WatchlampGuidesGet Watchlamp · free

Guide

Claude Code hooks: which events tell you what a session is doing

Updated November 21, 2026 · by the maker of Watchlamp

Hooks let a script follow every Claude Code session: when a turn starts, when Claude needs you, when it finishes. We built Watchlamp, a status light for Claude Code, entirely on them. This is the map we wish we had had: which events to listen to, what each one tells you, and what none of them will.

Where hooks go

FileApplies to
~/.claude/settings.jsonAll your projects
.claude/settings.jsonOne project, shared through the repository
.claude/settings.local.jsonOne project, just for you (not committed)

Type /hooks in Claude Code to browse the hooks it has loaded and where each one comes from. Settings files are strict JSON: a comment or a trailing comma is an error.

The events that describe a session

EventRuns whenWhat it tells you
SessionStartA session starts or resumesThere is a session to follow
UserPromptSubmitA prompt is submittedA turn has started
PreToolUse, PostToolUseBefore and after each tool callClaude is working, and on what (tool_name, tool_input)
PermissionRequestA tool call needs your permission, at onceClaude is waiting for you
Notificationpermission_prompt after about 6 s; idle_prompt about 60 s after a turn endsSomeone should look
StopClaude finishes respondingThe turn is done
StopFailureThe turn ends because of an API errorIt stopped and needs a look
SubagentStart, SubagentStopA subagent starts or finishesWork goes on in a subagent
SessionEndThe session endsForget it

Every event arrives as JSON on standard input with session_id, cwd, transcript_path and hook_event_name, so one script can follow any number of sessions.

What the events do not tell you

Keep status hooks fast and quiet

A minimal status hook

This script keeps the latest event of each session in a small file, a starting point for a status line or a dashboard:

#!/bin/bash
# ~/.claude/status.sh: the latest event of each session, in ~/.claude/status/<session>.json
input=$(cat)
mkdir -p ~/.claude/status
jq -c '{event: .hook_event_name, cwd, at: now}' <<< "$input" > ~/.claude/status/"$(jq -r .session_id <<< "$input")".json

Make it executable (chmod +x ~/.claude/status.sh; jq comes with macOS 15 and later) and register it in ~/.claude/settings.json:

{
  "hooks": {
    "UserPromptSubmit": [{ "hooks": [{ "type": "command", "command": "$HOME/.claude/status.sh" }] }],
    "PermissionRequest": [{ "matcher": "*", "hooks": [{ "type": "command", "command": "$HOME/.claude/status.sh" }] }],
    "PostToolUse": [{ "matcher": "*", "hooks": [{ "type": "command", "command": "$HOME/.claude/status.sh" }] }],
    "Stop": [{ "hooks": [{ "type": "command", "command": "$HOME/.claude/status.sh" }] }],
    "StopFailure": [{ "hooks": [{ "type": "command", "command": "$HOME/.claude/status.sh" }] }]
  }
}

From there it is a matter of turning events into states and handling the gaps above. That is what Watchlamp does, free, with a lamp for every session that you can see from across the room.

Frequently asked questions

Does the Stop hook run when I press Esc?

No. Stop runs when Claude finishes responding, not when you interrupt a turn. A status script has to notice an interruption some other way, for example in the session's transcript.

Is there a hook for when I approve a permission prompt?

No. The next event is the PostToolUse of the approved tool, when it finishes, so a long command still looks like it is waiting until then.

Can a hook slow Claude Code down?

Yes. PreToolUse and PostToolUse hooks run around every tool call, and Claude waits for them. Keep them to a few milliseconds and do slow work elsewhere.

Where do I put a hook so it applies to every project?

In ~/.claude/settings.json. Hooks in a project's .claude/settings.json apply to that project and can be committed; .claude/settings.local.json is for your own, uncommitted ones.

Watchlamp is a free Mac app that puts one lamp per Claude Code session on your screen: it glows while Claude works, blinks when Claude needs you, and goes dark when the turn is done. For the desktop app and claude in the terminal.

Learn more

More guides

How to get notified when Claude Code needs you on a MacRunning several Claude Code sessions at once, and knowing which one needs you