Read Cache blocks redundant reads. Prompt Coach grades and rewrites weak prompts before they cost you context. Smart Pack picks the optimal file set for your task. The session's real model — Fable 5, Opus, Sonnet, Haiku — is detected from the transcript, so windows and pricing are always right. Measured at 63% token savings across 7 reproducible scenarios.
$ npx skills add https://github.com/egorfedorov/claude-context-optimizer
Run node benchmark/run.js yourself.
All scenarios use real file parsing, real token estimation, and real file digests. Nothing synthetic.
| Scenario | Without CCO | With CCO | Savings | |
|---|---|---|---|---|
| Read Cache Dedup (JS) | 9,082 | 4,579 | 50% | |
| Read Cache (5x reads) | 22,705 | 4,693 | 79% | |
| File Digest vs Full Read (JS) | 4,541 | 38 | 99% | |
| Read Cache Dedup (JSON) | 12,076 | 6,075 | 50% | |
| Contextignore Block (lockfile) | 8,827 | 0 | 100% | |
| File Digest vs Full Read (MD) | 3,117 | 36 | 99% | |
| Typical Session (10 files, 45 min) | 35,166 | 20,044 | 43% |
Based on 35% average waste rate (conservative), 80K tokens/session, 5 sessions/day.
Run /cco-roi for personalized calculations based on your actual usage.
| Model | $/M tokens | Saved/session | Saved/day | Saved/month | Saved/year |
|---|---|---|---|---|---|
| Haiku 4.5 | $0.80 | $0.02 | $0.11 | $3 | $40 |
| Sonnet 4.6 | $3.00 | $0.08 | $0.42 | $13 | $151 |
| Opus 4.8 | $5.00 | $0.14 | $0.70 | $21 | $252 |
* Individual developer. For a team of 10 on Opus: $2,520/year saved. Opus 4.8 delivers the full 1M context window at $5/$25 per M — no premium tier.
Every Read call consumes context — whether the file was relevant or not.
At $5/M input tokens on Opus 4.8, this adds up fast.
Claude reads package.json, tsconfig.json, .eslintrc every session. ~500 tokens each time, rarely used.
A single read of a 250-line README burns tokens. If Claude reads it once and never references it again, that's pure waste.
Context gets compacted, Claude forgets, reads again. 5x the tokens for the same information. Over and over.
The plugin hooks into Claude Code silently. No configuration. No commands to learn. It just works.
Every Read, Edit, Write, Glob, Grep, and Agent call is tracked automatically via PostToolUse hooks. Zero overhead.
Read Cache blocks redundant reads and returns a compact file digest (~100 tokens instead of ~18K). Contextignore blocks lockfiles and generated code entirely.
Cross-session confidence scoring identifies which files are useful and which are waste. Per-project, decays with time. Gets smarter every session.
No commands needed. The plugin intervenes only when it can save you tokens.
Smart Read Cache v2.0 — blocks re-reading unchanged files. Returns a structural digest (~100 tokens) instead of full content (~18K). Saves 50-99% per file.
Live session pulse — "45K used, 18K saved by CCO (28% efficiency)" — unobtrusive real-time feedback on your savings.
Budget multiplier — "CCO makes your budget 1.4x more effective" — shows how much extra context you're getting from saved tokens.
Smart compact suggestions — lists specific read-only files to drop with exact token savings. Repeats every 10K tokens.
Performance comparison — "12% waste. Better than your avg (19%)!" Motivates improvement over time.
Weekly savings streak — shows waste trend. Warns about files that are always wasted in this project.
The budget hook reads the exact model id from your session transcript — window size, pricing, the board, and cache staleness all follow the model you're actually on. And the three biggest avoidable dollar leaks are now caught live, with their real cost named.
Fable 5, Opus, Sonnet, Haiku — detected per session from the transcript,
zero config. Switch /model mid-day and nothing miscalibrates;
config.model is only the fallback. Claude 5 family in the pricing table.
The prompt cache lives 5 minutes. Resume after a longer pause and the hook names what the break just cost — "re-warming 150K of context ≈ $0.86 extra". A broken cache re-bills your whole context at 12.5× the cached rate. Batch pauses.
Shell output was the biggest untracked context consumer. Every tool's actual response size is measured now — and a single ≥10K-token result gets a one-line fix: pipe through tail/grep, read with offset/limit.
On 1M-window models quality degrades in the ~300–400K "dumb zone" — long before the
window fills, and long before any budget-% warning. A one-shot signal at ~350K suggests a
focused /compact or a fresh session while the model is still smart.
Files read-but-unused in 3+ sessions now surface automatically (when the
recurring waste is ≥30K tokens) with the exact fix: /cco-shield apply turns
them into permanent .contextignore rules.
The session-end summary leads with the number people remember: ★ CCO saved $654.36 this session — 86% of what it would have cost. Read-cache savings + prompt-cache economics, measured — not marketing.
Opus 4.8-aware, with corrected model facts: Opus 4.7/4.8 deliver the full 1M window at the standard $5/$25 price — no premium tier. Optimization isn't just about blocking reads, though: the most expensive thing in any session is a vague prompt that sends Claude reading 20 files to guess your intent. The Prompt Coach and Smart Pack make every prompt count.
/cco is now one screen: budget %, $ spent this session,
tokens saved by the cache (your effectiveness multiplier), waste,
last prompt grade, the active task's cost, and ready-to-run actions
(what to drop → /compact, what to /cco-pack). Everything the
optimizer tracks, unified — nothing to configure.
/cco-task add "fix login flow" starts a task; tokens spent are
attributed to it, so you see cost per task, not just per session.
Pair with /cco-pack to load only what each task needs, then
/cco-task done freezes its total. A session-end report shows what CCO saved you.
A UserPromptSubmit hook scores every prompt on
specificity, scope, success criteria, and length.
Weak prompts get inline suggestions before Claude starts working —
so you stop wasting context on guesswork. Run /cco-coach to grade
a prompt manually or see history.
Run /cco-pack "fix login flow" and get a ranked file list with
suggested offset/limit per file — built from
mentioned paths, git diff, and historical patterns. Token-budget aware:
stops at 25% of your effective context.
Set /cco-budget model opus-4.8 and the entire plugin retunes:
adaptive Read Cache staleness thresholds, correct cost calculations
($5/$25 per M — full 1M, no surcharge), and budget warnings that don't fire at 5% of a 1M window.
Budget monitor now estimates input and output tokens separately and uses each model's real prices (Opus 4.8: $5/$25, Sonnet 4.6: $3/$15, Haiku 4.5: $1/$5). You see actual cost — not just half of it.
PostToolUse hook now matches mcp__* tools too — so Linear, Slack,
Postgres, GitHub, and other MCP integrations show up in your token reports
alongside Read/Edit/Write.
Run /cco-doctor to verify install integrity: version sync,
hooks wiring, data-dir writable, model config sane. Catches the
"I installed it but nothing happens" class of bugs in under a second.
The plugin works automatically, but 18 commands are available for detailed insights.
Run /cco for the one-screen Control Center, or drill into the per-file heatmap — green = useful, red = waste — with actionable recommendations.
Run /cco-roi for personalized savings: monthly costs by model, effective budget multiplier, team ROI tables. Based on your real data.
Run /cco-digest for a weekly grade (S/A/B/C/D/F) broken down by precision, edit ratio, search accuracy, and focus.
Run /cco-budget set 80000 to set a limit. Automatic alerts at thresholds with cost estimates and budget multiplier.
Blocks redundant reads automatically. Returns a file structure digest (~100 tokens) instead of full re-read (~18K). Staleness-aware.
Run /cco-anatomy to generate a compact codebase map. Claude reads one file instead of twenty.
PreToolUse hook that warns before loading known-waste files. Suggests Grep or offset/limit alternatives.
Run /cco-export html for a Chart.js dashboard with waste trends, token usage, project breakdown, and edit timelines.
Run /cco-replay to see recent session summaries. Pick up where you left off without re-reading everything.
One command. Zero config. Proven savings.
$ npx skills add https://github.com/egorfedorov/claude-context-optimizer
Or clone manually: git clone https://github.com/egorfedorov/claude-context-optimizer.git
context-optimizer is 100% free, open source, and has no telemetry. If it saved you money on Claude tokens, consider supporting development.
bc1q428exz5t2h9rzk7z5ya70madh0j3rs6h4gfgyd
0xB3f0C8e42B7cA9d65920cEfe82e3fef1B5C9d0C9
8ctK8nt3CBkPZGfWQXX8TsnqUYUy4JAbT1EMhr8rsQxm