Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Per-message cost breakdown within a single session. The drill-down companion to cost-anomaly — when an outlier session is flagged, this surfaces the specific expensive messages so operators can see whether the cost came from output tokens, cache writes, or model escalations.
.claude/skills/ruvnet-cost-session/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-13 | ✗→✓ | ▲ Improved | -47% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 118% | 0% |
| case-04 | ✗→✓ | ▲ Improved | -24% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 25% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 19% | 0% |
When cost-anomaly flags a session as a >3.5σ outlier, the next question is "which MESSAGES were expensive?". cost-session answers that.
| Question | Skill | |---|---| | "Which sessions cost the most?" | cost-conversation | | "Which sessions are outliers?" | cost-anomaly | | "Which messages in THIS session were expensive?" | cost-session ← this |
Implementation: scripts/session.mjs.
--session-id <id> (scans ~/.claude/projects/*/)or --latest (default; picks most-recently-modified jsonl).
usage blocks._prices.mjs).cost_usd, surface top-N (default 20).Example real session, top message:
| # | Model | In | Out | Cache W | Cache R | Cost |
| 1 | opus-4-7 | 6 | 569 | 881898 | 0 | $16.58 |Without the Cache W column it looks like "569 output tokens cost $16" — that's wrong by 380×. The actual cost is ephemeral 1h cache write at opus pricing: 881,898 tokens × $18.75/1M = $16.54.
Operators reading the table see immediately: "the model wrote 881K tokens to ephemeral cache". From there the question becomes "why did we cache 881K tokens of context for a 6-input request?" — that's a real engineering signal.
bash# Step 1: find outliers across all sessions cost anomaly --alert-on-outliers 1 || cost anomaly # see which session-ids # Step 2: drill into the flagged session cost session --session-id <flagged-id> --top 10 # Step 3: open that jsonl at the timestamp the top message reports, # inspect the prompt + tool calls
Top of output:
| p50 (median) message | $0.85 |
| p90 message | $1.45 |
| p99 message | $1.74 |Lets operators ask "is this top message a 2× outlier or a 380× one?" without having to compute it themselves. The "top is >2× p99" footer fires when the answer is "yes, this is an in-session outlier worth investigating".
Useful for drilling into a specific time range within a long session:
bashcost session --since 2026-06-16T13:00:00Z --top 5
Only messages with timestamp >= --since are considered.
--session-id not found in any project's jsonls → exit 2 with error.--top must be a positive integer → exit 2.| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-13 | fail→pass | 12,263 | 2,407 | -80% | 1 | 1 | 0% | 2,391 | 1,259 | -47% | 0 | 0 | — |
case-01 | fail→fail | 25,943 | 2,547 | -90% | 1 | 1 | 0% | 4,069 | 1,246 | -69% | 0 | 0 | — |
case-02 | fail→fail | 10,278 | 5,321 | -48% | 1 | 1 | 0% | 2,133 | 1,137 | -47% | 0 | 0 | — |
case-03 | fail→pass | 6,675 | 8,750 | +31% | 1 | 1 | 0% | 1,146 | 2,497 | +118% | 0 | 0 | — |
case-12 | pass→pass | 5,393 | 1,986 | -63% | 1 | 1 | 0% | 1,067 | 1,134 | +6% | 0 | 0 | — |
case-04 | fail→pass | 10,624 | 3,141 | -70% | 1 | 1 | 0% | 1,844 | 1,406 | -24% | 0 | 0 | — |
case-05 | pass→pass | 9,051 | 3,513 | -61% | 1 | 1 | 0% | 1,715 | 1,450 | -15% | 0 | 0 | — |
case-06 | fail→fail | 4,516 | 4,481 | -1% | 1 | 1 | 0% | 812 | 1,659 | +104% | 0 | 0 | — |
case-07 | fail→pass | 5,303 | 2,390 | -55% | 1 | 1 | 0% | 977 | 1,218 | +25% | 0 | 0 | — |
case-08 | fail→pass | 5,408 | 1,656 | -69% | 1 | 1 | 0% | 893 | 1,067 | +19% | 0 | 0 | — |
case-09 | fail→pass | 11,401 | 1,640 | -86% | 1 | 1 | 0% | 2,048 | 1,140 | -44% | 0 | 0 | — |
case-10 | fail→pass | 6,015 | 2,119 | -65% | 1 | 1 | 0% | 1,058 | 1,222 | +16% | 0 | 0 | — |
case-11 | fail→pass | 8,422 | 6,132 | -27% | 1 | 1 | 0% | 1,525 | 1,094 | -28% | 0 | 0 | — |
case-14 | fail→pass | 10,908 | 11,645 | +7% | 1 | 1 | 0% | 2,242 | 3,030 | +35% | 0 | 0 | — |
case-15 | fail→pass | 6,967 | 2,672 | -62% | 1 | 1 | 0% | 1,207 | 1,330 | +10% | 0 | 0 | — |
case-16 | pass→pass | 8,326 | 2,591 | -69% | 1 | 1 | 0% | 1,766 | 1,334 | -24% | 0 | 0 | — |
case-17 | pass→pass | 11,826 | 5,652 | -52% | 1 | 1 | 0% | 2,085 | 1,809 | -13% | 0 | 0 | — |
case-18 | pass→pass | 8,816 | 1,223 | -86% | 1 | 1 | 0% | 1,427 | 1,021 | -28% | 0 | 0 | — |
case-19 | pass→pass | 20,698 | 2,453 | -88% | 1 | 1 | 0% | 1,881 | 1,334 | -29% | 0 | 0 | — |
case-20 | fail→fail | 8,511 | 1,383 | -84% | 1 | 1 | 0% | 1,570 | 1,060 | -32% | 0 | 0 | — |
case-21 | fail→pass | 9,205 | 5,248 | -43% | 1 | 1 | 0% | 1,721 | 1,052 | -39% | 0 | 0 | — |
case-22 | fail→pass | 9,239 | 3,214 | -65% | 1 | 1 | 0% | 1,587 | 1,388 | -13% | 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 +55 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.