@defrex/autobuild 1.3.0 → 1.4.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 (144) hide show
  1. package/README.md +1 -1
  2. package/SPEC.md +307 -27
  3. package/docs/accounts.md +38 -0
  4. package/docs/architecture.md +198 -25
  5. package/docs/build-store.md +18 -0
  6. package/docs/builds.md +5 -1
  7. package/docs/cli.md +1 -1
  8. package/docs/configuration.md +38 -19
  9. package/docs/dispatcher-hosting.md +42 -0
  10. package/docs/dispatcher.md +41 -0
  11. package/docs/forges.md +5 -0
  12. package/docs/integration-tree.md +8 -0
  13. package/docs/operating.md +11 -3
  14. package/docs/operator-api.md +37 -4
  15. package/docs/plugin-authoring.md +45 -1
  16. package/docs/remote-store-protocol.md +262 -42
  17. package/docs/remote-ticket-protocol.md +12 -10
  18. package/docs/restacking.md +60 -3
  19. package/docs/setup.md +37 -8
  20. package/docs/skills.md +1 -1
  21. package/docs/spec-standard.md +37 -3
  22. package/docs/troubleshooting.md +9 -0
  23. package/docs/workspaces.md +1 -1
  24. package/package.json +4 -3
  25. package/packages/core/src/accounts/availability.ts +96 -0
  26. package/packages/core/src/accounts/local-owner.ts +49 -2
  27. package/packages/core/src/cli/attention.ts +2 -0
  28. package/packages/core/src/cli/binary.ts +17 -1
  29. package/packages/core/src/cli/context.ts +62 -0
  30. package/packages/core/src/cli/dashboard/model.ts +12 -3
  31. package/packages/core/src/cli/dashboard/poll.ts +65 -8
  32. package/packages/core/src/cli/dashboard/refresh.ts +2 -0
  33. package/packages/core/src/cli/dashboard/render.ts +46 -5
  34. package/packages/core/src/cli/dispatch-args.ts +27 -3
  35. package/packages/core/src/cli/dispatch-frontend.ts +187 -53
  36. package/packages/core/src/cli/dispatch-mode.ts +94 -0
  37. package/packages/core/src/cli/dispatch-preflight.ts +43 -0
  38. package/packages/core/src/cli/dispatch-repository-feed.ts +45 -9
  39. package/packages/core/src/cli/dispatch.ts +145 -11
  40. package/packages/core/src/cli/harvest.ts +2 -1
  41. package/packages/core/src/cli/help.ts +16 -3
  42. package/packages/core/src/cli/historical-build-state.ts +6 -0
  43. package/packages/core/src/cli/main.ts +15 -2
  44. package/packages/core/src/cli/publication-settlement.ts +17 -0
  45. package/packages/core/src/cli/remote-poll.ts +11 -1
  46. package/packages/core/src/cli/repository-status.ts +11 -0
  47. package/packages/core/src/cli/status.ts +7 -1
  48. package/packages/core/src/cli/wait.ts +9 -2
  49. package/packages/core/src/cli/watch.ts +38 -3
  50. package/packages/core/src/config/roles.ts +16 -1
  51. package/packages/core/src/events/catalog.ts +7 -0
  52. package/packages/core/src/events/payloads.ts +85 -2
  53. package/packages/core/src/events/policy.ts +10 -0
  54. package/packages/core/src/events/repository.ts +35 -0
  55. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +189 -0
  56. package/packages/core/src/kernel/dispatch-placement.ts +30 -0
  57. package/packages/core/src/kernel/engine.ts +19 -12
  58. package/packages/core/src/kernel/generators/leaf-restack-log.ts +17 -1
  59. package/packages/core/src/kernel/leaf-restack-state.ts +24 -2
  60. package/packages/core/src/kernel/log-index.ts +1 -1
  61. package/packages/core/src/kernel/node-landing.ts +27 -10
  62. package/packages/core/src/kernel/node-restack-demand.ts +1 -0
  63. package/packages/core/src/kernel/node-restack-state.ts +16 -1
  64. package/packages/core/src/kernel/node-restack-transaction.ts +14 -0
  65. package/packages/core/src/kernel/read-facts.ts +114 -9
  66. package/packages/core/src/kernel/reconcile-head.ts +34 -11
  67. package/packages/core/src/kernel/reconcile-restack.ts +106 -72
  68. package/packages/core/src/kernel/reducer-registry.ts +3 -0
  69. package/packages/core/src/kernel/reducer.ts +20 -2
  70. package/packages/core/src/kernel/replay-retention.ts +176 -0
  71. package/packages/core/src/kernel/target-lineage.ts +65 -0
  72. package/packages/core/src/kernel/target-observation.ts +117 -0
  73. package/packages/core/src/operator/registry.ts +5 -13
  74. package/packages/core/src/operator/tickets.ts +8 -2
  75. package/packages/core/src/plugin-sdk/index.ts +1 -0
  76. package/packages/core/src/ports/forge/fake.ts +22 -0
  77. package/packages/core/src/ports/forge/git-rewrite.ts +49 -12
  78. package/packages/core/src/ports/forge/github.ts +42 -10
  79. package/packages/core/src/ports/forge/local-git.ts +16 -1
  80. package/packages/core/src/ports/types.ts +58 -4
  81. package/packages/core/src/ports/workspace/account-policy.ts +2 -1
  82. package/packages/core/src/ports/workspace/commit-preservation.ts +175 -0
  83. package/packages/core/src/ports/workspace/create.ts +2 -0
  84. package/packages/core/src/ports/workspace/distribution-archive.ts +14 -4
  85. package/packages/core/src/ports/workspace/fake.ts +4 -0
  86. package/packages/core/src/ports/workspace/git-worktree.ts +22 -1
  87. package/packages/core/src/ports/workspace/vercel-sandbox.ts +304 -56
  88. package/packages/core/src/processes/build-runner.ts +240 -111
  89. package/packages/core/src/processes/dispatcher-selectors.ts +3 -2
  90. package/packages/core/src/processes/dispatcher.ts +262 -80
  91. package/packages/core/src/processes/execution-no-progress.ts +7 -0
  92. package/packages/core/src/processes/harvest-runner.ts +6 -7
  93. package/packages/core/src/processes/publication-state.ts +2 -1
  94. package/packages/core/src/processes/repo-view.ts +22 -0
  95. package/packages/core/src/processes/tick-publication.ts +35 -47
  96. package/packages/core/src/processes/workspace-preservation.ts +164 -0
  97. package/packages/core/src/scenarios/harness.ts +7 -0
  98. package/packages/core/src/store/adapter.ts +9 -0
  99. package/packages/core/src/store/build-scope.ts +28 -0
  100. package/packages/core/src/store/contract.ts +125 -0
  101. package/packages/core/src/store/event-reads.ts +156 -0
  102. package/packages/core/src/store/local/schema.ts +11 -0
  103. package/packages/core/src/store/local/store.ts +117 -2
  104. package/packages/core/src/store/memory.ts +237 -0
  105. package/packages/core/src/store/phase-session.ts +47 -0
  106. package/packages/core/src/store/reduced-reads.ts +8 -0
  107. package/packages/core/src/store/reducer-value-shapes.json +6262 -5227
  108. package/packages/core/src/store/reducer-value-validation.ts +3 -0
  109. package/packages/core/src/store/reducer-values.ts +62 -2
  110. package/packages/core/src/store/remote/client.ts +161 -16
  111. package/packages/core/src/store/remote/compatibility.ts +177 -46
  112. package/packages/core/src/store/remote/errors.ts +16 -0
  113. package/packages/core/src/store/remote/index.ts +11 -0
  114. package/packages/core/src/store/remote/protocol.ts +22 -0
  115. package/packages/core/src/store/remote/released-clients.json +48 -0
  116. package/packages/core/src/store/remote/released-clients.ts +88 -0
  117. package/packages/core/src/store/remote/released-reducer-values/1.3.0.json +25093 -0
  118. package/packages/core/src/store/remote/released-reducer-values/1.4.0.json +26128 -0
  119. package/packages/core/src/store/remote/released-reducer-values/index.ts +13 -0
  120. package/packages/core/src/store/remote/version.ts +5 -2
  121. package/packages/core/src/store/repo-state-events.ts +4 -3
  122. package/packages/core/src/store/scan-cadence.ts +15 -0
  123. package/packages/core/src/store/session-handle.ts +18 -0
  124. package/packages/core/src/store/types.ts +27 -6
  125. package/packages/core/src/testing/dispatch-read-budget.ts +313 -2
  126. package/packages/core/src/testing/index.ts +5 -0
  127. package/packages/core/src/testing/reduced-read-budget.ts +728 -5
  128. package/skills/guide/SKILL.md +201 -18
  129. package/skills/guide/references/accounts.md +38 -0
  130. package/skills/guide/references/integration-tree.md +8 -0
  131. package/skills/guide/references/operator-api.md +37 -4
  132. package/skills/guide/references/plugin-authoring.md +45 -1
  133. package/skills/guide/references/remote-store-protocol.md +262 -42
  134. package/skills/guide/references/remote-ticket-protocol.md +12 -10
  135. package/skills/guide/references/restacking.md +60 -3
  136. package/skills/guide/references/setup.md +37 -8
  137. package/skills/guide/references/spec-standard.md +37 -3
  138. package/skills/implement/SKILL.md +12 -3
  139. package/skills/operate/SKILL.md +87 -15
  140. package/skills/plan/SKILL.md +27 -4
  141. package/skills/plan-review/SKILL.md +22 -2
  142. package/skills/reconcile/SKILL.md +10 -1
  143. package/skills/spec/SKILL.md +7 -4
  144. package/templates/hosted-service/package.json +2 -2
@@ -9,6 +9,15 @@ build or phase. Work directly in the repository and involve the maintainer in
9
9
  choices that cannot be derived from source. Secrets belong in the environment
10
10
  or an ignored `.env`, never in `autobuild.toml`, commits, or validation reports.
11
11
 
12
+ Local dispatch checks selected primary and alternate account credentials before
13
+ taking the repository lease. Supply the configured environment slot or a local
14
+ ChatGPT login (`bun ab accounts login NAME --local`). Hosted account absence
15
+ appears once in repository attention: set `bun ab secrets set VARIABLE`, or
16
+ renew with `bun ab accounts login NAME --project`. The next tick resumes without
17
+ per-build retries or infrastructure-attempt consumption. Unused accounts do not
18
+ block startup; present rejected credentials keep their rejection attention.
19
+ See [account admission and remedies](accounts.md#dispatcher-admission).
20
+
12
21
  ## Choose the execution environment
13
22
 
14
23
  Keep the default `git-worktree` provider unless the maintainer explicitly opts
@@ -250,12 +259,13 @@ sources agree with the running system by construction:
250
259
  **running dispatcher's version** (read from the installed distribution's
251
260
  `package.json`), so the guest runs the dispatcher's own release.
252
261
 
253
- A service accepts stable and prerelease clients from its own `major.minor`
254
- release line and the two preceding minor lines in the same major. A major starts a new family:
255
- X.0 accepts only X.0, X.1 accepts X.0/X.1, and X.2 onward accepts three lines.
256
- Patch versions are interchangeable in both directions and must never change
257
- the protocol. Keep project clients within the instance’s published window. Supported release lines retain their wire handlers and known
258
- protocol identities; an unknown protocol is refused independently of version.
262
+ A published release line stays supported by a service until both at least two newer minor lines have been published and 90 days have passed since the first release of the line that superseded it. The rule spans majors: a new major keeps supporting earlier lines on the same terms. The policy floor is 1.2: lines before 1.2 are refused regardless of publication dates because their clients rebuild server state from the journal. Lines newer than the service stay unsupported (service first). Supported means the published clients of that line can use the service’s retained protocol handlers and read its reduced answers in the shapes their released clients accept.
263
+
264
+ Stable patches never reset a line’s first-publication date. Only actually published
265
+ lines at or below the service line count; prereleases do not start retirement clocks.
266
+ Publication facts survive removal of retired identities, contracts, and handlers.
267
+ Patch releases must retain their line’s protocol identity. Unknown historical
268
+ protocol identities are refused independently of the numeric window.
259
269
  Stable and prerelease service and client identities share their numeric major/minor
260
270
  line. Malformed or missing identities, build metadata (`+…`), prefixes and
261
271
  whitespace are refused with HTTP 409.
@@ -266,8 +276,9 @@ and supported range.
266
276
  Unauthenticated `GET /health` publishes `ok`, `autobuildVersion`,
267
277
  `protocolVersion`, and `supportedClientRange: { minVersion, maxVersionExclusive }`.
268
278
  Range endpoints remain stable versions. The range is inclusive at the minimum
269
- and exclusive at the maximum; a 0.11.x
270
- service publishes `>=0.9.0 <0.12.0`. Health needs no credentials, version
279
+ and exclusive at the maximum; a 1.3.x
280
+ service publishes `>=1.2.0 <1.4.0` until later publication facts permit retirement.
281
+ The service reads the clock for each decision, so retirement needs no redeploy. Health needs no credentials, version
271
282
  headers, or available backend.
272
283
 
273
284
  `ab upgrade` probes this public range before installation or project changes.
@@ -507,3 +518,21 @@ change local files or configuration. Failed cleanup is retryable with access
507
518
  already refused. Reconnecting requires fresh browser approval and starts empty,
508
519
  with hosted ticket numbering reset to 1. See
509
520
  [permanent project deletion](operator-api.md#permanent-project-deletion).
521
+
522
+ ## Hosted dispatch and local viewing
523
+
524
+ A plain `ab dispatch` reads dispatch placement once before starting local execution.
525
+ For a hosted project it opens the Store-only viewer automatically, displaying
526
+ `viewer · dispatched by <host>` from the placement origin (including a nondefault
527
+ port). `--once`, `--plain`, and `--interval` retain their viewer meanings.
528
+ `--takeover` explicitly dispatches locally, with a warning that it can displace
529
+ the hosted dispatcher; it cannot be combined with `--viewer`. Startup intake
530
+ flags require `--takeover` when placement selects viewer.
531
+
532
+ An unreadable placement fails closed with a typed error naming the cause:
533
+ use `--viewer` to watch or `--takeover` to dispatch locally. Both explicit modes
534
+ skip placement discovery. Older services without the capability and projects
535
+ with unknown or nonhosted placement retain local dispatch behavior. Local stores
536
+ need no placement request. Origin mode (`--repository` or `AB_REPOSITORY`) and
537
+ hosted cron dispatch bypass this check. Placement is a startup snapshot, not a
538
+ liveness probe or a polling input.
@@ -61,15 +61,16 @@ plan review, code review, the repository's full verify suite, finalize,
61
61
  merge, and a restack for everything queued behind it. Ten small tickets pay
62
62
  that cost ten times, and a blocker chain pays it in series. Prefer fewer,
63
63
  larger tickets: one ticket per coherent change, as large as one plan and one
64
- review pass can hold without the quality bar slipping.
64
+ review pass can hold without the quality bar slipping, and no larger than one
65
+ implement session can finish.
65
66
 
66
67
  A ticket is the right size when its acceptance criteria describe one feature
67
68
  or fix a reviewer can judge in a single pass, one plan can cover it without
68
69
  deferring a design decision to a later build, and its out-of-scope list is
69
70
  short and obvious. It is too big when its criteria fall into groups that share
70
- no behavior, when part of it waits on a decision nobody has made, or when its
71
+ no behavior, when part of it waits on a decision nobody has made, when its
71
72
  parts need different merge — one can ship now while another needs consent
72
- or must wait.
73
+ or must wait — or when implementing it would outgrow one session.
73
74
 
74
75
  Do not split:
75
76
 
@@ -80,6 +81,39 @@ Do not split:
80
81
  - to make progress visible, or because the spec got long. A long spec with
81
82
  clear criteria is fine.
82
83
 
84
+ ### Fit one implement session
85
+
86
+ Larger stops paying off where the work outgrows one agent session. The first
87
+ implement round is a single session, and everything it does stays in that
88
+ session's context: the spec and plan, every file it reads, every edit, every
89
+ test and check run and its output, and every debugging detour. A ticket that
90
+ fills the implementer's context window — commonly a million tokens or less —
91
+ degrades mid-build: the harness compacts away the reasoning that held the
92
+ change together, or an operator has to clear context and restart by hand.
93
+ Size each ticket to finish well inside one window, with headroom for
94
+ debugging.
95
+
96
+ Nothing measures this at grooming time, so estimate from what the
97
+ implementer must do, not from how long the spec is:
98
+
99
+ - **Reading.** Count the code it must understand before it can edit safely.
100
+ Several unfamiliar subsystems, each read end to end, cost more than the
101
+ diff itself.
102
+ - **Edit sites.** Count files touched, not lines changed. A rename or
103
+ signature change threaded through dozens of callers spends context on
104
+ every one, however mechanical.
105
+ - **Iteration.** Count the separate behaviors that each need their own
106
+ tests, failures, and fixes, and the slow or verbose loops — full suites,
107
+ UI captures, migrations — the session will repeat.
108
+ - **Your own reading.** If writing the spec meant reading most of several
109
+ subsystems, the implementer reads them again, then writes the code and
110
+ tests on top.
111
+
112
+ Most tickets sit far below this ceiling; it is a limit, not a target. A
113
+ ticket that touches one subsystem and a handful of files needs no estimate.
114
+ When the signals put a ticket near the ceiling, split it at a seam (below)
115
+ rather than gamble on the build fitting.
116
+
83
117
  ### Cut along seams
84
118
 
85
119
  A seam decides where to cut once a split is justified; it is not a reason to
@@ -43,11 +43,20 @@ manifest-directed artifact paths remain authoritative. Never commit scratch.
43
43
  When the manifest lists `assets`, they are the build's pinned ticket assets
44
44
  under `$AB_CONTEXT_DIR/assets/<kind>/<name>/`; read them with the spec. A `design` asset
45
45
  is a contract on observable visual and reference outcomes, not on implementation — what you build must satisfy it, while how stays yours.
46
+ If the manifest includes `workspaceRecovery`, read that materialized note.
47
+ It distinguishes exact preserved commits restored before the session from
48
+ known lost candidates and unobservable additional work. A retired reconcile
49
+ result is reconstructed on the prepared replay under its retained frozen
50
+ target; do not search for the known nonexistent candidate. Preserved work
51
+ remains the starting point for continuation.
46
52
  2. Execute the plan. Commit in coherent increments with real messages —
47
53
  the commit history is part of the paper trail.
48
- 3. Run the repo's checks yourself before finishing (the config's typecheck /
49
- lint / test commands). A verify failure that a local run would have caught
50
- is a wasted round trip.
54
+ 3. Run fast checks while you work when they help you — typecheck, lint, unit
55
+ or focused tests. Do not run slow suites (integration, end-to-end, browser)
56
+ that the configured verify steps will run anyway: verify runs them after
57
+ code review and hands any failure back to you, so running them here only
58
+ doubles their cost on every build. To confirm a fix for a failure a verify
59
+ report names, rerun just the failing tests.
51
60
  4. Write the manifest's `notesPath` (normally `$AB_CONTEXT_DIR/implement-notes.md`) — what
52
61
  you did, where you deviated from the plan and why, what the reviewer should
53
62
  look at hardest — then run `ab done --notes <notesPath>`. The notes bytes
@@ -86,6 +86,29 @@ live operator is present, tell the human and do not become a second operator
86
86
  unless directed. Otherwise arm a repository-wide `ab watch --operator --json`.
87
87
  A flagged watch writes only mutable liveness, never events or a lease.
88
88
 
89
+ ### Diagnose missing account credentials
90
+
91
+ Local startup refuses missing selected primary/alternate account sources before
92
+ taking the repository lease. Unused declared accounts do not block startup.
93
+ Read the aggregate error: supply the named environment slot, renew Claude with
94
+ `claude setup-token`, replace a Kimi membership key, or sign in ChatGPT with
95
+ `ab accounts login NAME --local`. A safely owned local refreshing login counts;
96
+ a failed, mismatched or unsafe record fails closed. Startup inspects live peer-owned
97
+ logins without claiming them, allowing the losing dispatcher to yield; execution
98
+ claims only after the repository lease is held.
99
+ Successor preflight refusal keeps the predecessor active and reports upgrade
100
+ attention; it never claims or rotates the predecessor's credentials.
101
+
102
+ Hosted absence appears as one durable repository condition per account, in
103
+ repository status, watch and dashboard warnings. Set `ab secrets set VARIABLE`,
104
+ or renew ChatGPT with `ab accounts login NAME --project`. The next tick resumes
105
+ automatically; do not retry builds or reset infrastructure attempts. Hosted
106
+ account slots never use service environment fallback. Config changes may also
107
+ hold account-dependent launches. Observation, controls and cleanup continue.
108
+ Presence is checked without inference; present rejected credentials retain their
109
+ account-specific rejection attention. See [accounts](../ab-guide/references/accounts.md#dispatcher-admission).
110
+ Credential/process changes remain subject to the Boundaries below.
111
+
89
112
  ### Watch for attention events
90
113
 
91
114
  `ab watch --operator --json` is the standing monitor. Keep its default filter: every
@@ -102,8 +125,15 @@ local warnings do not start durable attention retroactively. Explicit shutdown
102
125
  still stops dispatch without waiting for reporting recovery. Routine outcomes and self-healing failures stay silent.
103
126
 
104
127
  Every record carries a cursor; bounded watches end with a bare `{"cursor": …}`
105
- line. Re-arm only with `ab watch --operator --json --since <watch-cursor>`,
106
- using this standing watch's own cursor. Presence survives a re-arm gap of up to
128
+ line. Normally re-arm with `ab watch --operator --json --since <watch-cursor>`,
129
+ using this standing watch's own cursor. Hosted resume covers the most recent
130
+ 1,000 sequence positions (inclusive at head minus 1,000). On typed
131
+ `cursor-too-old`, re-arm without `--since` and reconcile repository/build status;
132
+ acknowledge that the expired historical gap cannot be recovered. Never retry
133
+ from cursor zero. Normal re-arms retain their cursor, including after ordinary
134
+ reducer upgrades. `checkpoint-integrity` is a terminal storage error;
135
+ `retired-seed-generation` requires upgrade/restart before fresh attachment.
136
+ Presence survives a re-arm gap of up to
107
137
  five minutes after its last heartbeat on routine timeout/count completion.
108
138
  Termination (SIGINT, SIGTERM, SIGHUP or stdout EPIPE) attempts withdrawal within
109
139
  about two seconds; re-arming with the cursor re-registers the same ID/start.
@@ -123,7 +153,7 @@ Scope it to named slugs and explicit `--event` globs (for example,
123
153
  An extra monitor supplements the default standing watch.
124
154
 
125
155
  `ab wait [<slug>...] (--for <condition> | --event <glob>) [--since <cursor>] [--json]`
126
- blocks until a condition holds and prints one record. `--for` state conditions
156
+ uses the same hosted resume window and expiry recovery as watch, and blocks until a condition holds and prints one record. `--for` state conditions
127
157
  are also satisfied immediately by a build already in that state; `--event` is
128
158
  satisfied only by new events. Conditions include `attention`,
129
159
  `blocked`, `paused`, `running`, `done`, `aborted`, `terminal`, `pr=merged`,
@@ -132,12 +162,26 @@ satisfied only by new events. Conditions include `attention`,
132
162
  condition, 3 timeout, 4 interrupted. On 3 and 4 with `--json`, the output is a
133
163
  bare `{"cursor": …}` to resume from.
134
164
 
135
- Run long watches and waits in whatever background or monitor facility your
136
- harness provides, so the session stays responsive and you are woken when they
137
- emit. Use precisely the same resolved invocation and working directory as
138
- foreground commands, including inside background shells and harness monitors.
139
- Do not rely on a shell alias or function that those facilities may lose.
140
- Never block a foreground command for their whole duration.
165
+ An unbounded watch streams: it prints each record and keeps running, so it
166
+ does not exit when a build blocks. Match how you run it to how your harness
167
+ wakes you:
168
+
169
+ - **Woken on each new output line** (a monitor that streams stdout, such as
170
+ Claude Code's Monitor tool): run the standing watch unbounded there and act
171
+ on every line as it arrives.
172
+ - **Woken only when a command exits** (a background shell such as Claude
173
+ Code's background Bash, or a plain blocking call): never run an unbounded
174
+ watch this way, because its records sit unread until it exits. Add
175
+ `--count 1` so the watch exits on its first record:
176
+ `ab watch --operator --json --count 1 [--since <watch-cursor>]`. Act on the
177
+ record, then re-arm at once from the trailing cursor line. Presence survives
178
+ the re-arm gap.
179
+
180
+ `ab wait` exits on its first match, so it suits either kind. Use precisely the
181
+ same resolved invocation and working directory as foreground commands,
182
+ including inside background shells and harness monitors. Do not rely on a
183
+ shell alias or function that those facilities may lose. Never block a
184
+ foreground command for their whole duration.
141
185
 
142
186
  Ticket-source degradation records mean dispatch intake cannot evaluate the source;
143
187
  existing builds may still advance. Inspect `ab repository status --json` for the
@@ -185,9 +229,12 @@ Neither a loss observation nor a later retry authorizes dispatcher intervention.
185
229
  Operate the builds the repository's dispatcher dispatches, including new builds
186
230
  that appear after you arm. Finishing the initially queued set is no reason to stop.
187
231
 
188
- 1. Check presence as above, then arm `ab watch --operator --json` with no slugs.
189
- Retain its own cursor and re-arm with
190
- `ab watch --operator --json --since <watch-cursor>`.
232
+ 1. Check presence as above, then arm `ab watch --operator --json` with no slugs,
233
+ adding `--count 1` if your harness wakes you only on exit. Retain its own
234
+ cursor and re-arm with
235
+ `ab watch --operator --json --since <watch-cursor>`. If it reports
236
+ `cursor-too-old`, re-arm without `--since`, reconcile status and acknowledge
237
+ the unavailable historical gap.
191
238
  2. Right after arming and after each timeout, run `ab builds --all --json`, adopt
192
239
  newly dispatched builds, inspect active builds with `ab build status <slug> --json`,
193
240
  and reconcile `ab repository status --json`. Historical attention is baselined
@@ -427,7 +474,11 @@ for the exceptions above.
427
474
  logical credentials, or records a reasoned `harvest.session.resume-fallback`
428
475
  and starts fresh. Orderly suspension spends no recovery attempt; real
429
476
  crashes retain recovery accounting.
430
- - Never start, restart, or stop a dispatcher: no `ab dispatch` in any mode,
477
+ - Human checkout dispatch defaults to viewer for hosted placement. Humans can use
478
+ `--takeover` to dispatch locally with a displacement warning; unreadable placement
479
+ fails closed and names `--viewer` and `--takeover` as explicit recovery choices.
480
+ These human defaults and overrides do not authorize operator-agent dispatch.
481
+ - Never start, restart, or stop a dispatcher: no `ab dispatch` in any mode (including `--viewer` and `--takeover`),
431
482
  and no dispatcher process-management commands. This applies when the
432
483
  dispatcher is lost, stopped, absent, or failing repeatedly. Its lease,
433
484
  process, and configuration management belong to the maintainer. Diagnose
@@ -468,7 +519,9 @@ verification fails, file a repair child targeting that node and let it merge
468
519
  before retrying the node cycle.
469
520
 
470
521
  Watch for decisions and conflicts with `ab watch --operator --json`; save its opaque cursor
471
- and resume with `ab watch --operator --since <watch-cursor> --json`. Default attention includes
522
+ and resume with `ab watch --operator --since <watch-cursor> --json`. On
523
+ `cursor-too-old`, re-arm without `--since`, reconcile status and acknowledge the
524
+ unavailable historical gap. Default attention includes
472
525
  failed node verification (`integration.verification-failed`), node merges, node item conflicts, conflicted leaf replays and derived
473
526
  `build.consent-ready` observations, including already-ready merges on first
474
527
  repository-wide discovery. Readiness is identified by its durable
@@ -491,11 +544,24 @@ raise with its own event type.
491
544
 
492
545
  ## Forge failure recovery
493
546
 
547
+ A historical `publication.lost` does not prove that every copy of its candidate
548
+ is gone. Recovery checks the exact branch and private archive refs and retained
549
+ replay objects first. An available candidate continues guarded publication.
550
+ A genuinely missing reconcile or automatic restack candidate records
551
+ `publication.candidate-retired`, abandons its obsolete request, and replays the
552
+ producing operation with a fresh transaction identity. Its frozen target,
553
+ reconcile occurrence or automatic trigger, cycle, and message survive. The
554
+ retired candidate is excluded from archive requirements unless independently
555
+ required by proven history. This reconstruction consumes no infrastructure
556
+ attempt and no additional conflict occurrence; it needs no operator guidance.
557
+ A bare retry also clears an existing infrastructure-limit escalation through
558
+ ordinary retry semantics. Unavailable inspection defers rather than proving loss.
559
+
494
560
  Leaf restack and reconcile publication retry classified transient forge or transport
495
561
  failures six times after the initial attempt, waiting 30, 60, 120, 240, 300 and
496
562
  300 seconds. `publication.retry-scheduled` records the operation, frozen rewrite
497
563
  identity, episode anchor, failure ordinal, last error and absolute retry time;
498
- restart resumes that schedule without rerunning the resolver. These retries do
564
+ restart resumes that schedule without rerunning a resolver whose candidate remains available. These retries do
499
565
  not consume `maxPhaseAttempts`. A seventh transient failure records
500
566
  `publication.retry-exhausted` and raises `publication-retry-limit`, naming the last
501
567
  error and six retries. Answering that escalation opens a fresh publication episode
@@ -568,3 +634,9 @@ queued dependency presence and accepted re-parenting supply automatic demand.
568
634
  Nested nodes need independent demand. Inspect the shared parent commit distance
569
635
  readout; unknown is unavailable evidence, not zero. Existing transactions finish
570
636
  before fresh demand is evaluated. Leaves keep their usual restack points.
637
+
638
+
639
+ For explicit MCP build history, `builds.events` returns at most 256 events with
640
+ `cursor` and `hasMore`. Follow the cursor while `hasMore` is true; a single
641
+ page is never evidence that a later terminal event is absent. Hosted repository
642
+ event reads have a fixed 1,000-position tail window; do not replay from zero.
@@ -47,17 +47,40 @@ manifest-directed artifact paths remain authoritative. Never commit scratch.
47
47
  identifier constraints; memory, nearby adapter code, and passing tests over
48
48
  a fake or mock are not evidence of the real contract because they can
49
49
  repeat the author's assumption.
50
- 3. Write the plan to `$AB_CONTEXT_DIR/plan.md`, deposit it, and finish:
50
+ 3. Check the concrete plan against [Fit one implement session](../ab-guide/references/spec-standard.md#fit-one-implement-session),
51
+ as described below. If it clearly will not fit, escalate instead of
52
+ depositing the plan or running `ab done`.
53
+ 4. When the plan fits, write it to `$AB_CONTEXT_DIR/plan.md`, deposit it, and finish:
51
54
 
52
55
  ```
53
56
  ab artifact put plan "$AB_CONTEXT_DIR/plan.md"
54
57
  ab done
55
58
  ```
56
59
 
57
- `ab done` is your one terminal command — the phase is not complete until
60
+ `ab done` is the terminal command for this path — the phase is not complete until
58
61
  it succeeds, and nothing you print matters to the pipeline. If it reports
59
62
  a validation error, fix what it names and run it again.
60
63
 
64
+ ## Implement-session fit
65
+
66
+ After exploring the code, apply the standard's reading, edit-site, and iteration
67
+ signals to the concrete work the implementer must finish, with debugging
68
+ headroom. Most plans need no estimate. The ceiling is a limit, not a target:
69
+ ordinary large plans and plans near but comfortably under it proceed.
70
+
71
+ When the required work clearly will not fit one implement session, stop:
72
+
73
+ ```
74
+ ab escalate "…evidence that the plan will not fit; proposed seams, each resulting ticket's ownership, and the blocker graph…" --refs "$AB_CONTEXT_DIR/spec.md"
75
+ ```
76
+
77
+ Propose the split using [Cut along seams](../ab-guide/references/spec-standard.md#cut-along-seams)
78
+ and [Keep the blocker graph wide](../ab-guide/references/spec-standard.md#keep-the-blocker-graph-wide):
79
+ favor independent work, blockers only for prerequisites, and a minimal
80
+ contract-establishing prerequisite where needed. Put the evidence and concrete
81
+ proposal in the escalation reason. The operator decides and files the split;
82
+ do not deposit a plan or run `ab done` on this path.
83
+
61
84
  ## Verification selection
62
85
 
63
86
  The plan may select which configured optional verify steps this build warrants.
@@ -140,8 +163,8 @@ Some rounds carry no feedback at all — the loop's first round, and the first
140
163
  round after the spec is revised. Then neither file is there and the manifest
141
164
  has no `feedback` field; plan from the spec.
142
165
 
143
- Deposit a fresh `ab artifact put plan` on any round — revisions accumulate;
144
- never edit history.
166
+ On any round that proceeds rather than escalates, deposit a fresh
167
+ `ab artifact put plan` — revisions accumulate; never edit history.
145
168
 
146
169
  ## If the spec is the problem
147
170
 
@@ -34,6 +34,12 @@ verdict travels the typed channel; nothing you print matters to the pipeline.
34
34
  - **Executability** — could a competent implementer follow the steps
35
35
  without re-planning? Are the steps ordered so the build is never broken
36
36
  mid-sequence?
37
+ - **Implement-session fit** — apply [Fit one implement session](../ab-guide/references/spec-standard.md#fit-one-implement-session)
38
+ to the whole required plan, grounded in real code and its reading,
39
+ edit-site, and iteration burden, with debugging headroom. Most plans need
40
+ no estimate. The ceiling is a limit, not a target; ordinary large plans
41
+ and plans near but comfortably under it proceed. When fulfilling the
42
+ spec clearly will not fit, escalate with a proposed split as below.
37
43
  - **Testing** — does the testing section cover the seams the change
38
44
  touches?
39
45
  - **Verification selection** — if the plan has opening `verifySteps` TOML
@@ -51,6 +57,19 @@ verdict travels the typed channel; nothing you print matters to the pipeline.
51
57
  ab verdict escalate --reason "…" --notes "$AB_CONTEXT_DIR/plan-review.md"
52
58
  ```
53
59
 
60
+ ## Escalating an oversized plan
61
+
62
+ When fulfilling the spec clearly exceeds one implement session, write review
63
+ notes and use `ab verdict escalate --reason "…" --notes "$AB_CONTEXT_DIR/plan-review.md"`.
64
+ The reason must explain the concrete evidence and propose seams, what each
65
+ resulting ticket owns, and the blocker graph. Follow [Cut along seams](../ab-guide/references/spec-standard.md#cut-along-seams)
66
+ and [Keep the blocker graph wide](../ab-guide/references/spec-standard.md#keep-the-blocker-graph-wide):
67
+ favor independent work, blockers only for prerequisites, and a minimal
68
+ contract-establishing prerequisite where needed. The operator decides and
69
+ files the split. Do not issue a revise finding asking the planner to omit
70
+ scope the spec requires. Unnecessary scope expansion and ordinary plan defects
71
+ still belong in findings.
72
+
54
73
  ## Writing findings
55
74
 
56
75
  Findings are structured JSON (the CLI validates and stamps ids):
@@ -121,8 +140,9 @@ invariant makes it material.
121
140
  Approve when the plan would satisfy the spec — not when it matches how you
122
141
  would have written it. Known immaterial defects are not a reason to withhold
123
142
  approval — record them with `ab observe` and approve. Escalate when the
124
- *spec* is the problem (contradictory or unbuildable); revise when the plan
125
- is.
143
+ *spec* is the problem (contradictory or unbuildable), or when its required
144
+ plan clearly exceeds one implement session, carrying the proposed split above.
145
+ Revise when the plan has an ordinary defect it can fix within the spec.
126
146
 
127
147
  Read the manifest path printed by `ab context`. Its `materialized` keys are
128
148
  relative to `contextDir`: join them to locate collision-adjusted inputs.
@@ -43,6 +43,12 @@ manifest-directed artifact paths remain authoritative. Never commit scratch.
43
43
  whether replay conflicted. A replay may originate at verify entry before any
44
44
  PR exists; `restackId` identifies an adopted automatic transaction. Never fetch, merge, rebase, select another base,
45
45
  or move the named branch yourself. Missing replay inputs require escalation, except a node item uses `nodeChange` and `conflict.baseSha` instead of `replay`.
46
+ If the manifest includes `workspaceRecovery`, read that materialized note.
47
+ It distinguishes exact preserved commits restored before the session from
48
+ known lost candidates and unobservable additional work. A retired reconcile
49
+ result is reconstructed on the prepared replay under its retained frozen
50
+ target; do not search for the known nonexistent candidate. Preserved work
51
+ remains the starting point for continuation.
46
52
  2. Inspect `git status` and the prepared replay. If conflicts remain, resolve
47
53
  them with the explicit charge to regress against neither side:
48
54
  - Preserve the behavior the spec and approved plan require.
@@ -51,7 +57,10 @@ manifest-directed artifact paths remain authoritative. Never commit scratch.
51
57
  change is now redundant, preserve an empty commit with `git commit
52
58
  --allow-empty --no-edit`; never skip away the build's identity. A clean
53
59
  replay already has its commit and still needs inspection and checks.
54
- 3. Run the repository's required checks. The result must be exactly one commit
60
+ 3. Run fast checks that cover the resolution — typecheck, lint, unit or focused
61
+ tests. Skip slow suites (integration, end-to-end, browser): post-reconcile
62
+ verification reruns the configured steps, and a step the repository's
63
+ post-reconcile policy skips is a risk it chose. The result must be exactly one commit
55
64
  with exactly one parent equal to `replay.targetBase` (or `conflict.baseSha` for a
56
65
  node item) and exactly one terminal
57
66
  `Autobuild-Build: <build>` trailer. For node items use the source identity in
@@ -87,7 +87,10 @@ in order, but as a conversation, not a form:
87
87
  [sizing and splitting](../ab-guide/references/spec-standard.md#sizing-and-splitting)
88
88
  before treating the work as several tickets: default to one larger ticket,
89
89
  and when a split is warranted, propose the seams and the blocker graph to
90
- the user with the reason for each cut.
90
+ the user with the reason for each cut. Check a large ticket against the
91
+ standard's implement-session ceiling even when its criteria hang together:
92
+ estimate the reading, edit sites, and iteration the implementer faces, and
93
+ tell the user when it looks too big for one session.
91
94
  3. **Out of scope.** Ask what adjacent work is explicitly excluded. Propose
92
95
  candidates — the tempting expansions you noticed while reading the code.
93
96
  4. **Evidence.** Link what exists: the error rates, the user reports, the
@@ -258,9 +261,9 @@ repository, report that rather than waiting on builds that cannot start.
258
261
 
259
262
  ## Rules
260
263
 
261
- - **Fewer, larger tickets.** Split only when sizing calls for it, cut at
262
- seams, and keep the blocker graph wide so independent tickets build
263
- together.
264
+ - **Fewer, larger tickets.** Split only when sizing calls for it — including
265
+ when a ticket would outgrow one implement session — cut at seams, and keep
266
+ the blocker graph wide so independent tickets build together.
264
267
  - The spec says **what and why, never how.** An exported, attached `design`
265
268
  asset is a contract on observable visual and reference outcomes — layout,
266
269
  content, states, copy, look — that plan, review, and verify judge against;
@@ -4,8 +4,8 @@
4
4
  "build": "ab-hosted-service-build"
5
5
  },
6
6
  "dependencies": {
7
- "@defrex/autobuild-hosted-store-service": "1.3.0",
8
- "@defrex/autobuild": "1.3.0",
7
+ "@defrex/autobuild-hosted-store-service": "1.4.1",
8
+ "@defrex/autobuild": "1.4.1",
9
9
  "next": "16.1.6",
10
10
  "react": "19.2.4",
11
11
  "react-dom": "19.2.4"