Custom Hooks
ClaudeKit hooks automate your workflow by reacting to Claude Code lifecycle events — session start, tool calls, agent completion, and more.
~/.claude/settings.json that fire automatically in response to Claude Code events. Each hook receives JSON context via stdin and can inject guidance, block actions, or persist state. Hook Lifecycle Events
Hooks react to these Claude Code events:
SessionStart startup, resume, clear, compact UserPromptSubmit every user prompt PreToolUse before tool execution PostToolUse after tool execution SubagentStart subagent spawned SubagentStop subagent finished Stop session ends TaskCompleted task marked done TeammateIdle teammate about to idle Session Lifecycle
4 hooksInitialize, persist, and monitor session state throughout the lifecycle.
session-init.cjs
EK + MK
Initialize session with project detection, config loading, and environment setup. Fires on startup, resume, clear, and compact.
session-state.cjs
EK only
Persist and restore session progress across compactions. Saves active plan, todo items, and branch status.
usage-quota-cache-refresh.cjs
EK only
Keep usage quota cache warm for statusline. Smart throttling: 60s for prompts, 300s for tool events.
usage-context-awareness.cjs
EK + MK
Config gate wrapper for usage-quota-cache-refresh. Enables usage awareness via ck-config flag.
Context Injection
3 hooksInject rules, environment info, and team context into prompts and subagents.
dev-rules-reminder.cjs
EK + MK
Inject session info, development rules, modularization reminders, and active plan context on every prompt.
subagent-init.cjs
EK + MK
Inject minimal context (~200 tokens) to subagents using environment variables from SessionStart.
team-context-inject.cjs
EK only
Inject peer info and task summary when spawning Agent Team teammates. Non-blocking, fail-open.
Code Quality
3 hooksEnforce naming conventions, simplification reminders, and plan formatting.
descriptive-name.cjs
EK + MK
Enforce descriptive, kebab-case file naming when creating new files.
simplify-gate.cjs
EK only
Replaces post-edit-simplify-reminder. Auto-triggers code-simplifier when edit thresholds (400 LOC / 8 files) are breached.
plan-format-kanban.cjs
EK only
Warn when plan.md uses filenames as link text instead of human-readable names.
Security & Safety
2 hooksBlock access to sensitive files and restricted directories.
privacy-block.cjs
EK + MK
Block access to sensitive files (.env, credentials). Requires explicit user approval to proceed.
scout-block.cjs
EK + MK
Block directory access based on .ckignore patterns. Uses gitignore-spec matching.
Workflow & Teams
3 hooksCoordinate planning, task tracking, and team agent collaboration.
cook-after-plan-reminder.cjs
EK only
Remind to invoke /ck:cook after Plan subagent completes. Outputs plan path for new sessions.
task-completed-handler.cjs
EK only
Log task completions and inject progress context when agents mark tasks done.
teammate-idle-handler.cjs
EK only
Inject available task context when a teammate goes idle. Can prevent idle via exit code.
Deprecated
1 hookHooks that are disabled or removed from the active distribution.
skill-dedup.cjs Deprecated
EK only
Prevented local skills from shadowing global versions. Disabled in v2.9.1 due to race condition with parallel sessions.
Shared Utility Library
All hooks share utility modules under hooks/lib/ for common concerns.
ck-config-utils Read/validate .ck.json configuration colors ANSI color formatting config-counter Track skills, hooks, agents counts context-builder Build session context with WARN 70% / CRITICAL 90% thresholds git-info-cache Cache git status for performance hook-logger Structured diagnostics with performance tracking privacy-checker Block access to sensitive files (.env, credentials) project-detector Detect project type and package manager scout-checker Check if scout agents are available session-state-manager Manage session state persistence transcript-parser Parse Claude conversation transcripts usage-limits-cache Atomic cache for usage quota snapshots More hooks coming soon...
Slack notifications, auto-commit, and more!
Learn more about ClaudeKit built-in hooks at ClaudeKit Documentation