Home/Guides/CLAUDE.md, AGENTS.md, .cursor/rules: wh…
Guide · 6 min read

CLAUDE.md, AGENTS.md, .cursor/rules: where each coding agent reads its instructions, and why it ignores them

Your agent is not ignoring you. It is reading the wrong file, or the right file is too long, or the rule has no reason.

Quick answer

Coding agents read two layers: a root file at the start of every session (CLAUDE.md for Claude Code, AGENTS.md for most others) and on-demand instructions such as skills or Cursor rules, loaded when their description matches the task. Rules get ignored when the root file is too long, a rule has no reason, or it contradicts the code; keep…

You wrote a careful CLAUDE.md. Forty lines of hard-won rules. The agent read it, said it understood, and then did the exact thing line twelve told it not to do.

Usually the agent is not ignoring you. One of three things happened: the file was in a place it does not read, the rule was buried in a document too long to hold its attention, or the rule had no reason attached and lost to a stronger pattern in the code it was looking at. All three are fixable, and the fix starts with knowing where each agent actually looks.

Where each coding agent reads its instructions

AgentRoot fileOn-demand instructions
Claude CodeCLAUDE.md in the repository (plus ~/.claude/CLAUDE.md for your personal rules)Skills in .claude/skills/<name>/SKILL.md; subagents in .claude/agents/
CodexAGENTS.mdSkills in .agents/skills/<name>/SKILL.md
Muse CodeAGENTS.md (it also reads CLAUDE.md), walking up to the repository rootSkills in .agents/skills/
OpenCodeAGENTS.mdSkills in .opencode/skills/; agents in .opencode/agents/
CursorAGENTS.mdRules in .cursor/rules/*.mdc, each with a description, file globs, or "always apply"
HermesAGENTS.mdSkills in ~/.hermes/skills/ (your home directory, not the repository)

The pattern across all of them is the same two layers. A root file is read at the start of every session. On-demand instructions (skills, rules, subagents) are only loaded when their one-line description matches what the agent is doing. Tools keep adding layers and changing paths, so treat the table as a starting point and check your agent's documentation when something seems not to load.

Why rules in the root file get ignored

It is too long

Everything in the root file competes for attention with everything else in the session: the task, the files open, the conversation so far. A 400-line root file is not "more instructions". It is the same instructions diluted. Keep it short: what the repository is, the five to eight rules that matter most, and a pointer to the skill that holds the rest.

The rule has no reason

"Keep pull requests small" loses to the agent's instinct to finish the job properly. "Half of the last 400 commits touched two files or fewer; a larger change should say why" survives, because it is specific and it carries its own justification. Agents, like people, are much better at following a rule when they can see why it exists.

The rule contradicts the code

If the root file says "every change has a test" and the agent is looking at a directory where nothing has a test, the code wins. Agents imitate what they see. Rules written from what the team actually does, rather than what it aspires to, do not have this problem, because the evidence and the instruction agree.

A layout that works

That layout keeps the always-on cost tiny and puts the detail where the agent will find it at the moment it matters.

Skip the writing

The hard part is not the layout. It is knowing which rules your team actually follows, with numbers you trust. Loreto reads them from your git history and writes exactly this layout for whichever agent you use, in the paths from the table above. Reading your repository and seeing every file it would write is free; the harness installs with one line and merges into your existing root file instead of replacing it.

Frequently asked questions

Can I use the same file for every agent?
Mostly. AGENTS.md is read by Codex, Muse Code, OpenCode, Cursor and Hermes, and Claude Code reads CLAUDE.md. Skills and rules live in different folders per agent, so a harness for several agents means the same content laid out in each agent's paths.
How long should a root file be?
Short enough to read in a minute: what the repository is, the five to eight rules that matter most, the build and test commands, and a pointer to the skill. Under 60 lines is a good ceiling; the detail belongs in files loaded on demand.
Why does a skill's description matter so much?
It is how the agent decides whether to load the skill at all. One line that says what the skill knows and when to use it, for example before changing or reviewing code here, is the difference between a skill that loads every time it should and one that never does.

Get this layout written from your history

Paste a repository, pick your agent, and see every file Loreto would write, in the right paths, before you pay.