@defrex/autobuild 1.0.0-beta.3 → 1.0.0

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 (168) hide show
  1. package/README.md +1 -1
  2. package/SPEC.md +362 -56
  3. package/bin/ab-dispatch-generation.ts +93 -0
  4. package/docs/agent-runtimes.md +157 -0
  5. package/docs/answering-blocked-builds.md +21 -3
  6. package/docs/architecture.md +166 -7
  7. package/docs/build-store.md +123 -0
  8. package/docs/builds.md +82 -0
  9. package/docs/cli.md +48 -0
  10. package/docs/configuration-overview.md +93 -0
  11. package/docs/configuration.md +1778 -188
  12. package/docs/dispatcher-hosting.md +115 -0
  13. package/docs/dispatcher.md +59 -0
  14. package/docs/forges.md +121 -0
  15. package/docs/getting-started.md +60 -0
  16. package/docs/glossary.md +60 -0
  17. package/docs/hosted-service.md +2 -2
  18. package/docs/intake.md +48 -0
  19. package/docs/integration-overview.md +81 -0
  20. package/docs/integration-tree.md +87 -2
  21. package/docs/integration.md +54 -0
  22. package/docs/operating.md +114 -0
  23. package/docs/operator-api.md +64 -11
  24. package/docs/operator-surfaces.md +90 -0
  25. package/docs/overview.md +49 -0
  26. package/docs/plugin-authoring.md +426 -0
  27. package/docs/remote-store-protocol.md +12 -9
  28. package/docs/restacking.md +4 -1
  29. package/docs/seams.md +66 -0
  30. package/docs/setup.md +28 -6
  31. package/docs/skills.md +119 -0
  32. package/docs/spec-standard.md +23 -5
  33. package/docs/ticket-sources.md +132 -0
  34. package/docs/tickets.md +69 -0
  35. package/docs/troubleshooting.md +111 -0
  36. package/docs/upgrading.md +50 -0
  37. package/docs/verification.md +146 -0
  38. package/docs/website.md +47 -5
  39. package/docs/workspaces.md +152 -0
  40. package/package.json +5 -4
  41. package/packages/core/src/cli/artifact.ts +5 -4
  42. package/packages/core/src/cli/attention.ts +2 -0
  43. package/packages/core/src/cli/binary-direct.ts +190 -0
  44. package/packages/core/src/cli/binary-lifecycle.ts +46 -0
  45. package/packages/core/src/cli/binary.ts +24 -210
  46. package/packages/core/src/cli/build-control.ts +105 -2
  47. package/packages/core/src/cli/context.ts +41 -1
  48. package/packages/core/src/cli/dashboard/hand-pushed.ts +24 -0
  49. package/packages/core/src/cli/dashboard/handoff.ts +64 -0
  50. package/packages/core/src/cli/dashboard/integration-detail.ts +3 -0
  51. package/packages/core/src/cli/dashboard/model.ts +34 -10
  52. package/packages/core/src/cli/dashboard/render.ts +24 -2
  53. package/packages/core/src/cli/dashboard/rollback.ts +30 -0
  54. package/packages/core/src/cli/dispatch-args.ts +53 -0
  55. package/packages/core/src/cli/dispatch-crash-budget.ts +15 -0
  56. package/packages/core/src/cli/dispatch-frontend.ts +52 -5
  57. package/packages/core/src/cli/dispatch-handoff.ts +276 -0
  58. package/packages/core/src/cli/dispatch-launch-contract.ts +170 -0
  59. package/packages/core/src/cli/dispatch-launcher.ts +580 -0
  60. package/packages/core/src/cli/dispatch-parent-watch.ts +44 -0
  61. package/packages/core/src/cli/dispatch-preflight.ts +272 -0
  62. package/packages/core/src/cli/dispatch-presentation-job.ts +46 -0
  63. package/packages/core/src/cli/dispatch-presentation-ownership.ts +9 -0
  64. package/packages/core/src/cli/dispatch-process.ts +22 -90
  65. package/packages/core/src/cli/dispatch-readiness.ts +47 -0
  66. package/packages/core/src/cli/dispatch-repository-feed.ts +5 -1
  67. package/packages/core/src/cli/dispatch-runtime-cache.ts +522 -0
  68. package/packages/core/src/cli/dispatch-runtime-dependencies.ts +291 -0
  69. package/packages/core/src/cli/dispatch-runtime-use.ts +336 -0
  70. package/packages/core/src/cli/dispatch-upgrade-controller.ts +221 -0
  71. package/packages/core/src/cli/dispatch-upgrade-install.ts +258 -0
  72. package/packages/core/src/cli/dispatch-upgrade-source.ts +309 -0
  73. package/packages/core/src/cli/dispatch-upgrade-target.ts +190 -0
  74. package/packages/core/src/cli/dispatch.ts +604 -60
  75. package/packages/core/src/cli/dispatcher-liveness.ts +1 -1
  76. package/packages/core/src/cli/env.ts +1 -1
  77. package/packages/core/src/cli/harvest.ts +28 -11
  78. package/packages/core/src/cli/help.ts +10 -5
  79. package/packages/core/src/cli/installation.ts +5 -3
  80. package/packages/core/src/cli/main-checkout.ts +59 -0
  81. package/packages/core/src/cli/main.ts +15 -45
  82. package/packages/core/src/cli/node-verification-provenance.ts +97 -0
  83. package/packages/core/src/cli/repo-state.ts +3 -58
  84. package/packages/core/src/cli/repository-status.ts +67 -3
  85. package/packages/core/src/cli/runtime-spawn.ts +16 -0
  86. package/packages/core/src/cli/status.ts +57 -3
  87. package/packages/core/src/cli/upgrade-followup.ts +25 -0
  88. package/packages/core/src/cli/wait.ts +3 -0
  89. package/packages/core/src/cli/watch.ts +7 -0
  90. package/packages/core/src/config/landing.ts +8 -0
  91. package/packages/core/src/config/live.ts +1 -0
  92. package/packages/core/src/config/reference-metadata.ts +31 -0
  93. package/packages/core/src/config/reference.ts +342 -0
  94. package/packages/core/src/config/roles.ts +1 -1
  95. package/packages/core/src/config/schema.ts +352 -10
  96. package/packages/core/src/distribution-packaging.ts +116 -0
  97. package/packages/core/src/events/catalog.ts +6 -0
  98. package/packages/core/src/events/payloads.ts +53 -9
  99. package/packages/core/src/events/policy.ts +25 -0
  100. package/packages/core/src/events/repository.ts +184 -4
  101. package/packages/core/src/events/runtime.ts +16 -0
  102. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +2515 -78
  103. package/packages/core/src/kernel/dispatch-drain-recovery.ts +121 -0
  104. package/packages/core/src/kernel/dispatch-status.ts +4 -2
  105. package/packages/core/src/kernel/dispatch-upgrade.ts +171 -0
  106. package/packages/core/src/kernel/dispatcher-liveness.ts +7 -0
  107. package/packages/core/src/kernel/generators/repository-journals.ts +82 -0
  108. package/packages/core/src/kernel/guarded-forge.ts +1 -1
  109. package/packages/core/src/kernel/harvest.ts +98 -4
  110. package/packages/core/src/kernel/integration-attention.ts +20 -0
  111. package/packages/core/src/kernel/integration-state.ts +80 -11
  112. package/packages/core/src/kernel/landing-readiness.ts +6 -1
  113. package/packages/core/src/kernel/mixed-version.ts +34 -0
  114. package/packages/core/src/kernel/node-polling.ts +160 -0
  115. package/packages/core/src/kernel/read-facts.ts +40 -5
  116. package/packages/core/src/kernel/reducer-registry.ts +3 -0
  117. package/packages/core/src/kernel/reducer.ts +75 -14
  118. package/packages/core/src/kernel/service-facts.ts +11 -4
  119. package/packages/core/src/ontology.ts +2 -2
  120. package/packages/core/src/open-map.ts +3 -1
  121. package/packages/core/src/operator/presentation.ts +7 -0
  122. package/packages/core/src/operator/query.ts +6 -2
  123. package/packages/core/src/operator/registry.ts +1 -1
  124. package/packages/core/src/plugins/load.ts +4 -1
  125. package/packages/core/src/plugins/runtime-snapshot.ts +128 -0
  126. package/packages/core/src/ports/forge/contract.ts +29 -0
  127. package/packages/core/src/ports/forge/github.ts +189 -61
  128. package/packages/core/src/ports/forge-failure.ts +1 -0
  129. package/packages/core/src/ports/forge-telemetry.ts +3 -0
  130. package/packages/core/src/ports/runner/session-env.ts +1 -0
  131. package/packages/core/src/ports/types.ts +10 -0
  132. package/packages/core/src/ports/workspace/distribution-archive.ts +22 -149
  133. package/packages/core/src/ports/workspace/distribution-release.ts +56 -0
  134. package/packages/core/src/ports/workspace/git-worktree.ts +2 -1
  135. package/packages/core/src/ports/workspace/local-build-execution.ts +37 -17
  136. package/packages/core/src/processes/build-child-exit.ts +5 -26
  137. package/packages/core/src/processes/build-runner.ts +81 -11
  138. package/packages/core/src/processes/dispatcher.ts +254 -23
  139. package/packages/core/src/processes/execution-no-progress.ts +6 -0
  140. package/packages/core/src/processes/execution-relaunch.ts +30 -0
  141. package/packages/core/src/processes/execution-settlement.ts +16 -7
  142. package/packages/core/src/processes/harvest-runner.ts +328 -292
  143. package/packages/core/src/processes/process-group-reaper.ts +17 -10
  144. package/packages/core/src/runtime-identity.ts +22 -3
  145. package/packages/core/src/store/contract.ts +153 -0
  146. package/packages/core/src/store/local/store.ts +197 -72
  147. package/packages/core/src/store/reduced-reads.ts +8 -0
  148. package/packages/core/src/store/reducer-value-shapes.json +5783 -3305
  149. package/packages/core/src/store/remote/client.ts +43 -0
  150. package/packages/core/src/store/repo-state-events.ts +20 -3
  151. package/packages/core/src/store/types.ts +7 -0
  152. package/skills/finalize/SKILL.md +3 -1
  153. package/skills/guide/SKILL.md +273 -48
  154. package/skills/guide/references/integration-tree.md +87 -2
  155. package/skills/guide/references/operator-api.md +71 -14
  156. package/skills/guide/references/plugin-authoring.md +231 -266
  157. package/skills/guide/references/remote-store-protocol.md +12 -9
  158. package/skills/guide/references/restacking.md +4 -1
  159. package/skills/guide/references/setup.md +28 -6
  160. package/skills/guide/references/spec-standard.md +23 -5
  161. package/skills/harvest/SKILL.md +4 -0
  162. package/skills/harvest-review/SKILL.md +4 -0
  163. package/skills/implement/SKILL.md +4 -2
  164. package/skills/operate/SKILL.md +104 -35
  165. package/skills/plan/SKILL.md +12 -4
  166. package/skills/spec/SKILL.md +20 -2
  167. package/skills/tickets/SKILL.md +20 -1
  168. package/templates/hosted-service/package.json +2 -2
package/docs/setup.md CHANGED
@@ -115,17 +115,19 @@ exits nonzero on failure. Then:
115
115
  alternate. The runtime that launched setup and the temporary fresh-skeleton
116
116
  default do not constrain the final arrangement.
117
117
  3. Choose the ticket source and workflow states. Confirm account/team facts and
118
- required environment credentials. Configure end-to-end verification with the
119
- repository's real lifecycle and tools. When judgment is required, author a repository-owned
120
- agent-verify skill and select it from an agent verify step.
118
+ required environment credentials. Author a repository-owned acceptance-check skill and select it from an agent
119
+ verify step in every repository. An **acceptance check** is a repository-owned agent verify step that runs the built software, exercises each acceptance criterion in the spec, attaches evidence, and returns a typed verdict. Every repository must configure one. It is not a test suite and leaves no test files behind.
120
+ Wire an existing maintained end-to-end or browser test suite into an ordinary `check` step. If none exists, do not create one during setup. The acceptance check neither substitutes for nor seeds a suite.
121
121
  4. Preserve an existing `autobuild.toml` and unrelated repository choices on a
122
122
  rerun. Change only choices the maintainer approves.
123
123
  5. Commit the config, setup files, lockfiles, and installed reference changes,
124
124
  then push them to `baseBranch`. A remote sandbox clones the authoritative
125
125
  GitHub revision; it cannot acquire local-only edits.
126
126
  6. Run `ab init --validate`. Fix every named failure, review warnings and unknowns, and rerun
127
- validation. Only then use the installed grooming/ticket skills to create the
128
- first groomed Ready ticket and start `ab dispatch`.
127
+ validation. Setup ends at successful validation. Ask the human to start
128
+ `bun ab dispatch`, then open their coding agent at the repository root with
129
+ `ab-operate` loaded to specify, create, groom, and shepherd the first ticket.
130
+ The setup agent must not start dispatch itself.
129
131
 
130
132
  Validation is explicit and noninteractive. It does not dispatch, claim a
131
133
  ticket, or create build, phase, session, event, transcript, or artifact history.
@@ -222,6 +224,18 @@ requires a published release.
222
224
 
223
225
  ### Guest distribution version selection and delivery
224
226
 
227
+ Cached generations retain explicit archive provenance. A registry generation
228
+ resolves its manifest version’s GitHub release asset on first guest use, validates
229
+ version and digest, and atomically caches it separately from the host archive.
230
+ Local launch requires no GitHub fetch. Isolated and hoisted Bun installations
231
+ retain registry provenance through store-path or lock evidence. Source, Git and local package
232
+ generations deliver their exact packed code. Missing or invalid release assets
233
+ fail guest delivery and remain retryable, without falling back to packing the
234
+ registry installation.
235
+ Remote guests finish their phase before requesting relaunch; re-attachment
236
+ refreshes the archive and marker before the next runner starts. They retain
237
+ independent leases and never hold local retirement open.
238
+
225
239
  The guest's distribution version is selected by the archive source, and both
226
240
  sources agree with the running system by construction:
227
241
 
@@ -400,6 +414,14 @@ Its session instructions must preserve this contract:
400
414
 
401
415
  1. Run `ab context`. The verifier receives `.ab/spec.md`, the configured step,
402
416
  the commit range, and, after escalation is answered, `.ab/guidance.json`.
417
+ Node verify sessions also receive `nodeVerification` in the context manifest:
418
+ contribution specs and a provenance index mapping commits to the builds that
419
+ introduced them. Read those specs through the manifest's allocated paths.
420
+ Also read `handPushedCommits: [{sha, originalSha, message}]` from the manifest
421
+ and index. These hand-pushed node commit messages express maintainer-authorized
422
+ intent; judge quality and consistency, and never fail them solely for lacking
423
+ a covering spec. Other node changes are authorized when the node spec or the introducing
424
+ contribution's spec covers it; use the commit index to find that spec.
403
425
  2. Exercise each applicable acceptance criterion through the repository's real
404
426
  application lifecycle. Prefer the narrowest honest flow that catches a
405
427
  regression.
@@ -534,7 +556,7 @@ without the optional readiness capability report UNKNOWN and need an adapter
534
556
  upgrade; local Git passes these hosted-policy checks trivially.
535
557
 
536
558
  Known hard failures make `ab init --validate` exit unsuccessfully. Warnings and
537
- unknowns preserve the workspace validation result and require operator review.
559
+ unknowns preserve the workspace validation result and require your review.
538
560
  Dispatch reports known hard failures once per invocation as durable
539
561
  `dispatcher.forge-readiness-failed` repository notices without adding an admission
540
562
  gate. External orchestrators follow these through `ab watch` with no slugs or an
package/docs/skills.md ADDED
@@ -0,0 +1,119 @@
1
+ ---
2
+ title: "Skills"
3
+ label: "Skills"
4
+ group: "concepts"
5
+ order: 6
6
+ description: "Understand Autobuild's agent skills, customize their defaults for your repository, and keep your edits through upgrades."
7
+ ---
8
+
9
+ # Skills
10
+
11
+ Skills guide the agents that plan, implement, review and operate Autobuild, one per phase or role. They supply judgment; code owns build state, transitions, gates and publication.
12
+
13
+ ## Strong defaults, yours to edit
14
+
15
+ `ab init` installs the shipped skills as repository files under `.agents/skills/ab-<name>/`: a `SKILL.md` plus optional references or scripts. For example, tell `.agents/skills/ab-implement/SKILL.md` to use the shared database adapter, follow the existing error vocabulary and run the project's integration checks.
16
+
17
+ - Change how agents work, not the lifecycle's gates. Keep each skill's typed CLI contract: context, notes deposit and completion command.
18
+ - Commit edits so every agent shares them.
19
+ - Edit the live tree, never its pristine baseline.
20
+
21
+ ## The shipped skills
22
+
23
+ | Skill | Purpose |
24
+ |---|---|
25
+ | `ab-spec` | Groom intent into a ticket spec with you; not a spec-phase session |
26
+ | `ab-plan` | Plan the implementation from the spec |
27
+ | `ab-plan-review` | Check the plan against the spec independently |
28
+ | `ab-implement` | Execute the approved plan and commit |
29
+ | `ab-code-review` | Review the implementation against the contract independently |
30
+ | `ab-finalize` | Write the pull request description after verification |
31
+ | `ab-reconcile` | Resolve conflicts in a kernel-prepared replay onto a refreshed base |
32
+ | `ab-operate` | External operator agent: file tickets, watch builds, answer escalations, control landing |
33
+ | `ab-tickets` | Read, create, groom and update tickets through the tracker interface |
34
+ | `ab-harvest` | Turn claimed observations into ticket proposals |
35
+ | `ab-harvest-review` | Review those proposals independently |
36
+ | `ab-guide` | Reference for the system, configuration, setup and installed skills |
37
+
38
+ - **Phase skills** (plan through reconcile) are runner-invoked; don't start them manually.
39
+ - **Spec, ticket and operator skills** work outside the pipeline. Observation harvest is a separate repository workflow.
40
+ - **No generic agent verifier ships.** Your repository supplies its own evidence and checks.
41
+
42
+ ## How upgrades preserve customization
43
+
44
+ Init records upstream files under `.agents/skills/.ab-pristine/ab-<name>/`, a tracked baseline rather than an editable copy. `ab upgrade` three-way merges every distributed file, supporting files included:
45
+
46
+ - **Base:** the pristine copy
47
+ - **Local:** your file
48
+ - **Incoming:** the new upstream default
49
+
50
+ Overlapping edits get an agent resolution biased toward your customization, validated to preserve clean regions, add no conflict markers and keep frontmatter identity.
51
+
52
+ On success, pristine advances to the incoming upstream bytes, not the merged result, so your edits stay visible to the next upgrade. New upstream support files are added. Removed upstream files are deleted if unedited; customized copies stay as repository-local files.
53
+
54
+ ### Reading the upgrade report
55
+
56
+ Each skill reports the aggregate of its files; `conflicted` outranks `resolved`, `merged`, `adopted` and `current`.
57
+
58
+ | Outcome | Meaning |
59
+ |---|---|
60
+ | `current` | Upstream unchanged; the local file stands |
61
+ | `adopted` | Incoming bytes adopted, pristine advanced; also restoring a missing live file, adding a support file, or deleting an unedited upstream-removed one |
62
+ | `merged` | Independent changes combined, pristine advanced; also a customized upstream-removed support file, kept and released from pristine |
63
+ | `resolved` | Local-biased agent resolution passed validation; pristine advanced to incoming |
64
+ | `conflicted` | Resolution unavailable, failed, declined as ambiguous, or invalid. Live and pristine untouched while other files advance; no conflict markers in the live skill |
65
+ | `installed` | Missing from both live and pristine trees; installed fresh |
66
+ | `removed` | Eligible retired skill's unchanged tree and owned discovery link removed, or a missing tree's obsolete provenance and dangling owned link cleaned up |
67
+ | `kept` | Retired skill customized, configured or unsafe to remove, or a user-owned Claude discovery entry preserved while the canonical tree went; obsolete pristine ownership cleared |
68
+ | `unknown` | `ab-*` name not in the distribution; left alone. Not license to use the reserved prefix |
69
+
70
+ **No pristine record:**
71
+
72
+ - absent local file: installed
73
+ - local file identical to incoming: becomes the baseline
74
+ - differing local file: `conflicted`, not overwritten; merge by hand against the reported pristine path
75
+
76
+ **Retirement** (`removed`, `kept`) applies only to `ab-setup` and `ab-verify-e2e`, and only with a pristine record proving Autobuild provenance; a same-named repository skill without one is left alone. A retired skill is kept when an agent verify or finalize step uses it or its configuration can't be inspected safely. Obsolete ownership is then cleared, so the skill doesn't return or get reported again.
77
+
78
+ **Exit status.**
79
+
80
+ - **Discovery collisions fail.** A distinct real directory or foreign symlink at `.claude/skills/<name>` is preserved (symlinks keep their exact target text), reported, and exits nonzero, even when a retired canonical tree is removed.
81
+ - **Content conflicts don't.** `conflicted` results alone, including timeouts and cancelled resolution, exit zero. Read the report, not just the exit code.
82
+
83
+ **Commit.** A conflict-free upgrade makes a local commit limited to upgrade-owned changes; `--no-commit` leaves them to you. Conflicts or unsafe Git state suppress the commit with an explanation. See [Upgrading](upgrading.md).
84
+
85
+ ## Add a repository-local skill
86
+
87
+ `ab-` is reserved for shipped skills. Give yours plain names, such as `.agents/skills/verify-acceptance/SKILL.md` with a name, description and instructions. Application-specific evidence requirements belong there.
88
+
89
+ Every repository needs an **acceptance check**: a repository-owned agent verify step that exercises each acceptance criterion against the built software. It isn't a test suite and leaves no test files. Its skill tells the agent to:
90
+
91
+ 1. Run `ab context` and read the materialized inputs.
92
+ 2. Gather the evidence the skill defines as a pass or failure.
93
+ 3. Report `pass`, `fail` or `skip` through `ab verdict`; its prose response isn't the result.
94
+
95
+ Select the skill by exact name (no prefix is inferred), appending `acceptance` to your existing steps:
96
+
97
+ ```toml
98
+ [verify]
99
+ steps = ["acceptance"]
100
+
101
+ [verify.acceptance]
102
+ kind = "agent"
103
+ skill = "verify-acceptance"
104
+ ```
105
+
106
+ [Verification](verification.md#steps-and-outcomes) covers step kinds and outcomes.
107
+
108
+ ## Harness discovery
109
+
110
+ Codex and Pi read `.agents/skills/` directly. Claude Code reads `.claude/skills/`, where init links each shipped skill to its canonical directory, so there's one editable copy. Link a new local skill from the repository root:
111
+
112
+ ```sh
113
+ mkdir -p .claude/skills
114
+ ln -s ../../.agents/skills/verify-acceptance .claude/skills/verify-acceptance
115
+ ```
116
+
117
+ - **Check first.** If `.claude/skills/` and `.agents/skills/` already alias the same directory, skip per-skill links.
118
+ - **Don't overwrite** existing user-owned directories or foreign links; resolve collisions deliberately.
119
+ - **Commit** the skill and its link together.
@@ -127,8 +127,26 @@ order.
127
127
 
128
128
  ## Immutability during a build
129
129
 
130
- The spec is the build's contract artifact (kind `spec`, revision 0). It
131
- cannot change during a build because every downstream reviewer approves
132
- conformance *to it*. A phase that discovers the spec itself is wrong raises
133
- an escalation (`ab escalate`); a human answers, the spec gets revision N+1,
134
- and the build restarts from `plan`.
130
+ The spec is the build's contract artifact (kind `spec`, revision 0).
131
+ Every downstream reviewer approves conformance to its pinned revision.
132
+ For leaves, a phase that discovers the spec itself is wrong raises an
133
+ escalation (`ab escalate`); a human answers, the spec gets revision N+1,
134
+ and the leaf restarts from `plan`.
135
+
136
+ Operators may explicitly revise an opened idle collecting node or a node blocked on failed
137
+ integration verification without an escalation. Use
138
+ `ab answer <node> --revise-spec replacement.md` or, after amending its ticket,
139
+ `ab answer <node> --revise-spec-from-ticket`. Ticket edits alone do not revise
140
+ the build. Both forms enforce the same spec standard as leaf revisions.
141
+ Each kernel `spec.revised` records the exact artifact and operator identity
142
+ (with optional transport provenance); earlier revisions remain readable.
143
+ Ticket-origin revisions re-pin assets; supplied bodies preserve asset pins.
144
+ The node recollects and verifies the new revision, including on the same head
145
+ and parent after a failed cycle. Earlier cycles remain historical evidence
146
+ and cannot block or authorize landing under the replacement. Children keep
147
+ their specs, claims and targets; contributions are not restarted.
148
+ Active verification/reconcile or writer work, restack/reparent work, pause,
149
+ pending controls, landing intent and ended PRs refuse the no-escalation path.
150
+ A concurrent state change refuses publication with a retry explanation;
151
+ uncited artifacts are inert. Leaves still require an open escalation and
152
+ restart from `plan`.
@@ -0,0 +1,132 @@
1
+ ---
2
+ title: "Tickets"
3
+ group: "reference"
4
+ description: "Configure file, Linear, or hosted tickets and implement a ticket-source adapter."
5
+ label: "Ticket sources"
6
+ order: 13
7
+ ---
8
+
9
+ # Tickets
10
+
11
+ ## Responsibility
12
+
13
+ A ticket source owns ticket CRUD, lifecycle transitions, claiming, labels, blockers and creation identity. The build's pinned spec, history, transcripts and artifacts live in the BuildStore; editing a ticket after claim doesn't replace the pinned spec. See [Tickets are the interface](tickets.md) for grooming and the ready gate.
14
+
15
+ ## Shipped adapters
16
+
17
+ Install with `bun add -d --exact @defrex/autobuild`. Examples are complete minimal `autobuild.toml` files. Credentials go in the dispatcher environment or an ignored `.env`, never TOML.
18
+
19
+ | Source | Choose it for | Credential |
20
+ |---|---|---|
21
+ | `file` | tickets you edit as plain files | none |
22
+ | `linear` | a team already grooming in Linear | `LINEAR_API_KEY` |
23
+ | `hosted` | a project tracker shared by agents and clients | saved `ab connect` credential |
24
+
25
+ ### Local files (`file`)
26
+
27
+ Tickets live in a writable directory, `.autobuild/tickets/` by default; the default follows a local Store root and stays local with a remote Store. An explicit `dir` resolves from the repository root and isn't git-ignored automatically.
28
+
29
+ <!-- seam-config:start -->
30
+ ```toml
31
+ [tickets]
32
+ source = "file"
33
+ dir = ".tickets"
34
+ readyState = "ready"
35
+ readyLabels = []
36
+ createState = "triage"
37
+ triageState = "triage"
38
+ proposalState = "triage"
39
+ doneState = "done"
40
+ ```
41
+ <!-- seam-config:end -->
42
+
43
+ - **States are directories** (`.tickets/ready/`, `.tickets/doing/`). Claims move to `doing`; `claimedState` isn't configurable.
44
+ - **Claiming** needs `readyState`, every `readyLabels` entry and resolved blockers; `[]` adds no label gate.
45
+
46
+ Initialize with `bun ab init`; manage with `bun ab ticket states` and the other ticket commands.
47
+
48
+ ### Linear (`linear`)
49
+
50
+ Export a personal API key from [Linear's API setup](https://linear.app/developers/graphql) as `LINEAR_API_KEY` on the dispatcher host. It needs team access and must read issues, teams, workflow states, labels and dependencies, and write issues, comments, labels and blocking relationships.
51
+
52
+ <!-- seam-config:start -->
53
+ ```toml
54
+ [tickets]
55
+ source = "linear"
56
+ teamKey = "ENG"
57
+ readyState = "Todo"
58
+ readyLabels = ["autobuild"]
59
+ claimedState = "In Progress"
60
+ createState = "Backlog"
61
+ triageState = "Backlog"
62
+ proposalState = "Backlog"
63
+ doneState = "Done"
64
+ ```
65
+ <!-- seam-config:end -->
66
+
67
+ Replace `ENG` and the case-sensitive workflow names with your team's.
68
+
69
+ - **Admission.** `teamKey` selects the team; `readyState`, every `readyLabels` entry and optional `readyAssignee` filter it.
70
+ - **Labels.** `readyLabels` defaults to `["autobuild"]`; `[]` removes the gate.
71
+ - **No `project` key.** Scope the queue through team access, states and labels.
72
+ - **Rate limits** are shared with your other API callers.
73
+
74
+ ### Hosted (`hosted`)
75
+
76
+ An independent tracker (not a Linear proxy) that works with local builds too. Connect the project:
77
+
78
+ ```sh
79
+ bun ab connect --tickets https://tickets.example.com
80
+ ```
81
+
82
+ The saved credential authorizes ticket operations and policy publication.
83
+
84
+ <!-- seam-config:start -->
85
+ ```toml
86
+ [tickets]
87
+ source = "hosted"
88
+ teamKey = "ENG"
89
+ url = "https://tickets.example.com"
90
+ readyState = "ready"
91
+ readyLabels = []
92
+ claimedState = "doing"
93
+ createState = "triage"
94
+ triageState = "triage"
95
+ proposalState = "triage"
96
+ doneState = "done"
97
+ ```
98
+ <!-- seam-config:end -->
99
+
100
+ - `teamKey` identifies the registered project's team.
101
+ - **URL.** `tickets.url` defaults to the remote BuildStore service (`AB_STORE` or `[store].url`); it's required with a local Store, as here.
102
+ - **Authority.** A separate ticket service needs its own project credential; a Store connection grants nothing there. Delegated child sessions are read-only and can't redefine policy.
103
+
104
+ ### Optional ticket tree
105
+
106
+ All three sources declare `integrationTree: true`, storing kind and target as frontmatter (`file`), transactional project data (`hosted`), or the exact `node` label plus the parent relationship (`linear`).
107
+
108
+ - **Targets** resolve to canonical ids in the same source and pick the integration destination, not execution order; blockers are a separate graph. See [integration](integration-overview.md).
109
+ - **Updates.** Omitted `kind` or `target` keeps the value. New tickets default to work; `kind = "work"` resets kind; `target = null` clears a target in the typed API (not TOML syntax).
110
+ - **Validation.** Target existence, node kind, self/ancestor cycles, corrupt ancestor chains and demoting a node with children are checked before any write; invalid metadata rejects the whole patch.
111
+ - **Enumeration.** `listAll` lists every state, ignoring ready filters.
112
+ - **Without the capability**, a source keeps CRUD but must refuse kind/target writes, not drop them.
113
+
114
+ ## Writing your own
115
+
116
+ Implement `TicketSource`, register it in the manifest's `ticketSources` map, and select it with `tickets.source`. Import from `@defrex/autobuild/plugin-sdk`, never internal paths. [Writing a plugin](plugin-authoring.md) covers factories, registration and publishing.
117
+
118
+ An adapter must:
119
+
120
+ - preserve lifecycle, claim and blocker-completion semantics
121
+ - create idempotently under retries, with stable visible creation keys
122
+ - return valid records from `listReady` with diagnostics for malformed ones, but propagate infrastructure failures
123
+ - declare revision support honestly: guarded writes reject stale revisions; unsupported guards fail explicitly
124
+ - never report success for a partial mixed update
125
+
126
+ Test with a `TicketSourceContractFactory` returning a `TicketSourceContractHarness` (source, lifecycle states, a writable fixture label, cleanup). Live fixtures reserve creation keys before creating, so cleanup survives a lost response. Run `describeTicketSourceContract` unchanged, or expose the fixture through the plugin contract descriptor and run:
127
+
128
+ ```sh
129
+ bun ab plugin test ticket-source acme
130
+ ```
131
+
132
+ Declare tree support only if you keep the [optional tree contract](plugin-authoring.md#optional-ticket-tree-capability) on the same port and harness: exhaustive pagination, canonical targets, revision coverage and atomic rejection.
@@ -0,0 +1,69 @@
1
+ ---
2
+ title: "Tickets and specs"
3
+ group: "concepts"
4
+ description: "How your operator agent writes buildable specs, chooses ticket kinds, and grooms work for the ready gate."
5
+ label: "Tickets and specs"
6
+ order: 5
7
+ ---
8
+
9
+ # Tickets and specs
10
+
11
+ A ticket says what change to make and why. The tracker is the input; the build's pinned spec is the execution contract.
12
+
13
+
14
+ ## Choose a source
15
+
16
+ Autobuild ships three ticket sources; plugins can register more through the same port:
17
+
18
+ - **File** stores tickets in lifecycle directories.
19
+ - **Linear** (direct) uses your team's workflow.
20
+ - **Hosted** is its own project-scoped service, not a Linear proxy.
21
+
22
+ The source supplies content, workflow states, labels, and blockers; configuration picks the source and ready gate. Everything else is source-agnostic.
23
+
24
+ ```toml
25
+ [tickets]
26
+ source = "file"
27
+ readyState = "ready"
28
+ ```
29
+
30
+ See [Ticket sources](ticket-sources.md) for setup, credentials, configuration and extension contracts.
31
+
32
+ ## Groom a buildable spec
33
+
34
+ The spec standard asks for:
35
+
36
+ - **What and why.** The observable change and why it matters; implementation strategy is left to planning.
37
+ - **Acceptance criteria.** Verifiable facts that decide whether the work is done.
38
+ - **Out of scope.** Adjacent work the build must leave alone.
39
+ - **Evidence.** The decision, incident, data, or observations behind the request.
40
+
41
+ Your operator agent grooms the ticket with you using `ab-spec`, then moves it to the ready state with any required labels. Dispatch's spec gate returns ready tickets that can't become conforming specs to Triage with an explanation.
42
+
43
+
44
+ ## Ready is a gate, not a guarantee
45
+
46
+ The dispatcher claims only tickets in the ready state with the required labels and any source-specific filter. A ready ticket still waits on:
47
+
48
+ - **Blockers.** Unresolved prerequisite tickets keep it queued; they don't create a blocked build. With nodes, prerequisites with builds must be present at the sampled destination; see [integration and blocker presence](integration-overview.md).
49
+ - **Destination and capacity.** Its target must accept new work, and a capacity slot must be free.
50
+
51
+ At dispatch, Autobuild pins the spec, so later tracker edits don't change what reviewers approved. A deliberate revision goes through your operator agent answering an escalation, and restarts planning:
52
+
53
+ ```sh
54
+ bun ab answer <slug> --revise-spec-from-ticket
55
+ ```
56
+
57
+
58
+ ## Work and node tickets
59
+
60
+ | Kind | Describes | Runs |
61
+ |---|---|---|
62
+ | Work | an individual change | the build pipeline |
63
+ | Node | a finite integration point | collects related work, verifies it together, lands into its parent |
64
+
65
+ Both kinds need conforming specs; a node's intent alone isn't a buildable contract. Set the kind with `ab ticket create` or `ab ticket update --kind work|node`. See [integrating related work](integration-overview.md) for targets, node admission and landing.
66
+
67
+ Outside signals and agent discoveries enter through [Intake and harvest](intake.md) as proposals, groomed before they become ready work.
68
+
69
+ Follow the [dispatcher guide](dispatcher.md) for what happens at claim, or [Getting started](getting-started.md) for a first ticket.
@@ -0,0 +1,111 @@
1
+ ---
2
+ title: Troubleshooting
3
+ group: reference
4
+ order: 18
5
+ description: "Diagnose configuration, idle dispatch, authentication, stalled builds, and project selection."
6
+ ---
7
+
8
+ # Troubleshooting
9
+
10
+ Start from the symptom and recorded state. Your operator agent inspects the CLI and suggests fixes; you manage dispatcher processes and credentials.
11
+
12
+ ## Invalid configuration
13
+
14
+ **Symptom.** Startup reports a TOML syntax error, invalid config with field paths, or a runtime-routing error naming a role.
15
+
16
+ **Cause.** Malformed TOML, misplaced fields, inconsistent step definitions, or runtime and model settings inherited from `roles.default`.
17
+
18
+ **Fix**, in order:
19
+
20
+ 1. Repair TOML syntax.
21
+ 2. Fix every schema path the error names in `autobuild.toml`.
22
+ 3. Give each listed step a matching subtable and existing command names.
23
+ 4. Inspect the merged default and child roles; each setting inherits independently.
24
+ 5. Pick a supported model with `bun ab models` or the plugin's documentation.
25
+
26
+ ```sh
27
+ bun ab models --available
28
+ bun ab init --validate
29
+ ```
30
+
31
+ `bun ab dispatch --once` runs real work; use it only for a real tick.
32
+
33
+ ## tick: idle with expected work
34
+
35
+ **Symptom.** Plain dispatch prints `tick: idle` while you expect a ticket or harvest to start.
36
+
37
+ **Cause.** An admission or workflow gate is closed.
38
+
39
+ **Fix.** Inspect state, then check the gates:
40
+
41
+ ```sh
42
+ bun ab repository status
43
+ bun ab builds --queued
44
+ bun ab harvest status
45
+ ```
46
+
47
+ - **Intake and pause:** intake on, repository not paused. Resume a deliberately paused repository only when work should proceed.
48
+ - **Ready state:** ticket in the exact ready state with every required label.
49
+ - **Blockers and destination:** blockers done, target node open, required changes in the destination.
50
+ - **Claims:** claimed tickets aren't reclaimed.
51
+ - **Capacity:** paused or blocked work keeps its slot; idle collecting nodes take none. Node verification and reconciliation account specially for descendants' slots.
52
+ - **Harvest:** check the acknowledged harvest gate and unclaimed observations. Harvest triggers at `policy.harvestThreshold` observations, or `policy.harvestMaxDrift` other merged builds since the oldest observation (zero disables drift), and uses no build slot.
53
+
54
+ ## Authentication failures
55
+
56
+ **Symptom.** Ticket requests, forge operations, agent launches or hosted reads report missing or rejected credentials. Each service has its own credential and scope.
57
+
58
+ | Component | Check |
59
+ |---|---|
60
+ | Linear | `LINEAR_API_KEY`, team and workflow states, in the actual process environment or supported `.env` |
61
+ | GitHub | `gh auth status` and repository permissions; test Git fetch and push separately |
62
+ | Agent providers | The effective role's runtime: `codex login` when the Codex diagnostic asks; for Pi, provider login and the provider-qualified model |
63
+ | Hosted store | `bun ab connect` for service, project and credential status |
64
+
65
+ - **Provider refusals.** Fix permission, billing and quota failures on the provider side.
66
+ - **Hosted credentials.** Reconnect on the affected host and user when saved credentials are missing or rejected. `AB_STORE` and `AB_TOKEN` override the saved store URL and credential. Build and session grants have narrower authority.
67
+
68
+ [Build store](build-store.md#shipped-adapters) covers saved credentials and store-selection precedence. Keep secrets out of diagnostic reports.
69
+
70
+ ## Stuck or wedged builds
71
+
72
+ **Symptom.** A build stops advancing, often after an interruption.
73
+
74
+ **Cause.** Escalated, paused, waiting on landing gates, starting a runner, or recovering an expired lease. A quiet log isn't a crash.
75
+
76
+ **Fix.** Inspect the build, reading status, progress and lease health separately:
77
+
78
+ ```sh
79
+ bun ab build status my-build
80
+ bun ab builds --queued
81
+ ```
82
+
83
+ - **Held lease:** something owns the build live.
84
+ - **Old progress:** nothing recent was recorded.
85
+ - **Absent lease:** often a runner still starting.
86
+ - **Expired lease on actionable work:** the lease sweep recovers it. A merged or closed PR may instead be waiting on completion bookkeeping.
87
+
88
+ | State | Action |
89
+ |---|---|
90
+ | Cleanly paused | `bun ab resume my-build` |
91
+ | Open escalation | `bun ab answer my-build "guidance"`, or a retry resolution from `bun ab help answer` |
92
+ | Process recovery needed | You stop and drain the dispatcher cleanly, then restart it |
93
+
94
+ - A restart doesn't clear escalation gates.
95
+ - Terminal builds can't restart, and abort is irreversible.
96
+
97
+ See [answering blocked builds](operating.md#answer-and-pause). Preserve event logs; let the kernel manage leases and recovery.
98
+
99
+ ## Hosted project selection
100
+
101
+ **Symptom.** A project is missing from connected tools or the dashboard, or hosted dispatch ignores it despite valid credentials.
102
+
103
+ **Cause.** Registration, allowed-user access, project credentials and dispatcher selection are separate gates.
104
+
105
+ - **Registration.** Check the active PostgreSQL project registry; build or ticket data doesn't register a project.
106
+ - **Access.** Every allowlisted user sees all active entries; verify sign-in separately from credentials.
107
+ - **Administration.** With deployment database credentials, an administrator runs `ab-hosted-store projects list`, `projects add` or `projects remove`. Mutations require `--user IDENTITY` for attribution; project tokens can't administer registrations.
108
+ - **Dispatcher selection.** `AB_DISPATCHER_REPOSITORIES` in the hosted dispatch environment selects projects: unset selects every active registration; an explicit ordered list is intersected with current registrations.
109
+ - **Dashboard fallback.** With no selection, the dashboard shows the first registered origin.
110
+
111
+ Registry errors fail closed.
@@ -0,0 +1,50 @@
1
+ ---
2
+ title: Upgrading
3
+ group: reference
4
+ order: 17
5
+ description: "Update the pinned installation, preserve customization, and resume durable work."
6
+ ---
7
+
8
+ # Upgrading
9
+
10
+ Autobuild is an exact pinned development dependency. Pin the release you intend and review manifest and lockfile together.
11
+
12
+ ## Update the installation
13
+
14
+ Stop the dispatcher cleanly first and let its sessions drain or suspend. Your operator agent diagnoses the need; you manage the process.
15
+
16
+ From the project that owns the installation, replacing `VERSION`:
17
+
18
+ ```sh
19
+ bun add -d --exact @defrex/autobuild@VERSION
20
+ bun ab upgrade --no-self-update
21
+ ```
22
+
23
+ - **Self-update.** Plain `bun ab upgrade` updates a recognized installation on its distribution channel, then merges skills and applies supported migrations with the new distribution. An unsupported installation reports why it skipped. `--no-self-update` skips only the installation update.
24
+ - **Two scopes.** Package and lockfile changes belong to the project that owns the installation; skill merges and config migrations apply to the target repository, which can differ.
25
+
26
+ Check what upgrade committed, then review and commit the version bump.
27
+
28
+ ## Review configuration and skills
29
+
30
+ Upgrade keeps your `autobuild.toml`; supported migrations may amend it.
31
+
32
+ - **Explicit landing policy:** a valid policy stays byte-for-byte unchanged.
33
+ - **Absent landing policy:** upgrade reads the target repository's journal. Legacy ON becomes leaf auto; OFF or no fact becomes leaf consent; nodes get consent either way. If the journal is unavailable, restore access or configure policy deliberately, then retry.
34
+
35
+ Skills [merge three ways](skills.md#how-upgrades-preserve-customization), with validated agent resolutions for overlapping edits. An unresolved conflict leaves that file untouched while others advance. Read the [upgrade report](skills.md#how-upgrades-preserve-customization) and diff even after exit zero: content conflicts don't fail the command. A conflict-free upgrade makes a narrowly scoped local commit. With `--no-commit`, conflicts or unsafe Git state, edits stay uncommitted with an explanation; resolve the reported files and commit.
36
+
37
+ ## Restart and resume
38
+
39
+ Restart with the upgraded repository-installed CLI:
40
+
41
+ ```sh
42
+ bun ab dispatch
43
+ ```
44
+
45
+ - **One writer.** Don't run old and new dispatchers at once.
46
+ - **Durable resume.** Work resumes from durable state after a clean stop. Restart doesn't answer escalations.
47
+ - **Old behavior.** Drain old work before switching if it must keep the old execution behavior; no claim-version switch preserves it.
48
+ - **Hosted services.** Upgrade the hosted service before its connected projects, within its compatibility window.
49
+
50
+ Read [Infrastructure seams](seams.md) and [Repository configuration](configuration-overview.md) before changing infrastructure or landing policy.