ruvnet/ruflo/cost-anomaly
Claude Code and agent skill by ruvnet/ruflo
- community
Checking that the SKILL.md file is still in the repository.
MAD-based outlier detection on session spend: lists anomalous sessions with modified-z scores, with an optional --alert-on-outliers exit code for CI. Use when asked which individual session is the cost outlier; cost-burn covers the aggregate trend.
Install
npx vskill@latest install ruvnet/ruflo/cost-anomalySKILL.md
The same SKILL.md was published earlier as ruvnet/ruflo/cost-anomaly.
Per-session outlier detection — the diagnostic counterpart to cost-burn's aggregate-trend signal.
| Question | Skill | |
|---|---|---|
| "Is the AGGREGATE rate accelerating?" | cost-burn | |
| "Which SPECIFIC sessions are anomalous outliers?" | `cost-anomaly` ← this | |
| "Could we have spent less in aggregate?" | cost-counterfactual | |
| "When will we hit budget?" | cost-projection |
Algorithm
Implementation: `scripts/anomaly.mjs`.
- Read all
session-*records fromcost-trackingnamespace. - Filter to
--sincewindow (default: all-time). - Compute
median(total_cost_usd)andMAD = median(|x - median|). - Per-session modified z-score (Iglewicz-Hoaglin 1993):
z = 0.6745 * (x - median) / MAD
- Flag sessions with
|z| > --threshold(default 3.5).
Why MAD and not mean + sigma?
| Approach | What breaks | |||
|---|---|---|---|---|
mean + sigma | A single $50 session inflates BOTH mean and sigma so badly that subsequent outliers hide inside the new "normal" band. Catastrophic on small samples. | |||
median + MAD | Both estimators ignore up to 50% of the data — the outliers themselves can't shift them. Robust on n=10. The canonical cutoff `\ | z\ | > 3.5` is from Iglewicz-Hoaglin (1993). |
Smoke transcript (5 baseline sessions $0.08-$0.12 + 1 outlier $5.00)
Exit codes
CI integration
Most useful when paired with cost-burn:
Together they cover "is the average shifting?" AND "is there a single rogue session?" — both can fire independently.
Edge cases
- n < 3: emit "Insufficient data" message, exit 0. MAD on 1-2 samples is meaningless.
- MAD = 0: ≥50% of sessions share the exact same spend, so z-scores collapse. Emit explainer instead of dividing by zero. Common cause: dry-run sessions all at $0.
- Low-direction outliers: usually crashed or dropped sessions, not over-spending. The output table explicitly labels direction so operators interpret correctly.
- Very small MAD: even tiny absolute deviations produce huge z-scores. The $5 outlier with MAD=$0.01 yields z=330 — that's correct, not a bug.
Direction column
| Direction | Likely cause | Action | |
|---|---|---|---|
high | Long session, stuck in expensive tier, or runaway loop | cost report + cost conversation to investigate | |
low | Crash, dropped session, or unfinished work | Verify the session completed normally |
Security
- Security scanPassed, 90 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-anomaly/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-anomaly)