Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Governance and Enforcement

Rules that only live in prose get forgotten. This page maps each governance invariant to the automated check that enforces it, so the rule and its tripwire stay together.

Enforcement map

InvariantEnforced byFailure mode
No secret ever committedsecret-scanner.sh (PreToolUse Write/Edit/MultiEdit) + gitleaks (CI)Write blocked (exit 2); CI job fails
No destructive/bypass shell commanddangerous-cmd-guard.sh (PreToolUse Bash)Command blocked (exit 2)
Reviewers end with an explicit verdictreview-verdict-validator.sh (SubagentStop) + .agents/rules/challenge-protocol.mdSubagent stop blocked until a verdict is present
Subagents get an adversarial mandatechallenge-injector.sh (PreToolUse Task)Mandate injected into the dispatch
Written code stays formattedquality-check.sh (PostToolUse) + fmt step of verify.shAuto-formatted; verify.sh fails on drift
Session state survives compactionsave-session.sh (PreCompact) + context-loader.sh (SessionStart) + .agents/rules/compaction.mdSESSION.md written / restored
Uncommitted or debug leftovers at stopcompletion-check.sh (Stop)One advisory block, then allowed
Layer hierarchy holdscargo run -p lint-layers (verify.sh + CI)verify.sh / CI fails
Generated code is not hand-editedcheck-generated-artifacts.sh, check-agents-md.sh (.mdc scan)verify.sh / CI fails
Skills reference only real filesvalidate-skills.py (verify.sh + CI)verify.sh / CI fails
Hooks behave as specifiedtest-hooks.sh (verify.sh + CI)verify.sh / CI fails
Local gate == CI gatecheck-gate-parity.py (verify.sh)verify.sh fails
Commits are conventional, not bypassescommit-msg hookCommit rejected

Red flags — stop and fix the cause

When you catch yourself reaching for one of these, the code or the rule is wrong. Stop and address the cause; do not bypass the gate.

  • Reaching for --no-verify, [skip ci], or disabling a hook.
  • Adding #[allow(...)], # noqa, or eslint-disable without an inline reason.
  • Hand-editing a *.g.rs, *.g.cs, *.g.ts, or generated/ file.
  • Adding a dependency or changing config that was not part of the request.
  • Making a claim about the code without having read the current source.

When a practice becomes a rule

When an agent repeats a mistake, check whether a rule should have caught it. If there is no rule, add one. If there is, it was not clear enough — sharpen it. Then add or tighten the validator so the next occurrence is caught deterministically rather than trusted.