AGENTS.md vs CLAUDE.md: what Claude Code and Codex read
Codex reads AGENTS.md and Claude Code reads CLAUDE.md; recent Claude Code versions can also read AGENTS.md. Keep one set of rules in AGENTS.md and have CLAUDE.md import it with @AGENTS.md, so both tools follow the same instructions.
Which file does each tool read?
| Tool | Project file | Personal file |
|---|---|---|
| Codex | AGENTS.md | AGENTS.md in the .codex folder of your profile |
| Claude Code | CLAUDE.md (AGENTS.md in recent versions) | CLAUDE.md in the .claude folder of your profile |
Both read the file at the start of each session and treat it as standing instructions. In Claude Code, run /memory to see which files loaded.
How do I keep one set of rules for both tools?
Write the rules once in AGENTS.md. Then make CLAUDE.md import it, and add anything that applies only to Claude Code below:
@AGENTS.md
# Claude Code only
- Run the tests before you say a task is done.Codex reads AGENTS.md directly, Claude Code reads it through the import, and there is one file to keep up to date.
What belongs in these files?
- How to install, build, run and test the project, as exact commands.
- Conventions: code style, naming, where new files go.
- Folders and files the agent must not touch.
- How to check a change is done, such as which tests must pass.
Keep it short. Every line is read at the start of every session, in both tools.
Can I use them to share my last session?
No. They hold standing instructions, not a record of what happened. A session log written there goes stale within a day and is still followed as an instruction. For the last session, use a handoff prompt or a tool that briefs the next chat for you, such as AskOnce, which never writes into these files.
Do I need both files?
If you use both tools, yes: AGENTS.md for the rules, and a CLAUDE.md of one or two lines that imports it. It is the most reliable way to give every Claude Code version and Codex the same rules. See also using both tools in one repo.
Questions
Does Codex read CLAUDE.md?
Not by default. Codex looks for AGENTS.md. If your rules live in CLAUDE.md, move them to AGENTS.md and import that from CLAUDE.md with @AGENTS.md.
Does Claude Code read AGENTS.md?
Recent versions can, and any version can import it from CLAUDE.md with @AGENTS.md. Run /memory in Claude Code to see which files loaded.
Does AskOnce change AGENTS.md or CLAUDE.md?
No. AskOnce never writes captured text into instruction files. It gives the next chat a separate brief instead.