Intercept and control agent behavior with hooks changedagent-sdk/hooks
Upstream edited this page at 22 Nov 2026 18:49 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 22 Nov 2026 19:07 UTC.
Upstream edited
Recorded here
Lines+1added
Lines−1removed
From line
148
where the diff opens
First seen
14 Aug 2026
this site's first read of the page
Recorded edits29to this page, all time
The whole hunk
from line 148, old and new numbered
/
from line 148
148148| `PostToolBatch` | No | Yes | A full batch of tool calls resolves, once per batch before the next model call | Inject conventions once for the whole batch |
149149| [`UserPromptSubmit`](https://code.claude.com/docs/en/hooks#userpromptsubmit) | Yes | Yes | A prompt is submitted, including a turn Claude Code starts on its own | Inject additional context into prompts |
150150| [`UserPromptExpansion`](https://code.claude.com/docs/en/hooks#userpromptexpansion) | No | Yes | A user-typed command, or an MCP prompt, expands into a prompt before it reaches Claude. Doesn't fire when Claude invokes a skill itself | Block a command from direct invocation or add context when a skill is typed |
151| `MessageDisplay` | No | Yes | An assistant message with text completes, once per message with the full message text | Redact or reformat the displayed text without changing the transcript |
151| `MessageDisplay` | No | Yes | An assistant message with text completes, once per message with the full message text | Reformat the displayed text without changing the transcript |
152152| `Stop` | Yes | Yes | Agent execution stop | Save session state before exit |
153153| `StopFailure` | No | Yes | The turn ends with an API error instead of a normal stop | Log failures or send alerts |
154154| `SubagentStart` | Yes | Yes | Subagent initialization | Track parallel task spawning |
No line in this hunk matches that.