Guide
AGENTS.md vs CLAUDE.md: which file each agent reads
AGENTS.md is the open, tool-neutral instructions file that Codex reads; CLAUDE.md is Claude Code's own. Claude Code v2.1.277 and later also reads AGENTS.md, but by default only when there is no CLAUDE.md, .claude/CLAUDE.md or CLAUDE.local.md in the working directory or above it. If both tools work on a repository, put the shared instructions in AGENTS.md and either have no CLAUDE.md at all or one whose first line is @AGENTS.md.
How the two files compare
Both are plain Markdown that the agent reads at the start of a session as standing instructions. AGENTS.md has no required fields or headings. The differences are in where each tool looks, what it does when several files exist, and which extra features it supports.
AGENTS.md in Codex | CLAUDE.md in Claude Code | |
|---|---|---|
| Personal file for every project | ~/.codex/AGENTS.md (or under $CODEX_HOME) | ~/.claude/CLAUDE.md |
| Project file | AGENTS.md in the repository | ./CLAUDE.md or ./.claude/CLAUDE.md |
| Second file in the same directory | AGENTS.override.md, which replaces AGENTS.md at that level | CLAUDE.local.md, which is added after CLAUDE.md |
| Which directories are read | Project root (normally the Git root) down to the current directory, at most one file per directory | Current directory and every directory above it at launch; subdirectories when Claude works on files in them |
| When files conflict | All are joined from the root down, so the closest file comes last | All are joined from the filesystem root down, so the closest file comes last |
| Size | project_doc_max_bytes, 32 KiB by default | Guidance: under 200 lines per file |
| Pull in other files | Not described in Codex's AGENTS.md documentation | @path imports, up to four hops deep |
| Read other filenames | project_doc_fallback_filenames | AGENTS.md, controlled by the Project instructions setting |
The row that causes the most confusion is the second file. Codex uses one file per directory, so an AGENTS.override.md hides the AGENTS.md next to it rather than adding to it. Claude Code's CLAUDE.local.md is additive. Codex also builds its instruction chain once per run, so restart Codex after you edit AGENTS.md.
When Claude Code reads AGENTS.md, and when it skips it
Older guides say Claude Code ignores AGENTS.md. That changed in v2.1.277. Under the default setting, Claude Code checks for three files in your working directory and every directory above it: CLAUDE.md, .claude/CLAUDE.md and CLAUDE.local.md. If it finds any of them, it reads those and not AGENTS.md. If it finds none, it reads every AGENTS.md and .claude/AGENTS.md on that path, and shows a line such as no CLAUDE.md found; AGENTS.md loaded: /home/you/repo/AGENTS.md in the session.
Three things do not count toward that check and load alongside AGENTS.md: your own ~/.claude/CLAUDE.md, your organisation's managed CLAUDE.md, and anything in .claude/rules/. Claude Code never reads AGENTS.override.md, AGENTS.local.md or anything under a .agents/ directory, so instructions there reach Codex only.
Adding a CLAUDE.local.md for your own notes in a repository that relies on AGENTS.md makes Claude Code stop reading AGENTS.md. Set Project instructions to claude-md-and-agents-md (below), or add a CLAUDE.md that imports @AGENTS.md.
To change the rule, run /config in a Claude Code session and set Project instructions:
| Value | What Claude Code reads |
|---|---|
claude-md-or-agents-md | The default: CLAUDE.md files, or AGENTS.md when there are none |
claude-md-and-agents-md | Both, with each directory's CLAUDE.md files first; an AGENTS.md already imported is not read twice |
claude-md | CLAUDE.md files only |
managed-only | Only the organisation's managed CLAUDE.md and auto memory at launch |
To set it once for every project, put it in ~/.claude/settings.json. Claude Code ignores this entry in a project's .claude/settings.json, so it cannot be set for a whole team from the repository. The key below needs v2.1.285 or later; earlier versions read the same entry under agents-md@builtin:
{
"pluginConfigs": {
"cc-plugin-agents-md@builtin": {
"options": { "instructionFiles": "claude-md-and-agents-md" }
}
}
}
How Codex finds AGENTS.md
Codex starts with the file in its home directory: AGENTS.override.md if it exists and is not empty, otherwise AGENTS.md. Then it finds the project root, which by default is the nearest directory at or above you that contains .git (configurable with project_root_markers), and walks down to the directory where you started it. In each directory it takes the first of AGENTS.override.md, AGENTS.md and any names in project_doc_fallback_filenames, skipping empty files. If there is no project root, it checks only the current directory.
To make Codex read a CLAUDE.md in directories that have no AGENTS.md, add it as a fallback in ~/.codex/config.toml:
project_doc_fallback_filenames = ["CLAUDE.md"]
project_doc_max_bytes = 65536
The second line raises the instruction size limit from its 32 KiB default. Treat the fallback as a stopgap. Any @path line in a CLAUDE.md means something to Claude Code, and Codex's AGENTS.md documentation describes no import syntax of its own.
Three ways to keep one source of truth
Two files that say slightly different things are the usual end state when nobody decides. Pick one of these:
AGENTS.mdonly. Both tools read it with no setup, as long as everyone runs Claude Code v2.1.281 or later and nobody adds aCLAUDE.mdorCLAUDE.local.md. Versions from v2.1.277 read it too, except in some sessions such as those on Amazon Bedrock or with telemetry disabled. This is the simplest option.- A
CLAUDE.mdthat importsAGENTS.md. Use this when you need instructions only Claude should see, or when some people run older Claude Code versions. Claude reads the imported file first, then the rest:@AGENTS.md ## Claude Code Use plan mode for changes under `src/billing/`. - A symlink,
ln -s AGENTS.md CLAUDE.md, when there is nothing Claude-specific. Claude's Edit and Write tools refuse to write through a symlink and editAGENTS.mdinstead, and if anyone clones the repository on Windows, Git may check the link out as a one-line text file. Use the import in that case.
Avoid /import for this. It appends a one-time copy of AGENTS.md to CLAUDE.md, which gives you two files to keep in step from that moment on.
What belongs in which file
Put everything both agents need in AGENTS.md: build and test commands, where code lives, naming conventions, and rules such as which directories not to touch. Put Claude-only material below the import in CLAUDE.md, and use .claude/rules/ with a paths list in the frontmatter for instructions that only matter for some files, since Claude loads those only when it works on matching files. Codex-only material can go in an AGENTS.override.md, but remember that it replaces the AGENTS.md in its directory for Codex, so it must repeat anything shared.
Neither file enforces anything. Claude Code's documentation says it treats CLAUDE.md as context, not enforced configuration, and points to a PreToolUse hook or a permissions.deny rule for anything that must never happen.
Ignored instruction files don't follow you into new worktrees
When you give each agent its own git worktree, a committed AGENTS.md or CLAUDE.md is there in every checkout. Ignored files are not. A CLAUDE.local.md exists only in the worktree where you created it; to share personal instructions across worktrees, import a file from your home directory, such as @~/.claude/my-project-instructions.md. The ChatGPT desktop app copies an ignored AGENTS.override.md into the local worktrees it manages, but not into worktrees you create with git worktree add.
Check what each agent actually loaded
In Claude Code, run /memory and look for the file's path, or run /context and check the list under Memory files. In Codex, run this from the directory you work in:
codex --ask-for-approval never "Summarize the current instructions."
For a record of the session, start Codex with codex -c log_dir=./.codex-log and read ./.codex-log/codex-tui.log.
Running Claude Code and Codex side by side on one project
A shared AGENTS.md matters most when both agents work on the same repository at the same time, which Armadai supports. Armadai is a native macOS app where each project folder becomes a workspace on one canvas, with Claude Code and Codex CLI tiles alongside terminals, code and notes. Its task handoff gives each run its own Git worktree, so commit any instructions a run needs, and Coordinate lets the two agents exchange plans, implementation and reviews while you set the limits. The agents use your own Claude Code and Codex accounts. Armadai costs $20 a month after a 7-day free trial that needs no card.
For the rest of the setup, including review hand-offs between the two tools, see how to use Claude Code and Codex together.
Questions
Is AGENTS.md a standard or a Codex file?
It is an open format for instructions to coding agents, stewarded by the Agentic AI Foundation under the Linux Foundation. It is plain Markdown with no required fields or headings. Codex reads it by default, and Claude Code reads it from v2.1.277.
Does Codex read CLAUDE.md?
Not by default. Add it to project_doc_fallback_filenames in ~/.codex/config.toml and Codex will read CLAUDE.md in any directory between the project root and the current directory that has no AGENTS.override.md or AGENTS.md. Keeping the shared content in AGENTS.md avoids the need.
Should CLAUDE.local.md and AGENTS.override.md be committed?
Claude Code's documentation says to add CLAUDE.local.md to .gitignore, because it holds your personal instructions for the project. If you keep AGENTS.override.md out of Git, the ChatGPT desktop app copies it into the local worktrees it manages, but it will be missing from worktrees you create with git worktree add.
Can an instructions file stop an agent from doing something?
No. Claude Code's documentation says CLAUDE.md is treated as context, not enforced configuration. To block an action whatever the model decides, use a PreToolUse hook or a permissions.deny rule in Claude Code, and the sandbox and approval settings in Codex.
Sources
Details about other products come from their own pages, checked on the dates shown. If something has changed, tell us at support@armadai.sh and we will correct it.
- AGENTS.md is an open format for guiding coding agents, stewarded by the Agentic AI Foundation under the Linux Foundation; it is standard Markdown with no required fields. agents.md, checked October 30, 2026.
- Codex home defaults to ~/.codex and can be changed with CODEX_HOME; at global scope Codex reads AGENTS.override.md if it exists and is non-empty, otherwise AGENTS.md. learn.chatgpt.com, checked October 30, 2026.
- Codex walks from the project root, typically the Git root, down to the current directory, checking AGENTS.override.md, then AGENTS.md, then names in project_doc_fallback_filenames, and includes at most one file per directory. learn.chatgpt.com, checked October 30, 2026.
- Codex concatenates instruction files from the root downward joined with blank lines, so files closer to the current directory come later; empty files are skipped; the chain is built once per run, so Codex must be restarted to pick up changes. learn.chatgpt.com, checked October 30, 2026.
- project_doc_max_bytes limits how much instruction text Codex reads and defaults to 32 KiB; the page shows project_doc_fallback_filenames and project_doc_max_bytes set in ~/.codex/config.toml, and describes no import or include syntax for AGENTS.md. learn.chatgpt.com, checked October 30, 2026.
- codex --ask-for-approval never "Summarize the current instructions." checks what Codex loaded, and codex -c log_dir=./.codex-log writes a TUI log to ./.codex-log/codex-tui.log. learn.chatgpt.com, checked October 30, 2026.
- By default Codex treats a directory containing .git as the project root, and project_root_markers = [] treats the current working directory as the root; sandbox_mode and approval_policy configure Codex's sandbox and approvals. learn.chatgpt.com, checked October 30, 2026.
- Codex copies git-ignored files matching .worktreeinclude into desktop-managed worktrees, copies an ignored AGENTS.override.md into local managed worktrees automatically, and these rules do not apply to worktrees created from the command line. learn.chatgpt.com, checked October 30, 2026.
- Claude Code loads managed, user (~/.claude/CLAUDE.md), project (./CLAUDE.md or ./.claude/CLAUDE.md) and local (./CLAUDE.local.md) instructions; files above the working directory load at launch, files in subdirectories load on demand, all are concatenated from the filesystem root down, and CLAUDE.local.md is appended after CLAUDE.md in each directory. code.claude.com, checked October 30, 2026.
- Claude Code recommends under 200 lines per CLAUDE.md file; @path imports resolve relative to the importing file and can nest to four hops; CLAUDE.local.md should be added to .gitignore and only exists in the worktree where it was created. code.claude.com, checked October 30, 2026.
- Claude Code v2.1.277 or later reads AGENTS.md by default only when no CLAUDE.md, .claude/CLAUDE.md or CLAUDE.local.md exists in the working directory or above, and before v2.1.281 some sessions, such as those on Amazon Bedrock or with telemetry disabled, read CLAUDE.md only; the cc-plugin-agents-md@builtin settings key needs v2.1.285, earlier versions use agents-md@builtin; ~/.claude/CLAUDE.md, the managed CLAUDE.md and .claude/rules/ do not count; AGENTS.local.md, AGENTS.override.md and .agents/ are not read; @path imports inside AGENTS.md are expanded. code.claude.com, checked October 30, 2026.
- The Project instructions setting in /config takes claude-md-or-agents-md (default), claude-md-and-agents-md, claude-md or managed-only, and can be set under pluginConfigs for cc-plugin-agents-md@builtin with options.instructionFiles in ~/.claude/settings.json but not in project or local settings. code.claude.com, checked October 30, 2026.
- A CLAUDE.md that starts with @AGENTS.md never makes Claude read AGENTS.md twice; ln -s AGENTS.md CLAUDE.md also works, but Claude's Edit and Write tools refuse to write through the symlink and Windows clones may check it out as a one-line text file. code.claude.com, checked October 30, 2026.
- From v2.1.280, /memory lists an AGENTS.md that Claude read directly, /context lists loaded files under Memory files, and an interactive session shows a line such as no CLAUDE.md found; AGENTS.md loaded when it reads AGENTS.md directly. code.claude.com, checked October 30, 2026.
- /import appends a one-time copy of instruction files such as AGENTS.md to the matching CLAUDE.md. code.claude.com, checked October 30, 2026.
- Claude treats CLAUDE.md as context, not enforced configuration; a PreToolUse hook or managed permissions.deny blocks actions. code.claude.com, checked October 30, 2026.