Split stage memory into capped essential memory.md and full history.md

Every stage used to be told to read memory.md, the full output of every
earlier turn (19 KB average, 92 KB max), and paid for it on each model call.
memory.md is now essential memory, hard-capped at 4 KB and inlined in the
prompt: the task, the previous stage's # handoff section (or its truncated
output head), a one-line-per-stage outcome ledger and the server-captured
changed files. history.md keeps the old full memory on disk; read-capable
stages are pointed at it and input.md for on-demand detail, and it is never
inlined. The prompt asks each stage for a short # handoff section.
This commit is contained in:
2026-11-04 13:00:48 +00:00
parent fa6c0864db
commit 538143554c
27 changed files with 912 additions and 128 deletions
+5 -2
View File
@@ -6,6 +6,7 @@ the run's artifact root:
```
<artifacts>/<run>/stages/01-implementer/input.md
<artifacts>/<run>/stages/01-implementer/memory.md
<artifacts>/<run>/stages/01-implementer/history.md
<artifacts>/<run>/stages/01-implementer/output.md
<artifacts>/<run>/stages/01-implementer/private/
<artifacts>/<run>/public/
@@ -19,8 +20,10 @@ directories idempotently; it never deletes or rewrites existing files.
prompt under a `# Run task` heading (headings demoted two levels) followed by
the previous visit's output body (without the outcome section) under a
`# Previous turn output` heading. Carrying the task forward means a stage that
only summarised its own work is never the sole carrier of what the run is for. `memory.md` is plain
markdown: one `## <stage> · visit <n>` section per completed turn, with that
only summarised its own work is never the sole carrier of what the run is for.
`memory.md` is essential memory (`turn.RenderEssential`, capped at 4 KB, inlined
in the prompt): task, previous stage's `# handoff` (or truncated output head),
outcome ledger and captured changed files. `history.md` is plain markdown: one `## <stage> · visit <n>` section per completed turn, with that
turn's body — its own ATX headings demoted two levels, so the turn heading stays
the structural one — followed by a system-written list of files it added to
`public/`.