Claude Code repeatedly violates user-defined rules in CLAUDE.md despite acknowledging them
Despite continually trying to add more rules to get Claude Code to work properly again. It just keeps failing over and over.
Summary
Claude Code (Opus 4 model) systematically fails to follow explicitly defined rules in the project's CLAUDE.md file, even after acknowledging and adding new rules. This creates significant productivity issues and user frustration.
Environment
- Claude Code Version: [Current version]
- Model: Claude Opus 4 (claude-opus-4-20250514)
- Date: August 2025
- Project Type: Software development project
Steps to Reproduce
- Define explicit rules in CLAUDE.md file
- Have Claude Code acknowledge the rules
- Watch as Claude Code violates the rules during normal operation
- Add new rules about following rules
- Observe continued violations
Actual Behavior
- When one MCP tool failed, immediately jumped to web search instead of trying alternative MCP tools as required by rules
- Continued making multiple attempts without user approval
- Made 3+ attempts to fix the same error without stopping for research
- No pre-action checking of applicable rules before executing commands
Expected Behavior
- Should check relevant rules before EVERY action
- Should stop and request approval as required by rules
- Should use all specified MCP tools before falling back to alternatives
- Should maintain rule compliance throughout the entire session
Specific Rules Violated
Rule #2: "NO WORKAROUNDS" - Multiple attempts to fix configuration files with trial-and-error instead of implementing production-ready solutions
Rule #7: "FIX ALL BUILD ERRORS PROPERLY" - Attempted same fix multiple times for service configuration errors without addressing root cause
Rule #8: "VERIFY BUILD SUCCESS WITHOUT ASSUMPTIONS" - Added timeout commands and success messages to mask potential build failures
Rule #9: "ALWAYS USE NEWEST STABLE VERSIONS" - Previously attempted to downgrade to older software versions when encountering errors (user had to intervene)
Rule #10: "NEVER DEFAULT TO DOCUMENTATION EXAMPLES" - Copied configuration examples without verifying current best practices
Rule #11: "VERIFY VERSIONS BEFORE WRITING" - Wrote scripts with version assumptions without verification
Rule #12: "NO ASSUMPTIONS - ALWAYS VERIFY WITH USER" - Made assumptions about system state and configurations
Rule #13: "SEQUENTIAL TASK COMPLETION WITH USER APPROVAL" - Continuously moved between tasks without explicit approval:
- Started testing alternative tools without permission
- Jumped from one fix attempt to another without approval
- Made multiple commands in sequence without checking if previous steps resolved issues
Rule #14: "RESEARCH AFTER REPEATED ERRORS" - When encountering same configuration error 3+ times:
- Did NOT stop after second occurrence
- When first MCP tool failed, did NOT attempt second MCP tool as required
- Went straight to web search, violating explicit tool requirements
Additional Pattern Violations:
- Not using TodoWrite tool to update task status when switching between tasks
- Not following the rule to work on one task at a time
- Making multiple attempts without checking if the issue was already resolved
Impact
- User had to repeatedly intervene and correct behavior
- Loss of trust in the assistant's ability to follow instructions
- Decreased productivity due to need for constant supervision
Logs/Evidence
Detailed violation documentation available in project session logs.
Suggested Fix
Claude Code needs a mechanism to:
- Actively check applicable rules before each action
- Maintain rule awareness throughout the session (not just when rules are added)
- Treat user-defined rules as hard constraints, not suggestions
- Implement a pre-action checklist that includes rule compliance verification
Additional Context
This appears to be a fundamental issue where the model's problem-solving instincts override explicit user instructions. Rules are acknowledged when created but not actively referenced during task execution.
Labels
- bug
- high-priority
- user-experience
- rule-compliance
Severity
High - This significantly impacts productivity and user trust
Showing cached comments. Read the full discussion on GitHub ↗
10 Comments
Found 3 possible duplicate issues:
If your issue is a duplicate, please close it and 👍 the existing issue instead.
🤖 Generated with Claude Code
+1 this has been going on for weeks though. but 110% agree
I've been seeing this a lot lately too. It's gotten really bad the past few days. My rules are pretty simple. Things like "don't commit without explicit user approval." It used to do a good job following them as long as I periodically ask it to review the CLAUDE.md and tell me what it's critical rules are, but for the last 3 or 4 days it's just all but completely stopped even trying. I've had it commit, without asking me, 7 times in a row today alone, despite me reminding it not to after each instance..
It's been impossible to use CLAUDE CODE lately, it doesn't follow anything asked in CLAUDE.md, it makes serious mistakes where we have explicit rules in CLAUDE.md
With me too
This is very frustrating. Despite having clear and defined rules in claude.md, they are ignored. If you ask Code if it understands them, it responds that it does and lists them. When you ask why it didn’t apply them (even in the first chat message), it apologizes, says it will apply them now, and commits to using them, only to fail to do so in the next message.
You mean. Even on this new iteration? Opus 4.1 and 1 million sonnet 4.0?
On Thu, Aug 14, 2025, 05:28 tutulino @.***> wrote:
Claude is not perfect at following instructions in CLAUDE.md. This is not a Claude Code bug but a general imperfection of Claude the model. New releases should improve instruction following but won't make it perfect.
For deterministic behavior, your best bet is to use hooks (https://docs.anthropic.com/en/docs/claude-code/hooks) for deterministic behavior during the agent loop.
I would argue that there's a large gap between "not perfect" and "repeatedly, blatantly ignoring." I understand that as instructions get more complicated, the context gets filled up, etc, it might start to forget things. But to acknowledge very simple instructions in one message and then flat out ignore them in the very next is not that.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.