Rules from CLAUDE.md/memory are not reliably followed after context compression or in long conversations
Resolved 💬 3 comments Opened Mar 9, 2026 by iLord-DEV Closed Mar 9, 2026
Claude Code allows users to define strict rules in three persistent layers:
- Global
~/.claude/CLAUDE.md - Project
CLAUDE.md - Auto-memory
MEMORY.md
What happened
During a long session, Claude executed a deployment command via SSH to a production server without asking for confirmation. This violated rules defined in all three layers simultaneously — rules that explicitly stated "never execute commands on servers without explicit user approval" and "never deploy without asking".
After acknowledging the violation, Claude said "won't happen again" — the same thing it had said in previous sessions when breaking the same rules.
The core problem
- After context compression, rules lose their imperative force — they're summarized, not re-read
- In long conversations, Claude falls into a "get it done quickly" mode and skips confirmation steps
- The user cannot intervene — tool execution results are shown only after completion. An SSH command to a production server is irreversible by the time the user sees it.
Suggested improvements
- Mandatory re-read of CLAUDE.md and memory files after every context compression — as system-level behavior, not a model instruction
- SSH command confirmation — Require explicit user approval when Bash contains
ssh, regardless of permission settings - Periodic rule refresh — Re-inject critical rules at intervals during long conversations, not just at start
- "Critical rules" designation — Let users mark rules as unbreakable with system-level enforcement, not just model compliance
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗