acpmux: show suggested next prompts only while they tend to be taken (Codex has none natively)

TE
2d ago
+485-2

Leo, 2026-11-03: "that suggested prompting from Codex, we need to have that as well. We need to make sure we have that."

Does Codex provide suggestions?

No. The Codex app-server protocol has no follow-up or next-prompt suggestion: the schema codex app-server generate-json-schema writes (stable and --experimental, codex-cli 0.164.0) has nothing of the kind (the only "suggest" names are plugin install suggestions and the multi-agent followupTask tool kind), and the codex binary carries no such strings. So acpmux's Codex bridge has nothing to translate. The fallback for Codex is the next-step box's own buttons (#34360's wrap_up actions): once #34360 lands, a follow-up feeds its first action into this same prompt_suggestion path with _meta.acpmux.source: "wrap_up", so it shares the composer ghost text and this gating. This PR builds the gating that every source goes through.

Gating (Cursor Tab's lesson: only show what is likely to be taken)

New cmux-tui/crates/acpmux/src/suggestion_gate.rs, in the hub, for every harness:

  • Where: the hub tap, on each live prompt_suggestion update before it is recorded. A withheld one goes on with suggestion: null (so the composer clears any old one) and _meta.acpmux.suggestionWithheld {source, estimate}.
  • Counting: one tally per harness and source (claude/harness today, codex/wrap_up next). A shown suggestion counts as taken when the person's next prompt is that text (whitespace aside), or when the composer marked the send _meta.acpmux.promptSuggestion: "taken", which it does after Tab or Right-arrow took it into the field (so an edited take still counts). Any other next prompt from the person counts as passed over. Another agent's message or the agent taking it back (null) counts as neither.
  • Estimate: a Beta(3,3) prior (a new install starts at 50%, so it still sees suggestions; a single pass never withholds; about seven straight passes do), with older outcomes decayed by 0.97 per outcome so a change of habit shows. Under 25% the suggestion is withheld. While withheld, one in eight is shown anyway, so a source can climb back.
  • Persisted: ~/.acpmux/prompt-suggestions.json (atomic write after each outcome); missing or unreadable starts from the prior.
  • Webview: AcpmuxDirectClient.takeSuggestion() (Composer's new onSuggestionTaken, wired in App) marks the next send. No new ACP method: the mark rides the prompt's existing _meta.acpmux.

On by default, never in Labs; the existing agents.promptSuggestions setting and per-chat option still turn suggestions off entirely.

Tests

  • Rust (cargo test -p acpmux --lib suggestion_gate): prior, takes and passes, one pass never withholds, run of passes does, exploration 1-in-8, recovery through decay, next-prompt answering (exact, whitespace, marked edit, different), withdraw and withheld record nothing, per-harness/source/chat keys, withheld update shape, persistence across restart and unreadable file.
  • Webview (test/agent-pane-prompt-suggestion.test.ts): a send after takeSuggestion carries promptSuggestion: "taken" and the next does not; a take with nothing shown marks nothing.

Follow-up: the Codex wrap_up source and its gallery/mock fixture after #34360 merges.

Agent session: agent session

🤖 Generated with Claude Code


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


Summary by cubic

Gates acpmux's prompt-suggestion preview so a harness's predicted next prompts reach the composer only while they tend to be taken, instead of always showing them.

Gating

  • The hub tallies takes vs passes per harness and source; a withheld suggestion goes on as null so the composer clears the previous one.
  • Acceptance is estimated with a Beta(3,3) prior and 0.97 decay; below 25% a suggestion is withheld, with one in eight still shown so a source can recover. Tallies persist to ~/.acpmux/prompt-suggestions.json.

Taking

  • The composer marks the next send when the person takes a suggestion into the field (Tab or Right-arrow), so an edited take still counts; no new ACP method.
  • On by default; the existing agents.promptSuggestions setting and per-chat option still disable suggestions entirely.
  • Codex has no native suggestions; this gate is the shared path for the upcoming Codex wrap_up source.