Roles, Models and Safety Rails
Gates, Receipts and Secret Scanning
The Build and Test Gate
gate.js auto-detects your stack (package.json runs npm run build / npm test; Cargo.toml uses cargo; go.mod uses go; and so on) and can be overridden with .claude/gate.config.json. It is built to tell the truth:
- Zero-collected teeth: a test leg that collects no tests, or reports unhandled errors outside its pass/fail counts, fails — even when the runner exits 0
- KILLED is not FAILED: a leg stopped by a signal (an out-of-memory kill, Ctrl-C, a CI cancel) is reported as KILLED with the signal; a run that hits its time limit is TIMED OUT. Legs get default timeouts when your config omits one
- An opt-in
visualleg runs with the test gate (not under--no-build), locally only, and a run that finds zero snapshots fails gate.js full testbuilds and tests with no change-scoping;gate.js stopstops a running gate cooperatively
Receipts
Every gate run writes a receipt: the tree hash at start and end, HEAD, mode, config and engine identity, and per-project results. gate.js verify-receipt [--mode full] checks that a passing receipt covers the exact current tree, and a tree that changes mid-run makes the receipt invalid. The ship-check seal is built on these receipts.
A test project listed in test.projects with reuse: true may be skipped when its whole input closure is byte-identical to its last clean pass; receipts.maxAgeHours (24) and forceRunEvery (5) force fresh runs. Before turning receipts on, gitignore your build output (bin, obj, TestResults, coverage), or every run is invalid.
Secret Scanning
Scanning runs on the pinned Betterleaks engine. A reviewed false positive on a generic rule (never a named provider key) is cleared by the owner, never the agent, in one of three ways:
- a trailing
betterleaks:allowcomment on the same line, after the value - a
.betterleaksignorefingerprint (path:rule:line), read from the index, never the working tree - a
value-sha256:<hash>entry that clears one reviewed value anywhere
Large inputs are scanned in overlapping windows, so a secret on a chunk boundary is not missed. Content that is already committed and is only moved, renamed or copied byte for byte is not rescanned; any changed byte is a new blob and is scanned.
Keep the Gate Honest
Adopter gates are application-only: your project's build, test, lint and e2e. The toolkit's own test suite runs in the toolkit repository and never becomes a leg of your gate — not even after you edit agent files.
Never weaken an assertion or skip a scan to get a green check. A red gate with a clear cause is information; a green gate you bought by loosening the check is a liability.
Your test runner is killed by the out-of-memory killer mid-run. How does the gate report it?