AGENTS.md for a team: keeping Codex, Cursor, Copilot and Claude Code on the same rules
Which coding tools read AGENTS.md and how each finds it, what to put in it, nested files for a monorepo, and how we keep Codex and Claude Code on one set of rules.
By Christian Buckner
We run Codex and Claude Code side by side on the same repository, which means two different agents have to follow one set of rules. AGENTS.md is how most tools now handle that. Put an AGENTS.md at the top of the repository and commit it, and Codex, Cursor, GitHub Copilot's coding agent, Gemini CLI and a long list of other tools will read it. Claude Code reads it too, as long as the repository has no CLAUDE.md. When one part of the code needs its own rules, add another AGENTS.md in that folder, and the file nearest the work wins.
The format is plain Markdown with no required fields. Its own site calls it "a README for agents", and it's stewarded by the Agentic AI Foundation under the Linux Foundation. What follows is from each tool's docs as of November 27, 2026, linked at the end.
Which tools read it, and how
| Tool | Where it looks | When two files disagree |
|---|---|---|
| Codex | The repository root, then each folder down to the one you're working in, one file per folder | Files are joined from the root down, so the nearest file comes last and wins |
| Cursor | The repository root and any subfolder | Combined with the files above it; the more specific one wins |
| GitHub Copilot | Anywhere in the repository | The nearest file in the directory tree wins. Code review reads the files on the pull request's branch |
| Claude Code | Every AGENTS.md from your working folder up, and a subfolder's when Claude opens a file there | Only read when there's no CLAUDE.md or CLAUDE.local.md |
| Gemini CLI | Wherever its context fileName setting in .gemini/settings.json points | Set "fileName": "AGENTS.md" to use it |
| Aider | Only when told to | Add read: AGENTS.md to .aider.conf.yml |
The format's site lists about twenty more, including Jules, Factory, goose, opencode, Zed, Warp, VS Code, Devin, Junie, Amp, RooCode, Windsurf and Augment Code.
What to put in it
The format suggests a project overview, build and test commands, code style, testing instructions and security notes. The thing that matters most is writing each line so someone could check it was followed. "Run pnpm test before committing" is checkable. "Test your changes" isn't. And if you list a test command, expect agents to run it and try to fix whatever fails.
Here's one for a small service:
Keep it short. Codex stops adding instruction files once they reach 32 KiB together (that's its project_doc_max_bytes setting), and every tool spends context on whatever the file holds. A procedure with lots of steps is better as a skill, which only loads when it's needed.
Nested files for a monorepo
Each part of a monorepo can have its own file:
An agent working in services/api/ reads the API's file on top of the root one. Codex joins them from the root down, Cursor combines a nested file with the ones above it, and Copilot takes the nearest one. Put each rule in the folder it applies to and keep the root file for what holds everywhere.
When some of the team uses Claude Code
Claude Code 2.1.277 and later reads AGENTS.md with no setup (2.1.281 if you're on Bedrock or have telemetry off), but only if there's no CLAUDE.md:
| Your repository has | Claude Code reads |
|---|---|
AGENTS.md, and no CLAUDE.md or CLAUDE.local.md | AGENTS.md |
AGENTS.md and a CLAUDE.md or CLAUDE.local.md | The CLAUDE.md files only |
A CLAUDE.md that imports AGENTS.md | Both |
The usual way to give Claude a few instructions of its own is a CLAUDE.md that imports the shared file, so there's still only one file to keep up to date:
We do it the other way round. Our CLAUDE.md came first and is the one we edit. A script generates AGENTS.md from it, swapping "Claude Code" for "Codex", and CI fails if the two drift apart. The catch is that Codex doesn't read the per-area rule files Claude Code loads from .claude/rules/, so the shared file has an index of areas that tells any agent whose tool doesn't load that folder to open the rule file itself before editing there. Either direction works. What matters is that people edit one file and the other follows.
Codex can also read CLAUDE.md directly if you add it to project_doc_fallback_filenames. That setting goes in Codex's config file (~/.codex/config.toml in its docs), though, so every teammate has to add it, and Codex only falls back to it in a folder with no AGENTS.md. A generated file works for anyone who clones the repo.
Watch out for one trap: a personal CLAUDE.local.md counts as a CLAUDE.md. Add one to a repository that relies on AGENTS.md and Claude quietly stops reading AGENTS.md for you. To keep both, type /config in Claude Code and set "Project instructions" to claude-md-and-agents-md. Claude Code also doesn't read AGENTS.override.md, AGENTS.local.md or anything under .agents/.
I wrote about the CLAUDE.md side, with a checker for the file itself, in CLAUDE.md for a team.
Personal instructions stay out of the repository
Each tool has a place for one person's own preferences, and none of them is the shared file. Codex reads ~/.codex/AGENTS.md in every project, and an AGENTS.override.md next to it, or in any project folder, replaces the AGENTS.md at that level. Claude Code has ~/.claude/CLAUDE.md for every project and CLAUDE.local.md in the project folder (mind the trap above). Cursor keeps them as User Rules, under Customize, then Rules.
How to check what loaded
Codex builds its list of files once per session, so restart it after a change. Running codex --ask-for-approval never "Summarize the current instructions." should give you a summary that quotes your files, and codex --cd services/api checks a nested one. Claude Code prints a line like no CLAUDE.md found; AGENTS.md loaded: /home/you/repo/AGENTS.md when a session starts, and /context all lists the instruction files that loaded (from 2.1.280, that includes an AGENTS.md). In any tool, it's worth asking the agent which instruction files it was given before you trust a new rule.
What AGENTS.md doesn't share
AGENTS.md holds what the code needs every time: commands, layout, rules. It doesn't hold what happened this week, like the decision made in yesterday's session, why a migration got rolled back, or which customer a feature is for. Each agent keeps that in its own session, and the next person's agent starts without it.
That's where Jackdaw comes in for us. Both Codex and Claude Code connect to it over MCP, and since AGENTS.md is generated from CLAUDE.md, both get the same instruction to read an area's history before changing it and to write down what they settle. So a decision recorded from a Codex session is there for the next Claude Code session that touches the same code.
Sources
Read on November 27, 2026: agents.md, the format's own site; Codex's Custom instructions with AGENTS.md; Cursor's Rules; GitHub Copilot's Adding repository custom instructions; and Claude Code's How Claude remembers your project.