cost-counterfactual
Multi-baseline counterfactual cost analysis. Compares actual session spend to hypothetical always-haiku / always-sonnet / always-opus routing baselines. Answers "is the routing earning its keep?" Negative savings flag over-escalation; positive savings quantify the router's win.
npx skills add ruvnet/ruflo --skill cost-counterfactual --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
Multi-baseline counterfactual cost analysis. Pairs with the existing observability surface: - **`cost-budget-check`** — "have we crossed a threshold?" (reactive) - **`cost-projection`** — "when will we cross a threshold?" (predictive) - **`cost-counterfactual`** — "is the routing earning its keep?" (comparative) ← this one ## Algorithm 1. Read all `session-*` records from the `cost-tracking` namespace. 2. Apply `--since` window filter (default all-time). 3. Sum tokens across `byModel[*]` entries for each session. 4. For each requested baseline (default: all three): - `counterfactualUsd = (input × tier.input + output × tier.output + cache_write × tier.cache_write + cache_read × tier.cache_read) / 1M` 5. Compute `savings = counterfactualUsd − actualUsd`. 6. Emit per-baseline totals + savings % across the comparison set. ## Smoke transcript (2 sessions: 50K haiku tokens + 50K sonnet tokens) ``` | Sessions considered | 2 | | Total input tokens | 100,000 | | Actual spend | $0.162500 | | Baseline | Hypothetical | Actual | Savings | % | | `always-haiku` | $0.025000 | $0.162500 | -$0.137500 | -550.00% | | `always-sonnet` | $0.300000 | $0.162500 | +$0.137500 | 45.83% | | `always-opus` | $1.
- Algorithm
- Smoke transcript (2 sessions: 50K haiku tokens + 50K sonnet tokens)
- How to read negative savings
- When to use
- Stationarity caveat
What does the cost-counterfactual skill do?
Multi-baseline counterfactual cost analysis. Compares actual session spend to hypothetical always-haiku / always-sonnet / always-opus routing baselines. Answers "is the routing earning its keep?" Negative savings flag over-escalation; positive savings quantify the router's win.
How do I install it?
Run `npx skills add ruvnet/ruflo --skill cost-counterfactual --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.