AGENTS.md: the note the agent reads first
Why a workspace needs an AGENTS.md, why it is more than a note, how we adapted ours — and which other files sit next to it.
An agent working in a directory knows nothing at the start. It sees files, but not intent: not which command runs the tests, not what counts as clean in this project, not what it must never touch. Every session begins at zero, and every answer it gives without that context is a guess that may happen to be right.
AGENTS.md is where that context lives. A file in the top directory of the project that every agent reads before calling the first tool.
What the file is for
The comparison the format itself uses: a README for agents. The README explains to a human how the project is meant; the AGENTS.md tells the agent what applies in this directory. The difference is not only the addressee but the kind of statement. A human reads once and remembers. An agent reads anew in every session and needs the same statement again, in the same form.
In content these are usually four kinds of sentence:
- Commands that work: how to build, how to check, how to deploy. The agent does not have to guess them, and does not have to search the project for them every time.
- Conventions: naming, language, formatting, where something belongs.
- Boundaries: what it must not do. No printing credentials, no deleting, no installing packages without asking.
- Pointers to records: which file carries the editorial rules and which the technical ones.
The format is open, and many tools read it: Codex, Jules, Aider, Cursor, Zed, Gemini CLI and others. Claude Code’s documentation explicitly names CLAUDE.md or AGENTS.md; Cursor lists AGENTS.md as the simple alternative to its own rule files. Maintain the file once and you do not have to write it again for every tool.
Why it is more than a note
Without the file a pattern emerges that you know after a few weeks: the agent proposes a structure the project already has. It carries on building somewhere that was abandoned long ago. It writes in a tone you corrected last time. None of this is a failure of the model. It is a missing note.
With the file, the work shifts. Instead of correcting every session, you change a rule once. And because the same file applies in every session, a decision survives after the conversation is long over.
A second point that is easily missed: the file forces you to write things down. Whoever has to explain how the project is built notices that nobody ever wrote it down. That is not a side effect, it is often the larger gain.
Large projects have gradations. If an AGENTS.md sits in a subdirectory, it applies there; the agent reads the file closest to it in the directory tree. So you can have a general file at the top and one per subproject.
How we adapted ours
Our AGENTS.md did not come about in one go. It is the result of several rounds, and the direction was almost always the same: fewer rules, more principles.
The first draft was a collection. Every mistake we noticed became a rule, every rule got an example. The result was complete and unusable: the agent worked through the list and wrote texts that looked as if someone had worked through a list. Forty style rules do not make a style.
After that we changed the approach. The file now begins with a basic rule against which everything else can be measured, and below it a few sections explain what that rule means in practice. Word lists — the enumeration of phrases to be struck out — are gone. In their place stands one sentence about why they are to be struck out.
The second part of the work was testing. After every change we wrote a real article with it and read it. Whatever remained only as a rule on paper and had no effect on the text was removed again. A rule that you do not notice when reading the result is either superfluous or badly worded.
The third part was cutting. At one point the file was considerably longer than it is today. We cut not because space was short but because rules cancelled each other out: “write vividly” and “write soberly” neutralise each other, and the agent then looks for a middle way that half satisfies both. What stayed is what forces a decision.
The other files next to it
The AGENTS.md is the entry point, not the whole set. A few more files sit in our workspace with a similar purpose but a different subject. They are split by area so that one file does not have to carry everything:
- an editorial record for the content: narrative form, titles, images, references, checks before publication;
- a technical record for templates, stylesheets, scripts and delivery;
- a paper that fixes the fundamental decisions before anything is built — platform, delivery, encryption;
- a dated log that holds every finished piece of work, newest entries on top;
- a collection of our own mistakes, each with cause and the rule that follows from it.
The split has a practical reason. The AGENTS.md always applies; the other files apply depending on the task. Whoever works on an article needs the editorial record and not the technical one. Whoever works on delivery, the other way round. A single huge file would be half ballast for every task, and the agent reads it anyway.
There is a second reason: the log and the collection of mistakes grow. They are dated and appended, not rewritten. The AGENTS.md stays small because it holds only what applies permanently.
What does not belong in it
The file gets read along and is often versioned. So no credentials belong in it, no keys, no internal addresses. Paths to configuration files may be named, their contents not.
Nor do things that only apply once belong there: yesterday’s state, an open bug, a note about one particular customer. Such sentences go stale in the file and are then followed wrongly. They belong in the dated log, where you can see when they were written.
And finally: no rules in reserve. Every line there is read on every task — including the ones not needed right then. What has not proven itself in a real case stays out.
If you start yourself
The beginning is unspectacular. Twenty lines are enough: how it is built, how it is checked, what must not be touched, which file carries which rules. After that you write with it and change what does not work.
If you need help with it — setting it up, reviewing an existing file, or cutting one that has grown too long — write to me through the contact form or at blog@gustl.icu. I am happy to look at it.
Sources
All addresses retrieved on 25 November 2026, each answered HTTP 200.
- AGENTS.md, open format for agent instructions — purpose, structure, nested files, adoption: https://agents.md/
- The same project in source, README and example: https://github.com/agentsmd/agents.md
- Claude Code, project memory —
CLAUDE.mdorAGENTS.md, loading from the directory tree, importing further files: https://code.claude.com/docs/en/memory - Cursor, rules —
.cursor/rulesandAGENTS.mdas the alternative: https://cursor.com/docs/context/rules