Automation

Lifecycle Hooks

Event-driven scripts that automate quality gates, context loading, and workflow orchestration across every coding session.

Hook Events

PreToolCall

before

Intercepts tool calls before execution for validation

PostToolCall

after

Processes tool results and triggers follow-up actions

SessionStart

after

Initializes session context, loads project state

SessionEnd

after

Captures session summary, updates episodic memory

Notification

after

Routes important events to external channels

PreCommit

before

Quality gates: lint, typecheck, test on staged files

PostCommit

after

Updates changelog, triggers CI notifications

ErrorRecovery

after

Spawns debugging agent on build/test failures

Hook Scripts

pst-timestamp

SessionStart

Injects PST/PDT timestamps into every response

~/.claude/bin/pst-timestamp

shift-left-gate

PreCommit

Runs lint + typecheck + tests before allowing commits

pnpm lint && pnpm tsc --noEmit

context-loader

SessionStart

Detects project type and loads appropriate conventions

~/.claude/bin/project-detector

memory-sync

SessionEnd

Persists learned patterns to episodic memory store

~/.claude/bin/sync-memory

error-agent

ErrorRecovery

Spawns specialized debugging sub-agent on failures

claude --agent error-recovery