Merge main; align lint and skill practices with essential memory/history and the four graded examples

This commit is contained in:
2026-11-04 13:08:47 +00:00
217 changed files with 8560 additions and 1937 deletions
+13
View File
@@ -95,6 +95,19 @@ Claude Code also accepts `/clear` in `-p --input-format stream-json` mode, but
the CLI then picks the new session id itself. Re-keying keeps one path for all
three harnesses and lets the server choose the id.
## Chat list activity
Every `chat_sessions` row carries `activity` (turn running, running background
tasks), and `chat_activity` pushes each change to every connection (see
`docs/cli.md`). Background tasks are the same shells all three harnesses already
report: OpenCode shells, Codex `commandExecution` items, and Claude Code
background Bash and Agent/Task subagents. A chat whose last viewer left stays
observed while its tasks run, so their exits are seen. That is bounded by the
unattended limits (16 chats, 6 hours) and by the harness: when a Claude Code
process exits, its background tasks are reported exited because they ran inside
it. After an OpenCode or Codex stream reconnects, the shell set is re-read from
the harness.
## Web interaction contract
All advertised chat adapters (OpenCode V2, Codex and Claude Code) implement the
+78 -28
View File
@@ -71,8 +71,9 @@ token-reporting stage reported one, and the summed cost, plus counts of stages
that did or did not report a cost. A stage whose provider reported no cost is
counted as cost-unknown and never contributes a fabricated or zero cost, and no
cost/token count is inferred from output length or transcript text. The totals are
the sum of the per-run totals `inspect` shows. `pipelines stats --json` exposes
these aggregates.
the sum of the per-run totals `inspect` shows. Only usage rows whose recorded
step still exists are counted, so rows orphaned by an old history wipe are ignored
(not deleted). `pipelines stats --json` exposes these aggregates.
Use `:status` on any TUI page to open server and ntfy information. Scroll with
arrows or `j/k`, PgUp/PgDn; `r` refreshes and Esc closes without changing the page.
@@ -152,7 +153,7 @@ pipelines edit # fuzzy pipeline selection
pipelines edit "bug fix" # ask the harness what to change
pipelines edit "bug fix" "Add a review step"
pipelines new "release notes" "Summarize changes and notify my phone"
pipelines new "Add a feature" --template task
pipelines new "Add a feature" --template feedback-loop
```
`new` opens the configured harness (Pi or OpenCode; host by default, or
@@ -213,27 +214,21 @@ is not ownership (the kernel lock is). This is a local-filesystem lock, not a
distributed lease; hard-link database aliases and filesystems without reliable
advisory locking are unsupported.
Use `:templates` for four simple, manual-only starters: task, review, research,
and plan/implement/review. **Submit template** (`s` or Enter) asks for a
Use `:templates` for the four manual-only examples, read in order: one stage,
two stages, a feedback loop and a human decision (`examples/README.md`). A
brand-new database already holds them as ordinary pipelines; the server seeds
them once and never again, so removing them or upgrading never brings them back.
**Submit template** (`s` or Enter) asks for a
name without opening an editor. Enter saves a retained draft, then a separate
confirmation publishes it as a new pipeline. Esc before naming creates nothing;
Esc at publication keeps the draft. **Customize** (`e`) opens the editor picker
instead. Both paths inherit the configured default model and preserve existing
pipelines/history. The research starter requires configured web search support.
Starter stages use goal-appropriate tools: the task worker and the three-stage
implementer edit and run checks, the task, planner and review stages may
search/fetch official sources only when external knowledge is genuinely needed,
the three-stage implementer has no web tools and follows the planner's research,
the standalone review stage never edits or runs commands and says so explicitly,
and the three-stage reviewer independently inspects the real changes and receives
the planner-owned acceptance checks rather than the implementer's summary,
approving only when the applicable acceptance checks were independently observed
passing and no unresolved substantive issue remains. The task and three-stage
templates end in a committer stage that stages the runner's captured changed paths
and commits locally without ever pushing; a genuine operator gate is a `type=human`
decision stage, never a model stage pretending to approve. Editing a bundled
template source changes no installed or published definition; a starter becomes an
immutable version only after explicit authoring and publication.
pipelines/history. Only the stages that make the requested change (`implement`,
`act`) may edit; the others read, and the loop's reviewer also runs read-only
checks. No example commits, pushes or deploys. A genuine operator gate is a
`type=human` decision stage, never a model stage pretending to approve. Editing a
bundled template source changes no installed or published definition; a template
becomes an immutable version only after explicit authoring and publication.
Home's `n` / `:new` and **Customize** (`e`) on a template first ask how to author the new
pipeline: **nvim** opens a retained Markdown draft file, or a configured harness
@@ -284,6 +279,19 @@ pipelines validate /path/to/pipeline-123.md --json
pipelines submit /path/to/pipeline-123.md --json
```
`validate` and `submit` apply the authoring lint to new drafts (stored versions
keep loading and running unchanged). Errors reject the draft and are listed
together, one `stage KEY: RULE: message` per line: a stage that can modify the
workspace without a `checks` block (`none: <reason>` or, on a `delivery=true`
stage, the commands), a prompt naming an undeclared outcome ("report skipped"),
a "the server lands it" claim with no `delivery=true` stage, a loop edge without
`limits`, and a check guard that passes without running (`|| true`,
`[ ! -x tool ] || ...`). Warnings print as `warning: ...` on stderr (the
`warnings` array with `--json`) and do not block: runner boilerplate in a prompt,
a prompt over 2000 bytes, an instruction to read the full history every visit,
and back-quoted non-outcome words after return/report. The skill's
`references/practices.md` explains each rule.
`--json` never opens an editor or picker; provide a name explicitly. It returns
draft metadata including `path`, `name`, `server`, `create_only`, and `base_version`.
`--no-open` prints the path and review commands. `$PIPELINES_DRAFT_DIR` overrides
@@ -349,8 +357,23 @@ Every run summary (`list_runs` rows, `get_run`, subscribe snapshots and terminal
with turn documents and session exports, server-created Pi session directories,
plus an estimate of its database rows). It is cached in `pipeline_runs.size_bytes`,
invalidated by triggers when the run changes, measured on completion, and
backfilled in the background; 0 means not measured yet. `delete_runs` removes
finished runs to free space:
backfilled in the background; 0 means not measured yet.
`list_runs` rows (and `get_run`) also carry `usage`, the run's totalled reported
model usage, in the same shape as the run detail's total: `tokens_total`,
`stages` and `tokens_known_stages` (the total is partial when fewer stages
reported tokens than recorded usage), the `tokens_in`/`tokens_out` split with
`split_known`, the `tokens_reasoning`/`cache_read`/`cache_write` components with
`cache_known` (true only when every token-reporting stage recorded them;
`tokens_total` includes cache reads, which dominate for a caching harness), and
`cost_usd` with `cost_known_stages`/`cost_unknown_stages`. The list computes it
with one grouped SQL aggregate per batch of 100 runs over the stored per-stage
usage rows joined to their recorded steps, never a step load or transcript parse.
It is omitted for a run with no recorded model usage; an older server omits it on
every row, and clients then show nothing. Subscribe snapshots and `run_event`
frames do not carry it, so a running run's total refreshes with the next list.
`delete_runs` removes finished runs to free space:
```json
{"type":"delete_runs","id":"1","run_ids":[12,13,99]}
@@ -461,6 +484,20 @@ sessions pipeline runs create. The protocol types are:
for the run that owns them. The list is fail-closed: with no registry and no
store it returns an empty list, never the endpoint's whole session list. A
session is never marked `busy`: any number of clients may watch and write one.
Each row carries `activity` (`turn_running`, `background_tasks`, `seq`): the
server's live view of the session. An older server omits it.
- `chat_activity` is pushed to every open connection, not only the chat's
watchers, when a session's turn starts or ends or its count of running
background tasks changes (shells, background commands, Claude Code background
Bash and subagents, Codex command executions). The body is `chat_activity`
(`session_id`, `turn_running`, `background_tasks`, `seq`). It is sent on those
transitions only, never per output chunk. `seq` increases with every change
and keeps increasing across a restart, so a client keeps the snapshot (list
row or push) with the larger `seq`. Background tasks are counted only while
the server observes the session: after a chat's last viewer leaves, the
server keeps observing it while its tasks run (bounded like an unattended
turn: at most 16 such chats and 6 hours). Once released it reports none
rather than a stale count.
- `chat_subscribe` attaches a connection to one session's shared live stream (body
`session_id`) and replays the session's still-pending approval requests, so every
client that watches a session sees every frame any client's turn produces — the
@@ -627,8 +664,12 @@ per-step `provider`/`model`, and the run's graph shows the effective pair). Each
model step also records the usage the harness reported, carried from the same
accounting the stage already used for its budget: `usage.tokens_total`, the
`tokens_in`/`tokens_out` split when the harness reported it (`split_known`),
`cost_usd` when reported, and the explicit `tokens_known`/`cost_known`/
`split_known` markers. The run detail totals those stages as `usage`, so a
`cost_usd` when reported, the `tokens_reasoning`/`cache_read`/`cache_write`
components when the harness reported the component split (`cache_known`; rows
recorded before these were kept lack it, so their cache share is unknown), and
the explicit `tokens_known`/`cost_known`/`split_known` markers. Some subscription
providers report `cost_known` with no positive `cost_usd`; clients show that cost
as not reported, never as $0. The run detail totals those stages as `usage`, so a
mixed-model run shows each stage's model, tokens and cost and the run total. A
stage whose provider reported no cost shows its tokens with `cost_known: false`
(never a fabricated or zero cost), and a harness that reports only a total (Pi)
@@ -637,6 +678,13 @@ total as input tokens. The
CLI is the deliverable; a TUI picker for choosing overrides is a documented
follow-up, not half-built.
The run detail (`inspect <id> --json`, `get_run`) also carries an additive
top-level `warnings` string list, derived at read time from the steps; `inspect`
repeats each entry on stderr as `warning: ...`. Today it names every visit whose
retained file-change capture was `partial` or `unavailable`, because such a
capture is not a complete workspace diff and disables the server skip fallback
(see [stage-file-diffs.md](stage-file-diffs.md)). Older peers ignore the field.
On either the runs list or run inspector, press `P` (or use `:pipeline`) to open
the selected run's exact pipeline version. Navigation does not cancel the run.
@@ -754,6 +802,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 +810,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
+4 -3
View File
@@ -146,9 +146,10 @@ go run ./cmd/pipelines --url ws://127.0.0.1:8081/connect ping --json
```
If the TUI is on another machine, use an SSH/VPN tunnel instead of exposing the
unauthenticated pipeline port publicly. The bundled examples are not automatically
submitted. Open `:templates` and use **Submit template** to name/review/publish a
simple starter, or **Customize** to edit it first. All bundled starters are manual-only.
unauthenticated pipeline port publicly. A brand-new database starts with the four
bundled example pipelines, seeded once; an existing database is never changed.
Open `:templates` and use **Submit template** to name/review/publish another copy,
or **Customize** to edit it first. All bundled examples are manual-only.
## 4. Android
+7 -7
View File
@@ -29,15 +29,15 @@ sandbox for model tools.
1. Pick a disposable project without secrets or valuable uncommitted changes.
A remote browser selects a directory on the **server**, not its own computer.
2. Open **Settings → Templates** in the web app or `:templates` in the TUI.
Create the read-only **review** starter first. Fresh databases have no
published pipelines; choosing a template creates one explicitly.
2. A fresh database already holds the four example pipelines
(`examples/README.md`). Run the read-only **Example 1: one stage** first.
3. Ask it to review one short file. Watch the graph and inspect the retained
report and the stage's **Audit → Session** evidence.
4. Try a research or document starter. Check citations and quoted source content
yourself; a successful stage is not proof of factual accuracy.
5. Only then try an editing starter. Inspect actual changes and test evidence,
not just the model's summary. Keep version control/backups.
4. Try **Example 2: two stages** on a few local files. Check the result against
the sources yourself; a successful stage is not proof of factual accuracy.
5. Only then try an editing example (**feedback loop**, **human decision**).
Inspect actual changes and test evidence, not just the model's summary. Keep
version control/backups.
Editing a draft does not publish it. Publication creates an immutable version;
runs retain the version they used. Export/import bundles contain **definitions
+4 -3
View File
@@ -132,9 +132,10 @@ fire, which silently makes the reviewer's `rejected` control unreachable. The ru
already counts the visits and stops at the cap, so neither loop needs new server
code and no model counts visits.
The previous turn's output and the run's accumulated `memory.md` are handed to
each model stage as files; there is no `memory` map or field selection. Put the
facts later stages need in free-form headings. Only the `# outcome` section is
The previous turn's output (`input.md`), a capped essential `memory.md` (inlined)
and the run's full `history.md` are handed to each model stage as files; there
is no `memory` map or field selection. Put the facts the next stage needs in a
short `# handoff` section; it is what the next stage sees first. Only the `# outcome` section is
interpreted. Latest completed outputs are shared only within this run. Read
provenance and routing overrides are retained in SQLite and exposed in run
inspection/metadata.
+17 -8
View File
@@ -1,7 +1,7 @@
# Model turns, results and scoped tools
Model stages are file-based. Each visit reads `input.md` and `memory.md` and
returns the complete markdown for `output.md`. Only the outcome section is
Model stages are file-based. Each visit is given its capped essential
`memory.md` inline, may read `input.md` and `history.md` on demand, and returns the complete markdown for `output.md`. Only the outcome section is
interpreted; the rest is free-form text for the next stage and the operator.
## Turn files
@@ -11,6 +11,7 @@ Every model visit gets its own directory under the run's artifact root:
```
<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/
@@ -20,20 +21,28 @@ Every model visit gets its own directory under the run's artifact root:
prompt under a `# Run task` heading (its own headings demoted two levels) and
add the previous visit's body under a `# Previous turn output` heading, so
every stage sees what the run is for even when an earlier stage summarised.
- `memory.md` is one `## <stage> · visit <n>` section per completed turn: the
- `memory.md` is essential memory, hard-capped at 4 KB (`turn.EssentialCap`)
and inlined in every stage's prompt: the run task, the previous stage's
handoff (its `# handoff` section, else the head of its output) with outcome and
public/ additions, a one-line-per-stage outcome ledger and the server-captured
changed files. Every truncation names the file holding the full text.
- `history.md` is one `## <stage> · visit <n>` section per completed turn: the
turn body followed by a system-written, sorted list of the files that turn
added to `public/`.
added to `public/`. It is what `memory.md` used to be, and it is never inlined.
- `private/` belongs to one visit and is never handed to a later stage.
- `public/` is shared by every stage in the run.
The server writes `input.md` and `memory.md` before the model runs and
The server writes `input.md`, `memory.md` and `history.md` before the model runs and
`output.md` after it. All three are inventoried as step artifacts, together with
`private/` and the files in `public/`. See
[stage artifacts](stage-artifacts.md) for capture limits and URLs.
A text-only stage (an explicit empty `tools` block) cannot read files, so the
server embeds the contents of `input.md` and `memory.md` in its prompt instead.
A stage with tools receives the paths and reads them itself.
Every stage gets `memory.md` inline. A stage with `read` is given the paths of
`input.md` and `history.md` to read only when it needs more detail. A stage
without `read` cannot, so the server also inlines `input.md` (capped at 32 KB);
`history.md` is never inlined. Long runs used to resend the whole history on
every model call (19 KB average, 92 KB maximum in measured runs); the essential
file bounds that per-call cost.
## Output contract
+5 -2
View File
@@ -6,6 +6,7 @@ the run's artifact root:
```
<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/
@@ -19,8 +20,10 @@ directories idempotently; it never deletes or rewrites existing files.
prompt under a `# Run task` heading (headings demoted two levels) followed by
the previous visit's output body (without the outcome section) under a
`# Previous turn output` heading. Carrying the task forward means a stage that
only summarised its own work is never the sole carrier of what the run is for. `memory.md` is plain
markdown: one `## <stage> · visit <n>` section per completed turn, with that
only summarised its own work is never the sole carrier of what the run is for.
`memory.md` is essential memory (`turn.RenderEssential`, capped at 4 KB, inlined
in the prompt): task, previous stage's `# handoff` (or truncated output head),
outcome ledger and captured changed files. `history.md` is plain markdown: one `## <stage> · visit <n>` section per completed turn, with that
turn's body — its own ATX headings demoted two levels, so the turn heading stays
the structural one — followed by a system-written list of files it added to
`public/`.
+4 -3
View File
@@ -379,9 +379,10 @@ File-attachment bytes are stored by ntfy, not permanently archived in SQLite;
run metadata stores the delivered filename/URL, and workspace files may later
change. Download attachments before your ntfy retention expires.
Bundled starters do not require notification or schedule setup. Add a `notify`
block to the stages of your own workflow using the example above; configure the
system phone connection first. Adding a schedule activates it on publication,
Bundled examples need no schedule setup. **Example 4: human decision** shows
`notify` hooks (`plan` on failure, `decide` on `waiting`, `act` on success and
failure); they only deliver once the system phone connection is configured. Add a
`notify` block to the stages of your own workflow the same way. Adding a schedule activates it on publication,
so review it explicitly rather than copying a scheduled niche example.
References: [publishing](https://docs.ntfy.sh/publish/),
+4 -3
View File
@@ -12,6 +12,7 @@ The server creates this layout under the run's artifact root:
```
<artifacts root>/<run>/stages/<seq>-<stage>/input.md
<artifacts root>/<run>/stages/<seq>-<stage>/memory.md
<artifacts root>/<run>/stages/<seq>-<stage>/history.md
<artifacts root>/<run>/stages/<seq>-<stage>/output.md
<artifacts root>/<run>/stages/<seq>-<stage>/private/
<artifacts root>/<run>/public/
@@ -22,7 +23,7 @@ directory holding the database (`<data directory>/artifacts`) and can be pointed
elsewhere with the server's `ArtifactsRoot` option. Only model stages get a turn
directory.
- `input.md`, `memory.md` and `output.md` are server-written turn files.
- `input.md`, `memory.md`, `history.md` and `output.md` are server-written turn files.
- `private/` belongs to this visit. It is writable by the stage and is never
handed to a later stage.
- `public/` is run-level and shared by every stage. Files are writable and
@@ -36,7 +37,7 @@ files.
The prompt names the turn directory, the writable `private/` directory and the
shared `public/` directory, and says that the server owns `input.md`,
`memory.md` and `output.md`. Those are the exact paths the tool permission rules
`memory.md`, `history.md` and `output.md`. Those are the exact paths the tool permission rules
grant. A Pi stage also receives `PIPELINES_ARTIFACTS_DIR`; OpenCode V2 tools run
inside the shared serve process, so its prompt is the reliable carrier.
@@ -54,7 +55,7 @@ server-relative `url`. Public entries carry a `public/` name prefix. The same
fields appear under each step's `artifacts` in `pipelines inspect RUN_ID --json`
and in the TUI.
`input.md`, `memory.md` and `output.md` are the primary artifacts of every model
`input.md`, `memory.md`, `history.md` and `output.md` are the primary artifacts of every model
visit. `private/` files are listed without a prefix; shared files are listed as
`public/...` on every visit that can see them.
+36 -4
View File
@@ -26,10 +26,21 @@ includes the same evidence under each step's `file_changes` field.
`secrets/`, Git internals and `node_modules/` are excluded. This is a path-based
precaution, **not secret-content scanning**; ordinary source patches may contain
sensitive text and become part of retained history.
- Limits: 10,000 inventoried entries, 1 MiB per file, 32 MiB per snapshot,
five seconds per snapshot, 5,000 combined lines per textual comparison,
64 KiB per patch and 128 KiB serialized file evidence per visit. Oversized,
unreadable, omitted or truncated evidence is explicitly flagged partial.
- Limits: 10,000 inventoried entries, 1 MiB per file and 32 MiB per snapshot of
retained text, 256 MiB per hashed file, five seconds per snapshot, 5,000
combined lines per textual comparison, 64 KiB per patch and 128 KiB serialized
file evidence per visit. Oversized, unreadable, omitted or truncated evidence
is explicitly flagged partial.
- Over-budget content degrades to a listing, not silence: a text file over 1 MiB,
or beyond the 32 MiB snapshot budget, is still compared by SHA-256 and a change
is listed with `no_patch: true` (and `truncated`) but no patch. In a Git working
tree, a path the snapshot could not compare at all (above 256 MiB, unreadable,
or past the time/file limit) is listed the same way when its
`git status --porcelain` entry changed during the visit; a path dirty with the
same status before and after cannot be proven changed and stays in `skipped`.
Git is only read (`--no-optional-locks`); protected paths are never listed.
- `pipelines inspect RUN_ID --json` carries a top-level `warnings` list (also
printed to stderr) naming every visit whose capture was partial or unavailable.
- Failed/canceled stages still retain changes when execution returns. Unconfirmed
agent cleanup is flagged partial. A server/process crash cannot guarantee an
after-snapshot; recovered steps without capture say “not recorded.”
@@ -41,3 +52,24 @@ includes the same evidence under each step's `file_changes` field.
Snapshots are transient server memory. The database retains patches/metadata,
not full copies of every workspace file. No new model calls are used for capture.
## Server skip fallback
A non-human stage that declares a `skipped` edge (typically a UI reviewer) is
completed by the server without a model call, and routed along `skipped`, only
when every earlier visit of the run recorded a **complete** capture with **no**
changed files and no image artifact. The step's verdict reason begins
"Server fallback skip (no model run):" and has `reason_source: fallback`.
Everything else runs the stage's model, which may still choose `skipped` itself:
- any recorded file change, whatever its path or extension (no repository layout
or "non-UI" extension list is assumed: Go TUIs, Flutter `.dart`, Kotlin, Swift,
templates, strings and config files can all be rendered surface);
- any partial or unavailable capture, or a visit with no capture (a crash, a
historical row, a human decision during which the workspace was unobserved, or
a checkpoint-retry prefix);
- `auto_skip=false` in the stage's `configs`.
A wrong run costs one model call; a wrong skip would ship an unreviewed change, so
absent or partial evidence is never read as "nothing changed".
+1 -1
View File
@@ -106,7 +106,7 @@ Its complete model/web/phone execution was **not tested**. It used dated web
evidence → verify/enrich → Markdown report → native ntfy attachment through the
system connection; the LiveChart schedule was fetched during that investigation.
Removing its bundled starter does not remove its published history. Current
snapshot fixtures use the generic `examples/three-stage.md` starter.
snapshot fixtures use the generic `examples/human-decision.md` example.
`PIPELINES_UX_SNAPSHOT_DIR=<directory> go test ./internal/tui -run
TestUIUXReviewSnapshots -count=1` regenerates the existing snapshots without server