npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

pi-ghost-text

v0.1.1

Published

Ghost-text prompt suggestions (inline autocomplete + next-prompt) for the pi coding agent

Readme

pi-ghost-text

Ghost-text prompt suggestions for the pi coding agent — like Claude Code's inline autocomplete for the prompt box.

As you type (or after the agent finishes and the input is empty), a dimmed prediction of the likely next prompt appears after the cursor. Accept it, cycle alternatives, or keep typing.

Requirements

  • Interactive TUI mode. Suggestions are an editor feature and only appear in the interactive terminal (pi with no mode flag). They do not run in -p/--print, --mode json, or --mode rpc.
  • A model with a configured API key. With the default "model": "auto", the extension scans the available models for a fast/cheap one, in priority order: haiku, then gpt-*mini, then flash, then nano. If none match — or if an explicit provider/model-id isn't found — it falls back to the active session model. Set a specific model with /suggest-model.

Install

pi install npm:pi-ghost-text

Remove it:

pi remove npm:pi-ghost-text

Using it

| Key | Action | |-----|--------| | Tab | Cycle to the next candidate; accept when it's the last (or only) one | | → (right arrow, cursor at end) | Accept the current suggestion | | Esc | Dismiss the ghost, keeping what you've typed | | Move the cursor away from the end | Dismiss | | Keep typing | Shrink the ghost while it still matches, otherwise regenerate |

Tab only applies to the ghost when the file/command autocomplete dropdown is not open. Accepting inserts the suggestion into the editor for you to edit; press Enter to send it.

When candidates is 1 (the default), Tab simply accepts. Set candidates to 2 or 3 to fetch alternatives and cycle them.

Commands

| Command | What it does | |---------|--------------| | /suggest | Choose mode: both, while-typing, after-turn, or off | | /suggest-model | Pick the suggestion model (or auto to prefer a fast, cheap one) | | /suggest-context | Set the context window (messages × chars per message) |

Configuration

Stored as JSON, resolved defaults ← global ← project:

  • global: ~/.pi/agent/prompt-suggestions.json
  • project: .pi/prompt-suggestions.json
{
  "model": "auto",
  "mode": "both",
  "candidates": 1,
  "streaming": true,
  "contextMessages": 8,
  "contextChars": 600,
  "maxPerTurn": 0,
  "debug": false
}

| Key | Default | Description | |-----|---------|-------------| | model | "auto" | "auto" (prefer a fast, cheap model) or an explicit provider/model-id | | mode | "both" | "both", "while-typing", "after-turn", or "off" | | candidates | 1 | Alternatives to fetch (1–3); Tab cycles them | | streaming | true | Stream the single suggestion token-by-token (ignored when candidates > 1) | | contextMessages | 8 | Recent messages included in the suggestion prompt (0 = none) | | contextChars | 600 | Chars kept per message | | maxPerTurn | 0 | Max suggestions shown per agent turn (0 = unlimited) | | debug | false | Append diagnostic lines to ~/.pi/agent/prompt-suggestions.log |

mode, model, contextMessages, and contextChars are settable from the commands above; candidates, streaming, maxPerTurn, and debug are JSON-only. Commands write to the global scope, so a project override in .pi/prompt-suggestions.json takes precedence over a command-set value.

Privacy

When enabled, the suggestion model receives only:

  • the text you have typed so far, and
  • the last contextMessages user/assistant messages, each trimmed to contextChars characters.

It is never sent:

  • the full conversation transcript,
  • tool outputs,
  • file contents,
  • project or session metadata.

Suggestions are advisory and best-effort; failures are never surfaced in the UI. With "debug": true they are logged to ~/.pi/agent/prompt-suggestions.log with a stable category (timeout / error / no-suggestion).

Troubleshooting

If no suggestion appears:

  1. Confirm the mode is not off — run /suggest.
  2. Confirm the suggestion model has an API key configured (or, for auto, that one of the fast/cheap models does). /suggest-model shows what's available. An explicit model that isn't found silently falls back to the active session model, so check the spelling as provider/model-id.
  3. While-typing suggestions need ≥4 chars of plain text (not starting with / or !, not an @file completion in progress), a ~700ms pause, and the agent must be idle (not mid-response).
  4. After-turn suggestions only appear when the editor is empty right after the agent settles.
  5. If maxPerTurn is set, you may have hit the per-turn cap.
  6. Set "debug": true and check ~/.pi/agent/prompt-suggestions.log for [prompt-suggestions] lines — they state the reason (timeout, error, no-suggestion).
  7. If the ghost flakes with streaming enabled, set "streaming": false to force the non-streaming path.

Development

npm test   # node --test, no dependencies (requires Node ≥ 23.6)

Prior art

Inspired by supi-prompt-suggestions. This adds inline while-typing autocomplete (prefix-anchored, shrink-on-type), multi-candidate cycling, streaming ghost text, scoped global/project config, and explicit modes on top of the empty-box next-prompt suggestion.