Observability / Infrastructure

Motor Agéntico — AI agent observability

A local dashboard that measures what Claude Code, Cursor, Codex and OpenCode cost you. Strictly read-only: it reads their folders and never writes a line into them.

Motor Agéntico — AI agent observability
You can work with AI agents for months without knowing what they cost. Each tool leaves a trail on disk —transcripts, SQLite databases, per-session files— and no two of them report the same thing. I built the reader: it indexes those trails and answers how much, on which model, in which project and with which tools. Measuring it turned out to be an accounting problem rather than an AI one, and the traps are the usual ones. The usage Codex reports is cumulative per session, not per turn: summing the events multiplies spend by the number of turns. The input they report already includes the cached part, so it has to be subtracted or cache tokens are counted twice. Anthropic charges a premium for cache writes and OpenAI does not, so the same formula is wrong for one of them. And a date filter has to cut messages, not sessions: if it cuts sessions, one that merely grazes the range contributes its entire cost and the sum stops matching the total on screen. I found that last one by comparing the export against the dashboard itself, and today a test pins the invariant. The rule governing the rest: never invent a number. If a rate is not verified against the vendor’s own page, the model is flagged UNVERIFIED and its cost counts as zero, in plain sight. If a tool does not record tokens, its figures stay out of the money instead of being estimated. And foreign folders are treated as genuinely read-only: a guard throws on any attempt to write into them, a denylist prevents reading credentials, and the databases Cursor keeps open in WAL mode are copied before being read, because opening them in place would already create a file in someone else’s folder.

Tech stack

TypeScript · Bun · SQLite · SVG

Outcomes

  • 1.5 GB of transcripts indexed; incremental reindex in 0.4 s
  • Rates verified against each vendor’s own documentation
  • Zero dependencies, zero telemetry, zero writes into foreign folders

Links