Claude duplicates existing rules in CLAUDE.md instead of complying with them

Resolved 💬 2 comments Opened May 23, 2026 by metilluyoc Closed Jun 24, 2026

Preflight Checklist

  • [x] I have searched existing issues for similar behavior reports
  • [x] This report does NOT contain sensitive information (API keys, passwords, etc.)

Type of Behavior Issue

Claude ignored my instructions or configuration

What You Asked Claude to Do

Maintain a long-lived CLAUDE.md (project instructions file, ~1000 lines) for a
production Flask/Python project. The file contains numbered persistent rules
that Claude is supposed to read on every session.
When I correct Claude for breaking a rule, I expect Claude to (1) locate the
existing rule, (2) acknowledge it was broken, (3) apply it going forward.

What Claude Actually Did

When corrected, Claude added a NEW rule (often labeled as a "sub-rule") that
restated the existing rule with more words, instead of searching the file
first.
Concrete example from this session:

  • CLAUDE.md already had Rule 4: "Versions are odd by default AND decided by

Javi" (line 54).

  • I broke it by proposing "v0.16.1 for P5" without being asked.
  • I corrected Claude: "versions are decided by me, not you."
  • Claude added "Sub-rule 4.bis — Versions are decided by Javi" inside Rule 4,

AND a standalone "Rule 23 — Versions are decided by Javi, not me", both
saying the same thing as the existing Rule 4.

  • I had to explicitly ask Claude to search for the prior rule. It found it,

confirmed the duplication, deleted both additions.

  • Net effect on the file: zero changes after wasted edits.

Same pattern happened minutes later: I asked Claude to look for rules about
branches and versions before adding anything. It correctly listed the existing
rules — proving it COULD find them. The problem was it didn't look by default.

Expected Behavior

On user correction "we already had a rule about this":

  1. Grep CLAUDE.md (or equivalent instructions file) for semantically similar

rules BEFORE editing.

  1. If found: acknowledge non-compliance, do NOT add a new rule, just commit

to applying the existing one.

  1. If not found: propose the new rule for user approval before writing.

More generally: when adding to a persistent instructions file, default to
"check for duplicates first" rather than "append".

Files Affected

Permission Mode

Accept Edits was ON (auto-accepting changes)

Can You Reproduce This?

Yes, every time with the same prompt

Steps to Reproduce

  1. Have a CLAUDE.md with ~20 numbered rules.
  2. Break one of those rules (e.g., propose an action the rule forbids).
  3. When the user corrects you, observe whether Claude:

(a) searches CLAUDE.md for the existing rule and applies it, or
(b) appends a new rule with similar wording.

In my experience across multiple sessions on the same project, behavior (b)
is the default.

Claude Model

Sonnet

Relevant Conversation

Recurring. Observed multiple times across sessions in the same project.
When corrected, Claude added a NEW rule (often labeled as a "sub-rule") that
restated the existing rule with more words, instead of searching the file
first.
Concrete example from this session:
- CLAUDE.md already had Rule 4: "Versions are odd by default AND decided by
  Javi" (line 54).
- I broke it by proposing "v0.16.1 for P5" without being asked.
- I corrected Claude: "versions are decided by me, not you."
- Claude added "Sub-rule 4.bis — Versions are decided by Javi" inside Rule 4,
  AND a standalone "Rule 23 — Versions are decided by Javi, not me", both
  saying the same thing as the existing Rule 4.
- I had to explicitly ask Claude to search for the prior rule. It found it,
  confirmed the duplication, deleted both additions.
- Net effect on the file: zero changes after wasted edits.
Same pattern happened minutes later: I asked Claude to look for rules about
branches and versions before adding anything. It correctly listed the existing
rules — proving it COULD find them. The problem was it didn't look by default.

Impact

Critical - Data loss or corrupted project

Claude Code Version

Claude Code, model: Claude Sonnet (4.5/4.6 over recent months). OS: Windows 11. Project: long-lived Python/Flask repo, CLAUDE.md ~1000 lines, ~20 numbered persistent rules.

Platform

Anthropic API

Additional Context

Suggestion that would help: when Claude is about to add content to a
designated "rules" / "instructions" / "memory" file, run an internal
semantic-similarity check against existing content first. If similarity > N,
prefer to acknowledge the existing entry rather than append.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗