Your repo has a CLAUDE.md. A teammate opens the same repo in Codex and the agent ignores it, because Codex looks for AGENTS.md. Someone adds a .cursorrules. Now the same build commands live in three files, and they drift apart within a week.

Short answer: Keep one AGENTS.md at the repo root. It is the cross-vendor default, used by over 60,000 open-source projects and stewarded by the Agentic AI Foundation under the Linux Foundation. Claude Code reads its own CLAUDE.md first, but since v2.1.277 it falls back to AGENTS.md when no CLAUDE.md is present. If you need Claude-only extras, put them in a CLAUDE.md that imports AGENTS.md, so there is still one source of truth.

Which coding agents read which file?

AGENTS.md is the file most agents look for; CLAUDE.md is native to Claude Code alone. Support below is current as of November 2026, per agents.md and vendor documentation.

Chart: ten coding agents and whether they read AGENTS.md or CLAUDE.md. Claude Code reads both, with CLAUDE.md as primary and AGENTS.md as fallback. Codex, Cursor, GitHub Copilot, Gemini CLI, Jules, Amp, Aider, Windsurf and Zed read AGENTS.md.

Two things follow from that chart. First, an AGENTS.md-only repo works everywhere, including Claude Code on a recent version. Second, a CLAUDE.md-only repo works in exactly one tool. If your team mixes agents, the asymmetry decides the layout for you.

What happens when a repo has both files?

Claude Code does not merge the two by default. It picks one, following a fixed precedence (official docs):

Your repository has Claude Code reads
AGENTS.md, and no CLAUDE.md or CLAUDE.local.md in the working directory or above it AGENTS.md
AGENTS.md and a CLAUDE.md or CLAUDE.local.md in the working directory or above it The CLAUDE.md files only
A CLAUDE.md that imports AGENTS.md CLAUDE.md, with AGENTS.md included through the import

Three gotchas hide in that table:

  • A CLAUDE.local.md silently disables the fallback. Adding one to keep your own uncommitted notes stops Claude Code from reading AGENTS.md at all. To keep both, set the Project instructions setting to claude-md-and-agents-md.
  • The fallback is version-gated. Direct AGENTS.md reading needs Claude Code v2.1.277 or later. On older versions, import it from a CLAUDE.md instead.
  • Subagents start without project instructions. A spawned subagent does not inherit the main conversation's loaded files, so rules you rely on may not reach it.

Claude Code also skips any single instruction file over 4 MiB, and expands @path imports inside the files it does read.

How do you keep one source of truth?

Diagram: Codex, Cursor, Copilot and Gemini CLI read AGENTS.md directly; Claude Code reads CLAUDE.md, which imports AGENTS.md via @AGENTS.md, keeping a single source of truth.

Write the shared rules once in AGENTS.md, then let CLAUDE.md import it:

<!-- CLAUDE.md -->
@AGENTS.md

## Claude Code only
- Run `bun run check` before declaring a task done.

Every other agent reads AGENTS.md directly. Claude Code reads CLAUDE.md and pulls AGENTS.md in through the import. The shared rules exist in one place; the Claude-only section stays small and separate. This is the pattern the Claude Code docs recommend for sharing one file across tools, and /init can scaffold the starting file for you.

For a monorepo, nest AGENTS.md files per package. Agents read the nearest file in the directory tree, so the closest one wins; the main OpenAI repository ships 88 of them.

What belongs in a lean rules file?

A rules file is loaded into context at the start of every session, so every line is a recurring cost, not a one-time one. Keep it short, imperative and checkable. A useful starting shape:

# AGENTS.md
## Commands
- Install: bun install
- Test: bun run test (run the single file you changed first)
- Lint: bun run lint
## Conventions
- TypeScript strict; no default exports.
- Match the surrounding style; do not reformat unrelated code.
## Etiquette
- Never commit secrets or edit .env.
- Open a draft PR; describe what you verified.

What to leave out: long architecture prose, copied README content, and anything the agent can discover from the code itself. If a rule cannot be verified by looking at the repo, it tends to rot. For what a bloated file costs per session, see our token cost breakdown; a stable rules prefix also plays well with prompt caching, since unchanged leading content is what gets cached.

Where rules files fall short

A rules file is a static instruction sheet, and it has real limits:

  • It is a permanent token tax. A 2,000-word file is roughly a few thousand tokens billed on every session, whether the task needs them or not. Lean beats complete.
  • Nothing validates it. A stale command or a wrong path is followed confidently. There is no test that fails when a rule goes out of date.
  • Support is version-dependent. The same repo behaves differently across agent versions, as the Claude Code fallback shows.
  • It does not learn. A rules file cannot remember the correction you made yesterday. You have to edit it by hand.

That last gap is the interesting one. Static rules and learned memory solve different problems, and the second is harder.

How we handle rules at Muvon

Our own repositories keep AGENTS.md as the source of truth, with tool-specific files importing it rather than duplicating it. For the learning gap, Besydr runs beside the agent and stores lessons from finished sessions: a rule must quote a message you actually wrote, and the lessons that fit the current request are injected at no more than 2,000 tokens per request. The static file says how the repo works; the learned layer carries what you corrected. Neither replaces the other.

The takeaway: one AGENTS.md, imported where a tool needs its own file, kept lean enough that you would not mind paying for it every session.