---
title: "AGENTS.md vs CLAUDE.md on a mixed-agent team: which file each agent reads, and the CLAUDE.local.md trap"
description: "AGENTS.md vs CLAUDE.md: which file Claude Code, Codex, Cursor and Copilot read, why a CLAUDE.local.md can hide AGENTS.md, and a one-line fix."
canonical_url: "https://factrove.app/blog/agents-md-vs-claude-md/"
author: "Tom"
date: "2026-10-20"
---
# AGENTS.md vs CLAUDE.md on a mixed-agent team: which file each agent reads, and the CLAUDE.local.md trap

Short answer: keep the shared rules in `AGENTS.md`, and commit a `CLAUDE.md` next to it whose first line is `@AGENTS.md`. Codex and Cursor read `AGENTS.md`, and so does GitHub Copilot on GitHub.com. Claude Code reads `CLAUDE.md`, and from v2.1.277 it can read `AGENTS.md` on its own too, but by default only when there's no `CLAUDE.md`, `.claude/CLAUDE.md` or `CLAUDE.local.md` in your working directory or above it. The import keeps working in all of those cases, including the one that catches people: a teammate adds a personal `CLAUDE.local.md` and Claude quietly stops reading the shared file for them. It does not cover Project instructions set to `managed-only`, which leaves project files out.

Everything below about Claude Code comes from the [Claude Code memory docs](https://code.claude.com/docs/en/memory). It changes often, so check the page for your version.

## If Claude Code is ignoring your AGENTS.md right now

The memory docs' troubleshooting section says to check these in order:

1. Look for a `CLAUDE.md`, `.claude/CLAUDE.md` or `CLAUDE.local.md` in your working directory or any directory above it, other than your `~/.claude/CLAUDE.md`. If there is one, Claude reads it instead of `AGENTS.md`, unless you set Project instructions to `claude-md-and-agents-md`.
2. Run `claude --version` and confirm v2.1.277 or later. Before v2.1.281, some sessions, such as those on Amazon Bedrock or with telemetry disabled, couldn't load `AGENTS.md` either. If you're on one of those, update to v2.1.281 or later.
3. Type `/config` and check that **Project instructions** isn't set to `claude-md` or `managed-only`. If the setting isn't there at all, your session is one that can't load `AGENTS.md`.

Except when Project instructions is `managed-only`, add a `CLAUDE.md` next to your `AGENTS.md` and import it as shown below. With `managed-only`, project instruction files are excluded at launch, so ask your organization administrator to change the managed setting. A subdirectory's `CLAUDE.md` and `.claude/rules/` files, and path-scoped rules, still load on demand.

```markdown
@AGENTS.md
```

Start a new session, run `/context`, and check that `CLAUDE.md` is listed under **Memory files**.

## Which file each agent reads

What each tool's own docs say it reads from the repository. Each name links to the page I checked, and I only listed tools whose docs I could check.

| Agent (docs) | Reads by default | CLAUDE.md | Nested files |
| --- | --- | --- | --- |
| [Claude Code](https://code.claude.com/docs/en/memory) | `CLAUDE.md`, `.claude/CLAUDE.md` and `CLAUDE.local.md`, from the working directory and every directory above it. `AGENTS.md` and `.claude/AGENTS.md` instead, by default only when none of those three exist (v2.1.277+) | Its native file | A subdirectory `CLAUDE.md` loads once Claude reads, writes, or edits a file there. A subdirectory `AGENTS.md` loads when Claude opens a file there with the Read tool, and only if that subdirectory has none of the three `CLAUDE.md` files |
| [Codex](https://learn.chatgpt.com/docs/agent-configuration/agents-md) | `AGENTS.override.md`, else `AGENTS.md`, else any names in `project_doc_fallback_filenames` | Not in the default list, but you can add fallback names | At most one file per directory, from the project root down to the working directory, up to 32 KiB combined by default |
| [Cursor](https://cursor.com/docs/rules) | `AGENTS.md` in the project root and subdirectories, plus `.cursor/rules` | Yes, a root `CLAUDE.md`. [Cursor's help](https://cursor.com/help/customization/rules) says it reads it the same way as `AGENTS.md` and always applies it | Nested `AGENTS.md` files are combined with their parents, and the more specific file wins |
| [GitHub Copilot (on GitHub.com)](https://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/add-custom-instructions/add-repository-instructions) | One or more `AGENTS.md` files anywhere in the repo, nearest one wins, plus `.github/copilot-instructions.md` | "Alternatively," a single `CLAUDE.md` or `GEMINI.md` in the repo root | Nearest `AGENTS.md` in the directory tree takes precedence |
| [Gemini CLI](https://geminicli.com/docs/cli/gemini-md/) | `GEMINI.md`. `context.fileName` in `settings.json` can add `AGENTS.md` and other names | Not by default | Loads `GEMINI.md` from workspace directories and their parents, and from a directory and its ancestors when a tool accesses it |

The Gemini CLI page carries a banner that Gemini CLI was replaced by Antigravity CLI on June 18th, 2026, for unpaid and Google One users.

Two details from Claude Code's side that people trip on. It doesn't read `AGENTS.local.md`, `AGENTS.override.md`, or anything under a `.agents/` directory. And it doesn't count your `~/.claude/CLAUDE.md`, your organization's managed `CLAUDE.md` or `.claude/rules/` files when it decides whether to read `AGENTS.md`. Those keep loading alongside it.

## AGENTS.md vs CLAUDE.md, side by side

| | AGENTS.md | CLAUDE.md |
| --- | --- | --- |
| Read natively by | Codex, Cursor, GitHub Copilot on GitHub.com. Claude Code from v2.1.277, by default only when no `CLAUDE.md` files exist | Claude Code, and Cursor, which reads a root `CLAUDE.md` like `AGENTS.md`. GitHub Copilot on GitHub.com accepts a single root `CLAUDE.md` as an alternative |
| Personal, uncommitted version | No shared convention. Codex's `AGENTS.override.md` replaces `AGENTS.md` in its directory (the docs use a committed `services/payments/AGENTS.override.md`), and `~/.codex/AGENTS.override.md` is a temporary global override. It's an override, not a personal file, and Claude Code doesn't read it | `CLAUDE.local.md`, added to `.gitignore`, appended after `CLAUDE.md` in the same directory |
| Imports | Claude Code expands `@path` imports inside an `AGENTS.md` it reads. I didn't find import syntax in the Codex or Cursor `AGENTS.md` docs, so I keep `AGENTS.md` self-contained | `@path` imports, including `@AGENTS.md` |
| Size guidance | Codex stops adding files at 32 KiB combined by default (`project_doc_max_bytes`) | Target under 200 lines per file. Claude Code skips a file over 4 MiB |
| Hooks in Claude Code | `InstructionsLoaded` hooks don't fire for an `AGENTS.md` read directly, but do when a `CLAUDE.md` imports it | `InstructionsLoaded` hooks fire |

## The CLAUDE.local.md trap

Here's how it happens. Your team relies on `AGENTS.md` and has no `CLAUDE.md`, because Claude Code reads `AGENTS.md` directly now. One person wants their own sandbox URL and test account in Claude's context, so they create a `CLAUDE.local.md` and gitignore it. That's exactly what the docs recommend for personal notes.

But `CLAUDE.local.md` counts as one of the three files that make Claude read `CLAUDE.md` files instead of `AGENTS.md`. From then on, in that person's sessions, Claude reads their local file and not the shared rules. Nothing errors. Everyone else is fine. The memory docs say it directly: adding one "stops Claude from reading `AGENTS.md` for you."

The same docs point out that a gitignored `CLAUDE.local.md` only exists in the worktree where you created it, so the same person can see different behavior in two worktrees of one repo.

There are two fixes.

### Fix 1: commit a CLAUDE.md that imports AGENTS.md

This is the one I'd pick for a team. Once the repo has a `CLAUDE.md`, Claude reads it, expands the import, and appends anyone's `CLAUDE.local.md` after it. Per the docs, keeping the import "never makes Claude read `AGENTS.md` twice, whichever **Project instructions** value you use." That is about not loading the file twice. With `managed-only`, project `CLAUDE.md` files are left out at launch, so the import never loads and you have to ask your organization administrator to change the managed setting. A subdirectory's `CLAUDE.md` and `.claude/rules/` files, and path-scoped rules, still load on demand. Everywhere else, it's one committed file, so it fixes the trap for the team, including sessions that can't read `AGENTS.md` directly.

### Fix 2: set Project instructions to read both

In `/config`, set **Project instructions** to `claude-md-and-agents-md`. Claude then reads each directory's `CLAUDE.md` files first and its `AGENTS.md` after them. You can also set it in `~/.claude/settings.json`:

```json
{
  "pluginConfigs": {
    "cc-plugin-agents-md@builtin": {
      "options": { "instructionFiles": "claude-md-and-agents-md" }
    }
  }
}
```

The catch for a team: the docs say Claude Code reads this entry from `~/.claude/settings.json`, a `--settings` file or managed settings, and ignores it in project and local settings files. So each person sets it for themselves; you can't commit it for the repo. Before v2.1.285 the plugin ID was `agents-md@builtin`, and v2.1.285 and later read either ID.

## Version notes for Claude Code

From the memory docs:

- **v2.1.277 or later** is needed to read `AGENTS.md` directly.
- **Before v2.1.280**, `/memory` and `/context` didn't list an `AGENTS.md` that Claude read directly. On those versions, ask Claude what its project instructions say instead. On later versions, `/memory` lists its path.
- **Before v2.1.281**, some sessions, such as those on Amazon Bedrock or with telemetry disabled, read `CLAUDE.md` files only.
- **Before v2.1.285**, the settings ID was `agents-md@builtin` instead of `cc-plugin-agents-md@builtin`.
- In some cases, the **first session after upgrading** from v2.1.276 or earlier doesn't read `AGENTS.md`. The next one does.
- If you disabled the built-in plugin with `/plugin`, Claude reads `CLAUDE.md` files only.

When it does read `AGENTS.md` directly in an interactive session, you see a line like `no CLAUDE.md found; AGENTS.md loaded: /home/you/repo/AGENTS.md`.

## The setup I'd use on a mixed team

```text
AGENTS.md          shared rules for every agent, plain Markdown, no imports
CLAUDE.md          @AGENTS.md; additional root-file notes also reach Cursor
CLAUDE.local.md    optional, personal, in .gitignore
```

Root `CLAUDE.md`:

```markdown
@AGENTS.md
```

`.claude/rules/claude-only.md`:

```markdown
Use plan mode for changes under `src/billing/`.
```

### Why an import and not a symlink

The docs also allow `ln -s AGENTS.md CLAUDE.md`, with two constraints. Claude's Edit and Write tools refuse to write through a symlink and point it at `AGENTS.md` instead. And on Windows, creating a symlink needs Administrator privileges or Developer Mode, and Git checks a committed symlink out as a plain text file unless `core.symlinks` is enabled. That leaves a one-line `CLAUDE.md` in place of your instructions. If anyone on the team uses Windows, the docs say to use the import.

### Why not rely on direct reading alone

Direct reading can stop after someone adds a `CLAUDE.local.md`, uses an older version, or disables direct `AGENTS.md` support. The committed import covers those cases. See [the managed-only exception above](#if-claude-code-is-ignoring-your-agents-md-right-now).

### If you set up a workaround before Claude read AGENTS.md

The docs cover the common ones. A `CLAUDE.md` with `@AGENTS.md` can stay. A `CLAUDE.md` that tells Claude in words to read `AGENTS.md` only works if Claude decides to open the file, so replace the sentence with the import. A `SessionStart` hook that prints `AGENTS.md` should go, because once Claude reads the file directly the hook adds a second copy.

### Check that each agent loaded it

- **Claude Code:** run `/context` and look for `CLAUDE.md` under **Memory files**.
- **Codex:** the [Codex guide](https://learn.chatgpt.com/docs/agent-configuration/agents-md) suggests running `codex --ask-for-approval never "Summarize the current instructions."` from the repository root.
- **Anything else:** ask the agent to restate two or three of your rules before it edits anything. If it can't, the file may not have loaded, or the agent may not be following it reliably.

## How this fits with handoffs and shared files

The same split shows up in the other posts here. When you [hand a task from Claude Code to Codex](https://factrove.app/blog/claude-code-to-codex-handoff/), the shared rules live in `AGENTS.md` and the task state lives in a `HANDOFF.md`. When you [share a Claude Code artifact with a Codex or Cursor teammate](https://factrove.app/blog/share-claude-code-artifact-with-codex-teammate/), the repo file route depends on every agent reading the same instructions. And if those artifacts are HTML, [keep the HTML for people and generate Markdown for agents](https://factrove.app/blog/html-for-humans-markdown-for-agents/). For configuration migration, see [Claude Code to Cursor](https://factrove.app/blog/claude-code-to-cursor/), [Codex to Claude Code](https://factrove.app/blog/codex-to-claude-code/) and [Cursor to Codex](https://factrove.app/blog/cursor-to-codex/).

## Where Factrove fits

Factrove doesn't touch your instruction files, and you don't need it for anything above. The planned link is small: a line in `AGENTS.md` that tells agents to check a `factrove.md` index of shared plans and reports before they ask you. That's planned, not built, and the file format isn't final.

---

*Factrove is early and not available yet; CLI and file formats aren't final. If your team runs more than one coding agent, [follow me on X](https://x.com/thetomweiss) for what I find, and tell me which setup you landed on. Read the [planned artifact workflow](https://factrove.app/#how) or [join the waitlist](https://factrove.app/#access).*
