CLI for tracking AI agent task metrics: token cost, retry pressure, and outcome quality.
Project description
ai-agents-metrics
Analyze your AI agent work history. Track spending. Optimize your workflow.
AI is writing more of your code. You still don't know:
- How many attempts each task actually takes
- Where the process breaks down and why
- Whether your workflow is getting faster or generating more rework
ai-agents-metrics extracts these signals from your existing Claude Code or Codex history — no manual setup required. Point it at your history files and see what's happening: retry pressure, token cost, session timeline. For richer tracking, add explicit goal boundaries and outcome labels on top.
Running this on 6 months of Claude Code + Codex history (3.85B tokens, 160 threads) surfaced:
- 100% of Claude "retries" are subagent spawns, not user retries —
attempt_count > 1is structural, not a failure signal (F-001)- Subagent delegation halves main-session tokens within-thread — median 2.05× compression, p = 0.000456 (F-007)
- Per-skill compression ranking —
Explore2.63×,code-reviewer3.25×,commit0.72× (F-008)Full index: docs/findings/. N=1 developer; the mechanisms generalize because they come from the tools, not the data.
Quick start
pipx install ai-agents-metrics
ai-agents-metrics history-update # reads ~/.codex + ~/.claude by default
ai-agents-metrics show # retry pressure, cost, session timeline
ai-agents-metrics render-html # interactive HTML report
Non-default history paths, full command list, and manual goal tracking (optional): CLI reference.
What you get
- History extraction — retry pressure, token cost, model usage from existing session files. No setup.
- HTML report — one self-contained file, summary strip + 5 trend charts, opens in any browser.
- Optional manual tracking — add goal boundaries and outcome labels on top of history for per-task breakdowns.
Not a benchmark, not an eval framework, not a model comparison tool. It is a local analysis tool for real engineering work done with AI.
Privacy
All data stays local. Writes only to:
.ai-agents-metrics/warehouse.db— local SQLite warehouse used by the history pipelinemetrics/events.ndjson— append-only event log for manual goal tracking (opt-in)docs/ai-agents-metrics.md— optional markdown export (regenerated on demand)
No data is sent to any remote service.
Links
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ai_agents_metrics-0.2.1.tar.gz.
File metadata
- Download URL: ai_agents_metrics-0.2.1.tar.gz
- Upload date:
- Size: 462.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d83ff33430288ba777f2fd077aa249b087544065ae245ab70903f386929d308
|
|
| MD5 |
bd4abb841cb0b0740fb48175b16a26f4
|
|
| BLAKE2b-256 |
348b14e6ae7a6f780879d5a0b411d94507020c98037341ca83731ce2b1debe51
|
Provenance
The following attestation bundles were made for ai_agents_metrics-0.2.1.tar.gz:
Publisher:
publish.yml on sg4tech/ai-agents-metrics
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ai_agents_metrics-0.2.1.tar.gz -
Subject digest:
9d83ff33430288ba777f2fd077aa249b087544065ae245ab70903f386929d308 - Sigstore transparency entry: 1342557352
- Sigstore integration time:
-
Permalink:
sg4tech/ai-agents-metrics@006a47aec02ab12c5f31bb8238e063f70f6add25 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/sg4tech
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@006a47aec02ab12c5f31bb8238e063f70f6add25 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ai_agents_metrics-0.2.1-py3-none-any.whl.
File metadata
- Download URL: ai_agents_metrics-0.2.1-py3-none-any.whl
- Upload date:
- Size: 147.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e8a6e6fa5d5a95bf274df0d8b43fe2cc80844630714d3fdf3d9a88966ad22f88
|
|
| MD5 |
36b998306c3d065694990f7d34b4df94
|
|
| BLAKE2b-256 |
24e0d02a07f3414dfabd4e39d2f02a6de4e24d188c7cc8c4a5ba71bfb6ac3dc2
|
Provenance
The following attestation bundles were made for ai_agents_metrics-0.2.1-py3-none-any.whl:
Publisher:
publish.yml on sg4tech/ai-agents-metrics
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ai_agents_metrics-0.2.1-py3-none-any.whl -
Subject digest:
e8a6e6fa5d5a95bf274df0d8b43fe2cc80844630714d3fdf3d9a88966ad22f88 - Sigstore transparency entry: 1342557360
- Sigstore integration time:
-
Permalink:
sg4tech/ai-agents-metrics@006a47aec02ab12c5f31bb8238e063f70f6add25 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/sg4tech
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@006a47aec02ab12c5f31bb8238e063f70f6add25 -
Trigger Event:
push
-
Statement type: