feat(worker): add TranscriptUsageReader for per-model token usage

Aggregates ~/.claude/projects/**/*.jsonl assistant messages by date/model/
scope (ClaudeDo worktree-or-sandbox cwd vs Other), deduped by requestId
(falls back to message.id), with a per-file length+mtime cache so repeat
calls skip unchanged files.
This commit is contained in:
mika kuns
2026-08-05 10:19:27 +02:00
parent 8d7ba1e314
commit e926f4db81
6 changed files with 395 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
namespace ClaudeDo.Worker.Usage;
public enum UsageScope
{
ClaudeDo,
Other,
}
public sealed record UsageAggregateRow(
DateOnly Date,
string Model,
UsageScope Scope,
long InputTokens,
long OutputTokens,
long CacheReadTokens,
long CacheCreationTokens,
int Messages);