Why is my coding agent ignoring AGENTS.md?
Usually one of four things: the agent doesn't read AGENTS.md without a setting (Gemini CLI, Aider); another file outranks it (a CLAUDE.md in Claude Code, an AGENTS.override.md in Codex or Pi); it sits outside the directories the agent searches; or it's past the agent's size cap (Codex 32 KiB combined, Devin 16 KiB per file). Ask the agent what it loaded before you rewrite the file.
By Himanshu Singh · Updated · How we score →
Which files does each coding agent read, and does AGENTS.md need a setting?
Each line below comes from the agent's own docs, linked beside it, read in November 2026. Where the docs don't say, neither do we.
| Agent | What it reads, and which wins | Setting needed for AGENTS.md? |
|---|---|---|
| Claude Code | CLAUDE.md, .claude/CLAUDE.md and CLAUDE.local.md in the working directory and every directory above it. AGENTS.md and .claude/AGENTS.md the same way (v2.1.277 and later), but only when none of those CLAUDE.md files exist. ~/.claude/CLAUDE.md doesn't count. A subdirectory's file loads once Claude reads a file there (docs (new tab)). | No setting by default. A CLAUDE.md or CLAUDE.local.md on the path hides AGENTS.md unless it imports @AGENTS.md or Project instructions in /config is claude-md-and-agents-md (docs (new tab)). |
| Cursor | AGENTS.md at the project root and in subdirectories, combined, the more specific winning (docs (new tab)). CLAUDE.md the same way, always applied (help (new tab)). Rules are .mdc files in .cursor/rules/. The CLI reads a root AGENTS.md and CLAUDE.md (CLI docs (new tab)). | Not for AGENTS.md. A plain .md in .cursor/rules/ is ignored; an Apply Intelligently rule needs a description, and Apply to Specific Files needs globs that match (docs (new tab)). |
| Devin | Looks for AGENTS.md before it starts coding, in the project root "or anywhere else" (docs (new tab)); which of several wins isn't documented. Pulls CLAUDE.md, .cursorrules, .mdc, .rules and .windsurf files into its Knowledge, which is deprecated and moving to Skills in Plugins (docs (new tab)). Devin CLI loads root files at session start and subdirectory files when it reaches them (CLI docs (new tab)). | No, but Devin must have access to the repo. Knowledge that isn't pinned is used only when its trigger matches (docs (new tab)). |
| Codex | ~/.codex/AGENTS.override.md or AGENTS.md, then one file per directory from the project root (usually the Git root) down to the working directory: AGENTS.override.md, else AGENTS.md, else a name in project_doc_fallback_filenames. Joined root first, so closer files win; nothing below the working directory is read (docs (new tab)). | No. CLAUDE.md is read only if you list it in project_doc_fallback_filenames in ~/.codex/config.toml (docs (new tab)). |
| Kimi Code CLI | A project AGENTS.md or .kimi-code/AGENTS.md, plus the global ~/.kimi-code/AGENTS.md (it moves with KIMI_CODE_HOME) and ~/.agents/AGENTS.md. Injected into the prompt as reference data (docs (new tab)). Subdirectories, precedence and CLAUDE.md aren't documented. | No (docs (new tab)). |
| Gemini CLI | ~/.gemini/GEMINI.md, then GEMINI.md in the workspace directories and their parents. When a tool touches a file, that directory and its ancestors up to a trusted root (docs (new tab)). For unpaid and Google One users, Antigravity CLI replaced it on June 18, 2026 (docs (new tab)); that reads GEMINI.md and AGENTS.md in the active directory (migration (new tab)). | Yes. AGENTS.md loads only when named in the context.fileName setting; the docs' example is ["AGENTS.md", "CONTEXT.md", "GEMINI.md"] (docs (new tab)). |
| Aider | Nothing on its own. A file loads when passed with --read, with /read in chat, or listed under read: in .aider.conf.yml (docs (new tab)). The docs don't mention AGENTS.md by name. | Yes: read: AGENTS.md, or a list. .aider.conf.yml is read from the home directory, the Git root and the current directory, and the file loaded last takes priority; --config <file> loads only that one (docs (new tab)). |
| OpenHands | A root AGENTS.md, in full, in the initial system prompt; CLAUDE.md and GEMINI.md count as model-specific repository context (docs (new tab)). Nested files and precedence aren't documented. Runs .openhands/setup.sh each time it begins work on the repo (docs (new tab)). | No (docs (new tab)). |
| Pi | The agent directory (~/.pi/agent), the working directory and each directory above it (docs (new tab)). In each, the first of AGENTS.override.md, AGENTS.md, AGENTS.MD, CLAUDE.md and CLAUDE.MD, so an empty AGENTS.md still hides a CLAUDE.md beside it (loader (new tab)). Nothing below the working directory. | No, and no project trust (docs (new tab)). --no-context-files (-nc) turns them off (CLI (new tab)). |
How do I fix an agent that ignores AGENTS.md?
- Check the agent reads AGENTS.md at all. Gemini CLI needs it in
context.fileName; Aider needs it underread:in.aider.conf.yml. - Check the name and place:
AGENTS.md, upper case, at the repo root. A Cursor rule must be an.mdcfile in.cursor/rules/. - Look for a file that outranks it: a CLAUDE.md or CLAUDE.local.md on the path (Claude Code), an AGENTS.override.md (Codex, Pi), an empty AGENTS.md beside the CLAUDE.md you meant (Pi).
- Start the agent where it searches. Codex and Pi read only from the root down to the working directory, so a package's file loads only when you start inside that package.
- Check the size: Codex stops at 32 KiB across the path, Devin reads the first 16 KiB of each file.
- Start a new session after editing, or reload: Codex rebuilds its instructions only at launch.
- Ask the agent what loaded, using the commands below.
How do I check which instruction files an agent loaded?
| Agent | How to check | After editing mid-session |
|---|---|---|
| Claude Code | /memory lists an AGENTS.md it read (v2.1.280 and later); /context all lists launch files under Memory files. An interactive session prints no CLAUDE.md found; AGENTS.md loaded: … (docs (new tab)). | Root CLAUDE.md is re-read after /compact. After upgrading from v2.1.276 or earlier, AGENTS.md may load only from the next session (docs (new tab)). |
| Cursor | Customize lists every rule and its status; the docs describe no per-chat view of what applied. Rules apply to Agent (Chat), not Tab or Bugbot (help (new tab)). | Not documented. |
| Devin | Knowledge it used is listed under Accessed Knowledge in the session chat (docs (new tab)). The docs don't say how to confirm it read AGENTS.md. | Not documented. |
| Codex | codex --ask-for-approval never "Summarize the current instructions.", or write a log with -c log_dir=./.codex-log (docs (new tab)). | Builds the instruction chain once per run. Restart Codex in the target directory; there's no cache to clear (docs (new tab)). |
| Kimi Code CLI | Not documented. /init writes an AGENTS.md from the codebase (commands (new tab)). | /reload reloads the session and tells the agent about external AGENTS.md changes (commands (new tab)). |
| Gemini CLI | The footer shows how many context files loaded; /memory show prints their combined text (docs (new tab)). | /memory reload re-scans every context file (docs (new tab)). |
| Aider | The docs' example session shows Added CONVENTIONS.md to the chat. at startup (docs (new tab)). | /read AGENTS.md adds it to the running chat (docs (new tab)). |
| OpenHands | Not documented. | Not documented. |
| Pi | Not documented. | /reload after changing instructions (docs (new tab)). |
Where no command is documented, ask the agent to summarize its project instructions. That tests what reached the model, though not which file it came from.
Why does Claude Code ignore AGENTS.md when there's a CLAUDE.md?
By default Claude Code reads AGENTS.md only when no CLAUDE.md, .claude/CLAUDE.md or CLAUDE.local.md exists in the working directory or above it. Its docs call this the usual cause of an AGENTS.md that isn't loading (docs (new tab)).
92 of the 388 GitHub repos in our 2026-11-16 census have both a root AGENTS.md and a root CLAUDE.md. In 18 of them the CLAUDE.md is a separate file that neither symlinks to nor imports AGENTS.md, so Claude Code sees only the CLAUDE.md there. 39 repos import @AGENTS.md and 28 symlink CLAUDE.md to it.
- A CLAUDE.md that says "read AGENTS.md" in words isn't an import: Claude sees AGENTS.md only if it decides to open it. Write
@AGENTS.mdinstead (docs (new tab)). - A CLAUDE.local.md counts as a CLAUDE.md, so adding one for your own notes hides the team's AGENTS.md from you.
- Or set Project instructions in
/configtoclaude-md-and-agents-md, which loads both and skips an AGENTS.md already imported (docs (new tab)). - Claude Code before v2.1.277, or a session where the built-in AGENTS.md plugin is disabled, reads CLAUDE.md only; the Project instructions setting is then missing from
/config(docs (new tab)).
Is there a size limit on AGENTS.md?
| Agent | Limit |
|---|---|
| Claude Code | Skips a file over 4 MiB. Files that load on demand (subdirectory CLAUDE.md, path-scoped rules) are cut at 40,000 characters on a 200K context window. Guidance: under 200 lines per file (docs (new tab)). |
| Cursor | None documented. Guidance: keep each rule under 500 lines (docs (new tab)). |
| Devin | The first 16 KiB (16,384 bytes) of each AGENTS.md; the rest only if Devin opens the file (docs (new tab)). |
| Codex | 32 KiB across every file on the path (project_doc_max_bytes); Codex stops adding files at the cap. Empty files are skipped (docs (new tab)). |
| Kimi Code CLI | Not documented. |
| Gemini CLI | None on the GEMINI.md page (docs (new tab)). |
| Aider | Not documented. |
| OpenHands | None documented; the docs say to keep AGENTS.md short and move long material into skills (docs (new tab)). |
| Pi | Not documented. |
A file cut off at a cap fails quietly: the agent follows the top and never sees the rest. Put the commands and the never-do rules first.
Do symlinked AGENTS.md or CLAUDE.md files work?
Claude Code reads CLAUDE.md through a symlink, but its Edit and Write tools refuse to write through one and edit the target instead. On Windows, Git checks a committed symlink out as a one-line text file unless core.symlinks is on, which is why Anthropic suggests the @AGENTS.md import for teams with Windows users (docs (new tab)). It doesn't follow a link to a network path such as \\server\share (docs (new tab)).
The other agents' docs don't cover symlinks. Pi's loader accepts a link that resolves to a regular file. If you rely on a link, check it on each OS your contributors use, or use the one-file setup that suits your agents.
Does the AGENTS.md filename have to be upper case?
Name it exactly AGENTS.md. Every agent's docs use that spelling, and none of the docs linked here promises to find agents.md. Pi's loader looks for AGENTS.md and AGENTS.MD only, so on Linux, where file names are case-sensitive, a lowercase file is skipped. Our AGENTS.md check matches any case, so a passing score doesn't prove every agent finds the file.
Why isn't the AGENTS.md in my package loading?
Agents find nested files differently: Codex and Pi read only the directories on the path to where you started, Claude Code loads a subdirectory's file once it reads a file there, Cursor combines them all, Devin CLI loads one once it reaches that directory, and Kimi Code and OpenHands don't document it. The monorepo guide covers each agent and what to put at the root.
AGENTS.md loaded but the agent still doesn't follow it?
Then it's the wording, not the loading. Claude Code delivers CLAUDE.md as a user message after the system prompt, with no guarantee of strict compliance; Anthropic's fixes are concrete instructions, no conflicts between files, and a hook for anything that must run every time (docs (new tab)). The same advice holds for any agent: "Run pnpm test before committing" is followed more often than "test your changes".
Questions people ask
- Does Claude Code read AGENTS.md?
- Yes, from v2.1.277, but only when there's no CLAUDE.md,
.claude/CLAUDE.mdor CLAUDE.local.md in the working directory or above it. Import@AGENTS.mdfrom your CLAUDE.md to load both. - Does Gemini CLI read AGENTS.md?
- Only when it's listed in the
context.fileNamesetting; by default it reads GEMINI.md. Antigravity CLI, which replaced it for unpaid and Google One users on June 18, 2026, reads both. - Does Aider read AGENTS.md?
- Not on its own. List it under
read:in.aider.conf.yml, pass--read AGENTS.md, or run/read AGENTS.mdin the chat. - Why does Codex skip the AGENTS.md in my package?
- Codex reads one file per directory from the project root down to where you started it, and nothing below. Start Codex inside the package, and keep the files on that path under 32 KiB combined.
- Do I need to restart the agent after editing AGENTS.md?
- For Codex, yes: it builds its instructions once per run. Gemini CLI has
/memory reload, Kimi Code CLI and Pi have/reload. The other agents' docs don't say, so start a new session to be sure. - Is AGENTS.md case-sensitive?
- Treat it as such. Every agent documents the name
AGENTS.md, and Pi looks only forAGENTS.mdandAGENTS.MD, so a lowercaseagents.mdis skipped on Linux.
From the docs: code.claude.com/memory (new tab) · learn.chatgpt.com/agents-md (new tab) · cursor.com/docs/rules (new tab) · cursor.com/customization/rules (new tab) · cursor.com/using (new tab) · docs.devin.ai/agents-md (new tab) · docs.devin.ai/knowledge-onboarding (new tab) · docs.devin.ai/rules (new tab) · docs.devin.ai/git-backed-blueprints (new tab) · github.com/agents.md (new tab) · github.com/slash-commands.md (new tab) · geminicli.com/gemini-md (new tab) · antigravity.google/gcli-migration (new tab) · aider.chat/conventions.html (new tab) · aider.chat/aider_conf.html (new tab) · aider.chat/lint-test.html (new tab) · docs.openhands.dev/skills (new tab) · docs.openhands.dev/repository (new tab) · github.com/configuration.md (new tab) · github.com/resource-loader.ts (new tab) · github.com/args.ts (new tab)
AGENTS.md in a monorepo · One file for every agent · CLAUDE.md guide · CLAUDE.md vs AGENTS.md · Check your AGENTS.md · All guides