Follow Discord
Sweep 02 Oct 2026 · 18:55Z Build v2.1.288 509 read Stable v2.1.285 Latest v2.1.287 Next v2.1.288 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One change · claude-code

Automate actions with hooks changedhooks-guide

Nearest release: v2.1.287, published 5 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 1 Oct 2026 22:23 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 1 Oct 2026 22:37 UTC.

Upstream edited
Recorded here
Lines+12added
Lines−9removed
From line 63 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 63, old and new numbered
/
lines
from line 63
6363 </Step>
6464 
6565 <Step title="Verify the configuration">
66 Type `/hooks` to open the hooks browser. You'll see a list of all available hook events, with a count next to each event that has hooks configured. Select `Notification` to confirm your new hook appears in the list. Selecting the hook shows its details: the event, matcher, type, source file, and command.
66 Type `/hooks` at the Claude Code prompt to open the hooks browser. Your new hook appears in the list under `Notification`.
6767 </Step>
6868 
6969 <Step title="Test the hook">
from line 71
7171 </Step>
7272</Steps>
7373 
74<Tip>
75 The `/hooks` menu is read-only. To add, modify, or remove hooks, edit your settings JSON directly or ask Claude to make the change.
76</Tip>
77 
7874## What you can automate
7975 
8076Hooks let you run code at key points in Claude Code's lifecycle: format files after edits, block commands before they execute, send notifications when Claude needs input, inject context at session start, and more. For the full list of hook events, see the [Hooks reference](/docs/en/hooks#hook-lifecycle).
from line 83
8783 
8884Get a desktop notification whenever Claude finishes working and needs your input, so you can switch to other tasks without checking the terminal.
8985 
90This hook uses the `Notification` event, which Claude Code fires when Claude is waiting for input or permission. See [when each notification type fires](/docs/en/hooks#notification) for the exact timing. Each tab below uses the platform's native notification command. Add this to `~/.claude/settings.json`:
86This hook uses the `Notification` event, which Claude Code fires when Claude is waiting for input or permission. See [when each notification type fires](/docs/en/hooks#notification) for the exact timing.
9187 
88Each tab below uses the platform's native notification command. Add this to `~/.claude/settings.json`:
89 
9290<Tabs>
9391 <Tab title="macOS">
9492 ```json theme={null}
from line 108
110108 ```
111109 
112110 <Accordion title="If no notification appears">
113 `osascript` routes notifications through the built-in Script Editor app. If Script Editor doesn't have notification permission, the command fails silently, and macOS won't prompt you to grant it. Run this in Terminal once to make Script Editor appear in your notification settings:
111 `osascript` routes notifications through the built-in Script Editor app. If Script Editor doesn't have notification permission, the command fails silently, and macOS won't prompt you to grant it.
114112 
113 Run this in Terminal once to make Script Editor appear in your notification settings:
114 
115115 ```bash theme={null}
116116 osascript -e 'display notification "test"'
117117 ```
from line 170
170170 ```
171171 
172172 <Accordion title="If no dialog appears">
173 This command opens a dialog box rather than a notification in the corner of your screen, so the dialog can open behind your terminal window. Test the command directly in PowerShell first. If you run Claude Code inside WSL, `powershell.exe` must be available on your `PATH` through Windows interop.
173 This command opens a dialog box rather than a notification in the corner of your screen, so the dialog can open behind your terminal window. Test the command directly in PowerShell first.
174 
175 If you run Claude Code inside WSL, `powershell.exe` must be available on your `PATH` through Windows interop.
174176 </Accordion>
175177 </Tab>
176178</Tabs>
from line 204
202204 
203205`agent_needs_input` for a teammate's terminal setup question requires Claude Code v2.1.248 or later.
204206 
205Type `/hooks` and select `Notification` to confirm the hook is registered. For the full event schema, see the [Notification reference](/docs/en/hooks#notification).
207Type `/hooks` at the Claude Code prompt and confirm the hook appears under `Notification`.
206208 
207209### Auto-format code after edits
208210 
from line 999
997999* File edits are normally picked up automatically. If they haven't appeared after a few seconds, the file watcher may have missed the change: restart your session to force a reload.
9981000* Verify your JSON is valid: trailing commas and comments aren't allowed
9991001* Confirm the settings file is in the correct location: `.claude/settings.json` for project hooks, `~/.claude/settings.json` for global hooks
1002* If the menu shows `Only hooks from managed settings run here`, your organization has set [`allowManagedHooksOnly`](/docs/en/settings-reference#allowmanagedhooksonly). Hooks in your user, project, and local settings files don't run and aren't listed
10001003 
10011004### Stop hook hits the block cap
10021005 
Feedback