Repository navigation
Commit ebb7760
feat(fetcher): add codex_usage — local Codex CLI session rollup
Walks `~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl` (or `$CODEX_HOME/sessions/...`)
via the helpers shipped in the family scaffold, extracts per-turn token usage
from each `event_msg` of type `token_count`, and aggregates by project / model
/ day. The `turn_context` event that precedes each turn carries the model id
and `cwd`; we thread that state forward as we parse so usage gets attributed
to the right turn.
Shape coverage matches `claude_code_usage`: Text / TextBlock /
MarkdownTextBlock / Entries / Bars / NumberSeries / Badge (seven). Options
mirror it too — `since` (today/7d/30d/all), `limit`, `group_by`
(project/model/day). `Safety::Safe` — every read is local; unknown models
contribute $0 rather than hiding their token activity behind an error.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>1 parent b8c1be2 commit ebb7760
2 files changed
Lines changed: 844 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
| 3 | + | |
| 4 | + | |
5 | 5 | | |
6 | | - | |
7 | | - | |
| 6 | + | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
16 | | - | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
28 | 34 | | |
29 | 35 | | |
0 commit comments