Follow Discord
Sweep 03 Dec 2026 · 19:13Z Build v2.1.336 553 read Stable v2.1.332 Latest v2.1.336 Next v2.1.336 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One change · claude-code

Intercept and control agent behavior with hooks changedagent-sdk/hooks

Nearest release: v2.1.335, published 9 hours after 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 2 Dec 2026 12:25 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 2 Dec 2026 12:37 UTC.

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

The whole hunk

from line 6, old and new numbered
/
lines
from line 6
66 
77* **Block dangerous operations** before they execute, like destructive shell commands or unauthorized file access
88* **Log and audit** tool calls for compliance, debugging, or analytics
9* **Transform inputs and outputs** to sanitize data, inject credentials, or redirect file paths
9* **Transform inputs and outputs** to inject credentials or redirect file paths
1010* **Require human approval** for sensitive actions like database writes or API calls
1111* **Track session lifecycle** to manage state, clean up resources, or send notifications
1212 
from line 316
316316 
317317* **`Stop`, `SubagentStop`, `TaskCompleted`, and `TeammateIdle`**: these events ignore the option, so the action goes ahead.
318318* **`PermissionRequest`**: the block counts only if it arrives before your `canUseTool` callback answers.
319* **`PostToolUse`**: the tool has already run, so Claude receives the failure as feedback.
319* **`PostToolUse`**: the tool has already run, so Claude receives the failure as feedback and still reads the tool's original output.
320320 
321321A callback that exceeds its timeout follows [Hook timeout](#hook-timeout). With `"block"` set, a timeout also blocks `PreCompact` and `Elicitation`.
322 
323After a `PostToolUse` timeout, Claude reads the original output with no failure feedback.
322324 
323325#### Startup errors for `onFailure`
324326 
Feedback