- Published on
Does an AGENTS.md Make a Coding Agent Better?
- Authors

- Name
- Mehdi Akiki
Article · Measurement
I asked Claude Code to write an AGENTS.md for a small Rust repository. It took 20 seconds and cost about 8 cents. The file was 420 words long. It described every module, the build and test commands, and the conventions. It even found a rounding rule that was hidden in a comment in one source file.
It looked useful. But an instruction file is not free. The agent reads it in every session, and it follows it. So I wanted to know: does the agent finish more tasks with this file, or does it only do more work?
A research team asked the same question at a much bigger scale. In the paper "Evaluating AGENTS.md: Are Repository-Level Context Files Helpful for Coding Agents?", researchers from ETH Zurich and LogicStar.ai write: "we find that providing context files does not generally improve task success rates, while increasing inference cost by over 20% on average." I wanted to see this on my own laptop, in Rust, with tests that I wrote myself.
Six tasks, and the tests came first
The repository is constructed for this check. It is a small Rust library for a personal expense ledger, called tally: amounts in cents, dates, one entry per line, and a few reports. It has six source files and no dependencies.
Before any agent run, I wrote one test per task, from the task text and the project's documented rules. The agent never saw these tests. I added each test only after the run, in the agent's copy, and it decided pass or fail. Each test also contains cases that a plausible wrong version gets wrong. I checked this for five tasks: I wrote a correct version, which passed all six tests. Then I wrote six wrong versions for five of the tasks, for example integer division for task 4, and each one failed its test.
| Task | What the agent must do | A case in the deciding test |
|---|---|---|
| 1 | Fix: -0.50 parses as plus 50 cents | --1 must still be an error |
| 2 | Add top_categories(n), ties in A to Z order | a tie, n = 0, and a negative total |
| 3 | Add spent_in(category) | "Groceries" must match entries stored as groceries |
| 4 | Add average_per_day(days) | 25 cents over 2 days must give 12, and 35 cents must give 18 |
| 5 | Add to_csv() with quoting | a note with a comma, a quote and a line break |
| 6 | Report the line number of a parse error | blank and comment lines must count |
Tasks 3 and 4 depend on project rules that the task text does not repeat. The README says that category names are not case-sensitive. A comment at the top of money.rs says that half a cent rounds to the even cent, so 12.5 becomes 12 and 17.5 becomes 18. Plain integer division gives 17 there, and f64::round gives 13 for 12.5.
Three versions of the same repository
Each run got a fresh copy of the repository, in one of three versions:
- No file. Only the code and the README.
- Generated file. The 420-word AGENTS.md from the start of this article. I asked Sonnet once to write an AGENTS.md that describes the project, its layout, how to build and test it, and its conventions, and to save it in the repository root. I used the same file for all runs.
- Hand-written file. Four rules, 92 words, only things that the code does not make obvious:
# Notes for coding agents
- Money is whole cents (`money::Cents`), never floating point.
- When a division of money leaves a remainder, round to the nearest cent, and
round half a cent to the even cent: 2.5 -> 2, 3.5 -> 4, -2.5 -> -2.
Plain integer division and `f64::round` both get this wrong.
- Category names are not case-sensitive. They are stored in lowercase, so
lowercase a category name that comes from a caller before you compare it.
- Do not add dependencies. Run `cargo test --offline` before you finish.
The generated file had both rules too: "Categories are case-insensitive", and "round half to even (banker's rounding: 12.5 -> 12, 13.5 -> 14, -12.5 -> -12)". It also had a build section with cargo clippy --all-targets and cargo fmt --check, and the line "Run the commands above before finishing."
Claude Code reads an AGENTS.md when the repository has no CLAUDE.md, so I did not need any other setting. More about which files it loads is in what Claude Code loads.
The agent was Claude Code 2.1.325 with Sonnet at --effort low, started with claude -p. It could edit files and run cargo. Other shell commands that need approval were refused, because nobody was there to approve them. Six tasks, three versions, two runs each: 36 runs, one after another, on November 15, 2026.
Results per task
| Task | No file | Generated | Hand-written |
|---|---|---|---|
| 1 Negative amounts | 2 of 2 | 2 of 2 | 2 of 2 |
| 2 Top categories | 2 of 2 | 2 of 2 | 2 of 2 |
| 3 Spent in a category | 1 of 2 | 2 of 2 | 2 of 2 |
| 4 Average per day | 2 of 2 | 2 of 2 | 2 of 2 |
| 5 CSV export | 2 of 2 | 2 of 2 | 2 of 2 |
| 6 Line numbers | 2 of 2 | 2 of 2 | 2 of 2 |
35 of 36 runs passed. The only failure was task 3 without a file. The agent wrote this:
pub fn spent_in(&self, category: &str) -> Cents {
self.entries
.iter()
.filter(|e| e.category == category)
.map(|e| e.amount)
.sum()
}
It compiles, and it works for "groceries". For "Groceries" it returns zero. In that run the agent read only ledger.rs. It never opened entry.rs, where categories are lowercased, and it never opened the README. In the second run without a file, the agent read entry.rs and added category.to_lowercase(). So one rule, one run, one difference. That is a real failure, but one run cannot tell you a rate.
Task 4 surprised me. I expected the rounding rule to be the place where a file helps. But both runs without a file passed. The agent printed money.rs with cat, saw the comment, and wrote banker's rounding correctly.
The files changed the work, more than the result
The success rate was nearly the same. The work was not. These are means per run, with Claude Code's reported cost:
| No file | Generated | Hand-written | |
|---|---|---|---|
| Passed | 11 of 12 | 12 of 12 | 12 of 12 |
| Turns | 6.7 | 9.8 | 9.3 |
| Cost (USD) | 0.066 | 0.102 | 0.082 |
| Time | 17.6 s | 29.3 s | 22.2 s |
Ran cargo test | 5 of 12 | 12 of 12 | 12 of 12 |
| Ran clippy and fmt | 0 of 12 | 12 of 12 | 0 of 12 |
Added tests to tests/ledger.rs | 0 of 12 | 12 of 12 | 3 of 12 |
Changed src/date.rs, which no task needed | 0 of 12 | 6 of 12 | 0 of 12 |
Compared with no file, on average, the generated file made a run 56 percent more expensive, and it took 67 percent longer. The hand-written file made it 25 percent more expensive.
Look at the last rows. The agent did what the files said, and sometimes more. The generated file listed cargo clippy --all-targets and cargo fmt --check, and every run ran both. --check only reports. But my repository was not formatted with rustfmt, so in six runs the agent also ran plain cargo fmt, which rewrote one long line in date.rs. So six of the twelve changes came with an edit to a file that the task never touched. The agent also added its own tests in every run with the generated file, because the file said to add integration tests to tests/ledger.rs. No task asked for them. That is not bad work. But it is work you pay for, and work you must review.
Without a file, the agent ran the tests in only 5 of 12 runs. It still passed 11 of 12. And running the tests would not have saved task 3, because the existing tests did not check mixed-case categories.
Compared with the paper
The study used 300 SWE-bench Lite tasks and 138 tasks from 12 repositories with developer-written files, and four agent setups, Claude Code with Sonnet 4.5 among them. These are the numbers I checked in the current version, v3 from September 29, 2026:
- Generated files: "the average resolution rate is reduced by 0.5% and 2% on average" on the two benchmarks, with p-values of 87% and 37%, so no significant effect. Cost went up by 20% and 23% on average.
- Developer-written files: "improve agent performance by 2.4% on average ( p=21% )", and increased cost by at most 19%. They helped every agent "but Claude Code".
- Agents follow the files: "uv is used 1.6 times per instance on average when mentioned in the context files, compared to fewer than 0.01 times when it is not mentioned".
My small check points the same way. Success did not clearly change: 11, 12 and 12 of 12 passes is one run of difference. Cost went up with both files, more with the generated one.
The paper's advice for human-written files matched my hand-written file: "Human-written context files should only include instructions required for coding agents that are not already present in the README (e.g., specific conventions or non-functional requirements)".
Limits
This is a small check, not a benchmark. It is 36 runs on one constructed repository of six files, with six tasks that I wrote, two runs per task and version. One model, Sonnet at low effort, one version of Claude Code, one laptop, one day. My permission setup refused some shell commands in every version, for example appending a test with a heredoc, and the agent switched to the edit tool. Refusals were more frequent with a file: 18 and 22 refused commands, against 4 without one. So part of the extra turns and cost came from retries that a setup with other permissions might not have. Both rules lived somewhere in the repository, so I did not test a rule that exists only in the instruction file. And the costs are Claude Code's reported cost at list price.
What I would put in an AGENTS.md
Start with what the agent cannot find. Before you delete a line that looks obvious, test without it: in my audit, one such line was doing a job. A rule that lives in one comment in one file is a good candidate: the agent found it here, because it printed that file for a money task. A task that does not touch money code may never show it. A list of modules is a weak candidate: the agent read the code anyway in my runs, and the paper found that overviews did not help.
Treat every command in the file as a cost. The line "Run the commands above before finishing" put clippy and fmt into every run. In half of the runs it also led to an unrelated diff, because my code was not formatted. If you want that rule, format the repository first.
Then check your file the way you check code. Write two or three tasks with tests that you write first, and run them with and without the file. For cutting an existing file down, see auditing an agent instruction file line by line.