Your agent ignores CLAUDE.md
“why does Claude Code ignore my CLAUDE.md rules even though it read them”
Your agent reads CLAUDE.md, even quotes it back to you, then does the opposite an hour later. Instructions in a markdown file are suggestions the model can weigh away under pressure to finish. The reliable fix is fewer, sharper rules plus a hook that blocks the action when a rule is broken, so the rule is enforced, not merely written down.
Why the rules get ignored
A CLAUDE.md rule is not a switch the model must obey. It is text competing for attention against everything else in the context: your latest message, the file it is editing, the thousand tokens of code it just read. As the context fills, the standing instructions sit further from the current work and their influence decays. The rule was never disabled. It was outvoted.
This gets worse the longer a session runs, and users have documented exactly that: the same rule ignored again and again, with violations escalating as the conversation grows. Each turn adds context that dilutes the instruction, and the pull to just finish the current step is immediate while the rule is abstract and far away.
So the rule being present and even acknowledged is no guarantee it is followed. Acknowledgement is cheap; the model can restate a rule and still take the higher-probability action that breaks it a moment later.
The manual fix (free, and complete)
Two things make CLAUDE.md rules stick harder without any product: make them few and sharp, and make the agent re-read them out loud before it acts. Long rule files get diluted fast, so cut yours to the handful that matter and phrase each as a testable line, not a paragraph of preference.
## Rules (keep this list short; long files get ignored)
- Edit files in place. Never regenerate a whole file to change part of it.
- Ask before adding a dependency, a new pattern, or a new top-level folder.
- Before you write code, restate the rule that applies and confirm the plan.
- If you are about to break a rule because the task seems to need it, STOP and
ask me first. Do not decide on your own that the rule does not apply here.
## Self-check (run this before every code edit)
- Which rule above applies to what I am about to do?
- Am I about to violate it? If unsure, ask.- Cut the file down. Keep only the handful of rules that matter. Long instruction files get diluted as context fills.
- Make each rule testable. Phrase rules as checkable lines, not paragraphs of preference, so a violation is obvious.
- Force a restate-before-acting step. Have the agent name the applicable rule and confirm the plan before writing code.
- Add an explicit stop. Tell the agent to stop and ask when it thinks a rule should not apply, rather than deciding alone.
The kit's starter CLAUDE.md is exactly this shape: short, testable, and paired with hooks that check the rules at action time instead of trusting recall.
The durable fix (the kit)
The ceiling on written rules is that nothing checks them. The durable fix moves the important rules out of prose and into hooks that run on the agent's own events, so the rule is evaluated at the exact moment the agent tries to act. When the agent goes to regenerate a whole file or skip the plan step, the hook fires and blocks it, instead of trusting the model to remember an instruction that is now buried under a thousand tokens of code.
That is the difference the kit sells: hooks enforce what markdown only suggests. The rules themselves travel to Codex, Cursor, and Antigravity through AGENTS.md, so the ask-first behavior is cross-tool, while the enforcing engine runs in Claude Code only. One install, one-time price, and your agent stops treating its own instructions as optional.
The real numbers
In our first clean-room suite, five scripted tasks with the same model in both arms, the vanilla agent asked a clarifying question first on only two of five tasks, while the kit-configured agent asked on all five. Following the ask-first rule is the single clearest behavioral gap in the data, and it is exactly the rule that gets ignored when it lives only in markdown.
The honest caveat: enforcement is not free. The hook context that makes rules stick added about a 25 percent average cost premium across the suite, and on already-clear tasks that overhead buys you nothing. You are paying for reliability on the tasks where a missed rule is expensive, not for a free lunch.
| Behavior | Vanilla agent | Kit-configured |
|---|---|---|
| Followed ask-first before coding | 2 of 5 tasks | 5 of 5 tasks |
| Code for the same outcome | baseline | about 40% less |
| Cost of the enforcement context | none | about +25% average |
Directional, n=1 per task. The cost row is the price of making the rule reliable.
It is in Anthropic's own tracker
Ignored instructions are one of the most reported behaviors in the Claude Code tracker, including the one page here that is still open.
- #2901closed2025-07-03The most-upvoted report of the pattern: Claude Code creates deprecated legacy methods instead of editing in place, over-engineers, and ignores single-source-of-truth rules that are written plainly in CLAUDE.md. Closed as not planned with 20+ thumbs-up still on it.
- #33603open2026-03-12Still open. Hard rules in CLAUDE.md and MEMORY.md are consistently ignored, and the violations escalate with each session. The report documents four consecutive violations of rules the agent had already read.
- #40541closed2026-03-29CLAUDE.md scope and context-boundary rules ignored after being corrected five or more times in a single conversation. The reporter's summary: the agent prioritizes completing the task quickly over checking constraints before it acts.
The through-line across these reports is that a rule being present, and even acknowledged, does not make it followed. That is precisely the gap a hook closes.
Common questions
Why does Claude Code ignore my CLAUDE.md?
Because the file is text competing for attention, not an enforced rule. As the session fills with code and messages, the standing instructions sit further from the current work and their influence decays, so the model takes the higher-probability action that breaks the rule. Shorter, sharper rules help; a hook that checks the rule at action time is what makes it reliable.
Does making CLAUDE.md longer help?
Usually the opposite. A long file dilutes the few rules that matter and gives the model more to weigh away. Cut it to a short list of testable lines, put the most important ones first, and have the agent restate the applicable rule before it acts. Length is not adherence.
AGENTS.md or CLAUDE.md, which should I use?
Use both, with one source of truth. Claude Code reads CLAUDE.md; most other tools read AGENTS.md. Keep the rules in AGENTS.md so they travel to Codex, Cursor, and Antigravity, and let Claude Code pick them up too. The kit writes both from the same source.
Do hooks work in tools other than Claude Code?
No. The stateful engine, hooks included, runs in Claude Code only. What is cross-tool is the written rule itself, which travels through AGENTS.md. So other tools get the ask-first behavior from the rules, and Claude Code additionally gets the enforcement that makes those rules un-skippable.

Make your agent ask before it builds
One kit. Ask-first behavior, lean output, no AI slop. Works with Claude Code, Codex, and Antigravity.
Get the kit · $29One-time. Less than one hour of cleaning up AI slop.