From claude-code-expert
Calculates 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.
How this command is triggered — by the user, by Claude, or both
Slash command
/claude-code-expert:cc-budgetThe summary Claude sees in its command listing — used to decide when to auto-load this command
# /cc-budget — Context Budget Calculator Use `/cc-budget` to understand how much of your context window is consumed by always-on content (CLAUDE.md, rules, skills, MCP schemas) and how much remains for actual work. ## What it does Calculates your effective working context by subtracting fixed overhead from the total context window, then recommends optimizations. ## Usage ## Operating protocol ### Phase 1 — Inventory context consumers Scan and measure: - CLAUDE.md files (project, user, managed) — exact line counts - `.claude/rules/` files — total and per-file - Loaded skill descripti...
Use /cc-budget to understand how much of your context window is consumed by always-on content (CLAUDE.md, rules, skills, MCP schemas) and how much remains for actual work.
Calculates your effective working context by subtracting fixed overhead from the total context window, then recommends optimizations.
/cc-budget # Show current context budget
/cc-budget audit # Detailed breakdown of token consumers
/cc-budget optimize # Suggest reductions to free context
/cc-budget anchor-plan # Design PreCompact anchor strategy
/cc-budget simulate --task "refactor auth module" # Estimate context needs
Scan and measure:
.claude/rules/ files — total and per-fileTotal context window (Sonnet/Opus) = 200,000 tokens
Minus system prompt ≈ 4,000 tokens
Minus CLAUDE.md (all levels) ≈ X,XXX tokens
Minus rules files ≈ X,XXX tokens
Minus skill descriptions ≈ X,XXX tokens
Minus MCP tool schemas ≈ X,XXX tokens
─────────────────
Effective working budget = Y,YYY tokens
Based on working budget:
Output:
optimize action)anchor-plan action)simulate action)When anchor-plan is selected:
/compactsettings.jsonReturns:
npx claudepluginhub markus41/claude --plugin claude-code-expert/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.
/context-optimizerDiagnoses context window usage issues, audits MCPs and CLAUDE.md, applies fixes like compaction and disabling unused tools, sets auto-compaction, and reports optimized state.
/contexteRuns built-in /context command to fetch real token metrics, analyzes usage patterns for inefficiencies, and provides tailored optimization recommendations.
/optimize-contextAnalyzes context window usage against MECW principles, providing token breakdowns, utilization status, and optimization recommendations. Accepts optional path and --detailed flag.
/fire-costTracks context window consumption and estimates session costs, recommending strategic compaction before hitting limits. Supports --detail, --warn, and --budget flags.