DEV Community

Alejandro Cavagna
Alejandro Cavagna

Posted on

How I track what my coding agents actually cost

How I track what my coding agents actually cost

For the last few months I've been using Pi and Claude Code for real work. The speed is great. The problem is that after a week I had two questions I couldn't answer:

  1. Is this actually done? An agent would say "fixed" and the next day I'd find a skipped test or a broken type check.
  2. What did this feature cost? Five sessions spread across Pi and Claude Code, and I had no idea if the total was $2 or $20.

So I built agent-kit, a small, provider-agnostic setup that solves both.

What it looks like

agent-kit overview

The two ideas

1. One command decides "done"

Every project gets an AGENTS.md with the development cycle, definition of done, stop-and-ask list, and hand-off format. Then there is one verification script:

scripts/verify
Enter fullscreen mode Exit fullscreen mode

The agent runs it after every change. A pre-push hook runs it before every push. CI runs the same thing.

scripts/verify passing

No more "I think it's done". It's done when scripts/verify says PASS.

2. One ledger tracks cost across agents

A Pi extension and a Claude Code hook write to the same ledger file, ~/.agent-kit/ledger.jsonl. Each line is a delta of spend since the last write, tagged with project, branch, and a cost bucket (usually a ticket id).

Then you can ask:

agent-cost --projects
Enter fullscreen mode Exit fullscreen mode

agent-cost --projects

Or see what a single ticket cost across multiple sessions and tools:

agent-cost --bucket PROJ-123
Enter fullscreen mode Exit fullscreen mode

agent-cost --bucket

Why I built it this way

I didn't want another dashboard. I wanted something that:

  • Works in any directory, with or without a project.
  • Doesn't force a specific agent. Pi and Claude Code are supported today; Codex can follow the same AGENTS.md rules.
  • Keeps the gate simple: one script, not a CI pipeline nobody runs locally.
  • Stores data locally by default, in plain JSONL.

Quick start

git clone https://github.com/acs195/agent-kit.git
cd agent-kit
./install.sh --user
./install.sh /path/to/your/project
Enter fullscreen mode Exit fullscreen mode

Then fill in the Project section of AGENTS.md, set the STEPS in scripts/verify, and run it until it passes.

What's included

  • AGENTS.md / CLAUDE.md templates
  • scripts/verify + scripts/lib/verify-runner.sh
  • .githooks/pre-push
  • Pi extension with cost bucket picker
  • Claude Code ledger hooks
  • agent-cost report
  • TypeScript preset and example project
  • GitLab and GitHub CI templates
  • 36 tests

Try it or tear it apart

The repo is open source under MIT:

👉 https://github.com/acs195/agent-kit

I'd especially love feedback on the AGENTS.md format and what other presets would be useful (Python is next on my list).

Top comments (0)