token-roi¶
Phase 1: parses a Claude Code session .jsonl, computes Effective Token Cost (ET) and
dollar cost per the shared rate card, prints a one-line turn/session report, and appends
a row to the unified ledger.
Standard: see docs/METRICS-STANDARD.md (formulas §2, savings
accounting §5, turn-line format §10). Scope for this milestone: see
docs/PHASE1-SPEC.md. Attribution/gate/report verbs are Phase 2 and
are not implemented here.
Layout¶
TokenRoi.sln
src/TokenRoi.Core/ parsing, ET/cost math, pricing table, governor/caveman readers, ledger, formatter
src/TokenRoi.Cli/ token-roi.exe — `turn` and `scan` verbs
tests/TokenRoi.Tests/ xunit + Bogus, no I/O in unit tests (streams/paths are injected)
pricing.json $/MTok rate card — VERIFY before trusting dollar outputs; rates change
Build & test¶
dotnet build TokenRoi.sln
dotnet test TokenRoi.sln
Usage¶
# Newest session in a project dir (or newest across all projects if --project-dir omitted)
token-roi turn --project-dir "C:\Users\fives\source\repos" --no-ledger
# A specific session file, and append a ledger row
token-roi turn --session <path-to-session.jsonl>
# Whole-session totals instead of just the last turn
token-roi scan --session <path-to-session.jsonl>
Ledger rows are appended to %LOCALAPPDATA%\TokenRoi\ledger.jsonl unless --no-ledger is
passed (the scan verb never writes the ledger).