Guide
AGENTS.md: the file that tells coding agents how your repository works
AGENTS.md is a plain Markdown file at the root of a repository that tells AI coding agents how to work on it: how to install, build and test, the conventions the code follows, and what to check before handing work back. The project behind the format calls it a README for agents.
It matters most when nobody is watching. An agent working in the background, or one that starts work on its own, can't stop and ask which test command to run. Whatever it needs to know has to be written down where it will look, and AGENTS.md is where a growing number of agents look.
What AGENTS.md is
It's an open format, not a product feature: one Markdown file, named AGENTS.md, with no required fields or headings. The agent reads the text you write and treats it as standing instructions for the repository. The format was put together by several coding agent makers, including OpenAI Codex, Amp, Google's Jules, Cursor and Factory, and is now stewarded by the Agentic AI Foundation under the Linux Foundation.
The idea is to keep agent-specific detail out of your README. The README stays short and written for people; AGENTS.md holds the exact commands, the gotchas and the rules that would clutter it.
What to put in it
- Setup: the commands that install dependencies and get the project running, exactly as typed, including the package manager and runtime version.
- Build, lint, type-check and test: one command each, and which of them must pass before the work counts as done.
- How to run one test or one package, so the agent doesn't run a twenty-minute suite to check a one-line change.
- Code style that a linter doesn't already enforce: naming, file layout, patterns to prefer and patterns the team has moved away from.
- Where things live: which folder holds the API, the UI, the generated code, and which files are generated and must not be edited by hand.
- Pull request rules: branch naming, title format, what the description should say, and whether to add tests with every change.
- Boundaries: files and folders not to touch (CI configuration, migrations already run, vendored code), and anything that needs a person, such as secrets or production access.
An example to start from
This is a starting point for a typical TypeScript web app. Replace every command and folder with your own: an agent will run exactly what the file says.
# AGENTS.md
## Setup
- Node 22. Install with `npm ci`.
- Copy `.env.example` to `.env`; tests need no real keys.
## Checks (all must pass before you finish)
- Lint: `npm run lint`
- Types: `npm run typecheck`
- Tests: `npm test` (one file: `npx vitest run path/to/file.test.ts`)
## Code
- TypeScript strict mode. No `any` in new code.
- API routes live in `src/server/routes/`, one file per resource.
- `src/generated/` is generated by `npm run codegen`: never edit it by hand.
## Pull requests
- One change per pull request. Title: `<area>: <what changed>`.
- Add or update tests for the code you change.
- Don't edit `.github/`, database migrations that have already run, or lock files you didn't need to change.What to leave out
- Secrets, tokens and internal URLs. The file is committed and read by tools that may run outside your network.
- Anything a tool already enforces. If the formatter fixes it on save or the linter fails on it, the instruction is noise.
- Long explanations of the architecture. Link to the doc that has them and keep AGENTS.md to what an agent needs to act.
- Rules for one corner of the codebase. Put those in a nested AGENTS.md beside that code instead.
- Instructions that contradict each other. Agents may follow either one, so read the file end to end when you change it.
Nested files and monorepos
You can put an AGENTS.md in any folder, not only the root. Agents that follow the format read the file nearest to the code they're editing, so a package in a monorepo can carry its own commands and rules while the root file covers what's shared. When instructions conflict, the closest file wins, and what you ask for directly in the prompt overrides all of them.
Tools differ in the details. OpenAI's Codex, for example, joins the files from the repository root down to the folder it's working in, lets an AGENTS.override.md replace the AGENTS.md beside it, reads a personal file from your Codex home folder as well, and stops adding files past a size limit (32 KiB by default). Check your agent's documentation for how it combines files and how much it reads.
Which coding agents read AGENTS.md
The agents.md site lists the tools that support the format, and the list keeps growing. Support also varies: some read the file automatically, some only when no tool-specific file is present, and some need a line of configuration. These are the documentation pages that say how each one handles it today.
- AGENTS.md (the format's own site): The format, examples from open-source repositories, and the current list of supporting agents.
- OpenAI Codex: How Codex finds, layers and overrides AGENTS.md files, and the size limit it applies.
- GitHub Copilot: Repository instructions for Copilot, including AGENTS.md files anywhere in the repository, with the nearest one taking precedence.
- Cursor: Cursor's rules, with AGENTS.md as the plain Markdown alternative to its project rules.
- Claude Code: How Claude Code reads CLAUDE.md, and when it reads AGENTS.md instead or alongside it.
- Jules by Google: Google's asynchronous coding agent, one of the format's founding supporters.
AGENTS.md vs. CLAUDE.md and other rules files
Before AGENTS.md, most tools had their own file: CLAUDE.md for Claude Code, .cursor/rules for Cursor, .github/copilot-instructions.md for Copilot, among others. Many of those still work, and some tools prefer their own file when both are present.
Claude Code is the common case. Recent versions read AGENTS.md when the repository has no CLAUDE.md; when it has one, Claude reads the CLAUDE.md instead unless you change its project instructions setting. Anthropic's documentation suggests keeping one shared file by putting an @AGENTS.md import at the top of CLAUDE.md, followed by anything specific to Claude, or by making CLAUDE.md a symbolic link to AGENTS.md.
The simplest rule: write your instructions once, in AGENTS.md, and make any tool-specific file point to it rather than repeat it. Two copies drift apart, and an agent following the stale one is worse than an agent with none.
Why it matters more for background and proactive agents
In your editor, a missing instruction costs a correction: the assistant runs the wrong command, you tell it the right one. A background agent has nobody to correct it until the pull request arrives, and a proactive agent, one that starts work on its own when an error appears or a dependency goes stale, may open several before anyone looks.
So the file does the job a person would do in the moment. If it says which checks must pass, the agent runs them before handing the work back. If it says which folders are off limits, the pull request doesn't touch them. Most of what makes an unattended agent's work easy to review comes from what this one file tells it.
Keeping it current
- Change it in the same pull request as the thing it describes: a new test command, a renamed folder, a new package manager.
- When an agent makes the same mistake twice, or a reviewer catches something it should have known, add one line that prevents it.
- Keep it short. A file an agent reads in full every time is worth more than a long one it skims; move detail into nested files or linked docs.
- Ask an agent to check it: have it compare AGENTS.md against the repository's scripts and CI workflow and list what's out of date.
Questions people ask
Where does AGENTS.md go?
At the root of the repository, next to README.md. In a monorepo you can add more AGENTS.md files inside packages or services; agents use the one nearest to the code they're working on.
Does AGENTS.md need a particular structure?
No. It's ordinary Markdown with no required fields. Headings such as Setup, Checks, Code style and Pull requests make it easier for people to maintain, but the agent simply reads the text.
Will an agent actually run the commands in AGENTS.md?
Agents that follow the format try to run the checks you list and fix failures before they finish. They can only run what their environment allows, so make sure the commands work in a fresh checkout without secrets.
Should I have both AGENTS.md and CLAUDE.md?
Only if you need instructions that apply to Claude Code alone. Otherwise keep one AGENTS.md; recent Claude Code versions read it when there's no CLAUDE.md, and where you do keep a CLAUDE.md, an @AGENTS.md import at its top includes the shared file.
Is AGENTS.md the same as README.md?
No. README.md is for people: what the project is and how to get started. AGENTS.md is for agents: the exact commands, conventions and boundaries that would clutter a README.
Want a coding agent that starts the work itself? Proactive Coding is your proactive coding agent. Get in touch and tell us what you're building.