Play · Rules that hold
A rule in text is a wish. A rule in code is a rule.
Agents skim long instructions. Four pillars move each rule to the moment and the place where it is enforced.
Steering docsHooks, not rulesValidation gatesCI/CD pipelineThe team, files and output on this page are invented to illustrate.
The rule
"Never read .env files." Does it hold?
Same rule, same agent, same afternoon. One team wrote it down. The other made it code.
1Session starts
Rule in AGENTS.mdAGENTS.md 412 lines line 287: never read .env files
The rule is in there, deep down.
Enforced so far: 0 / 4
Rule in settingsAGENTS.md 38 lines .claude/settings.json deny: Read(./.env*) PreToolUse: block-env.sh
The rule is a setting and a script.
Enforced so far: 1 / 4
2It reaches for .env
Rule in AGENTS.mdRead(.env) DATABASE_URL=postgres://…
It read it. Nothing stopped it.
Enforced so far: 0 / 4
Rule in settingsRead(.env) Blocked: .env holds secrets. exit 2
Stopped, with the reason.
Enforced so far: 2 / 4
3It checks its work
Rule in AGENTS.md$ npm test 12 passed # lint and types never ran
Green, for some value of green.
Enforced so far: 0 / 4
Rule in settings$ pnpm validate lint · types · test · arch all passed
One command, every gate.
Enforced so far: 3 / 4
4The PR reaches CI
Rule in AGENTS.mdCI: test job passed # lint job allowed to fail
A red stage, ignored.
Enforced so far: 0 / 4
Rule in settingsCI: validate passed branch protection: required
Nothing merges red.
Enforced so far: 4 / 4
The chain
Each pillar moves a rule closer to code
- Steering docsA short fileonly what code cannot enforceWithout it: a manual nobody finishes
- Hooks, not rulesA deny rule and a hookthe floor, plus the reason at the momentWithout it: a sentence it may skip
- Validation gatesOne commandevery check, one verdictWithout it: whichever tests it remembers
- CI/CD pipelineCIthe same command, fail closedWithout it: a red stage nobody reads
The gains
For the agent
- Feedback the moment it slips
- Fewer rules to hold in mind
- A clear red instead of a review comment
For the team
- The same review comment stops coming back
- Rules hold whoever writes the code
- Steering files people actually read
Try it on your repo
Pick three rules from AGENTS.md. Try to break each one.
Ask an agent to do each forbidden thing. Count how many something actually stops.