~/.claude/hooks/ and registers them in your settings.json automatically.
Lifecycle events
Claude Code fires hooks at these events:| Event | When it fires |
|---|---|
PreToolUse | Before any tool call executes |
PostToolUse | After a tool call completes |
PreCompact | Before the context window is compacted |
SessionStart | When a new Claude Code session begins |
Stop | When Claude finishes a response turn |
SessionEnd | When the session terminates |
PostToolUseFailure | When a tool call fails |
The 25 kit-native hooks
Safety hooks (PreToolUse)
careful-guard
careful-guard
Blocks destructive commands before they run —
rm -rf, DROP TABLE, force push, and other irreversible operations. Uses regex pattern matching as a best-effort safety net. Combine with your settings.json deny list for stronger protection.pre-commit-verify
pre-commit-verify
Runs a TypeScript check (
tsc) before every git commit. Blocks the commit if type errors exist, preventing broken code from entering your history.confidence-gate
confidence-gate
Warns before multi-file bash operations —
sed -i on globs, find -exec, and similar broad-scope commands — giving you a chance to review before Claude touches many files at once.Monitoring hooks (PostToolUse)
context-guard
context-guard
Tracks context window usage after every tool call. Warns at approximately 70% usage and auto-saves the session so you can resume cleanly after compaction.
auto-checkpoint
auto-checkpoint
Creates a
git stash checkpoint automatically every 10 file edits. If a session goes sideways, you have a recent rollback point.cost-alert
cost-alert
Monitors estimated session cost. Fires alerts at approximately 2.00 (around 60 tool calls) so you are never surprised at the end of a long session.
auto-lessons
auto-lessons
Captures errors and corrections during the session and appends them to
tasks/lessons.md in your project. Builds a running log of what went wrong and how it was fixed.rate-predictor
rate-predictor
Tracks the tool call rate across the session and predicts when you are likely to hit Claude’s rate limit. Surfaces a timing estimate so you can plan breaks.
self-verify
self-verify
Runs a post-edit verification pass on changed files, checking for drift between what Claude said it would do and what it actually wrote.
preuse-logger
preuse-logger
Logs every tool call — tool name, inputs, and timing — to a local file for cost analysis and debugging after the session.
auto-notify
auto-notify
Sends a notification when significant events occur during a session, such as a deploy completing or a long-running test suite finishing.
status-reporter
status-reporter
Generates progress updates during long-running sessions so you can see what Claude has done without scrolling through the full transcript.
Context hooks (PreCompact)
pre-compact
pre-compact
Saves session state — current working directory, git branch, modified files list, and active tasks — immediately before context compaction. After compaction, Claude resumes with the right context rather than starting blind.
Session end hooks (Stop)
session-coach
session-coach
Fires periodic coaching nudges at session end: skill suggestions based on what you built, workflow tips, and checkpoint reminders. Toggleable — set
CC_COACH_DISABLE=1 to turn it off.status-checkin
status-checkin
Renders a status summary at session end — what was built, files modified, cost incurred, and time elapsed.
session-end-verify
session-end-verify
Runs an end-of-session checklist: verifies modified files, checks for leftover
console.log statements, and flags uncommitted changes.Additional hooks
context-rot-monitor
context-rot-monitor
Monitors context window fill level with tiered warnings at 60%, 75%, 85%, and 90%. Disable with
CC_CONTEXT_ROT_DISABLE=1.vendor-update-notify
vendor-update-notify
Alerts you when any of CCC’s 19 vendor packages have published updates, so your tool set stays current.
claude-md-staleness
claude-md-staleness
Checks whether your
CLAUDE.md is out of date compared to the latest CCC template and nudges you to refresh it.openclaw-adapter
openclaw-adapter
Forwards tool use events to the OpenClaw gateway for multi-agent coordination when OpenClaw is detected.
openclaw-sync
openclaw-sync
Syncs session state bidirectionally with the OpenClaw platform after edits, writes, and bash operations.
daily-improvement-scan
daily-improvement-scan
Scans the CCC ecosystem for new techniques and improvements, feeds findings into the continuous improvement pipeline.
linear-auto-track
linear-auto-track
Automatically tracks progress against Linear issues when a Linear integration is configured.
linear-phase-gate
linear-phase-gate
Enforces phase gates on Linear issues — blocks advancement until defined criteria are met.
linear-pr-link
linear-pr-link
Links pull requests back to their originating Linear issues automatically after
git push.Hook configuration structure
Hooks are registered in yoursettings.json as entries under their lifecycle event. Here is what the structure looks like (key fields only):
matcher field controls which tools trigger the hook. "*" fires on every tool call; "Bash" fires only on shell commands; "Edit|Write" fires on file writes.
Two hook configurations
CCC ships two ready-to-use hook configurations:| File | Use when |
|---|---|
hooks.json | You have Everything Claude Code (ECC) installed — includes 34 hooks (15 kit-native + 19 ECC-inherited) |
hooks-standalone.json | You do not have ECC — includes the 15 kit-native hooks only |
Environment variable controls
| Variable | Effect |
|---|---|
CC_COACH_DISABLE=1 | Disable the session-coach nudges entirely |
CC_COACH_INTERVAL | Set the coaching nudge interval (number of responses between nudges) |
CC_NO_COLOR=1 | Strip all color output from hook messages |
CC_NO_ANIMATION=1 | Disable animation effects in hook output |
CC_CONTEXT_ROT_DISABLE=1 | Disable the context-rot-monitor tiered warnings |
Writing your own hook
Hooks receive session data as JSON on stdin and must write JSON to stdout. APreToolUse hook can block the tool call by exiting with code 2.
~/.claude/settings.json using the same structure shown above.