Hooks
Hooks are configured in settings.json and fire automatically at specific points in a Claude Code session.
| Hook | Trigger | Script |
|---|---|---|
WorktreeCreate |
Developer creates a worktree | git worktree add + echo path |
WorktreeRemove |
Developer removes a worktree | git worktree remove --force |
SessionEnd |
Any session ends | hooks/on_session_end.sh (async) |
PreToolUse |
Every Bash, Task or Agent tool call |
hooks/on_preflight_check.sh — pre-flight checklist backstop |
hooks/on_session_end.sh
Runs asynchronously at the end of every session:
- Logs a
session_endevent toproject/logs/events.json - Compares
project/rapports/problems/against.rapport_manifest.json(skipping*.IGNORE.mdfiles)- If new rapports found: writes a
rapport_reviewtrigger toscrum_triggers.jsonl
- If new rapports found: writes a
- Always writes a
status_reviewtrigger for the next Scrum Master session - If
.session_handoff.jsonexists in the queue: forwards the handoff to the developer trigger queue
This ensures the Scrum Master always has an up-to-date view of the project when it starts the next session.
hooks/on_preflight_check.sh
The enforcing layer of the pre-flight checklist feature (mirrored at project/.wiki/preflight-checklists.md). Fires on PreToolUse for Bash, Task and Agent calls, reads the situation marker written by scripts/checklist-marker.sh to learn which lifecycle phase is active, runs scripts/checklist.sh check <phase>, and refuses the tool call when a block-enforcement item is unsatisfied (a failing confirm item makes it ask instead). It exists so enforcement does not ultimately depend on an agent choosing to call the checker.
- No marker, no effect. With no lifecycle phase active it exits
0with no output and no subprocess. - It gates each phase’s own irreversible operation, not every tool call —
pre-commit→git commit,pre-task→ subagent dispatch andgit worktree add,pre-release/pre-publish→npm publish/gh release/git push/git tag,pre-mirror→git push/mirror.sh,pre-reconcile→git merge/git worktree remove. Gating everything would wedge the session, because satisfying a failed item is itself a tool call. - It holds at every permission level, including level 5 (Unrestricted). Its decision never consults permission state, and no environment variable disables it.
- It is registered in six files, not one. Switching permission level whole-file-overwrites
.claude/settings.jsonand.agents/settings.jsonfromtemplates/permission-levels/level-<n>-<name>.json, so thePreToolUseblock is byte-identical across the rootsettings.jsonand all five templates. Change all six together.