The events that matter

Hook eventWhat it tells you
SessionStartA session started, resumed or was cleared; it carries the session id early.
UserPromptSubmitA turn began: the agent is working.
PreToolUse, PostToolUseA tool started or ended: reading, editing, running a command.
PermissionRequestThe agent stopped for your permission: it needs you.
StopThe turn ended normally: done.
StopFailureThe turn ended on an error, such as a rate limit or an unknown model: failed, not done.
SubagentStart, SubagentStopA subagent began or finished, so the turn is not over yet.
SessionEndThe session closed.

StopFailure matters: without it, a turn that died on an API error looks like a finished one. A connection that keeps failing can retry for about three minutes before it arrives, and the agent looks busy all that time.

Where to install them

Put hooks in .claude/settings.local.json in the worktree, not in the committed .claude/settings.json: the local file is per checkout and is not meant to be shared. Add it to .git/info/exclude so it is never committed by accident. A hook entry looks like this:

.claude/settings.local.json
{
  "hooks": {
    "Stop": [
      { "hooks": [ { "type": "command", "command": "my-notifier stop" } ] }
    ],
    "PermissionRequest": [
      { "hooks": [ { "type": "command", "command": "my-notifier permission" } ] }
    ]
  }
}

The hook receives the event as JSON on standard input. Keep the command fast and make it exit 0 even when your notifier is not running, so a hook can never slow down or break the agent.

How Ourkite Bot does it

  • Install hooks writes the entries into the worktree's .claude/settings.local.json and adds it to .git/info/exclude, only after you click. Hooks other people wrote are kept.
  • The hooks call ourkite notify <event> from a stable copy in %APPDATA%\Ourkite\bin, so moving or updating the app does not break them. It always exits 0 and prints nothing.
  • The event travels as one JSON line over a loopback connection with a token that only the app's terminals receive.
  • ourkite hooks uninstall removes exactly what was installed.

The state rules were checked against recordings of real Claude Code sessions (versions 2.1.330 to 2.1.332), including an API error and a refused connection.

Try the preview

The preview is shared by email while the signed installer is prepared. Tell us how many agents you run and what you would want first.

  • Windows 10 or 11, 64-bit
  • Claude Code, signed in
  • git
Join early access

Windows 10 and 11 · Claude Code · early preview