Lifecycle Hooks
6 Automation Hooks
Bash scripts that run automatically at key points during a Claude Code session — from startup to shutdown.
PreToolUseWrite|Edit
pre-write-validate.sh
Validates file paths before Claude writes or edits them, blocking writes to sensitive files like .env and credentials.
UserPromptSubmit
prompt-context.sh
Injects current git branch, status, and recent commits into every prompt.
PreToolUseBash
secret-scan.sh
Scans for potential secrets or credentials before allowing shell commands.
SessionStart
session-start-context.sh
Injects previous session context so Claude can resume where it left off.
SessionStart
session-start-pull.sh
Pulls all repos in background with 60s timeout on session startup.
Stop
session-stop-summary.sh
Saves a session summary for continuity between Claude Code sessions.