Skip to main content

CLI Consumption

CLI Consumption measures how AI coding CLIs use models, tokens, tools, conversations, and turns. It runs locally, can consolidate copied data from several machines, and can send metadata-only snapshots to a central collector.

It never stores prompts, responses, tool arguments, credentials, or raw provider events. Local token counters are usage metadata, not billing records. Read the privacy boundary before sharing a database or report.

Quick start

CLI Consumption requires Python 3.14 or newer and uses uv.

From a checkout, collect every supported CLI detected on the machine and generate a self-contained dashboard:

uv sync
uv run cli-consumption collect --provider all
uv run cli-consumption export --output reports

Open reports/dashboard.html locally. It makes no network requests. Detailed normalized CSV tables are generated only when --csv is passed.

To collect a single CLI, use its provider name. For example, with Codex:

uv run cli-consumption collect --provider codex --database usage.sqlite

From PyPI, no permanent installation is required:

uv tool run cli-consumption collect --provider all
uv tool run cli-consumption export --output reports

To run the latest unreleased GitHub source:

uv tool run --from git+https://github.com/Guillaume-Lombardo/cli-consumption \
  cli-consumption providers

Supported CLIs

--provider all detects the supported data stores found in their default locations. Use the provider name below with --provider to select one CLI explicitly.

CLI Provider name Default local source Particularities and limits
Aider aider ~/.aider/analytics.jsonl Requires opt-in analytics logging; no projects, tools, cache/reasoning split, or provider-reported durations.
Amazon Q Developer CLI amazon-q ~/.local/share/amazon-q/data.sqlite3 Persistent conversations only; request timing is available, but token counters are not.
Amp amp ~/.local/share/amp/threads/ Per-inference tokens and context windows; no subthreads, compactions, reasoning split, or latency.
Claude Code claude ~/.claude/projects/ Main sessions, tokens, tools, and compactions; no subagents, context windows, or provider-reported durations. claude-code is accepted as an alias.
Cline CLI cline ~/.cline/data/sessions/sessions.db Uses the session index and message artifacts; no costs or arbitrary task metadata.
Codex codex ~/.codex/sessions/ Richest support: timing, context pressure, settings, compactions, work items, and subagent relationships.
Continue CLI continue ~/.continue/sessions/ Token usage when present; session files lack reliable per-message timing and duration.
Crush crush ~/.local/share/crush/ Reads registered per-project SQLite stores; token counters are a latest-context snapshot, not additive usage.
Cursor CLI cursor ~/.cursor/ Composer 2 transcripts and chat metadata; no per-message time or tokens, and model attribution is incomplete.
Gemini CLI gemini ~/.gemini/tmp/ Replays active history and rewinds; hashed projects are not reversed and nested agents are excluded.
GitHub Copilot CLI copilot ~/.copilot/session-state/ Tokens are latest shutdown aggregates and cannot be assigned to individual turns.
Goose goose ~/.local/share/goose/sessions/sessions.db Supports SQLite schema v16; no legacy JSONL, subagents, reasoning tokens, or latency.
Grok Build grok ~/.grok/sessions/ Per-prompt aggregates, reasoning effort, TTFT, and auto-compactions; no costs or subagent relationships.
Kilo Code kilo ~/.local/share/kilo/kilo.db CLI SQLite store only; excludes legacy IDE tasks, cloud sessions, subagents, context windows, and costs.
Kimi Code CLI kimi ~/.kimi/sessions/ Wire v1 events, context windows, and compactions; selected model is not persisted and is reported as unknown.
Mistral Vibe CLI mistral-vibe ~/.vibe/logs/session/ Session-level token aggregates, user turns, tools, and compactions; no per-message timestamps or historical model attribution.
OpenCode opencode ~/.local/share/opencode/opencode.db SQLite v2 only; no legacy storage, child sessions, context windows, or costs.
OpenHands CLI openhands ~/.openhands/conversations/ SDK persistence with context windows, reasoning effort, and condensations; excludes cloud-only conversations and delegates.
Pi pi ~/.pi/agent/sessions/ Counts all persisted branches; no branch relationships, custom-directory auto-detection, context windows, or provider-reported durations.
Plandex plandex /plandex-server Requires an offline copy of a self-hosted PLANDEX_BASE_DIR; hosted accounts are not accessed, and models/tools are unavailable.
Qwen Code qwen ~/.qwen/projects/ Follows the active branch and records context windows and compactions; excludes archived and sidechain sessions.

Provider formats are internal and can change without notice. The detailed extraction rules and qualification versions are documented in Provider support.

Collect copied data

--source [LABEL=]PATH points to a provider home directory and can be repeated. With --provider all, each path is inspected and unmatched sources are rejected. With one provider selected, each path must contain that provider's expected store.

For example, consolidate trusted copies of Codex data from several machines:

uv run cli-consumption collect --provider codex \
  --source desktop=/data/codex/desktop \
  --source laptop=/data/codex/laptop \
  --source server=/data/codex/server \
  --database usage.sqlite

Copy only the required provider data. For Codex, copy the sessions/ directory but never auth.json or other credentials. Globally identical conversation IDs are deduplicated, and the most complete copy wins.

Map original working-directory prefixes to stable project labels with repeated --project NAME=PATH_PREFIX options. The longest matching prefix wins:

uv run cli-consumption collect --provider codex \
  --source desktop=/data/codex/desktop \
  --project cli-consumption=/home/me/dev/cli-consumption

Plandex auto-detection checks /plandex-server. For any other trusted offline copy of a self-hosted server data directory, pass the path explicitly:

uv run cli-consumption collect --provider plandex \
  --source server=/srv/plandex-server --database usage.sqlite

Explore and share reports

The dashboard can filter by time, provider, machine, project, and model. It reports activity, token composition, cache efficiency, latency and duration distributions, technical throughput, context pressure, work-item reliability, configuration cohorts, compactions, subagent delegation, and ingestion quality. Availability varies by provider, as summarized in the table above.

Generate a more shareable dashboard by pseudonymizing labels, grouping tool names, rounding timestamps to days, and hiding small cohort rows:

uv run cli-consumption export --output shared-report --share-safe

Share-safe reports still disclose aggregate work patterns and remain private operational data. A technically completed turn is not a measure of task quality or productivity.

SQLite and PostgreSQL

A file path selects SQLite. A SQLAlchemy URL selects PostgreSQL:

uv run cli-consumption collect --provider all --database usage.sqlite
uv run cli-consumption collect --provider all \
  --database postgresql+psycopg://usage@localhost/cli_consumption

Pass credentials through environment variables or a secret manager rather than shell history. CLI_CONSUMPTION_DATABASE can provide the database setting.

Central collector API

Copied files are simplest for personal or air-gapped use. For recurring collection across machines, start the metadata-only API:

export CLI_CONSUMPTION_API_TOKEN="$(your-secret-provider)"
uv run cli-consumption serve \
  --database postgresql+psycopg://usage@localhost/cli_consumption \
  --host 0.0.0.0

Then send all locally detected snapshots from another machine:

export CLI_CONSUMPTION_API_TOKEN="$(your-secret-provider)"
uv run cli-consumption sync --provider all \
  --endpoint https://usage.example.test

The application refuses to bind beyond localhost without a token. Production deployments also need TLS and standard operational controls. See Architecture for the trade-offs.

Commands

Command Purpose
collect Collect local or copied provider data into SQL.
sync Collect and send metadata-only snapshots to a central API.
serve Run the central collection API.
export Write the HTML dashboard and optional CSV tables.
providers List provider names and support status.

Run uv run cli-consumption COMMAND --help for all options.

Development

uv sync --all-groups
uv run pre-commit install
uv run pre-commit run --all-files
uv run ruff format --check .
uv run ruff check .
uv run ty check
uv run pytest --cov --cov-report=term-missing
uv build

Development uses short-lived branches and squash-merged pull requests into protected main. Read CONTRIBUTING.md and AGENTS.md before changing the project.

License

Licensed under the Apache License 2.0.

Metadata

Release files for cli-consumption 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cli-consumption 0.1.1
File Size Uploaded
cli_consumption-0.1.1.tar.gz 160.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cli-consumption 0.1.1
File Interpreter ABI Platform
cli_consumption-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 282.2 kB

Release files / cli_consumption-0.1.1.tar.gz

Download URL cli_consumption-0.1.1.tar.gz
Size 160.2 kB
Tags Source
SHA-256 checksum
How to use checksums
76a208d49b27d3ba381c263be886456d50016440da587ddebcc1f2de03e806e1
BLAKE2b-256 checksum
How to use checksums
c4b1d8a17d5c43fbfe58cca4cf0d85709b4d804384280752b73f9427e63d07fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 27, 2026.

Transparency log

Release files / cli_consumption-0.1.1-py3-none-any.whl

Download URL cli_consumption-0.1.1-py3-none-any.whl
Size 122.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8681b7bc671dc79ce0b4ee6cb02e154a2c8c78479da3503c43166905a3eea985
BLAKE2b-256 checksum
How to use checksums
96443bb08e4fba5b2b0f2126ec95c38b9f733d7058a65529a7099b569f42eddf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 27, 2026.

Transparency log

Release history Release notifications | RSS feed

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

This release

0.1.1 This release

2 release files

0.1.0

2 release files

0.0.18

2 release files

0.0.17

2 release files

0.0.16

2 release files

0.0.15

2 release files

0.0.14

2 release files

0.0.13

2 release files

0.0.12

2 release files

0.0.11

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page