feat(terminal): show Claude Code's prompt suggestion as a tap-to-send chip - #1126
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
RonenMars
added a commit
to RonenMars/threadbase-streamer
that referenced
this pull request
Sep 19, 2026
## Summary
Claude Code paints a predicted next prompt as dim text in its input line, for example `add type hints and a docstring`.
The rendered text is identical to text the user typed, so the text scrape could not tell them apart and mobile showed it as a sent message.
This reads the composer row's cell attributes instead and reports the text only while every cell after the prompt glyph is dim.
## Wire
- New WS frame `prompt_suggestion`: `{ sessionId, text: string | null, updatedAt }`, sent to that session's subscribers only.
- New always-present session field `promptSuggestion: string | null`, so a reconnecting client sees the current value.
- It is set only while the session is `waiting_input` and cleared when input is sent or the status leaves `waiting_input`.
- Claude only. Codex and Cursor dim placeholder text that is not a prediction.
Additive, so old clients ignore both.
The `pty-host` protocol version is not bumped, because a bump makes `connect()` shut down a surviving host and its sessions, and an older streamer ignores an unknown event.
## How it is detected
The suggestion is emitted as `ESC[2m … ESC[22m` (SGR 2), verified against Claude Code v2.1.278.
The scan runs on that escape even inside the 300 ms scrape throttle, because a `waiting_input` session has no quiet re-scan and would otherwise miss it.
It also keeps scanning while a suggestion is shown so its clearing is seen.
## Verification
- `npm run lint` and `npm test` pass (3255 tests).
- Mutation-checked: removing the dim check fails the four not-dim tests, and removing the throttle bypass fails the throttle-window test.
- Not run against a live phone yet.
## Related
Mobile half: RonenMars/threadbase-mobile#1126
… chip Claude Code predicts the next prompt and paints it dim in its input line. The streamer now reports it as a prompt_suggestion frame and a promptSuggestion session field. Show it as a chip above the composer: tap sends it through the normal send path, long-press puts it in the composer to edit. Hide the duplicate ghost row from the terminal view, but only when it matches the suggestion exactly. An older streamer sends neither the frame nor the field, so nothing renders for it.
RonenMars
force-pushed
the
feat/prompt-suggestion
branch
from
September 19, 2026 22:51
9a190d1 to
00adafa
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Claude Code predicts the next prompt and paints it dim in its input line, for example
add type hints and a docstring.This shows it as a chip above the composer.
❯ …row, but only when it matches the suggestion exactly.Wire
Consumes the
prompt_suggestionframe and thepromptSuggestionsession field from the streamer PR below.The session query is the single source of truth: REST seeds it and frames are merged into it, so a reconnect refetch cannot disagree with a live frame.
An older streamer sends neither, so nothing renders.
Verification
tsc, eslint, i18n and all three jest suites (unit, integration, e2e) pass.Not run on a device or simulator yet, and the
test:scriptsand Maestro suites were not run.The Arabic, Hebrew and Russian strings are machine-written and need a native review.
Known limits
LiveConversationViewreplaces the session cache onsession_update, so it relies on the streamer always sendingpromptSuggestion, which it does.Related
Streamer half: RonenMars/threadbase-streamer#946