cost-track
यह क्या करती है
यह स्किल आपके चालू AI कोडिंग सत्र का लॉग पढ़ती है और उसके टोकन उपयोग और लागत का रिकॉर्ड सहेजती है। जो लोग समय के साथ अपने AI खर्च का हिसाब रखना चाहते हैं, उनके लिए यह है।
कब इस्तेमाल करें
- ✓जब आप बड़ा काम पूरा करें और दर्ज करना चाहें कि उसकी लागत कितनी रही।
- ✓जब आप सत्र के अंत में अंतिम कुल योग सहेजना चाहें।
- ✓जब लंबे सत्र के दौरान नियमित शेड्यूल पर खर्च जाँचना हो।
Skill का लिंक
https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-cost-tracker/skills/cost-track/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“यह सत्र कितना महँगा रहा, यह दर्ज कीजिए, ताकि मैं बाद में अपनी रिपोर्ट में देख सकूँ।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
स्किल सक्रिय सत्र लॉग ढूँढती है, हर मॉडल के टोकन उपयोग को जोड़ती है, एक कीमत सूची से लागत निकालती है और कुल योग सहेजती है। आप इसे ड्राई रन के रूप में भी चला सकते हैं, जो कुछ सहेजता नहीं।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Cost Track
Reads the active Claude Code session jsonl (~/.claude/projects/<encoded-cwd>/<session>.jsonl), tallies assistant-message usage per model, computes USD cost using REFERENCE.md pricing, and writes a structured record to the cost-tracking AgentDB namespace. This is the producer that gives cost-report and cost-optimize real data to consume.
When to use
- After a meaningful chunk of work, to capture spend for the report.
- At session-end to persist the final tally.
- Periodically during long sessions (cron-friendly — see
/loop 30m).
Steps
Run the tracker from the project root:
node plugins/ruflo-cost-tracker/scripts/track.mjsThe script auto-discovers the session jsonl from the current working directory. To pin a specific session:
TRACK_SESSION=/path/to/session.jsonl. To dry-run (no memory write):TRACK_DRY_RUN=1.Inspect the markdown summary — total cost, per-model and per-tier breakdowns, and the persisted memory key.
Verify persistence —
mcp__plugin_ruflo-core_ruflo__memory_search({ query: "session-", namespace: "cost-tracking" })should list the new record.cost-reportstep 1 reads from this namespace.
Record shape (in cost-tracking namespace)
Key: session-<sessionId>. Value (JSON):
{
"sessionId": "1dba3b8c-...",
"cwd": "/Users/cohen/Projects/ruflo",
"startedAt": "2026-05-04T...",
"endedAt": "2026-05-05T...",
"messageCount": 234,
"byModel": {
"claude-opus-4-7": {
"tier": "opus",
"input_tokens": 12345,
"output_tokens": 6789,
"cache_creation_input_tokens": 800000,
"cache_read_input_tokens": 2000000,
"messages": 50,
"cost_usd": 1.23
}
},
"byTier": { "haiku": 0.0, "sonnet": 0.45, "opus": 1.23, "unknown": 0 },
"total_cost_usd": 1.68,
"capturedAt": "2026-05-05T..."
}
Pricing source of truth
The script's PRICING constant mirrors REFERENCE.md "Model pricing (USD per 1M tokens)". Update both together when prices change. Cache-write tokens are billed at cache_write rate; cache-read tokens at cache_read (per Anthropic billing docs).
Env overrides
| Env | Default | Purpose |
|---|---|---|
TRACK_CWD |
process.cwd() |
Override which project's sessions to scan |
TRACK_SESSION |
most-recent jsonl | Pin a specific session file |
TRACK_OUT |
unset | Also write the JSON summary to this path |
TRACK_DRY_RUN=1 |
unset | Skip the memory store call |
TRACK_QUIET=1 |
unset | Suppress markdown output |
TRACK_NAMESPACE |
cost-tracking |
Override target namespace |
Cross-references
cost-report(consumer) — reads records produced by this skill- REFERENCE.md "Cost attribution formula" — the math the script implements
cost-budget-check(consumer; landing in P2) — reads totals to evaluate alerts
अक्सर पूछे जाने वाले सवाल
सत्र लॉग कहाँ मिलता है?
यह आपके Claude Code फ़ोल्डर में उस प्रोजेक्ट के लिए ढूँढता है जिस पर आप काम कर रहे हैं, जब तक आप कोई फ़ाइल न बताएँ।
क्या मैं बिना सहेजे इसे परख सकता हूँ?
हाँ। ड्राई-रन सेटिंग नतीजे दिखाती है, पर मेमोरी में कुछ नहीं लिखती।
इस डेटा का इस्तेमाल कौन सी रिपोर्ट करती है?
लागत रिपोर्ट और लागत ऑप्टिमाइज़ेशन स्किल वे रिकॉर्ड पढ़ती हैं जो यह स्किल सहेजती है।
जानकारी
लेखक का मूल विवरण
Auto-capture per-session token usage from the Claude Code session jsonl and persist to the cost-tracking namespace
repo: ruvnet/ruflo
लोकप्रियता
- GitHub स्टार
- 81k
- रैंकिंग में स्थान
- #1611
- लाइसेंस
- 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 की जांच और नियंत्रण करने में मदद करती है, जिसमें तापमान, अलार्म और नींद की समय-सारणी शामिल हैं।