Case study · open source · cognitive-claude

Three AI models working as one team. And the bill for every task.

I built a policy layer for Claude Code that decides which model does each task, delegates work to sub-agents and measures everything. This is the replay of 90 days of real use.

MIT license · v0.1.1 · Python, standard library onlyView on GitHub

Opus · most capable106,092 · 52.5%Haiku · lightest55,709 · 27.6%Sonnet · mid-tier40,109 · 19.9%cognitive-clauderules + routing

Each dot ≈ 1,000 replies · each slab = 5,000

201,910
model replies
987
sessions
19.46 B
tokens processed
144,881
replies inside sub-agents

sub-agents 71,76%main thread 28,24%

Opus, the most capable, did 52.5% of the work. Haiku, the lightest, did 27.6% for 1.6% of the cost. That is routing at work.

Real totals for the period (Jan 29 to Apr 28, 2026, 74 active days). The animation spreads the pace evenly.

Scale: usage worth $42,358 at API prices, running on a $500 plan over three months. Why this is not savings from the framework

turn 16same context, charged againConstitution, the team handbook~100 lines · 9 laws6 hooksapply the rulesClaude Codeyour sessions and logs

Each layer is the same context, charged again every turn.

01 · Constraint

Every AI reply paid again for the same context.

On every reply, Claude Code rereads the instructions and project files. It is like paying the entrance fee again for every question.

Heavy users could not see that cost, or tell whether the right model was doing each task.

02 · Decision

One conductor for three models, with rules that apply themselves.

The golden rule: simple tasks go to the lightest, fastest model, hard tasks go to the most capable. Each type of agent has its model.

03 · Accepted cost

What was left out, on purpose.

  • Hooks warn, but never block. The person still decides.
  • Installation has three phases. The last one only runs after you confirm you have read the whole constitution.
  • It is not for everyone. For people using it less than an hour a day, keeping it running costs more than it returns.

04 · Result

90 days of real use, measured reply by reply.

987
sessions
201,910
model replies
71.76%
of the work done by sub-agents
91.63%
cache hit rate
View by
Opus
52.5%
Sonnet
19.9%
Haiku
27.6%

Half of the replies come from Opus. More than a quarter go to Haiku, the lightest model.

One operator, 90-day window, Jan 29 to Apr 28, 2026. Source: cost-audit.py output and EVIDENCE.json in the repository. Your numbers will differ.

Under the hood

For those who want to go past the numbers.

Nothing here is invented. Caching, delegation and model routing are in Anthropic’s documentation. The contribution is putting the pieces together, measuring and showing the math.

What the number does not prove

01

API price is not savings.

Over 90 days, usage was worth $42,358 at API prices, with $500 paid for the plan. That gap comes from the flat plan price and would exist for any heavy user. The framework delivers the instrument that makes the math measurable.

02

High cache is not always a good sign.

During a platform incident confirmed by Anthropic in March and April 2026, the cache hit rate rose from 85% to 95% while cost per turn tripled. That is why cost per turn is the main indicator.

The cycle of each session

01 / 05

A hook restores the rules and stabilizes the start of the session, the part the cache reuses.

A closed loop: each session corrects the next estimate.

Installation in three phases

10 min · Zero risk

Installs telemetry only. You see your real numbers, with no change in behavior.

Height = time for each phase. You can stop at any of them.

Seven principles

  1. 01Fixed context is charged every turn.
  2. 02Keeping the cache stable matters more than using fewer tokens.
  3. 03The cheapest tool that solves it wins: hook, then rule, then skill, then agent.
  4. 04If the answer can be computed, code beats the model.
  5. 05Delegating to sub-agents preserves the main thread cache.
  6. 06Each type of agent has a set model.
  7. 07Without measurement, there is no optimization.

Try it with your data

No install needed. The command reads your sessions and shows your numbers in about 60 seconds.

python3 tools/cost-audit.py --window 90 --verbose
View on GitHub

Want this level of measurement in your company’s systems?

The free 1-hour diagnosis runs the X-Ray on your operation and shows where to start.

See all systems

Let’s talk

Reach me directly. I answer personally, usually the same day.