@defrex/autobuild 1.10.0 → 1.11.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 (255) hide show
  1. package/README.md +1 -1
  2. package/SPEC.md +745 -69
  3. package/bin/ab-dispatch-generation.ts +3 -1
  4. package/docs/accounts.md +2 -1
  5. package/docs/answering-blocked-builds.md +20 -0
  6. package/docs/architecture.md +165 -29
  7. package/docs/build-store.md +10 -7
  8. package/docs/cli.md +33 -1
  9. package/docs/configuration-overview.md +4 -1
  10. package/docs/configuration.md +381 -29
  11. package/docs/dispatcher.md +64 -4
  12. package/docs/forges.md +7 -0
  13. package/docs/integration-tree.md +2 -2
  14. package/docs/operating.md +4 -2
  15. package/docs/operator-api.md +134 -6
  16. package/docs/operator-surfaces.md +85 -0
  17. package/docs/optimization-nodes.md +69 -11
  18. package/docs/plugin-authoring.md +37 -1
  19. package/docs/remote-store-protocol.md +94 -13
  20. package/docs/remote-ticket-protocol.md +40 -0
  21. package/docs/restacking.md +20 -4
  22. package/docs/setup.md +14 -2
  23. package/docs/ticket-dependencies.md +10 -3
  24. package/docs/ticket-sources.md +24 -2
  25. package/docs/tickets.md +7 -1
  26. package/docs/troubleshooting.md +8 -0
  27. package/docs/verification.md +4 -3
  28. package/docs/workspaces.md +3 -0
  29. package/package.json +9 -5
  30. package/packages/core/src/cli/accounts.ts +7 -2
  31. package/packages/core/src/cli/attention.ts +3 -1
  32. package/packages/core/src/cli/binary-direct.ts +2 -0
  33. package/packages/core/src/cli/binary-lifecycle.ts +2 -1
  34. package/packages/core/src/cli/build-control.ts +79 -1
  35. package/packages/core/src/cli/context.ts +4 -0
  36. package/packages/core/src/cli/dashboard/facts.ts +49 -53
  37. package/packages/core/src/cli/dashboard/header.ts +111 -0
  38. package/packages/core/src/cli/dashboard/model.ts +31 -39
  39. package/packages/core/src/cli/dashboard/objective-row.ts +46 -14
  40. package/packages/core/src/cli/dashboard/poll.ts +179 -76
  41. package/packages/core/src/cli/dashboard/render.ts +159 -230
  42. package/packages/core/src/cli/dashboard/row-text.ts +538 -0
  43. package/packages/core/src/cli/dashboard/timeline.ts +288 -0
  44. package/packages/core/src/cli/dashboard/vocabulary.ts +188 -0
  45. package/packages/core/src/cli/dispatch-args.ts +44 -1
  46. package/packages/core/src/cli/dispatch-frontend.ts +40 -40
  47. package/packages/core/src/cli/dispatch-launch-stop.ts +18 -0
  48. package/packages/core/src/cli/dispatch-launcher.ts +20 -7
  49. package/packages/core/src/cli/dispatch-web.ts +155 -0
  50. package/packages/core/src/cli/dispatch.ts +202 -38
  51. package/packages/core/src/cli/help.ts +87 -3
  52. package/packages/core/src/cli/init-validation.ts +3 -3
  53. package/packages/core/src/cli/main.ts +70 -6
  54. package/packages/core/src/cli/mcp.ts +35 -3
  55. package/packages/core/src/cli/objective.ts +1 -1
  56. package/packages/core/src/cli/operator-preference.ts +57 -0
  57. package/packages/core/src/cli/repo-lease.ts +2 -0
  58. package/packages/core/src/cli/repo-state.ts +56 -6
  59. package/packages/core/src/cli/repository-status.ts +105 -49
  60. package/packages/core/src/cli/status.ts +82 -1
  61. package/packages/core/src/cli/terminal-restore.ts +32 -7
  62. package/packages/core/src/cli/ticket.ts +98 -36
  63. package/packages/core/src/cli/wait.ts +14 -6
  64. package/packages/core/src/cli/watch.ts +20 -4
  65. package/packages/core/src/cli/web.ts +139 -0
  66. package/packages/core/src/config/live.ts +99 -14
  67. package/packages/core/src/config/load.ts +61 -20
  68. package/packages/core/src/config/local.ts +212 -0
  69. package/packages/core/src/config/pipeline-source.ts +2 -0
  70. package/packages/core/src/config/reference.ts +18 -0
  71. package/packages/core/src/config/schema.ts +45 -10
  72. package/packages/core/src/events/catalog.ts +4 -0
  73. package/packages/core/src/events/payloads.ts +97 -0
  74. package/packages/core/src/events/policy.ts +10 -0
  75. package/packages/core/src/events/repository.ts +46 -3
  76. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +381 -30
  77. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/017d8dd5bb6dd80b.json.gz +0 -0
  78. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/178e12f1759b7552.json.gz +0 -0
  79. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/4932c70a2af97faf.json.gz +0 -0
  80. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/536085773daf6b58.json.gz +0 -0
  81. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/6bd6275061aaffa5.json.gz +0 -0
  82. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/89625654b02e9ac1.json.gz +0 -0
  83. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/a98af134be2da8a9.json.gz +0 -0
  84. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/d5d5ccca80a893d8.json.gz +0 -0
  85. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/f8155387eb5f375c.json.gz +0 -0
  86. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/3c27f918b194e3b3.json +465 -0
  87. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/46196d8f0076496a.json +97 -0
  88. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/79f0e0f4ccd43ba2.json +455 -0
  89. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/859c09edac738823.json +1086 -0
  90. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/a283c1f3462b1cc1.json +81 -0
  91. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/a6e570fb126991ff.json +36 -0
  92. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/a8acf22c968b6e3d.json +81 -0
  93. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/ba7b85895bf6698e.json +1153 -0
  94. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/fc66408cde0b6b04.json +637 -0
  95. package/packages/core/src/kernel/build-roster.ts +230 -0
  96. package/packages/core/src/kernel/dispatch-capacity.ts +4 -2
  97. package/packages/core/src/kernel/dispatch-status.ts +139 -0
  98. package/packages/core/src/kernel/engine.ts +43 -5
  99. package/packages/core/src/kernel/execution-intervals.ts +61 -0
  100. package/packages/core/src/kernel/generators/optimization-log.ts +101 -0
  101. package/packages/core/src/kernel/generators/repository-journals.ts +13 -0
  102. package/packages/core/src/kernel/leaf-restack-base.ts +33 -7
  103. package/packages/core/src/kernel/leaf-restack-state.ts +82 -3
  104. package/packages/core/src/kernel/log-index.ts +19 -0
  105. package/packages/core/src/kernel/optimization-admission.ts +244 -3
  106. package/packages/core/src/kernel/optimization.ts +183 -4
  107. package/packages/core/src/kernel/phase-failures.ts +121 -0
  108. package/packages/core/src/kernel/published-branch-head.ts +60 -0
  109. package/packages/core/src/kernel/read-facts.ts +15 -13
  110. package/packages/core/src/kernel/reducer-registry.ts +27 -8
  111. package/packages/core/src/kernel/reducer-revisions.ts +27 -0
  112. package/packages/core/src/kernel/reducer.ts +63 -4
  113. package/packages/core/src/kernel/rollup.ts +61 -0
  114. package/packages/core/src/kernel/setup-streak.ts +38 -0
  115. package/packages/core/src/kernel/step-durations.ts +257 -0
  116. package/packages/core/src/kernel/target-observation.ts +6 -1
  117. package/packages/core/src/kernel/target-rewrite-recovery.ts +116 -0
  118. package/packages/core/src/kernel/verify-diff-base.ts +5 -0
  119. package/packages/core/src/kernel/verify-stages.ts +13 -3
  120. package/packages/core/src/ontology.ts +5 -0
  121. package/packages/core/src/operator/agent-context-serve.ts +631 -0
  122. package/packages/core/src/operator/annotations.ts +75 -5
  123. package/packages/core/src/operator/attention.ts +470 -0
  124. package/packages/core/src/operator/canonical-skills.ts +35 -0
  125. package/packages/core/src/operator/cli-equivalents.ts +270 -0
  126. package/packages/core/src/operator/context-prompts.ts +61 -0
  127. package/packages/core/src/operator/index.ts +49 -1
  128. package/packages/core/src/operator/landings.ts +28 -19
  129. package/packages/core/src/operator/optimization.ts +7 -0
  130. package/packages/core/src/operator/protocol.ts +3 -0
  131. package/packages/core/src/operator/query.ts +129 -74
  132. package/packages/core/src/operator/read-view.ts +5 -2
  133. package/packages/core/src/operator/registry.ts +406 -46
  134. package/packages/core/src/operator/requests.ts +20 -18
  135. package/packages/core/src/operator/sandbox-host.ts +107 -11
  136. package/packages/core/src/operator/sandbox-resolver.ts +253 -0
  137. package/packages/core/src/operator/sandbox.ts +778 -82
  138. package/packages/core/src/operator/ticket-asset-list.ts +77 -0
  139. package/packages/core/src/operator/ticket-assets.ts +167 -0
  140. package/packages/core/src/operator/tickets.ts +33 -2
  141. package/packages/core/src/plugin-sdk/index.ts +22 -0
  142. package/packages/core/src/plugins/manifest.ts +1 -1
  143. package/packages/core/src/ports/forge/fake.ts +92 -1
  144. package/packages/core/src/ports/forge/git-blob.ts +15 -0
  145. package/packages/core/src/ports/forge/github.ts +82 -0
  146. package/packages/core/src/ports/forge/local-git.ts +61 -1
  147. package/packages/core/src/ports/forge-failure.ts +24 -0
  148. package/packages/core/src/ports/runner/antigravity-test.fixture.ts +149 -0
  149. package/packages/core/src/ports/runner/claude-test.fixture.ts +71 -0
  150. package/packages/core/src/ports/runner/codex-test.fixture.ts +63 -0
  151. package/packages/core/src/ports/tickets/contract.ts +71 -0
  152. package/packages/core/src/ports/tickets/fake.ts +11 -0
  153. package/packages/core/src/ports/tickets/file.ts +18 -0
  154. package/packages/core/src/ports/tickets/github-fake.ts +136 -4
  155. package/packages/core/src/ports/tickets/github.ts +387 -30
  156. package/packages/core/src/ports/tickets/hosted-index.ts +10 -0
  157. package/packages/core/src/ports/tickets/linear.ts +130 -0
  158. package/packages/core/src/ports/tickets/priority.ts +9 -0
  159. package/packages/core/src/ports/tickets/remote-protocol.ts +34 -0
  160. package/packages/core/src/ports/tickets/remote.ts +70 -6
  161. package/packages/core/src/ports/tickets/search.ts +139 -0
  162. package/packages/core/src/ports/types.ts +104 -2
  163. package/packages/core/src/ports/workspace/builtin-capabilities.ts +9 -0
  164. package/packages/core/src/ports/workspace/create.ts +15 -1
  165. package/packages/core/src/ports/workspace/fake.ts +340 -12
  166. package/packages/core/src/ports/workspace/git-worktree.ts +833 -42
  167. package/packages/core/src/ports/workspace/operator-sandbox.ts +129 -12
  168. package/packages/core/src/ports/workspace/process-group.ts +48 -0
  169. package/packages/core/src/ports/workspace/vercel-sandbox.ts +1260 -123
  170. package/packages/core/src/processes/agent-context-assemble.ts +576 -0
  171. package/packages/core/src/processes/agent-context.ts +469 -0
  172. package/packages/core/src/processes/build-runner.ts +387 -236
  173. package/packages/core/src/processes/dispatcher.ts +211 -55
  174. package/packages/core/src/processes/execution-no-progress.ts +4 -0
  175. package/packages/core/src/processes/optimization-activity.ts +120 -0
  176. package/packages/core/src/processes/phase-failure-budget.ts +1 -0
  177. package/packages/core/src/processes/repo-view.ts +78 -2
  178. package/packages/core/src/processes/sandbox-state.ts +53 -6
  179. package/packages/core/src/processes/tick-publication.ts +2 -0
  180. package/packages/core/src/processes/workspace-preparation.ts +76 -0
  181. package/packages/core/src/scenarios/harness.ts +0 -5
  182. package/packages/core/src/store/account-redaction.ts +1 -0
  183. package/packages/core/src/store/adapter.ts +52 -1
  184. package/packages/core/src/store/agent-context.ts +432 -0
  185. package/packages/core/src/store/build-feed.ts +291 -0
  186. package/packages/core/src/store/build-scope.ts +19 -1
  187. package/packages/core/src/store/contract.ts +911 -14
  188. package/packages/core/src/store/digest.ts +19 -6
  189. package/packages/core/src/store/histogram.ts +113 -0
  190. package/packages/core/src/store/local/schema.ts +62 -0
  191. package/packages/core/src/store/local/store.ts +628 -22
  192. package/packages/core/src/store/local/ticket-asset-heads.ts +23 -0
  193. package/packages/core/src/store/memory.ts +461 -69
  194. package/packages/core/src/store/open-builds.ts +19 -0
  195. package/packages/core/src/store/phase-session.ts +32 -4
  196. package/packages/core/src/store/reduced-reads.ts +14 -4
  197. package/packages/core/src/store/reducer-value-shapes.json +7027 -5751
  198. package/packages/core/src/store/reducer-values.ts +6 -1
  199. package/packages/core/src/store/remote/client.ts +208 -2
  200. package/packages/core/src/store/remote/compatibility.ts +1 -1
  201. package/packages/core/src/store/remote/index.ts +33 -0
  202. package/packages/core/src/store/remote/protocol.ts +69 -0
  203. package/packages/core/src/store/remote/released-clients.json +22 -0
  204. package/packages/core/src/store/remote/released-reducer-values/1.11.0.json +35680 -0
  205. package/packages/core/src/store/remote/released-reducer-values/1.11.1.json +35718 -0
  206. package/packages/core/src/store/remote/released-reducer-values/index.ts +20 -16
  207. package/packages/core/src/store/retention.ts +23 -1
  208. package/packages/core/src/store/rollups.ts +337 -0
  209. package/packages/core/src/store/session-handle.ts +20 -2
  210. package/packages/core/src/store/snapshots.ts +10 -0
  211. package/packages/core/src/store/types.ts +108 -9
  212. package/packages/core/src/testing/dispatch-journals.ts +117 -0
  213. package/packages/core/src/testing/dispatch-read-budget.ts +1092 -2
  214. package/packages/core/src/testing/git-config-isolation.ts +7 -5
  215. package/packages/core/src/testing/index.ts +27 -0
  216. package/packages/core/src/testing/memory-operator-sandbox.ts +346 -0
  217. package/packages/core/src/testing/reduced-read-budget.ts +1873 -98
  218. package/packages/core/src/web/analytics-source.ts +303 -0
  219. package/packages/core/src/web/assets/Atkinson-OFL.txt +93 -0
  220. package/packages/core/src/web/assets/AtkinsonHyperlegibleNext.latin.woff2 +0 -0
  221. package/packages/core/src/web/assets/JetBrains-OFL.txt +93 -0
  222. package/packages/core/src/web/assets/JetBrainsMono.latin.woff2 +0 -0
  223. package/packages/core/src/web/assets/app.css +1 -0
  224. package/packages/core/src/web/assets/app.js +9 -0
  225. package/packages/core/src/web/assets/manifest.json +31 -0
  226. package/packages/core/src/web/assets/theme.js +1 -0
  227. package/packages/core/src/web/bounded.ts +31 -0
  228. package/packages/core/src/web/http.ts +315 -0
  229. package/packages/core/src/web/hub.ts +160 -0
  230. package/packages/core/src/web/options.ts +38 -0
  231. package/packages/core/src/web/overview-source.ts +322 -0
  232. package/packages/core/src/web/page.ts +56 -0
  233. package/packages/core/src/web/protocol.ts +151 -0
  234. package/packages/core/src/web/read-only.ts +23 -0
  235. package/packages/core/src/web/repository-source.ts +39 -0
  236. package/packages/core/src/web/server.ts +97 -0
  237. package/skills/code-review/SKILL.md +10 -2
  238. package/skills/guide/SKILL.md +376 -54
  239. package/skills/guide/references/accounts.md +2 -1
  240. package/skills/guide/references/integration-tree.md +2 -2
  241. package/skills/guide/references/operator-api.md +134 -6
  242. package/skills/guide/references/optimization-nodes.md +69 -11
  243. package/skills/guide/references/plugin-authoring.md +37 -1
  244. package/skills/guide/references/remote-store-protocol.md +94 -13
  245. package/skills/guide/references/remote-ticket-protocol.md +40 -0
  246. package/skills/guide/references/restacking.md +20 -4
  247. package/skills/guide/references/setup.md +14 -2
  248. package/skills/guide/references/ticket-dependencies.md +10 -3
  249. package/skills/implement/SKILL.md +23 -4
  250. package/skills/operate/SKILL.md +134 -32
  251. package/skills/plan/SKILL.md +10 -4
  252. package/skills/plan-review/SKILL.md +9 -2
  253. package/skills/spec/SKILL.md +34 -8
  254. package/skills/tickets/SKILL.md +51 -5
  255. package/templates/hosted-service/package.json +2 -2
@@ -22,7 +22,7 @@ Idle nodes consume no runner capacity and empty nodes have no PR.
22
22
  - [Nodes, targets and the operating model](references/integration-tree.md)
23
23
  - [Merge policy, examples and forge requirements](references/merge-policy.md)
24
24
  - [Restacking, identity and recovery](references/restacking.md)
25
- - [Optimization nodes](references/optimization-nodes.md): when to use one, a run end to end, grooming the objective, the `autobuild-objective` marker, objective schema, refusals, paired harness-pinned measurement and the noise check, revisions, derived progress, the proposer phase, and the landing gate and attempt settlement, stopping and completion.
25
+ - [Optimization nodes](references/optimization-nodes.md): when to use one, a run end to end, grooming the objective, the `autobuild-objective` marker, objective schema, refusals, paired harness-pinned measurement and the noise check, revisions, derived progress, the proposer phase, attempt priority, and the landing gate and attempt settlement, active hours, stopping and completion.
26
26
  - [Migration from 0.x](references/migration-1.0.md)
27
27
  - [Moving ticket sources](references/ticket-migration.md): recorded migrations preserve in-flight build continuity.
28
28
 
@@ -39,7 +39,9 @@ system.** For anything repository-specific — what verify steps run here, which
39
39
  runner a role uses, what `test` actually invokes — read the repo, not this
40
40
  document:
41
41
 
42
- - `autobuild.toml` at the repo root — the live configuration.
42
+ - `autobuild.toml` at the repo root — the live configuration, layered in that
43
+ checkout with an uncommitted `.autobuild/local.toml` when one exists (see
44
+ [Local overrides](#local-overrides)).
43
45
  - `.agents/skills/ab-*/SKILL.md` — the installed skills *as this repo edited
44
46
  them*. They are editable by design, so the vendored copy may deliberately
45
47
  differ from the distribution's default described here.
@@ -93,7 +95,9 @@ spec → plan ⇄ plan-review → implement ⇄ code-review → verify:* → fin
93
95
  urgent start requests and urgent tickets, then normal waiting work, then
94
96
  normal start requests and normal tickets; a build takes its ticket's priority at
95
97
  claim, and `ab priority <slug> urgent|normal` changes an active build's
96
- priority. Priority orders free slots only.
98
+ priority. An optimization node's attempts claim at the node's current
99
+ priority instead, so `ab priority <node> urgent` speeds up its attempts
100
+ claimed afterwards. Priority orders free slots only.
97
101
  `capacity` counts builds running work: a build that finished its pipeline
98
102
  holds no slot while it waits for a merge decision, though it keeps its
99
103
  workspace until it merges or closes. Priority never preempts a running build.
@@ -218,6 +222,12 @@ ready, within the groomed budget, and each must pass the ratchet before it
218
222
  lands. The marker rules and the objective schema are in
219
223
  [optimization nodes](references/optimization-nodes.md).
220
224
 
225
+ To groom an optimization node, follow
226
+ the [grooming guidance](references/optimization-nodes.md#grooming-an-optimization-node):
227
+ measure the evidence, threshold and ε where builds run, and choose a budget
228
+ whose `maxHours` counts [active hours](references/optimization-nodes.md#active-hours),
229
+ the time attempts, the proposer and measurements actually run.
230
+
221
231
  **Optimization attempts.** A child is an attempt when its ticket came from one
222
232
  of the node's recorded proposals; it runs the ordinary work grammar. In every
223
233
  phase of an attempt, `ab context` writes a derived `objective.md` and a manifest
@@ -230,7 +240,8 @@ skips review, verification and measurement, completes the build
230
240
  `closed-unmerged`, and the dispatcher settles the attempt `declined` on the
231
241
  node with the reason as the ledger note. A branch that an earlier implement
232
242
  round published is deleted by the node before the ticket moves to rejected.
233
- The flag is refused outside an attempt's implement phase. See
243
+ The flag is refused outside an attempt's implement phase. An attempt claims
244
+ at its node's current priority; nothing is reserved for it. See
234
245
  [attempts](references/optimization-nodes.md#attempts).
235
246
 
236
247
  **Judge panels.** A panel objective is measured by a panel of judge sessions
@@ -345,12 +356,14 @@ terminal.
345
356
  **Slug naming is not a phase.** For each new build, a tool-free one-shot call
346
357
  proposes a lowercase kebab base of at most three meaningful spec-derived words.
347
358
  The dispatcher owns a hard deadline, strict validation, and `-2`, `-3`, …
348
- collision suffixes that skip both this store's slugs and `ab/` or `ab-node/`
349
- build branches already on the remote, checked once at claim time. A forge
350
- without that capability deduplicates against the store only and says so in a
359
+ collision suffixes that skip this store's slugs, `ab/` or `ab-node/` build
360
+ branches already on the remote, and, for a workspace provider that creates
361
+ branches in the local checkout (git-worktree), branches that already exist
362
+ there, checked once at claim time. A forge without the remote capability
363
+ deduplicates against the store (and local branches) only and says so in a
351
364
  startup warning. A missing or failed model proposal falls back to the first
352
365
  three words of the kebab-cased title, so the proposal never blocks dispatch.
353
- The branch check is not optional: if a remote lookup fails, or the base and its
366
+ The branch check is not optional: if a remote or local lookup fails, or the base and its
354
367
  `-2` … `-100` suffixes are all taken, the claim fails, no build is created, and
355
368
  the ticket is handed back to ready for a later tick. The slug
356
369
  and `ab/<slug>` (or `ab-node/<slug>` for a node) branch are chosen once;
@@ -386,8 +399,9 @@ The distinctions that change an administrator's answer:
386
399
  to the Store, so a slow claim or agent turn cannot delay a keypress. Repository
387
400
  reads advance incrementally. SIGINT, SIGHUP, SIGQUIT, and SIGTERM restore the
388
401
  terminal immediately, drain and reap the child, and keep repeated signals
389
- graceful until an open claim tick reaches a recoverable boundary; non-SIGINT
390
- termination is replayed only after that drain. Durable normal/forced/abnormal
402
+ graceful until an open claim tick reaches a recoverable boundary; after that
403
+ drain SIGHUP and SIGTERM are replayed, while SIGQUIT exits 131 instead of
404
+ dumping core. Durable normal/forced/abnormal
391
405
  evidence retains available process detail, and parent-death detection prevents
392
406
  a detached kernel. Resident checkout dispatch selects viewer or local execution before running a filesystem-only
393
407
  launcher that snapshots the invoking installation and its installed production
@@ -486,12 +500,15 @@ The distinctions that change an administrator's answer:
486
500
  within the generation; `--once`, origin-mode and hot development paths bypass
487
501
  the launcher. `--once` remains one tick plus drain.
488
502
  - **Live configuration** has two explicit contexts. A running dispatcher owns
489
- the last valid snapshot from the **main checkout**; dispatch, setup, and each
503
+ the last valid snapshot from the **main checkout**: its `autobuild.toml`
504
+ layered with `.autobuild/local.toml`, read together as one candidate before
505
+ every tick. Dispatch, setup, and each
490
506
  pipeline step capture it at their action boundary, without interrupting an
491
507
  agent turn or command already running. Missing, unreadable, malformed, and
492
508
  routing-invalid candidates retain that snapshot with deduplicated operator
493
509
  notice, and restoring a valid file resumes reload. Scoped phase CLI processes
494
- still read the build worktree's branch-owned file. Dispatcher merge readiness,
510
+ still read the build worktree's branch-owned file, which never has a local
511
+ override layer. Dispatcher merge readiness,
495
512
  resume, and execution recovery use the runner's pinned commands, verify, and
496
513
  finalize configuration through the cycle capture's exact artifact revision.
497
514
  Lease sweeps reuse at most 128 parsed effective-config pins in a disposable
@@ -623,6 +640,49 @@ clock is therefore consulted only once that window ends, at most one scan
623
640
  interval after the recorded measurement; the dispatcher then treats it as a
624
641
  clock rollback, rescans, and resets the cache to the current clock.
625
642
 
643
+ ### Local overrides
644
+
645
+ `.autobuild/local.toml`, beside `autobuild.toml` in a checkout, overrides
646
+ personal settings for every `ab` command that reads configuration from that
647
+ checkout, including a checkout-mode dispatcher. `ab init` ignores `.autobuild/`,
648
+ so the file is never committed. Edit overrides by hand; use
649
+ `ab operator dispatcher [human|agent] [--json]` to read or save ownership.
650
+ Saving may normalize local TOML formatting.
651
+
652
+ - **Allowed:** `capacity`, `ticketScanIntervalSeconds`, `[upgrade]`, `[hooks]`,
653
+ `[roles]`, `[accounts]`, `[operator]`.
654
+ - **Local only:** `[operator] dispatcher = "human" | "agent"` is optional, with no
655
+ default. Even an empty `[operator]` is rejected in `autobuild.toml`, with advice
656
+ to use `.autobuild/local.toml`. Preference changes are hot and never command a
657
+ dispatcher. Repository instructions take precedence.
658
+ - **Committed only:** every other section — store, forge, plugins, tickets,
659
+ orchestrator, PR, merge, policy, base branch, generated files and profiles
660
+ must agree across everyone sharing the store and ticket source, and the
661
+ build-owned `[verify]`, `[finalize]`, `[commands]` and `[workspace]` come from
662
+ the build's own branch. A local file that sets one is rejected with
663
+ `<path>: <key> can only be set in autobuild.toml`; an unknown key is
664
+ rejected with `<path>: "<key>" is not a configuration setting`. Both messages
665
+ then list the allowed sections.
666
+ - **Merge:** tables merge key by key; scalars and arrays replace whole. A local
667
+ file adds or changes keys but cannot remove a committed role, hook or key.
668
+ Invalid local values get the `autobuild.toml` message, naming the local file.
669
+ - **Reload:** a running dispatcher picks up edits with the same hot or
670
+ restart treatment per field; a rejected file keeps the last accepted
671
+ configuration running.
672
+ - **Visibility:** `ab repository status` prints
673
+ `dispatcher local overrides (<path>): <settings>` (`localOverrides` in
674
+ `--json`) when the held dispatcher took settings from its local file.
675
+ - Build worktrees, origin-mode and hosted dispatchers never read it.
676
+
677
+ ### `[operator]`
678
+
679
+ This table is local-only: put it in `.autobuild/local.toml`. Committed input
680
+ rejects even an empty table. `ab operator dispatcher [human|agent] [--json]`
681
+ reads or saves the preference; it never starts or stops a dispatcher.
682
+
683
+ | Field | Default | Allowed / constraints | Effect |
684
+ |---|---|---|---|
685
+ | `dispatcher` | unset | `"human"` or `"agent"` | Who runs a dispatcher when fresh status proves none is running; repository instructions take precedence. Hot, with no process action. |
626
686
 
627
687
  ### Root scalars
628
688
 
@@ -822,12 +882,22 @@ likes.
822
882
  |---|---|---|---|
823
883
  | `<name>` | — | nonempty string → nonempty shell string | Names a deterministic verb the kernel may run. Referenced by name from check steps in `[verify.<step>]` or `[finalize.<step>]`. |
824
884
 
825
- `setup` is special by convention: it runs after workspace provision and after a
826
- sandbox rehydrate. Failures are durable, remain visible in build status and the
827
- dashboard, and retry up to `[policy].maxSetupAttempts`; exhaustion raises a
828
- setup-targeted escalation without manufacturing a pipeline phase or verdict. An
829
- answer from your operator agent or you re-arms the budget, and a later successful `runner.attached` clears
830
- the current error. Values are never evaluated as config — they are handed to a
885
+ `setup` is special by convention: it runs at every runner attachment (workspace
886
+ provision, sandbox rehydrate, resume). Local worktrees do not inherit the
887
+ checkout's installed dependencies, so `setup` installs them. It runs again before
888
+ the next phase,
889
+ check, verify, finalize or measurement step whenever a restack, wait-resume
890
+ advance or completed reconcile moves the build onto a new base. Autobuild cannot
891
+ see which files setup reads, so every base move counts as a dependency change;
892
+ commits the build's own agents make do not move the base. Setup does not run
893
+ while a reconcile resolver works on a replay: a resolver that needs the new
894
+ dependencies to check its resolution runs the repository's setup itself.
895
+ Failures, at attachment or after a base move, are durable, remain visible in
896
+ build status and the dashboard, stop dependent work, and retry up to
897
+ `[policy].maxSetupAttempts`; exhaustion raises a setup-targeted escalation
898
+ without manufacturing a pipeline phase or verdict. An answer from your operator
899
+ agent or you re-arms the budget, and only a later successful setup, recorded as
900
+ a new `runner.attached`, clears the current error. Values are never evaluated as config — they are handed to a
831
901
  shell as written.
832
902
 
833
903
  Fresh init config deliberately leaves this map empty. The setup agent follows
@@ -1528,7 +1598,8 @@ while `round` remains occurrence scope. Answering a runner-failure cause re-arms
1528
1598
  only its matching phase and round. The phase-level `verify-failure-limit` cause
1529
1599
  explicitly re-arms all rounds for its verify target, while
1530
1600
  `reconcile-no-progress`, `publication-retry-limit`, `wait-unresolvable`,
1531
- `measurement-failed` and the setup-only cause reset no phase-runner failures.
1601
+ `measurement-failed`, `target-rewritten` and the setup-only cause reset no
1602
+ phase-runner failures.
1532
1603
  The closed cause map forces every future policy condition to choose one of these
1533
1604
  semantics instead of inheriting behavior from a missing `round`. Runner failures
1534
1605
  while checking progress or refreshing the base therefore remain counted after a
@@ -1668,7 +1739,13 @@ issue on GitHub returns it to triage: the first read strips a stale pre-reopen
1668
1739
  state label. That check reads the issue's last 100 label and reopen events, so
1669
1740
  an issue whose deciding event is older is excluded with a diagnostic until its
1670
1741
  state label is removed and re-added. Blockers are native GitHub issue
1671
- dependencies; a blocker in another repository never resolves. The ticket's own
1742
+ dependencies; a blocker in another repository never resolves. Blocker reads use
1743
+ the dependency list, not GitHub's lagging dependency summary, except broad
1744
+ listings and export, which can miss a blocker recorded seconds earlier. Claim
1745
+ re-reads blockers and leaves a ticket whose blocker was added after the
1746
+ dependency check ready for the next scan, and a ready-bound create with
1747
+ blockers opens in triage and moves to ready only after every blocker is
1748
+ recorded. The ticket's own
1672
1749
  issue is always a `closes` link. Links to other issues show on GitHub as
1673
1750
  `autobuild-link:<intent> #<n>` labels, one repository label per linked issue
1674
1751
  and intent, never deleted when unused; state and link labels are never ticket
@@ -1687,7 +1764,10 @@ import remaps every id to a new issue number (see the
1687
1764
  [ticket migration procedure](references/ticket-migration.md)). Dispatcher reads are conditional requests whose validators
1688
1765
  live under the local state root and are evicted after 7 days unused, so an
1689
1766
  unchanged repository costs a tick no primary rate-limit budget. Rate limits
1690
- surface as the ticket-source rate-limit error. A keyed create needs
1767
+ surface as the ticket-source rate-limit error. Each search page is one GitHub
1768
+ search API request on its own 30-per-minute quota; exhausting that quota
1769
+ refuses only searches until its reset, while a secondary rate limit pauses the
1770
+ whole source, like any other GitHub request. A keyed create needs
1691
1771
  `idempotencyKeyReservedAt`, the earliest time the key could first have been
1692
1772
  used; harvest supplies it. Drive all of it through `ab ticket`, never by
1693
1773
  hand-editing state or link labels.
@@ -1716,15 +1796,22 @@ environment variable instead and say why.
1716
1796
  ### `[orchestrator]`
1717
1797
 
1718
1798
  Enables credential-free sandbox environments per session owner and repository,
1719
- driven by external agents through `sandbox.*` tools. Operators run in external
1799
+ driven by external agents through `sandbox.*` tools: `sandbox.open`,
1800
+ `sandbox.status`, `sandbox.close` and `sandbox.refresh` manage the
1801
+ environment's lifecycle, and the remaining tools work inside it. Operators run in external
1720
1802
  harnesses; the service never starts or resumes them. The table is strict and
1721
1803
  restart-classified.
1722
1804
 
1723
1805
  | Field | Default | Allowed / constraints | Effect |
1724
1806
  |---|---|---|---|
1725
- | `enabled` | `false` | boolean | Enables external sandbox tools, archive cleanup and dispatcher idle settlement. |
1807
+ | `enabled` | unset: on when hosted, off locally | boolean | Enables external sandbox tools, archive cleanup and dispatcher idle settlement. An explicit value wins on every host. |
1726
1808
  | `sandbox` | — | strict subtable | The sandbox behavior knobs; absence reads as the defaults below. |
1727
1809
 
1810
+ Unset `enabled` resolves per host: a hosted deployment serves the sandbox tools,
1811
+ while local `ab mcp`, dispatch and `ab init` leave them off. Dispatcher releases
1812
+ older than this default deposit an explicit `enabled = false`, so their
1813
+ projects stay off until they upgrade.
1814
+
1728
1815
  The removed runner settings `model`, `invocationBudgetSeconds`, `approvals` and
1729
1816
  repository-default `wake` are rejected in new config. Historical effective
1730
1817
  config artifacts remain readable. New sessions have no inherited wake settings;
@@ -1734,7 +1821,7 @@ explicit session wake writes are durable facts and do not execute turns.
1734
1821
 
1735
1822
  | Field | Default | Allowed / constraints | Effect |
1736
1823
  |---|---|---|---|
1737
- | `idleMinutes` | `30` | positive integer | Minutes without a sandbox tool call after which the dispatcher tick's janitor stops the environment, keeping its snapshot; the next tool call resumes it. |
1824
+ | `idleMinutes` | `30` | positive integer | Minutes without a sandbox tool call after which the operator sandbox stops, keeping its snapshot; a later sandbox.open resumes it. On vercel-sandbox the provider's own timer stops it, and every tool call extends that timer, so no dispatcher tick is needed; the dispatcher tick's janitor also stops an environment whose journal evidence is older, so it is no longer the only idle stop. |
1738
1825
  | `environmentVariables` | `[]` | array of nonblank names | Names of non-secret host variables forwarded into the sandbox — the only non-toolchain environment it ever sees, during provisioning/setup and tool exec/start alike. Unset means none. |
1739
1826
 
1740
1827
  The credential-free rule is structural, not advisory: the environment receives
@@ -1744,19 +1831,58 @@ no store, forge, ticket-provider, or model credential, and naming any of
1744
1831
  `AI_GATEWAY_API_KEY` in `environmentVariables` is a config error. The typed
1745
1832
  operator tools remain the only route to build state from inside the sandbox.
1746
1833
 
1747
- Tool bounds an operator agent should know: `sandbox.exec` waits at most **300
1748
- seconds**; stdout and stderr are each truncated at **65,536 bytes** with a
1834
+ Lifecycle an operator agent should follow:
1835
+
1836
+ - **Open, then poll.** `sandbox.open` returns at once with state
1837
+ `provisioning`, `resuming`, `ready` or `failed`; provisioning runs in the
1838
+ background of the serving process. On vercel-sandbox the slow tail
1839
+ (dependency install, runtimes, setup) runs detached inside the sandbox, so
1840
+ it is not bound by the serving request. Poll `sandbox.status` (safe to
1841
+ repeat; it also reports the checkout head and the recorded base head) until
1842
+ it reports `ready`. Its only write records a finished attempt's outcome,
1843
+ exactly once, whichever process observes it.
1844
+ - **Not ready refuses.** Until then `sandbox.exec`, `start`, `read_file`,
1845
+ `write_file`, `publish` and `refresh` refuse with code `sandbox-not-ready`
1846
+ and a `state` field (`absent`, `provisioning`, `resuming`, `stopped` or
1847
+ `failed`); none of them provisions. A `failed` status carries the failing
1848
+ stage and a redacted message; open again to retry.
1849
+ - **Close keeps work.** `sandbox.close` stops the environment and its detached
1850
+ commands, releases provider capacity and keeps the checkout; a later
1851
+ `sandbox.open` resumes it. Closing nothing succeeds and does nothing.
1852
+ - **Refresh is not destructive.** `sandbox.refresh` fast-forwards a clean
1853
+ checkout to the current base-branch head and records it as the publication
1854
+ base. A dirty checkout refuses with `sandbox-refresh-dirty`, a diverged one
1855
+ with `sandbox-refresh-diverged`, and a refusal changes nothing.
1856
+ - **Reset is.** `sandbox.reset` discards everything and re-provisions from the
1857
+ current base head in the background, returning the `sandbox.open` result;
1858
+ poll `sandbox.status` again.
1859
+ - **Idle stops.** An idle environment stops after `idleMinutes` without a
1860
+ sandbox tool call, keeping its checkout. On vercel-sandbox the provider's
1861
+ own timer stops it and every tool call extends that timer, so no dispatcher
1862
+ tick is needed; the dispatcher janitor is a second stop, no longer the only
1863
+ one. A stopped environment refuses tools with `sandbox-not-ready` (`stopped`)
1864
+ until `sandbox.open` resumes it with its committed and uncommitted work
1865
+ intact. `sandbox.status` never resumes it, so a failure recorded inside a
1866
+ stopped sandbox surfaces through the next `sandbox.open`, which reports it
1867
+ with its original stage. A failed environment is kept (stopped by its timer
1868
+ or `sandbox.close`) until the next `sandbox.open` records the failure and
1869
+ re-provisions; if that record cannot be written, open refuses with "nothing
1870
+ was discarded; call sandbox.open again".
1871
+ - A workspace provider without this lifecycle answers `sandbox.open`,
1872
+ `status`, `close`, `refresh` and `reset` with code `sandbox-unsupported`.
1873
+
1874
+ Tool bounds: `sandbox.exec` waits at most **300 seconds**; stdout and stderr
1875
+ are each truncated at **65,536 bytes** with a
1749
1876
  `[truncated by autobuild: output exceeded 65536 bytes]` marker; `sandbox.reset`
1750
- and archiving a session owner's last session are **destructive** (reset re-provisions
1751
- from the current base head); there is at most **one** environment per session owner
1752
- and repository.
1877
+ and archiving a session owner's last session are **destructive**; there is at
1878
+ most **one** environment per session owner and repository.
1753
1879
 
1754
1880
  Publication: `sandbox.publish` takes a title (1–200 characters), an optional
1755
1881
  body (≤65,536 characters), and an optional explicit commit, and takes your
1756
1882
  sandbox's current head commit to a pull request. It refuses when the checkout
1757
1883
  has uncommitted changes — tracked or untracked (the sandbox's own provisioning
1758
1884
  marker is excluded) — and when the commit is not a descendant of the base head
1759
- recorded when the sandbox was provisioned or last reset — a pre-existing environment without a recorded
1885
+ recorded when the sandbox was provisioned, last refreshed, or reset — a pre-existing environment without a recorded
1760
1886
  base head asks you to run `sandbox.reset` first. The rule is PR only, never the
1761
1887
  base branch: the sandbox itself never pushes and holds no credential — the push
1762
1888
  and the PR creation are kernel plumbing through the workspace provider's
@@ -1765,6 +1891,37 @@ repository, so a later publish updates the same PR's head. A publication is a
1765
1891
  repository-journal fact naming the session owner (the `operator` field), the session, the branch, the
1766
1892
  commit, and the PR; a refused or failed attempt is journaled too.
1767
1893
 
1894
+ Where the tools are served:
1895
+
1896
+ - **Local `ab mcp`** reads the checkout's config at startup. It lists the
1897
+ `sandbox.*` tools only when `[orchestrator] enabled = true` and the backend
1898
+ builds; `sandbox.publish` also needs a forge and provider publication.
1899
+ - **Hosted `/mcp`** lists every `sandbox.*` tool whenever the deployment can
1900
+ host operator sandboxes. Each call is checked against the repository's latest
1901
+ deposited effective config and refused with a typed code that names the
1902
+ reason:
1903
+
1904
+ | Code | Reason |
1905
+ |---|---|
1906
+ | `sandbox-orchestrator-disabled` | The latest effective config sets `enabled = false` (older releases write it explicitly). |
1907
+ | `sandbox-no-effective-config` | No dispatcher has deposited an effective config for the repository. |
1908
+ | `sandbox-effective-config-invalid` | The latest deposited effective config cannot be read. |
1909
+ | `sandbox-credentials-missing` | The project's provider cannot host a sandbox and the deployment lacks Vercel or forge credentials; the message names which. |
1910
+ | `sandbox-backend-unavailable` | The sandbox backend could not be built. |
1911
+
1912
+ A new deposit takes effect on the next call. Only `vercel-sandbox` can host
1913
+ a sandbox on a deployment, so a project with any other workspace provider,
1914
+ such as `git-worktree` dispatched locally, gets one from the deployment's
1915
+ Vercel Sandbox provider. That needs the deployment's Vercel credential and
1916
+ `GITHUB_TOKEN` or `GH_TOKEN`. The forge token is the git read credential,
1917
+ injected only by the host-side egress transform on upload-pack requests; the
1918
+ guest never sees it. `sandbox-not-ready` applies here as it does locally;
1919
+ the Vercel Sandbox provider implements the whole lifecycle, so
1920
+ `sandbox-unsupported` does not arise on a deployment.
1921
+ - **A hosted per-repository URL** (`/mcp/<host><path>`) lists `sandbox.*` only
1922
+ when that repository's latest deposited effective config enables
1923
+ `[orchestrator]`. Calls keep the same typed codes.
1924
+
1768
1925
  ### `[upgrade]`
1769
1926
 
1770
1927
  | Field | Default | Meaning |
@@ -2037,26 +2194,90 @@ By default, each Git repository owns one self-contained state tree at
2037
2194
 
2038
2195
  - `autobuild.sqlite` — build records, event logs, and repository journals.
2039
2196
  - `blobs/` — content-addressed artifacts.
2040
- - `worktrees/` — autobuild-created Git worktrees.
2041
2197
  - `tickets/` — the default location for the `file` ticket source.
2042
2198
 
2199
+ Build worktrees live outside the checkout, so tools that walk parent
2200
+ directories for `node_modules` never reach the checkout's packages. A state
2201
+ tree outside the checkout keeps them in its own `worktrees/`. Otherwise they
2202
+ go to `$XDG_STATE_HOME/autobuild/worktrees/<checkout>-<hash>/`, which defaults
2203
+ to `~/.local/state/…`. The destination is checked on real paths: it must not
2204
+ resolve inside the checkout, and no directory from it up to `/` may hold
2205
+ `node_modules`. When the check fails, each new build fails to provision with an
2206
+ error naming the remedy, and dispatch shows the same message as a startup
2207
+ notice. Builds already in a worktree continue and release. Builds whose
2208
+ worktree is still at the old `<main-repo>/.autobuild/worktrees/` location
2209
+ resume, clean up and release in place; nothing new is created there.
2210
+
2043
2211
  The main checkout comes from Git's absolute repository/worktree topology, not
2044
2212
  blindly from the current worktree's top level or the parent of its Git common
2045
2213
  directory. Commands run in an autobuild-created linked worktree therefore read
2046
2214
  the main checkout's state and file tickets, while submodules and
2047
2215
  separate-Git-dir checkouts keep distinct roots beneath their own working trees.
2048
- There is no home-directory fallback: a repository with no state tree starts
2049
- empty.
2216
+ Store state has no home-directory fallback: a repository with no state tree
2217
+ starts empty.
2050
2218
 
2051
2219
  Every command uses the same precedence: explicit `--store <ref>` > nonempty
2052
2220
  `AB_STORE` > `[store] url` > `<main-repo>/.autobuild`. Relative local overrides are normalized
2053
2221
  against the main checkout. A local override relocates the whole state tree,
2054
- including `worktrees/` and default file tickets; an explicit `[tickets].dir`
2055
- remains repo-relative. An HTTP(S) URL still selects the remote store unchanged,
2056
- while worktrees and default file tickets remain under the repository-default
2057
- `.autobuild/` directory. The dispatcher passes its normalized selection to
2222
+ including default file tickets, and build worktrees follow it when it lies
2223
+ outside the checkout; an explicit `[tickets].dir` remains repo-relative. An
2224
+ HTTP(S) URL still selects the remote store unchanged, while default file
2225
+ tickets remain under the repository-default `.autobuild/` directory and build
2226
+ worktrees use the state-home location. The dispatcher passes its normalized selection to
2058
2227
  every agent session as `AB_STORE`.
2059
2228
 
2229
+ ### Repository agent context
2230
+
2231
+ Every dispatcher, in checkout or origin mode, keeps one record of the
2232
+ repository's agent context at the base-branch head in the store. It reads the
2233
+ tree through the forge (`git` for `local-git`, the Git Data API for GitHub), so
2234
+ both modes record identical content for the same commit. The record names its
2235
+ base commit and captures:
2236
+
2237
+ - **Skills.** Every skill directory under `.agents/skills/` and
2238
+ `.claude/skills/` that holds a `SKILL.md`, with all its files. A skill present
2239
+ in both, symlinked or byte-identical, appears once with every install path.
2240
+ Repository-local skills without the `ab-` prefix are included; dot-directories
2241
+ such as `.ab-pristine` are not.
2242
+ - **Agent instructions.** Every `AGENTS.md` and `CLAUDE.md`, root and nested,
2243
+ each with its directory. In one directory the two collapse into one entry
2244
+ when they are the same file or identical.
2245
+ - **Imports.** Files the instructions import by `@path`, resolved relative to
2246
+ the importing file and followed transitively. Each is a separate entry, never
2247
+ inlined. A path outside the repository is listed as omitted.
2248
+
2249
+ | Repository artifact | Holds | Written |
2250
+ | --- | --- | --- |
2251
+ | `agent-context` | The record: gzip JSON, metadata `{ schema, commit, digest, bytes, rawBytes }` | Only when the content digest changes |
2252
+ | `agent-context-head` | Pointer: last base head handled, input fingerprint, standing diagnostic | When the base head changes |
2253
+ | `agent-context-cache.<i>` | Blob bytes an interrupted capture already fetched | Only when an invocation deadline cuts a capture short |
2254
+
2255
+ Each process reads the base head at most once a minute, always on its first
2256
+ tick. An unchanged head then costs one small pointer read per fresh process and
2257
+ no tree, blob, record or event reads. Readers take the latest `agent-context`
2258
+ revision only.
2259
+
2260
+ Two bounds apply, and each has a typed tick-report diagnostic that `ab
2261
+ dispatch` prints:
2262
+
2263
+ - `oversize`: the encoded record exceeds 2.25 MiB.
2264
+ - `raw-oversize`: the record exceeds 32 MiB uncompressed, which is also every
2265
+ reader's decode ceiling, so a published record is always readable.
2266
+
2267
+ Both name the bound and the largest contributors. They, and `tree-unlistable`
2268
+ (the forge cannot list one directory completely), keep the last good revision
2269
+ and are reported once per base head. `capture-failed` is retried after five
2270
+ minutes, or as soon as the base head moves, and reported once per distinct
2271
+ failure; `unavailable` means the forge cannot read trees.
2272
+
2273
+ All three kinds are retention-managed like the dispatcher config artifacts: the
2274
+ newest 200 revisions of each kind survive (`AB_ARTIFACT_RETENTION_MAX_REVISIONS`
2275
+ overrides the bound). The dispatcher only writes the record. Connected agents
2276
+ read it through the `context.list` and `context.read` operator tools, the MCP
2277
+ prompt named for each skill, and the agent-context section of the MCP server
2278
+ instructions; see [Serving the operator tools over
2279
+ MCP](#serving-the-operator-tools-over-mcp).
2280
+
2060
2281
  ### Several dispatchers on one repository
2061
2282
 
2062
2283
  One repository driven by several dispatchers — for example each engineer
@@ -2075,8 +2296,12 @@ dispatchers but not store-owned state. Separate local stores each see only their
2075
2296
  API show only the local store's builds.
2076
2297
  - **Branch collisions are only partly guarded.** A dispatcher skips any slug
2077
2298
  whose `ab/` or `ab-node/` branch already exists on the remote (when its forge
2078
- supports `remoteBranchExists`), but two stores that claim the same name
2079
- before either pushes can still collide.
2299
+ supports `remoteBranchExists`) or locally in its checkout (when its workspace
2300
+ provider, such as git-worktree, supports `localBranchExists`), but two stores
2301
+ that claim the same name before either pushes can still collide. A leaf
2302
+ build's first provision never adopts an existing branch: it cuts from the
2303
+ base and keeps the old tip under `refs/autobuild/displaced/<branch>/<sha>`.
2304
+ A node's branch, which the kernel opens before any provision, is its own.
2080
2305
 
2081
2306
  ## Connect a project
2082
2307
 
@@ -2178,6 +2403,16 @@ provider-specific API/MCP calls:
2178
2403
  no filters it uses exactly dispatch's configured ready state and source-aware
2179
2404
  default labels. If either filter is present, only explicitly supplied
2180
2405
  criteria apply; every requested label must match.
2406
+ - `ab ticket search <query> [--state <state>] [--labels a,b] [--limit <n>] [--cursor <cursor>] [--json]`
2407
+ finds tickets whose title or body contains every query word,
2408
+ case-insensitively, in every state unless `--state` is given; check it for
2409
+ duplicates before `create`. `--limit` (default 20, at most 100) sizes a page
2410
+ and `--cursor` continues from the previous page's cursor. `--json` emits
2411
+ `{tickets, cursor?, diagnostics}`, identical to MCP `tickets.search`. Sources
2412
+ without search exit nonzero naming themselves and list nothing. The file,
2413
+ hosted, Linear and GitHub sources search; GitHub matches whole words through
2414
+ GitHub issue search. The hosted source refuses against a service predating
2415
+ search.
2181
2416
  - `ab ticket show <id> [--json]` reads one complete ticket. Human output includes
2182
2417
  labeled metadata and the body verbatim, so it can read a stored spec back.
2183
2418
  - `ab ticket move <id> (<state> | --role triage|ready|backlog|rejected) [--json]`
@@ -2215,8 +2450,10 @@ to a ticket that has already been claimed into a build does not stop that build.
2215
2450
  For dependent tickets, follow the
2216
2451
  [safe blocker-filing workflow](references/ticket-dependencies.md): determine the
2217
2452
  intended final destination, stage outside ready, verify all blocker relationships,
2218
- and move to ready last. Direct Linear and GitHub create the issue and its blockers
2453
+ and move to ready last. Direct Linear creates the issue and its blockers
2219
2454
  in separate requests; one `create --blocked-by` call is not atomic publication.
2455
+ GitHub stages a ready-bound create in triage itself and publishes it to ready
2456
+ after recording every blocker.
2220
2457
  Harvest's creation reservations cover Harvest only, not interactive CLI creates.
2221
2458
  Dependency order and JSON id extraction are still required, but do not alone
2222
2459
  prevent an active dispatcher from claiming a partially created ready ticket.
@@ -2238,7 +2475,9 @@ issue links refuses any write naming them, names itself, and writes nothing.
2238
2475
  work, each class in source order, and ahead of normal builds waiting for a
2239
2476
  slot; blockers and every other gate still apply, and it never preempts a
2240
2477
  running build. The claimed build keeps that priority; `ab priority <slug>
2241
- urgent|normal` changes an existing build's priority without touching its ticket. `--priority normal` (the default)
2478
+ urgent|normal` changes an existing build's priority without touching its ticket.
2479
+ An optimization attempt ignores its ticket's priority and claims at its node's
2480
+ current priority. `--priority normal` (the default)
2242
2481
  removes urgency. The file, hosted and Linear sources store priority (Linear as
2243
2482
  its native Urgent; `normal` clears only Urgent and leaves other Linear priorities
2244
2483
  alone); plugin sources without the capability read every ticket as normal,
@@ -2282,16 +2521,20 @@ assets composed with legacy BuildStore attachments. Sources without native asset
2282
2521
  use the BuildStore. Existing service assets need no migration. Old local hosted-ticket
2283
2522
  assets are not moved and are not a fallback. Each has a kind and a name.
2284
2523
 
2285
- - `ab ticket attach <id> <kind> <path> [--name <name>] [--json]` stores `<path>`
2524
+ - `ab ticket attach <id> <kind> <path> [--name <name>] [--json]`
2525
+ (`tickets.asset.attach`) stores `<path>`
2286
2526
  (default name: its basename). Attaching the same kind and name again makes a
2287
2527
  new revision; earlier ones stay retrievable. Over the store's size limit
2288
2528
  (25 MiB by default, lower when the instance advertises a request ceiling) it is refused. Attach and
2289
2529
  remove leave a note on the ticket naming the asset.
2290
2530
  - `ab ticket show <id>` lists the current assets; with `--json` the ticket
2291
- gains an `assets` array.
2292
- - `ab ticket asset get <id> <kind> <name> <dest> [--rev <n>]` downloads the
2293
- exact bytes of the latest (or given) revision; `ab ticket asset rm <id> <kind>
2294
- <name>` drops it from the current assets.
2531
+ gains an `assets` array, as does `tickets.get`.
2532
+ - `ab ticket asset get <id> <kind> <name> <dest> [--rev <n>]`
2533
+ (`tickets.asset.get`) downloads the exact bytes of the latest (or given)
2534
+ revision; `ab ticket asset rm <id> <kind> <name>` (`tickets.asset.remove`)
2535
+ drops it from the current assets.
2536
+ - The operator tools carry bytes as base64 under the same rules, limits and
2537
+ notes; see the [operator API](references/operator-api.md#ticket-assets).
2295
2538
  - **Frozen at claim.** A claim pins the current revisions into the build.
2296
2539
  Hosted revisions are copied into immutable snapshots in the build store,
2297
2540
  preserving revision numbers and allowing reads without the ticket service.
@@ -2399,15 +2642,20 @@ Humans may run `ab dispatch --viewer` from a local checkout to watch dispatch
2399
2642
  elsewhere without taking a lease or starting any dispatch work. The optional
2400
2643
  `--dispatched-by <label>` is descriptive input: every frame shows `viewer` or
2401
2644
  `viewer · dispatched by <label>`. Plain/non-TTY output prints the same at startup
2402
- and emits state changes. `--once` reads one snapshot; `--interval <s>` sets the
2403
- viewer polling cadence. Startup intake flags and explicit `--repository` are
2645
+ and emits state changes; with `--web` a TTY viewer shows the web UI's URL beside
2646
+ its `viewer` line, and plain/non-TTY output prints only the URL. `--once`
2647
+ reads one snapshot; `--interval <s>` sets the viewer polling cadence. Startup intake flags and explicit `--repository` are
2404
2648
  rejected. With no recorded dispatcher run the viewer says no dispatcher has run
2405
2649
  for this project yet; with a run whose effective configuration is not yet
2406
2650
  durable it waits.
2407
2651
 
2408
2652
  Viewer uses the dispatch frontend with canonical repository facts for status,
2409
2653
  settings, harvest and migrations, bypassing the dispatch presentation event feed
2410
- and its checkpoints. Fresh viewers reuse server reductions; idle refreshes read
2654
+ and its checkpoints. That status, like the web dashboard's and the operator
2655
+ queries', describes the run holding repository authority, or that held it last:
2656
+ an overlapping run that starts, yields and stops never replaces it. A run
2657
+ replaces it by recording a tick boundary, or by starting once it has stopped or
2658
+ before it has ticked. Fresh viewers reuse server reductions; idle refreshes read
2411
2659
  zero event rows. Its one ticket-source read is the header's triage count, at
2412
2660
  most once per 60 s. It has no child, lease, execution wiring or upgrade-release timer.
2413
2661
  All existing shared-store controls remain: merge/hold, build/global pause/resume,
@@ -2483,7 +2731,9 @@ the configured source's bounded state count itself, at most once per 60 s
2483
2731
  while it runs. It keeps its last good value through failed reads and through
2484
2732
  headless ticks that publish no count, and shows `–` until its first read
2485
2733
  succeeds or when the source has no state counts (Linear). `queue` is the
2486
- ready-ticket queue depth, and `active` is occupied capacity (every unfinished
2734
+ ready-ticket queue depth measured by the latest completed ticket scan,
2735
+ whichever dispatcher run recorded it (0 before any scan), so an overlapping
2736
+ run that starts and yields cannot displace it. `active` is occupied capacity (every unfinished
2487
2737
  build except one waiting on tickets, plus finished builds running work again)
2488
2738
  against root `capacity`. Observation pressure is not a header counter: the
2489
2739
  Harvest row shows a run's observations, and `ab harvest status` reports
@@ -2698,10 +2948,11 @@ to the build's event log and apply the same write-time checks.
2698
2948
  | Stop an optimization node | `ab objective <node> --stop [--drain\|--abort] [--json] [--store <ref>]` | CLI/tool request (`optimization.stop`). Without a flag the objective's stop mode applies (abort by default). Final, and not merge consent. | `optimization.stopped`; dispatcher `build.abort-requested` per aborted attempt, then `attempt.settled` |
2699
2949
  | Settle an unmeasured merge | `ab objective <node> --settle-unmeasured <proposal\|build> --policy release-unmeasured [--note <text>] [--json] [--store <ref>]` | CLI/tool request (`optimization.settle-unmeasured`). Only for an attempt listed as an unmeasured merge; releases its slot once, never as accepted. | `attempt.settled {outcome: merged-unmeasured}` |
2700
2950
  | Hold merge | `ab hold <slug> [--reason <text>] [--store <ref>]` | Select a build and press `o`, including before readiness. | `build.hold-requested` (optional `reason`), then `landing.command-acknowledged` after native cancellation |
2701
- | Set build priority | `ab priority <slug> urgent\|normal [--store <ref>]` | CLI/tool request (`builds.control` action `priority`); changes only the build's slot-admission order, never its ticket, and never preempts running work. A build priority is only `urgent` or `normal`; `ab start`'s `manual` tier is admission-only. | `build.priority-set` |
2951
+ | Set build priority | `ab priority <slug> urgent\|normal [--store <ref>]` | CLI/tool request (`builds.control` action `priority`); changes only the build's slot-admission order, never its ticket, and never preempts running work. On an optimization node it also sets the tier its attempts claim in afterwards. A build priority is only `urgent` or `normal`; `ab start`'s `manual` tier is admission-only. | `build.priority-set` |
2702
2952
  | Answer blockers with guidance | `ab answer <slug> <text> [--store <ref>]` | Select a blocked build, press `r`, enter text, then Enter. | One `escalation.answered` with `resolution: guidance` per applicable blocker. |
2703
2953
  | Retry blockers without guidance | `ab answer <slug> [--store <ref>]` | Open the same `r` field and press Enter empty or whitespace-only. | One `escalation.answered` with `resolution: retry` per applicable blocker. |
2704
2954
  | Dismiss cited finding chains | `ab answer <slug> --dismiss [--store <ref>]` | CLI only; build detail names the command. | One `escalation.answered` with `resolution: dismiss-finding` per blocker that cites a real review finding. |
2955
+ | Accept a rewritten target | `ab answer <slug> --accept-target [--store <ref>]` | CLI or MCP `builds.answer` with `resolution: accept-target`; answers only a leaf's `policy/target-rewritten` escalation, which other answer forms skip. | One `escalation.answered` with `resolution: accept-target`, then kernel `target.rewrite-recovered {recovery: accepted}` and a restack onto the current target |
2705
2956
  | Revise spec from a file | `ab answer <slug> --revise-spec <file> [--store <ref>]` | CLI only; build detail names the command. | For leaves, human `escalation.answered` then kernel `spec.revised`; eligible nodes publish `spec.revised` with operator provenance. |
2706
2957
  | Re-import revised ticket spec | `ab answer <slug> --revise-spec-from-ticket [--store <ref>]` | CLI only; build detail names the command. | The same leaf answer or direct node `spec.revised` protocol. |
2707
2958
  | Reopen a finished leaf | `ab reopen <slug> [--feedback <text>] [--revise-spec <file> \| --revise-spec-from-ticket] [--store <ref>]` | CLI/tool request (`builds.reopen`); only for a leaf waiting for its merge decision. Feedback alone returns to implement; a spec revision restarts from plan; the PR and branch are kept. | `build.reopened`; with a spec, kernel `spec.revised` with operator provenance |
@@ -3423,7 +3674,9 @@ MCP `repository.events` is a connected agent's repository attention watch: it
3423
3674
  reads at most 256 journal positions after its cursor, with an optional wait of
3424
3675
  at most 30 seconds, and by default returns exactly the repository records this
3425
3676
  default watch reports. Its cursor advances past filtered events; omit it once
3426
- for a baseline, and treat `cursor-too-old` as above.
3677
+ for a baseline, and treat `cursor-too-old` as above. MCP `repository.attention`
3678
+ returns the current attention digest, every item naming its resolving tool,
3679
+ with the same cursor rules.
3427
3680
 
3428
3681
  **`ab harvest status [--events N] [--json] [--store <ref>]`** projects the
3429
3682
  **`ab harvest status [--events N] [--json] [--store <ref>]`** projects the
@@ -3512,6 +3765,30 @@ args = ["<install-root>/bin/ab.ts", "mcp"]
3512
3765
  The server runs until its client disconnects (stdio EOF) and needs no
3513
3766
  daemon: each client session starts one short-lived `ab mcp` process.
3514
3767
 
3768
+ ### Agent context over MCP
3769
+
3770
+ Every MCP binding (`ab mcp`, hosted `/mcp`, and the per-repository URLs) serves
3771
+ the repository's captured agent context, so a connected agent learns how to
3772
+ work without a checkout:
3773
+
3774
+ - `context.list` returns the skills (name, description, files), the agent
3775
+ instructions files with scopes and imports, the commit the record was taken
3776
+ from, and which to load before operating (`ab-operate`) and before ticket
3777
+ work (`ab-spec`, `ab-tickets`, the instructions).
3778
+ - `context.read` returns one file by path, or by a relative link with `from`.
3779
+ Skill files that mention `ab` commands start with a generated preamble that
3780
+ maps each command to its operator tool, or marks it as build-session only,
3781
+ runnable in the sandbox, or a host task for a human. Agent instructions get a
3782
+ preamble framing them as the repository's own rules, which win over
3783
+ Autobuild skills for that repository.
3784
+ - One MCP prompt per skill returns the same text as `context.read`.
3785
+ - The server instructions list each repository's skills and instructions.
3786
+ Hosted endpoints build them only for an `initialize` request: one
3787
+ latest-revision record read per repository in scope.
3788
+
3789
+ A repository with no captured record is served the canonical skills bundled
3790
+ with the serving Autobuild, and the index and every preamble say so.
3791
+
3515
3792
  ## The installed skills
3516
3793
 
3517
3794
  Each is invoked as `ab-<name>`, with its editable copy at
@@ -3593,8 +3870,19 @@ and `tickets.unblock` with the revision from `tickets.get` or `tickets.list`.
3593
3870
  ## Forge failure recovery
3594
3871
 
3595
3872
  Destination observation uses authoritative remote tips and fails closed on read
3596
- or ancestry errors. External rewrites retain the accepted target and raise
3597
- `target.rewritten` attention. Kernel node restacks instead require durable
3873
+ or ancestry errors. External rewrites record `target.rewritten` and retain the
3874
+ accepted target; nothing adopts them on top of existing work automatically:
3875
+
3876
+ - A leaf with no work of its own (no published head, no PR, no commits beyond
3877
+ its base) is reprovisioned from the current target by its next runner,
3878
+ without operator action (`target.rewrite-recovered`, `reprovisioned`).
3879
+ - A leaf with work raises one `policy/target-rewritten` escalation per episode
3880
+ (a run of rewrites of the same rejected base) naming that base, the new
3881
+ target head and its own commits. `ab answer <slug> --accept-target` restacks
3882
+ those commits onto the current target; `ab abort` is the other way out.
3883
+ - A node waits and raises `target.rewritten` attention once per episode.
3884
+
3885
+ Kernel node restacks instead require durable
3598
3886
  guarded publication receipts: the dispatcher proves at most 64 indexed hops per
3599
3887
  baseline and records them in `target.moved.lineage` for scoped runners. Missing
3600
3888
  proof or a longer gap still raises attention. See
@@ -3815,3 +4103,37 @@ ticket numbering from 1. Old credentials remain invalid with 401; independently
3815
4103
  repository-established requests receive 403 project not registered. See
3816
4104
  [project deletion](references/operator-api.md#permanent-project-deletion) for
3817
4105
  generation-bound preview tokens and API semantics.
4106
+
4107
+ ## Dispatcher ownership and web views
4108
+
4109
+ Read fresh `ab repository status --json` (`repository.status` for connected
4110
+ operators). `dispatcherRunning` is true for a holder, expired holder or unfinished
4111
+ handoff with a draining predecessor, including an empty drain map. Only durable
4112
+ retirement clears that evidence; missing/unreadable status fails closed for startup.
4113
+ Follow `ab-operate` boundaries: never start while running, honor repository rules,
4114
+ then the local ownership preference, or ask and offer to save it when unset.
4115
+ Agent-owned startup uses `ab dispatch --web --plain --json` and returns the URL;
4116
+ only a dispatcher this session started may be cleanly stopped on request.
4117
+
4118
+ `ab web [--json]` always permits a read-only browser surface without a dispatcher
4119
+ lease. `ab dispatch --web` serves the same UI with the dispatcher; `--plain`
4120
+ keeps the URL on stdout and diagnostics on stderr, and a TTY dashboard keeps it
4121
+ right-aligned on its top line in every view and across runtime upgrades. Loopback binding is the default;
4122
+ non-loopback serving has no access control. The overview and build detail show progress,
4123
+ and each build page ends with that build's timeline. The analytics page
4124
+ (`/analytics`) shows a Gantt of builds active in a window (24 hours, 7 days,
4125
+ 30 days or all retained history), 25 to a page, on a clock or from-start axis,
4126
+ and step durations as per-run mean and percentiles or total time; outcome
4127
+ (merged or all) and kind (leaf, node or all) filters apply to both. Open tabs share refresh work;
4128
+ standalone web serving reads nothing while no browser is connected. While a tab is
4129
+ open, `ab web` starts its overview from the build roster, reading live builds and
4130
+ recently aborted builds that may still be cleaning up. It then reads only changed
4131
+ builds, and only the repository change position while idle. Analytics and
4132
+ timelines are explicit reads, fetched on load and on each filter, window or page
4133
+ change, and again for the same query only when the change position moves. A new
4134
+ analytics answer reads one rollup value, one listing page and at most 25 saved
4135
+ timelines; a build timeline not in memory reads the build and its saved timeline.
4136
+ `ab dispatch --web` shows the repository header without the overview. Its
4137
+ terminal-dashboard frames add no reads; a plain dispatcher reads one change
4138
+ position per tick while a browser is connected; analytics requests are explicit
4139
+ reads once its store is open.