docs: describe the agent-driven workflow, drop the scripted driver model

Rewrite the workflow documentation to describe how the system actually works:
the agent (the session) is the brain and advances the queue by hand through the
`pipelines` CLI. There is no orchestration script, no driver, no polling loop and
no lane machinery, and none may be written.

- references/work.md: rewritten end to end. The queue-driver script
  (drivers/workd.sh), the claim-file ledger with atomic renames, the PAUSED
  marker and the poll loop are gone. State is now the server (authoritative for
  run state), the queue file (authoritative for intent) and the conversation.
  The agent reads the queue, picks the item, creates its worktree/branch and
  launches it with `pipelines run <pipeline> <brief> --json --yes`; progress is
  event-driven via a background `pipelines wait <run-id> [...]` (never polled);
  on completion the agent reconciles with `pipelines inspect <run-id> --json`,
  verifies it landed and starts the next item.
- references/queue.md: the landing gate runs the command directly
  (`git merge-base --is-ancestor <branch> main`, exit 0 = landed) instead of a
  `land-check.sh` helper; the never-delete-branch / never-remove-worktree rules
  are kept, and the waiting section states the agent advances the queue by hand.
- references/orchestration.md: intro and "Running and watching" state the
  agent-driven, event-driven model; "Pipeline choice" names the current set
  (Android, TUI, Server, Generic, Plan and land, UI sweep, Probe) by area and
  records the retired names.
- references/debugging.md: "Duplicated work after a driver restart" became
  "…after a session restart", resuming from the queue file not a cursor file.
- SKILL.md: the routing row no longer says "queue driver".
- AGENTS.md: the maintenance workflow names the current pipeline set instead of
  the retired `Pipelines maintenance - plan implement review`.
- internal/tui/AGENTS.md: the restart line no longer names lanes.
- docs/notes/agent-driven-work-model.md: the docs-fold note recording that
  docs/cli.md needs its "Scripted runs"/`--wait` framing aligned to the
  event-driven model, and that the dated evidence docs stay as they are.

Checked before committing: no packaged template directory exists in this repo, so
none needed updating; internal/author/install.go's managed file inventory needs no
change (no packaged reference was added or removed — the 13 listed files all
match internal/author/skill/references/); no stale `queue driver`/`workd.sh`/
`claim-file` references remain anywhere under internal/author. Genuine device
tooling (android/scripts/capture_png.sh-style) and server-side polling prose were
left alone.

Checks: `go test ./internal/author -count=1` ok; `go build ./...` clean;
`go vet ./...` clean; `gofmt -l .` clean.
This commit is contained in:
2026-10-18 01:50:55 +01:00
parent d0c12e3b75
commit 01d5dad9b9
8 changed files with 207 additions and 232 deletions
@@ -5,6 +5,11 @@ briefs and a set of managed runs, not the change itself. The implementer stage m
the change; the reviewer stages check it; the committer stage commits it. Route all
project work through Pipelines runs.
The agent advances this **by hand through the `pipelines` CLI**: it launches each run,
is woken when it finishes, reconciles against the server, and starts the next item.
There is no orchestration script, driver, polling loop or lane machinery, and none may
be written.
## Stance
- **Reconnoitre first.** Read enough of the repository, its notes and recent history
@@ -141,6 +146,24 @@ pipelines run "Docs fold"
## Pipeline choice
Choose by the **area the work is in**; each area pipeline reads the project's own map
for its build, test, run and capture commands:
- **`Android`** — `android/`.
- **`TUI`** — `internal/tui/`.
- **`Server`** — `internal/server/`, `internal/stage/`, `internal/pipeline/` and
`internal/protocol/`.
- **`Generic`** — only when a change genuinely spans areas.
- **`Plan and land`** — when the change needs a plan before implementation
(contract-level work).
- **`UI sweep`** — a full-screen review pass.
- **`Probe`** — a harness smoke check.
The retired names (`Pipelines quick`/`maintenance`/`critical`, `Focused tweak`, `Quick
tweak`, `Plan, implement, review`, `Harness probe`) stay in the registry because
definitions are immutable, but nothing should start them. If a pipeline is unavailable,
ask instead of silently bypassing it.
- Use a pipeline that keeps **implementer + reviewer + ui_reviewer + committer** for
anything that matters. The planner is the only stage a leaner variant may drop.
- **Never remove a review stage to go faster.** The reviewer stages are the
@@ -162,9 +185,10 @@ pipelines run "Docs fold"
- A run cannot approve its own work. When an item genuinely needs an operator gate
before it continues or commits, insert a `type=human` decision stage
(`references/format.md`); never invent a model stage that pretends to approve.
- Choose per item: a logic, server or format change usually wants the planner
(a plan/implement/review pipeline); a small, fully understood tweak may use the
leaner implementer-first variant. Both keep all review stages.
- Pick the pipeline whose area matches the change (above); `Generic` only when a change
genuinely spans areas. A logic, server or format change usually wants the planner
(`Plan and land`); a small, fully understood tweak may use the leaner area pipeline.
Both keep all review stages.
## Running and watching
@@ -179,9 +203,13 @@ pipelines run "Docs fold"
and are recorded on the run; `retry` reuses them. See `references/harnesses.md`
for how a stage's model and its repair path both use the effective model.
- Watch to a **terminal state** (`succeeded`, `failed`, `canceled`, `interrupted`).
Poll `CLI_PREFIX inspect RUN_ID --json` (or use `--wait`) until terminal. A reached
client wait limit is not a run failure: the run stays active; keep waiting or
reattach with the original request key, never start a duplicate run.
Progress is **event-driven, never polled**: `CLI_PREFIX wait RUN_ID […]` blocks until
the runs are terminal and is run as a **background task**, so the session is woken
exactly when the batch finishes; `CLI_PREFIX inspect RUN_ID --json` then reads the
retained outcome. A reached client wait limit is not a run failure: the run stays
active; keep waiting or reattach with the original request key, never start a
duplicate run. Do not build a polling loop, a cursor file or a driver script to
answer "is it done yet".
- Read the **outcomes**, not just the status: the option each stage returned, the
evidence it recorded, and any run or step diagnostic. Interpret diagnostics by
category (`references/debugging.md`).