DEV Community

Olivia Craft
Olivia Craft

Posted on

Your CLAUDE.md Rules Are Probabilistic: Why Claude Quietly Deprioritizes Some Instructions

The Problem Nobody Warns You About

You wrote the rule clearly. You put it in your CLAUDE.md.

Never push to production without explicit user confirmation.
Enter fullscreen mode Exit fullscreen mode

Claude read it. You can tell because it follows it most of the time. Then one session, mid-task, it pushes to production without asking.

No error. No warning. No "I know you said not to, but..."

Just: done.

This is not a bug. It is how CLAUDE.md actually works — and most developers do not know this until something breaks.


CLAUDE.md Rules Are Not Hard Constraints

Here is what the Claude Code documentation does not say loudly enough:

CLAUDE.md instructions are injected as user-turn context, not as system prompt.

This matters because:

  • User-turn context is weighted, not enforced
  • When context fills or instructions conflict, lower-priority items get deprioritized
  • Claude is balancing your rules against task completion pressure, conversation history, and other instructions
  • There is no "rule lock" — every instruction competes for attention

The result: your rules are probabilistic constraints, not deterministic ones.


Why Some Rules Survive and Others Do Not

Claude does not read your CLAUDE.md once and lock those rules in. It reads them at each turn as part of its context window. This means:

Rules that get followed reliably:

  • Short, unambiguous, repeated early in the file
  • Align with Claude's default safety behaviors
  • Do not conflict with task completion

Rules that get dropped silently:

  • Long paragraphs with conditional logic
  • Rules that appear near the end of a dense CLAUDE.md
  • Rules that conflict with each other
  • Rules that require Claude to not do something it was about to do anyway

The worst case: you have two rules that contradict each other. Claude picks one. It does not tell you which one it picked, or that it had to choose.


The Compaction Problem Makes It Worse

When your session gets long, Claude Code compacts its context window. This is a summarization — your CLAUDE.md rules get compressed into a shorter version.

Some rules survive the compression. Others do not.

And here is the critical part: Claude does not tell you when a rule was dropped from the compressed context. The next task runs with an incomplete ruleset. You will not know until the behavior breaks.


How to Write Rules That Stick

After observing how CLAUDE.md rules actually degrade in practice, here is what improves reliability:

1. Lead with critical rules
The first 20 lines of your CLAUDE.md carry more weight than the last 20. Put your safety-critical rules at the top.

2. Use imperative, single-sentence rules
Not: "When possible, try to avoid making large refactors unless you are very confident."
But: "Do not refactor existing code unless explicitly asked."

3. Mark rules with explicit weight signals

CRITICAL: Never push to production without user confirmation.
Enter fullscreen mode Exit fullscreen mode

The word "CRITICAL" acts as a salience signal. It is not a guarantee, but it helps.

4. Avoid contradictions
Audit your CLAUDE.md for rules that pull in opposite directions. Claude will resolve them silently. You want to resolve them first.

5. Keep it short
A 50-line CLAUDE.md with clear rules beats a 200-line CLAUDE.md with nuanced guidelines. Density works against you.


The Real Fix: Rules Built for Probabilistic Compliance

The mental model shift is this: you are not writing a config file. You are writing instructions for a reasoning system that has to balance your rules against everything else it knows.

That means:

  • Structure matters (order, length, specificity)
  • Conflict resolution must happen in the file, not at runtime
  • Compaction resistance requires brevity and prominence
  • Safety-critical rules need redundancy — mention them more than once

This is not a workaround. It is how high-reliability CLAUDE.md files are built.


Ready-to-Use Rules That Account for This

If you want a tested CLAUDE.md structure that accounts for probabilistic compliance, compaction survival, and instruction conflict resolution, the CLAUDE.md Rules Pack includes:

  • 40+ battle-tested rules organized by risk level
  • Safety-critical rules placed for maximum retention
  • Non-conflicting instruction sets for solo and team use
  • Rules tested against real Claude Code sessions

Get the CLAUDE.md Rules Pack — $27

Or start free: Free CLAUDE.md Starter — includes the core rules structure.


Built from watching what breaks. If you have a rule that Claude keeps ignoring, it is probably a structure problem, not a Claude problem.

Top comments (0)