> Agent-ready spec from Diff of the Day (2026-11-28, idea 1). Give this file to your coding agent (Claude Code, Codex, Cursor) and ask it to build the P0 requirements first.

# Spec: Coding-agent quota burn tracker

## Problem Statement
Coding-agent plans change how fast they drain without much warning: on 26 Nov 2026 OpenAI fixed a billing bug and GPT-6.2 Astra users started hitting limits 40% faster. Developers notice only when they get cut off mid-task. A small local tracker that shows daily burn and flags step changes would make these shifts visible within a day.

## Goals
- Show tokens or requests used per day and per model for the last 30 days from local agent logs.
- Flag a step change: a day whose burn per task is 25% or more above the 7-day median.
- Run locally in under 10 seconds with no account or upload.

## Non-Goals
- Predicting exact plan limits: vendors do not publish them reliably.
- Tracking other people's usage: personal tool only.
- Cost accounting in money: tokens and requests are enough for v1.

## User Stories
- As a developer on a coding-agent plan, I want a daily burn chart so that I see when my quota drains faster.
- As a developer, I want a warning when the burn per task jumps so that I can check for a pricing or model change.
- As a developer, I want to tag a day with a note ("switched to GPT-6.2") so that I remember why it changed.
- Edge case: as a developer, I want days with no logs shown as gaps, not zeros, so that the median is not skewed.

## Requirements
### P0 (must have)
1. **Log reader** for at least one agent's local logs (for example Claude Code JSONL session logs or Codex logs).
   - [ ] Extracts timestamp, model and token counts per request; skips lines it cannot parse and counts them.
2. **Daily table** `burn.csv`: date, model, requests, input tokens, output tokens, tasks (sessions).
3. **Step-change check**: compare burn per task with the 7-day median.
   - [ ] Given a day at 1.3 times the median, when the check runs, then it prints a warning with the date and model.
4. **Report** `burn.html`: one chart per model and a list of warnings.

### P1 (nice to have)
- Notes file to tag days.
- A second agent's log format.

### P2 (future)
- A desktop notification when a warning fires.

## Success Metrics
- Leading: the report builds from your real logs on the first run.
- Lagging: the next vendor pricing change is flagged within one working day.

## Open Questions
- Which agent's logs to support first? (you)

## Timeline
One evening for P0.

## Agent Instructions
- **Suggested stack**: Python 3.12 with the standard library and one chart library, or TypeScript on Node 22.
- **Build order**: log reader with unit tests on sample lines → daily table → step-change check with a test for the 1.3x case → HTML report.
- **Safety**: read logs only; never send them anywhere; do not print prompt text into the report.
- **Done when**: burn.html shows your last 30 days and the step-change test passes.

## Sources
- GPT-6.2 Astra users now hit limits 40% faster: https://the-decoder.com/gpt-6-2-astra-users-now-hit-limits-40-faster-after-openai-patched-a-pricing-error/
