Claude Hookbook

Hooks / notifications

Notify when the agent completes

Desktop notification when Claude finishes a turn - useful for long unattended runs.

Notificationagent_completedlow riskneeds manual check

What 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

EventNotification
Matcheragent_completed
Scopeuser
Platformsmacos, linux
Asyncruns in the background, reports on exit
Timeout10s
Requiresjq
Failure modeobserve
Verified againstClaude Code hooks reference, event/matcher schema checked 2026-09-10
Test statusneeds 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

  1. Save the script to .claude/hooks/notify-agent-complete.sh and chmod +x it.
  2. Add the config fragment to ~/.claude/settings.json.

Test it

Sources

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 check

Terminal bell on permission prompt

Rings the terminal bell when Claude asks for permission, via the terminalSequence output field.

Notificationpermission_promptlow riskneeds manual check

Pro Pack (later)

Framework bundles, cross-platform scripts, tested blocking policies, and a test harness. Free recipes and the generator stay free.

Waitlist opens soon.