Spec file
AGENTS.md vs CLAUDE.md: which one Claude Code reads and how to share one file
By default Claude Code reads AGENTS.md only when no CLAUDE.md exists; an @AGENTS.md import in CLAUDE.md shares one file. Not tested; check the official docs.
The main conclusions apply to Claude Code only and follow the current Claude Code docs page, which says reading AGENTS.md directly requires Claude Code v2.1.277 or later. Other tools are covered in the last section.
- Verified
- · Not tested by us
- Applies to
- Claude Code Main conclusions apply to Claude Code only (reading AGENTS.md directly needs v2.1.277 or later)[1]
- AGENTS.md-compatible tools The agents.md site says AGENTS.md is compatible with many coding agents; exact reading behavior differs per tool; the official docs state no version, so treat this as accurate as of the verification date (2026-10-28)[2]
- Cursor Cursor docs: supports AGENTS.md in the project root and subdirectories; the Cursor docs state no version, so treat this as accurate as of the verification date (2026-10-28)[3]
- Tools
File locations
| Path | Scope | How it is read |
|---|---|---|
./AGENTS.md | Repository root; large monorepos can add one per subproject | Site: agents read the nearest file in the tree; Claude Code: under the default setting, read only when there is no CLAUDE.md (needs v2.1.277 or later; the agents.md site states no version, so treat it as of the verification date)[2][1] |
./CLAUDE.md | Project root, shared with the team | Read by Claude Code at session start; can import AGENTS.md with @AGENTS.md[1] |
./.claude/CLAUDE.md | The other official project location | Same as ./CLAUDE.md and also counts as having a CLAUDE.md[1] |
~/.claude/CLAUDE.md | Only you, all projects | Read by Claude Code; does not affect whether AGENTS.md is read[1] |
./CLAUDE.local.md | Only you, current project; the docs suggest adding it to .gitignore | Read by Claude Code; under the default setting it stops AGENTS.md from being read[1] |
~/.claude/projects/<project>/memory/ | Auto memory, machine-local, shared across worktrees of one repository | Written by Claude itself; at the start of every session only MEMORY.md is loaded, up to its first 200 lines or first 25KB, whichever comes first, and content beyond that is not loaded at start; topic files are not loaded at start and Claude reads them on demand[1] |
When to use
- Your repository already has an AGENTS.md and you want to know whether Claude Code reads it.[1]
- Your team uses Claude Code plus other coding agents and wants to maintain a single set of project instructions.[1][2]
- You want to separate the instruction files you write from the notes Claude keeps for itself, and know where each lives.[1]
When not to use
Three combinations and what Claude Code reads by default
The official docs give a table of what Claude Code reads by default for each combination of instruction files. It is reorganized below without changing the meaning.[1]
| Your repository has | Claude Code reads |
|---|---|
| An AGENTS.md, and no CLAUDE.md or CLAUDE.local.md in the working directory or above it | Your AGENTS.md |
| An AGENTS.md and a CLAUDE.md or CLAUDE.local.md in the working directory or above it | Your CLAUDE.md files only |
| A CLAUDE.md that already imports AGENTS.md | Your CLAUDE.md, with AGENTS.md included through the import |
These count as having a CLAUDE.md: a CLAUDE.md, .claude/CLAUDE.md or CLAUDE.local.md in the working directory or any directory above it. These do not count and keep loading alongside AGENTS.md: ~/.claude/CLAUDE.md, the organization's managed CLAUDE.md, and files in .claude/rules/.[1]
Note that CLAUDE.local.md counts too: adding one for your own uncommitted instructions stops Claude Code from reading your AGENTS.md. The docs' fix is to set Project instructions to claude-md-and-agents-md in /config so both file types are read.[1]
- claude-md-or-agents-md: the default; reads CLAUDE.md, or AGENTS.md only when there is no CLAUDE.md.
- claude-md-and-agents-md: reads both, with each directory's CLAUDE.md first; an AGENTS.md already loaded is not read twice.
- claude-md: reads CLAUDE.md files only.
- managed-only: at launch, loads only the organization's managed CLAUDE.md and auto memory; your project, local and user CLAUDE.md files, your .claude/rules/ files and every AGENTS.md are left out. A subdirectory's CLAUDE.md and .claude/rules/ files, and path-scoped rules, still load on demand.
The docs also list sessions where Claude Code cannot read AGENTS.md: these read CLAUDE.md files only, and Project instructions does not appear in the /config panel. They include: a Claude Code version before v2.1.277; having disabled the built-in plugin that reads AGENTS.md through /plugin; and, in some cases, the first session after upgrading from v2.1.276 or earlier (AGENTS.md is read from the next session on). Before v2.1.281, some sessions, such as those on Amazon Bedrock or with telemetry disabled, also read CLAUDE.md files only, and the docs advise updating. To give Claude your AGENTS.md in these sessions, import it from a CLAUDE.md.[1]
Where files live and what they apply to
| File | Location | Scope |
|---|---|---|
| Project CLAUDE.md | ./CLAUDE.md or ./.claude/CLAUDE.md | Project instructions shared with the team through source control |
| Project AGENTS.md | Repository root, plus AGENTS.md and .claude/AGENTS.md in directories above the working directory | Read at session start when no CLAUDE.md counts; a subdirectory's AGENTS.md is read when Claude opens a file there with the Read tool and that subdirectory has no CLAUDE.md of its own |
| Personal global instructions | ~/.claude/CLAUDE.md | Only you, all projects |
| Personal project instructions | ./CLAUDE.local.md | Only you, current project; the docs suggest adding it to .gitignore |
| Organization instructions | macOS: /Library/Application Support/ClaudeCode/CLAUDE.md; Linux and WSL: /etc/claude-code/CLAUDE.md; Windows: C:\Program Files\ClaudeCode\CLAUDE.md | All users in the organization |
AGENTS-style files Claude Code does not read: AGENTS.local.md, AGENTS.override.md, and anything under a .agents/ directory.[1]
The agents.md site suggests creating AGENTS.md at the repository root; large monorepos can add another one in each subproject.[2]
How it differs from auto memory
The docs describe two complementary memory systems: CLAUDE.md (or AGENTS.md in its place) holds instructions you write, while auto memory holds notes Claude writes itself from your corrections and preferences. The docs also note that Claude treats both as context, not enforced configuration.[1]
| Aspect | CLAUDE.md | Auto memory |
|---|---|---|
| Who writes it | You | Claude |
| What it contains | Instructions and rules | Learnings and patterns |
| Scope | Project, user, or org | Per repository, shared across worktrees |
| Loaded into | Every session | Every session (first 200 lines or 25KB) |
| Use for | Coding standards, workflows, project architecture | Your preferences, corrections you give Claude, project context Claude can't derive from the code |
Auto memory lives under ~/.claude/projects/<project>/memory/ and is machine-local; it is not shared across machines. Any special relationship between AGENTS.md and auto memory is not stated officially; use the table above to tell them apart. The "first 200 lines or 25KB" in the table applies to MEMORY.md only: whichever limit comes first, and content beyond it is not loaded at session start; other topic files in the directory are not loaded at start and Claude reads them on demand.[1]
Other tools (only what official pages state)
Only statements that each official page makes are listed below. Rules differ between tools and must not be read as Claude Code behavior. Neither the agents.md site nor the Cursor docs state a version, so the content above is accurate as of the verification date, 2026-10-28; the version threshold stated by the Claude Code docs page is given at the start of this article.[1][2][3]
- agents.md site: AGENTS.md is an open format for guiding coding agents; the site lists Codex, Cursor, Gemini CLI, Zed and others as compatible; there are no required fields, just standard Markdown.
- agents.md site: large monorepos can place an AGENTS.md in each subproject; agents read the nearest file in the directory tree and the closest one takes precedence; explicit user chat prompts override everything.
- Cursor docs: AGENTS.md is supported in the project root and subdirectories; a nested AGENTS.md applies automatically when working on files in that directory or its children, is combined with parent directories, and the more specific instructions take precedence.
- Claude Code docs: the rules for reading AGENTS.md are above, and the docs list differences between an AGENTS.md read through the setting and a CLAUDE.md, for example InstructionsLoaded hooks do not fire.
For exact AGENTS.md behavior and version requirements in any tool, rely on that tool's current official docs.[2]
Sources
All links are official pages; verification dates are listed per source, and links point to the version checked.