skip to content

A repository's AGENTS.md stopped reaching Claude Code after a developer added a CLAUDE.local.md — why, and how do you fix it?

level: seniorimportance: nice to knowfreq 7%

answer

  1. a fallback, not a merge
  2. which files count for the check
  3. the Project instructions setting in /config
  4. claude-md-and-agents-md
  5. direct reading since 2.1.277

basics

~10 s

Since 2.1.277 Claude Code reads AGENTS.md only when no CLAUDE.md, .claude/CLAUDE.md or CLAUDE.local.md exists in the working directory or above, and CLAUDE.local.md counts. Set Project instructions to claude-md-and-agents-md, or import @AGENTS.md.

solid answer

~40 s

From 2.1.277 Claude Code can read `AGENTS.md` as project instructions, but the default **Project instructions** value, `claude-md-or-agents-md`, is a fallback: Claude reads `AGENTS.md` only when there is no `CLAUDE.md`, `.claude/CLAUDE.md` or `CLAUDE.local.md` in the working directory or above it. A personal `CLAUDE.local.md` counts, so for that developer Claude switched to the CLAUDE.md files and dropped `AGENTS.md`; `~/.claude/CLAUDE.md`, the managed file and `.claude/rules/` do not count. Fix it by setting **Project instructions** in `/config` to `claude-md-and-agents-md`, which loads each directory's CLAUDE.md files and then its AGENTS.md without reading a file twice, or by putting an `@AGENTS.md` import in a CLAUDE.md, which also works in sessions that cannot read AGENTS.md directly.

go deeper

for a junior

Recall that Claude Code can read AGENTS.md as project instructions when a repository has no CLAUDE.md.

for a middle

Explain which files count for the fallback check, the four Project instructions values, and how an @AGENTS.md import differs.

for a senior

Diagnose why one developer loses AGENTS.md, name the release that added direct reading, and pick a fix that holds in every session.

for a principal

Decide whether a team keeps one shared AGENTS.md, a CLAUDE.md importing it, or both, given versions and platforms in use.

## Why Claude Code reads AGENTS.md at all Many repositories already keep agent instructions in an `AGENTS.md`, a file several coding agents share. Since **release 2.1.277**, Claude Code can read it directly as **project instructions**, so such a repository works without a CLAUDE.md, an import or a setting. Before that release the usual routes were an `@AGENTS.md` import, a symlink from CLAUDE.md, or a `SessionStart` hook that printed the file. Release 2.1.281 extended direct reading to sessions on Amazon Bedrock, Google Vertex AI, Microsoft Foundry, LLM gateways and with telemetry disabled. ## The default is a fallback, not a merge The **Project instructions** setting decides what Claude reads, and its default is `claude-md-or-agents-md`: | Your repository has | Claude reads by default | | --- | --- | | An `AGENTS.md`, and no `CLAUDE.md` or `CLAUDE.local.md` in the working directory or above | `AGENTS.md` | | An `AGENTS.md` and a `CLAUDE.md` or `CLAUDE.local.md` there | The CLAUDE.md files only | | A `CLAUDE.md` that imports `@AGENTS.md` | CLAUDE.md, with AGENTS.md included through the import | Which files count for that check is the whole story: - **Count**, so Claude reads them instead of `AGENTS.md`: a `CLAUDE.md`, `.claude/CLAUDE.md` or `CLAUDE.local.md` in the working directory or any directory above it. - **Don't count**, and keep loading alongside `AGENTS.md`: your `~/.claude/CLAUDE.md`, the organization's managed CLAUDE.md, and `.claude/rules/` files. In the scenario, a developer adds a personal, gitignored `CLAUDE.local.md`. It counts, so for that developer Claude reads the CLAUDE.md files and stops reading the team's `AGENTS.md`. Teammates without the file are unaffected, which is what makes the failure look random. ## The fixes 1. **Change the setting.** In `/config`, set **Project instructions** to `claude-md-and-agents-md`. Each directory's CLAUDE.md files load first and its `AGENTS.md` after them, and an `AGENTS.md` already loaded through an import or symlink is not read twice. The same value can live in a settings file under `pluginConfigs` for the built-in `agents-md@builtin` plugin, as `options.instructionFiles`, in user settings, a `--settings` file or managed settings; project and local settings files are ignored for it. 2. **Import it.** Put `@AGENTS.md` at the top of a CLAUDE.md next to it and add Claude-specific lines below. Claude reads the imported file first, and this works in every session, including those that cannot read AGENTS.md directly. 3. **Move the personal notes** out of `CLAUDE.local.md`, for example into `~/.claude/CLAUDE.md`, which does not count, accepting that it then applies to every project. The other two values: `claude-md` reads CLAUDE.md files only, and `managed-only` loads only the managed CLAUDE.md and auto memory at launch. ## What is and isn't read - **At session start**: every `AGENTS.md` and `.claude/AGENTS.md` in the working directory and above. An interactive session shows a line such as `no CLAUDE.md found; AGENTS.md loaded: ...`. - **In subdirectories**: a subdirectory's `AGENTS.md`, when Claude opens a file there with Read and that directory has no CLAUDE.md files of its own. - **Inside AGENTS.md**: `@path` imports expand and `claudeMdExcludes` patterns apply. - **Never read**: `AGENTS.local.md`, `AGENTS.override.md`, or anything under a `.agents/` directory. Direct reading is **unavailable** before 2.1.277, when the built-in `agents-md` plugin is disabled in `/plugin`, and in some first sessions after upgrading from 2.1.276 or earlier. In those sessions **Project instructions** does not appear in `/config` at all. ## Where AGENTS.md read through the setting differs An `AGENTS.md` that Claude reads through **Project instructions** is not a perfect stand-in for CLAUDE.md: | | `CLAUDE.md` | `AGENTS.md` read through the setting | | --- | --- | --- | | `InstructionsLoaded` hooks | Fire | Don't fire | | Directories added with `--add-dir` while `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD` is set | Their file loads | Their file doesn't load | | An `@path` import outside the working directory | Asks for approval | Loads only if already approved, with no prompt | ## Diagnosing, and the old workarounds Look for a counting CLAUDE.md file on the path, run `claude --version`, and confirm **Project instructions** is not `claude-md` or `managed-only`; `/memory` lists an AGENTS.md that Claude read directly. For setups that predate the feature: - An `@AGENTS.md` import can stay; it never causes a double read. - A CLAUDE.md that only says "read AGENTS.md" in prose relies on Claude choosing to open the file. - A `SessionStart` hook that prints AGENTS.md now adds a second copy and should be removed. - A `CLAUDE.md` symlinked to `AGENTS.md` works, but on Windows clones without `core.symlinks` Git checks it out as a one-line text file, so the import is the safer choice.

  • After upgrading Claude Code, should a team delete the CLAUDE.md that only contains @AGENTS.md?
    It can, but it does not have to. Keeping the import never makes Claude read AGENTS.md twice, whatever the Project instructions value. Remove the CLAUDE.md if it holds nothing else, and keep it if some sessions cannot read AGENTS.md directly, such as an older version or a disabled built-in plugin.
  • Why can't a repository switch the Project instructions value for every contributor through .claude/settings.json?
    Claude Code ignores that value in project and local settings files; it is honored only from `/config`, user settings, a `--settings` file or managed settings. A team that wants AGENTS.md read alongside CLAUDE.md for everyone uses an `@AGENTS.md` import in the committed CLAUDE.md instead.

  • Claude Code reads AGENTS.md alongside CLAUDE.md by default
  • A personal ~/.claude/CLAUDE.md stops the repository's AGENTS.md loading
  • AGENTS.local.md works the way CLAUDE.local.md does
  • Setting the value in .claude/settings.json changes it for the whole team
  • Claude Code has always read AGENTS.md without an import

Assumes Claude Code 2.1.286; direct AGENTS.md reading arrived in 2.1.277 and reached Bedrock, Vertex and telemetry-off sessions in 2.1.281.