Skip to main content

codex-stats

codex-stats is a local analytics tool for coding agents.

It reads local session data from every coding assistant installed on the machine and surfaces:

  • a browser dashboard with an Overview tab for every tool combined, plus one tab per tool (Codex, OpenCode, Claude Code, Hermes)
  • day, week, month, and all-time windows inside every tab
  • model and project breakdowns
  • recent session history
  • estimated token-based cost (or each tool's own recorded cost when available)
  • per-tool cost overrides and a stacked per-tool token trend on the Overview
  • anomaly-aware usage insights and recommendations
  • file-level impact tracking: a "Most Edited Files" panel showing per-file edit counts and add/delete line totals parsed from Codex and Claude Code rollouts
  • export for cross-device snapshots
  • shareable JPG cards and browser PDF export from the dashboard

Data Sources

Each source is detected automatically and skipped when no data is present:

Tool Location Notes
Codex ~/.codex state_5.sqlite + rollout JSONL files
OpenCode ~/.local/share/opencode/opencode.db recorded cost + tokens per session
Claude Code ~/.claude/projects/**/*.jsonl per-project transcripts
Hermes ~/.hermes/state.db recorded cost + tokens per session

Use these environment variables to point at non-default locations (also used for test isolation):

  • CODEX_HOME (Codex), CODEX_STATS_OPENCODE_HOME (OpenCode), CODEX_STATS_CLAUDE_PROJECTS_DIR (Claude), CODEX_STATS_HERMES_HOME (Hermes)

Install

pipx install codex-stats

Or with pip:

python3 -m pip install codex-stats

Command Reference

  • codex-stats Generate a standalone dashboard HTML file and open it in the default browser.
  • codex-stats --output codex-stats-dashboard.html Write the dashboard HTML to a fixed path.
  • codex-stats --output codex-stats-dashboard.html --no-open Write the dashboard HTML without opening the browser.
  • codex-stats --source codex --source opencode Restrict the dashboard to the given tool scopes (repeat the flag to pick multiple).
  • codex-stats export codex-stats-export.json Export normalized local stats to JSON.
  • codex-stats export codex-stats-export.json --since 30d Export only a rolling window of recent sessions.

Inside the dashboard, use the action bar to:

  • switch tools with the Overview / Codex / OpenCode / Claude Code / Hermes tab row
  • switch between Day, Week, Month, and All Time inside the active tool
  • print the active tool and window to PDF
  • download shareable JPG cards for summary, cost, focus, and project share

How It Works

codex-stats does not proxy or intercept API traffic. It reads local artifacts: Codex state_5.sqlite and rollout files, the OpenCode database, Claude Code project transcripts, and the Hermes database, then normalizes everything into one session model.

Notes

  • Costs are estimates by default. When a tool records its own cost (OpenCode, Hermes), that value wins for the session. Per-tool rates can be set in ~/.config/codex-stats/config.toml:

    [pricing.source_usd_per_1k_tokens]
    codex = 0.01
    opencode = 0.01
    claude = 0.015
    hermes = 0.008
    
  • Output depends on local file formats remaining compatible.

  • export --since Nd limits snapshots to a rolling window before sharing.

Roadmap

The current priority list lives in docs/roadmap.md.

Shareable Assets

The dashboard exports JPG cards with names like:

These sample assets were generated from the current renderer so the docs match what the dashboard actually downloads.

Development

For local development from the repo:

python3 -m venv .venv
source .venv/bin/activate
python -m pip install -U pip setuptools
python -m pip install -e .

Run without installing:

PYTHONPATH=src python3 -m codex_stats

Metadata

Release files for codex-stats 1.8.0

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

Source distribution (sdist)

Source distribution for codex-stats 1.8.0
File Size Uploaded
codex_stats-1.8.0.tar.gz 53.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for codex-stats 1.8.0
File Interpreter ABI Platform
codex_stats-1.8.0-py3-none-any.whl Python 3 none any Details

Total release size: 100.8 kB

Release files / codex_stats-1.8.0.tar.gz

Download URL codex_stats-1.8.0.tar.gz
Size 53.5 kB
Tags Source
SHA-256 checksum
How to use checksums
9cea7dd9ffaddea79d103c10cba9a94d67d7bfb7f9120e14ba0d408b4218c857
BLAKE2b-256 checksum
How to use checksums
b8749f51d483c1328d4f514f43e269b9779f3e4da13504969a105a07765045cc
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 Sep 22, 2026.

Transparency log

Release files / codex_stats-1.8.0-py3-none-any.whl

Download URL codex_stats-1.8.0-py3-none-any.whl
Size 47.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
16cda44b4833f0b3c61cd742f0cba8b47d017452d2322ac0f71a60e239b83b8d
BLAKE2b-256 checksum
How to use checksums
7fd097100bf6e18ba3f061b46f8cf82b40545e3bfd2bda0b9e598a9955848e31
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 Sep 22, 2026.

Transparency log

Release history Release notifications | RSS feed

1.11.3

2 release files

1.11.2

2 release files

1.10.0

2 release files

1.9.0

2 release files

This release

1.8.0 This release

2 release files

1.7.0

2 release files

1.6.2

2 release files

1.6.1

2 release files

1.6.0

2 release files

1.5.9

2 release files

1.5.8

2 release files

1.5.6

2 release files

1.5.5

2 release files

1.5.4

2 release files

1.5.3

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.3

2 release files

1.4.2

2 release files

1.4.1

2 release files

1.3.0

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

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