Skip to main content

Module usage_signal

Module usage_signal 

Source
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§

AccountInfo
Subscription account read from ~/.claude/auth-*.json.
ActiveSession
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.
AgentUsage
DailyInstance
One (day × project) row — the better-ccusage daily --instances cross-tab.
NamedBucket
SessionRecord
TimeBucket
ToolSummary
UsageSnapshot

Functions§

collect_native