agent-stat
v0.1.4
Published
Terminal analytics for local AI coding sessions from Codex and Claude logs.
Maintainers
Readme
Agent Stats CLI
Terminal analytics for local AI coding sessions from Codex and Claude logs.
What It Does
- Scans local session logs from:
~/.codex/sessions~/.codex/archived_sessions~/.claude/projects(excludingsubagents)
- Shows:
- Total sessions
- Estimated spend
- Tokens (input + output only, cached tokens excluded from displayed totals)
- Today / last 7 days / last 30 days / all-time summaries
- Model and provider breakdowns
- Activity patterns
- Recent sessions
- Live auto-refresh monitor
- Includes interactive dashboard view with range switching (
all,30d,7d) - Checks npm for updates and shows an upgrade hint when available
Install
Run once (no install):
npx agent-stat@latestInstall globally:
npm i -g agent-statQuick Start
agent-statRunning with no command opens the interactive menu (TTY).
Commands
agent-stat [menu|dashboard|summary|live|models|providers|activity|recent|update] [--json]menu- interactive menu (default in TTY)dashboard- unified overview + models withall/30d/7drange switchsummary- today, 7d, 30d, all-time totalslive- auto-refresh live monitormodels- top models by spend/tokensproviders- Codex vs Claude breakdownactivity- hourly + weekday usage viewrecent- recent session tableupdate- self-update via npm--json- output full analytics snapshot JSON-h, --help- help-v, --version- version
Keyboard Controls (Interactive)
- Global/menu:
j/kor↑/↓to moveEnterto selectqto quitrto refresh data
- Dashboard:
1all-time2last 30 days3last 7 daysTabor←/→to cycle rangesbback to menu
- Live view:
- Auto-refresh every ~2s
bback,qquit
No Data / Missing Folders
The CLI fails gracefully when one or both local folders are missing.
- If neither exists, you get a clear warning with expected paths.
- If one is missing, stats are still computed from the available source.
Pricing Notes
- Cost is estimated from model pricing constants in
dist/cli.js. - Displayed token totals intentionally exclude cached tokens.
- Unknown/unpriced models are surfaced in output where relevant.
Development
node --check dist/cli.js
node dist/cli.js --help
node dist/cli.js summary
node dist/cli.js dashboardPublish to npm
npm login
npm whoami
npm publish --access publicIf your account enforces 2FA, publish with a token or OTP per npm policy.
Package
- npm package:
agent-stat - binary:
agent-stat
