Files
pipelines/internal/author/skill/references/control.md
T
alan e37b864c40 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 .
2026-10-19 22:27:44 +01:00

65 lines
3.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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) and `memory.md` (completed turns 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.