/ecc-backend-data:cost-trackingfrom ecc-backend-data
Track and report Codex token usage, spending, and budgets from a local cost-tracking database. Use when the user asks about costs, spending, usage, tokens, budgets, or cost breakdowns by project, tool, session, or date.
Ships in ecc-backend-data. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Use this skill to analyze Codex cost and usage history from a local SQLite
database. It is intended for users who already have a cost-tracking hook or
plugin writing usage rows to ~/.Codex-cost-tracker/usage.db.
Source: salvaged from stale community PR #1304 by MayurBhavsar.
First verify prerequisites:
command -v sqlite3 >/dev/null && echo "sqlite3 available" || echo "sqlite3 missing"
test -f ~/.Codex-cost-tracker/usage.db && echo "Database found" || echo "Database not found"
If the database is missing, do not fabricate usage data. Tell the user that cost tracking is not configured and suggest installing or enabling a trusted local cost-tracking hook/plugin.
The expected usage table usually contains one row per tool call or model
interaction. Column names vary by tracker, but the examples below assume:
| Column | Meaning |
|---|---|
timestamp | ISO timestamp for the usage event |
project | Project or repository name |
tool_name | Tool or event name |
input_tokens | Input token count, when recorded |
output_tokens | Output token count, when recorded |
cost_usd | Precomputed cost in USD |
session_id | Codex session identifier |
model | Model used for the event |
Prefer cost_usd over hand-calculating pricing. Model prices and cache pricing
change over time, and the tracker should be the source of truth for how each row
was priced.
sqlite3 ~/.Codex-cost-tracker/usage.db "
SELECT
'Today: $' || ROUND(COALESCE(SUM(CASE WHEN date(timestamp) = date('now') THEN cost_usd END), 0), 4) ||
' | Total: $' || ROUND(COALESCE(SUM(cost_usd), 0), 4) ||
' | Calls: ' || COUNT(*) ||
' | Sessions: ' || COUNT(DISTINCT session_id)
FROM usage;
"
sqlite3 -header -column ~/.Codex-cost-tracker/usage.db "
SELECT project, ROUND(SUM(cost_usd), 4) AS cost, COUNT(*) AS calls
FROM usage
GROUP BY project
ORDER BY cost DESC;
"
sqlite3 -header -column ~/.Codex-cost-tracker/usage.db "
SELECT tool_name, ROUND(SUM(cost_usd), 4) AS cost, COUNT(*) AS calls
FROM usage
GROUP BY tool_name
ORDER BY cost DESC;
"
sqlite3 -header -column ~/.Codex-cost-tracker/usage.db "
SELECT date(timestamp) AS date, ROUND(SUM(cost_usd), 4) AS cost, COUNT(*) AS calls
FROM usage
GROUP BY date(timestamp)
ORDER BY date DESC
LIMIT 7;
"
sqlite3 -header -column ~/.Codex-cost-tracker/usage.db "
SELECT session_id,
MIN(timestamp) AS started,
MAX(timestamp) AS ended,
ROUND(SUM(cost_usd), 4) AS cost,
COUNT(*) AS calls
FROM usage
GROUP BY session_id
ORDER BY started DESC
LIMIT 10;
"
When presenting cost data, include:
For small amounts, format currency with four decimal places. For larger amounts, two decimals are enough.
cost_usd is present.SELECT * exports on large databases./cost-report - Command-form report using the same database.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.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub hretheum/skillforge --plugin ecc-backend-data40 skills in this plugin
/api-connector-builderBuild a new API connector or provider by matching the target repo's existing integration pattern exactly. Use when adding one more integration without inventing a second architecture./api-designREST API design patterns including resource naming, status codes, pagination, filtering, error responses, versioning, and rate limiting for production APIs./backend-patternsBackend architecture patterns, API design, database optimization, and server-side best practices for Node.js, Express, and Next.js API routes./bun-runtimeBun as runtime, package manager, bundler, and test runner. When to choose Bun vs Node, migration notes, and Vercel support./clickhouse-ioClickHouse database patterns, query optimization, analytics, and data engineering best practices for high-performance analytical workloads./content-hash-cache-patternCache expensive file processing results using SHA-256 content hashes — path-independent, auto-invalidating, with service layer separation.