← back to AbramsEgo

build-queue/done/01-cost-trend-chart.md

10 lines

# AbramsEgo build task 01 — cost trend chart + per-model breakdown

Add to AbramsEgo (~/Projects/AbramsEgo) a **7-day cost trend** and **per-model breakdown**:

1. In `server.js`, extend the cost collector: add a `collectCostSeries()` that buckets `~/.claude/cost-ledger.jsonl` by day (last 7d) → `[{day, tokens, energy, total}]`, and a per-`api`/model breakdown for 30d. Expose in the snapshot under `cost.series7d` and `cost.byModel`.
2. In `public/index.html`, add a "Cost trend · 7d" card rendering a **pure-SVG line/area chart** (no libraries) of daily total cost, and a small per-model bar list. Match the existing dark theme + var names.
3. Keep it read-only. Verify: boot on PORT 9773, `curl -u admin:'DW2024!' /api/cost` shows `series7d` with 7 buckets. Commit `feat: 7d cost trend + per-model breakdown`.

Do NOT deploy. Local only.