# Rewrite AGENTS.md rules with a checklist

> Audit AGENTS.md for length, enforceability, duplicates and stale commands before you blame the model.

Source: https://fullbytedeveloper.com/blog/rewrite-agents-md-rules-checklist
Published here: 2026-11-26

An `AGENTS.md` that grew for six months usually fails because the commands are stale, the rules are vague, or a "never" sits in markdown where only a deny or hook can stop the tool. Rewrite it with a pass/fail audit before you blame the model [1] [2].

## Run a pass/fail audit

Mark each question Pass or Fail. Any Fail blocks the rewrite from merging.

| # | Question | Pass | Fail |
| --- | --- | --- | --- |
| 1 | Does every install, test and lint command still work on a clean clone? | Commands run green | Commands 404, wrong package manager, or CI-only |
| 2 | Is every rule concrete enough to verify? | "Use 2-space indentation" | "Format code properly" |
| 3 | Did you delete anything the agent can see in the tree? | No duplicated folder maps or API lists | Tree dumps and sermons the layout already shows |
| 4 | Is every hard stop outside markdown? | Deny/hook owns "never touch .env" | Only a prose "never" with no enforcement |
| 5 | Is the file under about 200 lines, or split by path? | Short, sectioned | Essay that burns context |
| 6 | Was each new rule added after a repeated mistake? | Second failure, then the rule | Speculative rules for futures nobody hit |

Claude Code memory docs target under 200 lines per `CLAUDE.md` file: longer files use more context and reduce how reliably Claude follows them [2]. Keep `AGENTS.md` to the same budget. Prefer several focused sections (setup, tests, PR) over one essay [1] [2]. agents.md shows that shape: setup commands, code style, testing instructions, PR instructions [1].

Paste this checker and fill Pass/Fail by hand:

```bash title="print audit rows"
python3 - <<'PY'
rows = [
    "Commands still work on a clean clone",
    "Every rule is concrete enough to verify",
    "No duplicate of README or obvious tree maps",
    "Hard stops live in deny/hook, not prose only",
    "File under ~200 lines or split by path",
    "New rules added only after a repeated mistake",
]
for i, r in enumerate(rows, 1):
    print(f"{i}. [ ] {r}")
PY
```

You should see six numbered checkbox lines.

## Delete vague and duplicate rules

Claude Code memory docs say auto memory skips architecture and paths Claude can derive from the codebase, and skips anything `CLAUDE.md` already says [2]. Apply the same filter to `AGENTS.md`:

- Delete repeated tree maps and copy-pasted API inventories.
- Delete "don't invent files" sermons when the folder layout is obvious.
- Delete human onboarding that already lives in `README.md` [1].
- Keep what a fresh agent session would otherwise re-ask: install, test, lint, deploy gates and house conventions that are not visible from code alone [2].

Vague lines fail the audit. Claude Code docs ask for instructions concrete enough to verify, and warn that if two instructions contradict each other, Claude may pick one arbitrarily [2].

## Add rules only after repeated mistakes

Claude Code memory docs say when to add to `CLAUDE.md` [2]:

1. Claude makes the same mistake a second time.
2. A code review catches something Claude should have known about this codebase.
3. You type the same correction into chat that you typed last session.
4. A new teammate would need the same context to be productive.

Use that bar for `AGENTS.md` too. A rule you invent "just in case" usually ages into noise. Keep entries to facts every session should hold: build commands, conventions, layout, "always do X" rules. Move multi-step procedures or path-only advice out of the root file (Claude Code path-scoped `.claude/rules/` for Claude-specific cases; nested `AGENTS.md` for shared agent entry in a package) [1] [2].

## Move hard stops out of prose

Claude Code treats `CLAUDE.md` and auto memory as context, not enforced configuration. To block an action no matter what Claude decides, use a PreToolUse hook [2]. Permission deny rules live in settings JSON, not in markdown wishes [3]. When you rewrite `AGENTS.md`, turn "never touch `.env`" into a settings deny (or hook) and leave a one-line reminder that points at that enforcement [2] [3].

Teaching reminder line (enforcement lives in settings):

```md title="AGENTS.md excerpt"
## Secrets
- Do not read `.env` files. Enforcement: deny rules in `.claude/settings.json` (see settings load order).
```

## Finish the rewrite checklist

1. Re-run the six pass/fail rows above until all Pass.
2. Date any fragile UI wording ("checked on YYYY-MM-DD") so the next rewrite knows what aged.
3. Confirm nested package files still win for their trees when you rely on nearest-file precedence [1].
4. If Claude Code also has a project `CLAUDE.md`, import `@AGENTS.md` or you will rewrite a file Claude never loads [2].

Related: [Write an AGENTS.md coding agents actually read](/blog/write-agents-md-that-agents-read), [Where each Claude Code instruction belongs](/blog/claude-md-where-instructions-belong), [Constrain AI coding agent scope](/blog/constrain-ai-coding-agent-scope), [Claude Code settings load order](/blog/claude-code-settings-load-order), [Stop an AI coding agent from over-engineering](/blog/stop-ai-coding-agent-over-engineering).

Your next PR should shrink the file and move one fake "never" into a real deny or hook.

Send this to the teammate whose AGENTS.md still lists a package manager the repo abandoned last year.

## Sources

1. [AGENTS.md format site](https://agents.md/)
2. [Claude Code docs: How Claude remembers your project (memory)](https://code.claude.com/docs/en/memory)
3. [Claude Code docs: Settings files and precedence](https://code.claude.com/docs/en/settings)
