Skip to Content
MeowKit

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

KindScriptsRegisteredWhen it fails
Guardsprivacy-block.cjs, pre-ship.cjsDirectly in .claude/settings.jsonClosed: a crash, a syntax error or a missing library still blocks the call
ObserversThe 24 files in handlers/Through dispatch.cjs, which reads .claude/hooks/handlers.jsonOpen: 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

HookEvent and matcherWhat it doesBlocks
privacy-block.cjsPreToolUse: Edit|Write, Read|Grep|Glob, BashRefuses 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 targetsYes (exit 2)
pre-ship.cjsPreToolUse: BashThe 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 nothingYes: 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.

ObserverEvent (matcher)What it does
pre-task-checkPreToolUse (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-checkPreToolUse (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-verifyPostToolUse (Edit|Write)Runs the compile or lint check for the file's language; results are cached by file content hash
loop-detectionPostToolUse (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-trackerPostToolUse (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-checkpointPostToolUse (Edit|Write)Writes a checkpoint when a write touches tasks/plans/, tasks/contracts/ or tasks/reviews/
learning-observerPostToolUse (Edit|Write)Keeps the per-file edit ledger .meowkit/state/learning-observer.jsonl
post-writePostToolUse (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-tagPostToolUse (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-evidenceSessionStart; 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-writerStopWrites a sequenced checkpoint with the git state
post-sessionStopRecords cost and trace data to .meowkit/telemetry/
control-probeStopLogs a known-good fire, to tell an event the host does not support from a broken logger
pre-completion-checkStopOpt-in. See below
plan-state-syncStopOn 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-detectorSessionStartWrites the detected model tier and density to .meowkit/state/detected-model.json and prints one status line
orientation-ritualSessionStartOn 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-loaderSessionStartInjects the project context and resets per-session state
jira-env-loaderSessionStartReports 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-bootstrapSessionStartEmits the committed capability-resolution guidance; silent when the file is absent
safety-sentinel-injectUserPromptSubmitEmits the cached-skip marker, or forces a safety-baseline re-read after compaction
tdd-flag-detectorUserPromptSubmitDetects --tdd in the prompt and writes the sentinel .meowkit/state/tdd-mode
precompact-probePreCompactLogs 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-probePostToolUseFailureLogs 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.

ProfileEffect
fastlearning-observer, post-session and pre-task-check do nothing
standard, strictAll 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.

SettingEffect
hooks.build-verify: falseSkip build-verify
hooks.loop-detection: falseSkip loop-detection
hooks.pre-completion-check: trueTurn on pre-completion-check
hooks.plan-state-sync: falseSkip the stop-time sync of changed plans (the ship check's drift line still prints)
autobuild.mode: MINIMALSkip build-verify
MEOWKIT_HOOK_PROFILE=fastSkip 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:

LibraryPurpose
parse-stdin.cjsParses the JSON on stdin and resolves a relative tool_input.file_path against the working directory
secret-scrub.cjsRedacts Anthropic, OpenAI, AWS, GitHub, GitLab, Slack, JWT and PEM secrets before a hook persists content
shared-state.cjsIn-process state shared between handlers
checkpoint-utils.cjsReads and writes checkpoint files
core/*.cjsThe 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

FileWriterPurpose
.meowkit/state/edit-counts.jsonloop-detectionPer-file edit counter, keyed {session_id}:{realpath}
.meowkit/state/build-verify-cache.jsonbuild-verifyFile-content-hash cache for skipping unchanged files
.meowkit/state/learning-observer.jsonllearning-observerPer-file edit ledger
.meowkit/state/tdd-modetdd-flag-detectorTest-first sentinel
.meowkit/state/detected-model.jsonmodel-detectorDetected model tier and density
.meowkit/state/session-sentinels.jsonlsafety-sentinel-inject, precompact-probeSafety-baseline verification and re-arm markers
.meowkit/state/active-planmk:autobuild, mk:plan-creatorCurrently active plan slug
.meowkit/state/last-session-idproject-context-loaderSession 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.

BehaviorClaude CodeCodexCursorGrokPiOMPAntigravity
Privacy blockprivacy-block.cjsPorted, Bash only: Codex has no file-read hook, so the decision runs on the shell command and the paths it namesPorted: privacy-read-gate.cjs on beforeReadFilePorted: privacy-block.cjs on PreToolUse, every toolPorted: guard.cjs through the extension's tool_callPorted: guard.cjs through the hook module's tool_callUnverified, from documentation: privacy-block.cjs on PreToolUse, every tool
Ship checkpre-ship.cjsPorted: pre-ship.cjs on PreToolUse BashPorted: pre-ship.cjs on beforeShellExecutionPorted: pre-ship.cjs on PreToolUse BashPorted: inside guard.cjs, on a shell commandPorted: inside guard.cjs, on a shell commandUnverified, from documentation: pre-ship.cjs on PreToolUse run_command
Session contextproject-context-loaderNot ported: AGENTS.md carries the standing contextEquivalent: session-context.cjs, a short pointer to .meowkit/ stateNot portedNot portedNot portedNot ported

Of the 24 observers, hook-coverage.json ports or maps only these off Claude Code:

ObserverCodexCursorGrok, Pi, OMP, Antigravity
pre-completion-checkPorted: completion-check.cjs on StopPorted: stop-followup.cjs sends the reason as a follow-up messageNot ported
plan-state-syncPorted: completion-check.cjs on Stop, line as systemMessagePorted: stop-followup.cjs, line on stderrEquivalent: the ship check prints the drift line, read-only
verification-evidencePorted: completion-check.cjs on PostToolUse BashPorted: completion-check.cjs on postToolUse ShellNot ported
learning-observer, post-session, precompact-probe, posttoolfailure-probeNot portedEquivalent: telemetry-observers.cjsNot ported
capability-bootstrapEquivalent: the text goes into AGENTS.mdNot portedNot 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.

EventPurposeCan it block?
PostToolUseDispatchBlocking
PostToolUseFailureDispatchBlocking
PreCompactDispatchBlocking
PreToolUseChecking file access permissionsBlocking
PreToolUseChecking web fetch targetsBlocking
PreToolUseDispatchBlocking
PreToolUseRunning ship check (lint, related tests, type-check)Blocking
SessionStartDispatchBlocking
StopDispatchBlocking
UserPromptSubmitDispatchBlocking

Registered with no hooks today: SubagentStart, SubagentStop.

On this page