Expand description
Cross-project agent usage signals.
Reads Claude Code (~/.claude/projects/**/*.jsonl) and Codex CLI
(~/.codex/sessions/**/*.jsonl) transcript files to summarize token usage
over a rolling 5-hour session and 7-day week, plus the most recent turn’s
context-window utilization. Output drives the HUD surface.
Implementation note: the heavy lifting lives in usage_signal.py invoked
through process:exec. The Rust side validates the JSON envelope and
returns a typed snapshot. On systems without python3 (or where the
script aborts) the snapshot is empty and the HUD degrades gracefully.
Structs§
- Account
Info - Subscription account read from
~/.claude/auth-*.json. - Active
Session - One in-flight session for an agent — a JSONL file whose last turn is within ACTIVE_WINDOW (currently 30 minutes). Multiple of these can be live at the same time when the user runs 3-5 sessions in parallel.
- Agent
Usage - Daily
Instance - One (day × project) row — the
better-ccusage daily --instancescross-tab. - Named
Bucket - Session
Record - Time
Bucket - Tool
Summary - Usage
Snapshot