cost-anomaly
यह क्या करती है
यह स्किल ऐसे AI सत्र खोजती है जिनका खर्च आपके बाकी सत्रों की तुलना में बहुत ज़्यादा है। जो लोग जानना चाहते हैं कि कौन सा सत्र लागत में अचानक उछाल का कारण बना, उनके लिए यह है।
कब इस्तेमाल करें
- ✓जब एक AI सत्र का खर्च बाकी से कहीं ज़्यादा लगे।
- ✓जब आप अपने पूरे इतिहास में असामान्य रूप से महँगे सत्रों की सूची चाहें।
- ✓जब आप ऐसी जाँच चाहें जो असामान्य सत्र दिखने पर विफल हो जाए।
Skill का लिंक
https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-cost-tracker/skills/cost-anomaly/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“मेरे कौन से AI सत्र बाकी से कहीं ज़्यादा महँगे रहे?”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
स्किल हर सत्र के खर्च की तुलना सामान्य खर्च से करती है, ऐसे तरीके से जिसे एक बड़ा सत्र आसानी से नहीं बिगाड़ सकता। जो सत्र बाकी से बहुत ऊपर हों, उन्हें स्कोर के साथ सूचीबद्ध किया जाता है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
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)
| Sessions considered | 5 |
| Threshold (|modified z|) | 3.5 |
| Median spend | $0.100000 |
| MAD | $0.010000 |
| Min / Max | $0.080000 / $5.000000 |
| **Outliers found** | **1** |
## Outlier sessions
| Session | Spend | Deviation | Modified z | Direction |
| outlier- | $5.000000 | +$4.900000 | 330.505 | high |
Exit codes
$ cost anomaly --alert-on-outliers 1
⚠ ALERT: found 1 outlier session(s) (|modified z| > 3.5); threshold was ≥1
exit 1
$ cost anomaly --alert-on-outliers 5
✓ found 1 outlier session(s); under threshold ≥5 — OK
exit 0
CI integration
# Fail the build if any session this week is a >3.5σ outlier
cost anomaly --since 7d --alert-on-outliers 1 || investigate-bad-session
Most useful when paired with cost-burn:
cost burn --alert-on-acceleration-pct 50 || page-oncall # rate-of-change alert
cost anomaly --alert-on-outliers 1 || investigate # point-anomaly alert
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 |
अक्सर पूछे जाने वाले सवाल
असामान्य किसे माना जाता है?
जिस सत्र का स्कोर डिफ़ॉल्ट रूप से 3.5 से ऊपर हो, उसे चिह्नित किया जाता है। चलाते समय आप यह सीमा बदल सकते हैं।
क्या यह बताती है कि कोई सत्र महँगा क्यों था?
सीधे नहीं। यह असामान्य सत्र की ओर इशारा करती है, और एक साथी स्किल उस सत्र को संदेश-दर-संदेश तोड़कर दिखा सकती है।
क्या यह जाँच अपने-आप विफल हो सकती है?
हाँ। एक वैकल्पिक सेटिंग से, असामान्य सत्र होने पर यह एरर कोड लौटाती है, जो स्वचालित जाँच में उपयोगी है।
जानकारी
लेखक का मूल विवरण
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.
repo: ruvnet/ruflo
लोकप्रियता
- GitHub स्टार
- 81k
- रैंकिंग में स्थान
- #1591
- लाइसेंस
- MIT
- अपडेट की गई
- 2/11/2026
कमेंट
- …
इस repository की और skills
agent-adaptive-coordinator
81kआपके एजेंट को काम बदलने पर AI एजेंटों के समूह को बाँटने और फिर से संतुलित करने में मदद करती है, और काम के हिसाब से लेआउट चुनती है।
agent-agent
81kआपके एजेंट को बड़े लक्ष्य को क्रमबद्ध कार्यों की योजना में बदलना सिखाती है, और स्थिति बदलने पर योजना फिर से बनाना भी।
agent-agentic-payments
81kAI खरीदारी के लिए खर्च के आदेश मैनेज करने में मदद करती है, जिसमें खर्च की सीमा, समय अवधि, व्यापारी नियम और signed मंज़ूरियाँ शामिल हैं।
agent-analyze-code-quality
81kआपके एजेंट को कोड की गुणवत्ता जाँचने में मदद करती है, बिना फ़ाइलें बदले code smells, technical debt और refactoring के सुझाव खोजकर।
मिलती-जुलती skills
blucli
394kयह आपके एजेंट को blu कमांड से Bluesound और NAD स्पीकर खोजने, चलाने, रोकने, समूह बनाने और वॉल्यूम बदलने में मदद करती है।
camsnap
394kयह आपके एजेंट को नेटवर्क कैमरों और लोकल webcam से स्नैपशॉट, छोटी क्लिप या मोशन इवेंट लेने में मदद करती है, जो आपने सेट किए हों।
eightctl
394kयह आपके एजेंट को Eight Sleep pod की जांच और नियंत्रण करने में मदद करती है, जिसमें तापमान, अलार्म और नींद की समय-सारणी शामिल हैं।