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
+7 -9
View File
@@ -12,10 +12,9 @@ pipeline automatically; all templates are manual-only and have at most four stag
| `docs-fold` | Fold accumulated item documentation notes into the shared docs, then commit locally | Fold: read/glob/grep/edit/shell; committer: read/shell |
Every workflow that changes the repository ends in a **committer** stage that
commits locally and never pushes. The committer stages the union of the runner's
server-captured changed paths (`input.server_changed_files`) and the producer's
declared `changed_files` — a declared list can be incomplete — then runs the
repository's required checks before committing. `task` and `three-stage` follow this;
commits locally and never pushes. The committer inspects `git status` and the full
diff, stages this run's change (a model-declared list can be incomplete), then runs
the repository's required checks before committing. `task` and `three-stage` follow this;
`review` and `research` change nothing and so do not commit.
`docs-fold` is the deliberate **single documentation writer**. A per-item workflow never
@@ -24,11 +23,10 @@ edits a shared README or topic doc: when its change makes one stale it records a
the manual-only `docs-fold` pipeline later folds the accumulated notes into the shared
documentation and removes them.
Model and agent stages return the line-oriented result: the first non-empty line is
the declared outcome, a `# output` section holds the JSON output map for the next
stage, and any further `# <heading>` section is retained verbatim as evidence. The
legacy `{ "outcome": ..., "output": {...} }` envelope is still accepted. See
`docs/model-results.md`.
Model and agent stages read the turn's `input.md` and `memory.md`, then return the
complete `output.md` markdown. The only required section is `# outcome` followed by
one declared edge word; every other heading is free-form evidence for the next stage
and the operator. See `docs/notes/stage-turns.md`.
Web search/fetch is conditional: stages use it only when a task genuinely needs
external knowledge such as accepted industry approaches, framework or library