From pro-workflow
Diagnoses context window usage issues, audits MCPs and CLAUDE.md, applies fixes like compaction and disabling unused tools, sets auto-compaction, and reports optimized state.
How this command is triggered — by the user, by Claude, or both
Slash command
/pro-workflow:context-optimizerThe summary Claude sees in its command listing — used to decide when to auto-load this command
# /context-optimizer - Optimize Token Usage Diagnose and fix context window problems. ## Process 1. **Check current usage:** - If > 70% → compact now before quality degrades - If > 90% → compact immediately, you're in the "dumb zone" 2. **Run optimization checks:** **MCP audit:** - Keep <10 MCPs enabled, <80 tools total - Disable what you're not actively using **CLAUDE.md size:** - Root CLAUDE.md should be < 60 lines, < 150 max - Move package-specific info to package-level files - Move personal preferences to CLAUDE.local.md 3. **Apply fixes based on fi...
Diagnose and fix context window problems.
Check current usage:
Run optimization checks:
MCP audit:
/mcp
CLAUDE.md size:
Apply fixes based on findings:
| Problem | Fix |
|---|---|
| High context usage | /compact with focus on current task |
| Too many MCPs | Disable unused servers |
| Bloated CLAUDE.md | Split into modular files |
| Heavy exploration in main session | Delegate to subagents |
| Vague prompts causing broad searches | Scope prompts with paths and constraints |
Set proactive auto-compaction if not already configured:
{
"env": {
"CLAUDE_AUTOCOMPACT_PCT_OVERRIDE": "50"
}
}
Report current state and what was optimized.
| Action | Saves | When |
|---|---|---|
/compact | 30-50% context | Task boundaries |
| Disable unused MCPs | ~5% per MCP | Switching domains |
| Subagent delegation | Keeps main clean | Heavy search/read tasks |
Fresh session via /resume | 100% reset | Unrelated work |
Trigger: Use when sessions feel slow, context is degraded, running out of budget, or before starting a long task.
npx claudepluginhub rohitg00/pro-workflow --plugin pro-workflow/cc-budgetCalculates remaining context window after fixed overhead from CLAUDE.md, rules, skills, and MCP schemas. Shows budget summary table and top consumers. Also supports audit, optimize, anchor-plan, simulate.
/contexteRuns built-in /context command to fetch real token metrics, analyzes usage patterns for inefficiencies, and provides tailored optimization recommendations.
/contextAnalyzes Claude Code's context configuration for optimization opportunities and applies improvements. Also supports resetting to defaults.
/optimize-contextAnalyzes context window usage against MECW principles, providing token breakdowns, utilization status, and optimization recommendations. Accepts optional path and --detailed flag.
/context-budgetAnalyzes context window usage across agents, skills, MCP servers, and rules to find optimization opportunities, producing a Context Budget Report with recommendations.
/context-budgetAudits fixed and dynamic context overhead in the current session — scans CLAUDE.md, agents, MCP servers, rules, skills, and history — estimates tokens per component, reports budget usage and headroom, and issues alerts for oversized components or overflow risk.