# Claude Code hook formats used by `aq hook` Checked against Claude Code 2.1.319 on 2026-11-07. Facts from the docs link to the source. Facts from real runs say so and give the timings. Sources: - Hooks reference: - CLI reference: ## Common input (all events) Each hook gets one JSON object on stdin. Fields shared by every event ([hooks: common input fields](https://code.claude.com/docs/en/hooks#common-input-fields)): `session_id`, `prompt_id` (absent before the first prompt), `transcript_path`, `cwd`, `scratchpad_dir`, `permission_mode`, `effort`, `hook_event_name`, and `agent_id` / `agent_type` inside subagents. `aq hook` reads only the fields it needs and ignores the rest. Missing fields become empty strings. ## PreToolUse (step mode) Input ([hooks: PreToolUse input](https://code.claude.com/docs/en/hooks#pretooluse-input)): the common fields plus `tool_name`, `tool_input` and `tool_use_id`. For `Write`, `tool_input` is `{"file_path": "", "content": "..."}`. Seen in a real run (`aq hook pre-tool` forwarded this to the socket): ```json {"session_id":"8c35adc1-...","transcript_path":"/home/saman/.claude/projects/-tmp-aq-spike-deny-4kpu/8c35adc1-....jsonl", "cwd":"/tmp/aq-spike-deny.4kpu","tool_name":"Write","tool_use_id":"toolu_01DU...", "tool_input":{"content":"hi","file_path":"/tmp/aq-spike-deny.4kpu/x.txt"}} ``` Output ([hooks: PreToolUse decision control](https://code.claude.com/docs/en/hooks#pretooluse-decision-control)): ```json {"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"allow"}} {"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"deny","permissionDecisionReason":"..."}} ``` ### Option menus (AskUserQuestion) The same hook, with `AskUserQuestion` in its matcher, catches Claude's option menu before it shows. aq holds the call, shows the questions on a card, and answers by handing the input back with an `answers` object added ([hooks: tools that require user interaction](https://code.claude.com/docs/en/hooks)): ```json {"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"allow","updatedInput":{"questions":[...],"answers":{"":"