New in 0.7 · now reads Codex too

See what your AI coding agent actually did, and what it cost.

One command reads the Claude Code and Codex session logs already on your machine and tells you where the money went and what was avoidable: long context re-sent every turn, caches rebuilt after breaks, stuck retries. No config, no API key, nothing uploaded.

Works withClaude CodeClaude CodeCodexCodex
$ npx @kerrshift/agentdiff
How it works

Or uvx --from agent-trajectory-diff agentdiff, or /agentdiff:report inside Claude Code.

LOCAL
$ npx @kerrshift/agentdiff

A real week from the author's own logs · session names changed

What it finds

Your bill shows a total. Not a reason.

On real Claude Code usage, most of the spend isn't the model writing code. It's context habits. Every finding names the session and the file or command involved, with a dollar estimate.

Usually the biggest

Long context, re-sent every turn

Each turn re-reads the whole conversation. Past a few hundred thousand tokens, most of your bill is the model re-reading what it already saw.

→One session per task. /compact before it gets huge.

Surprisingly expensive

Cache rebuilt after a break

Come back to a long session after the prompt cache expired and the entire context is written again at cache-write prices. One resume of an 818k-token session cost $6.38.

→After a long break, start fresh instead of resuming.

Agent behaviour

Stuck retries and repeated failures

The same command failing the same way, again and again, or one kind of command failing all session long.

→Fix the setup step, cwd or flaky test once.

Agent behaviour

Re-reads and identical calls

Unchanged files read repeatedly, and identical calls returning identical output. Cost with no new information.

→Point the agent at the right section; keep notes in CLAUDE.md.

$420
real spend across the author's 17 sessions. Naively summing the logs says $640, because resumed sessions copy history.
42%
of it flagged avoidable, almost all from long context and cache rebuilds.
$0.02
gap between our price table and Claude Code's own cost counter, on the same tokens of a $47 session.
How it works

One command. Zero setup.

Claude Code and Codex already write a log of every session to disk. AgentDiff reads them. Nothing to configure, no account, no key.

Inside Claude Code

Install the plugin once, then run /agentdiff:report in any session. Claude shows the report and explains what to change. It can also pick it up when you ask why usage is high.

/plugin install agentdiff --marketplace kerrshift/agentdiff

Any terminal with Node

npx fetches a tiny launcher that runs AgentDiff with uv, pipx or your Python 3.10+, whichever you have.

$ npx @kerrshift/agentdiff

Python people

Run it once with uv, or install it with pip, pipx or uv tool install. The command is agentdiff.

$ uvx --from agent-trajectory-diff agentdiff
Also:pip install agent-trajectory-diffpipx install agent-trajectory-diffnpm i -g @kerrshift/agentdiff/agentdiff:report --since 30d

Options

agentdifflast 7 days (same as agentdiff sessions)
agentdiff --since 30d24h, 7d, 30d, 12w … or all
agentdiff --project apionly projects whose name contains “api”
agentdiff --top 10list more findings and sessions
agentdiff --agent codexonly Codex (or claude, all)
agentdiff --jsonmachine-readable output

How the numbers are computed

  • Reads ~/.claude/projects (or $CLAUDE_CONFIG_DIR), including subagent transcripts.
  • Counts each billed request once. Claude Code repeats usage on every content block, and resumed or forked sessions copy their parent's history.
  • Prices per model at Anthropic list prices, with cache reads and both cache-write TTLs (5-minute and 1-hour). Fast mode included.
  • Reads Codex rollouts from ~/.codex/sessions ($CODEX_HOME) and prices each turn with the model it used, including OpenAI's long-context and Fast tiers. Codex logs carry no cost, so those figures are API-equivalent estimates.
  • Uses Claude Code's own cost counter as the total when a session has one; the gap shows up as background calls not in the transcript.
  • On Pro/Max plans these are API-equivalent costs: still the clearest view of which sessions and habits use the most.

Private by design. Session logs contain your source code. AgentDiff reads them locally, makes no network calls and has no telemetry.

Supported: Claude Code and OpenAI Codex CLI. Planned: Gemini CLI, Cursor.

Also in AgentDiff · for agents you build

A trajectory regression gate for your CI.

Building your own agent with LangGraph, CrewAI, the OpenAI Agents SDK or OpenTelemetry? AgentDiff compares each PR's agent run against a recorded baseline and fails the build on runaway tool loops or cost spikes. It handles non-deterministic agents with N-run baselines, posts a verdict on the PR, and re-baselines with a /agentdiff approve comment.

Automated CI/CD Feedback

Instant root-cause diagnosis right in GitHub PRs.

Engineers never have to hunt through raw terminal logs or third-party web apps. AgentDiff posts an actionable diagnostic comment directly to the Pull Request review timeline.

acme-corp/customer-support-agentPublic
Code● Issues Pull requests4

refactor(prompt): parse customer records with new schema #42

Openalex-chen wants to merge 1 commit into main from feat/parse-schema
AD
agentdiff-botbotcommented 2 minutes ago

⛔ AgentDiff · Trajectory Regression Check (Exit Code 1)

Candidate execution trajectory breached regression tolerances against golden baseline.

GateMeasuredThresholdVerdict
TDI (Trajectory Divergence)0.4285≤ 0.2500❌ FAIL
Stagnant Tool Retries3 loops0 loops❌ FAIL
Token Budget Delta+148.2%≤ 10.0%❌ FAIL
Root Cause Culprit

execute_sql node repeated 3 consecutive times with identical parameters without state progress.

Divergence Tree
1 · authenticate
2 · execute_sql
3 + execute_sql (↻ loop repetition 1)
4 + execute_sql (↻ loop repetition 2)
5 + execute_sql (↻ loop repetition 3)
6 · generate_summary
All checks have failed
1 failing and 2 successful checks — agentdiff-gate failed
agentdiff / evaluate-trajectory (push)
Failed in 4.2ms
Example AgentDiff gate comment
View workflow runs•Documentation
Universal Ecosystem Ingestion

Works with your existing agent stack. Zero code rewrite.

You shouldn’t have to re-architect your codebase to protect your agents. AgentDiff connects directly to your existing telemetry formats and framework runtimes.

LangGraph

LangGraph

State Checkpoint DAGs
StateGraph & Cyclical Subgraphs

Ingest native JSON trace dumps from LangGraph directly into AgentDiff's deterministic regression engine. Sub-5ms parsing speed, zero telemetry lock-in, and full DAG verification.

Zero custom SDK or decorator changes
Deterministic sub-5ms graph alignment
Runs locally and in GitHub Actions
Instant CLI Diff Command
agentdiff golden.json pr_run.json --adapter langgraph
test_langgraph_regression.pyPure Python SDK
# Ingest native LangGraph Checkpoints with zero instrumentation
from agentdiff import load_trace, compare

baseline  = load_trace("runs/langgraph_golden.json")
candidate = load_trace("runs/langgraph_pr.json")

# Compare execution paths across cycles & tool nodes
report = compare(baseline, candidate)
assert report.stagnant_loops == 0
Auto-detects format from JSON payloadView all adapters
Frequently Asked Questions

Everything you need to know.

The spend report first, then the CI gate. Anything else, ask on GitHub.

No. Session logs contain your source code, so AgentDiff reads them locally, makes no network calls and has no telemetry. There is no account and no API key.
Another agent or log format you want supported?Open an issue on GitHub
Try it now

Find out where your agent budget went.

One command, about ten seconds, nothing uploaded. Building your own agents too? The same package gates them in CI.

MIT LicensedRuns locally, nothing uploadedNo account or API key
bash
Spend report
$npx @kerrshift/agentdiff
.github/workflows/ci.ymlCI gate (optional)
- uses: kerrshift/agentdiff/.github/actions/[email protected]
  with:
    baseline: baselines/default.envelope.json
    candidate: traces/candidate.json