Skip to content
By Abhi Yoheswaran
TokenTrace
v0.14.2 MCP agent adoption

Local-first AI CLI usage analytics

TokenTrace

TokenTrace scans local AI CLI artifacts, normalizes token usage, estimates missing counts when necessary, and shows cost, model, project, session, parser, and repair evidence in a local dashboard. No cloud account, no telemetry, no proxying.

npx tokentrace

Runs without installing. Or install globally with npm install -g tokentrace and run tokentrace.

localhost:3030 / TokenTrace overview
TokenTrace overview dashboard: Usage Pulse, token accounting cards linked to evidence, Model Rates, and Token Trend and Cost Trend charts

What it does

One local database, every total auditable

Nine surfaces over one local SQLite database, from evidence-first analytics to a first-class MCP entry point. Each tile is the short version. Tap into Features for the full breakdown.

Live status

A live status line for Claude Code

Claude Code renders a custom status line at the bottom of its terminal. TokenTrace plugs into that contract. The line separates live context (what Claude is carrying now) from cumulative processed and cache usage, so you stop misreading "tokens used this session" as "tokens in context now."

A Claude Code session with a TokenTrace status line at the bottom showing session tokens, cache, cost, and Model Rate state

Wire it up

tokentrace statusline setup claude
# add the printed statusLine block to ~/.claude/settings.json

Codex CLI status-line integration is deferred until its hook contract stabilizes. tokentrace watch --session shows the same status in a terminal split as a fallback.

Evidence-first overview

Every total points back to what produced it

Four surfaces tied together: the Overview pulse and metric cards link into evidence trails, unknown cost has its own Repair workflow, and Scan Health carries the Parser Trust Report, Scan History Diff, scan scheduling, and supply-chain IOC checks. Every record carries a Data Confidence score; the same evidence behind any total can be exported as an Evidence Pack.

Overview, metric cards linked to evidence
TokenTrace 0.12.0 Overview with Usage Pulse, token accounting cards linked to evidence trails, Model Rates, and Token Trend and Cost Trend charts
Linked Overview. Major totals link into evidence trails; unknown cost links into the Repair workflow. Token Trend and Cost Trend sit right after Usage Pulse and the token accounting cards. Processed tokens are cumulative processed usage, not current context size.
Evidence, processed tokens trail
TokenTrace Evidence detail page tracing a processed-tokens total back to sessions, source files, Parsers, and Model Rates
Evidence trail. Every metric on Overview traces back to the sessions, source files, Parsers, and Model Rate context behind it. tokentrace evidence --json prints the same trail for local automation, and Evidence Packs export the entire pack as JSON or Markdown.
Unknown Cost Repair
TokenTrace Unknown Cost Repair workflow grouping unknown-cost rows by cause, with alias hints, parser review links, and Model Rate follow-up
Unknown Cost Repair. Unknown-cost rows grouped by cause, with alias hints, parser review links, and Model Rate follow-up. tokentrace repair --json prints the same groups for scripting.
Scan Health, parser review
TokenTrace Scan Health: files checked, Parser warnings, ignored support files, cost coverage, scan scheduling, and supply-chain IOC checks
Scan Health. Files checked, Parser warnings, ignored support files, cost coverage, scan scheduling, and supply-chain IOC checks in one view. The Parser Trust Report sits alongside the Scan History Diff so scan-to-scan movement is auditable.

Release notes

Shipped in 0.14.x

The MCP agent adoption and stabilization line. TokenTrace ships a first-class Model Context Protocol entry point so coding agents can adopt it without inventing a wrapper.

  • Local stdio MCP server. tokentrace mcp starts a read-only server under io.github.abhiyoheswaran1/tokentrace, exposing get_status, run_doctor, get_evidence, get_repair_queue, get_report, and run_scan. No files scanned at startup.
  • Grounded by default. Agents call get_agent_guide first to load the privacy model and guardrails; every response carries agent-decisive metadata; run_scan refuses without confirmLocalScan=true.
  • Verifiable + resilient. tokentrace mcp selftest --json verifies startup without local file reads; data-backed CLI help stays safe on fresh or broken local databases. Adoption docs in docs/agent-adoption.md, TOKENTRACE_AGENT.md, and llms.txt.

Package trust

What npm install tokentrace runs

No install scripts. npm install tokentrace runs zero TokenTrace code. The package has no preinstall, install, or postinstall hooks.

npm provenance. Every release ships an npm provenance attestation, so anyone can check on npm that the published package matches the public source repo.

Readable source. The published package ships readable application source and the compiled CLI runtime, not generated route bundles. Anyone can read what actually runs.

Settings, Package trust
TokenTrace Settings package trust panel summarizing install-script, network, and provenance guarantees

Settings, Package trust. The same guarantees, surfaced inside the running app.

Privacy

TokenTrace runs locally, does not bill users, and only uses Model Rates to estimate provider costs.

Local files stay local. TokenTrace reads files the AI CLIs already write on your disk. No scraping, no extensions, no traffic interception, no proxy, no MITM, no telemetry. Raw prompt and response bodies are not stored by default. The only optional outbound network call refreshes public Model Rate data so the local cost estimate is accurate. No accounts, no billing.

Quick start

From npx to status line

npx tokentrace                   # run without installing; opens the local dashboard
npx tokentrace mcp               # start a local stdio MCP server for agents
tokentrace mcp selftest --json   # verify MCP startup; does not scan files
tokentrace agent --json          # read-only agent discovery manifest
tokentrace doctor --json         # inspect Scan Health and repair recommendations
tokentrace evidence --json       # trace metric totals to their source records
3,450

Total downloads

About

Where it fits

TokenTrace is one of two related developer-tools projects on this site. ProjScan gives AI coding agents real structural facts about your codebase. TokenTrace shows you, after the fact, what those agents and their CLIs actually cost.

The scope stays narrow on purpose. Ingestion reads only the local filesystem. Desktop scraping, browser extensions, traffic interception, and cloud telemetry change the trust profile, so they are not on the roadmap.

Every record carries a Data Confidence label (exact, tokenizer estimate, or simple estimate) and a Model Rate coverage flag, so any aggregate splits back into what was measured and what was estimated.

App Details

Built
Version 0.14.2
Category Developer Tools
Platform Node.js >= 18.18 (macOS, Linux, Windows)
Price Free / MIT