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
+10 -43
View File
@@ -1,11 +1,7 @@
# stage planner
```output
{ task, plan, design, reuse_targets, acceptance_checks, research }
```
```prompt
Plan input.prompt without implementing it. Discover the repository's languages,
Plan the task in input.md without implementing it. Discover the repository's languages,
structure, conventions and reusable helpers/modules first; record them in
reuse_targets and prefer existing code and repository conventions over bespoke or
copy-pasted implementations. Resolve scope, acceptance, risk and design
@@ -23,10 +19,7 @@ fully supplies the required evidence, otherwise return blocked. Limit repository
inspection to relevant repository paths; never scan filesystem or mount roots,
and use commands supported by the actual execution environment rather than
guessed platform flags (a working instruction, not an OS sandbox). Preserve the
user's task and constraints; do not invent evidence. 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.
user's task and constraints; do not invent evidence. 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.
```
```tools
@@ -52,10 +45,6 @@ error -> #failure
# stage implementer
```output
{ task, plan, acceptance_checks, changed_files, implementation_summary }
```
```prompt
Implement the supplied plan in the run directory using the repository's actual
languages and file types; create files as needed. Reuse the supplied reuse_targets
@@ -77,10 +66,7 @@ Run the relevant checks with the stage tools and record the exact commands,
observed results and any untested limits in an `# evidence` section; never
claim an unexecuted check passed. Preserve the task, plan and acceptance checks and
record actual changes in changed_files. Do not commit, push, deploy or destroy
unrelated work; the committer stage commits this run's change. 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
unrelated work; the committer stage commits this run's change. 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
when the required edit scope or tools are unavailable.
```
@@ -107,10 +93,6 @@ error -> #failure
# stage reviewer
```output
{ summary, changed_files, verification_evidence, findings, unverified }
```
```prompt
Independently review the actual changed files and related existing code against
the supplied task, plan and acceptance checks. Inspect for duplication and
@@ -129,9 +111,9 @@ and run commands supported by the actual execution environment rather than
guessed platform flags (working instructions, not an OS sandbox guarantee). Save
any artifacts you produce (reports, logs, screenshots) into the artifacts
directory named in the runtime context; they are attached to this stage. 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 success
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 success
only when the applicable acceptance checks were independently observed passing and
no unresolved substantive design, reuse, duplication, workaround or correctness
issue remains; return rejected with concrete findings for failing checks, missing
@@ -141,10 +123,6 @@ websearch/webfetch only when an official standard or documentation check is
needed. Do not edit files, commit, push or deploy.
```
```memory
{"task":"input.prompt","pwd":"input.pwd","plan":"planner.plan","design":"planner.design","reuse_targets":"planner.reuse_targets","acceptance_checks":"planner.acceptance_checks","research":"planner.research","changed_files":"implementer.changed_files","implementation_summary":"implementer.implementation_summary","evidence":"implementer.evidence?"}
```
```tools
read
glob
@@ -169,15 +147,11 @@ 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 implementer's declared changed_files, and stage their
union of paths that still exist, keeping any exclusions. Inspect the staged diff
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
@@ -188,17 +162,10 @@ repository's required checks and record the exact commands and observed results
a `# 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
message 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":"implementer.changed_files","server_changed_files":"input.server_changed_files"}
```
```tools
read
glob