Your repository currently holds CLAUDE.md, AGENTS.md, .cursor/rules/, and .github/copilot-instructions.md. Four files saying the same thing, and they have already started contradicting each other.
CLAUDE.md only and not AGENTS.md, and the text was built around that claim. Since v2.1.277 it reads AGENTS.md natively (v2.1.281 extended that to Bedrock, Vertex AI, Foundry and similar sessions). The affected passages below have been rewritten against the current official docs.AGENTS.md is a README for agents: one plain Markdown file at the repo root, no schema, no validation, no required fields, read into context by coding agents before they start work. It is now stewarded by the Agentic AI Foundation under the Linux Foundation, and the spec repo agentsmd/agents.md shows roughly 24.2k stars and an MIT license per its GitHub page, 2026-09.
The single most useful thing to know has a version boundary: before v2.1.277 Claude Code read CLAUDE.md only, not AGENTS.md; from v2.1.277 on, it reads AGENTS.md directly when the repository has no CLAUDE.md. Mind the condition — a single CLAUDE.md in your working directory or above it (a CLAUDE.local.md counts too) and by default only CLAUDE.md is read. So "just rename the file and it works everywhere" is still only half right. This issue names what each tool actually reads, gives the exact commands that wire them together, and then answers the real question: in a repo-level brief, what belongs and what does not.
# Make AGENTS.md the canonical file. Claude Code v2.1.277+ with no CLAUDE.md in the repo: do nothing
# Verify: a new session prints no CLAUDE.md found; AGENTS.md loaded: <path>
# To load both files: /config -> Project instructions -> claude-md-and-agents-md
# On older versions, or to append Claude-only text, the two earlier recipes still work (content is read once) --
# (1) symlink: simplest when you need no Claude-specific text; prints nothing on success
ln -s AGENTS.md CLAUDE.md
# On Windows a symlink needs Administrator or Developer Mode; use (2) instead
# (2) import: leaves you a place to append Claude-only instructions
# contents of CLAUDE.md:
@AGENTS.md
## Claude Code
Use plan mode for changes under src/billing/.
# Verify: open a new session, run /context, confirm CLAUDE.md is under Memory files
# Gemini CLI takes one setting to accept AGENTS.md (.gemini/settings.json)
{ "context": { "fileName": ["AGENTS.md", "GEMINI.md"] } }
# Inspect what got concatenated: /memory show Rescan: /memory reload
# Already have Cursor / Copilot rules and want them inside Claude Code
/import # v2.1.213+, also carries over MCP, commands, subagents, skills
The difference between /import and /init is worth memorizing. /init reads your old rules and regenerates a CLAUDE.md — by default from .cursor/rules/, .cursorrules and .github/copilot-instructions.md; with CLAUDE_CODE_NEW_INIT=1 it also reads AGENTS.md, .devin/rules/, .windsurf/rules/ and .clinerules. /import appends a one-time copy and brings MCP servers, commands, subagents and skills along with it. The first one merges; the second one moves house.
/import is literally "a one-time copy": it is a migration tool, not a sync tool.CLAUDE.md and CLAUDE.local.md from your working directory and every directory above it and concatenates them, ordered from the filesystem root down — so the file closest to where you launched is read last. Codex does the same from the git root to the current directory, stacked on top of a global ~/.codex/AGENTS.md..claude/rules/*.md use a paths: field in YAML frontmatter, Copilot's .instructions.md use applyTo, Cursor's .mdc use globs. AGENTS.md itself has no such capability — that is the price of being the common denominator.The Claude Code docs are explicit: CLAUDE.md content is delivered as a user message after the system prompt. It is context, not enforced configuration. So "I wrote it down and it still ignores me" is not a bug, it is the nature of this layer. To pin an action down — lint must run before every commit, say — the documented answer is a hook, which fires as a shell command at a fixed lifecycle event regardless of what the model decides. The same holds for AGENTS.md, only more so: across harnesses you do not even know whether the other tool has hooks at all.
/doctor (v2.1.206+) proposes trims for a checked-in CLAUDE.md on one criterion: cut what the model can derive from the codebase, keep what it cannot.Turned around: to decide whether a line belongs in AGENTS.md, ask three questions. (1) Would a new teammate need to be told this? Yes → keep it. (2) Could the agent find it with one grep? Yes → delete it. (3) Is it true only inside one subdirectory? Yes → move it to a path-scoped rule (.claude/rules/ with paths:) instead of spending context on it every session.
Nesting may not load the way you assume. Codex walks "git root to current directory", not "every subdirectory". Issue #13288 in openai/codex (opened 2026-03-02, now closed) reports exactly this: launched at the repo root and editing code under go/, the go/AGENTS.md is never merged in. Claude Code's subdirectory CLAUDE.md files, by contrast, are loaded on demand — they enter context when Claude reads a file in that directory. The same nested layout behaves differently under the two harnesses.
Monorepos get polluted by other teams' briefs. Claude Code offers claudeMdExcludes, matched as globs against absolute paths. Put it in .claude/settings.local.json and it stays on your machine:
{ "claudeMdExcludes": ["**/monorepo/CLAUDE.md"] }
Personal preferences do not belong in the canonical file. CLAUDE.local.md (gitignore it) is for your sandbox URLs and test data. Across git worktrees it only exists in the one where you created it, so the docs suggest importing from your home directory instead: @~/.claude/my-project-instructions.md. A new trap: adding a CLAUDE.local.md to a repo that relies on AGENTS.md stops Claude Code from reading AGENTS.md by default (it counts as "having a CLAUDE.md"); to read both, set Project instructions to claude-md-and-agents-md.
.cursorrules says npm, and you never learn which one won today. When you absorb old rule files, deleting the source matters more than the import itself.ln -s AGENTS.md CLAUDE.md (the docs confirm the content is read once either way). No dependencies, no maintenance, one canonical file. When it stops being enough: when tools need different wording (you want only Claude in plan mode, say) — switch to the @AGENTS.md import and append below it. Once a CLAUDE.md exists it is the only file read by default, so that import line is not optional.npx @intellectronica/ruler apply, canonical text in .ruler/AGENTS.md, distributed to CLAUDE.md, AGENTS.md, .aider.conf.yml and more; the README lists 30 targets (Copilot, Claude Code, Cursor, Windsurf, Cline, Aider, Codex CLI, Gemini CLI, Goose, Zed, Jules and others) and it manages MCP config too. When not to install it: if your team uses one or two agents, the generated artifacts and the CI drift check cost more than they save.npm install -g rulesync; rulesync import pulls existing configs into .rulesync/, and rulesync convert --from cursor --to copilot,claudecode does a one-shot format conversion without adopting its workflow at all; rulesync generate is the steady-state command. Beyond rules it covers ignore files, MCP, commands, subagents, skills and hooks. When not to install it: if you only need one migration, run convert and uninstall — do not leave a generator living in the repo.Make AGENTS.md canonical: Claude Code (v2.1.277+), Copilot and Codex read it natively, and Gemini CLI needs one context.fileName change; on an older Claude Code add one ln -s. Those few steps cover almost everyone's needs at zero cost. A generator only starts paying for itself once "each tool also needs its own paragraph" becomes the norm — at that point you are no longer maintaining one file but a template plus N diffs.
Do these three first: (1) make AGENTS.md canonical. On Claude Code v2.1.277+ with no CLAUDE.md in the repo there is nothing to do — a new session showing the AGENTS.md loaded line is your confirmation; on older versions, or in a repo that already has a CLAUDE.md, use ln -s AGENTS.md CLAUDE.md or an @AGENTS.md import and check that it is listed under /memory; (2) run /doctor and apply its criteria — delete the directory tree, the dependency list and the architecture overview, keep pitfalls, rationale and anti-default conventions, and get under 200 lines; (3) move anything that is only true inside one subdirectory into .claude/rules/ with a paths: frontmatter, so it stops taxing every session.
Pick by situation: one or two agents → a symlink is enough, skip the generator; distributing to a dozen tools with per-tool differences → npx @intellectronica/ruler apply with .ruler/AGENTS.md as the source; a pile of Cursor .mdc files you just want converted once → rulesync convert --from cursor --to copilot,claudecode, then uninstall; moving a whole setup of MCP servers, commands, subagents and skills into Claude Code → /import (v2.1.213+); polluted by other teams in a monorepo → claudeMdExcludes.
Numbers to keep handy: target under 200 lines for CLAUDE.md · over 4 MiB is skipped · @path imports nest at most four hops · Gemini CLI takes an array in context.fileName · Copilot is nearest-wins while Codex and Claude Code concatenate · CLAUDE_CODE_NEW_INIT=1 makes /init read AGENTS.md as well · Claude Code v2.1.277+ reads AGENTS.md when there is no CLAUDE.md (a CLAUDE.local.md counts as one).
The criterion in one line: if one grep would tell the model, delete it; if a new teammate would need to be told, keep it; if it is true in only one subdirectory, move it into a path-scoped rule.
.claude/rules/ uses paths:, Copilot uses applyTo. The main lever for saving context.@AGENTS.md import and ln -s recipes, which legacy rule files /init and /import each read, load order, claudeMdExcludes, the paths: field in .claude/rules/, the 200-line and 4 MiB numbers, and the /doctor trim criteria~/.codex/AGENTS.md, with a byte cap on the total)context.fileName accepts ["AGENTS.md", "CONTEXT.md", "GEMINI.md"]; the hierarchical load order (~/.gemini/GEMINI.md → workspace and parents → just-in-time); /memory show and /memory reload.github/copilot-instructions.md and .github/instructions/**.instructions.md, with the per-surface matrix (coding agent, chat, code review)npx @intellectronica/ruler apply, source in .ruler/AGENTS.md, 30 target agents, MCP config included; roughly 2.9k stars, MIT, per its GitHub repo page, 2026-09npm install -g rulesync; four commands (init, generate, import, convert) covering rules, ignore files, MCP, commands, subagents, skills and hooks; roughly 1.4k stars, MIT, per its GitHub repo page, 2026-09