Usage Audit

Cross-client token and session accounting. Every AI agent client records what it consumed — Claude Code per-message usage JSONL, Codex token_count events, OpenCode per-session token columns — but none shows the cross-client total. Reads the same local stores as session-handoff (read-only, nothing uploaded) and reports tokens by model, client, and project, with an optional budget gate.

trac3r00 d8c36ba 2 files · 8.5 KB Updated

File contents

Usage Audit

You cannot manage what no client will show you: cross-client, cross-project token consumption, from the logs already on your disk.

Commands

python3 scripts/usage_audit.py                        # last 30 days, by model
python3 scripts/usage_audit.py --by project           # where tokens go
python3 scripts/usage_audit.py --by client --since 7  # which client burns most
python3 scripts/usage_audit.py --budget-tokens 50000000 || notify  # tripwire
python3 scripts/usage_audit.py --json                 # full report, all groupings

Stores read (read-only, local)

Client Source
Claude Code ~/.claude/projects/*/*.jsonl per-message usage blocks
Codex ~/.codex/sessions/**/rollout-*.jsonl final token_count totals
OpenCode / OMO opencode.db session token columns

Missing stores are skipped silently. Cache tokens are tracked separately from input/output so cached-heavy workflows read honestly.

Pairs with

context-budget (why is per-turn cost high) answers the static question; usage-audit answers the historical one (where did tokens actually go). session-handoff shares the same store-reading conventions.

trac3r00/agent-skills/tree/main/skills/usage-audit commit d8c36ba8b0

Frequently asked questions

npx skillmds@latest add trac3r00/usage-audit