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 readCLAUDE.md, CLAUDE.local.md, .claude/CLAUDE.mdAGENTS.override.md, then AGENTS.md, then fallback names from project_doc_fallback_filenames
Search pathWorking directory and every directory above itProject root (usually the Git root) down to the working directory
Subfolder filesLoad on demand when Claude works in that folderCloser files come later in the chain and take precedence
Size limitSee the Claude memory docsproject_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.md in that folder. In Claude Code, use a CLAUDE.md in that folder, which loads when Claude works there.

Keep one source of truth

  1. Write the shared rules in the root AGENTS.md. Keep the build, test and lint commands there.
  2. Create a root CLAUDE.md that contains a single line: @AGENTS.md. Claude Code expands imports, so the shared rules load through that file.
  3. Add Claude-only lines below the import in CLAUDE.md. They sit beside the imported content and do not reach Codex.
  4. 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.md in 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 the claude-md-and-agents-md value, 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.

Platform Score is our assessment under a published method. It is not a safety guarantee.

Terms this guide uses

This item is a worked example in the AI glossary for:

Next steps

  1. Codex Skills Explained: Locations and AGENTS.md Differences Read next.
  2. CLAUDE.md examples: four stack templates, rules, imports Read next.
  3. All guides by topic Browse everything.

Sources

This page is not offered to search engines yet: The content file does not mark this page indexable yet.