Skip to content

Commit 9a0111d

Browse files
unhappychoiceclaude
andcommitted
feat(fetcher): add claude_code_usage — local Claude Code session rollup
Walks the `<root>/projects/<encoded-cwd>/<session-uuid>.jsonl` files Claude Code writes for every assistant turn, deduplicates by `(message.id, requestId)` (higher token total wins on collision), then groups by project / model / day depending on `group_by`. Pricing is hardcoded in `claude/common.rs` (Opus / Sonnet / Haiku families plus the legacy `claude-3-*` aliases), so the splash works offline. Refresh interval is 5 minutes — fast enough to reflect a freshly-spent session, slow enough not to re-walk MBs on every `cd`. 7 shapes: - Text — `"Today: 17.0M tokens / \$52.70"` headline - TextBlock / MarkdownTextBlock / Entries — per-group rows - Bars — value=tokens (chart_bar ranks correctly), value_label=`\$cost` - NumberSeries — daily token total time series - Badge — cost tier (Ok < \$10 / Warn < \$50 / Error ≥ \$50) Options: `since` (`today` / `7d` / `30d` / `all`), `group_by` (`project` / `model` / `day`), `limit` (1..=50). `Safety::Safe`, no network. Family scaffold lives in `src/fetcher/claude/` (mod + common + code_usage); the family is plumbed into `Registry::with_builtins`. Catalog: #64 AI / LLM — local agent activity. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
1 parent 2a2e1fd commit 9a0111d

4 files changed

Lines changed: 1180 additions & 0 deletions

File tree

0 commit comments

Comments
 (0)