One AGENTS.md at the root of your repo is read by Claude Code, Codex, Cursor, GitHub Copilot, Antigravity and Devin Desktop. As of December 2026 that part is settled. What isn't settled is everything after the root file: nested files, size caps, and the .local and .override variants each behave differently per tool, and two of the six truncate or demote your rules once you pass a size limit.
This is the matrix, built from each vendor's own docs as they read in late November 2026. We read the docs. We did not test every tool. Where a doc says nothing, we say so instead of guessing.
AGENTS.md supported tools: the short version
- Claude Code: yes, as a fallback when no
CLAUDE.mdis present. - Codex: yes, it's the primary instruction file.
- Cursor: yes, root and subdirectories.
- GitHub Copilot: yes for agents, CLI and code review. Not for every chat surface.
- Antigravity: yes, next to
GEMINI.md. - Devin Desktop (formerly Windsurf): yes, as always-on rules.
The format itself is plain Markdown with no required fields. The agents.md site says it's used by over 60k open-source projects and is now stewarded by the Agentic AI Foundation under the Linux Foundation.
AGENTS.md in Cursor, Claude Code, Codex and Copilot: tool by tool
Claude Code
Source: Claude Code memory docs.
- Reads
AGENTS.mdnatively from v2.1.277, but only when there's noCLAUDE.md,.claude/CLAUDE.mdorCLAUDE.local.mdin the working directory or above it. A Project instructions setting in/configcan load both. - Nested: loads every
AGENTS.mdfrom the working directory upward at start. A subdirectory'sAGENTS.mdloads when Claude opens a file there with the Read tool. - Not read:
AGENTS.local.md,AGENTS.override.md, anything under.agents/. - Size: the docs recommend under 200 lines per instruction file. For
CLAUDE.mdfiles loaded at launch they state a hard limit of 4 MiB, above which the file is skipped whole. They don't give a separate figure forAGENTS.md.
The fallback rule trips up most people. We covered it in why your AGENTS.md isn't loading in Claude Code.
Codex
Source: Custom instructions with AGENTS.md.
- Global file in
~/.codex, then one file per directory from the project root down to your current directory. - Override file: in each directory Codex checks
AGENTS.override.mdfirst, thenAGENTS.md. At most one file per directory is used, so an override replaces its neighbour instead of adding to it. - Merge order: files are concatenated from the root down. Later files win because they appear later in the prompt.
- Size: Codex stops adding files once the combined size reaches
project_doc_max_bytes, which is 32 KiB by default. - Empty files are skipped.
Cursor
Source: Cursor rules docs.
- Reads
AGENTS.mdin the project root and in subdirectories. - Nested files apply automatically when you work with files in that directory or its children. They're combined with the parents, and the more specific instructions take precedence.
- Size: no cap is stated for
AGENTS.md. The only number on the page is a best practice for.cursor/rulesfiles: keep rules under 500 lines. - Rules don't affect Cursor Tab. The docs say so in the FAQ.
GitHub Copilot
Sources: repository instructions and the support reference.
- One or more
AGENTS.mdfiles anywhere in the repo. The nearest file in the directory tree takes precedence. - Alternatively, a single
CLAUDE.mdorGEMINI.mdin the repo root. - Support depends on the surface. The reference lists agent instructions for Copilot cloud agent, Copilot CLI, Copilot code review on GitHub.com, and Copilot Chat in VS Code. It doesn't list them for Copilot Chat on GitHub.com, or for Copilot Chat in Visual Studio, JetBrains, Eclipse or Xcode.
- Size: no cap for
AGENTS.mdis stated on either page.
Antigravity
Source: Antigravity rules docs.
- Reads
AGENTS.mdorGEMINI.mdin your workspace folder and in every parent folder up to the repository root. Also.agents/AGENTS.mdand a global~/.gemini/AGENTS.md. - Rules are cumulative. Everything found is combined into the prompt.
- Nested: it doesn't load rules from subfolders below the workspace folder, even when the agent reads or edits files there.
- Size: any single rule file over 24,000 bytes is truncated. All always-on rules also share a 20,000-token budget.
Devin Desktop, formerly Windsurf
Sources: Devin Desktop FAQ and Devin CLI rules docs.
- Reads
AGENTS.md,AGENTS.local.mdand the singularAGENT.mdas always-on rules. - Nested: read at the workspace root and in each directory between the root and where the agent is working. The CLI docs add that subdirectory files are discovered lazily when the agent accesses files there.
- Old Windsurf files still load.
.devin/rules/is the preferred location, but the CLI rules docs say rule files in.devin/rules/and.windsurf/rules/are both loaded, so a rule copied into both is in context twice..windsurfrulesis still read. - Size: no cap stated. The CLI docs just say rules and
AGENTS.md"should be kept as small as possible".
Nested AGENTS.md precedence: three models, not one
The agents.md site gives a simple rule: the closest AGENTS.md to the edited file wins. Only some tools work that way.
Nearest file wins. That's Copilot's wording, and it matches the spec.
Everything loads, later wins. Codex concatenates from the root down to the directory you started in. Claude Code loads every AGENTS.md from the working directory upward. Cursor combines nested files with their parents. Nothing is replaced. The deeper file just comes last.
Parents only. Antigravity walks up from the workspace folder to the repo root and never down. A packages/api/AGENTS.md does nothing if you opened the repo root as your workspace. Codex has a similar edge: it stops at your current directory, so a nested file loads only if you start Codex at or below that folder.
Put the three side by side and the same monorepo behaves three ways. Open the root in Cursor and edit a file under packages/api/: the nested file applies. Do the same in Antigravity: it doesn't. Start Codex at the root: it doesn't. Start Codex inside packages/api/: it does.
So write the root file so it stands alone. Treat nested files as extra detail for the tools that pick them up, never as the only place a rule lives.
AGENTS.md size limit: the numbers that exist
Only three of the six tools publish a number.
- Codex: 32 KiB by default, set by
project_doc_max_bytes. - Antigravity: 24,000 bytes per file, plus a 20,000-token budget across always-on rules.
- Claude Code: 4 MiB stated for
CLAUDE.mdat launch, with a 200-line recommendation. - Cursor, Copilot, Devin Desktop: no published cap on the pages we read.
Two things here are easy to miss.
The Codex cap is described two ways by OpenAI. The AGENTS.md guide says Codex stops adding files once the combined size reaches the limit. The advanced config page describes the same setting as how much to read from each AGENTS.md file. Combined and per-file aren't the same thing. Codex is open source, and its loader settles it: one shared budget across the project files, read from the root down, with the file that crosses the line cut at a byte offset. So a root file plus a nested file can cross 32 KiB together while each one looks small. Check the total.
Antigravity's token budget doesn't fail loudly. When always-on rules pass 20,000 tokens, it demotes the largest rule files from inline text to a one-line pointer that the agent can choose to read. Your biggest rule file is the first to become optional reading.
You can raise the Codex limit in ~/.codex/config.toml:
project_doc_max_bytes = 65536The better fix is a smaller file. If one AGENTS.md has to work in every tool, the smallest published cap is your real limit: stay under 24,000 bytes. Check with wc -c AGENTS.md.
The variants only some tools read
Every tool reads AGENTS.md. The variants are where a file can sit in your repo for months and never be read by the tool you're using.
AGENTS.override.md: Codex only. Claude Code's docs list it as not read.AGENTS.local.md: Devin reads it. Claude Code's docs list it as not read..agents/directory: Antigravity reads.agents/AGENTS.mdand.agents/rules/. Claude Code doesn't read anything under.agents/.AGENT.md, singular: Devin.CLAUDE.md: Copilot's agents accept one in the repo root, and Devin CLI reads it too. Devin CLI even reads your~/.claude/CLAUDE.mdas a global rule.
That last one cuts both ways. Your personal Claude Code preferences are quietly steering Devin as well.
Two more silent failures from the same docs, for anyone moving past a single file. In Cursor, a plain .md file inside .cursor/rules is ignored, because project rules must be .mdc. In Antigravity, a file in .agents/rules/ with missing frontmatter or an unrecognized trigger value is silently discarded. In both cases the vendor's advice is the same: if you want plain Markdown, put it in AGENTS.md.
One AGENTS.md for Cursor, Claude Code, Codex and Copilot: a layout that holds
As of December 2026, this is the layout we'd use for a repo that several tools touch:
repo/
AGENTS.md # the shared file, under 24,000 bytes, stands alone
CLAUDE.md # optional: "@AGENTS.md" plus Claude-only lines
packages/
api/
AGENTS.md # extra detail, never the only copy of a ruleSkip CLAUDE.md unless you need Claude-specific lines. If you add one, it must import AGENTS.md, or Claude Code stops reading the shared file.
Keep personal preferences out of the repo. The .local variants aren't portable, so use each tool's global file instead.
Don't rely on AGENTS.override.md unless your whole team is on Codex.
If you'd like a starting point, you can generate an AGENTS.md for your stack, then cut it down to what the agent can't work out from the code. Our older comparison of Cursor and Copilot context handling and the Windsurf rules setup guide predate most of the above, so trust this matrix where they disagree.
The compatibility question in late 2026 isn't "which tools support AGENTS.md". They all do. It's which nested files load, which variants are ignored, and where the size limit sits. Check those three for your own stack, build one file, and keep it small.