Notify when the agent completes
Desktop notification when Claude finishes a turn - useful for long unattended runs.
Notificationagent_completedlow riskneeds manual checkWhat it does
Fires on Notification with the agent_completed matcher and posts a native desktop notification. Pairs well with headless or background sessions you check on between other work.
When it runs
| Event | Notification |
| Matcher | agent_completed |
| Scope | user |
| Platforms | macos, linux |
| Async | runs in the background, reports on exit |
| Timeout | 10s |
| Requires | jq |
| Failure mode | observe |
| Verified against | Claude Code hooks reference, event/matcher schema checked 2026-09-10 |
| Test status | needs manual check - run the test steps below before relying on it |
Config
Merge this into .claude/settings.json (or ~/.claude/settings.json for user scope) - or use the generator to combine hooks.
{
"hooks": {
"Notification": [
{
"hooks": [
{
"type": "command",
"command": "${CLAUDE_PROJECT_DIR}/.claude/hooks/notify-agent-complete.sh",
"timeout": 10,
"async": true
}
],
"matcher": "agent_completed"
}
]
}
}Script
Save as .claude/hooks/notify-agent-complete.sh and chmod +x it.
#!/bin/bash
# notify-agent-complete: desktop notification on agent completion.
set -u
msg="Claude finished"
if command -v osascript >/dev/null 2>&1; then
osascript -e "display notification \"$msg\" with title \"Claude Code\"" >/dev/null 2>&1 &
elif command -v notify-send >/dev/null 2>&1; then
notify-send "Claude Code" "$msg" >/dev/null 2>&1 &
fi
exit 0
Install
- Save the script to .claude/hooks/notify-agent-complete.sh and chmod +x it.
- Add the config fragment to ~/.claude/settings.json.
Test it
- Positive: run a short task - a notification fires when the turn completes.
- Negative: mid-turn tool calls should not notify.
Sources
- Claude Code hooks reference (checked 2026-09-10)
Related hooks
Notify when Claude needs input
Desktop notification when Claude asks for permission or goes idle waiting for you.
Notificationpermission_prompt|idle_prompt|agent_needs_inputlow riskneeds manual checkTerminal bell on permission prompt
Rings the terminal bell when Claude asks for permission, via the terminalSequence output field.
Notificationpermission_promptlow riskneeds manual checkPro Pack (later)
Framework bundles, cross-platform scripts, tested blocking policies, and a test harness. Free recipes and the generator stay free.
Waitlist opens soon.