Leadership1 publisher3 min readPublished
Claude Code's AGENTS.md plugin defers to any CLAUDE.md in the project path
Claude Code now supports AGENTS.md through a built-in plugin with four loading modes. The default treats the two filenames as alternatives, and the mode itself is set in user or managed settings outside the repo.
The Board Room · Leadership desk
What happened
- The claude-md-and-agents-md value loads every AGENTS.md beside CLAUDE.md up and down the tree, skipping any file CLAUDE.md already @-imports, compared by path and then by content.
- The option is read from user settings, a --settings file or managed settings, and a project's own .claude/settings.json is not read for plugin options.
- A value left under the older projectInstructions key is still honoured while instructionFiles sits at its default, with none mapping to managed-only and both to the merge mode.
Compiled by The Board RoomSomething wrong?How this is made
Why it matters
- decision The mode belongs to whoever distributes settings, so a repo owner controls which instruction file is checked in and a platform or IT group controls whether it is read.
- exposure A team's checked-in instructions sit at the organization's discretion: managed-only removes them from the context while the managed CLAUDE.md survives, with nothing changing in the repo.
- precedent Provisioning scripts that still write the old key with an unrecognised value will load no AGENTS.md, since anything outside the four legacy values falls to claude-md.
The plugin hands back a list. On `prompt.context` the engine gives a hook the instruction files behind `claudeMd`, each one as path, kind, content and an optional parent, in load order across the kinds `managed`, `user`, `project`, `local` and `memory`. The hook answers with that list changed [11]. The engine renders the answered files with its own preamble and framing and announces them by name [12]. For an agent that omits project instructions, which includes Explore, Plan and a custom agent with `omitClaudeMd`, it keeps only the managed files [12]. So an `AGENTS.md` the plugin adds as a project file is, to everything downstream, a project instruction file: same place in the context, same omission rules [13]. The default is a fallback, and it is judged across the whole project path. A project with no instruction files of its own gets its `AGENTS.md` files loaded exactly where and how `CLAUDE.md` would be [3]. "Of its own" is read off what the engine already loaded. One `CLAUDE.md`, `.claude/CLAUDE.md` or `CLAUDE.local.md` in any directory from the root down to the working directory leaves the whole project to the engine, and the plugin stays out [4]. The organization's managed file, a person's `~/.claude/CLAUDE.md`, a `.claude/rules` file and an added directory's `CLAUDE.md` all sit outside that check, because the nested walk misses them too [5]. With none of those present, every `AGENTS.md` and `.claude/AGENTS.md` on the path joins what the engine renders. A `Read` under a subdirectory attaches that directory's `AGENTS.md` unless a `CLAUDE.md` there claims it [6]. A team that wants one instruction file per repo has two routes. Delete the `CLAUDE.md` files from the root down to where people work. Or set `claude-md-and-agents-md`, which loads every `AGENTS.md` beside `CLAUDE.md` up and down the tree and skips anything `CLAUDE.md` already `@`-imports or links to, compared by path and then by content [7]. Of the four values, two load `AGENTS.md` at all [1]. `claude-md` leaves the engine reading `CLAUDE.md` as it does today [2]. `managed-only` drops the project's checked-in and private files along with the person's own, keeping the organization's managed `CLAUDE.md` and the engine's memory [8]. The choice lives in settings. The option is set in user settings at `~/.claude/settings.json`, through `--settings`, or in managed settings, and a project's `.claude/settings.json` is not read for plugin options [16]. In the app it is the `/config` row "Project instructions", a picker over the four values with each described there [15]. A repo can check in `AGENTS.md`; whether a given workstation reads it is decided by that workstation's settings or by whoever ships managed settings [16]. A person can also turn the built-in off from `/plugin`, after which the engine reads `CLAUDE.md` alone [19]. An organization's prepended plugin on `prompt.context` sits above this one and decides the files [14]. And `managed-only` removes a team's checked-in instructions from the context without anyone editing the repo [8]. The migration has one quiet failure mode. The option was first keyed `projectInstructions`, with the values `claude`, `agents-fallback`, `both` and `none` [22]. A value still stored there is honoured for now while `instructionFiles` is at its default. It maps `none` to `managed-only`, `claude` to `claude-md`, `agents-fallback` to the fallback default and `both` to the merge mode [23]. Any other value under the old key is read as `claude-md`. It adds nothing [24]. A provisioning script carrying a stale value therefore leaves `AGENTS.md` unread. The notice is one line: the first `session.start` of a load says in the transcript how the option was read [25]. Setting `instructionFiles` to anything but its default stops the old key being read, and the transcript says to remove it [26].
What to watch
- Whether plugin options ever become readable from a project's .claude/settings.json, putting the mode inside the repo.
- How long a value under the old projectInstructions key stays honoured, and what the transcript says once it stops.
- Whether the engine's nested CLAUDE.md attachments on Read become an event the plugin can act on.