AGENTS.md: the instructions file for coding agents
ExplainerBy Lucas Matías García TorresUpdated Data checked 4 min read
Reviewed by Lucas Matías García Torres on . How we work.

Short answer
AGENTS.md, on October 23, 2026, is a Markdown file in a repository that tells coding agents how to build, test and style the project. Codex, Cursor and GitHub Copilot read it directly, and Claude Code reads it when there is no CLAUDE.md, or through an @AGENTS.md import. In nested setups the file closest to the edited code wins, and limits apply: Codex reads up to 32 KiB by default and Anthropic recommends CLAUDE.md files under 200 lines.
Prices and limits change often: check the vendor's page before you pay. How we make money.
AGENTS.md is a plain Markdown file at the root of a repository that tells coding agents how to work on the project: how to build it, how to run the tests, which conventions to follow and what to avoid. Its official site calls it a README for agents, kept separate from the README written for people. On October 23, 2026, Codex, Cursor, GitHub Copilot and many other tools read it, and Claude Code reads it when the project has no CLAUDE.md of its own. This guide explains what to put in the file, how each tool finds it and how to keep it short and safe, based on the documentation of each tool read on October 23, 2026.
What AGENTS.md is for
A coding agent starts every session knowing nothing about your project. Without instructions it guesses the package manager, runs the wrong test command or reformats files against your style. AGENTS.md gives it a predictable place to look. The format has no required fields: it is ordinary Markdown with whatever headings make sense. The agents.md site says agents will try to run the testing commands you list there, so the file is not just documentation but a set of instructions the agent acts on.
The format is now stewarded by a foundation under the Linux Foundation, and the site says it is used by over 60,000 open-source projects. Supported tools listed there include Codex, Jules, Aider, goose, opencode, Zed, Warp, VS Code, Devin, Junie, Amp, Cursor, RooCode, Gemini CLI, Kilo Code, the GitHub Copilot coding agent, Windsurf and Augment Code.
What to put in it
The agents.md site suggests a project overview, build and test commands, code style guidelines, testing instructions and security considerations. Headings help in long files, but a minimal file can be four lines:
Setup: pnpm install, then pnpm dev for the dev server.
Tests: run pnpm test before every commit; all tests must pass.
Code style: TypeScript strict mode, single quotes, no semicolons.
Security: never commit .env files or print secrets in logs.
Write commands exactly as they should be typed, and prefer concrete rules ("run pnpm lint") over vague ones ("keep the code clean"). If you are new to agents in the terminal, our guide on how to use Claude Code shows the same kind of file in practice.
How each tool reads it
Table: how coding tools load AGENTS.md (official documentation, checked October 23, 2026)
| Tool | Reads AGENTS.md? | Own instructions file | Nested files and precedence |
|---|---|---|---|
| Codex (OpenAI) | yes, global and per project | AGENTS.override.md, fallback names you configure | walks from the repository root to the current folder, one file per folder; closer files come later and override earlier ones |
| Claude Code | yes, when there is no CLAUDE.md or CLAUDE.local.md (version 2.1.277 or later) | CLAUDE.md, CLAUDE.local.md, .claude/rules/ | files from the root to the current folder are combined; subfolder files load when needed |
| Cursor | yes, in the root and in subfolders | .cursor/rules/ with .mdc files | AGENTS.md files are combined and the more specific one wins |
| GitHub Copilot | yes, anywhere in the repository | .github/copilot-instructions.md and .github/instructions/*.instructions.md | the nearest AGENTS.md takes precedence |
Claude Code has a setting called Project instructions that decides which file wins: by default it reads CLAUDE.md or, failing that, AGENTS.md, and it can also read both, CLAUDE.md only or managed files only. If you want one source of truth for every tool, Anthropic's suggestion is to keep the rules in AGENTS.md and import it from CLAUDE.md with a line containing @AGENTS.md. Claude Code does not read AGENTS.local.md, AGENTS.override.md or a .agents/ folder. Our comparison of Claude Code and Cursor covers the other differences between the two.
Nested files in a monorepo
Large repositories can have one AGENTS.md per package. The agents.md site's rule is simple: the file closest to the code being edited takes precedence, and an explicit instruction from the user in the chat overrides everything. Codex makes the mechanics explicit: it reads one file per folder from the root down to where you started it, in the order AGENTS.override.md, then AGENTS.md, then any fallback names, and concatenates them so the closer files come last. GitHub Copilot also accepts a single CLAUDE.md or GEMINI.md at the root instead of AGENTS.md, and when personal, repository and organization instructions all exist, it uses all of them, with personal ones taking precedence.
Keep it short
Every line costs context on every request, and the tools set limits. Codex stops reading project instructions at 32 KiB by default (project_doc_max_bytes). Anthropic recommends keeping each CLAUDE.md under 200 lines, and Cursor suggests keeping rules under 500 lines. Move long reference material into separate documents, and for Claude Code use path-scoped files in .claude/rules/ so a rule only loads when the agent touches matching files. To check what Codex actually loaded, ask it to summarize its current instructions.
Security: an instructions file is code
Agents follow AGENTS.md, so treat changes to it like changes to a build script: review them in pull requests. Never put API keys, passwords or tokens in it, because the file is committed and sent to the model on every task. Be careful with files from repositories you do not trust: a malicious AGENTS.md is a ready-made prompt injection, and an agent with shell access may run the commands it lists. The same caution applies to tools connected through MCP. For a broader view of which agents to trust with your code, see our guide to the best coding assistants.
What we checked
- AGENTS.md is described as a README for agents, a dedicated and predictable place for context and instructions, with README.md kept for humans; suggested sections are project overview, build and test commands, code style, testing instructions and security considerations; agents will attempt to run the testing commands listed; in nested setups the closest file takes precedence and explicit user prompts override everything; the format is stewarded under the Linux Foundation and used by over 60,000 open-source projects; supported tools include Codex, Jules, Aider, goose, opencode, Zed, Warp, VS Code, Devin, Junie, Amp, Cursor, RooCode, Gemini CLI, Kilo Code, the GitHub Copilot coding agent, Windsurf and Augment Code. (AGENTS.md, )
- Claude Code reads CLAUDE.md files in managed, user, project and local scopes, combining files from the root to the current folder and loading subfolder files on demand; it recommends keeping each file under 200 lines; .claude/rules/ holds path-scoped rules; since version 2.1.277 it reads AGENTS.md when there is no CLAUDE.md or CLAUDE.local.md; the Project instructions setting accepts claude-md-or-agents-md (default), claude-md-and-agents-md, claude-md and managed-only; it does not read AGENTS.local.md, AGENTS.override.md or .agents/; to share instructions, import AGENTS.md from CLAUDE.md with @AGENTS.md. (Anthropic, )
- Cursor project rules live in .cursor/rules as .mdc files with description, globs and alwaysApply; rule types are Always Apply, Apply Intelligently, Apply to Specific Files and Apply Manually; AGENTS.md is supported in the root and in subfolders, combined, with more specific files taking precedence; rules should stay under 500 lines. (Cursor, )
- GitHub Copilot reads repository instructions from .github/copilot-instructions.md and path-specific files in .github/instructions/NAME.instructions.md with applyTo; agent instructions can come from AGENTS.md files anywhere in the repository, with the nearest taking precedence, or from a single CLAUDE.md or GEMINI.md at the root; personal, repository and organization instructions are all provided, with personal instructions taking precedence. (GitHub, )
- Codex reads a global AGENTS.override.md or AGENTS.md from its home folder, then walks from the project root to the current folder reading at most one file per folder in the order AGENTS.override.md, AGENTS.md and configured fallback names; files are concatenated so closer files override earlier ones; project_doc_max_bytes limits project instructions to 32 KiB by default; you can check the loaded instructions by asking Codex to summarize them. (OpenAI, )
What may change
- Support for AGENTS.md changes quickly as tools add or change features. This page is reviewed quarterly.
- The sample file is our example, not an official template.
Frequently asked questions
What is AGENTS.md?
A Markdown file, usually at the root of a repository, with instructions for coding agents: setup and build commands, how to run tests, code style and security rules. Its official site describes it as a README for agents, separate from the README written for people.
Does Claude Code read AGENTS.md?
Yes, since version 2.1.277, when the project has no CLAUDE.md or CLAUDE.local.md. The Project instructions setting can also make it read both files, only CLAUDE.md or only managed files. To share one file across tools, import it from CLAUDE.md with a line containing @AGENTS.md.
What is the difference between AGENTS.md and CLAUDE.md?
AGENTS.md is an open format read by many tools, including Codex, Cursor and GitHub Copilot. CLAUDE.md is Claude Code's own file, with extra features such as imports, user and local scopes and path-scoped rules in .claude/rules/. Claude Code prefers CLAUDE.md when both exist, unless you change its setting.
Can I have more than one AGENTS.md?
Yes. In a monorepo you can put one in each package. The file closest to the code being edited takes precedence, and an explicit instruction in the chat overrides everything. Codex combines the files from the root down to the current folder, with closer files overriding earlier ones.
How long should AGENTS.md be?
As short as possible. Codex reads up to 32 KiB of project instructions by default, Anthropic recommends keeping each CLAUDE.md under 200 lines and Cursor suggests rules under 500 lines. Every line is sent to the model, so move long reference material to separate documents.
Sources
- AGENTS.md: an open format for guiding coding agents, with suggested sections, nesting rules and supported tools, AGENTS.md. Accessed October 23, 2026.
- How Claude Code remembers your project: CLAUDE.md scopes, imports, rules and AGENTS.md support, Anthropic. Accessed October 23, 2026.
- Rules (Cursor documentation): project rules, rule types, AGENTS.md and precedence, Cursor. Accessed October 23, 2026.
- Adding repository custom instructions for GitHub Copilot: copilot-instructions.md, path-specific files and agent instructions, GitHub. Accessed October 23, 2026.
- Custom instructions with AGENTS.md (Codex documentation): discovery order, overrides and size limit, OpenAI. Accessed October 23, 2026.
Spotted an error or an outdated price? Tell us and we will fix it.
Change history
- : First published. Checked against agents.md, Claude Code's memory documentation, Cursor's rules documentation, GitHub's repository instructions page and the Codex AGENTS.md guide on October 23, 2026.
Next review: .
Part of our Coding Assistants guide.
Keep reading
- How to use Claude Code: a beginner's guide
How to use Claude Code step by step: install it, log in, start a session, ask questions, make a first change, use Git, learn the commands and set up CLAUDE.md.
- Claude Code vs Cursor vs Codex vs GitHub Copilot: what each costs and does
Claude Code vs Cursor, Codex and GitHub Copilot: what each costs, where it runs, how usage is limited and what each says about your code, from vendor pages.
- Best coding assistant: 7 tools compared by price and way of working
The best coding assistant by price and way of working: Claude Code, Codex, GitHub Copilot, Cursor, Antigravity, Mistral and local models, from vendor pages.
- What is MCP (Model Context Protocol)?
What the Model Context Protocol is, how hosts, clients and servers work, what tools, resources and prompts are, and the security rules the MCP spec sets.
- What is prompt injection, and why can't model makers fix it?
Prompt injection explained: how direct and indirect attacks hijack chatbots and agents, and why OWASP and the UK NCSC say it can only be reduced, not fixed.
- What is vibe coding? The original meaning, and when it is a good idea
What is vibe coding: Karpathy's definition, Collins' Word of the Year 2025, how it differs from model-assisted programming, when it is safe and its risks.
Other topics

Assistants & Chatbots
16 guides

LLM APIs & Costs
11 guides

Agents & Automation
8 guides

Local Models & Hardware
11 guides