Skip to content

Next prompt

  • Use it for: Offer one automatic next step or a verified requested prompt/slash-command handoff, without a separate generation request.
  • Enable: Select packages/pi-next-prompt/src/index.ts with pi config.
  • Controls: /next-prompt status/on/off and trace [page]; Tab/Right accept into an empty focused main editor, never submit.
  • Settings: next-prompt.json shared/user/project layers; enabled, Tab/Right, no length limit (maxChars, 0); Jev timeout 1500 ms, threshold 0.6.
  • Requirements, cost & privacy: Pi 1.0+ TUI; normal input/output tokens for suggestion instruction; the optional classifier sees suggestion/request/answer excerpts.
  • Integrations & limits: Optional Vim/select-nav and interactive-shell inspection. Model-only offer_prompt/offer_terminal return successful queued retention behind drafts or acknowledge actual rendered suggestions; prompt offers need no shell support, and ordinary tags retain optional classifier vetting. Missing classifier shows unvetted tags; failed/aborted runs clear still-unaccepted offers. Suggestions are not authorization.

Next prompt offers a likely follow-up after a completed run. Automatic suggestions are deliberately selective: a finished task, an unresolved question or several equally plausible directions should produce no suggestion. Explicit requested handoffs use a verified tool instead of this heuristic. All offer types—automatic tags, external offers and explicit prompt/terminal handoffs—live underneath your draft without overwriting it. Accepting text never sends it automatically.

The global System 1 configuration (/system1) sets an ordered chain of Jev and native OpenAI Decisions (Jev only by default). The legacy jev settings still control this feature, including its enabled flag and timeout; provider/model overrides apply only to Jev. Decisions requires pi-system1 and its isolated API credential; it uses API billing, not subscription OAuth. Pi does not verify credit funding. Operational failures can advance to the next configured backend with a notification; valid judgments and safety refusals do not trigger failover.

Use Install & select and select packages/pi-next-prompt/src/index.ts. The suite loads every entry by default and uses one Git pin for every selected component. This extension requires Pi 1.0 or newer; use the installation guide’s tested version for the suite as a whole.

Suggestions need Pi’s interactive terminal UI. Print mode, RPC hosts and ordinary headless subagents receive no suggestion instruction, even when an RPC host reports UI support. No companion extension is required, and classification is optional rather than a prerequisite for showing text.

The main model receives an additional prompt section and may emit a tag or call offer_prompt/offer_terminal for a suggestion. There is no separate generative request. Optional validation is an external classifier call that can incur charges, however, so “no extra generation” does not mean “no extra model cost.”

An ordinary tag suggestion appears as dim text in an empty editor after successful settlement and optional vetting. An explicit prompt or terminal offer can render during the response and can be copied immediately once render-acknowledged. Press Tab or Right to copy it into an editable draft, then review, edit and send it normally; acceptance never submits. With pi-stash and nothing stashed, Ctrl+S moves the acknowledged suggestion into the stash instead, even during the response, so it comes back like a stashed draft. Interactive commands still require waiting for the current operation to finish before pressing Enter to run them. For example, a suggestion to run a specific test should remain an editable proposal, not permission to execute that test without your next message.

Typing conceals any offer without discarding it, even before its first render or while busy. A preexisting draft stays byte-for-byte unchanged and the suggestion waits underneath it; explicit tools return successful queued retention rather than rejecting that draft. Clear or stash the draft with pi-stash’s Ctrl+S to reveal the suggestion. The live editor’s onChange callback handles edits, programmatic clearing and stash restoration without requiring another key; post-key reconciliation remains a compatibility fallback. Hidden offers cannot be accepted or taken into the stash. A new run, a submitted prompt, compaction, tree navigation, a model change or a session switch clears it. Failed and aborted runs do not show automatic suggestions and clear still-unaccepted explicit offers; a draft you already accepted is left unchanged.

The acceptance keys are intercepted only while a suggestion is offered, the editor is empty, and the focused component is the main prompt editor: not an editor embedded in a dialog, not while autocomplete is open, and, with pi-vim, only in an idle Insert or Normal state (not during a pending command, Visual mode or an EX line). Otherwise the focused component handles Right normally. With pi-select-nav, Tab accepts explicit completion or selects available task panels instead of triggering implicit file completion. A selected task panel keeps Tab for navigation, even if a new suggestion arrives. With pi-vim, accepting also moves the editor to Insert mode at the end of the text; it still does not submit.

The extension wraps rendering rather than replacing the editor. Editors drawing Pi’s software or hardware cursor, including pi-vim, can show inline ghost text. If no compatible cursor is drawn, the fallback is a dim line below the editor with an acceptance hint naming the first configured key.

When you ask the model to put ordinary text or a Pi slash command in your prompt, it should call offer_prompt({text}) with the complete exact text before claiming it is available. Prose or a <next> tag is not an explicit verified handoff. No interactive-shell extension or shell inspector is required.

The input is exactly one nonempty line. Blank input, leading/trailing whitespace, C0/C1 controls, line breaks and any text beginning ! are rejected; shell handoffs use offer_terminal. Quotes and internal spaces are preserved byte-for-byte, with no prefix or normalization. For example, /marimo new examples/viewer-demo.py is offered unchanged, not run by the tool. Slash names are not checked against a partial command registry. A positive maxChars rejects rather than truncates; visual clipping never shortens accepted text. Never include credentials.

The receipt has three outcomes:

  • queued is successful retention behind an existing draft, with the exact offered text and a reason, but no surface or acceptAfterTurn. It is not display or insertion. The model may say the suggestion is waiting underneath your draft and direct you to clear or stash it, never claim it is visible. Your draft is unchanged.
  • displayed means the ghost or fallback widget included the suggestion in actual component output within one second. It is not proof you saw it, not an editor insertion and not submission. Mounting or queuing alone is insufficient. Tab/Right copies it into an editable draft immediately once actually render-acknowledged, even during the response; Enter is a separate submission.
  • blocked is a tool error with a concrete reason. The model should state the blocker and print the complete text as a fallback without claiming display or insertion.

Neither the tool nor acceptance executes anything or overwrites a draft. Blockers include disabled suggestions, non-TUI or unattached UI, non-main focus or autocomplete, an existing external offer or a different outstanding explicit offer, invalid/overlong input, timeout, abort or reset—not an existing draft. Identical same-kind queued offers and acknowledged visible repeats are idempotent; a never-queued repeat still awaiting its first render is blocked as pending. Different text or kind cannot replace outstanding explicit ownership. Draft arrival conceals and retains it. Non-draft focus loss before successful settlement still invalidates outstanding ownership; reset, shutdown or unsuccessful settlement clears still-unaccepted offers, not an already accepted draft. A /reload between turns (for example pi-reload-all after a pin bump) carries an acknowledged or queued explicit offer into the reloaded instance, so it is still there. When an explicit offer leaves the editor without being accepted (your next message, reset or failed settlement), the next turn gets a hidden note telling the model it is gone, so it re-offers instead of claiming it is still in your prompt. An acknowledged offer suspends during temporary Sidebar focus after successful settlement and reappears when the empty main editor regains focus. Prompt offers have no shell-layout prerequisite.

Explicit offers bypass classifier vetting, outrank automatic tags and survive tagless or conflicting-tag final answers while still outstanding. They can render while busy and be accepted as soon as acknowledged. Accepting an explicit offer or taking it into the stash suppresses automatic suggestions for that run, so a later final tag cannot resurrect a conflicting offer even if the editor is empty again. A new run resets that suppression. Automatic tags otherwise remain optional, appear only after successful settlement and are vetted as configured. Prompt acceptance emits no shell-continuation signal; Enter uses Pi’s ordinary prompt/command handling. If blocked, the model should state the blocker and show the complete proposed text plainly without claiming an offer or insertion. This mechanism does not guarantee model compliance with those instructions.

With pi-interactive-shell enabled in a real terminal TUI, the model uses the model-only offer_terminal tool when direct human interaction is the next step, including requested manual tests after implementation and automated checks. Neither extension requires the other; next-prompt owns the suggestion UI and acceptance behavior.

The tool’s sole input is command: a raw, complete shell command, not an !i or !!i-prefixed suggestion. It preserves quotes and internal whitespace exactly, prepends !i , and never executes, submits or overwrites a draft. Blank, leading/trailing whitespace that Pi would strip on submission, control-character (other than line breaks) and prefixed input is rejected, as is a backslash followed by spaces before a line break. Line breaks are allowed: the model keeps a command of about 100 characters or fewer on one line and lays out a longer one over several ( \ continuations before &&, | and option groups, one statement per line inside a quoted sh -c script). Ghost text and the fallback widget show every line, and Tab/Right copies the command with its layout. A suggestion exceeding a positive maxChars is rejected, never truncated; width clipping of ghost text does not shorten the accepted command. Credentials never belong in suggestions.

The terminal tool uses the same three outcomes. queued successfully retains the exact !i -prefixed text behind your unchanged draft immediately, with a reason but no surface or acceptAfterTurn. Clear or stash that draft to reveal it without another key. The model may describe it as waiting underneath your draft, never as visible or inserted. Otherwise displayed acknowledges actual ghost or fallback output within one second, not that you saw or accepted it. Queuing or mounting alone is not display. blocked is an explicit tool error with a concrete reason and requires a plain-text fallback.

Blockers include disabled suggestions, non-TUI or unattached UI, non-main focus, missing interactive-shell support, unsupported inline layout, an existing external offer or a different outstanding explicit offer, and render timeout, abort or reset. A draft conceals and retains the offer, including before its first render or while busy. Non-draft focus loss before successful settlement still invalidates ownership; after successful settlement an acknowledged offer can suspend across temporary focus changes. Reset or shutdown clears it. Unsupported-layout errors include safe component names/counts, renderer mode and lookup reason, never command text, drafts or terminal output. Identical same-kind queued or acknowledged visible offers are idempotent, not replacements; different text/kind and external ownership remain conflicts.

Explicit terminal offers bypass classifier vetting, outrank automatic tags and survive a final answer without a tag while still outstanding. Once render-acknowledged, press Tab or Right to copy the suggestion into an editable draft immediately, even while the agent is busy. Review it and wait for the current operation to finish before pressing Enter yourself to run it. Acceptance never runs or submits it, and interactive-shell rejects busy submissions without queuing or retrying them. Failure or abort clears still-unaccepted offers, but does not retract an accepted draft. If you submit an accepted model-suggested !i draft exactly unchanged, the agent continues automatically on success, failure or cancellation. After a failure the recorded result includes the last terminal lines, so the agent diagnoses the error and offers a fix; keystrokes are never recorded. Manual, edited, externally offered and !!i commands do not automatically resume the agent; send another prompt to continue.

The explicit prefix opens a focused inline terminal in the chat transcript, roughly half the terminal height, without auto-detecting commands. It temporarily replaces the editor while running; every inline command restores editor text and focus immediately on exit, without an Enter/Esc dismissal. Program keys, including Tab and Esc, reach the running command; Ctrl+] prefixes panel controls, including live scrolling. In fullscreen mode, wheel/trackpad input inside the live panel scrolls its rows rather than the outer chat; regular mode uses the keyboard controls. The panel stays in transcript flow, not pinned to the viewport. New agent requests wait for the live handoff to finish, not for the retained snapshot to disappear.

After exit, a static head-and-tail frame remains in chat, with … N rows omitted … when needed. These are retained screen rows, including blanks; the head is bounded by xterm’s 1,000-line scrollback and may not include the original beginning. Very short panels show only the bottom viewport. Scrolling inside the terminal is live-only; revisit the snapshot with Pi’s transcript navigation. The snapshot is memory-only, can contain sensitive text, and can disappear on transcript clear/rebuild, reload, session switch or exit. It is not written to session history or model context, but external recording is still possible.

Interactive-shell is inline-only. If Pi’s private transcript layout is not recognized, it returns an explicit command-not-run error before starting a process: there is no overlay fallback or automatic continuation. /interactive-shell status reports availability, layout diagnostics and the most recent actual handoff path without starting a command. See the interactive-shell reference for controls, requirements and privacy limits.

  • /next-prompt or /next-prompt status shows a human-readable notification of at most eight logical lines, which may wrap to the terminal width, without suggestion text. It distinguishes concealed retention, pending rendering and actual acknowledged output, and covers enabled/UI, main focus and draft, turn and acceptance readiness, the last explicit offer outcome, pre- and post-settlement component-output observations tied to offer IDs, automatic tag/vetting state, and a trace hint.
  • /next-prompt trace [page] shows a numbered, text-free lifecycle trace, four events per page. The newest page comes first; events within each page are chronological. A bare trace freezes a new in-memory snapshot; numbered pages reuse it, capturing one first if none exists. Invalid or out-of-range pages produce a usage or range message. The single snapshot and the live 32-event ring survive ordinary turns and reset on session replacement.
  • /next-prompt on enables suggestions for the session, subject to settings.
  • /next-prompt off clears the suggestion and stops adding the instruction for subsequent runs.
  • Any other argument shows a usage warning.

Diagnostics make no model calls or files, and inspection does not render the editor/widget or create an acknowledgement. Inclusion in component output is not proof that you saw or accepted an offer. Typing a diagnostic command can itself hide an offer; preceding evidence remains in the trace.

Files merge in order: ~/.config/agents/next-prompt.json, ~/.pi/agent/next-prompt.json, <project>/.agents/next-prompt.json, then <project>/.pi/next-prompt.json. Shared user settings honor $XDG_CONFIG_HOME. Objects merge, while arrays and scalar values replace earlier values. A value whose type does not match the default (for example a string where a number belongs, or a non-finite number) is ignored.

This project .pi/next-prompt.json keeps the default acceptance keys and length while disabling classifier validation:

{
"enabled": true,
"acceptKeys": ["tab", "right"],
"maxChars": 0,
"jev": { "enabled": false }
}

Acceptance keys use pi-tui key identifiers, such as tab, right or ctrl+f. When enabled, Jev defaults to provider typesafe, model jev-latest, timeout 1,500 ms and acceptance threshold 0.6. Pi supplies credentials, normally TYPESAFE_API_KEY for TypeSafe.

For ordinary nonterminal suggestions, the main model writes a final <next>...</next> line under the added instruction; explicit requested text/slash handoffs use offer_prompt, and shell handoffs use offer_terminal. Explicit offers bypass classifier vetting; their tool inputs and receipts use ordinary tool-call history rather than stripped tag lines. The extension strips recognized tag lines at message_end before storing the assistant response, keeping them out of the saved answer and later conversation context. The tag may briefly be visible during streaming. Once you accept and send a suggestion, it is naturally an ordinary user message.

For an ordinary tag candidate (not an explicit prompt or terminal offer), the selected classifier receives the suggestion itself, up to 1,500 characters of the latest user prompt and up to 2,000 characters from the end of the assistant answer. Those excerpts may contain private project details. The classifier checks whether the proposal is concrete, relevant and not already completed; this is not a safety or authorization check.

A probability below 0.6 hides the proposal by default. Disabled classification, missing credentials, timeouts or missing answers show the proposal anyway. There is no classifier request when the main model supplies no candidate. /next-prompt status helps distinguish a rejected candidate from one shown without validation.

An extension can offer a next prompt over Pi’s event bus with prompt:offer { source, text }, and withdraw it with { source } and no text. An offer is accepted only while Pi is idle and never replaces the model’s own suggestion. It waits underneath an existing or later draft and reappears when that draft is cleared or stashed, without another key. It goes through no classifier check and is cleared by your next prompt, and nothing is sent. Unlike offer_prompt/offer_terminal, which can display during a response and be accepted into a draft immediately after render acknowledgement, busy-time external offers are dropped; they do not provide the tool’s render acknowledgement or model-authored command continuation. Neither explicit tool overwrites an existing external offer. pi-marimo uses it when you make a new marimo-lens selection.

There is one retained suggestion slot, not a history stack. Concealed offers add no hidden rows or permanent widget, and a hidden suggestion is not a stashed draft or a new footer control.

A suggestion is model-authored and can still be wrong or redundant, even after validation. It cannot know which of several unstated priorities you prefer. Do not expect a suggestion after every turn, and review accepted commands or requests before sending them.

For editor or key conflicts, consult Troubleshooting. The source and tests cover tag processing, editor behavior, lifecycle clearing and classifier fallback.

Your saved sessions do not keep suggestions, so the repository’s vet eval scores the vet on your real next messages instead. For each assistant turn you answered, it asks the vet once with your real next message as the suggestion and once with a message from another session, then reports how many real messages pass the 0.6 threshold, how many mismatched ones are hidden, and the real messages the vet scored lowest, which it would have hidden. It makes live, paid classifier requests, so it runs only on request (npm run -s eval -- vet from a checkout; --dry counts the requests first).