Why Claude Code ignores your AGENTS.md (and how to fix it)
Claude Code reads CLAUDE.md first and only falls back to AGENTS.md when no CLAUDE.md exists. If you have both, add one import line so Claude Code reads the shared instructions.
Updated 2026-10-27
A common setup: the team writes careful instructions in AGENTS.md for Codex and Cursor, and someone adds a short CLAUDE.md for Claude Code. From then on, Claude Code reads the CLAUDE.md and never sees AGENTS.md. Nothing errors; the agent simply follows a different, usually thinner, set of instructions.
What Claude Code loads at the repository root
- CLAUDE.md, .claude/CLAUDE.md and CLAUDE.local.md, from the working directory upwards.
- Files those import with @path, up to 4 hops deep.
- .claude/rules/*.md without a paths filter (rules with paths load only for matching files).
- AGENTS.md only when no CLAUDE.md exists, and only on Claude Code v2.1.277 or later. Earlier versions read CLAUDE.md only.
Taken from Claude Code’s memory documentation as checked on 2026-10-03. Startup loading of CLAUDE.md is verified against the real tool; the AGENTS.md fallback is modelled from the documentation.
The fix: one line
Keep the shared instructions in AGENTS.md and make CLAUDE.md import it. Claude-specific notes, if you have any, go under the import.
# CLAUDE.md
@AGENTS.md
# Claude Code-only notes go here.How to tell whether you are affected
Run a scan. The map at the end lists the files each agent loads at session start, and marks any agent that does not see AGENTS.md.
npx threadctx scanWhat each agent loads at session start
Codex / AGENTS.md AGENTS.md ≈47 tokens
Claude Code CLAUDE.md ≈19 tokens does not see AGENTS.mdthreadctx fix does not rewrite instruction text for you; adding the import is a one-line change you make and review.