cost-diff
Snapshot delta between two cost-summary JSON outputs. PR-level cost regression detection — answers "what changed between these two specific snapshots?". Pairs with cost-summary's stable JSON contract.
npx skills add ruvnet/ruflo --skill cost-diff --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.
PR-level cost regression detection. Where cost-counterfactual compares to HYPOTHETICAL baselines (always-haiku/sonnet/opus) and cost-burn compares latest bucket to PRIOR MEAN, cost-diff compares two SPECIFIC known-good snapshots. | Question | Skill | |---|---| | "What would we have spent at always-X?" | `cost-counterfactual` | | "Is daily burn accelerating vs prior mean?" | `cost-burn` | | "Did THIS PR add spend vs main?" | **`cost-diff`** ← this | ## Algorithm Implementation: [`scripts/diff.mjs`](../../scripts/diff.mjs). Consumes the stable JSON contract from `cost summary --format json`. 1. Load `--baseline` and `--current` JSON snapshots. 2. Sanity check: both must have `total_cost_usd` + `sessionCount` (cost-summary shape). 3. Per-key delta: `byTier` (haiku/sonnet/opus) and `byModel` (each model). 4. Each entry tagged `added` / `removed` / `changed` based on baseline / current zero-ness. 5. Sort table by `|delta|` descending so the biggest movers are at the top. 6. `--alert-on-pct N`: exit 1 when `total_pct > N`. 7. `--alert-on-usd N`: exit 1 when `total_delta_usd > N`. Both can be set; first to trigger wins. ## PR-gate workflow ```bash # Capture baseline (e.g. on main, via the
- Algorithm
- PR-gate workflow
- --alert-on-class-pct (iter 86)
- Smoke transcript (synthetic baseline + current)
- Exit codes
- Status column
- Composition with cost-summary
Capture baseline (e.g. on main, via the cost-tracker-smoke CI workflow) cost summary --format json > baseline.json On the PR branch, capture current state cost summary --format json > current.json cost diff --baseline baseline.json --current current.json \ cost diff --baseline ... --current ... \
What does the cost-diff skill do?
Snapshot delta between two cost-summary JSON outputs. PR-level cost regression detection — answers "what changed between these two specific snapshots?". Pairs with cost-summary's stable JSON contract.
How do I install it?
Run `npx skills add ruvnet/ruflo --skill cost-diff --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.