Skip to content

Chat: the composer shows Claude Code's suggested next prompt (#727, D281) - #733

Merged
contursofran merged 12 commits into
mainfrom
agent/727-prompt-suggestion
Nov 11, 2026
Merged

contursofran merged 12 commits into
mainfrom
agent/727-prompt-suggestion

Conversation

@contursofran

Copy link
Copy Markdown
Owner

Fixes #727

Source (step 1)

  • Claude Code makes the suggestion with the transcript off (skipTranscript), so it is not in the session file. It goes to the output stream only in -p/SDK mode.
  • terminal.read gives text only, with no styles.
  • A real session in a scratch core (haiku, trust prompt, one turn) drew the suggestion as ❯ ESC[0m ESC[2mcommit this ESC[0m: faint text (SGR 2) after the prompt mark. A sent prompt is not faint (it has a background color).
  • The MyGo terminal's Snapshot() gives the screen as escape sequences and keeps the faint attribute. So contr reads the real dim attribute and does not guess from plain text.

Steps

  1. internal/prompt.Suggestion: the text after the last ❯, only when all of it is faint.
  2. ghostty.Options.OnOutput: called as the plugin takes output.
  3. Frame (internal/app/nextprompt.go): 300 ms after output, off the UI thread, it reads the tail of Snapshot() and posts a change. Chat.NextPrompt gives the result to the composer.
  4. Composer: while the field is empty, the suggestion is the placeholder. Tab or Right takes it (after the slash popup's Tab). Enter on an empty field sends nothing. Typing hides it. A new turn clears the input line, so it goes.
  5. Docs: ChatView.md Composer and D281. Spec sheet part. chat-next see fixture (the fake claude got an idle:next= state).

Tests

  • TestSuggestion: suggestion, faint with a color, none, typed text, faint that ends, stale after a new prompt, menu choice, bad escape.
  • TestComposerShowsTheNextPrompt, TestComposerTypingHidesTheNextPrompt, TestComposerWithoutNextPromptShowsThePlaceholder.
  • TestOnOutputIsCalledForEachTakenOutput.
  • scripts/see.sh chat-next dark|light: the composer shows "commit this and open a PR" from the fake terminal's faint line.

Pre-check

  1. Tests: these failed with the change undone: TestSuggestion (faint check), TestComposerShowsTheNextPrompt (hint, and separately the Tab insert), TestOnOutputIsCalledForEachTakenOutput.
  2. Plan: all steps are done. Right as well as Tab comes from the issue text.
  3. Contract: no Contract section.
  4. Up to date: main is merged in (D282 conflict resolved; both rows kept). Chat: @ in the composer completes file paths (#708, D279) #732 (Chat: autocomplete file paths with @ in the composer #708) also changes composer.go and may conflict near textKey.
  5. Diff read: there are no leftovers.
  6. Coverage: all acceptance lines of the issue are done.
  7. Duties: nothing is removed.
  8. Evidence: sheets and see PNGs were made after the last code commit. scripts/check.sh passes.

@contursofran
contursofran marked this pull request as ready for review November 11, 2026 18:30
@contursofran
contursofran merged commit aaa8d64 into main Nov 11, 2026
3 checks passed
@contursofran
contursofran deleted the agent/727-prompt-suggestion branch November 11, 2026 18:40
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.

Chat: show Claude Code's prompt suggestion in the composer

1 participant