Case study · AgentDiff · KerrShift

Where your agent's money went. And what was avoidable.

An open-source tool that reads the session logs Claude Code and the OpenAI Codex CLI already keep, and shows where an AI coding agent's money went and what was avoidable. No config, no API key, no account, and nothing leaves your machine.

Role
Founder and sole engineer
Studio
KerrShift
Started
August 2026
Licence
Open source, MIT

Where the money went

12 sessions · 7 projects · $314.61

Re-reading context

$162.64 · 52%

Writing context to cache

$93.33 · 30%

Model output

$51.34 · 16%

Background calls

$7.28 · 2%

Avoidable ≈ $132.08, 42% of spendOne real week from my own Claude Code logs.

01The problem

Agent bills grow. Nobody can say why.

Teams now spend real money on AI coding agents like Claude Code and Codex. Three things made that spend hard to manage.

A bill without a reason

Agent invoices show a total. They don't say which session, which habit or which file made it expensive, so nobody can change anything.

Most spend isn't writing code

On real usage, most of the money goes to re-reading a growing conversation every turn and rebuilding the prompt cache after a break.

Logs hold your source code

Session logs contain the code you work on. A tool that uploads them to analyse costs is a tool many teams can't use.

02How it works

One command. Your logs, your machine.

AgentDiff reads the logs your agent already writes, prices every request, and names the habits that cost the most.

  1. 01

    Read

    Claude Code and Codex session logs already on your machine, subagents included

  2. 02

    Count once

    Each billed request exactly once, even across resumed and forked sessions

  3. 03

    Price

    Per model at list prices: input, output, cache reads and both cache-write tiers

  4. 04

    Find

    Long context, cache rebuilds, stuck retries, repeated reads and costly subagents

  5. 05

    Report

    Where the money went, what was avoidable, and what to do about it

Every finding names the session and the file or command involved, with a dollar estimate. For teams building their own agents, it also ships a CI gate that fails the build on loops or cost spikes.

03Key decisions

Built solo. Four calls that shaped it.

releases, latest version
0.7
commits, all by me
99
tests
463
agents read: Claude Code, Codex
2
ways to install
4

01/Focus

Follow the money, not the trace

1

command, no config

The problem
AgentDiff began as a CI gate that compares an agent's execution path to a baseline. It worked, but the question developers actually asked was simpler: why is my agent bill so high?
What I did
Lead with the spend report for the coding agents people already run, and keep the regression gate as a maintained second feature for teams building their own agents.
What happened
One command answers the question people have, and the original gate still ships for LangGraph, CrewAI and OpenAI Agents SDK users.

02/Accuracy

Count every request exactly once

1×

each billed request

The problem
Claude Code repeats usage on every content block of a request, and resumed or forked sessions copy their parent's history. Naive totals count the same tokens several times.
What I did
De-duplicate billed requests across blocks, resumes and forks, and cross-check against Claude Code's own cost counter where a session has one.
What happened
Totals match the agent's own numbers, and the gap that remains is shown honestly as background calls not in the transcript.

03/Trust

Nothing leaves the machine

0

network calls

The problem
Session logs contain source code. Uploading them for analysis would rule out most companies.
What I did
Run entirely locally: no network calls, no telemetry, no account and no API key.
What happened
Anyone can run it on real work logs without asking security for permission.

04/Reach

Install it however you already work

4

install paths, one CLI

The problem
A Python tool is a hurdle for JavaScript developers, and a CLI is a hurdle inside an agent session.
What I did
Ship the same CLI through PyPI, npm (a small launcher), uv and pipx, plus a Claude Code plugin so the agent can run the report and explain it.
What happened
npx, uvx, pip or /agentdiff:report all run the same version of the same tool.

04Results

Measured on real work.

42%

of one real week's agent spend found avoidable, with a fix named for each item

From the author's own Claude Code logs: $314.61 across 12 sessions, $132.08 of it avoidable, mostly long context re-sent every turn and caches rebuilt after breaks. Estimates are deliberately conservative.

open source, on GitHub, PyPI and npm
MIT
agents supported today: Claude Code and OpenAI Codex CLI
2
kinds of avoidable spend detected and explained
7
agent frameworks the CI regression gate reads
6+
telemetry, accounts or API keys
0

05Stack

Small, local, and easy to install.

Core
PythonPydanticNetworkXTyperRich
Distribution
PyPInpm launcheruvpipxClaude Code plugin
Quality
pytestGitHub ActionsBenchmarks
Web
agentdiff.appDocumentation site

06Where it stands

In pre-release, and moving fast.

Developers don't need more dashboards. They need the one number that changes a habit.

AgentDiff is in pre-release and moving quickly: Codex support landed in 0.7, and Gemini CLI and Cursor are next. It's the first product from KerrShift, my studio.

The lesson from building it: start from the question people already ask, keep their data on their machine, and make every number something they can check.

Further reading

Let's work together

Building something that has to be exactly right? Let's talk.