← Blog

How-to5 min read

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.

A Mirasim session with its own file tree and editor for the workspace it runs inA Mirasim session with its own file tree and editor for the workspace it runs in

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.mdCLAUDE.md
Read byCodex, Cursor, GitHub Copilot's coding agent, opencode, Zed and others; Claude Code when there is no CLAUDE.mdClaude Code
In the projectAGENTS.md at the root, more in subfoldersCLAUDE.md or .claude/CLAUDE.md, more in subfolders
Just for youAGENTS.md in the Codex home folder (Codex)CLAUDE.md in the .claude folder in your home folder; CLAUDE.local.md in a project
Override fileAGENTS.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

A small AGENTS.md
# 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 test before 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

  1. Your own file

    In the Codex home folder (~/.codex unless you set CODEX_HOME), Codex reads AGENTS.override.md if there is one, otherwise AGENTS.md.

  2. 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.

  3. 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).

~/.codex/config.toml: let Codex read a CLAUDE.md too
project_doc_fallback_filenames = ["CLAUDE.md"]
project_doc_max_bytes = 65536

A 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."

How Claude Code reads CLAUDE.md and AGENTS.md

Your project hasClaude Code reads
AGENTS.md, and no CLAUDE.md or CLAUDE.local.md here or aboveAGENTS.md
AGENTS.md and a CLAUDE.md or CLAUDE.local.mdOnly the CLAUDE.md files
A CLAUDE.md that imports @AGENTS.mdCLAUDE.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:

CLAUDE.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 unless core.symlinks is 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_filenames above, 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.

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.

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