Artifact be805d9d5fb87cc51308242e99cf7b3deadd716835bbf17e4d0c756e2110ef3c:
- File docs/reference/hook-events.md — part of check-in [541190af05] at 2026-11-22 21:42:46 on branch hook-fields — Hooks: a PreToolUse allow may rewrite the call (updatedInput) and a PostToolUse answer may replace the result (updatedToolOutput), as in Claude Code; the rewrite is merged into the journaled input before the tool runs, the replacement is written over the effect and the tool_result entry in one transaction; the search tools' own fields reload from a rewrite; tests for a rewritten bash call, a rewritten grep pattern and a redacted result (user: dlair, size: 1056) [annotate] [blame] [check-ins using] [more...]
Hook events
The Claude Code hook events pic fires. How hooks are configured and what their output does is in hooks.
| Event | When | Can block |
|---|---|---|
SessionStart |
a conversation opens; output becomes context | no |
UserPromptSubmit |
before a message is sent; output becomes context | yes |
PreToolUse |
before a tool call; permissionDecision or exit 2 denies it |
yes |
PostToolUse |
after a tool call; output becomes context | yes |
PreCompact |
before a compaction; output becomes context | no |
PreRequest |
before a reply request; answered by pic's compaction component, which may compact first; no command hook runs | no |
Stop |
when a reply ends with no tool calls | yes |
SessionEnd |
when a conversation closes | no |
A PreToolUse answer may also rewrite the call it allows (hookSpecificOutput.updatedInput), and a
PostToolUse answer may replace the result the model sees (hookSpecificOutput.updatedToolOutput);
hooks says what pic does with each.