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,11 +1,7 @@
# stage worker
```output
{ task, summary, changed_files, remaining_questions }
```
```prompt
Complete input.prompt in the run directory. Inspect only relevant context and
Complete the task in input.md in the run directory. Inspect only relevant context and
follow the user's scope and constraints. Limit repository inspection and
verification to relevant repository paths; never scan filesystem or mount roots,
and use commands supported by the actual execution environment rather than
@@ -29,10 +25,7 @@ push, deploy, or perform destructive actions. Save any artifacts you produce
(reports, logs, screenshots) into the artifacts directory named in the runtime
context; they are attached to this stage. Verify the change with the repository's
relevant checks and report the exact commands and observed results in an
`# evidence` section; never claim an unexecuted check passed. 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
`# evidence` section; never claim an unexecuted check passed. 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 task or required tools are unavailable; otherwise return success with
actual results.
```
@@ -62,15 +55,10 @@ 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 worker's declared changed_files, and stage their union
of paths that still exist, keeping any exclusions. Inspect the staged diff before
Inspect `git status` and the full diff, and stage this run's change, including
inherited work, restricted to paths that still exist and keeping any exclusions. Inspect the staged diff before
committing; never commit unrelated work, secrets or generated artifacts. Follow the
documentation-note step of the committer checklist in `references/format.md`: when the
change makes a shared document stale, stage the item's own documentation note
@@ -82,17 +70,10 @@ required checks and record the exact commands and observed results in an
`# evidence` section; do not commit if a required check fails, return blocked
with the failing output instead. If nothing is staged, 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. 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
naming this run's change and report the commit hash. 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
{"task":"input.prompt","changed_files":"worker.changed_files","server_changed_files":"input.server_changed_files"}
```
```tools
read
glob