Notification Hooks

Notification Hooks

When Claude finishes working and is waiting for your input, it fires a notification event (e.g. "Claude Code — 1:emacs .config — Task completed").

Notification event data format sent to hooks:

{
  "session_id": "abc123",
  "transcript_path": "/Users/.../.claude/projects/.../00893aaf-19fa-41d2-8238-13269b9b3ca0.jsonl",
  "cwd": "/Users/...",
  "permission_mode": "default",
  "hook_event_name": "Notification",
  "message": "Claude needs your permission to use Bash",
  "title": "Permission needed",
  "notification_type": "permission_prompt"
}

You can add custom logic to notification hooks. Useful on non-Linux systems where there is no native notification integration with their terminals, especially WSL2.

Notification hook has four trigger types:

Example config (settings.json), also showing a Stop hook running PowerShell:

{
  "hooks": {
    "Stop": [{ "hooks": [{ "type": "command", "command": "powershell.exe -NoProfile -NonInteractive -Command...." }] }],
    "Notification": [
      {
        "matcher": "permission_prompt",
        "hooks": [{ "type": "command", "command": "powershell.exe -NoProfile -NonInteractive -Command...." }]
      },
      {
        "matcher": "idle_prompt",
        "hooks": [{ "type": "command", "command": "New-BurntToastNotification -Text 'Claude Code', 'Task complete'" }]
      }
    ]
  }
}

Related: Hooks, Hooks Settings