All posts
Guides

AGENTS.md: The One File That Rules Your AI Agent

AGENTS.md is the instruction file 60,000+ repos use to tell agents how to work. What goes in it, what to leave out, and how to write your first one.

Younes Alturkey
Younes Alturkey
September 27, 2026·today
AGENTS.md: The One File That Rules Your AI Agent

AGENTS.md is a plain Markdown file that sits in your project and tells an AI agent how to work on it — build commands, test commands, conventions, and the traps that waste its time. One file, read automatically, at a path the agent already knows to look for.

It has become the closest thing the industry has to a standard for this job: adopted across tens of thousands of open-source repositories, read by most major coding agents, and now stewarded by the Agentic AI Foundation under the Linux Foundation. If you run an agent against anything you care about, this is the cheapest quality upgrade available to you.

Why not just put it in the README

A README is written for humans arriving cold. An AGENTS.md is written for a machine that will run commands and then live with the consequences.

The split matters because the two documents want opposite things. A README should stay short and welcoming. An agent file should be dense and specific — the exact test invocation for one package, the fact that the dev server needs a migration first, the one directory that must never be edited by hand. Putting that in a README buries the human quick-start under machine plumbing.

The official project puts it well: AGENTS.md gives agents "a clear, predictable place for instructions" so READMEs can stay focused on human contributors.

What actually goes in the file

The format is deliberately unopinionated — there are no required fields, no schema, no validator. That freedom is why the file works and also why most first drafts are useless. A few sections carry almost all the value:

SectionWhat to writeWhy it pays off
Project overviewOne short paragraph: what this is, what it is notStops the agent inferring architecture from filenames
Build and test commandsThe literal command, per package if neededRemoves the trial-and-error phase entirely
Code styleOnly the rules a linter does not already enforceLinters cover formatting; you cover judgement
Testing expectations"Add or update tests for the code you change"The single highest-value line in most files
Security and cautionPaths, secrets or operations that are off-limitsTurns a silent mistake into a non-event

Notice what is missing: a personality brief, a list of everything the project does, a restatement of the framework's docs. An AGENTS.md is not a knowledge dump. It is the set of things a competent contractor would need on day one that they cannot get from reading the code.

A worked example

The official sample is a good template because it is unexciting:

# AGENTS.md

## Dev environment
- Use `pnpm dlx turbo run where <project>` to jump to a package.
- Run `pnpm install --filter <project>` before touching its deps.

## Testing
- Find the CI plan in `.github/workflows`.
- Run `pnpm turbo run test --filter <project>` for every check.
- After moving files, run `pnpm lint --filter <project>`.

## PR instructions
- Title format: `[<project>] <Title>`
- Always run `pnpm lint` and `pnpm test` before committing.

Every line is a command or a rule with a command behind it. Nothing is aspirational. That is the bar.

How to write your first one

  1. Start from a failing session. The next time an agent fumbles something — wrong test command, edits the wrong file, misses a migration — write down that exact correction. Three or four of those are your first draft.
  2. Write commands, not descriptions. "Run the tests with pnpm test" beats "the project has a comprehensive test suite". The agent can run the first one.
  3. Put it at the repository root. Root is the predictable location every tool checks.
  4. Add nesting only where it earns its keep. Large monorepos use nested AGENTS.md files, so a package's own rules are read when working inside it. OpenAI's Codex repository reportedly ships dozens of them. Start with one.
  5. Revisit it after big changes. A stale instruction file is worse than none, because the agent will confidently follow it.

The portability trick, and its limits

The reason AGENTS.md spread is that it is not proprietary. One file works across a growing ecosystem — Codex, Cursor, Amp, Jules, Copilot, Aider and others.

That was not always true of Claude Code, which reads its own CLAUDE.md. That gap closed on 18 September 2026, when Anthropic added AGENTS.md support: with no CLAUDE.md present, Claude Code now falls back to AGENTS.md.

Practical advice for the two-file world: keep the substance identical and let each file carry only the tool-specific extras. If you already have AGENT.md in the singular, the official FAQ suggests renaming and symlinking for backward compatibility:

mv AGENT.md AGENTS.md && ln -s AGENTS.md AGENT.md

One caveat worth knowing: a file that tells the agent how to run tests does not make the agent run them. Whether test commands execute automatically is a setting in the tool, not a property of the Markdown.

This is not only for code

The pattern generalises further than its origin. Any agent you give work to benefits from a small, inspectable file of standing instructions sitting next to the work.

Wolffish takes this literally: the agent's behaviour, preferences and accumulated knowledge live as plain Markdown you can open and edit, so "why did it do that" is answered by reading a file rather than by guessing at a prompt. The repository this post is published from carries its own AGENTS.md for exactly this reason — the same document pattern, pointed at a website instead of a service.

If you want the personal-agent version of the idea, start with how to prompt an agent properly, then move the standing parts into a file. That is the whole trick: prompts are what you say once, instructions are what you should only have to say once.

Takeaway

AGENTS.md is a Markdown file at a predictable path that tells an agent how to work: literal commands, real conventions, and the traps you already fell into. There are no required fields, so quality comes entirely from specificity — write commands rather than descriptions, start from your own agent's mistakes, and trim anything that is not a command or a rule. One good file beats any amount of re-prompting.

AGENTS.md starter pack: three templates, a filled example and a review checklistagents-md-starter-pack.zip · ZIP