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
+6 -4
View File
@@ -754,6 +754,7 @@ files as that step's artifacts:
```
<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/
@@ -761,10 +762,11 @@ files as that step's artifacts:
`input.md` is the run prompt on the first visit; later visits carry the run
prompt under `# Run task` followed by the previous visit's output body (without
its outcome section) under `# Previous turn output`. `memory.md` is the accumulated markdown of completed turns plus the
files each turn added to the shared `public/` directory. A text-only stage (an
explicit empty `tools` block) receives both files' contents in its prompt
instead, because it has no file-reading tool. The model returns the complete
its outcome section) under `# Previous turn output`. `memory.md` is the capped (4 KB) essential memory inlined in every prompt: task,
previous stage's `# handoff`, outcome ledger and changed files. `history.md` is
the accumulated markdown of completed turns plus the files each turn added to
the shared `public/` directory, read on demand. A stage without `read` also
receives `input.md` in its prompt (capped), because it has no file-reading tool. The model returns the complete
`output.md` markdown; only its `# outcome` section is interpreted by the server.
Everything else is free-form and preserved under the step's `markdown` output.
`private/` belongs to its own visit, while `public/` is shared by every stage in