Skip to content

feat(terminal): show Claude Code's prompt suggestion as a tap-to-send chip - #1126

Merged
RonenMars merged 2 commits into
mainfrom
feat/prompt-suggestion
Sep 19, 2026
Merged

RonenMars merged 2 commits into
mainfrom
feat/prompt-suggestion

Conversation

@RonenMars

Copy link
Copy Markdown
Owner

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.

  • Tap sends it through the same path as the send button.
  • Long-press puts it in the composer and focuses it, without sending.
  • The chip hides while the composer has text or attachments, when input is disabled, and while a question card is open.
  • The terminal view hides the duplicate ghost ❯ … row, but only when it matches the suggestion exactly.

Wire

Consumes the prompt_suggestion frame and the promptSuggestion session 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:scripts and Maestro suites were not run.
The Arabic, Hebrew and Russian strings are machine-written and need a native review.

Known limits

  • A tap that fails to send still drops the chip; the existing send-failure alert shows.
  • A suggestion long enough to wrap onto two rows is not hidden from the transcript.
  • LiveConversationView replaces the session cache on session_update, so it relies on the streamer always sending promptSuggestion, which it does.

Related

Streamer half: RonenMars/threadbase-streamer#946

@vercel

vercel Bot commented Sep 19, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
threadbase-web Ignored Ignored Sep 19, 2026 10:51pm UTC

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
RonenMars force-pushed the feat/prompt-suggestion branch from 9a190d1 to 00adafa Compare September 19, 2026 22:51
@RonenMars
RonenMars merged commit 0da6006 into main Sep 19, 2026
25 checks passed
@RonenMars
RonenMars deleted the feat/prompt-suggestion branch September 19, 2026 22:54
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