@defrex/autobuild 1.0.0-beta.4 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/README.md +1 -1
  2. package/SPEC.md +45 -36
  3. package/docs/agent-runtimes.md +157 -0
  4. package/docs/build-store.md +123 -0
  5. package/docs/builds.md +82 -0
  6. package/docs/cli.md +48 -0
  7. package/docs/configuration-overview.md +93 -0
  8. package/docs/configuration.md +1626 -204
  9. package/docs/dispatcher-hosting.md +115 -0
  10. package/docs/dispatcher.md +59 -0
  11. package/docs/forges.md +121 -0
  12. package/docs/getting-started.md +60 -0
  13. package/docs/glossary.md +60 -0
  14. package/docs/hosted-service.md +2 -2
  15. package/docs/intake.md +48 -0
  16. package/docs/integration-overview.md +81 -0
  17. package/docs/operating.md +114 -0
  18. package/docs/operator-api.md +6 -6
  19. package/docs/operator-surfaces.md +90 -0
  20. package/docs/overview.md +49 -0
  21. package/docs/plugin-authoring.md +426 -0
  22. package/docs/remote-store-protocol.md +8 -8
  23. package/docs/seams.md +66 -0
  24. package/docs/setup.md +8 -6
  25. package/docs/skills.md +119 -0
  26. package/docs/ticket-sources.md +132 -0
  27. package/docs/tickets.md +69 -0
  28. package/docs/troubleshooting.md +111 -0
  29. package/docs/upgrading.md +50 -0
  30. package/docs/verification.md +146 -0
  31. package/docs/website.md +47 -5
  32. package/docs/workspaces.md +152 -0
  33. package/package.json +5 -4
  34. package/packages/core/src/cli/env.ts +1 -1
  35. package/packages/core/src/cli/help.ts +4 -2
  36. package/packages/core/src/config/landing.ts +8 -0
  37. package/packages/core/src/config/reference-metadata.ts +31 -0
  38. package/packages/core/src/config/reference.ts +342 -0
  39. package/packages/core/src/config/roles.ts +1 -1
  40. package/packages/core/src/config/schema.ts +344 -6
  41. package/packages/core/src/ontology.ts +2 -2
  42. package/packages/core/src/open-map.ts +3 -1
  43. package/skills/finalize/SKILL.md +3 -1
  44. package/skills/guide/SKILL.md +42 -25
  45. package/skills/guide/references/operator-api.md +18 -10
  46. package/skills/guide/references/plugin-authoring.md +227 -303
  47. package/skills/guide/references/remote-store-protocol.md +8 -8
  48. package/skills/guide/references/setup.md +8 -6
  49. package/skills/implement/SKILL.md +4 -2
  50. package/skills/operate/SKILL.md +26 -27
  51. package/skills/plan/SKILL.md +12 -4
  52. package/skills/spec/SKILL.md +1 -1
  53. package/skills/tickets/SKILL.md +1 -1
  54. package/templates/hosted-service/package.json +2 -2
package/README.md CHANGED
@@ -26,7 +26,7 @@ From the repository you want built, install Autobuild as a development dependenc
26
26
  <!-- release-install:start -->
27
27
 
28
28
  ```sh
29
- bun add -d --exact @defrex/autobuild@0.14.0
29
+ bun add -d --exact @defrex/autobuild@1.0.1
30
30
  ```
31
31
 
32
32
  <!-- release-install:end -->
package/SPEC.md CHANGED
@@ -395,7 +395,7 @@ files, including development configs, remain exactly as installed.
395
395
  - **harvest-runner** — one staged repository workflow (`scan → synthesize ⇄
396
396
  review → file`) under a repository lease; not a build and not a phase.
397
397
  - **ingesters** — other outer-loop processes turning signals into proposals (§12).
398
- - **operator** — UI process(es); see §14.
398
+ - **operator UI** — UI process(es); see §14.
399
399
 
400
400
  Ticket-source ready scans run immediately when no completed measurement exists,
401
401
  then every
@@ -443,6 +443,9 @@ One name, used everywhere. Every noun lives in exactly one layer.
443
443
 
444
444
  | Term | Meaning |
445
445
  |---|---|
446
+ | **Operator** | The role driving Autobuild through `ab` or MCP, normally an agent; a human may also drive the interface directly |
447
+ | **Operator agent** | An agent taking the operator role, guided by `ab-operate` |
448
+ | **Human (maintainer)** | The person authorizing work and making human decisions; addressed as “you” in reader-facing prose |
446
449
  | **Signal** | Raw input from the world — a Sentry issue, an observation |
447
450
  | **Proposal** | A synthesized candidate ticket sitting in Triage, awaiting grooming |
448
451
  | **Ticket** | A source record of kind `work` (default) or `node`, optionally targeting a same-source node; ordinary groomed work is dispatchable |
@@ -456,7 +459,7 @@ One name, used everywhere. Every noun lives in exactly one layer.
456
459
  | **Verdict** | Structured terminal outcome: reviews use `approve` \| `revise(findings)` \| `escalate(reason)`; agent verification uses `pass` \| `fail(report)` \| `skip(reason)` |
457
460
  | **Finding** | One structured item inside a `revise` verdict (file refs, description, severity) |
458
461
  | **Observation** | An out-of-scope discovery emitted mid-build: `followup` \| `refactor` \| `latent-bug` |
459
- | **Escalation** | A parked request for human input, answerable from any UI |
462
+ | **Escalation** | A parked request for external judgment from the operator agent or human, answerable from any UI |
460
463
  | **Event** | An append-only log record; everything above leaves one |
461
464
 
462
465
  Reserved-word discipline: **build** names the whole pipeline execution and
@@ -473,7 +476,7 @@ mechanically:
473
476
  | `plan-review` | `/plan-review <build>` | `plan-review.verdict` | `plan-review` (rev N) |
474
477
  | `implement` | `/implement <build>` | `implement.completed` | diff + `implement-notes` |
475
478
  | `code-review` | `/code-review <build>` | `code-review.verdict` | `code-review` (rev N) |
476
- | `verify:e2e` | `/verify-app-e2e <build>` (repository-authored) | `verify.completed {step, outcome}` | `verify-report:e2e` on pass/fail when present |
479
+ | `verify:acceptance` | `/verify-acceptance <build>` (repository-authored) | `verify.completed {step, outcome}` | `verify-report:acceptance` on pass/fail when present |
477
480
  | `finalize` | `/finalize <build>` | `finalize.completed` | PR ref, summary |
478
481
  | `reconcile` | `/reconcile <build>` | `reconcile.started`, `reconcile.prepared`, `reconcile.replayed`, `reconcile.publish-intended`, `reconcile.rewritten`, `reconcile.contended`, `reconcile.completed` | `reconcile-notes` + one replayed change |
479
482
 
@@ -481,8 +484,11 @@ Every phase skill takes **only the build slug**; everything else it needs
481
484
  comes from the store via the `ab` CLI (§8).
482
485
 
483
486
  Canonical skills installed into a repo carry the `ab-` namespace prefix
484
- (§16.3), for example `/ab-plan` and `/ab-code-review`. Repository-authored
485
- extension skills use their own names, such as `/verify-app-e2e`. This spec uses
487
+ (§16.3), for example `/ab-plan` and `/ab-code-review`.
488
+
489
+ An **acceptance check** is a repository-owned agent verify step that runs the built software, exercises each acceptance criterion in the spec, attaches evidence, and returns a typed verdict. Every repository must configure one. It is not a test suite and leaves no test files behind.
490
+
491
+ Repository-authored extension skills use their own names, such as `/verify-acceptance`. This spec uses
486
492
  the bare phase names throughout.
487
493
 
488
494
  ## 5. Pipeline grammar
@@ -679,10 +685,10 @@ ticket_assets repo, ticket_id, kind, name, revision, layout, manifest (JSON), si
679
685
  #### 7.1.1 Operator sessions (the third resource kind)
680
686
 
681
687
  An operator session is durable orchestrator-conversation state — a record keyed
682
- by repository and operator, hosted-only. It is neither a build nor a
688
+ by repository and session owner (the human account stored in `operator`), hosted-only. It is neither a build nor a
683
689
  repository fact: folding it into the build streams would leak conversation
684
690
  facts into the build reducer, and folding it into the repository journal would
685
- mix one operator's chat with dispatcher and harvest history that every process
691
+ mix one session owner's chat with dispatcher and harvest history that every process
686
692
  reads. The store's data model therefore gains a third resource family with the
687
693
  same shape as the other two:
688
694
 
@@ -733,7 +739,7 @@ stream read's ([docs/remote-store-protocol.md](docs/remote-store-protocol.md),
733
739
 
734
740
  #### 7.1.2 The embedded orchestrator (turns)
735
741
 
736
- The orchestrator is a role, not a deployment: the agent that files tickets,
742
+ The operator agent is the agent that files tickets,
737
743
  watches builds, unblocks them, and discusses direction. Any agent can take it
738
744
  on — a coding-agent session at the repository root using the `ab` CLI or
739
745
  `ab mcp` needs no initialization — and the canonical `ab-operate` skill is its
@@ -745,8 +751,8 @@ exists). Posting a message to a session of an enabled repository starts a
745
751
  turn in the same invocation: an AI SDK tool-loop agent, running with the
746
752
  registry bound in process, reads the conversation from the session's durable
747
753
  state, streams its output as protocol parts onto the turn's session-scoped
748
- stream (§7.6), calls tools with the operator's attributed identity — the
749
- session operator as the human actor, `via: {kind: "session", id}` —
754
+ stream (§7.6), calls tools with the session owner’s attributed identity — the
755
+ authorizing human account as the `human` actor, `via: {kind: "session", id}` —
750
756
  checkpoints as it goes, and completes or suspends.
751
757
 
752
758
  **Turn lifecycle.** `turn.started` (naming a new session-scoped stream and
@@ -809,7 +815,7 @@ turn (`turn.failed`, kind `internal`) after 15 minutes of stream silence,
809
815
  closing the stream `aborted` and leaving the session `idle`. The reaper never
810
816
  touches suspended or awaiting-approval sessions — a turn suspended for
811
817
  approval is precisely an open stream that goes quiet for however long the
812
- operator takes.
818
+ human takes.
813
819
 
814
820
  **Typed failures.** Model failures are typed on `turn.failed`:
815
821
  `provider-unavailable`, `exhausted`, `credentials`, `configuration` (plus
@@ -825,7 +831,7 @@ registry, and calls no model), and in origin mode it returns immediately
825
831
  unless the effective config enables the orchestrator. The system prompt is
826
832
  the canonical `ab-operate` skill shipped in `skills/operate/` — self-contained
827
833
  per the vendored-skill rule, teaching the tool surface, the attention set,
828
- and when to escalate to the operator rather than act — plus the current
834
+ and when to escalate to the human rather than act — plus the current
829
835
  `operator-notes` artifact, the session's wake settings, and the session's
830
836
  repository identity. The model never supplies a repository argument: the
831
837
  tools' model-facing schemas strip `repo`, and the runner injects the
@@ -1052,7 +1058,7 @@ The base-selection invariants make this safe with Git:
1052
1058
  - **The base is chosen once, at first branch creation**, from the freshly
1053
1059
  fetched origin tip of the configured base branch (fetched into a
1054
1060
  build-scoped internal ref so concurrent dispatches cannot clobber each
1055
- other or the operator's refs). If the remote is unavailable, creation falls
1061
+ other or the user's refs). If the remote is unavailable, creation falls
1056
1062
  back to the local base and records the diagnostic.
1057
1063
  - **Re-provisioning resumes; eligible restacks rewrite.** Provisioning alone
1058
1064
  resumes the published branch. The kernel collapses and restacks at verify
@@ -1813,11 +1819,11 @@ deterministic fail-safe.
1813
1819
  their *logical step name*; core phases select `[roles.<phase>]`.
1814
1820
 
1815
1821
  ```toml
1816
- [verify.e2e]
1822
+ [verify.acceptance]
1817
1823
  kind = "agent"
1818
- skill = "verify-app-e2e" # repository-authored skill
1824
+ skill = "verify-acceptance" # repository-authored skill
1819
1825
 
1820
- [roles.e2e] # the STEP name — not "verify-app-e2e"
1826
+ [roles.acceptance] # the STEP name — not "verify-acceptance"
1821
1827
  runtime = "pi"
1822
1828
  ```
1823
1829
 
@@ -2001,14 +2007,16 @@ body file changes the spec only.
2001
2007
 
2002
2008
  Only an operator answering an open `review-round-limit` policy escalation may
2003
2009
  set `escalation.answered.reviewRoundCeiling`. The same event both clears the
2004
- human gate and replaces the cap; no standalone or pre-emptive form exists. A
2010
+ external judgment gate and replaces the cap; no standalone or pre-emptive form exists. A
2005
2011
  ceiling cannot accompany a spec revision because `spec.revised` resets both
2006
2012
  loops to the configured default. The value is attached only to the matching
2007
2013
  review-limit answer, so unrelated blockers answered in the same command do not
2008
- acquire it and agents cannot widen their own build's loop.
2014
+ acquire it and build-phase agents cannot widen their own build's loop.
2009
2015
 
2010
- Every open escalation remains a human judgment gate until an operator answers
2011
- it. This includes all policy and setup causes. Starting either `ab dispatch` or
2016
+ Every open escalation remains an external judgment gate until an operator answers
2017
+ it. The answer may come from the operator agent or a human; build-phase agents
2018
+ cannot answer their own escalations. This includes all policy and setup causes;
2019
+ human authorization requirements still apply. Starting either `ab dispatch` or
2012
2020
  `ab dispatch --once` never appends `escalation.answered` and never re-arms a
2013
2021
  budget. Startup still recovers every actionable current build and delivers
2014
2022
  pending operator commands, whose decisions take precedence over a blocked wait;
@@ -2563,17 +2571,17 @@ live in the build log. Landing policy is declarative dispatcher configuration
2563
2571
  (§15.7); there is no writable repository auto-merge default.
2564
2572
 
2565
2573
  The **operator sandbox** is the third execution kind beside build and harvest
2566
- executions: a persistent, credential-free, per-operator-per-repository
2574
+ executions: a persistent, credential-free, per-session-owner-per-repository
2567
2575
  environment behind registry tools (`sandbox.*`, AUT-340), provisioned like a
2568
2576
  build workspace and exposed to operator agents only through those tools. The
2569
2577
  typed tools are the only route to state from inside it — the environment
2570
2578
  receives no store, forge, ticket-provider, or model credential, and
2571
2579
  `[orchestrator].sandbox.environmentVariables` may never name one. Its lifecycle
2572
2580
  is repository-journal fact: provisioned/resumed/activity/stopped/released facts
2573
- bracket one deterministic environment per operator × repository, the
2581
+ bracket one deterministic environment per session owner × repository, the
2574
2582
  dispatcher tick's idle settlement stops an environment whose evidence is
2575
2583
  stale (settling an orphan exactly as harvest executions are settled), and
2576
- `ab repository status` reports each operator's sandbox. An operator's work
2584
+ `ab repository status` reports each session owner's sandbox. A session owner's work
2577
2585
  leaves the sandbox only through `sandbox.publish`, which takes the checkout's
2578
2586
  head (or an explicit commit) to a deterministic operator branch and a pull
2579
2587
  request against the base branch and records published/publish-failed journal
@@ -2662,9 +2670,9 @@ validated by the separate repository catalog so build reducers cannot
2662
2670
  accidentally interpret repository state.
2663
2671
 
2664
2672
  A human actor may carry an optional `via` marker for delegated writes —
2665
- `{kind: "session", id}` (the operator's orchestrator session) or
2673
+ `{kind: "session", id}` (the human account's operator-agent session) or
2666
2674
  `{kind: "mcp", client}` (an MCP client) — so a team's audit trail can
2667
- distinguish "the operator did this" from "the operator's orchestrator session
2675
+ distinguish "the human did this" from "the human’s delegated session
2668
2676
  did this" or "an MCP client did this" forever. `via` is valid only on human
2669
2677
  actors and only on build and repository events (session events are the
2670
2678
  delegate's own log); validation rejects it anywhere else. The hosted service
@@ -2684,7 +2692,7 @@ rejection is `EventValidationError`.
2684
2692
 
2685
2693
  1. **Closed vocabularies live in type names; open ones live in payloads.**
2686
2694
  Phases are a closed set → `plan.completed`. Verify and finalize steps are
2687
- config-defined (open) → `verify.completed {step: "e2e"}`.
2695
+ config-defined (open) → `verify.completed {step: "acceptance"}`.
2688
2696
  2. **Events carry facts, never derived state.** Build status is a reduction
2689
2697
  (§15.5); no event ever says "status is now X".
2690
2698
  3. **Blobs live in artifacts; events carry refs** `{kind, rev}`.
@@ -2703,7 +2711,7 @@ rejection is `EventValidationError`.
2703
2711
  5. **Append-only; corrections are new events.**
2704
2712
  6. **Liveness is not history.** Heartbeats and runner leases are mutable
2705
2713
  columns on the `builds` table, never events — they would drown the log.
2706
- 7. **[D2] Operator commands are events in the same log.** Humans append
2714
+ 7. **[D2] Operator commands are events in the same log.** Operators (agents or humans) append
2707
2715
  `*-requested`/`*-cancelled` events (including queued-only discard), `escalation.answered`, and dispatcher
2708
2716
  setting facts; kernel or dispatcher plumbing acknowledges effects that
2709
2717
  require a boundary. The store is the *only* coordination surface — no side
@@ -2913,7 +2921,7 @@ plan-review.started{r1} → plan-review.verdict{approve}
2913
2921
  implement.started{r1} → implement.completed{commits, notes@1}
2914
2922
  code-review.started{r1} → code-review.verdict{approve}
2915
2923
  verify.started{types} → verify.completed{outcome:pass} → …unit
2916
- verify.started{e2e} → pr-attachment.designated{artifact,filename,mediaType} → verify.completed{outcome:pass}
2924
+ verify.started{acceptance} → pr-attachment.designated{artifact,filename,mediaType} → verify.completed{outcome:pass}
2917
2925
  finalize.started → pr-attachment.hosted{designationSeq,asset} → finalize.completed{pr} → finalize.step-completed{release-notes}
2918
2926
  (later, janitor:) pr.merged → workspace.released → build.completed{merged} → pr-attachment.reclaimed{hostedSeq}
2919
2927
  ```
@@ -2940,7 +2948,7 @@ any unexpired execution lease, then releases a partial workspace and stale
2940
2948
  lease, returns the ticket to Ready, and appends `build.completed {outcome:
2941
2949
  discarded}` last. No runner is required.
2942
2950
 
2943
- **A — verify failure:** `verify.completed {step: e2e, outcome: fail,
2951
+ **A — verify failure:** `verify.completed {step: acceptance, outcome: fail,
2944
2952
  report}` → kernel routes back into the code loop: `implement.started
2945
2953
  {round: 2, feedback: {verify: {step, report}}}` → fix → `code-review` round
2946
2954
  2 → approve → verify re-runs **from the first step** (implement changed the
@@ -3488,16 +3496,16 @@ test = "bun run test"
3488
3496
  publish = "bun run publish"
3489
3497
 
3490
3498
  [verify]
3491
- steps = ["types", "unit", "e2e"]
3499
+ steps = ["types", "unit", "acceptance"]
3492
3500
  [verify.types]
3493
3501
  kind = "check" # deterministic: command + pass/fail
3494
3502
  command = "typecheck" # ref into [commands]
3495
3503
  [verify.unit]
3496
3504
  kind = "check"
3497
3505
  command = "test"
3498
- [verify.e2e]
3506
+ [verify.acceptance]
3499
3507
  kind = "agent" # agent-verify: skill + pass|fail|skip verdict
3500
- skill = "verify-app-e2e" # repository-authored agent verifier
3508
+ skill = "verify-acceptance" # repository-authored agent verifier
3501
3509
  paths = ["web/**"] # optional changed-path applicability
3502
3510
 
3503
3511
  [finalize]
@@ -3643,8 +3651,8 @@ is not re-verified, so breakage that only exists in the combination can land.
3643
3651
  This project ships 11 canonical default skills for the fixed phases, the
3644
3652
  non-phase surfaces (`spec`, `tickets`, and `guide`), and the outer-loop skills.
3645
3653
  Repository setup guidance ships as `guide/references/setup.md`, not as a skill;
3646
- agent verifier skills are authored by each repository when needed. `ab init`
3647
- installs into a repo:
3654
+ each repository authors its own acceptance-check skill. No generic verifier
3655
+ skill ships. `ab init` installs into a repo:
3648
3656
 
3649
3657
  - **A stack-neutral `autobuild.toml` skeleton**, rendered only when absent. It
3650
3658
  declares no setup command or verify step and inspects no language or package
@@ -3671,7 +3679,8 @@ installs into a repo:
3671
3679
  point: this repo's code-review standards and setup reference live in the
3672
3680
  vendored trees. Harness-specific discovery paths are symlinks to the one
3673
3681
  canonical editable copy. Setup directs the repository to author and configure
3674
- its own agent verifier when judgment-driven end-to-end coverage is warranted.
3682
+ an acceptance-check skill selected from an agent verify step in every repository.
3683
+ Wire an existing maintained end-to-end or browser test suite into an ordinary `check` step. If none exists, do not create one during setup. The acceptance check neither substitutes for nor seeds a suite.
3675
3684
  - **Model-invocation discipline.** Phase skills are installed
3676
3685
  non-agent-invocable: they are invoked explicitly by the runner or a human,
3677
3686
  never auto-triggered by a model pattern-matching a description — a model
@@ -3746,7 +3755,7 @@ written. A replacement child marked as a handoff but missing that pre-update
3746
3755
  baseline — as when an older parent launches a newer child without the newer
3747
3756
  context — suppresses the entire automatic commit, names the cross-version
3748
3757
  compatibility reason, and leaves all upgrade-owned changes uncommitted for the
3749
- operator. The skill-upgrade results and merge-derived exit status are unchanged.
3758
+ human. The skill-upgrade results and merge-derived exit status are unchanged.
3750
3759
  Any content conflict, Claude discovery conflict, pre-existing dirt in an owned
3751
3760
  path, non-Git target, changed HEAD/worktree identity, or in-progress merge,
3752
3761
  rebase, or cherry-pick likewise suppresses the whole commit and prints the
@@ -0,0 +1,157 @@
1
+ ---
2
+ title: "Agent runtimes"
3
+ group: "reference"
4
+ description: "Choose Claude Code, Codex, or Pi, route producer and reviewer models, and implement a runtime adapter."
5
+ label: "Agent runtimes"
6
+ order: 14
7
+ ---
8
+
9
+ # Agent runtimes
10
+
11
+ ## Responsibility
12
+
13
+ A runtime transports agent turns: it starts, continues, cancels and ends sessions, captures transcripts and usage, and classifies failures. Roles choose the runtime and model; the workspace provider decides where they execute. Neither starts your operator agent, which works externally through the CLI or MCP.
14
+
15
+ ## Shipped adapters
16
+
17
+ Install with `bun add -d --exact @defrex/autobuild`. Examples are complete minimal configs for local execution: install and authenticate the CLI on the dispatcher host, then run `bun ab init --validate`.
18
+
19
+ A subscription login is host state and doesn't reach a remote sandbox. Remotely, provision every selected runtime and alternate and forward only API credentials; see [Workspaces](workspaces.md).
20
+
21
+ | Runtime | Models | Model ids | Default model |
22
+ |---|---|---|---|
23
+ | `claude` | Anthropic, via Claude Code | `claude-` family | the CLI's default |
24
+ | `codex` | OpenAI, via the Codex CLI | `gpt-` family | the CLI's default |
25
+ | `pi` | many providers | `provider/model` | `kimi-coding/k3` |
26
+
27
+ Set the model with the role's `model` field, not in `args`; the adapter owns model and output-protocol flags.
28
+
29
+ ### Claude Code (`claude`)
30
+
31
+ Install `claude` ([setup](https://code.claude.com/docs/en/setup)) and log in. API-backed environments need a provider credential such as `ANTHROPIC_API_KEY`, not copied login state; see [Claude authentication](https://code.claude.com/docs/en/authentication).
32
+
33
+ <!-- seam-config:start -->
34
+ ```toml
35
+ [tickets]
36
+ source = "file"
37
+ readyState = "ready"
38
+
39
+ [roles.default]
40
+ runtime = "claude"
41
+ ```
42
+ <!-- seam-config:end -->
43
+
44
+ ### Codex (`codex`)
45
+
46
+ Install `codex` ([CLI instructions](https://developers.openai.com/codex/cli)) and run `codex login`. API use needs its own credential, commonly `OPENAI_API_KEY`, with billing authority; see [Codex authentication](https://developers.openai.com/codex/auth).
47
+
48
+ <!-- seam-config:start -->
49
+ ```toml
50
+ [tickets]
51
+ source = "file"
52
+ readyState = "ready"
53
+
54
+ [roles.default]
55
+ runtime = "codex"
56
+ ```
57
+ <!-- seam-config:end -->
58
+
59
+ ### Pi (`pi`)
60
+
61
+ Install `pi` ([setup guide](https://github.com/earendil-works/pi/tree/main/packages/coding-agent)), then `/login` with a supported subscription or supply the provider's API credentials (a Vercel AI Gateway route needs `AI_GATEWAY_API_KEY`). Pi's provider configuration decides which account serves the model.
62
+
63
+ <!-- seam-config:start -->
64
+ ```toml
65
+ [tickets]
66
+ source = "file"
67
+ readyState = "ready"
68
+
69
+ [roles.default]
70
+ runtime = "pi"
71
+ model = "vercel-ai-gateway/anthropic/claude-sonnet-4.6"
72
+ ```
73
+ <!-- seam-config:end -->
74
+
75
+ Set an explicit route for any provider other than the `kimi-coding/k3` default. Example ids show syntax, not availability.
76
+
77
+ ## Choosing models
78
+
79
+ - **Producers** (plan, implement): one strong general coding model.
80
+ - **Reviewers** (plan review, code review, agent verification): a different strong model, preferably from another provider, to expose different assumptions. If your operator agent critiques specs well, its model is a good candidate.
81
+ - **Measure** quality, cost, latency and account limits on your repository.
82
+
83
+ This repository's example, recorded **2026-10-21**, uses `gpt-6.1-sol` (Codex) for producers and `claude-opus-5-5` (Claude) for reviewers, with reciprocal alternates. These are dated ids, not defaults; check `bun ab models` before adopting them.
84
+
85
+ <!-- seam-config:start -->
86
+ ```toml
87
+ [tickets]
88
+ source = "file"
89
+ readyState = "ready"
90
+
91
+ [verify]
92
+ steps = ["acceptance"]
93
+
94
+ [verify.acceptance]
95
+ kind = "agent"
96
+ skill = "verify-acceptance"
97
+
98
+ [roles.default]
99
+ runtime = "codex"
100
+ model = "gpt-6.1-sol"
101
+ alternates = [{ runtime = "claude", model = "claude-opus-5-5" }]
102
+
103
+ [roles.plan]
104
+ runtime = "codex"
105
+ model = "gpt-6.1-sol"
106
+ alternates = [{ runtime = "claude", model = "claude-opus-5-5" }]
107
+
108
+ [roles.implement]
109
+ runtime = "codex"
110
+ model = "gpt-6.1-sol"
111
+ alternates = [{ runtime = "claude", model = "claude-opus-5-5" }]
112
+
113
+ [roles.plan-review]
114
+ runtime = "claude"
115
+ model = "claude-opus-5-5"
116
+ alternates = [{ runtime = "codex", model = "gpt-6.1-sol" }]
117
+
118
+ [roles.code-review]
119
+ runtime = "claude"
120
+ model = "claude-opus-5-5"
121
+ alternates = [{ runtime = "codex", model = "gpt-6.1-sol" }]
122
+
123
+ [roles.acceptance]
124
+ runtime = "claude"
125
+ model = "claude-opus-5-5"
126
+ alternates = [{ runtime = "codex", model = "gpt-6.1-sol" }]
127
+ ```
128
+ <!-- seam-config:end -->
129
+
130
+ - **Verifier roles** use the step name (`roles.acceptance`), not the skill name; author the `verify-acceptance` skill first. Check steps run commands and need no model.
131
+ - **Inheritance.** Each role inherits omitted fields from `roles.default` field by field; an explicit `args` list replaces the inherited one.
132
+ - **Alternates** are ordered availability routes, not extra reviewers. Availability or exhaustion failures, or a missing executable, select the next route; credential and configuration failures need repair. A fallback may cost provider independence, so check which runtime ran.
133
+
134
+ ## Writing your own
135
+
136
+ Implement `AgentRunner`, return it in a `RuntimeRegistration`, and register the factory in `agentRuntimes`. Import from `@defrex/autobuild/plugin-sdk`; [Writing a plugin](plugin-authoring.md) covers the manifest.
137
+
138
+ A runtime must:
139
+
140
+ - preserve start/continue/end session identity, complete transcripts and usage, and refresh the environment each turn
141
+ - use the session's supplied `ab` launcher, never a CLI from the build branch
142
+ - keep an endable handle after cancellation so the runner can deposit the partial transcript
143
+ - report failures with verbatim diagnostics, the `permanent` bit and, when classifiable, `cause: availability | exhaustion | credentials | configuration`; never classify authentication as capacity loss
144
+ - declare `servesModels` prefixes and an optional matching `defaultModel` for routing validation
145
+
146
+ Optional capabilities:
147
+
148
+ - **`oneShot`**, tool-free and separate from phase sessions.
149
+ - **Native resume.** Declaring it means running `describeNativeResumeContract` with a `NativeResumeContractFixture` and preserving fresh-process identity and continuation semantics.
150
+
151
+ Test with an `AgentRunnerContractFactory` whose `AgentRunnerContractHarness` fixtures cover successful turns, typed failures, cancellation, turn-environment observations and cleanup. Run `describeAgentRunnerContract` unchanged, or expose its fixture through the plugin descriptor and run:
152
+
153
+ ```sh
154
+ bun ab plugin test agent-runtime acme
155
+ ```
156
+
157
+ Exercise declared streaming and one-shot capabilities through their harness fixtures too.
@@ -0,0 +1,123 @@
1
+ ---
2
+ title: "Build store"
3
+ group: "reference"
4
+ description: "Select local SQLite or an HTTP service and understand the storage extension contract."
5
+ label: "Build store"
6
+ order: 10
7
+ ---
8
+
9
+ # Build store
10
+
11
+ ## Responsibility
12
+
13
+ The BuildStore persists typed append-only events and repository journals, artifacts, blobs, session streams and leases.
14
+
15
+ - State is reduced from events; snapshots are disposable caches.
16
+ - Atomic sequence checks and transactions guard concurrent writes.
17
+ - A replacement runner resumes from durable records, without its predecessor's process or chat.
18
+ - Chosen independently of tickets and dispatcher placement.
19
+
20
+ ## Shipped adapters
21
+
22
+ ### SQLite and filesystem blobs
23
+
24
+ The default; needs no service credential:
25
+
26
+ <!-- seam-config:start -->
27
+ ```toml
28
+ [tickets]
29
+ source = "file"
30
+ readyState = "ready"
31
+ ```
32
+ <!-- seam-config:end -->
33
+
34
+ History lives in `.autobuild/`. To move it, pass a filesystem path or set a nonblank `AB_STORE`:
35
+
36
+ ```sh
37
+ bun ab builds --store /srv/autobuild/project-store
38
+ ```
39
+
40
+ Keep the database and blob directory together, durable and writable by the dispatcher identity.
41
+
42
+ ### Postgres with object storage
43
+
44
+ The server-side `@defrex/autobuild-postgres-store` package persists to PostgreSQL plus S3-compatible storage or Vercel Blob. The CLI never connects to PostgreSQL directly (no `[store] provider`); a repository selects the HTTP service:
45
+
46
+ <!-- seam-config:start -->
47
+ ```toml
48
+ [store]
49
+ url = "https://builds.example.com"
50
+
51
+ [tickets]
52
+ source = "file"
53
+ readyState = "ready"
54
+ ```
55
+ <!-- seam-config:end -->
56
+
57
+ In the service project:
58
+
59
+ ```sh
60
+ bun add @defrex/autobuild-postgres-store
61
+ export DATABASE_URL='<postgres connection URL>'
62
+ # AB_POSTGRES_URL overrides DATABASE_URL when nonblank.
63
+ ```
64
+
65
+ ```ts
66
+ import { openPostgresBuildStoreFromEnv } from '@defrex/autobuild-postgres-store'
67
+
68
+ const store = await openPostgresBuildStoreFromEnv(process.env)
69
+ ```
70
+
71
+ - **Migrate first** with the matching release's idempotent migration. Migration needs schema-creation permission; runtime needs access to the resulting tables.
72
+ - **One blob backend.** S3 needs a bucket, prefix and GetObject/PutObject credentials; Vercel Blob needs a read-write token, or an OIDC identity plus store ID.
73
+ - **Database and blob secrets** never leave the service.
74
+
75
+ ```sh
76
+ # S3-compatible storage
77
+ export AB_BLOB_BACKEND='s3'
78
+ export AB_S3_BUCKET='autobuild-artifacts'
79
+ export AB_S3_REGION='us-east-1'
80
+ export AB_S3_ACCESS_KEY_ID='<object-store identity>'
81
+ export AB_S3_SECRET_ACCESS_KEY='<object-store secret>'
82
+ # Optional: AB_S3_ENDPOINT, AB_S3_FORCE_PATH_STYLE, AB_S3_SESSION_TOKEN, AB_BLOB_PREFIX
83
+ ```
84
+
85
+ ```sh
86
+ # Alternatively, Vercel Blob
87
+ export AB_BLOB_BACKEND='vercel'
88
+ export AB_VERCEL_BLOB_ACCESS='private'
89
+ export BLOB_READ_WRITE_TOKEN='<blob read-write token>'
90
+ # Or supply VERCEL_OIDC_TOKEN and BLOB_STORE_ID together instead of the token.
91
+ ```
92
+
93
+
94
+ ### Remote HTTP client and service
95
+
96
+ `[store] url` selects the shipped HTTP client. Connect once per host and user, from a checkout with the intended origin:
97
+
98
+ ```sh
99
+ bun ab connect https://builds.example.com
100
+ bun ab builds
101
+ ```
102
+
103
+ Browser approval registers the project and saves its credential outside the repository. A URL alone grants no authority; in CI, set `AB_TOKEN` for the registered project.
104
+
105
+ Store selection precedence:
106
+
107
+ 1. `--store`
108
+ 2. nonblank `AB_STORE`
109
+ 3. committed `[store] url`
110
+ 4. the local default
111
+
112
+ A remote Store with missing credentials fails with connection guidance; it never falls back to local state.
113
+
114
+ ## Writing your own
115
+
116
+ A BuildStore isn't a plugin registration (no `buildStores` map; see [Writing a plugin](plugin-authoring.md)).
117
+
118
+ To add a backend:
119
+
120
+ 1. Implement `BuildStore` and `BlobStore` with the storage types from `@defrex/autobuild/store-adapter`.
121
+ 2. Pass the unchanged `describeBuildStoreContract` and `describeBlobStoreContract` suites from `@defrex/autobuild/testing`, on isolated fixtures with real persistence.
122
+
123
+ To serve it to the shipped CLI, implement the normative remote store protocol, not a new route catalog. Meet its conformance section and test the real remote client against your server.
package/docs/builds.md ADDED
@@ -0,0 +1,82 @@
1
+ ---
2
+ title: "One build, end to end"
3
+ group: "concepts"
4
+ description: "Follow a work ticket through planning, review, verification, pull request creation, and landing."
5
+ label: "Builds"
6
+ order: 2
7
+ ---
8
+
9
+ # One build, end to end
10
+
11
+ A build is one execution of one work ticket, identified by a slug, through a fixed pipeline:
12
+
13
+ ```text
14
+ spec → plan ⇄ plan-review → implement ⇄ code-review → verify:* → finalize
15
+ ```
16
+
17
+ Integration nodes have a [different lifecycle](integration-overview.md).
18
+
19
+
20
+ ## The spec is the contract
21
+
22
+ At dispatch, Autobuild pins the groomed, conforming spec as a stored artifact; `spec` names that contract, not an agent phase. Planning, review, and verification judge against the pinned spec, not mutable tracker text.
23
+
24
+ To change the contract, your operator agent answers an escalation with a revised spec, and the build restarts from planning:
25
+
26
+ ```sh
27
+ bun ab answer <slug> --revise-spec revised-spec.md
28
+ ```
29
+
30
+
31
+ ## Produce, then review
32
+
33
+ | Loop | Producer | Reviewer checks against |
34
+ |---|---|---|
35
+ | `plan ⇄ plan-review` | planner proposes a plan | the spec |
36
+ | `implement ⇄ code-review` | implementer makes local commits | the spec and plan |
37
+
38
+ Either reviewer approves, requests revisions with structured findings, or escalates a question.
39
+
40
+ - **Sessions.** Each phase gets its own session; the producer keeps it across a loop's rounds, and each reviewer round starts fresh.
41
+ - **Context** passes between phases as durable artifacts: spec, approved plan, implementation notes, findings, and verification reports.
42
+
43
+ Two limits park the build for an answer:
44
+
45
+ - **Round ceiling.** `[policy].maxReviewRounds` (default 6) per loop. Your operator agent can override it for the parked loop and current spec revision with `ab answer <slug> --review-round-ceiling <n>`.
46
+ - **Stall limit.** A finding the reviewer marks as persisting for `[policy].stallRounds` rounds (default 3) escalates.
47
+
48
+
49
+ ## Verify, then publish
50
+
51
+ After code review approves, Autobuild prepares the build's single net change on the sampled destination and runs the `verify:*` steps in order:
52
+
53
+ - **Check verifiers** run a command; the exit code decides.
54
+ - **Agent verifiers** record a pass, a failure report, or a skip reason.
55
+ - **Applicability rules** can skip a step with a recorded reason.
56
+
57
+ A failure sends the build, with its report, back through implementation, code review, and verification. See [Verification](verification.md).
58
+
59
+ Once verification passes, the finalize agent writes the PR description; Autobuild publishes the branch and opens the PR. Optional `finalize:*` post-steps, such as a changelog or ticket link, run after PR creation; a failed post-step records an observation instead of failing the build. `verify:*` and `finalize:*` are the only configurable extension points.
60
+
61
+
62
+ ## When a human is needed
63
+
64
+ After grooming, escalations are the judgment gates. A build parks with a recorded question on an unclear requirement, a persistent review disagreement, or an exhausted policy bound.
65
+
66
+ Your operator agent answers bounded questions from your instructions and brings unresolved product decisions to you. Restarting dispatch doesn't answer a question, and an answer doesn't force success.
67
+
68
+ Landing consent is a separate policy decision your operator agent manages. Repositories can require it even for a green build; verification, forge checks, and merge gates still apply. See [integration and landing policy](integration-overview.md).
69
+
70
+
71
+ ## The reconcile epilogue
72
+
73
+ After finalize, Autobuild watches the destination until the PR merges or closes:
74
+
75
+ ```text
76
+ (pr.conflicted → reconcile → verify:*)* → merged or closed
77
+ ```
78
+
79
+ - **Clean restack** onto a newer base is automatic; no agent runs.
80
+ - **Conflicted replay** enters `reconcile`: an agent resolves the kernel-prepared change on a frozen refreshed base, then post-reconcile verification runs.
81
+
82
+ See [integrating related work](integration-overview.md#one-identity-per-leaf-change) for replay details and the [dispatcher guide](dispatcher.md) for how builds run and resume.