Skip to content

feat: port next-prompt suggester from pi-prompt-suggester - #352

Open
burningportra wants to merge 2 commits into
superagent-ai:mainfrom
burningportra:feat/prompt-suggester
Open

feat: port next-prompt suggester from pi-prompt-suggester#352
burningportra wants to merge 2 commits into
superagent-ai:mainfrom
burningportra:feat/prompt-suggester

Conversation

@burningportra

@burningportra burningportra commented Aug 16, 2026

Copy link
Copy Markdown

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

  • Runs automatically after each interactive turn (/suggester is status/settings only)
  • /suggester reseed, /suggester instruction set …, /suggester auto|ghost
  • Never auto-sends
  • Headless --prompt is unchanged

Test plan

  • bun run typecheck
  • bunx vitest run src/suggester src/ui/slash-menu.test.ts
  • Interactive: finish a turn, confirm next prompt is filled
  • /suggester shows seed/status
  • /suggester off stops extra calls

Note

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). New src/suggester/ implements a two-stage pipeline: a background seeder (read-only repo exploration via ls/find/grep/read, persisted seed.json under ~/.grok/prompt-suggester/) and a per-turn suggester call (grok-3-mini by default) using turn context, intent seed, and steering when the user accepts or rewrites suggestions.

/suggester commands, slash-menu entry, and optional suggester block in user-settings.json control on/off, auto vs ghost, reseed, models, and custom instructions. usePromptSuggester wires turn completion, submit recording, and key handling into app.tsx. Headless --prompt mode is unchanged. package.json adds a grok-dev bin alias.

Reviewed by Cursor Bugbot for commit bff96b5. Configure here.

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
@open-cla

open-cla Bot commented Aug 16, 2026

Copy link
Copy Markdown

Contributor License Agreement

The following contributors need CLA coverage:

Review and sign the CLA

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 3 potential issues.

Fix All in Cursor

❌ 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;
}, []);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Fix in Cursor Fix in Web

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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit bff96b5. Configure here.

});
},
[persistState],
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Fix in Cursor Fix in Web

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant