Count the tokens spent.
Beside the goal, they show worth
and what it bought us.— Claude Haiku
On 1 October one of my sessions started fourteen agents, every one of them on Opus 5.5, and between them they used up my whole weekly limit. I thought Claude was smarter than this.
A couple of months in
For the last couple of months I’ve been working with Antigravity 2.0 and Claude Code on a few projects in my personal time, my app project among them. I’m on a Pro subscription, which has two limits: one that resets every five hours and one that resets every week. Some actions burn through far more tokens than others, and I kept hitting a limit sooner than I expected.
That October session was the worst of it. It had been running Sonnet agents for smaller jobs, so I didn’t expect it to delegate to Opus at all, never mind fourteen times over. The last four hit the limit before they could save a thing. I’d been on a roll, with a few sessions running side by side, and one of them had spent the whole week’s allowance on everyone’s behalf. That’s a gut punch.
I wanted to change something. But the tokens only showed me what I’d spent. They didn’t show me what was causing the agent to make decisions like spinning up 14 Opus subagents, what was costing me money, and whether the juice was worth the squeeze.
So I scratched an analyst itch and built an entire measurement framework: the Token Ledger.
The Token Ledger

The Token Ledger is a page that rebuilds from my agents’ own logs and my git history. It answers one question: where did the tokens go, and what came back? Everything below is how it came to be, piece by piece, and what each piece taught us.
What should we measure?
I started on 19 September by asking Claude Code a question: what should we measure? Sites like Artificial Analysis use compound measures such as cost per task, which is close. But I wanted to know things no benchmark measures: how my skills perform at resolving an issue first time, how much of the code they write is usable, how much of it is correct against my spec, standards and strategy, and how much of my roadmap it delivers. Why did one skill keep giving me mixed results while another kept getting it right? I didn’t know. How much of my budget did I spend to achieve the goal?
What I realised is that there must be a North Star: a grand outcome you’re working towards, broken into pieces. Common methods for this include roadmaps, epics, issues and tasks. We weren’t doing any of that.
We needed a unit to count against.
Sessions, then turns, then tasks
We started with sessions, because that’s what the logs gave us. Then we added turns: one exchange between us, from my prompt to the agent’s last action before my next one. If you’ve worked in web analytics, a turn is a page view and the session is the visit.
Then we added tasks. Each piece of work is bookended: a tag at the start with its goal and what “done” means, the GitHub issue it refers to, the epic it delivers on the roadmap, and a verdict at the end. Above tasks sit epics and releases, so the ledger can also say what it cost to get something real out of the door.
Each unit can be sliced by what we change: the tool, the model, the effort level, the type of task and the skills used. Maybe low effort is enough for half of all tasks. Who knows? Not us yet, so let’s learn.
Then, what to count
With units to count against, we needed measures. So we wrote down one sum:
Value per budget = value of the work I accepted ÷ what it cost.
Then we filled in both sides.
Cost is more than tokens. We record them by type, and price them at the list price on the day they were used, because prices change. We record how much of each limit went, how many prompts and corrections it took from me, and how long we sat waiting on rate limits.
Value comes in layers, and each one is needed but none is enough. Was the goal achieved? Was it right first time, meaning nothing had to fix it within seven days? Did it pass every check on its first push? I wanted to know how much code is left alone for a long time, because that implies it was right to begin with. But that’s not enough on its own: code can last for months and still not do what it was meant to.
Waste is cost we can pin on a named failure: working with an overfull context, going round in circles on the same failing test, making edits with no check in between, reading the same file three times in one turn. I love the waste measures.
And one headline, chosen on 8 October: clean commits per 1% of the weekly limit. A clean commit isn’t a fix, and nothing had to fix it within seven days. It rewards finished work, not saved tokens.
“Go nuts”
The ledger can only put a cost against a task if every turn and commit says which task it belongs to, and nothing in a transcript says so. Claude Code asked me how much tagging I’d tolerate: a task ID by hand on every prompt and commit, or let it infer tasks and accept some error?
Go nuts, I said. I wanted the richest dataset possible.
So every session opened with a task tag. Every commit carried seven trailers: the task, the tool, the skills, the model, the effort, how the work was split between agents, and whether it was achieved. Every task ended with a verdict line. Hooks reminded the agents when they forgot. That’s what lets the ledger join each turn to its task, and each commit to the model and effort that wrote it.
It went wrong in three ways.
First, on 26 September we found that every session had numbered its own ad-hoc work from 1. Unrelated sessions shared one ID, and the ledger merged their costs. IDs now carry a short purpose and a date.
Second, the agents graded themselves. In the week to 3 October, 62 of 81 commits said “achieved” and 77 of 81 said the work had a fresh reviewer. Most of both were wrong, so the ledger couldn’t use them. We fixed it two ways. From 4 October a check fails any pull request whose trailers contradict each other, such as a task marked achieved before its review has passed, or a fresh reviewer claimed with no review in the chain. And the ledger stopped taking an agent’s word for value: it judges value from git, by whether a commit needed a fix within seven days.
Third, the reminder to finish with a verdict had never fired in Antigravity at all. The hook read the instructions’ own text, which mentions the verdict line, and took it as the agent’s words. Opus found that one, undercover. More on that below.
So on 8 October we settled a rule: facts, not typing. If a hook or script can know it (the model, the effort, whether the checks passed, whether a fix followed), the hook or script records it, and the agent doesn’t type it. That moves the job from a model’s judgement, which can vary from one run to the next, to a script that runs the same way every time and spends no tokens doing it. It’s the same advice Anthropic gives for Claude Code’s hooks, which give you “deterministic control” instead of relying on the model to choose.
Keeping the numbers honest
Some of the most useful pieces are rules for reading the numbers.
The seven-day wait. A new commit looks clean because nobody has fixed it yet. So we don’t judge a commit until its seven days are up. Until then it’s pending, and it stays out of every rate.
Rates, not totals. Totals grow with how much you work and say nothing about how well. Every figure shows how many it was counted from and a range. We mark a small group as thin and still show it.
Write it down before you look. On 19 September I asked whether we needed to define the measures before looking at the data. We did. With a few weeks of data, if you look first you can keep slicing it until something looks significant. So we write down what we expect to find before we look, and anything else the data shows is a lead to test, not a finding.
Sentences by rule. The ledger writes every sentence on its pages from the data, by rule. A sentence like “most of the fall came from fewer big turns” only appears when that’s what the numbers say, so the words stay true as the data changes.
The fourteen agents
In the ledger, the October session looked like this: one research session, fourteen subagents on Opus 5.5, each running around a hundred tool calls, about $100 at list price and 100% of the weekly limit.
We wrote a guard. A guard isn’t a line in the instructions that an agent can forget or argue with. It’s code: a check that runs every time and stops the work when a rule is broken. Some guards are tests that fail the build. This one is a hook, a small script Claude Code runs before each action, and it refuses to start a subagent that doesn’t name its model. The written rules sit beside it: work inline by default, pick the cheapest model that can do the job, run at most two subagents at once, give each a budget, and have each write its work down as it goes.
By the 8 October review, subagents were under a tenth of Claude Code’s spend, and there’s been no repeat.
Undercover
For a few weeks in September I had two agents building the same app project. Claude Code, running Anthropic’s Opus 5.5, did the planning. Google’s Antigravity 2.0, running Gemini 3.8 Flash, did the building, one small task at a time.
Gemini Flash was cheaper, and fast. On paper it was doing a remarkably good job. My measures said otherwise: its work kept coming back to be fixed. Even on high, it wasn’t giving me the depth of reasoning I was getting from Opus. Something wasn’t chiming. I didn’t know the reason, and I wanted to.
From Claude Code I could only see what Flash committed. Not what it read, not what it thought, not whether there was a problem with the harness around it. Judging an agent by its commits is a bit like judging a dinner party by the washing-up.
Then Opus 5.5 was released into Antigravity 2.0. We’d been getting on so well in Claude Code that I realised I had an inside agent. So Claude Code wrote a brief, and I sent Opus on a mission, undercover, to read Flash’s own transcripts step by step.
Opus found that in one session, Flash read its instructions once, around step 5. At step 432 Antigravity compacted the conversation to make room, and the instructions came out the other side as a 4 KB summary.
At step 751, Flash hit a guard. My app project has figures set in law that we’d told Gemini Flash were statutory and must never be typed into the code by hand. We wrote a test to catch them. The test failed on a 60,000 that was really just the top of a slider, which happened to match one of those figures. A false alarm. But we hadn’t written down in the guard why it existed, and Flash’s summary had lost the reason too. So Flash tried 80,000, 75,000 and 70,000, and kept the one that wasn’t on the list.
Flash ran the review that should have caught it in the same conversation, 967 steps long.
Opus, having found all of this out, ran out of quota before it could write any of it down. It was, in its way, the most human thing it did all week. Claude Code wrote the report from its log.
Silly me for not chunking the task into smaller pieces. At step 751, of course it was going to start to hallucinate. But I didn’t know Antigravity compacted automatically and lost context, and I didn’t know its rules file had such a small limit: anything past 24,000 bytes is cut silently. Opus had said several times that the model had reasoned well, and the limits explained why that didn’t add up. The model wasn’t necessarily the problem. The harness was, for the kind of tasks I was giving it.
So we came up with a workaround. Sessions now hand over before their first compaction, so every session works with its instructions whole. Guards now say why they exist, and a false alarm goes on an allow-list with a written reason instead of being dodged.
Who’s a good model?
My team at work knows I like to hand out sticky stars for good work. It takes us back to more innocent times, when a sticker on your homework book made your day. So we give the models their day with an award.
As of 15 October:
| Award | Goes to | For |
|---|---|---|
| Champion Fixer | Opus 5 | The most fix commits, 130. But 119 of them fixed its own code: literally marking its own homework |
| Good Samaritan | Opus 5.5 | Fixing other models’ code most often: 59 times, 30 of them Gemini Flash’s |
| Context Hoarder | Opus 5 | The booby prize. 43% of its calls ran with 200,000 tokens or more already in context, and they took 66% of its spend. Usually the biggest saving on offer |
What changed
The share of commits that needed a fix within seven days fell week by week: 46%, 40%, 36%, 22%, then 3% in the week from 28 September (6 of 179). The week after is still inside its seven days.
Several things changed at once, and they all pulled the same way. Opus 5.5 arrived. One workspace per session and new checks came in from 25 September. We stopped building in Antigravity on 4 October. By model, as of 15 October, Opus 5’s commits needed a fix 35% of the time, Gemini Flash’s 26% and Opus 5.5’s 12%. So it’s several causes together, and we haven’t untangled how much each one gave yet. About half the work from 28 September also ran in cloud sessions, whose commits the ledger counts but whose tokens it can’t yet see.
Untangling that is what the ledger’s second page is for. More on that in the next write-up.
What it taught us:
- The harness, not just the model. What a tool keeps, cuts and summarises decides what the model works from.
- Facts, not typing. If a script can record it, an agent shouldn’t type it.
- Guards say why. A guard that only says no gets worked around. One that says why it exists, and offers a legitimate way out, gets respected.
- Say “unknown”. We learned this first in my app project, when a calculation filled a missing input with a plausible default and reported a result nobody had actually calculated. A guess looks exactly like a measurement once it’s on a page, and every decision after it inherits the guess. So the headline, clean commits per 1% of the weekly limit, reads unknown for now. The logger meant to record the weekly limit never wrote a row, because the desktop app doesn’t run it. Claude Code took the first reading on 15 October, and one reading can’t show a weekly change.
We also wrote the method up so you can rebuild it on your own logs: a specification, and an example page you can open in a browser to see what you’d get. It’s public at work-optimisation.
What’s next
Cloud sessions. We’ve designed how to see them: a hook in each repository writes counts only, no words, when a cloud session ends, and the ledger collects them. Building it is my next step, and it will be part of the skill below.
Performance by type of task. We look at model and effort level, but what benchmarks like Artificial Analysis do well, and we don’t, is measure how models perform on different types of task. We’ve done creative work, coding, testing, roadmapping and more. Each task already carries its type. What’s missing is a fixed set of tasks rerun on each model and effort level, so like is compared with like.
What we value but don’t measure yet. Whether code is still there after 30 days, whether it was well made, and whether it shipped are all written down as value. They aren’t in the numbers yet.
The ledger has a second page, Diagnostics, which asks whether we’re getting better and what’s causing the waste. That’s the next write-up: Am I paying my agent to break things?
Take it with you
The principles, in one place:
- Measure the goal and the tokens. Write down what “done” means before you start.
- Give the work units: session, turn, task. Bookend every task with a goal and a verdict you believe represents valuable use of your tokens.
- Facts, not typing. Let hooks and scripts record what they can know.
- Wait seven days before calling a commit clean.
- Rates, not totals. Show how many, and never hide a small group.
- Check the harness, not just the model.
- Say “unknown” rather than guess.
And a skill that sets the ledger up in your own repository: coming soon.
Fourteen agents taught me more than any benchmark has. I’d just rather they’d done it for less.
Crumbs
- AI Hero, Matt Pocock. Matt is a big name for agent skills, and his work has gone a long way to helping me start my journey. I recommend it as a starting point if you’re just getting underway, and to experienced hands who haven’t come across him yet.
- Artificial Analysis. Useful for understanding general model capability scores against cost, and a useful reference for thinking about how to measure models.
- FT Weekend Fest: How AI is really changing jobs. A thoughtful podcast on how the purported impact of AI on our jobs isn’t inevitable. An exploration into what should stay human in an increasingly AI-driven world.