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
+5 -24
View File
@@ -1,9 +1,5 @@
# stage fold
```output
{ summary, changed_files, folded_notes }
```
```prompt
Fold the accumulated per-item documentation notes into the repository's shared
documentation. Read every file under `docs/notes/`; for each note, apply the change it
@@ -16,10 +12,7 @@ directory and the documents they name; never scan filesystem or mount roots, and
commands supported by the actual execution environment. Save any artifacts you produce
into the artifacts directory named in the runtime context. Report the notes read, the
documents changed and the notes deleted in an `# evidence` section, with the exact
commands and observed results. Return the line-oriented result: the first non-empty line
is the declared outcome, a `# output` section holds one JSON object with the output
fields named above, and any further `# <heading>` section is retained verbatim as
evidence. Return blocked if the notes directory cannot be read.
commands and observed results. Return the complete output.md markdown; the only required section is `# outcome` followed by a declared edge word, with free-form headings for the facts later stages need. Return blocked if the notes directory cannot be read.
```
```tools
@@ -45,30 +38,18 @@ error -> #failure
# stage committer
```output
{ committed, commit, changed_files, pre_commit_checks }
```
```prompt
Commit this run's change locally. Never push, tag, deploy or rewrite history. Select
the run's changed paths from input.server_changed_files (the runner's captured
evidence) and the fold stage's declared changed_files, and stage their union, including
the notes the fold stage deleted (stage the removal, not only surviving paths). Inspect
Commit this run's change locally. Never push, tag, deploy or rewrite history. Inspect
`git status` and the full diff, and stage this run's change, including the notes the
fold stage deleted (stage the removal, not only surviving paths). Inspect
the staged diff before committing; never commit unrelated work, secrets or generated
artifacts. When nothing is staged - for example an empty notes directory - do not create
an empty commit; return success with a clear note. Otherwise commit with a concise
message naming this run's change and report the commit hash. If a required check fails,
do not commit; return blocked with the failing output. Return the line-oriented result:
the first non-empty line is the declared outcome, a `# output` section holds one JSON
object with the output fields named above, and any further `# <heading>` section is
retained verbatim as evidence. Never claim an unexecuted check passed or fabricate a
do not commit; return blocked with the failing output. Return the complete output.md markdown; the only required section is `# outcome` followed by a declared edge word, with free-form headings for the facts later stages need. Never claim an unexecuted check passed or fabricate a
commit.
```
```memory
{"changed_files":"fold.changed_files","server_changed_files":"input.server_changed_files"}
```
```tools
read
glob