Claude Code does not enforce CLAUDE.md project instructions — regressions shipped despite explicit rules
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:
- Claude moved a variable assignment in
engine.pywithout tracing every reference to that variable, causing anUnboundLocalErrorthat 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.
- Claude added a new
INSERTtodatabase.pywithout tracing the full call path under concurrent load. Eight screener threads were already writing to the same SQLite database. The change causedsqlite3.OperationalError: unable to open database fileon 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:
- 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.
- 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.
- 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.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗