Does an AGENTS.md help?
256 runs, with and without the file
Nov 23, 2026 · 6 min read
The question
An AGENTS.md is a file of instructions for coding agents. Many repositories have one, and tools will now write one for you. Does it change what the agent does, and what the run costs? I wanted a number, so I tested it on this site: the same tasks, with and without the file, scored by scripts and not by a model.
How the test worked
- Agent: Claude Haiku 5.5 through the Claude Agent SDK, six tools, no network. Each run got a fresh copy of this site at one fixed commit.
- Tasks: 32 small, one-sentence jobs, each run twice per condition, 256 runs in all. 24 are covered: they touch a rule in the real file, such as the corner radius of a new card. 8 are neutral: small utility functions the file never mentions.
- Scoring: a run counts as correct when the type check and lint pass, the task works, and every convention is followed. Every check was tested first against a known-good and a known-bad change.
- Pre-registered: the one comparison I committed to in advance was no file against the real file on the 24 covered tasks.
The four conditions
| Condition | What the agent got | Size |
|---|---|---|
| No file | Nothing | 0 lines |
| Short file | Stack, four commands, folder layout, four notes. Written by Claude, with none of the tested rules | 24 lines |
| Generated file | What the agent writes when asked to initialise a file, unedited | 73 lines |
| Real file | This site's own AGENTS.md | 107 lines |
Result 1: it followed the rules more often
On the 24 covered tasks, the share of runs that followed every rule went from 58% to 90%. The whiskers are 95% intervals: the range the true rate plausibly lies in, given only 48 runs. The no-file and real-file intervals barely overlap.
| Comparison | Difference | 95% interval | Verdict |
|---|---|---|---|
| No file → real file | +31 points | +12 to +52 | Detected (sign test p = 0.039, Wilcoxon p = 0.007) |
| No file → short file | +6 points | −4 to +19 | Not detected |
| No file → generated file | +4 points | −8 to +15 | Not detected |
| Short file → real file | +25 points | +8 to +42 | Detected (exploratory) |
Result 2: how well each rule was followed
The guide holds many separate rules. On the 24 covered tasks I checked 37 of them, twice each: 74 checks per condition. With no file, 72% were followed (53 of 74). With the real file, 93% (69 of 74). The grid below shows the 16 rules where the outcome differed. The other 21 were followed in every run, in every condition. The stronger the orange, the more often the rule was followed.
Read it from the top. The rules the real file fixed are the ones about exact values: a radius, an opacity, a letter spacing, a setting. Further down are rules the agents mostly followed anyway, and then the two where the real file did worse. The † marks two rules I later found to be flawed (see below). At the level of whole tasks, 10 improved, 2 got worse and 12 were identical.
What the file did not change
The code itself. In every condition it compiled, passed lint and did the task in practically every run: 100% with no file, 100% with the real file, 96% in the worst case (the generated file). The difference is whether the agent followed rules it cannot read from the surrounding code. When the code already shows the pattern, as with imports, translations and how scroll animation is built, the agent did fine alone. And on the 8 neutral tasks all 64 runs passed in every condition.
Result 3: the real file still missed rules
The real file was not a guarantee. Of its 74 rule checks it missed 5, on both models: 93% followed, not 100%. Three of the five were rules I later found flawed (see below). Two were real misses.
- It broke a rule it had just read. The guide keeps the coral accent for the last words of the quote. Asked to make the About title “stand out with colour”, the agent used that accent anyway in 3 of 4 runs with the real file, on both models, and once added a new violet as well. Without a file it got this wrong in all 4 runs, so the file did not fix it. A file can tell an agent that a colour exists and still not stop it using the colour where the task seems to invite it.
- It invented a contact address. On Haiku, one of two runs wrote
hello@example.cominto a placeholder, though the guide says not to invent content. With the file Sonnet did not, but without it Sonnet did, in both runs.
So a rule in the file is a strong nudge, not a hard limit, and when the task seems to ask for the opposite the rule can lose. My reading: if a rule really matters, back it with a script or a lint rule and do not rely on the file alone.
Result 4: what it cost
A run with the real file cost more, because the agent reads the file and writes more. But failed attempts cost too, so per correct run the real file was the cheapest.
| Condition | Cost per run | Time per run | Output tokens per run | Cost per correct run |
|---|---|---|---|---|
| No file | $0.0062 | 34.5 s | 3,118 | $0.0106 |
| Short file | $0.0066 | 39.8 s | 3,560 | $0.0102 |
| Generated file | $0.0070 | 41.3 s | 3,864 | $0.0113 |
| Real file | $0.0077 | 41.5 s | 4,058 | $0.0086 |
Result 5: does it hold for a stronger model?
I repeated the main comparison, no file against the real file, with Claude Sonnet 5.5, a larger model. I wrote down the plan first and changed nothing between the two runs. I expected the gap to shrink, since a stronger model might already follow more rules on its own. It did not: Sonnet followed 56% of the rules without a file, about the same as Haiku, and 90% with it.
| Model | No file | Real file | Difference | 95% interval | Cost per correct run |
|---|---|---|---|---|---|
| Haiku 5.5 | 58% | 90% | +31 points | +12 to +52 | $0.0106 → $0.0086 |
| Sonnet 5.5 | 56% | 90% | +33 points | +17 to +54 | $0.128 → $0.094 |
The gains were again in the tasks whose value is stated only in the file. Without it, Sonnet also invented a contact address in both runs of one task; with it, neither did. On the 8 neutral tasks both models passed every run. So the finding is not a quirk of one small model, though it is still two models from one family on one site.
Why a generated file did not help
The file the agent wrote for itself was 73 lines, and the short one 24. Both held what the agent can already work out by reading the code: the stack, the commands, the folders. The real file earns its place with what you cannot work out: exact values, and why they are what they are.
What went wrong in my own test
I read every failing run before trusting the numbers. Two things were my fault, and I report them instead of fixing them after the fact.
- A broken task. “A slightly different dark background” failed 8 of 8 runs, in every condition. The guide never says how to do it, and every agent invented a new colour. Without that task the gain is +33 points.
- A too-strict rule. It counted bold Lato text as a mistake, though the guide allows it. That cost the real file one run. Fixing it makes the gain +35.
Limits
- The tasks were written from the file. That favours the file by design. This shows that an agent follows rules it has been told, not that an
AGENTS.mdmakes agents better at coding in general. - Two models, one small repository. Haiku 5.5 and Sonnet 5.5 on this site, both from one family, and the tasks were tuned on Haiku pilots. Other models and codebases may differ.
- Modest power. 24 tasks run twice could reliably see a big effect only. A result of “not detected” for the other files is not proof that they do nothing.
- Heuristic checks. They read the diff, not the rendered page. About half of the gain comes from four tasks.
- Early rounds were tuned. Pilot runs shaped the tasks before the main run, which I disclose in full in the write-up. None of the pilot numbers are in this post.
Verdict
Write an AGENTS.md for what the code cannot teach: the exact radius, the opacity, the font weights, the setting that looks wrong but is right. Skip what the agent will work out anyway, and do not count on a file it generated for itself. If your style guide lives in your head, putting it in the file is the cheapest improvement I found. Just do not treat the file as a guarantee: check the rules that matter.
Run it on your own repository
Hand the recipe to your coding agent. The button copies a prompt with the method, the design, the scoring and the statistics. The harness, tasks, rules, every result and the notebook of decisions are in labs/agents-md/ in this site's repository.
Copies a prompt for your coding agent.