ruvnet/ruflo/cost-diff
Claude Code and agent skill by ruvnet/ruflo
- community
Checking that the SKILL.md file is still in the repository.
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.
Install
npx vskill@latest install ruvnet/ruflo/cost-diffSKILL.md
The same SKILL.md was published earlier as ruvnet/ruflo/cost-diff.
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`. Consumes the stable JSON contract from cost summary --format json.
- Load
--baselineand--currentJSON snapshots. - Sanity check: both must have
total_cost_usd+sessionCount(cost-summary shape). - Per-key delta:
byTier(haiku/sonnet/opus) andbyModel(each model). - Each entry tagged
added/removed/changedbased on
baseline / current zero-ness.
- Sort table by
|delta|descending so the biggest movers are at the top. --alert-on-pct N: exit 1 whentotal_pct > N.--alert-on-usd N: exit 1 whentotal_delta_usd > N.
Both can be set; first to trigger wins.
PR-gate workflow
The combination of both flags catches:
- Percent-only fires: a small absolute change but a meaningful shift
(e.g. doubling from $0.10 to $0.20 hits +100% but only +$0.10).
- USD-only fires: a large absolute change with a small percent
(e.g. growing from $100 to $110 is only +10% but +$10).
Either signal can fail the PR independently — they're OR'd.
--alert-on-class-pct (iter 86)
The two USD-level thresholds above miss a regression class: when ONE token type grows disproportionately even though total spend grows modestly. Example: a PR introduces a verbose context-cache pattern, total spend grows only 10% (under --alert-on-pct 50), but cache_write tokens grow 900%. The iter-82 driver hides inside the USD signal.
--alert-on-class-pct cache_write:50 exits 1 when cache_write tokens grow more than 50% baseline → current. Multiple classes can be checked in one flag (comma-separated):
First class to breach wins. Valid classes: input | output | cache_write | cache_read.
Recommended PR-gate triad:
Three orthogonal signals — pct (total grew), usd (large absolute jump), class-pct (composition shifted). Each catches what the others miss; AND-of-OR semantics means any one firing fails the PR.
Smoke transcript (synthetic baseline + current)
Notice the table is sorted by absolute delta, not alphabetically — the biggest mover (opus newly added) bubbles to the top. Operators reading top-down see "what mattered" first.
Exit codes
| Exit | Meaning | |
|---|---|---|
| 0 | No alert, OR no thresholds set | |
| 1 | --alert-on-pct or --alert-on-usd threshold exceeded | |
| 2 | Config error (missing files, invalid JSON, malformed snapshot) |
Status column
| Status | Meaning | |
|---|---|---|
added | This tier/model was $0 in baseline, >$0 in current | |
removed | This tier/model was >$0 in baseline, $0 in current | |
changed | Both baseline and current >$0; delta is the difference |
Entries with baseline === 0 && current === 0 are dropped (nothing to report).
Composition with cost-summary
cost-diff is the SECOND HALF of a contract that cost-summary started: the stable JSON shape from cost summary --format json. Both pieces have been frozen — adding fields to summary is fine; renaming or removing isn't.
If you're consuming snapshots elsewhere (dashboards, alerting), the same shape works — cost-diff is just one consumer.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingplugins/ruflo-cost-tracker/skills/cost-diff/SKILL.md
Popularity
- Repository stars
- 67,355
- Repository forks
- 8,058
- 7-day trend score
- 56
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/ruvnet/ruflo/cost-diff)