Manages token budget limits, auto-compact settings, and status for Claude Code sessions via commands like status, set <tokens>, model <name>, auto <on|off>. Optimizes context usage with config files.
npx claudepluginhub egorfedorov/claude-context-optimizerThis skill is limited to using the following tools:
Manage the token budget for Claude Code sessions.
Optimizes Claude Code session context and token usage via compaction, MCP audits, prompt scoping, and subagent delegation. Use when sessions slow, context degrades, or budget depletes.
Enforces token quota management in Claude Code sessions via quota checks, context read budgets (max 8-15 files), delegation to external tools, and compression reviews. Use at session start or before heavy analyses.
Optimizes Claude Code sessions for Max-plan token limits through response compression, tool output filtering, drift protection, and planning for broad tasks. Useful for quota management and efficiency.
Share bugs, ideas, or general feedback.
Manage the token budget for Claude Code sessions.
Parse $ARGUMENTS:
status (or no arguments)Show current budget configuration, usage, and auto-compact settings:
cat ~/.claude-context-optimizer/config.json 2>/dev/null
echo "---"
cat ~/.claude-context-optimizer/budget-config.json 2>/dev/null
If no config exists, show defaults (100K tokens, warn at 50/70/85/95%). Show auto-compact status: enabled/disabled, thresholds (default: auto-compact at 80%, critical at 90%).
set <tokens>Update the budget limit. Parse the token count from arguments.
Create or update ~/.claude-context-optimizer/config.json:
{
"budgetTokens": <parsed_number>,
"warnAt": [50, 70, 85, 95],
"autoCompactAt": 90,
"model": "opus"
}
model <name>Set the model for cost estimation (haiku, sonnet, opus).
Update the model field in config.json.
auto <on|off>Toggle auto-compact behavior. When enabled, the budget monitor will output strong directive messages at configurable thresholds to prompt Claude to run /compact.
Update ~/.claude-context-optimizer/budget-config.json:
auto on — set autoCompactEnabled to trueauto off — set autoCompactEnabled to falseRead the existing budget-config.json first, then update only the autoCompactEnabled field.
If the file doesn't exist, create it with defaults:
{
"autoCompactEnabled": true,
"autoCompactThreshold": 80,
"criticalThreshold": 90
}
After toggling, confirm the new setting to the user. Explain:
Explain that budget warnings will appear automatically during the session as hook feedback when thresholds are crossed.
At 50%+ budget usage, the monitor shows how much CCO improves your effective context budget. For example, "1.4x more effective" means CCO blocked enough redundant reads to make your 200K context behave like 280K. This metric comes from read-cache savings (blocked reads + file digests).