[DOCS] Hooks reference missing AskUserQuestion PreToolUse answer flow
Documentation Type
Missing documentation (feature not documented)
Documentation Location
https://code.claude.com/docs/en/hooks
Section/Topic
PreToolUse tool input and decision-control reference, with a related cross-reference from the headless (claude -p) docs
Current Documentation
The docs currently say:
In the hooks reference: Runs after Claude creates tool parameters and before processing the tool call. Matches on tool name:Bash,Edit,Write,Read,Glob,Grep,Agent,WebFetch,WebSearch, and any MCP tool names`.
Later on the same page:PreToolUsehooks can control whether a tool call proceeds. Unlike other hooks that use a top-leveldecisionfield, PreToolUse returns its decision inside ahookSpecificOutputobject. This gives it richer control: three outcomes (allow, deny, or ask) plus the ability to modify tool input before execution. |permissionDecision|"allow"skips the permission prompt."deny"prevents the tool call."ask"prompts the user to confirm. | |updatedInput| Modifies the tool's input parameters before execution. Combine with"allow"to auto-approve, or"ask"to show the modified input to the user |
The tools reference separately says: | AskUserQuestion | Asks multiple-choice questions to gather requirements or clarify ambiguity | No |
The headless page says: This page covers using the Agent SDK via the CLI (claude -p). For the Python and TypeScript SDK packages with structured outputs, tool approval callbacks, and native message objects, see the full Agent SDK documentation.
No code.claude.com page currently explains how AskUserQuestion can be satisfied through PreToolUse in a headless integration.
What's Wrong or Missing?
Changelog v2.1.85 says:
PreToolUse hooks can now satisfyAskUserQuestionby returningupdatedInputalongsidepermissionDecision: "allow", enabling headless integrations that collect answers via their own UI
A. The hooks reference does not tell users that AskUserQuestion now reaches PreToolUse
The current PreToolUse section lists several tool names, but not AskUserQuestion. Users reading the hooks docs cannot tell that this tool can now be intercepted and answered programmatically.
B. The required answer payload is undocumented on code.claude.com
The hooks docs explain updatedInput generically, but they never show the AskUserQuestion-specific shape: the original questions array plus an answers object mapping each question text to the selected label or labels.
C. The headless docs do not explain the non-interactive clarifying-question flow
The claude -p page points readers to the Agent SDK docs in general, but it does not say that clarifying questions can now be satisfied programmatically in headless runs instead of requiring an interactive Claude Code prompt.
Suggested Improvement
Add a short AskUserQuestion subsection to the hooks reference and cross-link it from the headless docs.
Suggested content:
AskUserQuestioncan also triggerPreToolUse. To satisfy it programmatically, returnhookSpecificOutput.permissionDecision: "allow"together withupdatedInputcontaining the originalquestionsarray and ananswersobject. Eachanswerskey is the question text and each value is the selected option label (or comma-separated labels for multi-select questions). This letsclaude -pintegrations collect answers in their own UI and continue without an interactive prompt.
Also add a minimal JSON example showing the required questions pass-through and answers mapping.
Impact
Medium - Makes feature difficult to understand
Additional Context
Affected Pages:
| Page | Context |
|------|---------|
| https://code.claude.com/docs/en/hooks | PreToolUse input and decision-control docs omit AskUserQuestion matching and the required answer payload |
| https://code.claude.com/docs/en/headless | Headless integration docs do not mention programmatically satisfying AskUserQuestion in -p flows |
| https://code.claude.com/docs/en/tools-reference | AskUserQuestion is listed as a tool, but there is no cross-reference to hook-based handling for headless use |
| https://platform.claude.com/docs/en/agent-sdk/user-input | Agent SDK cross-reference already documents the question/answer structure, which the code-site hook docs should align with |
Total scope: 4 pages affected
Source: Changelog v2.1.85
Exact changelog entry:
PreToolUse hooks can now satisfyAskUserQuestionby returningupdatedInputalongsidepermissionDecision: "allow", enabling headless integrations that collect answers via their own UI
4 Comments
AskUserQuestion fires as a PreToolUse event. Handle it with:
---
Issue #39620 Verification
Title: [DOCS] Hooks reference missing AskUserQuestion PreToolUse answer flow
Issue Date: 2026-03-27
Verification Date: 2026-04-01
Status: PARTIALLY RESOLVED
---
Issue Summary
This issue reports that the Claude Code docs did not explain that
AskUserQuestioncan triggerPreToolUse, did not document the requiredquestionsplusanswerspayload for satisfying that tool programmatically oncode.claude.com, and did not explain or cross-reference that headlessclaude -pflow clearly enough from the headless and tools-reference pages.---
Verification Results
Claim 1: The hooks reference does not tell users that
AskUserQuestionreachesPreToolUseStatus: RESOLVED
At https://code.claude.com/docs/en/hooks, line 846:
Runs after Claude creates tool parameters and before processing the tool call. Matches on tool name: Bash, Edit, Write, Read, Glob, Grep, Agent, WebFetch, WebSearch, AskUserQuestion, ExitPlanMode, and any MCP tool names.Verdict: The hooks reference now explicitly states that
PreToolUsematchesAskUserQuestion.---
Claim 2: The required
AskUserQuestionanswer payload is undocumented oncode.claude.comStatus: RESOLVED
At https://code.claude.com/docs/en/hooks, lines 951-954 document
questionsandanswers, including:answers | object | {"Which framework?": "React"} | Optional. Maps question text to the selected option label. Multi-select answers join labels with commas. Claude does not set this field; supply it via updatedInput to answer programmatically.At the same URL, lines 962-964 document
updatedInput:Modifies the tool's input parameters before execution. Replaces the entire input object, so include unchanged fields alongside modified ones.At the same URL, line 983 states:
For AskUserQuestion, echo back the original questions array and add an answers object mapping each question's text to the chosen answer.Verdict: The hooks page now documents both the required
questionspass-through and theanswersmapping needed to satisfyAskUserQuestionprogrammatically.---
Claim 3: The headless docs do not explain the non-interactive clarifying-question flow
Status: UNRESOLVED
At https://code.claude.com/docs/en/headless, lines 15-21 state:
This page covers using the Agent SDK via the CLI (claude -p). For the Python and TypeScript SDK packages with structured outputs, tool approval callbacks, and native message objects, see the full Agent SDK documentation.At the same URL, lines 139-157 document
--allowedToolsand permission rule syntax, but the page does not explainAskUserQuestion,PreToolUse,permissionDecision, orupdatedInputfor non-interactive clarifying-question handling.Verdict: The headless page still defers this flow to broader SDK documentation instead of documenting it directly on the
claude -ppage.---
Claim 4: The tools reference does not cross-reference hook-based handling for
AskUserQuestionin headless useStatus: UNRESOLVED
At https://code.claude.com/docs/en/tools-reference, line 16 lists: `
AskUserQuestion| Asks multiple-choice questions to gather requirements or clarify ambiguity | No`.At the same URL, lines 120-125 only include a generic Hooks link in the see-also section:
Hooks: run custom commands before or after tool execution.Verdict: The tools reference still does not point readers to the specific
PreToolUseandupdatedInputhandling now documented elsewhere.---
Current State
| Claim | Status |
|-------|--------|
| Hooks reference does not tell users that
AskUserQuestionreachesPreToolUse| RESOLVED || Required
AskUserQuestionanswer payload is undocumented oncode.claude.com| RESOLVED || Headless docs do not explain the non-interactive clarifying-question flow | UNRESOLVED |
| Tools reference does not cross-reference hook-based handling for
AskUserQuestionin headless use | UNRESOLVED |---
Suggested Fix
Update https://code.claude.com/docs/en/headless with a short section explaining that
AskUserQuestioncan be satisfied inclaude -pviaPreToolUseby returningpermissionDecision: "allow"plusupdatedInputcontaining the originalquestionsarray and ananswersmapping. Add anAskUserQuestion-specific cross-reference from https://code.claude.com/docs/en/tools-reference to the hooks page or to https://platform.claude.com/docs/en/agent-sdk/user-input.---
References
PreToolUsehooks can satisfyAskUserQuestionwithupdatedInputandpermissionDecision: "allow"PreToolUsematcher list includesAskUserQuestionAskUserQuestioninput documentsquestionsandanswersupdatedInputbehavior is documentedAskUserQuestionin-p--allowedTools, but notAskUserQuestionhandlingAskUserQuestionis listed as a toolupdatedInputwith bothquestionsandanswers---
Conclusion & Recommendation
Primary Concern: The issue reported missing Claude Code documentation for answering
AskUserQuestionthroughPreToolUse, especially in headlessclaude -pworkflows.Resolution Status: PARTIALLY RESOLVED
Recommendation: KEEP OPEN
The core hooks-reference gap is now fixed:
AskUserQuestionmatching and the requiredquestionsplusanswerspayload are documented on the hooks page. The headless page and tools reference still do not surface this flow directly, so the overall issue remains partially resolved.---
Issue Summary
Issue #39620 reports that the hooks reference documentation is missing information about how
AskUserQuestioninteracts withPreToolUsehooks, specifically: (A)AskUserQuestionis not listed as a tool that reachesPreToolUse, (B) the answer payload shape is undocumented, and (C) the headless non-interactive clarifying-question flow is not explained.Verification Results
Claim 1:
AskUserQuestionnot listed as aPreToolUsetool match| Item | Detail |
|------|--------|
| Status | RESOLVED |
| Evidence |
hooks.md:960now reads: "Matches on tool name:Bash,Edit,Write,Read,Glob,Grep,Agent,WebFetch,WebSearch,AskUserQuestion,ExitPlanMode, and any MCP tool names." || Verdict |
AskUserQuestionis explicitly listed in thePreToolUsetool name matches. |Claim 2: Required answer payload is undocumented
| Item | Detail |
|------|--------|
| Status | RESOLVED |
| Evidence |
hooks.md:1061-1068adds a dedicatedAskUserQuestionsubsection underPreToolUse inputdocumenting bothquestions(array) andanswers(object mapping question text to selected label). Additionally,hooks.md:1099states: "ForAskUserQuestion, echo back the originalquestionsarray and add ananswersobject mapping each question's text to the chosen answer." || Verdict | The answer payload shape and usage instructions are fully documented. |
Claim 3: Headless non-interactive clarifying-question flow undocumented
| Item | Detail |
|------|--------|
| Status | RESOLVED |
| Evidence |
hooks.md:1099explains thepermissionDecision: "allow"+updatedInputpattern for satisfyingAskUserQuestionin non-interactive mode.hooks.md:1105-1119adds a full "Defer a tool call for later" section with a 5-step round-trip walkthrough specific toAskUserQuestionin headless integrations, including thedeferdecision and--resumeflow. || Verdict | The headless flow is comprehensively documented with both the direct-answer and defer-resume patterns. |
Current State
| Page | Status | Notes |
|------|--------|-------|
| Hooks reference | Updated |
AskUserQuestionlisted in tool matches, input fields documented, answer payload explained, defer flow added || Headless docs | Unchanged | No direct cross-reference to the hooks-based
AskUserQuestionflow, but the canonical documentation on the hooks page covers it || Tools reference | Unchanged |
AskUserQuestionlisted as a tool but no cross-link to hooks-based handling || Agent SDK user input | Already documented | Was already aligned per the issue |
Suggested Fix
No fix needed. All three core claims from the issue have been addressed in the hooks reference page, which is the canonical location for this documentation. Optional improvement:
headless.mdandtools-reference.mdcould add cross-links to the hooks reference'sAskUserQuestionsection, but this is a minor enhancement rather than a documentation gap.References
changelog.md:776Conclusion & Recommendation
| Item | Detail |
|------|--------|
| Primary Concern | Missing documentation for
AskUserQuestion+PreToolUseinteraction and answer payload || Resolution Status | RESOLVED — All three claims addressed in the hooks reference |
| Recommendation | Close as completed. Optional: add cross-links from
headless.mdandtools-reference.mdto the hooks referenceAskUserQuestionsection |This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.