Skip to content

Composer: suggest the next prompt after Claude and Codex turns (Tab fills it) - #1216

Merged
sak0a merged 2 commits into
mainfrom
feat/composer-tab-completion
Nov 13, 2026
Merged

sak0a merged 2 commits into
mainfrom
feat/composer-tab-completion

Conversation

@sak0a

@sak0a sak0a commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Claude Code and Codex can both predict your next message after a turn (Claude Code's prompt suggestions, the Codex app's Tab suggestion). T3 Code shipped this as a Labs option (pingdotgg/t3code#28047). Ryco never showed either.

Now there is an opt-in setting, Suggest next prompt (Settings > Chat > Suggestions, a machine setting shared across devices, off by default). When it is on and a Claude or Codex turn completes, the empty composer shows the predicted next message with a Tab key hint. Tab fills it in (then edit or send), Escape hides it for that turn in every open composer.

How it works

  • Setting: promptSuggestions server setting, shareable since sharing version 2, with a promptSuggestions node capability so older nodes show the row disabled. Adapters read it live through readPromptSuggestionsSetting: Claude when a session opens (open Claude chats follow a change after a restart), Codex after every turn.
  • Claude: the Agent SDK promptSuggestions option. Its prompt_suggestion message arrives after result; it is tied to the turn that just finished (lastFinishedTurn) and dropped when that turn did not complete or a newer turn is already open. Claude Code itself skips the first turn, plan mode and turns near the usage limit.
  • Codex: after a completed root turn the adapter calls the experimental thread/sample (Codex 0.165+, Ryco already initializes with experimentalApi) on a hidden fork sharing the turn's prompt cache, effort: "low", same prompt as T3. Skips failed turns and turns started by /compact. Forked into the session scope and best effort: errors (old Codex, the user already sent again) are logged at debug.
  • Transport (differs from T3): T3 keeps suggestions in server memory and serves them on a new subscription. Here a new turn.prompt-suggestion runtime event is projected as one latest-state activity per thread (prompt-suggestion:<threadId>:latest, kind prompt.suggestion, compacted in the event log, coalesced live, hidden from the timeline). So it survives reloads and reconnects and reaches every client, Hub relay included, through the existing thread stream, with no new RPC.
  • Composer: derivePromptSuggestion offers it only while its turn is the thread's latest and completed. Not offered while running, sending or connecting, over approvals, questions or plan feedback, with an unavailable machine or terminal contexts, on the phone tier, or on devices without a fine pointer (Tab is the only way to accept). Tab goes through applyPromptReplacement like any insert, after onComposerIntent("type"). Shift+Tab (mode switch) and Tab in the //@ menu are unchanged. The editor now also routes Escape through its command plugin.

Verification

  • bun run check passes; bun run check:changed passed apart from two failures that reproduce without this change's code paths: 026_CanonicalizeModelSelectionOptions.test.ts (known local-only failure) and a mobile reactCompilerCoverage license-file rename race (passes alone).
  • New tests: Claude adapter (option only when on; suggestion tied to the finished turn, a mid-turn one dropped), Codex adapter (samples after completed turns and publishes; nothing for empty text, failed turns, the setting off, or /compact turns, the last checked to fail without its guard), ingestion projection, latest-state groups, normalization, selection, key handling, and a full-app browser test (suggestion + Tab hint shown, Tab fills it, Escape hides it and Tab then does nothing).
  • Live protocol check against Codex 0.167: thread/sample with these params returns { sourceTurnId, responseId, text, inputTokens, cachedInputTokens, outputTokens }; one sample on a tiny thread used ~22.6k input tokens (18.5k cached) and 18 output tokens. Claude's path was not run against the real CLI.

Not included

  • Agent Control child threads are not skipped (T3 skips delegated threads): adapters cannot tell them apart today, so with the setting on they also sample after each turn.
  • The native iPhone app does not show suggestions (no Tab key; would need a tap control).

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…ills it)

Opt-in "Suggest next prompt" setting (Settings > Chat, shared across devices).
After a completed Claude or Codex turn the empty composer shows the
provider's predicted next message with a Tab hint; Tab fills it in, Escape
hides it for that turn.

- Claude: the Agent SDK's promptSuggestions option; its prompt_suggestion
  message is tied to the turn that just finished, and dropped once a newer
  turn opened.
- Codex: the experimental thread/sample request (0.165+) after each completed
  root turn, skipping failed and /compact turns; failures are quiet.
- Kept as one latest-state activity per thread (prompt.suggestion), so it
  survives reloads and reconnects and reaches every client; hidden from the
  timeline and compacted in the event log.

Ported from T3 Code's Labs option (pingdotgg/t3code#28047).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XL labels Nov 13, 2026
… boot path

- Migration 026 wraps each json_group_array subquery in json(...). SQLite
  3.54 (CI's Node 24.22.3) no longer carries the JSON subtype out of a scalar
  subquery, so json_set stored the canonicalized options as a string and
  026_CanonicalizeModelSelectionOptions.test.ts failed.
- Runtime ingestion spells out the prompt.suggestion kind instead of importing
  @ryco/shared/promptSuggestion, which moves that module out of the boot chunk
  (-0.76 KB); the ingestion test checks it against the shared constant.
- Server boot cap 7,316,000 for what every boot needs of prompt suggestions
  (measured 7,314,409).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sak0a
sak0a merged commit 21c3454 into main Nov 13, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant