Claude context
Claude can load persistent instructions from organization policy, the user configuration directory,
ancestor and project CLAUDE.md or .claude/CLAUDE.md, CLAUDE.local.md, and AGENTS.md. The user
directory is ~/.claude unless CLAUDE_CONFIG_DIR changes it. Descendant instruction files load when
Claude works in their subtree.
AGENTS.md
Claude Code 2.1.277 and later read AGENTS.md and .claude/AGENTS.md directly, as project files
in the launch directory and above it. Claude has no user-level AGENTS.md: ~/.claude/AGENTS.md
loads only as an ancestor .claude/AGENTS.md for launches under home, under the rule below, and then
beside ~/.claude/CLAUDE.md. mdmanager refuses it as a Global target. By default Claude
reads project AGENTS.md files only when no unexcluded CLAUDE.md, .claude/CLAUDE.md, or CLAUDE.local.md exists in
the launch directory or above it; the user and managed CLAUDE.md and .claude/rules/ do not count. Any one of
those files turns off every AGENTS.md: mdmanager context shows the launch-path files as
not selected and omits subfolder files. Otherwise a subfolder AGENTS.md loads on demand unless
that subfolder has its own unexcluded CLAUDE file. An AGENTS.md that a startup CLAUDE.md imports or
symlinks to loads once, through that file; a subfolder CLAUDE.md that imports it does not stop it
loading at startup. The exception is a user CLAUDE.md that is itself a symlink resolving to the same file
as an AGENTS.md that also loads as a project file, such as ~/.claude/AGENTS.md for a launch under
home: Claude loads that text twice, and mdmanager context lists both files and warns. Claude never reads AGENTS.override.md,
AGENTS.local.md, or anything under .agents/.
The Project instructions setting changes this: claude-md-and-agents-md loads both,
claude-md loads CLAUDE.md only, and managed-only loads only the managed CLAUDE.md at launch.
mdmanager reads it from pluginConfigs["cc-plugin-agents-md@builtin"].options.instructionFiles in
user or managed settings files, and treats "cc-plugin-agents-md@builtin": false under
enabledPlugins as claude-md when it is the highest-precedence entry. It also reads the old
agents-md@builtin ID in both settings, preferring the new ID when both occur in one file. Claude
Code 2.1.285 and later accept either ID. mdmanager does not see MDM or server-managed policy,
--settings files, or the Claude Code version; on older versions, or in the first session after
upgrading, Claude reads CLAUDE.md files only.
mdmanager reports a managed claudeMd without showing its text and does not model Claude keeping
.claude/settings.local.json in the launch directory when the repository root, its .git, or its
.claude is not owned by the user.
Project and user .claude/rules/**/*.md files are also instructions. Rules without paths YAML
frontmatter load generally. Rules with paths load when Claude works with matching files. Symlinked
rule files and directories are followed. mdmanager shows rules but does not compose or rewrite them.
CLAUDE.md can reference another Markdown file with @path/to/file.md. mdmanager lists direct
Markdown imports beneath the parent source but does not own the imported file. Prefer mdmanager
Sections when mdmanager owns the target; preserve imports in external files unless the user asks to
change them.
mdmanager models complete --- frontmatter headers and simple inline or block lists, not general
YAML. A leading --- without a closing delimiter is reported as ambiguous; close the header
before relying on the reported loading behavior.
Duplicate instructions
Context warns when Claude loads the same instructions twice at startup; see
duplicate instructions for what counts. The common case is a
copy of ~/.claude/CLAUDE.md at ~/.claude/AGENTS.md: for a launch under home, Claude loads both.
An imported file counts once on its own, so a CLAUDE.md holding only @AGENTS.md is never a
duplicate of that AGENTS.md, and rule frontmatter does not count. Each warning names a fix that
fits its files: remove the extra file, exclude one with claudeMdExcludes in
.claude/settings.local.json, or, for an AGENTS.md and CLAUDE.md in one folder, replace the
copy in CLAUDE.md with an @AGENTS.md line. For shared Sections or paragraphs, compose or keep
them in only one file.
Disable a rule for this repository
To disable a shared Claude rule only on this machine, the user's coding agent should:
- Add the rule's exact absolute path to
claudeMdExcludesin.claude/settings.local.jsonat the repository root; in a linked worktree, use the main checkout's root. - Preserve every existing setting and exclusion.
- Do not rename, blank, or edit the shared rule file.
- Run
mdmanager context --runtime claudeand verify that the rule isexcludedand the reason names the settings file.
The same steps disable a shared AGENTS.md that Claude reads directly. Claude matches
claudeMdExcludes patterns against absolute file paths. A bare relative name such
as CLAUDE.md does not match a project file. Patterns for symlinked CLAUDE.md, CLAUDE.local.md,
and AGENTS.md match the link path; only rules also match their resolved target.
claudeMdExcludes, which mdmanager local disable claude also writes, hides a file from Claude
only: if Grok loads the file, it still does. To hide it from Grok too, see
Grok.
The same setting can exclude an inherited CLAUDE.md. Remove only an exclusion the user asked the
agent to remove; broader globs may come from another settings layer. mdmanager merges exclusions
from user settings, the managed settings file and drop-ins, the local settings file, and the
.claude/settings.json in the launch directory. A .claude/settings.json in a parent directory
does not apply, so start in the directory that holds it.
Local Instructions
CLAUDE.local.md adds to CLAUDE.md: Claude reads it after CLAUDE.md at that directory level.
It is also a CLAUDE file, so in a repository that relies on AGENTS.md it stops Claude reading
AGENTS.md under the default Project instructions setting. mdmanager local apply claude and
mdmanager project apply warn before writing a Claude file that would displace a loaded AGENTS.md,
including when replacing a Claude file removes its import. Imports are followed up to four hops.
A Project CLAUDE.md rendered beside a managed agents target always starts with @AGENTS.md, so it
keeps that file even before it exists. Elsewhere, add an @AGENTS.md import in the Claude file, or set
Project instructions to claude-md-and-agents-md in /config to keep both. Use
mdmanager local create claude SECTION, mdmanager local adopt claude SECTION,
mdmanager local render claude, and mdmanager local apply claude --yes to manage it. The Local
composition references Personal Sections from ~/.mdmanager/sections/; do not include the same
content as CLAUDE.md, which would load those instructions twice.
Claude system-prompt injection, memory, skills, hooks, commands, agents, and output styles are
outside mdmanager's scope. Grok runs the hooks in Claude's settings.json files, so
mdmanager context --runtime grok reports them; see mdmanager docs grok.