feat: port next-prompt suggester from pi-prompt-suggester - #352
feat: port next-prompt suggester from pi-prompt-suggester#352burningportra wants to merge 2 commits into
Conversation
Add a first-class Grok CLI port of Guido Witt-Dörring's pi-prompt-suggester (MIT): project-intent seed, per-turn next-prompt guess, steering history, and /suggester commands. Adapted from https://github.com/guwidoe/pi-prompt-suggester Copyright (c) 2026 Guido Witt-Dörring
Contributor License AgreementThe following contributors need CLA coverage: |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 3 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit bff96b5. Configure here.
| epochRef.current += 1; | ||
| setSuggestion(null); | ||
| suggestionRef.current = null; | ||
| }, []); |
There was a problem hiding this comment.
Cancel aborts background seeder
High Severity
cancel aborts the in-flight project seeder and clears seedPendingRef. Every interactive submit calls cancel, so the multi-step seed started by ensureSeed is routinely killed and never retried until a later staleness interval. The background intent seed often never lands for early turns.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit bff96b5. Configure here.
| cwd, | ||
| ); | ||
| const text = result.success ? result.output || "No matches found." : result.error || "grep failed"; | ||
| return cap(text, 4000); |
There was a problem hiding this comment.
Grep bypasses workspace confinement
High Severity
ls, find, and read go through confinePath, but grep forwards path straight to executeGrep. Absolute or .. paths can search outside the workspace. Matches can enter seeder history and the stored seed, then be sent to the API in later prompts.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit bff96b5. Configure here.
| }); | ||
| }, | ||
| [persistState], | ||
| ); |
There was a problem hiding this comment.
Stale suggestion steering recorded
Medium Severity
recordSubmit always scores against lastSuggestion and never clears it after use. applyResult also keeps the prior lastSuggestion when the new result is null. Queued follow-ups and later turns with no suggestion are misclassified as course changes, polluting RecentUserCorrections.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit bff96b5. Configure here.
Move next-prompt suggestions behind a plugin host. /install suggester enables the bundled plugin; /install owner/repo fetches a GitHub plugin.json + JS entry. Also brand this checkout as grok-kev and keep the TUI wiring that the host depends on.


Summary
Adds a first-class next-prompt suggester to the interactive TUI, ported from pi-prompt-suggester by Guido Witt-Dörring (MIT).
This is a Grok CLI / OpenTUI rewrite, not a drop-in of the Pi extension. After each interactive turn it predicts the user's likely next prompt (auto-inserts by default), keeps a background project-intent seed, and records whether the user accepted or rewrote the guess.
Credit and license text for the original work are in
NOTICE.md,LICENSE,src/suggester/README.md, and file headers.Attribution
Usage
/suggesteris status/settings only)/suggester reseed,/suggester instruction set …,/suggester auto|ghost--promptis unchangedTest plan
bun run typecheckbunx vitest run src/suggester src/ui/slash-menu.test.ts/suggestershows seed/status/suggester offstops extra callsNote
Medium Risk
Adds background Grok API calls on every interactive turn (plus seeder runs) and new TUI input/key paths in the main prompt loop; failures are mostly silent but increase cost and surface area in
app.tsx.Overview
Adds a next-prompt suggester to the interactive TUI: after each local turn it predicts a likely follow-up user message, optionally auto-inserts it into the empty editor (default), or shows it as a dim ghost with Space/right to accept and Esc to dismiss—never auto-sends.
The feature is a Grok CLI rewrite of pi-prompt-suggester (MIT attribution in
NOTICE.md,LICENSE, and module headers). Newsrc/suggester/implements a two-stage pipeline: a background seeder (read-only repo exploration via ls/find/grep/read, persistedseed.jsonunder~/.grok/prompt-suggester/) and a per-turn suggester call (grok-3-miniby default) using turn context, intent seed, and steering when the user accepts or rewrites suggestions./suggestercommands, slash-menu entry, and optionalsuggesterblock inuser-settings.jsoncontrol on/off, auto vs ghost, reseed, models, and custom instructions.usePromptSuggesterwires turn completion, submit recording, and key handling intoapp.tsx. Headless--promptmode is unchanged.package.jsonadds agrok-devbin alias.Reviewed by Cursor Bugbot for commit bff96b5. Configure here.