Skip to main content
Hooks are lifecycle scripts that run automatically during Claude Code sessions. They attach to specific events — PreToolUse, PostToolUse, PreCompact, and Stop — and fire without any prompting. CC Commander ships 15 kit-native hooks in its standalone configuration, plus an extended set when ECC is installed. There are two hook configurations:
FileForHook count
hooks.jsonUsers with ECC installed34 hooks (15 kit-native + 19 ECC-inherited)
hooks-standalone.jsonUsers without ECC15 kit-native hooks only
The hooks below cover all 25 hooks referenced in the CC Commander hook directory: 15 wired in the standalone configuration plus 10 additional hooks that ship with CC Commander and are ready to activate.

Hook Directory

Event: PreToolUse (Bash)Intercepts Bash tool calls and blocks destructive patterns: rm -rf, DROP TABLE, --force git push, and similar commands. Uses regex pattern matching — this is a best-effort safety net, not a security boundary. Always combine with a settings.json deny list.Disable: KZ_DISABLE_CAREFUL_GUARD=1
Event: PreToolUse (Bash)Runs tsc --noEmit before any git commit Bash call. Blocks the commit if TypeScript errors are present, forcing you to fix type errors before they enter version control.Disable: KZ_DISABLE_PRE_COMMIT_VERIFY=1
Event: PreToolUse (Bash)Warns before executing multi-file Bash operations like sed -i on globs or find -exec. Gives you a chance to review scope before a command touches many files at once.Disable: KZ_DISABLE_CONFIDENCE_GATE=1
Event: PostToolUse (*)Monitors context window fill level. Warns at approximately 70% usage and auto-saves the session so you can resume cleanly after compaction.Disable: KZ_DISABLE_CONTEXT_GUARD=1
Event: PostToolUse (Edit|Write)Creates a git-stash checkpoint every 10 file edits. Gives you a rollback point without interrupting the session. Default interval is 10 edits.Disable: KZ_DISABLE_AUTO_CHECKPOINT=1
Event: PostToolUse (*)Fires cost proxy alerts at two thresholds: approximately 0.50(after 30toolcalls)andapproximately0.50 (after ~30 tool calls) and approximately 2.00 (after ~60 tool calls). Helps you stay aware of session spend before it escalates.Disable: KZ_DISABLE_COST_ALERT=1
Event: PostToolUse (*)Captures errors and corrections as they happen and appends them to tasks/lessons.md. These lessons are available at the next session start and feed into the knowledge compounding system.Disable: KZ_DISABLE_AUTO_LESSONS=1
Event: PostToolUse (*)Calculates your tool call rate and predicts when you will hit rate limits. Surfaces this as a warning so you can plan compaction or model switches in advance.Disable: KZ_DISABLE_RATE_PREDICTOR=1
Event: PostToolUse (Bash)Fires desktop notifications when significant events occur — PR created, deploy complete, build finished. Lets you step away from the terminal during long tasks.Disable: KZ_DISABLE_AUTO_NOTIFY=1
Event: PostToolUse (Bash)Logs every tool call with timestamps and arguments for cost analysis and audit trails. Outputs to a structured log that you can analyze later.Disable: KZ_DISABLE_PREUSE_LOGGER=1
Event: Stop (*)After each Stop event, automatically checks modified files against the task’s stated intent. Catches drift — situations where Claude changed something it was not asked to change.Disable: KZ_DISABLE_SELF_VERIFY=1
Event: Stop (*)Prints a branded status footer at session end with a summary of what was completed, what remains, and cost. Fires every 10 responses by default.Disable: KZ_DISABLE_STATUS_CHECKIN=1
Event: Stop (*)At session end, checks all modified files for incomplete tasks, uncommitted changes, and leftover TODO/FIXME markers. Surfaces anything that should be resolved before the session closes.Disable: KZ_DISABLE_SESSION_END_VERIFY=1
Event: Stop (*)Fires periodic coaching nudges during long sessions: skill suggestions, checkpoint reminders, and workflow tips. Interval is configurable. Disable entirely with CC_COACH_DISABLE=1.Controls: CC_COACH_DISABLE=1 to disable · CC_COACH_INTERVAL=<n> to set nudge interval (number of responses between nudges, default: 10)
Event: PreCompact (*)Saves the current working directory, git branch, list of modified files, and active tasks before context compaction fires. This state is restored automatically when you resume.Disable: KZ_DISABLE_PRE_COMPACT=1
Event: PostToolUse (*) — requires ECCMonitors context window fill level with tiered warnings at 60%, 75%, 85%, and 90%. More granular than context-guard. Available in the ECC hook configuration.Disable: CC_CONTEXT_ROT_DISABLE=1
Event: Available, not wired by defaultScans vendor submodules for available updates and surfaces an alert. Run ccc --update to pull the latest vendor packages.
Event: Available, not wired by defaultChecks the age and content of your CLAUDE.md files and warns when they appear stale — for example, when the stack has changed but the instructions have not been updated.
Event: PostToolUse (Edit|Write|Bash)Forwards CC Commander tool events to the OpenClaw platform in real time. Requires OpenClaw to be running before launching CCC.
Event: Available, not wired by defaultSynchronises CC Commander session state with the OpenClaw gateway so other agents in the platform can see current context, cost, and task status.
Event: Available, not wired by defaultAutomatically creates or updates Linear issues based on the tasks CCC dispatches. Requires Linear credentials configured in settings.
Event: Available, not wired by defaultEnforces Linear workflow phase gates — prevents an issue from advancing to the next status until the required conditions are met.
Event: Available, not wired by defaultGenerates structured progress reports during long-running sessions and can forward them to Slack, Discord, or email at configurable intervals.
Event: Available, not wired by defaultRuns a daily scan of the codebase and knowledge base to surface improvement opportunities. Outputs a proposal queue that feeds into the continuous improvement workflow.

Environment Controls

VariableEffectScope
CC_COACH_DISABLE=1Disable session-coach nudges entirelysession-coach
CC_COACH_INTERVAL=<n>Number of responses between coach nudges (default: 10)session-coach
CC_NO_COLOR=1Disable ANSI colors in all hook outputall hooks
CC_NO_ANIMATION=1Disable spinner and animation outputall hooks
CC_CONTEXT_ROT_DISABLE=1Disable context-rot-monitor warningscontext-rot-monitor
Individual hooks respect their own disable flags (e.g. KZ_DISABLE_CAREFUL_GUARD=1) so you can turn off specific behavior without affecting the rest.

Activating an Unactivated Hook

Hooks that ship with CC Commander but are not wired by default can be activated by adding them to ~/.claude/settings.json:
{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "*",
        "hooks": [
          {
            "type": "command",
            "command": "node ~/.claude/hooks/vendor-update-notify.js"
          }
        ]
      }
    ]
  }
}
Hooks run with the same permissions as your Claude Code session. Review any hook script before activating it. The careful-guard hook is a best-effort safety net based on regex matching — always back it up with explicit deny rules in settings.json.