Skip to content

The hook contract

kanade does not patch Claude Code or wrap its binary. It observes via the hook contract — a tiny shell script that Claude Code already runs at every event boundary.

When you install kanade, it appends entries to ~/.claude/settings.json under the hooks key. Each entry runs a small shell command at one of Claude Code’s six hook events:

  • SessionStart — a new claude session begins.
  • UserPromptSubmit — you press Enter on a prompt.
  • PreToolUse — Claude is about to call a tool.
  • PostToolUse — the tool call completed.
  • Notification — Claude surfaced a notification (e.g. waiting for input).
  • SessionEnd — the session terminates.

For each event, the kanade hook script does one thing: appends a JSON line to a spool file. It never makes a network call. It is fast (~1 ms), synchronous, and crash-safe.

The spool path is %LOCALAPPDATA%\kanade\data\hook.spool.jsonl. It’s append-only and reset to empty after the daemon successfully ingests it into SQLite.

The daemon tails this file in a background task. If the daemon is down, the spool just accumulates — the next time kanade launches, the daemon catches up and the chronicle backfills.

  • It does not invoke claude itself. Your own shell + claude CLI is doing the work; kanade is reading the events.
  • It does not intercept tool calls. PreToolUse is a read; it cannot block or modify the call.
  • It does not phone home. The hook writes to a local file. Full stop.

If you have an existing ~/.claude/settings.json, the kanade installer merges its hook entries with whatever’s already there. Your other settings are untouched. The merge is atomic — settings.json is written to a temp file and renamed.

If you want to see what kanade installed, the entries are easy to spot — they all reference kanade-hook in the command.

Settings → Uninstall hook from the system tray removes only the kanade entries from ~/.claude/settings.json and leaves the rest of the file alone. The uninstaller does the same automatically if you remove the app.