Guide · Rules files
AGENTS.md, CLAUDE.md and Cursor rules: why rules files are not enforcement
Every serious AI-assisted codebase now has a rules file: AGENTS.md for most agents, CLAUDE.md for Claude Code, rules for Cursor. They help. But a rules file is a request. Nothing checks the agent actually followed it.
Which file does what
| File | Read by |
|---|---|
AGENTS.md | A shared convention read by Codex, GitHub Copilot, Windsurf, Gemini CLI and many other agents. |
CLAUDE.md | Claude Code. It can import AGENTS.md (@AGENTS.md) so both share one rulebook. |
| Cursor rules | Cursor's project rules. |
Why agents drift from the rules
- Rules are context, not constraints. The model weighs them against the task; the task usually wins.
- Files go stale. A rules file written in March doesn't know about the decision you made last week.
- Long files get diluted. Fifty rules read like none.
- No feedback loop. If a rule is broken, nobody finds out until review, or production.
What a good rules file contains
- What the project is, in one paragraph.
- The current task and which files it may touch.
- The behaviours that must keep working, and the command that proves each.
- A short "never do" list: protected paths, no new dependencies without asking, never weaken a test.
- Recent decisions, so they aren't reopened.
Turn rules into checks
The fix is to keep the file generated from things that can be verified. Stet does this: it writes the Stet block of AGENTS.md (imported by CLAUDE.md) from the project charter, the current scope, the locked behaviours and the decision log, then verifies the outcome.
npx stet-cli init # creates the charter, AGENTS.md and CLAUDE.md
stet scope set "Add CSV export" --allow "src/export/**"
stet decide "Prices are integer cents" --why "float rounding bugs"
stet guard && stet check # did the agent actually follow it?
Text you write outside the Stet block is kept. See the AGENTS.md guide for the full template.
Make your rules checkable
npx stet-cli init · AGENTS.md guide · Guardrails compared →