Skip to content

Answer & usage logs #31

Description

@jpka

Parent

Part of #25 (Screen Solver v1: implementation spec), itself under the map #1.

What to build

Durable memory of what the app has done, independent of whether anyone was watching. Two append-only JSONL files under the state root: answers.jsonl gets one entry per done or interrupted outcome only — never for a bail (# No exercise on screen) or an error — holding title (the answer's # heading), final answer text only (no delta history, no image), timestamp, model, usage, source window identity, and an interrupted: true tag where applicable. usage.jsonl gets one entry per attempted call, every outcome including bail and error, always recording usage/cost regardless of content — pure observability, nothing reads the running total to cap or throttle anything. GET /answers serves the full answers.jsonl backlog as a JSON array, independent of the live /events connection. A client connecting to /events while a solve is already in flight receives sync{text} — the accumulated text so far — in place of start.

Acceptance criteria

  • A successful solve (done) appends exactly one answers.jsonl entry with all specified fields, and exactly one usage.jsonl entry.
  • An interrupted solve appends one answers.jsonl entry tagged interrupted: true, plus its own usage.jsonl entry.
  • A bail (# No exercise on screen) appends a usage.jsonl entry but no answers.jsonl entry.
  • A failed solve (error) appends a usage.jsonl entry but no answers.jsonl entry.
  • GET /answers returns the full current backlog as JSON, matching the contents of answers.jsonl.
  • A client connecting to /events mid-solve receives sync{text} carrying the accumulated text so far, not start.
  • A client connecting to /events when nothing is in flight receives no sync and simply waits for the next start.

Blocked by

#29 (Solve loop over HTTP + SSE) — needs real done/interrupted/error/bail outcomes to persist.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agentImplementation-ready spec, ready to be picked up by an agent

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions