claude-hook-kit
Scott Converse · Claude Code · MIT

Rules that hold
because a hook enforces them.

Thirteen Claude Code hooks, switched on per project. A rule written in a prompt can be skipped. A hook that returns exit 2 cannot. Install once; each hook stays off in every folder until that folder opts in with one config file.

Verified boundary: every hook is tested by running it as a child process with a real hook event (140 tests, Node 24 on Windows), every ported hook has a parity test against its original, and node doctor.mjs checks that the installed copy is registered and alive. A read ledger proves that files exist with the stated line counts, not that the code was understood or reused. A fresh receipt proves freshness, not a true result. measure-gate gives up after a set number of blocks so it can never loop forever.

The thirteen hooks

Each one has one job. The ones labelled before tool use block a tool call. The ones labelled turn end block the end of a turn.

CONTEXT

inject-rules

Adds your project's rules file to Claude's context at session start and with every prompt. Never blocks.

BEFORE TOOL USE

deploy-gate

Blocks a deploy command until a gate file for the exact commit passes its checks.

BEFORE TOOL USE

walk-brief-guard

Blocks a walk brief that breaks a rule you set, such as a missing required section.

BEFORE TOOL USE

read-ledger-gate

Blocks any write to a code file until a read ledger lists the upstream files that were read, with true line counts.

BEFORE TOOL USE

db-write-guard

Blocks a command that can write to a live database, unless a fresh go file is present.

TURN END

no-idle

Blocks the end of a turn while background workers are left unattended.

TURN END

double-check

Blocks the end of a turn once, so Claude re-checks its work against a checklist. The second stop goes through.

TURN END

measure-gate

Blocks the end of a turn while the code is newer than the newest measurement receipt. No "done" without a number.

TURN END

citation-gate

Blocks the end of a turn while an audit, review or handoff cites a file the session never read. UNVERIFIED is always accepted; silence is not.

TURN END

sprint-gate

While a sprint is armed the agent cannot end the turn. Only a human with the passphrase can disarm; the cap pauses, never disarms.

BEFORE TOOL USE

command-gate

Blocks a forbidden shell verb even behind sudo, a path prefix, a pipeline or sh -c. Default rule: never kill a process by name or pattern. Optional commit-size gate.

TURN END

ran-before-done

Records edits to runnable files and tool calls that ran anything. If code was edited and nothing ever ran, blocks the stop once.

BACKGROUND

wake

After a delay, 20 minutes by default, wakes Claude with a status list of its workers.

Install once. Opt in per project.

Needs Node.js 18 or newer. No npm packages. The installer backs up your settings file first, never duplicates entries, and leaves every other hook alone.

git clone https://github.com/scottconverse/claude-hook-kit
cd claude-hook-kit
node install.mjs
node init-project.mjs C:/dev/my-project --example agent-build
  1. Install once. node install.mjs copies the hooks to ~/.claude/hook-kit/ and registers them in ~/.claude/settings.json.
  2. Opt in per project. Add .claude/hook-kit.json to the project folder. List only the hooks you want, with their settings.
  3. Hooks run only there. A hook looks for that file in its own folder, then in each folder above it. The nearest file wins. No file means no effect.

Example: the two agent-build gates

From examples/agent-build.hook-kit.json. No code before the upstream code was read; no "done" before a fresh measurement.

{
  "read-ledger-gate": {
    "upstreamRoots": ["C:/upstream/project-a", "C:/upstream/project-b"],
    "mustMention": ["project-a", "project-b"],
    "minEntries": 10,
    "minLines": 2000
  },
  "measure-gate": {
    "receiptDir": "work/receipts",
    "receiptPattern": "^receipt-.*\\.json$",
    "measureCommand": "node work/measure/run.mjs",
    "maxBlocks": 3
  }
}

Safe by default

A sibling kit for Codex, with the same project conventions: codex-hook-kit.