compact-guard
Installation
SKILL.md
Compact Guard
Protect important context through compaction cycles. Based on Claude Code internals: compaction restores max 5 files with 5K tokens each, within a 50K total budget.
Trigger
Use before /compact or when auto-compact warning appears.
Key Constants (from Claude Code source)
POST_COMPACT_MAX_FILES_TO_RESTORE = 5— only 5 files survivePOST_COMPACT_TOKEN_BUDGET = 50K— total restore budgetPOST_COMPACT_MAX_TOKENS_PER_FILE = 5K— per-file limit- Auto-compact fires at
context_window - 13Kbuffer
Pre-Compact Checklist
Before compacting, save these to memory or a scratch file: