CLAUDE.md vs AGENTS.md: Which Agents Read Which File
CLAUDE.md vs AGENTS.md: which coding agents read each file, how Claude Code and Codex load them, and how to keep one source of truth.
Updated · Markdown version
CLAUDE.md is the instruction file Claude Code loads at the start of a session, while AGENTS.md is an open Markdown format that many coding agents read, Codex among them. Claude Code falls back to a root AGENTS.md only when no CLAUDE.md applies, so the two files overlap unless you link them on purpose.
How each file loads
| CLAUDE.md (Claude Code) | AGENTS.md (Codex) | |
|---|---|---|
| File names read | CLAUDE.md, CLAUDE.local.md, .claude/CLAUDE.md | AGENTS.override.md, then AGENTS.md, then fallback names from project_doc_fallback_filenames |
| Search path | Working directory and every directory above it | Project root (usually the Git root) down to the working directory |
| Subfolder files | Load on demand when Claude works in that folder | Closer files come later in the chain and take precedence |
| Size limit | See the Claude memory docs | project_doc_max_bytes, default 32 KiB |
The agents.md page names Codex, Cursor and Gemini CLI among the tools that read the format, and it does not name Claude Code.
Use this decision rule:
- Choose a single root AGENTS.md when several agents on the team need the same build, test and convention rules.
- Choose CLAUDE.md when a rule only matters to Claude Code, such as a Claude-specific workflow.
- Choose a nested file when one folder needs different rules. In Codex, use
AGENTS.override.mdin that folder. In Claude Code, use aCLAUDE.mdin that folder, which loads when Claude works there.
Keep one source of truth
- Write the shared rules in the root
AGENTS.md. Keep the build, test and lint commands there. - Create a root
CLAUDE.mdthat contains a single line:@AGENTS.md. Claude Code expands imports, so the shared rules load through that file. - Add Claude-only lines below the import in
CLAUDE.md. They sit beside the imported content and do not reach Codex. - Confirm the link. Start a Claude Code session in the repository and ask a question whose answer appears only in
AGENTS.md. A correct answer means the import works.
Pitfalls
- A local file silently disables AGENTS.md. A
CLAUDE.local.mdin the working directory or above counts as a CLAUDE.md, so Claude Code stops reading the root AGENTS.md. The fix is the import from step 2, or the Project instructions setting with theclaude-md-and-agents-mdvalue, which loads both. - Copied rules drift apart. When the same rule lives in two files, one edit misses the other. Keep one copy of each rule and search both files after an edit.
- Codex drops late content without an error. Once the combined files reach 32 KiB, later guidance is not loaded. Raise
project_doc_max_bytes, or move folder-specific rules into nested files. - An import does not reduce context. Imported files load with the file that references them. For rules that matter in one part of a codebase, use path-scoped rules instead.
- A sentence that says "read AGENTS.md" is not an import. Claude sees the file only if it decides to open it. Replace the sentence with
@AGENTS.md.
When to use a skill instead
File placement is only half of the problem. The harder question is which lines belong in the shared file at all, and that judgment is what most guides skip. agent-instruction-files writes, audits and restructures these instruction files for a repository, and it can review an existing root file for lines that restate what the code already shows. That cleanup step is the part the placement rules above do not cover. If your repository has only a few stable rules, the manual steps in this guide are enough.
FAQ
Is CLAUDE.md the same as AGENTS.md?
No. They are separate files with separate loaders. Claude Code reads CLAUDE.md first and reads a root AGENTS.md only when no CLAUDE.md applies, while Codex reads AGENTS.md directly.
Does Claude Code read AGENTS.md?
Yes, when no CLAUDE.md or CLAUDE.local.md applies to the working directory. The memory docs say reading AGENTS.md directly requires Claude Code v2.1.277 or later. Where direct reading is unavailable, the same docs recommend importing AGENTS.md from a CLAUDE.md.
Can one file serve both Claude Code and Codex?
Yes. Put the shared rules in AGENTS.md and import that file from a one-line CLAUDE.md with @AGENTS.md. Codex reads AGENTS.md directly, so the rules reach both tools from one place.
Related skills in this catalog
Platform Score is our assessment under a published method. It is not a safety guarantee.
Related guides
- Codex Skills Explained: Locations and AGENTS.md Differences
- CLAUDE.md examples: four stack templates, rules, imports
- OpenCode Skills: Where They Live and How Agents Load Them
- Agentic Coding Tools: What They Are and How to Choose One
- Cursor Agent Skills Explained: How Skills Load vs Rules
- Make Claude Code read AGENTS.md: import and verify
Terms this guide uses
This item is a worked example in the AI glossary for:
Sources
- https://code.claude.com/docs/en/memory (accessed 2026-11-22)
- https://learn.chatgpt.com/docs/agent-configuration/agents-md (accessed 2026-11-22)
- https://agents.md/ (accessed 2026-11-22)
This page is not offered to search engines yet: The content file does not mark this page indexable yet.