Skip to content

feat(chat): clickable clarifying questions in the host chat - #393

Merged
jrothrock merged 1 commit into
mainfrom
feat/chat-question-prompts
Sep 2, 2026
Merged

feat(chat): clickable clarifying questions in the host chat#393
jrothrock merged 1 commit into
mainfrom
feat/chat-question-prompts

Conversation

@jrothrock

Copy link
Copy Markdown
Collaborator

The host Claude chat can now ask the user a quick multiple-choice question that renders as one-click option chips; clicking one sends that choice as the next turn.

Why a convention, not the AskUserQuestion tool

I verified empirically that AskUserQuestion is auto-dismissed in headless claude -p mode — the CLI resolves it to an errored/empty result before any stdin answer can land, so it cannot be answered over the stream. Instead this uses a tiny fenced corral-question convention the chat is taught to emit, parsed client-side and rendered as chips. Plain prose still works; the block is stripped so nothing leaks.

Changes

  • chat.go: chatQuestionGuidance prepended on the first turn (page-independent; later turns inherit via --resume). Reaches every host chat — global dock, project, PR review.
  • ChatPanel + lib/chatQuestion.ts: parse the latest assistant message for the block when idle; render the question + option chips; a click sends the option (reuses the queue-aware sendPrompt).
  • Updated TestWithContextHint for the new first-turn prefix.

Verified

Mocked chat WS: the assistant's prose renders, the fenced block becomes clickable Staging / Production chips (raw block stripped), and clicking sends the option as the next turn (prompts_sent=["deploy the app","Production"]). Go tests + typecheck + build pass. Screenshot-confirmed.

🤖 Generated with Claude Code

The host Claude chat can now ask the user a quick multiple-choice question
that renders as one-click option chips; clicking one sends that choice as
the next turn.

Why a convention, not the AskUserQuestion tool: AskUserQuestion is
auto-dismissed in headless `claude -p` mode (verified — the CLI resolves it
to an errored/empty result before any stdin answer lands), so it can't be
answered over the stream. Instead we teach the chat a tiny fenced
`corral-question` convention (first-turn guidance in chat.go), parse it
client-side (lib/chatQuestion.ts), and render the options as chips. Plain
prose still works; the block is stripped so nothing leaks.

- chat.go: chatQuestionGuidance prepended on the first turn (page-independent;
  later turns inherit via --resume). Reaches every host chat (global/project/PR).
- ChatPanel: parse the latest assistant message for the block when idle;
  render question + option chips; a click sends the option (reuses sendPrompt).
- Updated TestWithContextHint for the new first-turn prefix.

Verified with a mocked chat WS: chips render, the raw block is stripped, and
clicking sends the option as the next turn.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jrothrock
jrothrock merged commit 8981e2c into main Sep 2, 2026
1 check passed
@jrothrock
jrothrock deleted the feat/chat-question-prompts branch September 2, 2026 22:56
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