stage turns: replace JSON results with file-based markdown turns

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 .
This commit is contained in:
2026-10-19 22:27:44 +01:00
parent b2fd614ba4
commit e37b864c40
66 changed files with 2199 additions and 3028 deletions
@@ -1,5 +1,10 @@
# Verification, accounting and real-provider evidence
Historical note: model stages now use file-based turns and parse only the
`# outcome` section. The JSON/line-format envelope and format-repair ladder
described in the dated sections below are retired; see `docs/model-results.md`
for the current contract. The dated evidence remains as a record.
Structural validation is not inference, tool execution, correct task completion,
phone delivery or correct billing. Distinguish observed artifacts/command results
from model-written reports. State the command/check actually run and say **not
@@ -8,7 +13,8 @@ evidence or a different backend/model as already validated.
## Authoring useful verification
Preserve explicit output handoffs and evidence fields. Implementer/reviewer stages
Preserve the facts later stages need in free-form output headings; only the
`# outcome` section is interpreted. Implementer/reviewer stages
can use appropriate permitted commands; do not accept a preceding stage's success
summary as independent proof. Actual file bytes, command exit status, retained tool
parts and server-captured diffs are stronger evidence than prose. A read failure
@@ -29,7 +35,7 @@ credentials; a client-side check is not proof of a remote server's provider heal
Defaults remain two retries and one hour per stage attempt; a run-level wall-clock
deadline is not added. Budgets are optional, positive and independent USD/token
reported-usage limits shared across attempts, format repairs and repeat visits.
reported-usage limits shared across attempts and repeat visits.
Accounting failures stop budget-limited stages. In-flight calls can overshoot;
these are **not provider-side hard caps or a guaranteed bill ceiling**. Reported
USD may validly be zero; do not fabricate prices/accounting from output length.