Claude's compaction system only restores 5 files at 5K tokens each after wiping context, which means you lose everything else without warning. This skill gives you a pre-flight checklist: save your current task, list the files you're editing, note any decisions made, and identify blockers before you hit /compact. It also suggests microcompact strategies like using subagents for heavy searches or reading files with line limits to delay the inevitable. The output is a simple state snapshot you can reference after compaction to get back on track. Honestly just a structured reminder to write things down before your context gets nuked, but that's exactly what you need when the auto-compact warning appears mid-session.

skills.sh installs
189
GitHub stars
2.9K
last updated
Jun 8, 2026

Install

$ npx -y skills add rohitg00/pro-workflow --skill compact-guard --agent claude-code

Installs into .claude/skills of the current project.

Files

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
  • POST_COMPACT_TOKEN_BUDGET = 50K — total restore budget
  • POST_COMPACT_MAX_TOKENS_PER_FILE = 5K — per-file limit
  • Auto-compact fires at context_window - 13K buffer

Pre-Compact Checklist

Before compacting, save these to memory or a scratch file:

  1. Current task — What are you working on? One sentence.
  2. Files in progress — Which files are being edited? (max 5 — compaction only restores 5)
  3. Decisions made — Any architectural choices made this session
  4. Blockers — What's preventing progress?
  5. Next steps — What to do immediately after compact

Strategy: Microcompact First

Sponsors

Details

Repository
github.com/rohitg00/pro-workflow
Category
Automation & Workflows
First seen
Jun 11, 2026

More from rohitg00/pro-workflow

All 35
1martinholovsky avatarkanidm-expertmartinholovsky/claude-skills-generatorExpert in Kanidm modern identity management system specializing in user/group management, OAuth2/OIDC, LDAP, RADIUS, SSH key management, WebAuthn, and MFA. Deep188skills.sh installs
2rohitg00 avatarinsightsrohitg00/pro-workflowShow session analytics, learning patterns, correction trends, heatmaps, and productivity metrics. Computes stats from project memory and session history. Use wh186skills.sh installs
3cloudai-x avatardesigning-apiscloudai-x/claude-workflow-v2Designs REST and GraphQL APIs including endpoints, error handling, versioning, and documentation. Use when creating new APIs, designing endpoints, reviewing API184skills.sh installs
4rohitg00 avatarreplay-learningsrohitg00/pro-workflowSurface past learnings relevant to the current task before starting work. Searches correction history, recalls past mistakes, and applies prior patterns. Use wh184skills.sh installs
5cloudai-x avatardesigning-testscloudai-x/claude-workflow-v2Designs and implements testing strategies for any codebase. Use when adding tests, improving coverage, setting up testing infrastructure, debugging test failure180skills.sh installs
6cloudai-x avatarweb-design-guidelinescloudai-x/claude-workflow-v2Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", "check my site aga179skills.sh installs