CLAUDE.md vs AGENTS.md: One Repo, Two Agents
If Claude Code and Codex both work in one repository, you can keep the project rules in one file, AGENTS.md. Codex always reads it. Since version 2.1.277, Claude Code reads AGENTS.md on its own too, with one catch: if there's a CLAUDE.md next to it or above it, by default Claude Code reads only the CLAUDE.md and skips AGENTS.md.
Below: when one AGENTS.md is enough, when you need a CLAUDE.md, an example with a changed test command and a check for each agent. And at the end, what to do with instructions that don't belong in either file. In Tascue they live in the task, and one task goes to any agent the same way.
Three repository setups
| What's in the repo | What Claude Code reads | What Codex reads |
|---|---|---|
| Only AGENTS.md | AGENTS.md | AGENTS.md |
| AGENTS.md and CLAUDE.md without an import | Only CLAUDE.md | AGENTS.md |
AGENTS.md and CLAUDE.md with @AGENTS.md |
CLAUDE.md and AGENTS.md | AGENTS.md |
The second setup is the most common source of confusion. Someone created CLAUDE.md with /init a while ago, later added AGENTS.md for Codex, and Claude Code simply doesn't see it.
If there are no Claude-specific rules
One AGENTS.md is enough:
shop/
├── AGENTS.md # commands, structure, conventions
├── app/
│ ├── api/
│ │ └── AGENTS.md # rules for the API only
│ └── billing/
└── tests/
Codex adds the nested app/api/AGENTS.md to the root one when it works in that folder. Claude Code picks it up when it opens a file in app/api/.
If Claude Code needs something of its own
Say you want changes in app/billing/ to start in plan mode, and Codex has no such mode. Then you put a CLAUDE.md next to AGENTS.md:
@AGENTS.md
## Claude Code only
- Start changes in app/billing/ in plan mode.
The @AGENTS.md line pulls in the shared file, and it won't be read twice. Everything below it is seen only by Claude Code.
There's a third way: in /config, set "Project instructions" to claude-md-and-agents-md, and Claude Code reads both files without an import. But that's a user setting, not a project one. A teammate who hasn't turned it on gets the default behavior. The import in CLAUDE.md works for everyone.
Example: the test command changes
The project moved to uv, and instead of pytest the tests now run with uv run pytest -x.
-
Change the command in AGENTS.md, and only there.
-
Make sure the old command isn't left in CLAUDE.md:
grep -n "pytest" AGENTS.md CLAUDE.md -
Restart the sessions. Both agents read these files at startup, and a session opened in the morning keeps using the old command.
How to check that an agent sees the rule
Claude Code. The /memory command shows the loaded files: the path to AGENTS.md should be in the list. If the project has only AGENTS.md, Claude Code prints an AGENTS.md loaded line with the file path when the session starts.
Codex. Run codex --ask-for-approval never "Summarize the current instructions." and see whether the answer has the new command.
The simplest check works for both: in a new session, ask "Which command runs the tests?".
One trap: Codex reads AGENTS.override.md, Claude Code doesn't. A rule that lives only there is invisible to Claude Code.
What doesn't belong in either file
AGENTS.md holds what's true for any task in the repository. But work is full of instructions you don't always need:
- what this task should produce and how to check it;
- what not to touch this time;
- requirements for one type of task, such as "check in the browser" for UI changes.
Put these into AGENTS.md, and the file grows and gets in the way of tasks they don't apply to. Write them in the prompt, and you repeat the same things and have to remember what was said where.
In Tascue this is the task text and includes. Expectations go into the task, repeated requirements become an include once and are checked where needed. The task builds the prompt: fields, text, includes. Copy puts the same text on the clipboard whether you paste it into Claude Code or Codex. If the agents are connected to Tascue over MCP, either of them can take the task and gets it in full.
The project rules in the repository can live in one file or two, while the task in Tascue is one for both agents.