AGENTS.md and CLAUDE.md: what they are, and one file for Claude Code and Codex
AGENTS.md is the open instructions file most coding agents read; CLAUDE.md is Claude Code's. Where each goes, which one wins, and how to keep one copy for both.


The short answer
Both are plain Markdown files of instructions that a coding agent reads before it starts work: build and test commands, code style, project layout, rules it must follow. AGENTS.md is an open format that Codex and many other agents read. CLAUDE.md is Claude Code's own name for the same thing, and recent versions of Claude Code read AGENTS.md too when a project has no CLAUDE.md.
| AGENTS.md | CLAUDE.md | |
|---|---|---|
| Read by | Codex, Cursor, GitHub Copilot's coding agent, opencode, Zed and others; Claude Code when there is no CLAUDE.md | Claude Code |
| In the project | AGENTS.md at the root, more in subfolders | CLAUDE.md or .claude/CLAUDE.md, more in subfolders |
| Just for you | AGENTS.md in the Codex home folder (Codex) | CLAUDE.md in the .claude folder in your home folder; CLAUDE.local.md in a project |
| Override file | AGENTS.override.md (Codex) | None; files load from the broadest to the most specific |
| Draft one with | /init in Codex | /init in Claude Code |
If you use more than one agent, keep your rules in AGENTS.md. Codex reads it as is, and Claude Code reads it directly or through a one-line CLAUDE.md, shown below.
What to put in it
# AGENTS.md
## Setup
- Install: `pnpm install`
- Dev server: `pnpm dev`
- Tests: `pnpm test` (run before every commit)
## Code style
- TypeScript strict mode
- API handlers live in `src/api/handlers/`
## Rules
- Ask before adding a production dependency.
- Never edit files under `generated/`; run `pnpm codegen` instead.- No fields are required. Any headings work; the agent reads the text.
- Write what you'd otherwise repeat in every chat: commands, where things live, rules. Make each one checkable: “Run
npm testbefore committing”, not “Test your changes”. - Keep it short. Anthropic suggests under 200 lines per CLAUDE.md; Codex stops reading once the combined files pass 32 KiB by default.
- Put a long procedure, or something that matters for only one part of the code, in a skill or a subfolder's own file instead.
- These files are context, not enforcement. To block an action no matter what the agent decides, use permissions or hooks.
How Codex reads AGENTS.md
- Your own file
In the Codex home folder (
~/.codexunless you setCODEX_HOME), Codex reads AGENTS.override.md if there is one, otherwise AGENTS.md. - Then the project, from the root down
From the Git root down to the folder you started in, Codex takes at most one file per folder: AGENTS.override.md, else AGENTS.md, else a name from
project_doc_fallback_filenames. - Joined in order
The files are joined root first, so a file closer to where you work comes later and overrides broader guidance. Empty files are skipped, and reading stops at
project_doc_max_bytes(32 KiB by default).
project_doc_fallback_filenames = ["CLAUDE.md"]
project_doc_max_bytes = 65536A fallback name is only used in folders with no AGENTS.md. Codex rebuilds the list every time it starts, so after editing a file, start a new session. To check what it loaded, ask: codex --ask-for-approval never "Summarize the current instructions."
Article · Codex config.toml: where it is, and the settings worth changing → Codex config.toml: where it is and the other settings in it.
How Claude Code reads CLAUDE.md and AGENTS.md
| Your project has | Claude Code reads |
|---|---|
| AGENTS.md, and no CLAUDE.md or CLAUDE.local.md here or above | AGENTS.md |
| AGENTS.md and a CLAUDE.md or CLAUDE.local.md | Only the CLAUDE.md files |
| A CLAUDE.md that imports @AGENTS.md | CLAUDE.md, with AGENTS.md included |
Reading AGENTS.md directly needs Claude Code v2.1.277 or later. To read both files together, or only CLAUDE.md, open /config and change Project instructions. Claude Code doesn't read AGENTS.override.md or AGENTS.local.md.
- CLAUDE.md in the .claude folder in your home folder
- Your preferences for every project. It loads alongside a project's AGENTS.md.
- ./CLAUDE.md or ./.claude/CLAUDE.md
- The team's instructions, committed with the code. Files in subfolders load when Claude works there.
- ./CLAUDE.local.md
- Your own notes for this project; add it to .gitignore. It counts as a CLAUDE.md, so with the default setting it stops Claude Code from reading AGENTS.md.
- @path
- Pulls another file into a CLAUDE.md, up to four levels deep.
Run /init to draft a CLAUDE.md from your code, and /context all to see which instruction files loaded, under Memory files.
One file for both
Keep AGENTS.md as the real file. If the project has no CLAUDE.md, a recent Claude Code already reads it. If you need a CLAUDE.md, for Claude-only rules or for older versions, make it import AGENTS.md:
@AGENTS.md
## Claude Code
Use plan mode for changes under `src/billing/`.- A symlink works too (
ln -s AGENTS.md CLAUDE.md), but not for anyone on Windows: Git checks a symlink out there as a one-line text file unlesscore.symlinksis on. Use the import if your team uses Windows. - A CLAUDE.md that only says “read AGENTS.md” in words isn't the same: Claude sees AGENTS.md only if it decides to open it. Use
@AGENTS.md. - Going the other way, Codex can read a CLAUDE.md through
project_doc_fallback_filenamesabove, in folders with no AGENTS.md.
In Mirasim: see every agent's files in one place
Mirasim runs Claude Code, Codex and other coding agents as they are, so each one reads its own instruction files exactly as above, and Mirasim leaves those files as they are. In the new interface, the Workspaces page has a Memory tab that lists, for that folder, what each agent keeps there: CLAUDE.md, .claude/CLAUDE.md, .claude/rules, CLAUDE.local.md, AGENTS.md, AGENTS.override.md, GEMINI.md, and Claude Code's auto memory for the project. Click one to open it, read it and edit it.
Coming from Cursor? Mirasim follows each project's .cursor/rules in place, and can also add those rules to AGENTS.md for you; that option is off until you tick it, and lists each file first.
Chapter 11 · Files, Git and terminals → Docs, chapter 11: the Workspaces page, with its Files, Git and Memory tabs.
Article · Cursor alternatives: coding agents with their own apps → Moving off Cursor? Coding agents to use instead, and bringing your rules along.
Questions
- AGENTS.md or AGENT.md?
- AGENTS.md, plural. If you already have an AGENT.md, the agents.md site suggests renaming it and leaving a symlink:
mv AGENT.md AGENTS.md && ln -s AGENTS.md AGENT.md. - Who maintains AGENTS.md?
- It's an open format, now looked after by the Agentic AI Foundation under the Linux Foundation. The agents.md site says over 60,000 open-source projects use it.
- Two files disagree. Which wins?
- The agents.md rule: the file closest to the code being edited wins, and what you say in the chat overrides every file. Codex puts the closer file later so it overrides broader guidance. For contradictions, even within one CLAUDE.md, Anthropic warns that Claude may pick either line, so remove the stale one.
- Should I commit these files?
- Commit AGENTS.md and CLAUDE.md so the whole team gets them. Keep personal notes in CLAUDE.md in your home folder's .claude folder, or in CLAUDE.local.md listed in .gitignore.
Article · How to use Claude Code: your first session, permission modes, and undoing changes → How to use Claude Code: permissions, CLAUDE.md and the commands you'll use most.
Article · How to use Codex: your first task, permissions, and the commands you'll use → How to use Codex: your first task, permissions and AGENTS.md.
Sources
Checked on November 25, 2026 against agents.md, OpenAI's Codex documentation (learn.chatgpt.com/docs, Custom instructions with AGENTS.md) and Anthropic's Claude Code documentation (code.claude.com/docs, How Claude remembers your project). Both agents change often, so check those pages for the latest.
Keep reading

Code review with Claude Code and Codex: /review, GitHub reviews and a second opinion
Code review with Claude Code and Codex: /review for local changes, automatic GitHub PR reviews, where review rules go, and a second opinion from the other agent.

Hooks in Claude Code and Codex: run your own commands when the agent acts
What hooks are in Claude Code and Codex, where they go, when they fire, and examples: a notification, formatting after edits, blocking edits to protected files.

Claude Code and Codex permission modes: auto, plan, --dangerously-skip-permissions and --yolo
What each Claude Code and Codex permission mode allows without asking, what --dangerously-skip-permissions and --yolo turn off, and safer ways to get fewer prompts.