Follow Discord
Sweep 10 Nov 2026 · 02:18Z Build v2.1.322 539 read Stable v2.1.311 Latest v2.1.322 Next v2.1.322 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One change · claude-code

Hooks reference changedhooks

Nearest release: v2.1.322, published 15 hours before upstream edited the page. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.

Upstream edited this page at 10 Nov 2026 17:24 UTC, give or take a minute or two: the time comes from Anthropic’s own sitemap rather than from a commit. This site recorded the change at 10 Nov 2026 17:37 UTC.

Upstream edited
Recorded here
Lines+6added
Lines−1removed
From line 899 where the diff opens
First seen 14 Aug 2026 this site's first read of the page
Recorded edits136to this page, all time

The whole hunk

from line 899, old and new numbered
/
lines

This page is larger than the 256 KiB this site keeps, so one side of the diff below stops where the stored text does.

from line 899
899899 
900900#### Hooks that start a background process
901901 
902A hook can start a long-running program, such as a dev server, and leave it running while the session continues. In the hook's script or [shell form](#exec-form-and-shell-form) command:
903 
904* Run the program in the background
905* Redirect its stdout and stderr. For example, the Bash command `npm run dev > dev-server.log 2>&1 &` sends both to a file. If you don't redirect them, a hook that isn't [async](#run-hooks-in-the-background) takes up to 10 seconds to finish after its own process exits.
906 
902907If your command hook makes its decision in a background process and exits, a deny that process prints after Claude Code has stopped reading doesn't block the tool call. For a hook that isn't [async](#run-hooks-in-the-background), Claude Code finishes reading the hook's output shortly after the hook's own process exits.
903908 
904Print the decision before you start a background process, and redirect that process's stdout and stderr. If your script prints an allow, then starts a background process without redirecting that process's stdout and stderr, Claude Code blocks the tool call. The hook error includes `refusing to honor the suspect capture`.
909Print the decision before you start a background process, and redirect that process's stdout and stderr. If your script prints an allow, then starts a background process without redirecting that process's stdout and stderr, Claude Code blocks the tool call. The hook error includes `stdio went quiet` and `refusing to honor the suspect capture`.
905910 
906911This `PreToolUse` hook script prints the decision with `policy-check.sh`, then uploads metrics in the background:
907912 
from line 3681
36763681 
36773682Runs when an MCP server requests user input mid-task. By default, Claude Code shows an interactive dialog for the user to respond. Hooks can intercept this request and respond programmatically, skipping the dialog entirely.
36783683 
3679For a complete hook with its settings entry and script, see [Answer a form request from a script](#answer-a-form-request-from-a-script).
3680 
3681The matcher field matches against the MCP server name.
3682 
3683#### Elicitation input
3684 
3685In addition to the [common input fields](#common-input-fields), Elicitation hooks receive `mcp_server_name`, `message`, and optional `mode`, `url`, `elicitation_id`, and `requested_schema` fields.
3686 
3687For form-mode elicitation, the most common case:
3688 
3689```json theme={null}
3690{
3691 "session_id": "abc123",
3692 "transcript_path": "/Users/.../.claude/projects/.../00893aaf-19fa-41d2-8238-13269b9b3ca0.jsonl",
3693 "cwd": "/Users/..."
3684For a complete hook with its settings entry and script, see [Answer a form request from a script](#answer-a-form-reque
Feedback