Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
git clone --depth 1 https://github.com/egorfedorov/claude-context-optimizerWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/commands/egorfedorov/claude-context-optimizer/budget)<a href="https://agentmods.dev/commands/egorfedorov/claude-context-optimizer/budget"><img src="https://agentmods.dev/badge/commands/egorfedorov/claude-context-optimizer/budget/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/commands/egorfedorov/claude-context-optimizer/budget"><img src="https://agentmods.dev/badge/commands/egorfedorov/claude-context-optimizer/budget.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00000 | $0.00892 |
| Opus 5.5 | $0.00000 | $0.00357 |
| Sonnet 5.5 | $0.00000 | $0.00178 |
| Haiku 4.5 | $0.00000 | $0.00089 |
Grade A, and why
budget scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 74 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Context Budget Manager
Manage the token budget for Claude Code sessions. Model-aware — picks the right
effective context window and prices per model. The session's REAL model is read
from the transcript by the budget hook; config.model is only the fallback.
Everything from Sonnet 4.6 up is 1M; Haiku 4.5 is 200K.
Parse :
status (or no arguments)
Show current budget config + auto-compact settings: Read
~/.claude-context-optimizer/config.json and
~/.claude-context-optimizer/budget-config.json (either may be missing).
If no config exists, show defaults (200K working budget on a 1M window, opus-5.5 fallback model, warn at 50/70/85/95%).
set <tokens>
Update the budget limit. Parse the token count (200K, 1M, 500000 all OK).
Update ~/.claude-context-optimizer/config.json (the user approves the write):
{
"budgetTokens": <parsed_number>,
"warnAt": [50, 70, 85, 95],
"autoCompactAt": 90,
"model": "opus-5.5"
}
If budgetTokens exceeds the chosen model's context window, warn the user.
model <name>
Set the FALLBACK model for cost estimation (used only when a session's transcript has no model id yet). Supported keys:
haiku-4.5(aliashaiku) — $1/$5 per M, 200Ksonnet-4.6(aliassonnet) — $3/$15 per M, 1Msonnet-5— $2/$10 per M, 1Msonnet-5.5— $2/$10 per M, 1Mopus-4.7/opus-4.8— $5/$25 per M, 1Mopus-5(aliasopus) — $5/$25 per M, 1Mopus-5.5(default) — $4/$20 per M, 1M, cache reads at 0.05×fable-5— $10/$50 per M, 1Mfable-5.1(aliasfable) — $10/$50 per M, 1M, cache reads at 0.025× (vs 0.1× elsewhere)
opus-4.8-1m / opus-4.7-1m / opus-extended are back-compat aliases only — there is
no 1M surcharge; the 1M window is standard at $5/$25.
Update the model field in config.json. When switching to a 1M-context model and the
current budgetTokens is below 500K, ask if the user wants to bump it to 1M.
auto <on|off>
Toggle auto-compact at thresholds (80% / 90%). Update
~/.claude-context-optimizer/budget-config.json:
auto on→autoCompactEnabled: trueauto off→autoCompactEnabled: false
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- today First seen · 74 lines · 0 tokens per session scan A 04f8ddee9d66
budget is a command published in the GitHub repository egorfedorov/claude-context-optimizer (116 stars, last pushed yesterday), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 892 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-18.
Other commands, from other repositories
dock-chat
Dock the full conversation to Telegram — drive Claude from your phone.
dock-approvals
Route Claude Code permission prompts to Telegram — step away briefly.
run
Execute prompt(s) from ./prompts/ with automatic archiving - for structured prompt-based work.
help
Explain Ralph Wiggum technique and available commands.
scout-meta-review
Run an interactive Scout meta-review — a system-level audit that sits above the individual session types. Checks whether sessions are running, mistake audit is trending well, proposals are flowing, KB files are healthy, and data-source coverage is consistent across session types. Runs in the current conversation.
ashlr-eco-mode
Toggle eco mode — aggressive token-saving behaviors that trade some response richness for lower session cost.