# CLAUDE.md vs AGENTS.md: which file each tool reads

Canonical: https://cwyn.com/pages/claude-code-guide-claude-md-vs-agents-md.html
Last updated: 2026-11-26T21:07:53-05:00

Claude Code instruction files

Codex looks for `AGENTS.override.md` before `AGENTS.md` in each directory from the project root to the working directory. Claude Code can read `AGENTS.md` directly from v2.1.277 onward, but by default prefers `CLAUDE.md` in the working directory or its parents. Keep shared rules in `AGENTS.md` and import them with `@AGENTS.md` in a neighboring `CLAUDE.md`.

Last updated November 26, 2026 · Published November 20, 2026

By CWYN · Sources checked as of November 20, 2026 · Not affiliated with Anthropic or OpenAI · Short answer as of Nov 22, 2026 ([file discovery sources](https://cwyn.com/pages/claude-code-guide-claude-md-vs-agents-md.html#file-comparison))

## 1. Match the file to the tool

Documented instruction discovery, as of November 20, 2026

| Tool | Files and precedence | Public source |
| --- | --- | --- |
| Claude Code | Reads CLAUDE.md. From v2.1.277, it can also read AGENTS.md directly. By default, a CLAUDE.md or CLAUDE.local.md in the working directory or above takes priority over automatic AGENTS.md discovery. The Project instructions setting can change this. | [Claude Code memory docs](https://code.claude.com/docs/en/memory#agentsmd) |
| OpenAI Codex | Reads global instructions, then project instructions from the root to the working directory. Per directory, AGENTS.override.md precedes AGENTS.md, followed by configured fallback names. Deeper guidance overrides earlier guidance. CLAUDE.md needs an explicit fallback configuration to join this discovery order. | [Codex AGENTS.md docs](https://learn.chatgpt.com/docs/agent-configuration/agents-md) |

The [AGENTS.md public spec](https://agents.md/) describes plain Markdown and nearest-file precedence. It lists supporting tools, including Codex, Cursor and Jules. Consult each tool's docs before assuming identical discovery or import behavior.

## 2. Keep one source of truth

Start with the [AGENTS.md examples for web apps, Python scripts and monorepos](https://cwyn.com/pages/claude-code-guide-agents-md-examples.html). Use the [free AGENTS.md generator](https://cwyn.com/tools/agents-md-generator/) to add your preferences for edits and feedback to the shared file.

Starting a new project file? Copy the [CLAUDE.md template](https://cwyn.com/pages/claude-code-guide-claude-md-template.html) and fill in your repository’s commands and paths.

Put shared commands, conventions and paths in `AGENTS.md`. Where Claude needs a companion file, put this single line in a neighboring `CLAUDE.md`:

```
@AGENTS.md
```

[Claude's shared-file instructions](https://code.claude.com/docs/en/memory#share-one-file-with-other-coding-tools) support this pattern. Add only Claude-specific rules below it. Relative `@path` imports resolve from the importing file. An ordinary sentence asking Claude to read another file is not an import. This syntax is Claude's behavior; the AGENTS.md spec does not define a portable import mechanism.

## 3. Confirm what loaded

In Claude Code, run `/context all` and inspect Memory files. Use `/memory` to edit files; its menu can include paths for files that do not yet exist. For nested instructions, read a file in that directory and watch for the terminal's Loaded path. These checks come from [Claude's memory troubleshooting docs](https://code.claude.com/docs/en/memory#troubleshoot-memory-issues).

In Codex, start a fresh session in the intended directory and ask it to list its active instruction sources. Expect the global file, repository guidance and any applicable override in order, as described in the [Codex verification steps](https://learn.chatgpt.com/docs/agent-configuration/agents-md#verify-your-setup).

## 4. Check a rule before editing more files

Choose one command already documented by your repository. Ask each tool which command it would run without running it, then compare the answers. Reconcile contradictory instructions in the shared file and repeat in a fresh session. File discovery and following a rule are separate checks.

Once both tools see the same rules, [compare Claude Code and Codex CLI for editing, review and hand-off](https://cwyn.com/pages/claude-code-guide-claude-code-vs-codex.html) to choose which one handles the next task.

To budget the same project on both tools, [compare Claude Code and Codex costs](https://cwyn.com/pages/claude-code-guide-claude-code-vs-codex-cost.html).

## Next steps

- [All 34 Claude Code guides](https://cwyn.com/guides/claude-code/)
- [Claude Code setup walkthrough](https://cwyn.com/setup/claude-code/)
- [Check your setup file](https://cwyn.com/score/setup-file-checker/)
- [AI Instruction Builder Pro ($14.95)](https://cwyn.com/pages/pack-ai-instruction-builder-pro.html)

### Write and check your shared instructions

[Free AI instruction builder](https://cwyn.com/build/ai-instructions/)

[Check your setup file](https://cwyn.com/score/setup-file-checker/) before testing it in the tool.

### Generate instructions for both tools

To generate both AGENTS.md and CLAUDE.md offline from the same answers, use [AI Instruction Builder Pro ($14.95)](https://cwyn.com/pages/pack-ai-instruction-builder-pro.html).

AI Instruction Builder Pro $14.95

Build a full-length AGENTS.md, longer ChatGPT instructions and files for seven other targets offline, including a dedicated Grok Bot description. Nine offline presets include the General professional default and the developer ready set. Includes six role add-ons, a printable trait report and a self-test guide.
