name: compact-guard description: Smart context compaction with state preservation. Saves critical files, task progress, and working state before compaction, restores after. Use before manual compact or when auto-compact triggers. user-invocable: true
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 survive