From smorch-dev
Flags token/API spend anomalies per PR. Reads usage logs from Claude API (Anthropic console export), OpenAI (if used), and infra costs (Supabase, Vercel, server billing). Surfaces any PR that causes a >2× spend delta vs 7-day rolling average. Rejected idea of a separate hat — this is a signal surfaced during /smo-score Engineering hat.
How this skill is triggered — by the user, by Claude, or both
Slash command
/smorch-dev:cost-trackerThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
**Why:** MicroSaaS margin is tight. A feature that works but 5×'s Claude API cost isn't shippable without conscious tradeoff. This skill surfaces that tradeoff before the PR merges.
Why: MicroSaaS margin is tight. A feature that works but 5×'s Claude API cost isn't shippable without conscious tradeoff. This skill surfaces that tradeoff before the PR merges.
Invoked by: /smo-score (automatic during Engineering hat Q8 if PR touches Claude/OpenAI/DB paths)
Consumes: 7-day rolling spend from Anthropic console, Supabase dashboard, Vercel analytics
Produces: docs/cost-reports/YYYY-MM-DD-{pr}.md + annotation on Engineering hat score
.next/analyze output vs mainpm2 list --json)This skill does NOT block the PR. It annotates Engineering hat Q8 in /smo-score with a cost flag:
Q8 (deps + cost): 7 → cost-tracker flags 3.2× Claude token spend on /api/draft
Action required: document tradeoff OR optimize before ship
Dev must either:
Monthly, /smo-retro aggregates cost-tracker flags across projects. Pattern surfaces:
This becomes a lesson in smorch-brain/canonical/lessons.md (cross-project).
Export usage CSV from console.anthropic.com/billing/usage manually OR via API:
curl -H "x-api-key: $ANTHROPIC_API_KEY" \
"https://api.anthropic.com/v1/organizations/{org}/usage?start=2026-04-12&end=2026-04-19"
Store 7-day rolling window in ~/.claude/cost-baseline/claude-7d.csv.
SELECT date, SUM(db_size_bytes) as size, SUM(egress_bytes) as egress, SUM(db_operations) as ops
FROM supabase_usage
WHERE date > NOW() - INTERVAL '7 days'
GROUP BY date ORDER BY date;
vercel inspect {deployment-url} --token $VERCEL_TOKEN → JSON with function invocations + bandwidth.
Run on the target server via /smo-deploy --dry-run or SSH:
pm2 list --json | jq '.[] | {name, monit}'
Per-project in .smorch/project.json:
{
"cost_tracking": {
"claude_multiplier_threshold": 2.0,
"supabase_ops_threshold": 3.0,
"bundle_size_kb_threshold": 50,
"exclude_paths": ["/api/seed"]
}
}
Omitted = defaults above.
mkdir -p ~/.claude/cost-baseline
# Pull 7 days of historical data once:
bash ~/.claude/plugins/smorch-dev/skills/cost-tracker/scripts/seed-baseline.sh
# Subsequent runs auto-refresh
Seed script (to be created) pulls from all configured sources and stores baseline CSVs.
npx claudepluginhub smorchestra-ai/smorch-dev --plugin smorch-devGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.