Skip to main content

Hooks Pipeline

17 hooks across 7 lifecycle events — fire automatically at every stage.

Hooks are the enforcement layer. They run at each stage of Claude's work cycle — automatically, without prompting. Blocking hooks can reject an action or force a fix. Non-blocking hooks warn without interrupting. Async hooks run in the background.

SessionStart

On startup, clear, or after compaction

HookTypeDescription
Memory loaderBlockingLoads persistent context from Console memory into the session
post_compact_restore.pyBlockingRe-injects active plan, task state, and key context after compaction
session_clear.pyBlockingResets session state (spec artifacts, task list, caches) when user runs /clear
Session trackerAsyncInitializes user message tracking for the session

UserPromptSubmit

When the user sends a message

HookTypeDescription
Session initializerAsyncRegisters the session with the Console worker daemon on first message

PreToolUse

Before search, web, or task tools

HookTypeDescription
tool_redirect.pyBlockingRedirects to MCP alternatives, blocks Explore agent (use Probe + codebase-memory-mcp), blocks plan mode conflicts
tool_token_saver.pyBlockingRewrites Bash commands via RTK for token savings (60–90% reduction on dev operations)

PostToolUse

After every Write / Edit / MultiEdit

HookTypeDescription
file_checker.pyBlockingPython (ruff + basedpyright), TypeScript (Prettier + ESLint + tsc), Go (gofmt + golangci-lint). Auto-fixes formatting.
tdd_enforcer.pyNon-blockingWarns when implementation files are edited without a failing test first
context_monitor.pyNon-blockingTracks context usage 0–100%. Warns at ~80%, caution at ~90%+
Memory observerAsyncCaptures decisions, discoveries, and bugfixes to persistent memory

PreCompact

Before auto-compaction fires

HookTypeDescription
pre_compact.pyBlockingSnapshots active plan, task list, and key decisions to memory

Stop

When Claude tries to finish

HookTypeDescription
spec_stop_guard.pyBlockingBlocks stopping if an active spec hasn't completed verification
spec_plan_validator.pyBlockingVerifies plan file was created with required sections
spec_verify_validator.pyBlockingVerifies plan status was updated to VERIFIED
Session summarizerAsyncSaves session observations to memory for future sessions

SessionEnd

When the session closes

HookTypeDescription
session_end.pyBlockingStops worker daemon if no other sessions active. Sends dashboard notification.
Closed loop

When compaction fires, PreCompact captures your active plan, task list, and key decisions to persistent memory. SessionStart restores everything afterward — work continues exactly where it left off. No progress lost, no manual intervention.