Agent skill · AI & Agents

cost-session

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.

rUv71,307★ · +1,002/wk · 3 repos on radarProfile →
claude-codecodexcan modify filesMIT
Install
npx skills add ruvnet/ruflo --skill cost-session --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 1
SKILL.md size: 3 KB
Bundled scripts: none
Allowed tools: Bash
Path: plugins/ruflo-cost-tracker/skills/cost-session/SKILL.md
Open the folder on GitHub →
Where it comes from
Source: ruvnet/ruflo
Stars: 67,015 · +629 this week
Language: TypeScript
Read our review of the source →

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

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 | ## Algorithm Implementation: [`scripts/session.mjs`](../../scripts/session.mjs). 1. Resolve session jsonl: `--session-id <id>` (scans `~/.claude/projects/*/`) or `--latest` (default; picks most-recently-modified jsonl). 2. Parse all assistant messages with `usage` blocks. 3. Cost each message via shared PRICING (`_prices.mjs`). 4. Sort descending by `cost_usd`, surface top-N (default 20). 5. Compute p50/p90/p99 of message costs for in-session percentile context. 6. Flag the top message if it's >2× the p99 — that's an in-session outlier. ## Why this matters: cache writes are the silent cost 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×.

What's inside
Steps it walks through
  1. Algorithm
  2. Why this matters: cache writes are the silent cost
  3. Drill-down workflow
  4. Percentile context
  5. --since filter
  6. Edge cases
Commands it runs
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
cost session --since 2026-06-16T13:00:00Z --top 5
More from ruflo
All skills →
About this skill
What does the cost-session skill do?

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.

How do I install it?

Run `npx skills add ruvnet/ruflo --skill cost-session --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From ruvnet/ruflo, a repository with 67,015 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going