Study Notes / 2026 ・ No.05
AGENTS.md Field Notes
The house rules you hand to an AI
Published
Questions for this issue
The short answer to Q4: you will write less of it, but it won't go away
Codex, Claude Code, Copilot, Cursor: start using coding agents
and a file called AGENTS.md begins to appear in repositories.
Here is what it is for, and how to write one that actually helps.
What AGENTS.md is — Q1
AGENTS.md is a README for coding agents: a plain Markdown file at the top of a repository, with no required format and no mandatory fields. An agent reads it when it starts work and learns how to build, how to run the tests and which rules to follow.
OpenAI published the format in August 2025, shaped together with Amp, Google's Jules, Cursor, Factory and others. That December it was donated, alongside MCP (see No. 1), to the new Agentic AI Foundation (AAIF) under the Linux Foundation, so it now belongs to no single company. According to the official site, more than 60,000 open-source projects use it and over 30 agents and IDEs can read it.
| Tool | Its own file | How it treats AGENTS.md |
|---|---|---|
| OpenAI Codex | AGENTS.md | The origin. Concatenates ~/.codex/AGENTS.md with every AGENTS.md from the repo root down to the working folder (32 KiB in total by default) |
| Claude Code | CLAUDE.md | Reads AGENTS.md instead when there is no CLAUDE.md (v2.1.277 and later). A CLAUDE.md can also pull it in with @AGENTS.md |
| GitHub Copilot (coding agent) | .github/copilot-instructions.md | Supports AGENTS.md since August 2025 |
| Cursor, Jules, Devin, Zed, Aider and more | Listed on the official site |
The difference from a README is the reader. A README is for people: what the project is and how to use it. AGENTS.md is for an agent doing the work: which command proves a change is right, what it must never touch. As the official site puts it, the agent-specific detail gets its own home instead of cluttering the README.
Why agents need it
An agent is a new hire on their first day, every day. As No. 1 explained, a model sees only what is in its context. Start a new session and whatever you told it last time is gone.
- Some things can't be inferred — “this HTML is generated, don't edit it” or “a person signs off before anything goes live” appear nowhere in the code
- Inference costs time and money — hunting for how to run the tests means opening file after file and trying things that fail. One written line saves all that
- Instructions drift between people — moving spoken reminders into a file means every teammate's agent, whichever tool it is, follows the same rules
Think of it as onboarding notes for a new colleague, with one difference: this colleague reads every word, every time, and follows it quite literally. That is exactly why it has to be short and precise.
When to use it — Q2
It pays off in repositories where agents work again and again, and above all where there are rules you can't see in the code. For a one-off small task, putting it in the request is enough.
| Situation | Fit | Why |
|---|---|---|
| Unusual build or test steps | ◎ | Custom scripts, Docker, required env vars. Letting the agent search burns time and tokens |
| Places that must not be touched | ◎ | Generated files, vendored code, production config. One bad edit is expensive |
| Business systems | ◎ | House naming rules, tables that need approval to change. Business rules aren't written in the code |
| A team using several agents | ◎ | One file tells every tool the same rules |
| A monorepo | ○ | When front end and API differ, each folder can have its own AGENTS.md |
| A small app with a standard layout | △ | Agents can work out a standard layout on their own |
| A throwaway script | × | Writing the file costs more than it saves |
A simple test: have you told an agent the same thing twice? If so, you will be saying it a third time. That is the moment to add one line to AGENTS.md, and the least wasteful way to grow the file.
How to write it — Q3
Three principles: short, specific, and only what the code can't tell the agent. To decide what goes in, ask two questions: could the agent find this out itself, and how costly is a mistake?
Write it, or leave it out?
Always write the top right. For the top left, don't just write it: enforce it
- Give commands exactly as they run — not “run the tests” but npm test -- --run. Agents really do execute what you write
- Add the reason in a few words — “generated, don't edit (fix build.py instead)”. With the reason, the agent handles similar cases you never wrote down
- Pair every don't with what to do instead — a bare prohibition sends the agent looking for another way round
- Keep it short — Claude Code's documentation suggests under 200 lines for a CLAUDE.md; Codex caps what it reads at 32 KiB by default. Longer files are followed less reliably, and you pay for them every session
- No secrets — passwords and API keys never belong in the repo, and this file is shared with everyone
- Enforce what must never happen — AGENTS.md is context, not configuration; it has no power to stop anything. Use branch protection to keep changes off main, and CI or hooks (such as Claude Code's hooks) to keep formatting intact
One file per folder: the nearest wins
Codex concatenates from the root down to the working folder; later (nearer) files act as overrides
In a monorepo, subfolders can carry their own AGENTS.md. The official rule: the nearest file takes precedence, and your request overrides them all. OpenAI's own main repository reportedly has 88 of them.
With Claude Code, an AGENTS.md is read directly when there is no CLAUDE.md. To keep both, the documented approach is a one-line @AGENTS.md import at the top of CLAUDE.md, with Claude-only instructions below it. A symlink (ln -s AGENTS.md CLAUDE.md) also works, but if anyone clones on Windows, the import is safer.
Example: this site's AGENTS.md
As an example, here is the AGENTS.md we would put in this site's own repository, kiji-site: a small repo where a single Python file generates pages in three languages, published on Cloudflare Pages. From building this blog with AI, I kept only what I kept having to explain and the mistakes that nearly happened.
| What's in it | Why it's there |
|---|---|
| *.html is generated | Asked to fix a style, an agent tends to edit the HTML directly, and the next build wipes it out |
| Commands and check widths | No searching. Even the screen widths to check are fixed |
| Steps for adding a post | The three edits belong together; miss one and the build stops |
| Checking figures | Labels overflowing in the English version actually happened twice |
| Photo licences | So it doesn't grab whatever image it finds online |
| No pushing | A person looks before anything goes live. Irreversible steps stay human |
What is left out matters just as much. No project tour: nothing like “written in Python” or “blog.html lists the posts”. Anything the agent can see by opening a file, it will read for itself. At around 30 lines, the file is also the size the research in the next chapter points to.
Does it actually work? — the research
There is little research so far, and the results disagree. But they point the same way: a short, human-written AGENTS.md that holds only what the code can't tell may help; anything else does nothing or gets in the way.
| Study | What was tested | Result |
|---|---|---|
| Lulla et al. (Jan 2026) | 10 repositories, 124 pull requests | With AGENTS.md, median runtime 28.64% lower and output tokens 16.58% fewer, with similar completion |
| Gloaguen et al. ETH Zurich (Feb 2026) | 138 AGENTbench and 300 SWE-bench Lite tasks; Claude Code, Codex, Qwen Code | LLM-generated files cut success by 0.5–2 points; human-written ones added about 4 points on average. Both raised inference cost by over 20%. Repository overviews didn't help |
| Khatri (Jul 2026) | Claude Code and Codex CLI, 17 tasks, 288 runs | No significant effect on correctness. Failures came from design and implementation skill, not missing knowledge |
The ETH paper explains why: agents follow the instructions faithfully and test and explore more, which makes the task itself harder. More text does not mean better results.
The practical lesson: don't commit a file generated by /init or similar as it is. If you generate one, read it and delete every line the code already makes obvious. That is the most reliable way to use AGENTS.md today.
The third paper is a preprint by an independent researcher. Every figure holds only under its own experimental setup.
Will smarter AI make it obsolete? — Q4
My answer: you will write less of it, but it won't go away. Split what usually goes into an AGENTS.md into three kinds, and it becomes clear which parts intelligence will replace and which it can't.
What remains once models are smarter
Widths are rough proportions. Unwritten intent doesn't shrink as models improve
- What you can read in the code (the project overview, the language, the folder layout) — already unnecessary today, and the research says it doesn't help
- What you can find out by trying (build and test commands, how to run it locally) — as models get smarter, faster and cheaper, searching costs less and less. Writing it down becomes purely a way to save time and money
- Intent that is written down nowhere (why it was done this way, what must never happen, who decides) — no amount of reading code or history will surface it. It isn't a question of intelligence; the information simply isn't there
Think of people. However brilliant an engineer is, on their first day in a new job they don't know that “we never touch the production database on Fridays” or that “changes to this table need sign-off from finance”. The best engineers are the ones who ask about those rules first.
What will change is the form. There are already ways for agents to note what they learn (such as Claude Code's auto memory), instructions loaded only when needed (skills), and mechanisms that enforce (hooks and CI), so less needs to go into one AGENTS.md. Still, a place where people write down what people decided, and where people and AI read the same thing, should remain, for the same reason the README never went away.
This chapter is the author's reading of the facts above.
§ — On one page
- AGENTS.md is a README for agents: plain Markdown, read by over 30 tools including Codex, Copilot and Cursor, and by Claude Code when there is no CLAUDE.md.
- Use it where agents work repeatedly and there are rules you can't see in the code. Told an agent something twice? Add a line.
- Write commands, don'ts with their alternatives, and the reasons. Short, and by hand. No overviews or generic advice.
- Enforce what must never happen with branch protection, CI and hooks. AGENTS.md can't enforce anything.
- The smarter AI gets, the less you need to write, but the file stays as the place for intent the code doesn't contain.
References
- AGENTS.md (official site)
- Linux Foundation — formation of the Agentic AI Foundation (Dec 2025)
- OpenAI — how Codex reads AGENTS.md
- Claude Code — CLAUDE.md and AGENTS.md
- GitHub — Copilot coding agent supports AGENTS.md (Aug 2025)
- Lulla et al., “On the Impact of AGENTS.md Files on the Efficiency of AI Coding Agents”
- Gloaguen et al., “Evaluating AGENTS.md: Are Repository-Level Context Files Helpful for Coding Agents?”
- Khatri, “Do Context Files Help Coding Agents? A Two-Agent Ablation Study on Real Repositories”
AGENTS.md Field Notes — seven chapters / 2026.09