Skip to content

Hooks

Hooks run automatically — you don’t invoke them. They fire at points in the Claude Code lifecycle to capture your prompts and responses and keep the session’s context accurate.

HookClaude Code event
SessionStartClaude Code launches
UserPromptSubmitYou hit enter
CwdChangedYou switch working directory
PostCompactYou run /compact
PostToolUseA SendMessage tool call
StopClaude finishes a turn

Almost nothing. The hooks are quiet by design.

SessionStart prints one line confirming what it found — your key, the OTEL settings, the Prism it’s talking to — and a notice when a newer plugin version has been published. After a plugin reload it also reminds you to restart.

Nothing else is printed unless you turn on the realtime summary:

Terminal window
/prism:config set show_realtime_summary true

The plugin does not print prompt-quality coaching, rewrites, or context nudges. Scoring runs on the server; coaching surfaces on the dashboard (see Where coaching lives).

  1. Reads your API key from ~/.prism/config.json. If it’s missing or malformed, prints a setup prompt and exits without blocking the session.
  2. Checks that the key still matches the Prism it was issued for, and says so if it doesn’t.
  3. Checks the OTEL settings in the scope the plugin is installed in, and warns if two scopes both carry them.
  4. Checks — at most once a day — whether a newer version has been published, and folds that into its one startup message. A failed check stays silent and reuses the last known answer.
  1. Lets /prism:… commands through immediately.
  2. If no API key is configured, prints a setup reminder and exits 0 — the prompt still goes through.
  3. Captures the prompt to Prism.

The submit hook always exits 0. It never blocks or delays your prompt.

Runs when you change working directory, so the session’s project context stays correct when you move between repositories mid-session.

Runs after /compact completes, resetting the per-compaction session state so counting restarts from a clean baseline.

Runs after a SendMessage tool call. Captures git and prompt “evidence” — the changes tied to the prompt that drove them — and queues it for Prism. /prism:status shows this evidence queue.

Runs after Claude finishes a turn. Measures the elapsed time and sends the response and the turn’s metadata to Prism. Delivery is queued on disk and retried until the server confirms receipt, so a network blip or a restart doesn’t lose a response — and retries never record the same response twice.

Every hook catches its own exceptions and exits 0. Hooks are fail-open: if a step inside one fails, your session continues normally. Failure detail goes to the plugin debug log; /prism:doctor reports whether debug logging is on and which file it writes to.