Feature: CLAUDE.md critical rule markers to survive context compression
Summary
Provide a mechanism to mark specific rules in CLAUDE.md as "preserved during context compression."
Background
Analysis of 223 sessions revealed that the most frequent problem is "rules written in CLAUDE.md are not followed." This is especially pronounced in long sessions where the context window gets compressed.
The root cause is that all CLAUDE.md rules are treated with equal weight, so critical rules and general guidance are indiscriminately summarized or omitted during context compression.
Proposal
<!-- claude:critical -->
## Worktree Required Rule
All code changes must be made within git worktrees.
<!-- /claude:critical -->
## Design System (general guidance)
Use shadcn/ui...
Sections marked with claude:critical would:
- Never be omitted during context compression
- Always be included in subagent context
- Be preserved throughout long sessions
Current Workaround
We re-inject critical rules as additionalContext via SubagentStart hooks, but this cannot address context compression for the main agent itself.
Additional Context
Our analysis found that 5 out of 6 rules proposed by /insights for addition to CLAUDE.md were already written there. The real problem is not "rules are missing" but "rules disappear from context."
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗