claude-code - 💡(How to fix) Fix Claude Code does not enforce CLAUDE.md project instructions — regressions shipped despite explicit rules [2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#58642Fetched 2026-05-14 03:43:00
View on GitHub
Comments
2
Participants
3
Timeline
5
Reactions
0
Timeline (top)
labeled ×3commented ×2

Root Cause

  1. Claude moved a variable assignment in engine.py without tracing every reference to that variable, causing an UnboundLocalError that broke the portfolio tab for all users. The test suite passed because that module had zero test coverage — a risk Claude was aware of and did not flag before committing.
RAW_BUFFERClick to expand / collapse

I set up CLAUDE.md with explicit, non-negotiable rules to prevent regressions in my project. Claude Code read these rules at the start of every session and acknowledged them, but did not follow them during implementation. This caused two production regressions that required multiple fix cycles and wasted significant session usage.

Rules that were in place (verbatim from CLAUDE.md):

Before touching any code: Read the code path end-to-end before editing. State the impact — for every file you plan to change, say what could break and why it won't.

If a change touches more than one file: propose first, implement only after approval.

If asked to 'not break anything': treat every existing behaviour as a contract.

What happened:

  1. Claude moved a variable assignment in engine.py without tracing every reference to that variable, causing an UnboundLocalError that broke the portfolio tab for all users. The test suite passed because that module had zero test coverage — a risk Claude was aware of and did not flag before committing.

  2. Claude added a new INSERT to database.py without tracing the full call path under concurrent load. Eight screener threads were already writing to the same SQLite database. The change caused sqlite3.OperationalError: unable to open database file on every screener run.

Both failures would have been caught by the CLAUDE.md rules if followed. When asked why they weren't, Claude said 'I read it but didn't apply it' and 'best intentions aren't a system' — and offered to add more rules to the same file that was already being ignored.

What I am asking for:

  1. A mechanism for CLAUDE.md rules to be enforced mechanically — not just read and forgotten under task pressure. For example: requiring Claude to post a compliance checklist (files to change, what could break, why it won't) before any edit tool is called, and blocking the edit if the checklist is absent.

  2. A way to report SLA-equivalent breaches where explicit agreements in project instructions are not honoured. I should not need to babysit the model to get it to follow written rules I specifically put in place.

  3. Clarity on whether CLAUDE.md is intended as a binding instruction set or merely a hint — because the current behaviour treats it as the latter.

I am happy to provide session logs or the specific project files if useful.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Claude Code does not enforce CLAUDE.md project instructions — regressions shipped despite explicit rules [2 comments, 3 participants]