Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Auto-capture per-session token usage from the Claude Code session jsonl and persist to the cost-tracking namespace
.claude/skills/ruvnet-cost-track/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-02 | ✗→✓ | ▲ Improved | 4% | 0% |
| case-03 | ✗→✓ | ▲ Improved | -58% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 82% | 0% |
| case-08 | ✗→✓ | ▲ Improved | -4% | 0% |
| case-09 | ✗→✓ | ▲ Improved | -30% | 0% |
Reads the active Claude Code session jsonl (~/.claude/projects/<encoded-cwd>/<session>.jsonl), tallies assistant-message usage per model, computes USD cost using REFERENCE.md pricing, and writes a structured record to the cost-tracking AgentDB namespace. This is the producer that gives cost-report and cost-optimize real data to consume.
/loop 30m).bash node plugins/ruflo-cost-tracker/scripts/track.mjs
The script auto-discovers the session jsonl from the current working directory. To pin a specific session: TRACK_SESSION=/path/to/session.jsonl. To dry-run (no memory write): TRACK_DRY_RUN=1.
mcp__plugin_ruflo-core_ruflo__memory_search --query "session-" --namespace cost-tracking should list the new record. cost-report step 1 reads from this namespace.cost-tracking namespace)Key: session-<sessionId>. Value (JSON):
json{ "sessionId": "1dba3b8c-...", "cwd": "/Users/cohen/Projects/ruflo", "startedAt": "2026-05-04T...", "endedAt": "2026-05-05T...", "messageCount": 234, "byModel": { "claude-opus-4-7": { "tier": "opus", "input_tokens": 12345, "output_tokens": 6789, "cache_creation_input_tokens": 800000, "cache_read_input_tokens": 2000000, "messages": 50, "cost_usd": 1.23 } }, "byTier": { "haiku": 0.0, "sonnet": 0.45, "opus": 1.23, "unknown": 0 }, "total_cost_usd": 1.68, "capturedAt": "2026-05-05T..." }
The script's PRICING constant mirrors REFERENCE.md "Model pricing (USD per 1M tokens)". Update both together when prices change. Cache-write tokens are billed at cache_write rate; cache-read tokens at cache_read (per Anthropic billing docs).
| Env | Default | Purpose | |---|---|---| | TRACK_CWD | process.cwd() | Override which project's sessions to scan | | TRACK_SESSION | most-recent jsonl | Pin a specific session file | | TRACK_OUT | unset | Also write the JSON summary to this path | | TRACK_DRY_RUN=1 | unset | Skip the memory store call | | TRACK_QUIET=1 | unset | Suppress markdown output | | TRACK_NAMESPACE | cost-tracking | Override target namespace |
cost-report (consumer) — reads records produced by this skillcost-budget-check (consumer; landing in P2) — reads totals to evaluate alerts| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→fail | 6,023 | 1,947 | -68% | 1 | 1 | 0% | 994 | 1,101 | +11% | 0 | 0 | — |
case-02 | fail→pass | 7,442 | 3,718 | -50% | 1 | 1 | 0% | 1,435 | 1,498 | +4% | 0 | 0 | — |
case-03 | fail→pass | 17,873 | 5,266 | -71% | 1 | 1 | 0% | 4,448 | 1,864 | -58% | 0 | 0 | — |
case-04 | fail→fail | 8,381 | 5,617 | -33% | 1 | 1 | 0% | 1,667 | 1,313 | -21% | 0 | 0 | — |
case-05 | fail→fail | 14,789 | 9,990 | -32% | 1 | 1 | 0% | 2,662 | 2,401 | -10% | 0 | 0 | — |
case-06 | fail→fail | 9,287 | 4,156 | -55% | 1 | 1 | 0% | 1,751 | 1,151 | -34% | 0 | 0 | — |
case-07 | fail→pass | 3,971 | 1,650 | -58% | 1 | 1 | 0% | 660 | 1,202 | +82% | 0 | 0 | — |
case-08 | fail→pass | 7,265 | 7,434 | +2% | 1 | 1 | 0% | 1,298 | 1,252 | -4% | 0 | 0 | — |
case-09 | fail→pass | 9,437 | 1,438 | -85% | 1 | 1 | 0% | 1,632 | 1,137 | -30% | 0 | 0 | — |
case-10 | fail→pass | 13,730 | 3,014 | -78% | 1 | 1 | 0% | 2,479 | 1,202 | -52% | 0 | 0 | — |
case-11 | fail→pass | 8,273 | 1,552 | -81% | 1 | 1 | 0% | 1,347 | 1,152 | -14% | 0 | 0 | — |
case-12 | fail→pass | 9,154 | 6,653 | -27% | 1 | 1 | 0% | 1,713 | 1,155 | -33% | 0 | 0 | — |
case-13 | pass→pass | 3,518 | 4,616 | +31% | 1 | 1 | 0% | 689 | 1,819 | +164% | 0 | 0 | — |
case-14 | pass→pass | 9,158 | 4,356 | -52% | 1 | 1 | 0% | 1,631 | 1,801 | +10% | 0 | 0 | — |
case-15 | fail→pass | 8,940 | 1,149 | -87% | 1 | 1 | 0% | 1,516 | 1,055 | -30% | 0 | 0 | — |
case-16 | fail→pass | 7,333 | 1,701 | -77% | 1 | 1 | 0% | 1,199 | 1,188 | -1% | 0 | 0 | — |
case-17 | fail→pass | 6,000 | 1,700 | -72% | 1 | 1 | 0% | 984 | 1,175 | +19% | 0 | 0 | — |
case-18 | fail→pass | 11,330 | 1,848 | -84% | 1 | 1 | 0% | 1,504 | 1,191 | -21% | 0 | 0 | — |
case-19 | fail→pass | 9,517 | 2,941 | -69% | 1 | 1 | 0% | 1,754 | 1,432 | -18% | 0 | 0 | — |
case-20 | pass→pass | 9,986 | 2,337 | -77% | 1 | 1 | 0% | 1,863 | 1,316 | -29% | 0 | 0 | — |
case-21 | fail→pass | 3,012 | 2,151 | -29% | 1 | 1 | 0% | 408 | 1,311 | +221% | 0 | 0 | — |
case-22 | fail→pass | 9,211 | 1,622 | -82% | 1 | 1 | 0% | 1,631 | 1,212 | -26% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted, and 21 counted toward the lift figure. The other 1 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +68 percentage points is the difference between those two pass rates over the 21 comparable cases. 1 case got worse with the skill loaded, and it is included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.