Cost Tracking
Reports Claude Code token usage and spend from the local cost-tracker log, with per-session and per-model breakdowns.
- CCM score
- 73 of 100
- skills.sh installs
- 8.6K
- GitHub stars
- 312.6K
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers spend totals, token usage, and budget questions drawn from
~/.claude/metrics/costs.jsonl - Reduces cumulative per-session snapshots to the latest row per session before summing, avoiding double counting
- Prefers the tracker's
estimated_cost_usdfield over hand-calculated pricing, and checks that the log exists first - Designed for users who ask about costs by model, session, or date after the
stop:cost-trackerhook is enabled
Install
$ npx -y skills add affaan-m/ecc --skill cost-tracking -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
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.
ECC also maintains internal per-session files under
~/.claude/metrics/cost-snapshots/ so runtime hooks can read the current
session total without rescanning all history. Treat those files as a
rebuildable cache; each snapshot stores a byte cursor so only newly appended
rows are scanned. Stable reads are O(1), while updates are O(new bytes). Stale
entries are pruned after 30 days or when the directory exceeds 512 sessions.
Cold catch-up work is limited to 16 MiB per hook invocation, and malformed
unterminated rows larger than 1 MiB are discarded with a resumable cursor.
Reports and exports should continue to use costs.jsonl.
Row schema:
Details
- Repository
- github.com/affaan-m/ecc
- Category
- Agent Workflow & Planning
- First seen
- Jul 14, 2026
Questions
How do I check how much I have spent on Claude Code with cost-tracking?
The cost-tracking skill reads the local metrics log at ~/.claude/metrics/costs.jsonl, which the stop:cost-tracker hook writes after each session. It reduces the cumulative rows to the latest row per session and reports today's spend, yesterday's spend, the total, and a breakdown by model. If the log is missing, it tells you cost tracking populates after the first session ends with the hook enabled.
How do I install the cost-tracking skill?
Run npx -y skills add affaan-m/ecc --skill cost-tracking -y in your project to install it. After that, the agent can answer questions about Claude Code token usage, spending, budgets, and cost breakdowns by model, session, or date.
What does cost-tracking need before it can report anything?
It needs the ECC stop:cost-tracker hook enabled, because the hook writes the costs.jsonl log the skill reads. It uses node to check and read that file, so Node.js must be available on your machine.
Which other skills work with cost-tracking?
The skill points to cost-aware-llm-pipeline for model routing and budget design, token-budget-advisor for context and token-budget planning, and strategic-compact for reducing repeated token spend. It also refers to the /cost-report command, which runs a report over the same metrics log.
More from affaan-m/ecc
All 257- Network Bgp Diagnostics8.6K
- Flox Environments8.6K
- Homelab Vlan Segmentation8.6K
- Quarkus Security8.6K
- Quarkus Tdd8.6K
- Tinystruct Patterns8.6K
- Homelab Pihole Dns8.6K
- Quarkus Verification8.6K
- Prisma Patterns8.5K
- Fsharp Testing8.5K
- React Patterns8.5K
- React Testing8.5K
- React Performance8.5K
- Frontend A11y8.4K
- Recsys Pipeline Architect8.2K
- Marketing Campaign8.1K
- Uncloud8.1K
- Benchmark Optimization Loop7.8K
- Social Publisher7.8K
- Latency Critical Systems7.8K
- Parallel Execution Optimizer7.7K
- Prediction Market Risk Review7.7K
- Data Throughput Accelerator7.7K
- Prediction Market Oracle Research7.7K
Similar to Cost Tracking
More Agent Workflow & Planningcost-trackSkillruvnet/ruflo685 installsCaptures per-session Claude Code token usage and USD cost into the cost-tracking namespace for reporting.
session-reportSkillanthropics/claude-plugins-official4.9K installsGenerates an explorable HTML usage report from local Claude Code session transcripts, with anomaly callouts.
caveman-statsSkilljuliusbrussee/caveman392.5K installsShows recorded token usage and mode attribution for the current session, with savings reported as unknown.
cost-breakdownSkillhoangsonww/claude-code-agent-monitor1.2K starsDetailed per-model, per-session, and daily cost breakdown from the Agent Monitor pricing engine for Claude Code.
tokentabPlugindavepoon/buildwithclaude3.8K starsSee what Claude Code is spending while you work: every API call priced from the first prompt, a live cost pane, and budget limits that warn or stop. No setup, n
McpspendMCP serverandreisirbu91-lab59 starsCost and usage data from MCPSpend: today's spend, monthly limits, top tools, and sessions.