Each model visit now gets <run>/stages/<seq>-<stage>/ with input.md,
memory.md, output.md, private/ and a shared run-level public/. The model
reads the two input files, follows the stage's instructions verbatim and
returns complete markdown; only the # outcome section is parsed.
- add internal/turn layout, render and output parsing
- write input.md/memory.md before a visit and output.md from the final
message; inventory all turn files as stage artifacts
- accumulate completed turns and system-written public file additions in
memory, including across retries and resume
- remove the JSON envelope, strict field validation, line format and the
repair ladder for model stages
- republish pipeline authoring prompts and docs in the new style
Checks: go build ./..., go vet ./..., go test -count=1 ./..., gofmt -l .
Carry the usage a model stage already measures for its budget
(stage.Budget.Snapshot()) onto the step as typed evidence and total it in
one pass, rather than a second harness read, a transcript parse or an
output-length estimate. A shared budget across stage revisits records only
the visit's increment, and a revisit that observes no new report records no
usage instead of a fabricated known zero.
- protocol: StageUsage/RunUsage/TotalUsage and UsageTotals.
- pipeline: step_usage table + migration, COALESCEd into the one step
projection, FinishStep persistence, one json_extract history aggregate,
retention removes the rows with their run.
- server: stageUsage maps the budget snapshot, stamping per-stage model and
usage for every model stage (including failures).
- cli: inspect/stats human and JSON output.
- budget/pi: retain the reported in/out split, mark a total-only (Pi) report
split-unknown, and keep an unreported cost unknown (never zero).
Evidence and docs updated in the packaged skill references and docs/cli.md;
the live database has no step_usage rows yet (all history predates this), so
per-run figures are reported as unavailable, not zero.