Hooks
The hooks the kit registers, what each one does, which can block, and how to switch observers off.
The kit ships 28 hook scripts, all Node .cjs modules: 4 entrypoints directly under .claude/hooks/ and 24 observers under .claude/hooks/handlers/. Hooks enforce three things: the ship check, protection of sensitive files, and the post-write security scan. Everything else is an observer that records or reminds. Planning and review are workflow practices, not hooks; see Enforcement and Security.
Two kinds of hook
| Kind | Scripts | Registered | When it fails |
|---|---|---|---|
| Guards | privacy-block.cjs, pre-ship.cjs | Directly in .claude/settings.json | Closed: a crash, a syntax error or a missing library still blocks the call |
| Observers | The 24 files in handlers/ | Through dispatch.cjs, which reads .claude/hooks/handlers.json | Open: a handler that throws is reported and the others still run |
append-trace.cjs is the fourth entrypoint. A skill runs it by path to append one record to .meowkit/telemetry/trace-log.jsonl. Records are scrubbed of secrets, written atomically through a lock, and the file rotates at 50 MB.
Only exit code 2 blocks a tool call. Any other exit is advisory, which is why the guards install their own top-level error handlers that exit 2 before any library loads.
Guards
| Hook | Event and matcher | What it does | Blocks |
|---|---|---|---|
privacy-block.cjs | PreToolUse: Edit|Write, Read|Grep|Glob, Bash | Refuses reads and writes of sensitive files (.env, keys, credentials, SSH, cloud and registry tokens), shell commands that print or copy one out, reads of archived plans under tasks/plans/archive/ and tasks/plans/ceo-plans/archive/, and unsafe web-fetch targets | Yes (exit 2) |
pre-ship.cjs | PreToolUse: Bash | The ship check on git commit, git push, git merge and gh pr create|merge: team-memory lint, then lint on the changed files, their related tests and a type-check, each from the project's own node_modules/.bin (nothing is fetched). Before the check it prints the plan drift line and archive reminder, which change nothing | Yes: exit 2 when a check fails; the ask permission decision when a check could not run (crash, missing tool, deadline) |
privacy-block.cjs also blocks when the hook itself fails (onFailure: block). mewkit doctor --hard-gates runs both guards, and the injection scanner, in a scratch project and reports which block.
Observers
dispatch.cjs <Event> [Matcher] is registered in settings.json for SessionStart, PreToolUse (Bash), PostToolUse (Edit|Write and Bash), Stop, UserPromptSubmit, PreCompact and PostToolUseFailure. handlers.json lists which handler runs on which event, and its toggleKey is the handler's file base name. If handlers.json is missing or a handler throws, dispatch.cjs exits 0.
An observer with advice for the model returns it as hookSpecificOutput.additionalContext, which is the model-visible output on tool events. Two observers can fail a tool result: build-verify and post-write exit 2 with a block on stderr, and the edit is already saved when they do. The opt-in pre-completion-check answers with a block decision.
| Observer | Event (matcher) | What it does |
|---|---|---|
pre-task-check | PreToolUse (Bash) | Reports blocking-class prompt-injection patterns found in a command to the model as context. Advisory; a long command or a path outside the project is not reported |
delegation-brief-check | PreToolUse (Task|Agent) | Notes to the model when a subagent brief has no Goal: or Return: label, and records one delegation_brief_check trace event with two booleans. Never blocks and never repeats the brief |
build-verify | PostToolUse (Edit|Write) | Runs the compile or lint check for the file's language; results are cached by file content hash |
loop-detection | PostToolUse (Edit|Write) | Counts edits per file and reminds the model at 4 edits, asks it to re-plan at 8, and repeats every 4 after. Never blocks |
budget-tracker | PostToolUse (Edit|Write, Bash) | Estimates cost and prints a notice at the warn and block thresholds. The notices go to the user and stop nothing |
auto-checkpoint | PostToolUse (Edit|Write) | Writes a checkpoint when a write touches tasks/plans/, tasks/contracts/ or tasks/reviews/ |
learning-observer | PostToolUse (Edit|Write) | Keeps the per-file edit ledger .meowkit/state/learning-observer.jsonl |
post-write | PostToolUse (Edit|Write) | Security scan of the file just written: secrets, any type, SQL injection, XSS, destructive patterns. A blocked pattern fails the tool result |
review-evidence-tag | PostToolUse (Bash) | When the session runs mewkit review read --session, records an event so mewkit review coverage can mark the read as seen by the session |
verification-evidence | SessionStart; PostToolUse (Bash) | Records the starting tree and the tree at each passing verification command, for the opt-in completion check. Does nothing unless that check is on |
checkpoint-writer | Stop | Writes a sequenced checkpoint with the git state |
post-session | Stop | Records cost and trace data to .meowkit/telemetry/ |
control-probe | Stop | Logs a known-good fire, to tell an event the host does not support from a broken logger |
pre-completion-check | Stop | Opt-in. See below |
plan-state-sync | Stop | On by default; hooks.plan-state-sync: false turns it off. Brings changed plans' derived state (phase status, Overview line, plan.md table and status, and .plan-state.json when one exists) up to date with their checkboxes and prints one line when it changed something or a plan is ready for mewkit plan archive. Never blocks |
model-detector | SessionStart | Writes the detected model tier and density to .meowkit/state/detected-model.json and prints one status line |
orientation-ritual | SessionStart | On resume, clear or compact, runs mewkit orient --no-record and injects the result. When the CLI is unavailable it falls back to the last checkpoint and labels it as a fallback |
project-context-loader | SessionStart | Injects the project context and resets per-session state |
jira-env-loader | SessionStart | Reports whether the three MEOW_JIRA_* keys are present and never prints them. The only handler that reads the env files (.meowkit/.env, .claude/.env, ~/.meowkit/.env) |
capability-bootstrap | SessionStart | Emits the committed capability-resolution guidance; silent when the file is absent |
safety-sentinel-inject | UserPromptSubmit | Emits the cached-skip marker, or forces a safety-baseline re-read after compaction |
tdd-flag-detector | UserPromptSubmit | Detects --tdd in the prompt and writes the sentinel .meowkit/state/tdd-mode |
precompact-probe | PreCompact | Logs the event and appends a re-arm marker to .meowkit/state/session-sentinels.jsonl. Compaction drops the safety-baseline text but leaves the "verified" marker, so the marker makes the next turn re-read the baseline. Never blocks |
posttoolfailure-probe | PostToolUseFailure | Logs the event. Never blocks |
build-verify
build-verify picks the check from the file extension: ts and tsx run tsc --noEmit and eslint, the JavaScript extensions (js, jsx, mjs, cjs) run eslint, both from the project's own node_modules/.bin and never through npx, which would fetch a missing package; a tool not installed there is skipped. py runs ruff check and mypy, go runs go build ./..., rs runs cargo check, and rb runs ruby -c and rubocop. On failure it exits 2 and writes a @@BUILD_VERIFY_ERROR@@ ... @@END_BUILD_VERIFY@@ block to stderr, which Claude Code shows to the model. It skips node_modules/, virtualenvs, vendor/, target/, dist/, build/, .next/, out/, tasks/, docs/, plans/, .claude/, test files, and minified, map and lock files. The default timeout is 30 s (60 s for Rust, 20 s for Ruby, 15 s for JavaScript), and buildVerify.timeoutMs overrides it. It does nothing when autobuild.mode is MINIMAL.
pre-completion-check
pre-completion-check runs on the Stop event and is off unless hooks.pre-completion-check: true is set. When on, a stop with files changed since the session's last passing test, build, lint or type-check run is answered with a {"decision":"block","reason":"..."} that Claude Code feeds back as the next turn. After two reminders the session ends with a notice. It is evidence of effort, not proof: a trivial passing command satisfies it.
Profiles
MEOWKIT_HOOK_PROFILE is read by three observers. Only fast changes behaviour; standard (the default) and strict run the same hooks.
| Profile | Effect |
|---|---|
fast | learning-observer, post-session and pre-task-check do nothing |
standard, strict | All hooks run |
The guards ignore the profile. privacy-block.cjs and pre-ship.cjs run in every profile, and neither profile nor config can switch them off. mewkit doctor reports MEOWKIT_HOOK_PROFILE=fast in its checks: weakened row.
Switching observers off
Observer switches live in .meowkit/config.yaml. hooks.<name>: false turns one observer off, using the handler's file base name. The default is on, except pre-completion-check, which is off until set to true. The names privacy-block, pre-ship, check-careful, check-freeze and check-report-path are rejected in every config scope. Configuration lists every key.
| Setting | Effect |
|---|---|
hooks.build-verify: false | Skip build-verify |
hooks.loop-detection: false | Skip loop-detection |
hooks.pre-completion-check: true | Turn on pre-completion-check |
hooks.plan-state-sync: false | Skip the stop-time sync of changed plans (the ship check's drift line still prints) |
autobuild.mode: MINIMAL | Skip build-verify |
MEOWKIT_HOOK_PROFILE=fast | Skip learning-observer, post-session and pre-task-check; pre-ship still runs |
Registration
Every hook runs on Node. A registration is command: node plus an args list, so no shell parses the path. The registrations for the ship check and the dispatcher look like this:
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{ "type": "command", "command": "node", "args": ["${CLAUDE_PROJECT_DIR}/.claude/hooks/pre-ship.cjs"], "timeout": 300, "onFailure": "block" },
{ "type": "command", "command": "node", "args": ["${CLAUDE_PROJECT_DIR}/.claude/hooks/dispatch.cjs", "PreToolUse", "Bash"], "timeout": 10 }
]
}
]
}
}Hooks read their input as JSON on stdin, through lib/parse-stdin.cjs. The write guards use its readHookInput form, which also reports why input was unreadable so the guard can refuse; observers receive the same payload from the dispatcher.
Shared libraries
.claude/hooks/lib/ holds Node modules that hooks require(). They are not hooks. The main ones:
| Library | Purpose |
|---|---|
parse-stdin.cjs | Parses the JSON on stdin and resolves a relative tool_input.file_path against the working directory |
secret-scrub.cjs | Redacts Anthropic, OpenAI, AWS, GitHub, GitLab, Slack, JWT and PEM secrets before a hook persists content |
shared-state.cjs | In-process state shared between handlers |
checkpoint-utils.cjs | Reads and writes checkpoint files |
core/*.cjs | The decisions the guards share across runtimes: privacy.cjs, pre-ship.cjs and completion-check.cjs |
Each lib/core module is a pure decision. It reads the project tree, never touches stdin, stdout or the exit code, and returns { exit, stdout, stderr }, where exit 2 is a block. Claude Code's guards wrap these modules, and the Codex, Cursor, Grok, Pi, OMP and Antigravity hook code calls the same decisions, so a change reaches every runtime that carries them.
State files
| File | Writer | Purpose |
|---|---|---|
.meowkit/state/edit-counts.json | loop-detection | Per-file edit counter, keyed {session_id}:{realpath} |
.meowkit/state/build-verify-cache.json | build-verify | File-content-hash cache for skipping unchanged files |
.meowkit/state/learning-observer.jsonl | learning-observer | Per-file edit ledger |
.meowkit/state/tdd-mode | tdd-flag-detector | Test-first sentinel |
.meowkit/state/detected-model.json | model-detector | Detected model tier and density |
.meowkit/state/session-sentinels.jsonl | safety-sentinel-inject, precompact-probe | Safety-baseline verification and re-arm markers |
.meowkit/state/active-plan | mk:autobuild, mk:plan-creator | Currently active plan slug |
.meowkit/state/last-session-id | project-context-loader | Session change detection |
Runtime parity
The other runtimes do not run every Claude Code hook. .claude/hooks/hook-coverage.json records what each safety behaviour and each handler becomes on Codex, Cursor, Grok, Pi, OMP and Antigravity, and a test checks that each one appears there. The Enforcement & Security page lists what each runtime enforces and what has not been run live. The Grok, Pi and OMP entries follow the vendors' documentation and have not been run in a live session. The Antigravity entries carry the status unverified: the guard is installed and runs the shared decision, but it was built from the vendor's documentation (https://antigravity.google/docs/hooks, read 2026-11-22) and no live run has shown it deny. A test refuses an Antigravity row marked ported without a recorded probe that saw a denial, and mewkit init and mewkit doctor name every unverified guard.
| Behavior | Claude Code | Codex | Cursor | Grok | Pi | OMP | Antigravity |
|---|---|---|---|---|---|---|---|
| Privacy block | privacy-block.cjs | Ported, Bash only: Codex has no file-read hook, so the decision runs on the shell command and the paths it names | Ported: privacy-read-gate.cjs on beforeReadFile | Ported: privacy-block.cjs on PreToolUse, every tool | Ported: guard.cjs through the extension's tool_call | Ported: guard.cjs through the hook module's tool_call | Unverified, from documentation: privacy-block.cjs on PreToolUse, every tool |
| Ship check | pre-ship.cjs | Ported: pre-ship.cjs on PreToolUse Bash | Ported: pre-ship.cjs on beforeShellExecution | Ported: pre-ship.cjs on PreToolUse Bash | Ported: inside guard.cjs, on a shell command | Ported: inside guard.cjs, on a shell command | Unverified, from documentation: pre-ship.cjs on PreToolUse run_command |
| Session context | project-context-loader | Not ported: AGENTS.md carries the standing context | Equivalent: session-context.cjs, a short pointer to .meowkit/ state | Not ported | Not ported | Not ported | Not ported |
Of the 24 observers, hook-coverage.json ports or maps only these off Claude Code:
| Observer | Codex | Cursor | Grok, Pi, OMP, Antigravity |
|---|---|---|---|
pre-completion-check | Ported: completion-check.cjs on Stop | Ported: stop-followup.cjs sends the reason as a follow-up message | Not ported |
plan-state-sync | Ported: completion-check.cjs on Stop, line as systemMessage | Ported: stop-followup.cjs, line on stderr | Equivalent: the ship check prints the drift line, read-only |
verification-evidence | Ported: completion-check.cjs on PostToolUse Bash | Ported: completion-check.cjs on postToolUse Shell | Not ported |
learning-observer, post-session, precompact-probe, posttoolfailure-probe | Not ported | Equivalent: telemetry-observers.cjs | Not ported |
capability-bootstrap | Equivalent: the text goes into AGENTS.md | Not ported | Not ported |
Every other observer is not ported to any runtime other than Claude Code. The reason for each is in hook-coverage.json.
Registered hooks
Generated from .claude/settings.json, so a registered hook cannot be missing here.
Blocking means the hook can stop the action. Advisory means it observes and reports.
Script paths, timeouts, and matcher chains are intentionally not listed; read
.claude/settings.json for the wiring.
| Event | Purpose | Can it block? |
|---|---|---|
PostToolUse | Dispatch | Blocking |
PostToolUseFailure | Dispatch | Blocking |
PreCompact | Dispatch | Blocking |
PreToolUse | Checking file access permissions | Blocking |
PreToolUse | Checking web fetch targets | Blocking |
PreToolUse | Dispatch | Blocking |
PreToolUse | Running ship check (lint, related tests, type-check) | Blocking |
SessionStart | Dispatch | Blocking |
Stop | Dispatch | Blocking |
UserPromptSubmit | Dispatch | Blocking |
Registered with no hooks today: SubagentStart, SubagentStop.