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
This issue has 13 comments on GitHub. Read the full discussion on GitHub ↗