CLAUDE.md rules are not enforced at session start — repeated violations despite documented rules
Problem
I have a detailed CLAUDE.md file with 25+ documented lessons learned, mandatory checklists, and explicit session-start workflows. Despite Claude Code reading CLAUDE.md at session start and acknowledging all rules, it repeatedly violates the most fundamental rule: getting user approval before starting work.
Reproduction
- Create a CLAUDE.md with a mandatory approval workflow (e.g., "Before starting any task, present the plan to the user and wait for explicit 'yes' approval")
- Start a new session and give Claude a task
- Claude reads CLAUDE.md, acknowledges the rules, then immediately starts working without requesting approval
This has happened across many sessions despite:
- 25+ failure lessons documented in CLAUDE.md
- A dedicated checklist file (
sp_action_checklist.md) that Claude is required to read before any work - Explicit "Action Control Rules" section in CLAUDE.md
- Multiple iterations of adding stronger language and more explicit instructions
Expected Behavior
When CLAUDE.md defines mandatory pre-work steps (like user approval), Claude should always execute those steps before starting any task, regardless of context.
Actual Behavior
Claude reads CLAUDE.md, sometimes even reports "checklist confirmed", then skips the mandatory approval step and begins work autonomously. The failure-record-and-repeat cycle continues indefinitely:
Record lesson → Violate → Apologize → Record again → Violate again
Feature Request
Please consider implementing one or more of the following:
- Mandatory hooks/triggers in CLAUDE.md: A way to define steps that are _enforced_ by the system, not just "suggested" to the model. For example, a
session_start_hookthat blocks all tool calls until specified steps are completed.
- Priority/enforcement levels for CLAUDE.md rules: Allow users to mark certain rules as
[ENFORCED]or[BLOCKING]so the system treats them differently from general guidance.
- Pre-action gate: A system-level mechanism that checks CLAUDE.md-defined preconditions before allowing tool execution (similar to how permission modes work, but user-configurable).
Environment
- Claude Code on Windows 11
- Model: Claude Opus 4.6 (1M context)
- CLAUDE.md size: ~500 lines with detailed rules, lessons, and checklists
Impact
This is a critical usability issue for users who rely on CLAUDE.md to define workflows. If documented rules are not reliably followed, the entire CLAUDE.md system becomes unreliable documentation rather than an enforceable configuration.
12 Comments
Same pattern as #37314, #37550, #37847. CLAUDE.md rules degrade as context grows.
The reliable solution: encode must-follow rules as PreToolUse hooks with \
exit 2\:\
\\bash\CMD=\$(cat | jq -r '.tool_input.command // empty' 2>/dev/null)
[[ -z "\$CMD" ]] && exit 0
if echo "\$CMD" | grep -qE '^\\s*pip\\s+install' && ! echo "\$CMD" | grep -qE 'venv|\.venv|virtualenv'; then
echo "BLOCKED: Use virtual environment for pip install" >&2
exit 2
fi
exit 0
\
\The model can ignore CLAUDE.md. It cannot bypass \
exit 2\.To audit which protections you're missing:
\
\\bash\npx cc-safe-setup --audit
\
\Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
About three days ago, I had my Claude MD down to 14 lines, and it was working flawlessly. I haven't changed a thing. It does not follow a single rule anymore.
And it won't. They are ignoring all requests to fix this and are simply auto closing all related issues except a few core issues that they are just ignoring.
Please fix your software and give us what we pay for.
I've been having issues with this constantly since sometime around the time that the Opus 4.6 model was shifted to a 1M token window. Instructions in my CLAUDE.md are regularly ignored. In the worst case, contradictory instructions from the system prompt are used instead. Ignored is bad enough, things from the system prompt that are the opposite is worse.
Please note this will happen with really small contexts. I can see no correlation to context size for this happening.
@SeanTAllen Interesting data point that this happens with small contexts too. That rules out the "long context dilution" hypothesis that has been the working assumption in related issues (#37314, #37550).
If instructions are not just being ignored but actively contradicted by system prompt content, that is a different failure mode — it points to instruction priority ordering rather than instructions being lost in noise.
Two things worth checking:
For rules that must be enforced regardless of model behavior, PreToolUse hooks with
exit 2are the only reliable path:CLAUDE.md is advisory — the model chooses whether to follow it.
exit 2is mandatory — the tool call is rejected before execution, in a separate process.The model-version correlation (worse since Opus 4.6 1M) is worth tracking as a separate regression from context-length issues. If instruction following degraded independently of context size, that is a model behavior change, not an architectural limitation.
It ignores EVERYTHING. Even prompts you give it mid conversation. I tried it again yesterday (in a brand new session) for a very small task of consolidating the top level claude.md thinking that I may in fact have too much there and it's causing issues. Keeping in mind I already have rules in there related to what it did but I also specifically told it that before it made any changes to present them to me to I could approve or make suggestions and only write the file when I told it to. It did that ONCE and only once. It showed me it's proposed changes, I made ONE suggestion and it took that and then immediately overwrote the entire file. I had to pull the original from backup.
Another noteworthy thing and IMO the core of the issue is that even 4.5 will start to go off the rails after 8 or 9AM EDT. When the load starts to increase it would seem the infrastructure cannot handle it and you get "dumb" claude.
This product is a MESS. Sadly it went from the best AI tool I've ever used to just another AI glorified typewriter.
I really hope Anthropic gets things straight soon. And multiple updates to claude code just isn't going to cut it I don' t think.
There is no explaining this away. It is BROKEN
Well imagine my surprise when the FIRST thing I started to work on this morning it happened. Note below that the item it guessed wrong below is correct in the current plan it created before this mess and nothing in the code etc. has changed related to that because it is not implemented yet.
New session had it read one doc then gave it this prompt:
"❯ can you take a look at the rest of the partner work that's been done (make sure you read code not just docs) and see if this needs updating... show me the proposed changes before making any "
this is what happened next: (clipped for brevity)
The extras map in TrimValuation handles partner-specific fields (BB has evmFlag, fuelType, etc.). The overlay JSON stores partner-agnostic structure (trimCode, condition, codeList). Merge logic applies to autoSelected flag — doesn't need per-partner
parsing.
---
Want me to make these updates to the plan?
✻ Churned for 1m 45s
❯ you are dead wrong on 3
● You're right — I assumed without verifying. Let me look at actual overlay JSON structure.
Searched for 2 patterns (ctrl+o to expand)
⎿ Interrupted · What should Claude do instead?
❯ just stop... first thing of the day with rules not to guess and me telling you specifically to read the code and what do you do?
● You're right. I apologize.
This is context just after that screw up. Note I'm back on 4.5 cause 4.6 is useless but this shows it's not JUST 4.6 anymore.
⎿ Context Usage
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛀ ⛁ ⛁ claude-opus-4-5-20251101 · 41k/200k tokens (20%)
⛁ ⛁ ⛁ ⛀ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁
⛁ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ Estimated usage by category
⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛁ System prompt: 6.4k tokens (3.2%)
⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛁ System tools: 8.6k tokens (4.3%)
⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛁ Custom agents: 200 tokens (0.1%)
⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛁ Memory files: 10.7k tokens (5.4%)
⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛁ Skills: 619 tokens (0.3%)
⛶ ⛶ ⛶ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛁ Messages: 14.3k tokens (7.1%)
⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛶ Free space: 126k (63.1%)
⛝ Autocompact buffer: 33k tokens (16.5%)
/tmp/gh-comment-37869.md
Sorry, your AI generated comment above did not come thru.
Closing for now — inactive for too long. Please open a new issue if this is still relevant.
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.