Agent Cost Report
Turns Claude Code transcript tokens into a manager-readable dollar report with cost per completed outcome, waste, and labeled estimates.
Data & AnalyticsAdvanced★ 94,740⑂ 8,379AI score 7/10Last updated: Sep 26, 2026
What it does
- Parses
~/.claude/projects/**/*.jsonltranscripts, dedupes assistant replies, sums real token usage (input, output, cache write 5m/1h, cache read) and prices it with OpenRouter public list prices fetched at run time. - Labels every figure as Measured / Estimated / Extrapolated / Unavailable — never reports "$0 spent" for unknown data, and keeps the note-taker (observer) cost out of the headline.
- Groups sessions into work items, assigns one of six work categories and a separate
failure_type(Looping, Hedging, Rework, Regression, Unauthorized action, …), then computes waste rate, recovery share and cost per completed outcome. - Emits a run directory with a self-contained
report.html,report.pdf,report.json,line-items.csv,evidence.jsonandlabels.review.jsonfor a human/LLM review pass. - Default window is the last 7 full PT days, excluding today; override with
--session,--project, or--start/--end.
Who it's for
- Team leads running Claude Code with the claude-mem plugin who must report weekly AI spend upward.
- Engineers who want hard numbers on where agent turns were wasted (looping, rework, wrong model).
- Anyone building a reporting pipeline with only the Python 3.9+ standard library (no pip installs).
Example uses
- "Give me this week's agent cost report" → runs prices → collect → rollup → render on the default 7-day PT window and returns the HTML/PDF paths.
- "Only the claude-mem project, Sep 1–8" →
collect --project claude-mem --start 2026-09-01 --end 2026-09-08and a scoped report. - "Was this session worth it?" →
--session <id>produces the session's estimated cost, wasted turns and any blocked unauthorized actions with evidence IDs.
· · · Install guide · · ·
Try it now, no install
Paste this into Claude to use the skill without installing anything.
Read the instructions in this file and follow them to help me: https://raw.githubusercontent.com/thedotmack/claude-mem/HEAD/claude-mem-grok-bot/skills/agent-cost-report/SKILL.md What I want: (describe your task here)
If Claude can't open the link, open it yourself and paste the contents instead.
↓ If it works for you, download the ZIP below and install it. Then it runs on its own — no pasting each time.
Install in the Claude app (no terminal)
- Download the ZIP with the button below.
- In Claude, open Settings → Capabilities and turn on 'Code execution and file creation'. (one time)
- Go to Customize → Skills → + → 'Upload a skill' and upload the ZIP.
Install in Claude Code
Let Claude do it — paste this into Claude Code
Install the skill I found on Claude Skill Mart. Copy the claude-mem-grok-bot/skills/agent-cost-report folder from the GitHub repo thedotmack/claude-mem into my ~/.claude/skills/thedotmack-agent-cost-report/. When it's done, tell me in one line what this skill can do.
Install with a command instead
git clone https://github.com/thedotmack/claude-mem.git && mkdir -p ~/.claude/skills && cp -r claude-mem/claude-mem-grok-bot/skills/agent-cost-report ~/.claude/skills/⚠ This is a third-party skill. Check the source repository before installing.
- Open a terminal in a working directory.
- Clone the repo:
git clone https://github.com/thedotmack/claude-mem.git - Copy the skill into place:
mkdir -p ~/.claude/skills && cp -r claude-mem/claude-mem-grok-bot/skills/agent-cost-report ~/.claude/skills/ - Verify
python3 --versionis 3.9 or newer — no extra packages are required. - For PDF output, make sure headless
google-chromeis installed; without it you still get the canonical HTML. - Enable the claude-mem plugin and its
mem-searchMCP tools so the evidence review step can run. - Restart Claude Code and ask for "an agent cost report".
- Optional: to show measured provider spend, pass a plain inference
OPENROUTER_API_KEYas an environment variable only (never in a settings file). Without it the report simply reads "measured spend unavailable".
View source on GitHub ↗License: Apache-2.0