π§ Compaction Advisor
Automatic context monitoring for Claude Code β never get interrupted by mid-task compaction again.

π¦ Installation
Option 1: Plugin Marketplace (Recommended)
/plugin marketplace add vignesh07/compaction-advisor
/plugin install compaction-advisor
/compaction-advisor:setup
Then restart Claude Code. That's it!
Requires: jq (JSON processor). Install with brew install jq (macOS) or apt install jq (Linux).
Option 2: One-Line Install (without plugin system)
curl -fsSL https://raw.githubusercontent.com/vignesh07/compaction-advisor/main/install.sh | bash
Then restart Claude Code.
π― The Problem
Claude Code auto-compacts when your context window fills up. This often happens mid-task β right when you're deep in a refactor or debugging session. You lose important context, and Claude has to rediscover things it already knew.
The worst part? By the time you see the warning, it's too late.
β¨ The Solution
Compaction Advisor gives Claude real-time awareness of context usage with intelligent checkpointing. No user intervention needed.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β
β Status Line: [Opus] π 25k free ββββββββββ β
β β
β You: I want to refactor the authentication system β
β β
β Claude: Context is at 25k free β that's tight for a β
β refactor (~50k needed). Run /compact first to β
β avoid interruption? β
β β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Claude automatically knows when context is low and proactively advises you.
π How It Works
Two lightweight components work together:
βββββββββββββββββββ βββββββββββββββββββββββββββ
β Status Line β β UserPromptSubmit Hook β
β (for you) β β (for Claude) β
ββββββββββ¬βββββββββ ββββββββββββββ¬βββββββββββββ
β β
βΌ βΌ
Displays in UI Runs on every prompt
β β
βΌ βΌ
βββββββββββββββββββ βββββββββββββββββββββββββββ
β π 25k free ββββββββββΆβ Reads state file β
β ββββββββββ β writes β Injects into Claude β
βββββββββββββββββββ βββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββ
β Claude sees: β
β <context-status> β
β WARNING: 25k free... β
β </context-status> β
βββββββββββββββββββββββββββ
When context is healthy β hook stays silent (0 tokens)
π Intelligent Checkpointing
During long autonomous tasks (refactors, multi-file changes), the plugin monitors progress and suggests checkpoints:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Claude is working on a large refactor... β
β β
β [Edit] file1.ts β β
β [Edit] file2.ts β β
β [Bash] npm test β β
β [Edit] file3.ts β β
β ... 8 more operations ... β
β β
β <context-checkpoint> β
β CHECKPOINT RECOMMENDED: Context at 22k after 12 operations. β
β Good time to /compact. Summarize progress to preserve. β
β </context-checkpoint> β
β β
β Claude: "Good checkpoint! I've completed: β
β β’ Refactored auth module (files 1-5) β
β β’ Fixed 3 failing tests β
β β’ Remaining: API endpoints (files 6-10) β
β β
β Run /compact Focus on auth refactor progress β
β Then I'll continue with the API changes." β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Three Levels of Protection