Merge main into the engine loop improvements

Keep both intents: check stages, allow_workspace_changes, outcome repair
counts and Claude stage re-adoption from main beside the findings gate,
resume_session, applyLimitOn and exhaustion decisions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-03 14:24:27 +00:00
135 changed files with 7978 additions and 453 deletions
+10 -9
View File
@@ -42,14 +42,10 @@ preserved branch. `failed` and `interrupted` (server stopped mid-run) runs can b
retried: resume reruns the failed or interrupted stage, or starts the next stage
after the last completed one. `canceled` runs need a new run or direct work on
their branch. A retried stage's `input.md` carries a `# Previous attempt` section
(why the last attempt failed, plus the failed visit's partial `output.md` and
`private/` files copied under `previous-attempt/`) and, with `--input-file`, a
`# Operator correction` section holding only the overridden keys. A run that
failed because a loop exhausted its visits continues with `--extra-visits N
[--stage KEY]`; a run waiting on an exhausted loop (`on_exhausted: decide`) is
answered with `pipelines decide <id> --option accept|continue|abort`.
`inspect` shows the run's findings ledger (stable `F1`, `F2` IDs; stages report
them in a `# findings` section, `references/format.md`).
(why it failed; partial work under `previous-attempt/`) and, with
`--input-file`, a `# Operator correction`. An exhausted loop continues with
`--extra-visits N [--stage KEY]` (`references/control.md`); `inspect` shows the
findings ledger (`references/format.md`).
## Use an existing pipeline
@@ -70,7 +66,12 @@ Start from `pipelines templates` and `pipelines new NAME --template KEY`
(`research`, `task`); these fill in
the server's provider/model. Read `references/format.md` and
`references/practices.md` before writing prompts. Stage names: `plan` ·
`implement` · `review` · `ui-review` · `decide` (human) · `land`.
`implement` · `verify` (check) · `review` · `ui-review` · `decide` (human) ·
`land`. A `type=check` stage runs listed shell commands on the server, no
model, and routes on `pass`/`fail`: put one before review and use one with
`delivery=true` as the landing gate rather than having a model run the suite.
Stages with `shell` but no `edit` must not change the workspace (the server fails the
visit); give reviewers a `permissions.shell` allow-list.
Keep prompts short and objective: what the stage should produce and any real
constraints. The runner enforces turns, tools and limits and explains the output
+3 -3
View File
@@ -9,9 +9,9 @@ request does not authorize publication, execution or deployment.
Inspect actual source and diffs, run relevant tests and record exact results.
A model summary, committed branch or successful merge is not proof of runtime
behavior. Missing or partial diff capture must be reported as incomplete.
With delivery=true, the stage returns a clean candidate and the server checks and
lands it, first merging a moved main and re-checking the merged tree; only a real
conflict fails. Direct recovery can complete a reviewed merge without another pipeline.
With delivery=true (a model land stage on any harness, or a check stage), the
server checks and lands the candidate, first merging a moved main and
re-checking the merged tree; only a real conflict fails. Direct recovery can complete a reviewed merge without another pipeline.
Keep artifacts under the supplied run/stage artifact directory. Mark unverified
builds as WIP. Verify any download URL serves the real bytes before reporting it.
+79 -8
View File
@@ -2,8 +2,8 @@
A definition is Markdown made only of `# stage KEY` headings and fenced blocks;
no prose outside blocks. Blocks: `prompt`, `configs`, `tools`, `skills`, `edges`,
`checks`, `limits` (`references/control.md`), `permissions` and `notify`
(`references/notifications.md`). There are no memory, links, input or output
`checks`, `limits` (`references/control.md`), `permissions`, `notify`
(`references/notifications.md`) and, on check stages, `commands`. There are no memory, links, input or output
blocks; stages communicate through `output.md` (`# handoff`) and `public/`.
Schedules are saved run configurations, never definition blocks
(`references/schedules.md`).
@@ -160,8 +160,9 @@ edges are allowed.
(`pipelines new NAME --template KEY`) fill them in; copy those IDs into a
hand-written draft. Availability needs `pipelines provider-check`.
- `harness=opencode|pi|claude`; omission means OpenCode (`references/harnesses.md`).
`claude` needs `provider=anthropic` and a Claude model ID, and accepts no
`permissions` block, `delivery=true` or run write paths.
`claude` needs `provider=anthropic` and a Claude model ID; its `permissions`
block may hold only a `shell` allow-list (no `edit` patterns or run write
paths).
- `retries` 0–100, default 2 (three attempts). Retries cover transport failures
and timeouts; a stage with `edit`/`shell` (or no tools block) never replays
admitted work.
@@ -172,7 +173,10 @@ edges are allowed.
- `budget_usd`, `budget_tokens`: positive caps on reported usage, shared across
attempts and visits of this stage; totals include cache reads and writes. Set
only when the user asks or a measured visit exists (`references/practices.md`).
- `delivery=true`: the landing stage's gate (below). OpenCode harness only.
- `delivery=true`: the landing stage's gate (below), on any harness, or on a
check stage.
- `allow_workspace_changes=true`: lets a stage with `shell` but no `edit` leave file changes
in the run directory (below).
- `resume_session=true`: on a loop visit, resume this stage's previous harness
session instead of starting a cold one (Claude harness only; others start
fresh; a session Claude Code no longer has starts fresh). Use it for
@@ -196,6 +200,20 @@ patterns) and `shell` (exact commands) arrays. It narrows declared tools; it nev
enables a missing one. Empty arrays deny; wildcards, chaining, redirects and
traversal are rejected. With restricted edits and shell enabled, list shell too:
`{"edit":["README.md","plugin/*.qml"],"shell":["bash -n install.sh"]}`.
On `harness=claude` only `shell` is accepted; each entry becomes a Claude Code
rule (`go test ./...` -> `Bash(go test ./...)`) and an entry ending in ` *` is a
prefix (`git diff *` -> `Bash(git diff:*)`, any arguments; claude only). Claude
Code checks each part of a chained command, and every other command is
refused. A read-only reviewer: `{"shell":["git diff *","git log *","go test ./..."]}`.
A stage whose `tools` block has `shell` but not `edit` must leave the run directory as it
found it: the server compares the workspace before and after the visit and
fails the visit (`permission denied: ... changed the workspace (added x, ...)`,
following the `error` edge) when any file changed, outside the run's artifact
directories and a harness state directory inside the workspace. Committing is
not a change; merging or generating files is. Set
`allow_workspace_changes=true` on a stage that legitimately writes (for
example a land stage that merges main itself).
Named MCP entries are an explicit allowlist for unattended Claude stages:
`mcp:ai-memory` allows that server's tools, while `mcp:linear/list_issues`
@@ -252,6 +270,56 @@ A check must fail when it cannot run: validation rejects `|| true`, `|| :`,
`|| exit 0`, `|| echo`, negated file tests, `! command -v tool ||`, an `if` with no
failing else, and `set +e`. Cover every language the run can change.
## Check stages
`type=check` runs shell commands on the server, without a model, and routes on
`pass` or `fail`. Use it before review, so a reviewer never sees a red tree, and
as the landing gate instead of a model stage that runs the suite itself.
````markdown
# stage verify
```configs
type=check
command_timeout=15m
```
```commands
uv run ruff check .
uv run ty check
uv run pytest -q
```
```edges
pass -> review
fail -> implement
```
```limits
{"max_visits":3}
```
````
- `commands` (required): 1-20 lines, one `sh -c` command each, run in order
from the run directory with its workspace environment; blank and `#` lines are
ignored. The first failure stops the rest (`not_run`) unless `keep_going=true`.
Lint rejects silent guards (`|| true`) as for `checks`.
- Configs: `command_timeout` (per command, default `30m`), `timeout` (the whole
stage, default `1h`), `keep_going=true|false`, `delivery=true`. No prompt,
tools, model or skills.
- Edges: `pass` and `fail` are required and are the only outcomes besides
`error` (an infrastructure failure). A `fail` loop back needs `limits`.
- Output: the step records each command's status (`passed`, `failed`,
`timed_out`, `not_run`), exit code, duration and output (64 KB per failing
command, head and tail kept), plus a one-line summary as its verdict. Its
`# handoff` names the failing commands with the tail of their output, and the
full outputs follow, so the next stage sees exactly what failed.
- `delivery=true` makes it the landing gate: the server commits what the run
left uncommitted (run worktrees), merges a moved `main`, runs the commands in
a fresh worktree of the commit and fast-forwards `main` on `pass`. A failing
command is `fail` with `main` untouched; a gate problem (dirty checkout,
conflict, refused fast-forward) is `error`.
## Human stages
`type=human` pauses the run until a person picks one of its non-`error` edges
@@ -263,14 +331,17 @@ wait survives restarts and is never killed by a stage timeout or `max_visits`.
## Land stage and delivery gate
A workflow that commits its change ends in `land`: a model stage with
`read`/`glob`/`grep`/`shell`, no `edit`, that commits locally. Its prompt states:
A workflow that commits its change ends in `land`: either a check stage with
`delivery=true` (above; no model, the server commits and lands), or a model
stage with `read`/`glob`/`grep`/`shell`, no `edit`, that commits locally. A model
land stage's prompt states:
1. Commit only this run's changes (server list + git status).
2. Check the staged diff for unrelated work and secrets.
3. No empty commit, push, amend or rebase. Report the hash.
With `delivery=true` and `checks` commands, after `land` succeeds the server:
With `delivery=true` and `checks` commands (any harness), after `land` succeeds
the server:
commits whatever the run left uncommitted when the item is the run's own
worktree (see "Run worktrees" below); requires the item checkout to be clean,
untracked files included (the main checkout need not be: the final