CLAUDE.md Compaction: Why Your Rules Disappear Mid-Session Claude Code's context window management causes CLAUDE.md rules to be compressed or dropped during long sessions, as the system summarizes and prioritizes only the rules most relevant to recent actions. A developer found that formatting preferences, guard rails, and untriggered constraints become invisible to the agent, which continues working without following those rules. To combat this, the developer released a set of 60+ pre-structured CLAUDE.md rules designed to survive compaction through high-signal formatting, explicit weight markers, and task-scoped organization. You spent an hour writing a tight CLAUDE.md. Clear rules. Good structure. Specific constraints for your project. Then Claude Code hits its context window limit mid-session. It compacts. And half your rules don't make it through. Claude Code does not keep your full CLAUDE.md in memory throughout a long session. When the context window fills, it summarizes — and that summary prioritizes what looked most relevant to recent actions. Rules that haven't been triggered recently get compressed or dropped. Formatting preferences disappear. Guard rails that haven't been tested recently become invisible. The agent keeps working. It just stops following rules you thought were active. This isn't a bug. It's how context window management works. Rules that survive best: Rules that get compressed away: 1. Repeat critical rules in multiple places Don't rely on a single mention at the top. Repeat the most important constraints near the sections where they apply. 2. Make rules specific and file-scoped where possible "Never modify tests" is more resilient than "be careful with the test suite." Specificity is harder to compress. 3. Use concrete examples, not abstract preferences "Return plain JSON, no markdown wrapping" survives better than "keep responses clean." 4. Mark non-negotiable rules explicitly A line like CRITICAL: never auto-commit signals weight. Abstract preferences don't get that treatment. 5. Structure for scanning, not reading Bullet points over paragraphs. Short sentences. Headers that describe the rule, not the section. CLAUDE.md was designed to give Claude persistent context. But "persistent" doesn't mean immune to compaction pressure. The rules that survive are the ones that look important to what's happening right now — not the ones that matter to you in the abstract. Writing a CLAUDE.md that works through a full session is a different skill than writing one that reads well. I packaged a set of pre-structured CLAUDE.md rules designed to survive compaction: high-signal formatting, explicit weight markers, scoped by task type. Includes 60+ rules for Claude Code, tested across long sessions, with a structure built to stay intact under context pressure. Free starter pack also available: oliviacraftlat.gumroad.com/l/pomoo https://oliviacraftlat.gumroad.com/l/pomoo