v5.1.1 · Claude plugin · MIT · no telemetry

In a long session, most of the bill is re‑reading.

Every request re-reads the whole context. context-optimizer keeps it small and shows you the numbers: Haiku 5.5 subagents that do the reading for 1/40 of the price; and skills that keep long chats cheap on claude.ai too.

Where the money goes

We measured before building more features.

We expected read dedup to be the big win. On real transcripts, Claude almost never re-reads an unchanged file. The cost is the context itself, paid again on every request.

~60%

of a long session is cache reads

Cache reads are cheap per token, but every token in context is read again on every later request. 280K of context × 300 requests adds up.

40×

Opus 5.5 vs Haiku 5.5 per token

$4.00 against $0.10 per million input tokens. Reading files and test logs doesn't need the expensive model.

1×

a subagent's reading is paid once

Its context is thrown away when it returns. Only the short answer enters yours, and only that gets re-read.

The orchestrator

The expensive model decides. Haiku does the reading.

The plugin ships two subagents on Haiku 5.5. Claude hands them work on its own; a 90-token policy at session start says when.

plans · edits · decides
main model
Opus 5.5 — $4.00 / M input
question →
← 250-word answer
commands →
← pass / failures
scout
Haiku 5.5 · read-only
files and search
runner
Haiku 5.5
tests, builds, linters
Opus 5.5
$4.00
Sonnet 5.5
$2.00
Haiku 5.5
$0.10
1

Scouts explore

"Where is X defined, what calls Y, which tests cover Z" goes to context-optimizer:scout, several in parallel. Each answer comes back with path:line evidence.

2

The main model plans and edits

It reads only the line ranges it's about to change. Design calls and edits never leave it.

3

The runner verifies

Test suites and builds run in context-optimizer:runner. Thousands of log lines stay there; you get pass/fail and the failures.

4

Or ask for it outright

/cco orchestrate <task> runs a whole task this way.

Checked live in Claude Code 2.1.302: the scout ran on claude-haiku-5-5, did one Grep and a 25-line Read, and found readEnd at src/read-cache.js:212. The whole session cost $0.005.

Works where you work

Chat, Cowork and Claude Code each get something useful.

Most installs come from claude.ai chat, where a plugin loads its skills but not hooks or local scripts. So the plugin ships skills that work everywhere, and the heavy machinery where it can run.

Chat

claude.ai, desktop and mobile

fresh-start hands a long conversation over to a new one. doc-digest turns a long document into a working digest. project-context turns background you keep retyping into Project instructions. token-check and sharpen-prompt size and tighten.

Cowork

Desktop tasks

The same skills, plus the scout and runner subagents on Haiku 5.5 for reading and checks.

Code

Claude Code

Everything: Haiku subagents, one /cco command for the board, the audit and task state across /compact, read dedup, budget and cache warnings.

/cco audit

Does it save you anything? Ask your transcripts.

Claude Code keeps every session in ~/.claude/projects/. The audit prices them with each session's real model and cache TTL, counts every refusal CCO made, and ranks the levers that would save you the most. Nothing leaves your machine.

/cco audit --days 2
  SAVINGS AUDIT — 3 sessions + 2 subagent runs, last 2 days
  ──────────────────────────────────────────────────────────────────
  Spend      $26.16 over 293 requests  (subagents $2.04)
             cache reads 62% · cache writes 23% · output 17%
  Subagents  opus-5.5 $2.04 (1 run) · haiku-5.5 $0.001 (1 run)
  Context    avg 282.2K per request, peak 564.8K; fixed overhead is 22% of it

  WHAT CCO DID
  Read dedup refused 1 re-read (1.2K tokens) → saved ~$0.00 (0% of spend)
  Repeated reads that went through: 2 via Read, 0 via Bash cat/sed

  BIGGER LEVERS (estimates on these sessions)
  ~   $7.49   29%  Compact at 200K instead of letting context grow
  ~   $1.71    7%  Delegate exploration (Read/Grep/web) to Haiku subagents
  ~   $0.70    3%  Every 10K less of fixed overhead (MCP tools, CLAUDE.md, skills)

  VERDICT
  Read dedup saved $0.00. The biggest saving available here is
  "compact at 200K instead of letting context grow" — about $7.49 (29% of spend).

Real output, on the sessions that built this release. Yes, it says read dedup saved nothing there. That's why v4.22 ships the orchestrator.

Everything else it does

Quiet by default. Every message actually arrives.

Since v4.20 the hooks answer in the JSON Claude Code reads: advice for Claude as context, notes for you as a system message that costs no tokens.

read-cache

Read dedup with file maps

An unchanged re-read is skipped and replaced by a map of the file. Per subagent, and it steps aside if Claude asks again.

budget

Budget and cache-break warnings

Real context size from the transcript, the cost of a cold cache after a pause, and a nudge to /compact before quality drops.

/cco

One command for the rest

/cco is the session board; /cco help lists audit, task, pack, orchestrate, config and the others.

/cco task

Task state that survives /compact

A small JSON state per task, put back into context after compaction or resume.

/cco overhead

Fixed overhead audit

What every session pays before you type: system prompt, MCP tools, CLAUDE.md. Lists MCP servers you never call.

.contextignore

Files you never need

Block lock files and build output from Read. ContextShield proposes rules from your own waste history.

How we keep it honest

Numbers we can defend.

✓

Transcripts over estimates. Cost comes from the API usage Claude Code records, priced per model, cache TTL and fast mode.

✓

NET savings. Everything CCO injects into context is subtracted from what it claims to save.

✓

Tested the way Claude Code runs it. End-to-end tests drive the real hooks through sh -c on Linux and macOS; /cco doctor does the same on your machine.

✓

Local only. The plugin's code makes no network calls. Data lives in ~/.claude-context-optimizer/ and is pruned automatically.

Install

Two commands. Then restart Claude Code.

Install
claude plugin marketplace add egorfedorov/claude-context-optimizer
claude plugin install context-optimizer@cco
Check it, then see your numbers
# in Claude Code
/cco doctor
/cco audit

On claude.ai, the desktop app or Cowork: open the Directory and add Context Optimizer. Upgrading from 4.x: commands moved under /cco (/cco-audit is now /cco audit). Turn the delegation policy off with "orchestrate": false in ~/.claude-context-optimizer/config.json.