Skip to content

ProperPath

Menu

Free resources · Rules and hooks

CLAUDE.md vs AGENTS.md for Claude Code and Codex

CLAUDE.md vs AGENTS.md for teams using Claude Code and Codex. See which file each tool reads by default and how to spot a conflicting rule.

Built by ProperPath

Which instructions file does each tool start with?

Put both files at the root of a repository and Claude Code starts with CLAUDE.md. Codex starts with AGENTS.md. That’s what happens with default project settings and no imports or overrides. Both are Markdown files where your team can put instructions for its coding assistants, such as which tests to run. AGENTS.md is a shared convention that different coding tools can support. Each tool decides where to look for it.

See how CLAUDE.md, skills, and hooks fit together when you need to choose where to put a rule.

When does Claude Code read AGENTS.md?

When you start Claude Code, it looks for CLAUDE.md, .claude/CLAUDE.md, and CLAUDE.local.md in your starting folder and the folders above it. With the default settings, it reads AGENTS.md directly if it finds none of those files. Personal instructions at ~/.claude/CLAUDE.md and organization-managed instructions are separate from that check. A file at ~/CLAUDE.md can count when your starting folder is inside your home directory.

To read AGENTS.md directly, you need Claude Code v2.1.277 or later and the built-in AGENTS.md plugin. You can also choose a mode that reads both files under Project instructions. Starting with v2.1.280, the /memory panel can show the path to an AGENTS.md the session read directly.

Where does Codex look?

Codex looks for instructions from the project root, usually the Git repository root, down to the folder you started in. If it can’t find a project root, it checks only your starting folder. In each folder it checks AGENTS.override.md first, then AGENTS.md, then the filenames you set as fallbacks. It uses at most one instruction file per folder. Codex checks for CLAUDE.md only if you add it to the fallback list.

Do you need two copies of the same rule?

Keep each shared rule in one place. If your team needs both filenames, put the shared rules in AGENTS.md and use the @AGENTS.md import in the CLAUDE.md next to it. That leaves room for Claude-specific notes and gives you one place to edit a shared rule. Before editing either file, check whether both give instructions for the same task. If the rules disagree, decide with your team which one to follow.

How do you fix a conflicting test rule in a scratch repository?

Run these commands in a terminal to create an empty Git repository with two instruction files. The final command prints the conflicting lines and exits with status 1 because it found a difference.

scratch=$(mktemp -d) &&
git -C "$scratch" init -q &&
printf '%s\n' 'Before finishing, run unit tests only.' > "$scratch/CLAUDE.md" &&
printf '%s\n' 'Before finishing, run unit and integration tests.' > "$scratch/AGENTS.md" &&
git diff --no-index -- "$scratch/CLAUDE.md" "$scratch/AGENTS.md"

Say your team wants both test suites. Keep that rule in AGENTS.md and change the scratch CLAUDE.md to import it. Run this in the same terminal so it still has the scratch path.

printf '%s\n' '@AGENTS.md' > "$scratch/CLAUDE.md"
cat "$scratch/CLAUDE.md" "$scratch/AGENTS.md"

Where can you learn more about Claude Code?

Read how to keep CLAUDE.md short and how to make Claude read before answering.

Check the shared rule

The output should have two lines: @AGENTS.md, then Before finishing, run unit and integration tests. The rule now lives in one file. To repeat this on your own repository, compare one rule first and agree which version to keep before editing either file.

The terminal check shows the files you wrote. To check what Claude Code loads, open a fresh session from the scratch folder and use /memory. Look for the scratch CLAUDE.md and its AGENTS.md import.