jaysonpantollana/citadel/cost-tracking
- community
Checking that the SKILL.md file is still in the repository.
Track and report Claude Code token usage, spending, and budgets from the local ECC cost-tracker metrics log. Use when the user asks about costs, spending, usage, tokens, budgets, or cost breakdowns by model, session, or date.
Install
npx vskill@latest install jaysonpantollana/citadel/cost-trackingSKILL.md
The same SKILL.md was published earlier as affaan-m/everything-claude-code/cost-tracking.
Cost Tracking
Use this skill to analyze Claude Code cost and usage history from the metrics log that ECC's stop:cost-tracker hook writes.
Where the data lives
The tracker appends one JSON object per session-stop to ~/.claude/metrics/costs.jsonl. Each row is a cumulative snapshot for that session, so to total spend you take the latest row per `session_id` and sum across sessions — summing every row multiply-counts.
Row schema:
| Field | Meaning | |
|---|---|---|
timestamp | ISO timestamp of the snapshot | |
session_id | Claude Code session identifier | |
transcript_path | Path to the session transcript | |
model | Model used | |
input_tokens / output_tokens | Token counts | |
cache_write_tokens / cache_read_tokens | Prompt-cache token counts | |
estimated_cost_usd | Precomputed cumulative cost in USD for the session |
Prefer estimated_cost_usd over hand-calculating pricing — model and cache prices change, and the tracker is the source of truth.
When to Use
- The user asks "how much have I spent?", "what did this session cost?", or
"what is my token usage?"
- The user mentions budgets, spending limits, overruns, or cost controls.
- The user wants a cost breakdown by model, session, or date, or a CSV export.
How It Works
First verify the log exists (use node, not sqlite3 — the tracker writes JSONL, and node is cross-platform):
If the log is missing, do not fabricate usage data. Tell the user that cost tracking populates after the first session ends with the stop:cost-tracker hook enabled.
Example — summary, by model, last 7 days
For a session drilldown or CSV export, iterate the same latest set (or the raw rows for CSV) and print the fields you need.
Reporting Guidance
When presenting cost data, include today's spend vs yesterday, total across all sessions, a by-model breakdown, and session count. Format sub-dollar amounts with four decimals, larger amounts with two.
Anti-Patterns
- Do not sum every row — they are cumulative per session; reduce to the latest
row per session_id first.
- Do not estimate costs from raw token counts when
estimated_cost_usdis present. - Do not assume the log exists without checking.
- Do not hard-code current model pricing in user-facing answers.
- Do not recommend installing unreviewed hooks or plugins that execute arbitrary code.
Related
/cost-report- Command-form report over the same metrics log.cost-aware-llm-pipeline- Model-routing and budget-design patterns.token-budget-advisor- Context and token-budget planning.strategic-compact- Context compaction to reduce repeated token spend.
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 repositoryCheckingskills/skills/cost-tracking/SKILL.md
Popularity
- 7-day trend score
- 0
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/jaysonpantollana/citadel/cost-tracking)