MemoryRouter
Fix

CLAUDE.md is not being followed

You wrote the rule, the file is in the repository, and the session keeps breaking it. Nine times out of ten it is one of four mechanical problems, and all four have fixes.

Sources checked 2026-09-25.

Why instructions get ignored

Loaded once, needed later. CLAUDE.md enters context at session start. In a long session, the window fills and the file falls out or gets summarized away. The rule did not stop being true; it stopped being present.

Too big to matter. A 400-line instruction file competes with everything else in the window. Rules buried in the middle get less attention than rules stated at the top.

Conflicting sources. Project, user, and imported files can disagree. When they do, the model picks, and it may not pick the one you meant.

Nothing reinforces it. Instructions are static. A session that violates a rule gets no correction signal from the file, so the violation continues.

Free fixes you can do today

These work today, with no new tools.

  1. 1

    Cut the file to what changes behavior

    Commands, conventions, hard constraints. Move history and explanation out. Ten sharp lines beat a hundred reasonable ones.

  2. 2

    Use imports instead of inlining

    Keep CLAUDE.md as an index that imports focused files, so only relevant guidance is pulled in.

  3. 3

    Restate the critical rule where it applies

    A pre-commit hook, a lint rule, or a test enforces a convention better than a sentence in a markdown file. If it can be a check, make it a check.

  4. 4

    Re-anchor after compaction

    Expect instructions to weaken after a compaction, and say "re-read CLAUDE.md before continuing" once instead of arguing with the session.

The durable fix

The structural fix is to make memory do what files cannot: carry decisions in a form that gets re-injected at the moments instructions fall out.

MemoryRouter recalls relevant memory on every prompt and re-injects project context right after compaction finishes, so the rule about your test setup comes back even when the session summary forgot it.

  1. 1

    Install the hooks

    One command

    npx -y memoryrouter-claude init
  2. 2

    Store the rules that keep getting broken

    Save each as a memory with the reason attached. Reasons survive; bare commands get ignored.

  3. 3

    Test it after a compaction

    Force a compaction and check whether the rule is still respected. That is the exact scenario the file alone cannot cover.

Full setup guide: Claude Code setup guide

Install for Claude Code

Install, scopes, and removal on the Claude Code page. 14-day free trial.

Related

FAQ

Sources

Sources checked 2026-09-25. Tool behavior changes; check the vendor docs before relying on a detail.

Start free