
Cost Tracking
Parses the JSONL metrics log that ECC's cost-tracker hook writes to ~/.claude/metrics/costs.jsonl and gives you breakdowns by model, session, or date. The rows are cumulative snapshots per session, so you need to dedupe to the latest row per session_id before summing or you'll multiply-count everything. Useful when you want to know how much you spent today versus yesterday, which models are eating your budget, or need a CSV export for expense reports. The one-liner examples use Node because the log is JSONL and Node ships everywhere. If the log doesn't exist yet, it just tells you to run a session with the hook enabled first.
- skills.sh installs
- 5.4K
- GitHub stars
- 300.3K
- last updated
- Aug 21, 2026
Install
$ npx -y skills add affaan-m/ecc --skill cost-tracking --agent claude-codeInstalls into .claude/skills of the current project.
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:
Sponsors
Details
- Repository
- github.com/affaan-m/ecc
- First seen
- Jul 14, 2026
More from affaan-m/ecc
All 263- Homelab Vlan Segmentation5.4K
- Gateguard5.4K
- Workspace Surface Audit5.4K
- Plan Orchestrate5.4K
- Production Scheduling5.4K
- Automation Audit Ops5.4K
- Canary Watch5.4K
- Healthcare Eval Harness5.4K
- Laravel Plugin Discovery5.4K
- Lead Intelligence5.4K
- Team Builder5.4K
- Cisco Ios Patterns5.4K
- Logistics Exception Management5.4K
- Email Ops5.4K
- Santa Method5.4K
- Carrier Relationship Management5.4K
- Enterprise Agent Ops5.4K
- X Api5.4K
- Rules Distill5.4K
- Content Hash Cache Pattern5.4K
- Network Config Validation5.4K
- Dmux Workflows5.4K
- Quarkus Patterns5.4K
- Ecc Tools Cost Audit5.4K