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
+2 -2
View File
@@ -43,7 +43,7 @@ func isZeroWidth(r rune) bool {
// OutputPreview quotes retained output, never infers accomplishments from a
// successful process or invents a schema for technology-neutral workflows.
func OutputPreview(output map[string]any) string {
keys := []string{"summary", "result", "report", "message", "accomplished", "artifacts", "evidence", "reason", "error"}
keys := []string{"summary", "markdown", "result", "report", "message", "accomplished", "artifacts", "evidence", "reason", "error"}
seen := map[string]bool{}
remaining := make([]string, 0, len(output))
for key := range output {
@@ -72,7 +72,7 @@ func OutputPreview(output map[string]any) string {
if text == "" || text == "[]" || text == "{}" {
continue
}
if key != "summary" && key != "result" && key != "report" && key != "message" {
if key != "summary" && key != "markdown" && key != "result" && key != "report" && key != "message" {
text = key + ": " + text
}
runes := []rune(text)