Merge: short essential memory per stage; full history on demand

This commit is contained in:
2026-11-04 13:01:16 +00:00
27 changed files with 912 additions and 128 deletions
+4 -2
View File
@@ -58,10 +58,12 @@ explicitly asks to manage a schedule; scheduling alone is not workflow authoring
## Turns and artifacts
Each visit has `input.md` (the run prompt; later visits add the previous body), `memory.md`
(completed turns), `output.md`, and `private/`. Every run also has one shared
(short essential memory inlined in the prompt: task, previous stage's `# handoff`,
outcome ledger, changed files; 4 KB cap), `history.md` (completed turns in full,
read on demand), `output.md`, and `private/`. Every run also has one shared
`public/` directory, addressed by its absolute path; files there are visible to
later stages and are the stage's real artifacts. `input.md`, `memory.md`,
`output.md` and `session.html` are system evidence for auditing, not stage
`history.md`, `output.md` and `session.html` are system evidence for auditing, not stage
output.
## References
+3 -2
View File
@@ -41,8 +41,9 @@ nonterminal edge. Without `on`, entering beyond the cap fails before execution.
Global 30-step/five-visits-per-stage safety limits still apply.
A model stage reads its turn's `input.md` (the run prompt on the first visit,
the previous turn's output afterwards) and `memory.md` (completed turns with the
files each added to `public/`). The `memory` block is retired: it no longer
the previous turn's output afterwards), its inlined, capped `memory.md` (task,
previous stage's `# handoff`, outcome ledger, changed files) and, on demand,
`history.md` (completed turns in full with the files each added to `public/`). The `memory` block is retired: it no longer
selects fields or replaces previous output for model stages, and old definitions
that contain one parse but ignore it. Reviewers therefore see the previous
turn's output and the accumulated memory rather than a field projection.
+28 -7
View File
@@ -4,8 +4,8 @@ Definitions are Markdown made only of `# stage KEY` headings and fenced blocks.
Scheduling belongs to separate saved run configurations, not `# settings` or
schedule blocks in the definition. No unrelated prose outside blocks. The first
stage receives the run prompt in its `input.md`; later stages receive
the previous turn's output. Every visit also gets a `memory.md` of completed
turns. There are no stage `input`, `output`, or `memory` blocks: the model reads
the previous turn's output. Every visit also gets a short `memory.md` (essential
memory, inlined in the prompt) and a full `history.md` of completed turns. There are no stage `input`, `output`, or `memory` blocks: the model reads
the turn files and writes free-form markdown, and only the `# outcome` section is
interpreted. Read `references/control.md` for runner-enforced limits.
@@ -46,13 +46,34 @@ prompts/outputs. Read `references/control.md` for the exact format.
## Result format
Each visit gets `input.md`, `memory.md`, `output.md` and `private/` in
`<run>/stages/<seq>-<stage>/`, plus the run-level shared `public/`. The model
reads input and memory and returns the complete `output.md` markdown. The only
required section is the outcome heading, followed by one of the stage's declared
edge words:
Each visit gets `input.md`, `memory.md`, `history.md`, `output.md` and
`private/` in `<run>/stages/<seq>-<stage>/`, plus the run-level shared
`public/`. What a stage receives:
- `memory.md` (essential, hard cap 4 KB, always inlined in the prompt): the run
task, the previous stage's handoff with its outcome and public/ additions, a
one-line-per-stage outcome ledger (latest visit; a revisit is marked) and the
server-captured changed files. A stage must be able to work from this alone.
- `input.md` (on demand): the full run task and the previous turn's full output.
- `history.md` (on demand, never inlined): every completed turn in full, the
format `memory.md` had before essential memory existed.
Stages with `read` are told the two on-demand paths; stages without it get
`input.md` inlined too (capped at 32 KB) but never `history.md`.
The previous stage's handoff is its `# handoff` section (any level, up to the
next heading of the same or higher level); without one the server uses the head
of its output, marked as such. Either is truncated to fit with a pointer to
`input.md`, so nothing depends on the model following the convention. The
prompt asks every stage to start its output with a short handoff: what it did,
files changed, open issues or findings. The only required section is the
outcome heading, followed by one of the stage's declared edge words:
````markdown
# handoff
Fixed both review findings in cache.go; tests pass. No open issues.
# outcome
success
@@ -225,16 +225,17 @@ file diffs: current capture is server-owned. Do not promise full files/rollback.
## Retained stage artifacts
Every model visit gets a file-based turn under the data directory
(`<data>/artifacts/<run>/stages/<seq>-<stage>/`) with `input.md`, `memory.md`,
`output.md` and `private/`; `public/` is run-level and shared by every stage.
(`<data>/artifacts/<run>/stages/<seq>-<stage>/`) with `input.md`, `memory.md`
(capped essential memory, inlined), `history.md` (full earlier turns, read on
demand), `output.md` and `private/`; `public/` is run-level and shared by every stage.
The root is configurable and defaults next to the database. The writable
`private/` and shared `public/` directories are stated in the agent prompt for
every harness, and `PIPELINES_ARTIFACTS_DIR` points at the turn directory for a
locally spawned Pi process. OpenCode V2 tools run inside the shared serve
process, so there the prompt, not the environment, is the reliable carrier.
Turn-local files belong in `private/`; reports, logs and screenshots for later
stages belong in `public/`. The server owns `input.md`, `memory.md` and
`output.md` and never asks the model to write them directly.
stages belong in `public/`. The server owns `input.md`, `memory.md`,
`history.md` and `output.md` and never asks the model to write them directly.
After the visit the server makes one bounded inventory of the turn and public
directories and records each file's name, size, content type (extension, sniff
@@ -242,8 +243,9 @@ fallback) and a relative url; these appear under each step's `artifacts` in
`inspect RUN_ID --json` and the TUI's `A` artifacts view, which groups them by
stage and visit, marks images and shows the recorded count,
capture-pending/not-recorded wording and partial-capture notes. Public entries
carry a `public/` prefix. `input.md`, `memory.md` and `output.md` are the primary
artifacts of every model visit.
carry a `public/` prefix. `input.md`, `memory.md`, `history.md` and `output.md`
are the primary artifacts of every model visit. To see what a late stage was
given, read its `memory.md`; `history.md` is the full record it could consult.
`GET /artifacts/<run>/<step>/<name>` serves the bytes (correct Content-Type and
Content-Length, HEAD, and Range/206/416 via `http.ServeContent`), refusing
traversal, absolute paths, symlink escapes and unknown runs/steps. A pre-turn