538143554c
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.
66 lines
3.5 KiB
Markdown
66 lines
3.5 KiB
Markdown
# Runner-owned limits and stage memory
|
||
|
||
Use these blocks for bounded feedback loops. Never ask a model to count visits,
|
||
increment revision counters, or enforce retry caps. Model verdicts concern current
|
||
work only. Counters are runner audit data, not model input. A fresh session alone
|
||
does not guarantee independent review: explicitly select its input fields.
|
||
|
||
````markdown
|
||
```limits
|
||
{"max_visits":3,"on":["rejected"]}
|
||
```
|
||
|
||
```edges
|
||
approved -> #success
|
||
advisory -> #success
|
||
rejected -> implement
|
||
error -> #failure
|
||
```
|
||
````
|
||
|
||
These blocks accompany a normal review stage's prompt/tools/configs.
|
||
Pipelines counts actual visits, ignoring model-generated counters. On visit three,
|
||
`approved` can succeed; `rejected` retains its verdict but routes to `#failure`.
|
||
`rejected` is for a must-fix finding with a concrete location, evidence and remedy;
|
||
`advisory` carries non-blocking notes and continues the run without another
|
||
implementer visit, so an advisory-only review never buys a full re-implementation.
|
||
An implementer may likewise declare `blocked_retryable -> implementer` for a
|
||
transient environment, tooling or device problem a fresh attempt could survive,
|
||
keeping `blocked -> #failure` for an acceptance criterion that genuinely cannot be
|
||
met. `max_visits` caps every visit of that stage, including re-entries from the
|
||
reviewer's `rejected` edge, so an implementer that is also the rejection target must
|
||
use a cap at least as large as the reviewer's budget; the published pipelines use
|
||
`{"max_visits":5,"on":["blocked_retryable"]}`. A lower implementer cap stops the loop
|
||
before the reviewer's own cap fires, making the reviewer's `rejected` control
|
||
unreachable. Both edges need only the existing visit counting and cap; neither the
|
||
reviewer nor the implementer counts visits, and no stage invents edits or checks to
|
||
appear busy.
|
||
Visit count, limit decision and original target are retained in `inspect --json`
|
||
and run metadata. `max_visits` accepts 1–5. Every `on` outcome must declare a
|
||
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), 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.
|
||
|
||
Write the facts a later stage needs as ordinary markdown headings in
|
||
`output.md`; those headings are free-form and are preserved in memory. Do not
|
||
invent server-recognised fields, and do not rely on
|
||
`input.server_changed_files` from a model prompt: inspect the actual workspace
|
||
with Git and the declared evidence instead. Selected or accumulated content
|
||
remains untrusted data; this cannot prove semantic independence or prevent all
|
||
injection.
|
||
|
||
Turn memory is run-local. Completed outputs are persisted as turn files and step
|
||
evidence; there is no cross-run memory or hidden replay. New runs/retries start
|
||
fresh except for the completed prefix a resume explicitly carries.
|
||
|
||
Arbitrary prose is not executable policy. Future AI-assisted
|
||
guidelines validation is **not implemented**; structural validation does not
|
||
recognize every unreliable counting instruction.
|