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
+16 -16
View File
@@ -244,23 +244,22 @@ pipelines uninstall # remove Go binaries; keep history, drafts, and ntf
## A four-stage pipeline
**Plan → Implement → Review → Commit**. The first stage receives your task prompt.
Later stages receive the previous output or fields selected by an explicit
`memory` block. One outcome selects the next stage—no
parallel branches. Definitions use Markdown `output`, `prompt`, `tools`,
`configs`, and `edges` blocks. For example:
**Plan → Implement → Review → Commit**. The first stage receives your task prompt
in `input.md`. Every later stage also gets `memory.md`, the accumulated markdown
of completed turns, and `input.md` carries the previous turn's output body (the
free-form section after `# outcome`). One
outcome selects the next stage—no parallel branches. Definitions use Markdown
`prompt`, `tools`, `configs`, and `edges` blocks. The model returns free-form
`output.md` markdown; only its `# outcome` section is interpreted. For example:
````markdown
# stage planner
```output
{ task, plan, design, reuse_targets, acceptance_checks, research }
```
```prompt
Turn input.prompt into a focused plan. Discover repository conventions and
Turn input.md into a focused plan. Discover repository conventions and
reuse targets, and research official sources only when external knowledge is
actually required. State why when no research is needed.
actually required. State why when no research is needed. Return the complete
output.md markdown; the only required section is `# outcome`.
```
```tools
@@ -407,11 +406,12 @@ OpenCode** picker; Tab and Shift+Tab navigate it.
In the draft browser, **x** then **y** deletes the selected retained draft and
metadata. CLI: `pipelines draft-delete <draft.md>`. Published history is untouched.
Model results use native JSON-schema output where supported, precise parsing
errors, and bounded format-only repair without replaying tools. Retained failures
distinguish final-result validation from harness transport. Optional stage
permissions narrow file/command access without imposing a language-specific
default. See [model result recovery and permissions](docs/model-results.md).
Model results are file-based turn markdown: the model writes free-form `output.md`
and only its `# outcome` section is parsed. There is no JSON envelope, output
schema, field selection or format-repair pass. Retained failures distinguish
invalid turn output from harness transport. Optional stage permissions narrow
file/command access without imposing a language-specific default. See
[model turns and permissions](docs/model-results.md).
The run graph header shows start time and elapsed/final duration, plus finish
time for completed runs.