feature: Mark critical CLAUDE.md rules for context compression preservation

Resolved 💬 2 comments Opened Feb 7, 2026 by shuhei0866 Closed Mar 7, 2026

When context is pruned, CLAUDE.md sections may be dropped. This causes rule violations.

Example: learning_with project has 59+ wrong_approach errors from AI editing main worktree after CLAUDE.md (with WT rule) was pruned from context.

Proposal: Allow CLAUDE.md to mark critical rules that must survive context compression:

  • Add HTML comment marker: <!-- claude:critical="SAFETY" -->
  • During compression, preserve marked sections as system knowledge
  • Treat like system instructions (never pruned)

Use cases:

  1. Safety rules (WT enforcement, secret handling)
  2. Project constraints (DB migrations, RLS policies)
  3. Workflow (TDD mandatory, review steps)

Data: 5/6 friction categories in learning_with are already in CLAUDE.md. Problem: preservation, not documentation.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗