Skip to content

usage-stats

Know where you standv0.1.0

Tokens, prompts and sessions on this machine, on one page.

claude: usage-stats
What you are seeing Typing /usage-stats opens a side pane with 371.8M tokens in 30 days, a daily chart, and totals by project and by model.

Install

o-mods
  1. Add the o-mods collection (once):

    claude plugin marketplace add omeerdvrn/o-mods

  2. Install this mod:

    claude plugin install usage-stats@o-mods

Then run /reload-plugins in any open Claude Code session.

First time? Set up o-mods

Author
omeerdvrn
Version
0.1.0
License
MIT
Tags
usage, tokens, metrics, dashboard, linear
Source on GitHub
Source on GitHub

A Claude Code mod that shows your Claude Code usage on this machine. Type /usage-stats to open it. It never opens on its own. It opens as a side pane, brought to the front; where no pane can be shown, the same receipt is printed into the conversation.

Usage                                        7d  30d  All  ⟳

▀█  ▀▀█   █▀█ █▀▄
 █    █   █▀█ █▀▄
▀▀▀   ▀ ▀ ▀▀▀ ▀▀
tokens in the last 30 days

816 prompts   104 sessions   71 issues closed

          ▄▄▄▄  ▃▃                          ▅▅          ██▅▅
▄▄▃▃▃▃  ▃▃████▅▅██▆▆    ▇▇██▂▂▆▆▁▁  ▁▁██▄▄████▅▅    ▁▁▆▆████
Sep 9                                                  Oct 8

Projects
webapp ······································  10.8B    61%
shop-api ····································   3.8B    21%

Models
████████████████████████████████████████████████████████████
■ Opus 5 45%   ■ Opus 5.5 42%   ■ Sonnet 5 7%   ■ other 7%

Busiest day ········································  Oct 7
Busiest hour ···································· Thu 15:00
Top issue ··········································· ENG-4

It reads like a receipt:

  • The total: tokens in the range, in large block digits, then prompts, sessions and Linear issues closed.
  • The range: tokens per day across the range.
  • Projects: tokens and share per repository. A worktree counts toward its repository.
  • Models: each model's share of tokens.
  • Busiest moments: the busiest day, the busiest hour of the week, the issue with the most tokens, and the points you closed.

Press 7d, 30d or All to change the range; the choice is kept. Press ⟳ to read the logs again.

Where the numbers come from ​

  • Tokens, prompts, sessions: Claude Code's session logs in ~/.claude/projects, read by scanner/scan.py. Each API response is counted once, and subagents' logs are included.
    • The first scan reads every log, which takes a few seconds. After that, only new or changed logs are read.
    • The scanner caches its results in ~/.claude/usage-stats/cache.json.
  • Issues closed: your Linear connection (claude.ai Linear by default). Set linearServer in /config to use another server, or leave it empty to hide the section.
  • Claude Code removes old session logs, so "All time" goes back as far as the logs on this machine.

Nothing leaves your machine except the Linear request.

Requirements ​

  • Python 3, as python3
  • Linear connected to Claude, for the issues closed section

Development ​

claude --plugin-dir /path/to/o-mods/mods/usage-stats
claude plugin validate .
claude plugin test .
python3 scanner/scan.py | head -c 400
FileContents
hooks/register.tsxThe /usage-stats command, the scan and Linear calls, and the view
hooks/stats.tsRanges, totals and rankings from the scan
hooks/charts.tsBlock digits, dotted leaders, the sparkline and the proportion bar
scanner/scan.pyReads the session logs and prints aggregates as JSON
types/index.d.tsThe mod's state contract
tests/usage-stats.test.tsTests with the scanner and Linear faked

Edit this page on GitHub