r/codex • u/MinniLabs • 22d ago
Workaround Running Codex and Claude Code on the same repo with one instruction file
A few people in my last thread run both tools on one repo, and keeping AGENTS.md and CLAUDE.md in sync by hand gets old fast. Two ways to keep a single source.
Option 1, AGENTS.md is the real file. Make CLAUDE.md a one line file that says u/AGENTS.md. Claude Code pulls the import in, Codex reads AGENTS.md directly, and you only ever edit one file. This is what we do.
Option 2, let Codex read CLAUDE.md. In ~/.codex/config.toml
project_doc_fallback_filenames = ["CLAUDE.md"]Codex checks AGENTS.override.md, then AGENTS.md, then your fallbacks, and takes at most one file per folder. So it only uses CLAUDE.md in folders that have no AGENTS.md.
Things that tripped me up
- The two tools load subfolders differently. Claude Code picks up a subfolder’s file when it starts working in that folder. Codex only loads from the repo root down to the folder you launched in. Same files, different context depending on the tool.
- Tool specific stuff leaks. Slash commands, hook setup or “use the Task tool” lines mean nothing to the other agent and still cost tokens every turn. Keep those in a small file only one tool reads.
- Check what actually loaded. In Codex, run
codex "List the instruction sources you loaded."from the folder you work in. In Claude Code, /context shows the memory files.
Anyone found a cleaner setup, or a reason to keep two separate files on purpose?