Skip to main content

agentrecap

Get deeper insights into your local coding agents beyond cost.

An agentrecap report showing usage metrics and charts

Generate a local, metadata-only HTML report from your Codex, Claude Code, OpenCode, and pi sessions.

uvx agentrecap
# or 
npx agentrecap
# or
pnpx agentrecap
# or
bunx agentrecap

If you do not have uvx or pipx installed, clone the repository and run it with Python:

git clone https://github.com/bansalarnav/agentrecap.git
cd agentrecap
python3 -m venv .venv && .venv/bin/pip install .
.venv/bin/python -m agentrecap.cli

The local virtual environment keeps agentrecap and its dependencies separate from your existing Python installation.

Overview

agentrecap only reads your session data and writes its report to a separate output directory. It will not modify your existing environment or any existing session data.

By default, agentrecap reads active and archived sessions from ~/.codex, Claude Code sessions from ~/.claude/projects, OpenCode sessions from ~/.local/share/opencode, and pi sessions from ~/.pi/agent, then writes the report to ~/.agentrecap/reports/<timestamp>/index.html. When it finishes, it asks whether you want to open the report in your browser. Use --open to open it immediately without the prompt.

agentrecap \
  --codex-input /path/to/codex/home \
  --claude-input /path/to/claude/projects \
  --opencode-input /path/to/opencode/data \
  --pi-input /path/to/pi/agent \
  --since 2026-01-01 \
  --until 2026-06-30 \
  --output-dir /path/to/report \
  --title "My agent usage report"

Use --since and --until to limit the analysis by local calendar date. Both dates are inclusive, and either flag can be used on its own. Omit both flags to analyze all available sessions.

Keeping a report running

--server builds the report and then keeps serving it at http://127.0.0.1:8973/ instead of exiting:

agentrecap --server --port 8973 --refresh-minutes 30

Once it is listening, it prints a clickable URL and asks whether to open it in your browser, the same way a one-shot run does; --open opens it without the question. The analysis reruns every 30 minutes (--refresh-minutes) into the same output directory, so the URL stays stable and the page reloads itself once a new report is ready. The page also gets a Rerun analysis button for refreshing it on demand. The server binds to localhost only, and a failed rerun leaves the previous report in place. Press Ctrl+C to stop it.

The report includes:

  • Headline recent and all-time estimated API costs alongside usage metrics.
  • Codex, Claude, OpenCode, and pi comparisons.
  • Model usage, cache ratios, reasoning-token metrics, and monthly estimated API costs.
  • Run-duration, response-gap, thread-length, token, cache, and tool-call charts.
  • Human-readable, metadata-only CSV files under the report's data/ directory, including estimated lines added and removed in loc_usage.csv.

The generated report does not include transcript contents, only metadata. Thread, run, event, agent, and tool-call identifiers are hashed before they are written.

Cost estimates

For cost estimation, agentrecap uses the pricing catalog from models.dev.

Every request is priced before model and month totals are aggregated. Estimates distinguish uncached input, cache reads, five-minute cache writes, one-hour cache writes, unclassified cache creation, output, and separately priced reasoning when available. Generic models.dev context tiers are selected from each request's complete input footprint, so model-specific 200K, 256K, 272K, and future thresholds can be honored. A bounded fallback supplies the former Anthropic long-context rates for logged Sonnet 4 and 4.5 calls over 200K before Anthropic retired that 1M-context beta on April 30, 2026.

Explicit historical fast/priority metadata uses the provider's fast-mode price from models.dev; default is treated as standard. When a historical record has no speed metadata, it remains unknown and is estimated at the standard API rate as a clearly marked fallback—today's local configuration is never applied retroactively. Claude's raw top-level costUSD, when present, is retained only as reported_cost_usd provenance. All report cards, tables, monthly totals, and displayed exports use the independently calculated estimated_cost_usd.

These are API-equivalent token estimates, not ChatGPT, Codex, Claude, or Claude Code subscription spend or credit consumption. They do not include negotiated discounts, batch pricing, or provider/platform charges not represented in the logs. Unknown model IDs and fast modes without an explicit catalog price remain unpriced rather than receiving a guessed rate.

Development

The project requires Python 3.10 or newer and uses uv for dependency and environment management.

uv sync
uv run agentrecap --help

To generate a report from local session data while developing:

uv run agentrecap --output-dir ./report

Build the source distribution and wheel with:

uv build

Metadata

Release files for agentrecap 0.9.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 agentrecap 0.9.0
File Size Uploaded
agentrecap-0.9.0.tar.gz 357.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agentrecap 0.9.0
File Interpreter ABI Platform
agentrecap-0.9.0-py3-none-any.whl Python 3 none any Details

Total release size: 420.7 kB

Release files / agentrecap-0.9.0.tar.gz

Download URL agentrecap-0.9.0.tar.gz
Size 357.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ff69232ffc9433653e753f38d5f0dfd661dca0987d066bc9c13068636fe46c16
BLAKE2b-256 checksum
How to use checksums
4427ae93c3753e3b50f4e780d875591b49a5b19ef17fd12e702634ba6b5e3f7f
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 17, 2026.

Transparency log

Release files / agentrecap-0.9.0-py3-none-any.whl

Download URL agentrecap-0.9.0-py3-none-any.whl
Size 63.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
398b05b894c583b13b3765bd61c1b4882db820599d93bac44620a83a370aa329
BLAKE2b-256 checksum
How to use checksums
a067b0497f12a296da5c109b452355bd15a141ec9b98f1b408a4ff0cd270288f
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 17, 2026.

Transparency log

Release history Release notifications | RSS feed

0.13.1

2 release files

0.13.0

2 release files

0.11.1

2 release files

0.11.0

2 release files

0.10.0

2 release files

0.9.1

2 release files

This release

0.9.0 This release

2 release files

0.8.0

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.0

2 release files

0.4.0

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

0.1.1

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