Skip to main content

agentabacus

agentabacus — local-first analytics for AI coding agents

PyPI CI Python License

Local-first analytics for AI coding agents.

AI coding agents generate session logs, but each agent stores them differently. agentabacus brings those logs into one local database so you can see:

  • What did I spend?
  • Which models are doing the work?
  • Which projects or sessions cost the most?
  • How much of the usage comes from subagents?
  • Where are tokens being spent?

No server. No account. No telemetry. Your data stays on your machine.

agentabacus report --by model

Install

Try it without installing:

uvx agentabacus report

Or install it permanently:

pipx install agentabacus

Running it with no arguments shows the whole surface:

agentabacus --help

Then check what agentabacus can find:

agentabacus doctor

Collect your agent logs:

agentabacus collect

Collection is incremental, so you can safely run it again as new sessions are created.

To collect from one agent only, use:

agentabacus collect --claude

With no agent flag, collect reads every supported agent found on your machine.

Reports

Get a cost and usage report:

agentabacus report

Filter by time:

agentabacus report --since 30d

Group the results:

agentabacus report --by model

For example, --by thread separates your main agent from its subagents. Every grouping is listed in the command reference below.

Command reference

Every command also takes --help, e.g. agentabacus report --help.

Shared options

These mean the same thing wherever they appear.

Option What it does
--since <window> Time window counting back from now: 24h, 7d, 4w, 6m, or all. Default 30d. There is no upper limit — all covers everything you have collected.
--source <agent> Restrict to one agent, e.g. claude_code. Default is every agent in the archive.
--main-only Exclude subagent threads, counting only your main conversation.
--limit <n> How many rows to show.

agentabacus collect

Reads new log data into the archive. Incremental and safe to re-run — unchanged files cost one stat().

Option What it does
(no flag) Collect every supported agent found on this machine.
--claude Collect Claude Code only.
--codex, --gemini, --opencode, --cursor, --cline, --aider Collect that agent only. Unsupported ones exit with a link to the contributing guide.
--full Ignore saved read positions and re-read every log from the start. Use only after upgrading, or if numbers look wrong.
--session-id <id> Collect a single session. Used by the Claude Code SessionEnd hook.
--quiet, -q Print nothing unless something failed. Also disables the progress bar.

agentabacus report

Cost and token totals, with a breakdown.

Option What it does
--since <window> Time window. Default 30d.
--by <dimension> Group the breakdown. Default model.
--source, --main-only, --limit See shared options.

--by accepts:

Value Groups by
model Which model did the work — where the money goes.
source Which agent (Claude Code, etc.).
project Working directory the session ran in.
branch Git branch, so you can cost a feature.
day Daily series, for charting a trend.
effort Reasoning-effort setting.
speed Standard vs fast, which are priced differently.
thread Main conversation vs subagents.
agentabacus report                              # last 30 days, by model
agentabacus report --since all                  # everything collected
agentabacus report --since 7d --by project      # last week, by project
agentabacus report --since all --by day         # daily series, for charting
agentabacus report --by thread                  # main loop vs subagents
agentabacus report --since 6m --main-only       # 6 months, no subagents

agentabacus top

The most expensive sessions in the window.

Option What it does
--since, --source, --main-only See shared options.
--limit <n> How many sessions to list. Default 10.

agentabacus cache

Cache efficiency, with the 1-hour and 5-minute write split priced separately. Cache reads bill at 0.1× input, 5-minute writes at 1.25×, 1-hour writes at 2× — on a long session this is usually where the spend is.

Option What it does
--since, --source, --main-only See shared options.
agentabacus cache

agentabacus tools

Tool-call volume and error rate.

Option What it does
--since, --source, --main-only See shared options.
--limit <n> How many tools to list. Default 20.
agentabacus tools

agentabacus schedule

Collect automatically in the background, on an interval you choose. Uses your operating system's own scheduler.

Option What it does
(no option) Show whether auto-collection is on, and how often it runs.
--every <interval> Turn it on and run this often: 30m, 2h, 6h, 1d. Minimum 5m, maximum 7d.
--off Remove the schedule.
agentabacus schedule --every 6h    # collect every 6 hours
agentabacus schedule               # is it on?
agentabacus schedule --off         # stop
agentabacus schedule --help
Platform What gets created
macOS ~/Library/LaunchAgents/tech.agentabacus.collect.plist
Linux ~/.config/systemd/user/agentabacus-collect.timer
Windows A Task Scheduler task named agentabacus collect

Output goes to ~/.agentabacus/collect.log. Collection is incremental, so a long or short interval costs nothing and loses nothing and 6h is a good default.

This complements the Claude Code plugin rather than replacing it. The SessionEnd hook archives a session the moment it closes; the schedule also catches sessions that never exited cleanly, and every agent that has no hook at all.

agentabacus doctor

Which agents are on this machine, what has been collected, and any model in your data with no pricing row. Takes no options.

agentabacus export

Writes one file per table, plus the costed view.

Option What it does
--out <dir> Directory to write into, created if missing. Default ./agentabacus_export.
--format <fmt> parquet (typed, smaller) or csv (portable). Default parquet.

agentabacus sql

Run SQL directly against the archive. Run it with no query to print the schema, every table, view, column and row count, so you never have to guess a table name.

Argument What it does
(no argument) Print the schema and example queries, then exit.
"<SQL>" Run it. DuckDB dialect.
--schema Same as passing no query.
agentabacus sql                                                  # what can I query?
agentabacus sql "SELECT model_id, count(*) FROM turns GROUP BY 1"

Main tables: turns (one row per request), turns_costed (the same plus cost_usd — use this one when you want money), sessions, tool_calls, prompts, pricing.

Supported agents

Agent Status
Claude Code ✅ Supported
Codex CLI Open for contribution
Gemini CLI Open for contribution
OpenCode Open for contribution
Cursor Open for contribution
Cline Open for contribution
Aider Open for contribution
Others Open for contribution

agentabacus doctor detects every agent on this list that is installed on your machine, whether or not it is supported yet:

agentabacus doctor

Nothing from an unsupported agent is ever parsed, stored, or counted. An adapter is either finished and trusted or it is not there, so there is no half-supported state producing numbers you would have to decide whether to believe.

If one of these is yours, adding it is a single file.

How it works

agentabacus discovers session logs on your machine, parses them into a common schema, and stores the results in DuckDB.

Agent logs
    ↓
Discovery
    ↓
Adapters
    ↓
Normalized schema
    ↓
DuckDB
    ↓
Reports / SQL / Parquet

It also handles a few problems that can make agent usage data misleading:

  • Duplicate usage records in agent transcripts
  • Different cache pricing tiers
  • Subagent transcripts stored separately from the main session
  • Model pricing that changes over time

Data & privacy

Everything stays local.

By default, the database is stored at:

~/.agentabacus/agentabacus.duckdb

You can change the location with:

export AGENTABACUS_HOME=/path/to/data

agentabacus does not upload your prompts, responses, code, or usage data.

Prompt and response text is not stored. The database only keeps metadata such as hashes, counts, tokens, costs, and session information.

Claude Code auto-collection

Claude Code transcripts can be archived automatically when a session ends.

Install the plugin:

/plugin marketplace add tripleaceme/agentabacus
/plugin install agentabacus@agentabacus

Make sure agentabacus is available on your PATH:

pipx install agentabacus

No daemon or cron job is required.

For agents with no hook, or to catch sessions that never closed cleanly, add a schedule as well:

agentabacus schedule --every 6h

For contributors

Agent logs are not stable APIs, so adapters are designed to tolerate format changes.

A new adapter generally needs:

  1. A parser
  2. Discovery support
  3. Registration in the adapter package

See the existing adapters for examples.

Install the development dependencies and run the tests with:

pip install -e ".[dev]"
python -m pytest

Roadmap

  • More agent adapters
  • Local dashboard
  • Warehouse exports
  • dbt integration
  • GitHub Actions for usage rollups

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agentabacus-1.0.1.tar.gz (47.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agentabacus-1.0.1-py3-none-any.whl (43.7 kB view details)

Uploaded Python 3

File details

Details for the file agentabacus-1.0.1.tar.gz.

File metadata

  • Download URL: agentabacus-1.0.1.tar.gz
  • Upload date:
  • Size: 47.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for agentabacus-1.0.1.tar.gz
Algorithm Hash digest
SHA256 a9596b541f936e2d180412b8b9e8b7a06db06e12aa31352792665d3b164ec948
MD5 280f32ffaa29d470684b4684be142723
BLAKE2b-256 c5b17798ba9b8efbbbac6047c64c79451b26e3769f01718a01d645d45a5a4504

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentabacus-1.0.1.tar.gz:

Publisher: release.yml on tripleaceme/agentabacus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agentabacus-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: agentabacus-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 43.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for agentabacus-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 82ba7394f592743c95dd5eb41fb45a5bf0509054b37552f4e4b41bcfbaa53f4c
MD5 9d5efae64a95aeea0a877dfead4d72cd
BLAKE2b-256 ec0f2306488c6b61aac1cbab9eaa4a285c53f7222983dd3904fa575c9a3ab5b5

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentabacus-1.0.1-py3-none-any.whl:

Publisher: release.yml on tripleaceme/agentabacus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

1.0.3

2 files

1.0.2

2 files

This release

1.0.1 This release

2 files

1.0.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page