agentleFS
mfraunhofermfraunhofer/claude-skills/usage-dashboard/SKILL.md

usage-dashboard

Skill0 starsChanged 3 months agoMITView on GitHub

Local token-usage dashboard for Claude Code. Parses all session transcripts (~/.claude/projects/**/*.jsonl), aggregates usage per day / model / project / session / time-of-day / main-chat-vs-subagent, and renders a self-contained HTML dashboard with a USD cost equivalent (API list prices). Use when you want to see how much you've spent, what a day/project/model cost, or your token usage over time. NOT for the rate-limit status line (the harness renders that itself).

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Data source: every assistant line in the transcripts carries message.usage (input / output / cache_creation 5m+1h / cache_read), model, …

    line 27

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Usage Dashboard

One command, no setup:

python3 ~/.claude/skills/usage-dashboard/scripts/build_dashboard.py --open

Builds ~/.claude/cache/usage-dashboard/index.html and opens it in your browser. Without --open it only builds the file.

What it shows

  • KPIs: cost today / 7 days / 30 days / avg per day / total, plus tokens (30d)
  • Cost per day stacked by model (Opus / Fable / Sonnet / Haiku)
  • Tokens per day (output / input / cache writes): cache reads shown separately, because they dominate the volume but cost only 0.1x
  • Time-of-day profile (when you spend the most)
  • Tables: per model, per project (incl. subagent share), top 15 sessions

"Cost" = the API list-price equivalent in USD. If you're on a flat-rate plan, the number is the value you're getting out of the subscription, not a bill.

How it works

  • Data source: every assistant line in the transcripts carries message.usage (input / output / cache_creation 5m+1h / cache_read), model, timestamp (UTC), sessionId, isSidechain (subagent), and the project = top-level folder name. Subagent transcripts are nested (<session>/subagents/agent-*.jsonl), so the scan is recursive (rglob).
  • Dedupe: over (message.id, requestId): streamed responses appear as several JSONL lines with identical usage; without dedupe you'd double-count.
  • Cache = long-term history: ~/.claude/cache/usage-dashboard/cache.json.gz stores per-file records (mtime/size check → incremental, later runs take seconds). Claude Code deletes transcripts after ~30 days, entries for deleted files stay in the cache (archived: true), so your history grows from first install onward. Never delete the cache, or everything older than 30 days is gone.
  • Prices (PRICING in the script): Fable 10/50 · Opus 4.5+ 5/25 · Opus 4.0/4.1 15/75 · Sonnet 3/15 · Haiku 1/5 USD per 1M tokens. Cache writes 5m = 1.25x input, 1h = 2x input, cache reads = 0.1x input. For a new model, add a line at the top of PRICING (substring match, order = priority), costs are recomputed from raw tokens on every run, so price changes apply retroactively.
  • <synthetic> models (error placeholders) are filtered out.

Time zone

Day bucketing and the time-of-day chart use your system local time zone. Override with the TZ env var, e.g. TZ="America/New_York" python3 .../build_dashboard.py.

Notes

  • Window KPIs are calendar days, not "the last N days with data". Taking days[-30:] off the sorted day keys walks back over idle days: with 3 idle days in the range, "last 30 days" really covered 33 calendar days and read about 10% too high. window(n) filters on real calendar days instead, and avg_30 divides by elapsed calendar days rather than by the number of days that happen to have records. Build any new window KPI the same way, never off the list index.
  • The first run scans every transcript (can be a couple of GB), a line prefilter ('"usage"' in line) before json.loads keeps it to ~2 min; later runs use the mtime/size cache and finish in seconds.
  • Recursive scanning is required: a flat <project>/*.jsonl scan misses every subagent transcript.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.