You'll noticeTier: how much it should matter to you
2Useful: my rating, 1 to 5
2Signal: worth watching, 1 to 5
HooksArea: what it touches
ImprovementsKind: in v2.1.334,
ImprovementsSection of the release
Unclear It is unclear how a result of code 1 is treated, so it is unclear whether the hook still blocks the prompt.
What
A hook is a script you set up to run at a set moment. UserPromptSubmit hooks run when a prompt is submitted. An asyncRewake hook runs in the background. Exit code 2 is the number a hook returns to block what is happening.
When an asyncRewake hook on UserPromptSubmit exits with code 2, Claude Code now changes its result to code 1 in some cases, one of them tied to plugins. Before, the result was passed on unchanged.
Why
In these cases, a background hook's blocking exit code on prompt submission is no longer treated as it was before.
The entry above is what we published on the day. These lines were added later, as Anthropic's own pages caught up, and they sit beside the original rather than replacing it.
Confirmed sinceAnthropic's documentation has since written up UserPromptSubmit, on Intercept and control agent behavior with hooks.Claude Code runs each callback with a timeout, which you set in seconds with the `timeout` field on its `HookMatcher`. When you don't set one, Claude Code uses the event's default: 600 seconds for most events, 30 seconds for `UserPromptSub…agent-sdk/hookssee the edit
Added sinceA small documentation edit on Intercept and control agent behavior with hooks touched a line naming UserPromptSubmit after this was published.A `UserPromptSubmit` hook that spawns subagents can create infinite loops if those subagents trigger the same hook. You can prevent the loop in the following ways:agent-sdk/hookssee the edit
How sure we are
Something disagreesSomething we can check disagrees with this entry, or the writer said they could not settle it.
The writer flagged doubtIt is unclear how a result of code 1 is treated, so it is unclear whether the hook still blocks the prompt.
Anthropic's documentation agreesA small documentation edit on Intercept and control agent behavior with hooks touched a line naming UserPromptSubmit after this was…