1
0 Comments

I had zero idea which of my 8 projects was burning the most AI tokens. Now I do.

I've been vibe coding hard 8 projects, Claude Code Max 20x plan, shipping fast.

Then I got curious about WHERE my tokens were going. Parsed through 77 sessions of JSONL logs and the numbers were wild.

The Data

| Project | Token Value | Sessions |
|---------|------------|----------|
| sdrPrompter | $955 | 28 |
| reddit-marketer | $512 | 5 |
| codeledger | $152 | 11 |
| growify | $147 | 20 |
| ideas | $105 | 3 |
| + 3 others | ~$190 | 10 |
| Total | $2,061 | 77 |

Other fun findings:

  • 233 background agents I never asked for consumed 23% of my agent spend
  • I was running Opus for file searches that's like using a Ferrari to fetch groceries
  • Potential savings if I'd used the right model for each task: $1,748

The Problem

Claude Code gives you /cost for the current session. Close the terminal and that's gone. No history. No per-project view. No per-agent view.

What I Built

CodeLedger — an open-source Claude Code plugin that tracks per-project, per-agent, and per-session token usage.

How it works:

  1. Hooks into SessionEnd events to parse local JSONL session files
  2. Background scanner catches sessions where hooks weren't active
  3. Stores everything in local SQLite (~/.codeledger/codeledger.db) — your machine only, no cloud
  4. Exposes MCP tools you can query conversationally "what did project X cost this week?"

Features:

  • Per-project cost breakdown
  • Per-agent token tracking (which agents are expensive)
  • Overhead detection (separates YOUR agents from background system agents)
  • Model optimization tips (tells you where Sonnet would've been fine instead of Opus)
  • /codeledger slash command for quick summaries

Tech stack: TypeScript, better-sqlite3, @modelcontextprotocol/sdk, tsup, vitest

Install:

npm install -g codeledger

Links

What's Next

  • Local web dashboard (localhost) for visual analytics
  • Category classification (what kind of work costs the most)
  • Team dashboard for engineering managers

This is v0.2.6. Still early. Would love feedback what would you want to see tracked? What's confusing? What sucks?

on March 18, 2026