@defrex/autobuild 1.4.2 → 1.6.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 (218) hide show
  1. package/README.md +1 -1
  2. package/SPEC.md +512 -101
  3. package/bin/ab-dispatch-kernel.ts +1 -0
  4. package/docs/accounts.md +9 -0
  5. package/docs/agent-runtimes.md +1 -0
  6. package/docs/answering-blocked-builds.md +7 -3
  7. package/docs/architecture.md +313 -130
  8. package/docs/assets/headline-wide.png +0 -0
  9. package/docs/build-store.md +33 -3
  10. package/docs/cli.md +2 -1
  11. package/docs/configuration-overview.md +9 -0
  12. package/docs/configuration.md +217 -106
  13. package/docs/dispatcher-hosting.md +19 -3
  14. package/docs/dispatcher.md +11 -6
  15. package/docs/glossary.md +1 -1
  16. package/docs/integration-overview.md +2 -2
  17. package/docs/integration-tree.md +91 -28
  18. package/docs/merge-policy.md +28 -9
  19. package/docs/operating.md +1 -1
  20. package/docs/operator-api.md +57 -20
  21. package/docs/operator-surfaces.md +1 -1
  22. package/docs/plugin-authoring.md +89 -8
  23. package/docs/remote-store-protocol.md +39 -11
  24. package/docs/remote-ticket-protocol.md +126 -12
  25. package/docs/restacking.md +24 -6
  26. package/docs/seams.md +2 -2
  27. package/docs/setup.md +19 -13
  28. package/docs/spec-standard.md +2 -1
  29. package/docs/ticket-dependencies.md +26 -8
  30. package/docs/ticket-migration.md +70 -7
  31. package/docs/ticket-sources.md +82 -5
  32. package/docs/tickets.md +34 -2
  33. package/docs/troubleshooting.md +3 -3
  34. package/docs/verification.md +5 -5
  35. package/docs/website.md +8 -0
  36. package/docs/workspaces.md +1 -1
  37. package/package.json +4 -3
  38. package/packages/core/src/accounts/hosted-readiness.ts +21 -0
  39. package/packages/core/src/cli/attention.ts +3 -0
  40. package/packages/core/src/cli/build-control.ts +36 -12
  41. package/packages/core/src/cli/connect.ts +9 -18
  42. package/packages/core/src/cli/context.ts +44 -0
  43. package/packages/core/src/cli/dashboard/configuration.ts +11 -0
  44. package/packages/core/src/cli/dashboard/model.ts +51 -11
  45. package/packages/core/src/cli/dashboard/poll.ts +14 -0
  46. package/packages/core/src/cli/dashboard/queue.ts +21 -0
  47. package/packages/core/src/cli/dashboard/render.ts +43 -22
  48. package/packages/core/src/cli/dispatch-frontend.ts +63 -30
  49. package/packages/core/src/cli/dispatch-mode.ts +35 -16
  50. package/packages/core/src/cli/dispatch-preflight.ts +4 -1
  51. package/packages/core/src/cli/dispatch-repository-feed.ts +40 -11
  52. package/packages/core/src/cli/dispatch-tickets.ts +47 -0
  53. package/packages/core/src/cli/dispatch-upgrade-controller.ts +3 -0
  54. package/packages/core/src/cli/dispatch.ts +522 -145
  55. package/packages/core/src/cli/help.ts +63 -24
  56. package/packages/core/src/cli/init-hosted-accounts.ts +54 -0
  57. package/packages/core/src/cli/init-readiness-remote.ts +16 -3
  58. package/packages/core/src/cli/init-validation.ts +144 -42
  59. package/packages/core/src/cli/issue-links.ts +67 -0
  60. package/packages/core/src/cli/main.ts +32 -15
  61. package/packages/core/src/cli/pr-summary-publication.ts +38 -7
  62. package/packages/core/src/cli/publication-settlement.ts +36 -24
  63. package/packages/core/src/cli/repo-lease.ts +225 -0
  64. package/packages/core/src/cli/repository-status.ts +203 -49
  65. package/packages/core/src/cli/status.ts +42 -4
  66. package/packages/core/src/cli/terminals.ts +37 -2
  67. package/packages/core/src/cli/ticket-editor.ts +20 -6
  68. package/packages/core/src/cli/ticket.ts +264 -46
  69. package/packages/core/src/cli/triage-count-sampler.ts +59 -0
  70. package/packages/core/src/cli/wait.ts +4 -1
  71. package/packages/core/src/cli/watch.ts +19 -4
  72. package/packages/core/src/config/live.ts +45 -4
  73. package/packages/core/src/config/load.ts +9 -0
  74. package/packages/core/src/config/pipeline-source.ts +6 -2
  75. package/packages/core/src/config/ready-assignee.ts +86 -0
  76. package/packages/core/src/config/schema.ts +202 -38
  77. package/packages/core/src/distribution-packaging.ts +1 -1
  78. package/packages/core/src/events/catalog.ts +7 -0
  79. package/packages/core/src/events/compatibility.ts +2 -1
  80. package/packages/core/src/events/payloads.ts +85 -0
  81. package/packages/core/src/events/policy.ts +10 -0
  82. package/packages/core/src/events/repository.ts +93 -28
  83. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +237 -230
  84. package/packages/core/src/kernel/build-identity.ts +12 -0
  85. package/packages/core/src/kernel/change-presence.ts +139 -6
  86. package/packages/core/src/kernel/dispatch-capacity.ts +189 -19
  87. package/packages/core/src/kernel/dispatch-status.ts +10 -1
  88. package/packages/core/src/kernel/dispatch-upgrade.ts +104 -5
  89. package/packages/core/src/kernel/engine.ts +17 -8
  90. package/packages/core/src/kernel/finalize-pr-rejection.ts +95 -0
  91. package/packages/core/src/kernel/generators/build-log.ts +9 -0
  92. package/packages/core/src/kernel/generators/repository-journals.ts +15 -1
  93. package/packages/core/src/kernel/harvest.ts +4 -1
  94. package/packages/core/src/kernel/incremental-fixtures.ts +1 -0
  95. package/packages/core/src/kernel/integration-completeness.ts +104 -17
  96. package/packages/core/src/kernel/integration-landing.ts +17 -0
  97. package/packages/core/src/kernel/integration-state.ts +17 -0
  98. package/packages/core/src/kernel/issue-keywords.ts +202 -0
  99. package/packages/core/src/kernel/janitor-failure.ts +96 -5
  100. package/packages/core/src/kernel/kernel-git.ts +87 -0
  101. package/packages/core/src/kernel/landing-readiness.ts +25 -17
  102. package/packages/core/src/kernel/leaf-restack-state.ts +4 -2
  103. package/packages/core/src/kernel/log-index.ts +1 -1
  104. package/packages/core/src/kernel/node-issue-links.ts +142 -0
  105. package/packages/core/src/kernel/node-landing.ts +2 -1
  106. package/packages/core/src/kernel/node-parent.ts +6 -0
  107. package/packages/core/src/kernel/node-restack-transaction.ts +2 -0
  108. package/packages/core/src/kernel/pr-summary.ts +24 -0
  109. package/packages/core/src/kernel/read-deferrals.ts +75 -12
  110. package/packages/core/src/kernel/read-facts.ts +32 -1
  111. package/packages/core/src/kernel/reconcile-restack.ts +1 -1
  112. package/packages/core/src/kernel/reducer-registry.ts +37 -2
  113. package/packages/core/src/kernel/reducer.ts +147 -5
  114. package/packages/core/src/kernel/ticket-preparation.ts +16 -0
  115. package/packages/core/src/kernel/verify-budget.ts +43 -0
  116. package/packages/core/src/operator/index.ts +3 -1
  117. package/packages/core/src/operator/presentation.ts +3 -0
  118. package/packages/core/src/operator/protocol.ts +38 -2
  119. package/packages/core/src/operator/query.ts +69 -29
  120. package/packages/core/src/operator/registry.ts +47 -26
  121. package/packages/core/src/operator/tickets.ts +77 -10
  122. package/packages/core/src/plugin-sdk/index.ts +13 -0
  123. package/packages/core/src/plugins/manifest.ts +1 -1
  124. package/packages/core/src/plugins/registry.ts +1 -0
  125. package/packages/core/src/ports/forge/contract.ts +69 -0
  126. package/packages/core/src/ports/forge/create.ts +5 -0
  127. package/packages/core/src/ports/forge/fake.ts +184 -3
  128. package/packages/core/src/ports/forge/git-rewrite.ts +4 -2
  129. package/packages/core/src/ports/forge/github.ts +175 -38
  130. package/packages/core/src/ports/forge/local-git.ts +14 -0
  131. package/packages/core/src/ports/forge/readiness.ts +10 -0
  132. package/packages/core/src/ports/forge-failure.ts +43 -0
  133. package/packages/core/src/ports/runner/claude.ts +7 -1
  134. package/packages/core/src/ports/runner/codex.ts +7 -2
  135. package/packages/core/src/ports/runner/native-cli-fixture.ts +2 -1
  136. package/packages/core/src/ports/runner/pi.ts +7 -1
  137. package/packages/core/src/ports/runner/runtime.ts +3 -0
  138. package/packages/core/src/ports/runner/start-prompt.ts +37 -0
  139. package/packages/core/src/ports/tickets/contract.ts +320 -7
  140. package/packages/core/src/ports/tickets/create.ts +89 -20
  141. package/packages/core/src/ports/tickets/fake.ts +18 -0
  142. package/packages/core/src/ports/tickets/file-codec.ts +20 -0
  143. package/packages/core/src/ports/tickets/file.ts +43 -1
  144. package/packages/core/src/ports/tickets/github-fake.ts +1123 -0
  145. package/packages/core/src/ports/tickets/github-issues.ts +431 -0
  146. package/packages/core/src/ports/tickets/github-validators.ts +194 -0
  147. package/packages/core/src/ports/tickets/github.ts +2029 -0
  148. package/packages/core/src/ports/tickets/hosted-index.ts +34 -3
  149. package/packages/core/src/ports/tickets/issue-links.ts +86 -0
  150. package/packages/core/src/ports/tickets/lifecycle.ts +60 -4
  151. package/packages/core/src/ports/tickets/linear.ts +66 -6
  152. package/packages/core/src/ports/tickets/migration.ts +290 -68
  153. package/packages/core/src/ports/tickets/operations.ts +98 -12
  154. package/packages/core/src/ports/tickets/priority.ts +55 -0
  155. package/packages/core/src/ports/tickets/remote-protocol.ts +195 -29
  156. package/packages/core/src/ports/tickets/remote.ts +188 -13
  157. package/packages/core/src/ports/tickets/revision.ts +22 -1
  158. package/packages/core/src/ports/tickets/states.ts +43 -0
  159. package/packages/core/src/ports/tickets/tree.ts +58 -12
  160. package/packages/core/src/ports/tickets/update.ts +12 -2
  161. package/packages/core/src/ports/types.ts +194 -9
  162. package/packages/core/src/ports/workspace/commit-preservation.ts +163 -25
  163. package/packages/core/src/ports/workspace/git-worktree.ts +6 -2
  164. package/packages/core/src/ports/workspace/harvest-execution.ts +4 -2
  165. package/packages/core/src/ports/workspace/vercel-sandbox.ts +121 -27
  166. package/packages/core/src/processes/build-runner.ts +101 -22
  167. package/packages/core/src/processes/dispatcher.ts +1046 -372
  168. package/packages/core/src/processes/execution-no-progress.ts +7 -0
  169. package/packages/core/src/processes/harvest-child.ts +4 -2
  170. package/packages/core/src/processes/harvest-execution-state.ts +104 -0
  171. package/packages/core/src/processes/harvest-runner.ts +263 -25
  172. package/packages/core/src/processes/harvest.ts +5 -8
  173. package/packages/core/src/processes/tick-publication.ts +12 -2
  174. package/packages/core/src/processes/ticket-scan-schedule.ts +78 -0
  175. package/packages/core/src/processes/workspace-preservation.ts +36 -1
  176. package/packages/core/src/runtime-identity.ts +10 -2
  177. package/packages/core/src/scenarios/harness.ts +149 -35
  178. package/packages/core/src/store/adapter.ts +7 -1
  179. package/packages/core/src/store/contract.ts +83 -2
  180. package/packages/core/src/store/digest.ts +32 -1
  181. package/packages/core/src/store/reduced-reads.ts +10 -0
  182. package/packages/core/src/store/reducer-value-shapes.json +4471 -3427
  183. package/packages/core/src/store/remote/protocol.ts +2 -0
  184. package/packages/core/src/store/remote/released-clients.json +22 -0
  185. package/packages/core/src/store/remote/released-reducer-values/1.5.0.json +26924 -0
  186. package/packages/core/src/store/remote/released-reducer-values/1.6.0.json +27173 -0
  187. package/packages/core/src/store/remote/released-reducer-values/index.ts +4 -0
  188. package/packages/core/src/store/repo-state-events.ts +2 -0
  189. package/packages/core/src/store/types.ts +5 -0
  190. package/packages/core/src/testing/dispatch-read-budget.ts +729 -123
  191. package/packages/core/src/testing/index.ts +18 -1
  192. package/packages/core/src/testing/presence-history.ts +79 -0
  193. package/packages/core/src/testing/reduced-read-budget.ts +1424 -33
  194. package/packages/core/src/testing/upgrade-generations.ts +77 -0
  195. package/skills/code-review/SKILL.md +4 -3
  196. package/skills/finalize/SKILL.md +18 -2
  197. package/skills/guide/SKILL.md +417 -143
  198. package/skills/guide/references/accounts.md +9 -0
  199. package/skills/guide/references/integration-tree.md +91 -28
  200. package/skills/guide/references/merge-policy.md +28 -9
  201. package/skills/guide/references/operator-api.md +57 -20
  202. package/skills/guide/references/plugin-authoring.md +89 -8
  203. package/skills/guide/references/remote-store-protocol.md +39 -11
  204. package/skills/guide/references/remote-ticket-protocol.md +126 -12
  205. package/skills/guide/references/restacking.md +24 -6
  206. package/skills/guide/references/setup.md +19 -13
  207. package/skills/guide/references/spec-standard.md +2 -1
  208. package/skills/guide/references/ticket-dependencies.md +26 -8
  209. package/skills/guide/references/ticket-migration.md +70 -7
  210. package/skills/harvest-review/SKILL.md +4 -3
  211. package/skills/implement/SKILL.md +20 -1
  212. package/skills/operate/SKILL.md +149 -35
  213. package/skills/plan/SKILL.md +1 -1
  214. package/skills/reconcile/SKILL.md +5 -4
  215. package/skills/spec/SKILL.md +15 -2
  216. package/skills/tickets/SKILL.md +116 -37
  217. package/templates/autobuild.toml +5 -0
  218. package/templates/hosted-service/package.json +2 -2
@@ -2,7 +2,9 @@
2
2
 
3
3
  Export and import use the ordinary file ticket layout. They operate on tickets
4
4
  and current attachments through the ticket source; neither command contacts the
5
- forge. File and hosted sources support import. Linear supports export only.
5
+ forge, except that a GitHub source reads and writes the repository's issues.
6
+ File, hosted and GitHub sources support import. Every built-in source supports
7
+ export.
6
8
 
7
9
  1. Pause intake and quiesce build-related ticket writes and other ticket writers
8
10
  for the cutover. In-flight builds need not be aborted. Import preflight does
@@ -13,8 +15,8 @@ forge. File and hosted sources support import. Linear supports export only.
13
15
  directory only after all reads succeed. Back up the target tracker too.
14
16
  3. Configure the new `[tickets]` source, or use `ab connect --tickets URL` for a
15
17
  hosted ticket service. Keep the export directory intact.
16
- 4. Run `ab ticket import /path/to/export`. Inspect its printed ticket and state
17
- mappings and `/path/to/export/.ab-import-map.json`.
18
+ 4. Run `ab ticket import /path/to/export [--states <state,…>]`. Inspect its
19
+ printed ticket and state mappings and `/path/to/export/.ab-import-map.json`.
18
20
  5. Import records a durable source/ID mapping in the same BuildStore and repository
19
21
  that hold the existing builds, after tickets, metadata and assets finish.
20
22
  Keep that BuildStore/repository identity through the cutover.
@@ -37,13 +39,40 @@ through export when file or Linear tickets have attachments there.
37
39
  State directory names use lowercase letters, digits and hyphens, start with a
38
40
  letter and contain at most forty characters. Export maps `In Progress` to
39
41
  `in-progress`, `Backlog` to `backlog`, and `Done` to `done`. It retains each ticket's
40
- state rather than assigning lifecycle roles. Distinct names that collapse to the
42
+ state, and the manifest records which lifecycle roles each state held under the
43
+ exporting configuration: triage, ready, claimed, done, backlog, rejected, and the
44
+ create and proposal placements. Distinct names that collapse to the
41
45
  same directory fail before publication. The hidden `.ab-migration.json` records
42
46
  original display names and the state map. Import also accepts ordinary legacy
43
47
  file layouts: it reuses exact or unique case-insensitive target states before
44
48
  normalizing new names. A seeded `done` satisfies `Done`; absent `In Progress`
45
49
  creates `in-progress`. Ambiguous matches and colliding state maps fail preflight.
46
50
 
51
+ A state that held a role lands in the destination's state for the same role,
52
+ whatever either source calls it. For example, an `icebox` backlog lands in a
53
+ `later` backlog, and Linear's `Backlog` triage lands in `triage`. A state holding
54
+ several roles takes the first of done, rejected, claimed, ready, backlog, triage,
55
+ proposal and create. If the destination configures no backlog or rejected state
56
+ for such a state, import refuses and names the `[tickets]` key to set. States
57
+ without a role, and exports made before roles were recorded, map by name as above.
58
+
59
+ ## Importing selected states
60
+
61
+ `ab ticket import <dir> --states triage,ready,icebox` imports only the tickets in
62
+ the named states and creates only those states. Teams moving to a new tracker
63
+ often take their open work and leave closed history behind. A name matches an
64
+ export directory exactly, then by unique case-insensitive match, then by the
65
+ original display name the manifest recorded (`In Progress` for `in-progress`).
66
+ An unknown name is refused, and the refusal lists the export's states.
67
+
68
+ A blocker on a left-out ticket in the done role is dropped as resolved. Any other
69
+ reference to a left-out ticket is reported before any write, and nothing is
70
+ imported. That covers a blocker in another state, an integration-tree target, and
71
+ an issue link to a left-out issue in an export from GitHub. Import also refuses a
72
+ selection that leaves out a ticket an unfinished build is working on or targets.
73
+ The refusal names the build and the ticket, so in-flight work keeps its continuity.
74
+ Without `--states`, every ticket is imported.
75
+
47
76
  File targets retain source ids. Hosted targets keep canonical own-team ids:
48
77
  `AUT-706` imported into team `AUT` stays `AUT-706`. Other ids receive numbers above
49
78
  all existing and preserved incoming numbers. Known clashes with unrelated tickets
@@ -52,7 +81,8 @@ Content similarity and stale mapping files never establish identity.
52
81
 
53
82
  Creation keys establish identity. Exports retain existing keys and assign keys to
54
83
  legacy tickets. Importing an ordinary file layout first saves a hidden migration
55
- identity and keys in that input directory. Preserve this file and the input across
84
+ identity and keys in that input directory. The identity also records when it was
85
+ first saved, and that time is passed as the creation keys' reservation time. Preserve this file and the input across
56
86
  retries. After interruption, rerun the same command: committed creates are adopted
57
87
  by key even if their mapping write failed. Adopted bodies and other fields are not
58
88
  overwritten. Missing blockers and comments are replayed, and unchanged attachments
@@ -62,7 +92,7 @@ timestamps remain in the export; imported comments use the target's metadata.
62
92
 
63
93
  Portable records use TOML frontmatter between `+++` fences and an unchanged
64
94
  Markdown body. Alongside `id`, `title`, `labels`, `blockedBy` and `idempotencyKey`,
65
- optional `comments` contain `body`, `createdAt` and optional `author`. Optional
95
+ optional `issueLinks` contain `issue` and `intent` (`closes` or `refs`), optional `priority` is `"urgent"` (absent means normal), optional `comments` contain `body`, `createdAt` and optional `author`. Optional
66
96
  `attachments` contain `kind`, `name`, `layout` (`file` or `tree`) and `entries`:
67
97
  `{ type = "dir", path = "empty" }` or
68
98
  `{ type = "file", path = "image.png", base64 = "…" }`. Common asset limits and
@@ -78,12 +108,45 @@ no continuous sync, assignee migration, state history or build-history migration
78
108
 
79
109
  Integration-tree `kind` and `target` are preserved in portable frontmatter.
80
110
  Import validates the complete target graph before changing the destination and
81
- refuses a destination that cannot preserve metadata. It creates or adopts every
111
+ refuses a destination that cannot preserve metadata. Issue links and urgent
112
+ priority are preserved the same way, and a destination that cannot store them is refused before any write. It creates or adopts every
82
113
  identity, establishes node kinds, then applies targets using the durable id map,
83
114
  just like blockers. Input order does not matter. Resuming also restores edges on
84
115
  adopted tickets; normal destination validation still guards existing graphs and
85
116
  node demotion. Older work-only exports remain valid.
86
117
 
118
+ ## GitHub
119
+
120
+ GitHub chooses issue numbers, so import into a `github` source remaps every
121
+ ticket. Check the printed mapping and `.ab-import-map.json`, which list each
122
+ original id with its new issue number. Blockers are rewritten through that
123
+ mapping and become native issue dependencies. Comments become issue comments,
124
+ and attachments go to the BuildStore under the new number. States become
125
+ `autobuild:<state>` labels. The done role closes the issue as completed, the
126
+ rejected role closes it as not planned, and triage leaves it open without a state
127
+ label. Each issue carries a creation key in a hidden marker, so an interrupted
128
+ import resumes with the same command and adopts the issues it already opened.
129
+ Resuming never duplicates an issue, and it replays missing blockers, comments and
130
+ assets.
131
+
132
+ Before any write, import reports every problem together: states that cannot be
133
+ `autobuild:` labels (for example `proposal`, or names that are not lowercase),
134
+ a rejected state when `[tickets].rejectedState` is unset, and ticket labels that
135
+ would collide with a state label (`autobuild:<state>`) or an issue-link label
136
+ (`autobuild-link:…`). The `autobuild:proposal` and `autobuild:aborted` marker
137
+ labels are ordinary labels and import as-is. Node kinds become the exact `node`
138
+ label, and targets become sub-issue relationships to the remapped node issues.
139
+ Issue links are kept. They are rewritten through the mapping only when the export
140
+ came from GitHub, because only then do they name the exported tickets.
141
+
142
+ Export from a `github` source covers every issue, closed ones included. It records
143
+ comment history with authors and timestamps, kinds, targets, blockers and issue links, and skips
144
+ pull requests. An issue it cannot read as a ticket, such as one with two state
145
+ labels, fails the export. Issues closed as not planned export in the rejected
146
+ role even when `[tickets].rejectedState` is unset. Export and import read comment
147
+ history explicitly. The GitHub source still lists no comment history in
148
+ `ab ticket show`, and dispatcher ticks never read it.
149
+
87
150
  ## In-flight builds
88
151
 
89
152
  A recorded migration resolves old source-qualified ticket references through the
@@ -40,11 +40,12 @@ not author proposals or touch tickets.
40
40
  ```sh
41
41
  ab harvest verdict approve --notes .ab/harvest-review.md
42
42
  ab harvest verdict revise --notes .ab/harvest-review.md --findings .ab/findings.json
43
- ab harvest verdict escalate --notes .ab/harvest-review.md --reason "the human question"
43
+ ab harvest verdict escalate --notes .ab/harvest-review.md --reason "the question"
44
44
  ```
45
45
 
46
- Use `escalate` only when evidence or product intent requires human judgment,
47
- not as a substitute for a precise revision finding.
46
+ Use `escalate` only when evidence or product intent requires external judgment
47
+ from the operator agent or a human, not as a substitute for a precise revision
48
+ finding.
48
49
 
49
50
  ## Writing findings
50
51
 
@@ -72,6 +72,13 @@ manifest-directed artifact paths remain authoritative. Never commit scratch.
72
72
  terminal command besides `ab escalate`. If it reports a validation error,
73
73
  fix what it names and run it again.
74
74
 
75
+ An empty contribution is refused: when HEAD has no commits over the
76
+ recorded contribution base, `ab done` publishes nothing and instead records
77
+ an implement escalation naming both SHAs. That escalation is this session's
78
+ terminal; stop and run no further terminal. Commit intended changes before
79
+ running `ab done`. If you conclude the spec needs no code change, that is a
80
+ question for the operator: run `ab escalate` with the reason instead.
81
+
75
82
  ## Ground rules for this phase
76
83
 
77
84
  - **The spec bounds your work.** When you spot something outside its scope —
@@ -84,11 +91,23 @@ manifest-directed artifact paths remain authoritative. Never commit scratch.
84
91
  ab observe --kind followup "…"
85
92
  ```
86
93
 
94
+ - **Downgrade a linked issue you only partly resolve.** When the manifest
95
+ lists `issueLinks` and the spec leaves part of a `closes` issue undone, record
96
+ it so the PR (or, for a child of a node, the root node's PR) writes `Refs #N`
97
+ instead of `Closes #N`:
98
+
99
+ ```
100
+ ab issue downgrade 824 --reason "<what remains>"
101
+ ```
102
+
103
+ The reason shows in `ab build status`. Downgrades are one-way, and they are
104
+ refused once finalize seals the links.
105
+
87
106
  - **Handle feedback before anything else.** A round with feedback carries
88
107
  exactly one kind, named by `$AB_CONTEXT_DIR/context.json`'s `feedback` field:
89
108
  `findings` → resolve every finding in `$AB_CONTEXT_DIR/findings.json`; findings you
90
109
  dodge come back marked as persisting, and a chain that stays persistent
91
- goes to a human. `verify` → address every failed report listed in the manifest's
110
+ escalates for external judgment. `verify` → address every failed report listed in the manifest's
92
111
  `verifyReports` (or the historical single report) under `$AB_CONTEXT_DIR/verify/`.
93
112
  `cancelledVerify` lists unfinished steps as not run with their fail-fast cause;
94
113
  cancellation is never a pass. A stage receipt can remain available alongside
@@ -11,7 +11,9 @@ work to merge. Any external agent can take the role through the CLI or MCP.
11
11
  Filing sessions check presence before taking the role; with a live operator,
12
12
  they leave operating context in the ticket and stop. Explicit human instructions
13
13
  always override that default. Presence is advisory, permits concurrent operators,
14
- and grants no exclusive authority. MCP presence registration is deferred.
14
+ and grants no exclusive authority. MCP presence registration is deferred, and MCP
15
+ `repository.status` reports `operator.presence: "unavailable"`, which never means
16
+ no operator is present.
15
17
 
16
18
  The operator agent is not a build phase: it never runs pipeline steps, never
17
19
  edits the repository, and never touches a build's checkout. Its reach is the
@@ -81,7 +83,9 @@ the same resolved working directory.
81
83
 
82
84
  ### Check presence before registering
83
85
 
84
- Run `ab repository status --json` and inspect `operator.registrations`. If another
86
+ Run `ab repository status --json` and inspect `operator.registrations`, which the
87
+ CLI loads (`operator.presence: "loaded"`); only a loaded empty list means no live
88
+ operator. If another
85
89
  live operator is present, tell the human and do not become a second operator
86
90
  unless directed. Otherwise arm a repository-wide `ab watch --operator --json`.
87
91
  A flagged watch writes only mutable liveness, never events or a lease.
@@ -112,9 +116,9 @@ Credential/process changes remain subject to the Boundaries below.
112
116
  ### Watch for attention events
113
117
 
114
118
  `ab watch --operator --json` is the standing monitor. Keep its default filter: every
115
- record calls for action. It reports failed node verification, build escalations, persistent janitor failures and merge decisions,
119
+ record calls for action. It reports failed node verification, build escalations, persistent janitor failures and their escalations, merge decisions,
116
120
  harvest escalations/recovery exhaustion, automatic upgrade failures and runtime rollbacks, rejected configuration, reloads needing
117
- restart, abnormal dispatcher stops/loss, ticket-source and forge degradation past reset (15 minutes
121
+ restart, abnormal dispatcher stops/loss, abandoned ticket preparations, ticket-source and forge degradation past reset (15 minutes
118
122
  for ticket sources without reset), and five minutes of continuous tick failures. Advertised resets
119
123
  wait for a post-reset tick to finish before requiring action; ordinary recovery
120
124
  on that retry stays silent. Source grace and cooldown-driven failures do not
@@ -162,22 +166,33 @@ satisfied only by new events. Conditions include `attention`,
162
166
  condition, 3 timeout, 4 interrupted. On 3 and 4 with `--json`, the output is a
163
167
  bare `{"cursor": …}` to resume from.
164
168
 
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:
169
+ A watch without `--count` streams: it prints each record the moment the
170
+ attention arises and keeps running, so it does not exit when a build blocks.
171
+ Reacting to events means reading that output as it is written, not when the
172
+ command exits. Run it accordingly:
173
+
174
+ - **The harness offers a line-streaming monitor** (one that delivers each
175
+ stdout line as it arrives, such as Claude Code's Monitor tool): the standing
176
+ watch must run there, acting on every line as it arrives. Running it under
177
+ an exit-only facility instead, such as Claude Code's background Bash or a
178
+ blocking call, is wrong whenever such a monitor is available, even with
179
+ `--count 1`.
180
+ - **The monitor kills its command at a hard deadline** (Claude Code's Monitor
181
+ allows at most 30 minutes): pass `--timeout` shorter than that deadline, for
182
+ example `ab watch --operator --json --timeout 29m [--since <watch-cursor>]`
183
+ under a 30-minute Monitor. The watch's own 30-minute default would race the
184
+ kill. A killed watch never prints its trailing `{"cursor": …}` line; a
185
+ timed-out one does, so re-arm at once with `--since <watch-cursor>` from it.
186
+ - **Fallback: the harness has no line-streaming monitor at all** (for example
187
+ Codex, Pi, or a plain shell, which wake you only when a command exits):
188
+ never run the watch without `--count` there, because its records sit unread
189
+ until it exits. Add `--count 1` so the watch exits on its first record:
176
190
  `ab watch --operator --json --count 1 [--since <watch-cursor>]`. Act on the
177
191
  record, then re-arm at once from the trailing cursor line. Presence survives
178
192
  the re-arm gap.
179
193
 
180
- `ab wait` exits on its first match, so it suits either kind. Use precisely the
194
+ `ab wait` exits on its first match, so it suits either kind of facility for
195
+ one-off waits. Use precisely the
181
196
  same resolved invocation and working directory as foreground commands,
182
197
  including inside background shells and harness monitors. Do not rely on a
183
198
  shell alias or function that those facilities may lose. Never block a
@@ -209,7 +224,10 @@ use process lists to decide whether a dispatcher owns this repository. The
209
224
  identity resolves a yield message to run, pid, host, start time, and heartbeat
210
225
  age. Historical identity and a new holder's heartbeat may be unknown until its
211
226
  first attributable renewal. Source degradation or an old tick alone does not
212
- establish loss: a healthy lease can accompany a slow tick.
227
+ establish loss: a healthy lease can accompany a slow tick. `lost` can also be
228
+ transient: a dispatcher that stalled past `policy.dispatchLeaseTimeoutSeconds`
229
+ with no successor reclaims its lease on waking and returns to `held`, while one
230
+ that finds another holder stops as `superseded`.
213
231
 
214
232
  An unscoped watch, or a named watch with `--repository`, reports loss as a
215
233
  read-only observation: `{repo, build:null, state:null, observation:{type:
@@ -229,8 +247,10 @@ Neither a loss observation nor a later retry authorizes dispatcher intervention.
229
247
  Operate the builds the repository's dispatcher dispatches, including new builds
230
248
  that appear after you arm. Finishing the initially queued set is no reason to stop.
231
249
 
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
250
+ 1. Check presence as above, then arm `ab watch --operator --json` with no slugs
251
+ under your harness's line-streaming monitor, with `--timeout` below that
252
+ monitor's kill deadline (see *Watch for attention events*); add `--count 1`
253
+ only in the no-monitor fallback. Retain its own
234
254
  cursor and re-arm with
235
255
  `ab watch --operator --json --since <watch-cursor>`. If it reports
236
256
  `cursor-too-old`, re-arm without `--since`, reconcile status and acknowledge
@@ -248,7 +268,8 @@ that appear after you arm. Finishing the initially queued set is no reason to st
248
268
 
249
269
  Use `ab wait` and named unflagged watches only as separate diagnostics. They
250
270
  cannot replace the registered monitor or its cursor. In MCP, use the existing
251
- registry monitoring tools; operator presence is not exposed there.
271
+ registry monitoring tools; operator presence is not exposed there, and its
272
+ `repository.status` marks presence `unavailable` rather than absent.
252
273
 
253
274
  ### Inspect
254
275
 
@@ -257,8 +278,9 @@ registry monitoring tools; operator presence is not exposed there.
257
278
  attaches with runtime identity, and recent events. Historical runtime is null
258
279
  in JSON and unrecorded in human output.
259
280
  - `ab repository status` — the repository's derived status, including the lease
260
- holder’s recorded runtime version, commit, and source kind/location. Historical
261
- runtime is null in JSON and unrecorded in human output.
281
+ holder’s recorded runtime version, commit, and source kind/location, and the
282
+ latest scan's queue diagnostics and startup warnings. Historical runtime is
283
+ null in JSON and unrecorded in human output.
262
284
  - `ab artifact` — fetch one artifact's bytes.
263
285
 
264
286
  Read events with a cursor or a small `--events` count; logs are long.
@@ -288,7 +310,11 @@ Read events with a cursor or a small `--events` count; logs are long.
288
310
  Read the matched policy, readiness, acknowledged command and gate deferral in
289
311
  build status before acting. Work the consent queue by checking completeness
290
312
  and current verification, then issuing merge for the chosen merge. A merge
291
- acknowledgement accepts consent; it never promises that gates passed.
313
+ acknowledgement accepts consent; it never promises that gates passed. A
314
+ `merge-not-ready` or `node-incomplete` refusal records no consent and no
315
+ landing, though a node's completeness check may save an
316
+ `integration.observed` diagnostic; re-read status and act on the stated
317
+ reason.
292
318
  - Configure ordered `[[merge]]` rules for project policy through ab-guide.
293
319
  Repository auto-merge defaults and per-build auto-merge toggles are retired.
294
320
 
@@ -300,10 +326,28 @@ explicitly choose root or a node, evaluate the repository's effective merge
300
326
  policy, and explain the merge flow to the human. Ask when intent is unclear.
301
327
 
302
328
  `ab ticket create|update|block|unblock|list|show|move|states` file, edit, and
303
- move tickets; the `ab-tickets` skill covers the tracker's details. Moving a
329
+ move tickets; the `ab-tickets` skill covers the tracker's details. A ticket
330
+ filed from a forge issue carries it with `--issues N` (`closes`), or
331
+ `--issues N:refs` when the work only partly addresses it. Moving a
304
332
  ticket into the ready state sends it to dispatch — do that only when the
305
333
  ticket genuinely conforms and the human's intent is clear.
306
334
 
335
+ The dispatcher claims urgent ready tickets before normal ones, each in source
336
+ order. To expedite a ticket, such as a fix for a stuck build, mark it urgent
337
+ with `--priority urgent` on create or update; never move other ready tickets
338
+ out of ready to make room. Urgency never preempts a running build, and a blocked
339
+ urgent ticket still waits on its blockers. A source that cannot store priority
340
+ refuses `urgent` and names itself; tell the human.
341
+
342
+ Move tickets by lifecycle role rather than by native state name:
343
+ `ab ticket move <id> --role triage|ready|backlog|rejected`. "Ice it",
344
+ "icebox" and "backlog" mean `--role backlog` (deferred work); "reject" and
345
+ "won't do" mean `--role rejected` (declined work, which never unblocks its
346
+ dependents and no longer holds a node open). Both roles are optional: when the
347
+ move is refused naming `[tickets].backlogState` or `rejectedState`, tell the
348
+ human and recommend setting that key rather than inventing a custom state.
349
+ "Building" is the claimed role the dispatcher sets on claim, not a move target.
350
+
307
351
  ### What the CLI does not offer
308
352
 
309
353
  The registry has operator notes, harvest control, and `discard`, which have no
@@ -344,7 +388,8 @@ Your tools are the operator registry. The read-only ones are always safe:
344
388
  - `builds.events` — one build's event log from a cursor (use a cursor; logs
345
389
  are long).
346
390
  - `builds.artifact` — one artifact's bytes, base64-encoded.
347
- - `repository.status` — the repository's derived status.
391
+ - `repository.status` — the repository's derived status. Its `operator.presence`
392
+ is `unavailable`: it does not load presence, so it is not evidence of absence.
348
393
  - `harvest.status` — the observation workflow's current state.
349
394
 
350
395
  The mutating ones carry the human's authority — prefer the narrowest
@@ -360,10 +405,19 @@ that does the job, and say what you are doing before you do it:
360
405
  resumes under the revised spec and its publication is confirmed.
361
406
  - `tickets.list`, `tickets.get` — read the ticket queue and one ticket. A long
362
407
  queue pages with `limit`, `offset` and `order`; `total` counts every match.
363
- - `tickets.create` — file a new ticket from a conversation.
408
+ - `tickets.create` — file a new ticket from a conversation. A ticket filed
409
+ from a forge issue carries it in `issueLinks` as `{issue}` (intent `closes`,
410
+ the default) or `{issue, intent: "refs"}` when the work only partly
411
+ addresses it. `priority: "urgent"` dispatches it before normal ready work.
364
412
  - `tickets.update`, `tickets.block`, `tickets.unblock` — edit fields and
365
- blocker relations.
366
- - `tickets.move` — move a ticket between workflow states. Moving a ticket
413
+ blocker relations. `issueLinks` on update replaces the whole set;
414
+ `priority` (`urgent` or `normal`) expedites a ticket instead of moving other
415
+ ready tickets aside, and a source that cannot store it refuses `urgent` with
416
+ `code: "priority-unsupported"`.
417
+ - `tickets.move` — move a ticket between workflow states, by native `state`
418
+ or by lifecycle `role` (`triage`, `ready`, `backlog`, `rejected`; give
419
+ exactly one). Use `role` for deferring and declining work, with the same
420
+ phrases and unconfigured-role handling as the CLI. Moving a ticket
367
421
  into the ready state sends it to dispatch — do that only when the ticket
368
422
  genuinely conforms and the human's intent is clear.
369
423
  - `notes.read`, `notes.write` — the operator-notes artifact: durable,
@@ -390,6 +444,8 @@ Treat every default-watch record as a call to act:
390
444
  - `integration.verification-failed`: inspect the failed steps, verified head and parent, then recheck current status. If the node still needs that repair, file a repair child targeting it. Each current failed cycle reports once; recovery does not backfill superseded failures. The node may have advanced after notification.
391
445
  - `escalation.raised`: inspect the question and evidence, then resolve it using
392
446
  the shared rules.
447
+ - `build.janitor-escalated`: a janitor failure outlasted its escalation limit;
448
+ handle it as described under janitor escalation attention.
393
449
  - `build.consent-ready`: inspect the one consent queue, then merge or hold the
394
450
  selected candidate under the human's policy. Unready or stale candidates
395
451
  do not produce this observation.
@@ -401,7 +457,10 @@ Treat every default-watch record as a call to act:
401
457
  and reason, including a rejected protocol-write preflight. The running generation stays active; the same failed input is
402
458
  suppressed until target or selected-store compatibility evidence changes or a fresh operator launch. Report
403
459
  launcher-contract changes or disabled automatic upgrades as manual restart
404
- needs. Agents still never manage the process.
460
+ needs. Agents still never manage the process. Status shows a failure as
461
+ current only until a later different resolved target, a later successful
462
+ preparation or handoff, or a later generation supersedes it; a failure marked
463
+ `(superseded)` needs no action.
405
464
  - Automatic runtime rollback: repository status names the failed and restored
406
465
  runtimes and effective hold. Three failed exits within ten minutes of takeover
407
466
  restore one previous cached runtime; preflight failures do not count. The failed
@@ -419,6 +478,14 @@ Treat every default-watch record as a call to act:
419
478
  scope, cursor, field path, and running version/commit. Never start or run a dispatcher.
420
479
  - Persistent source degradation: inspect the source cause and reset evidence,
421
480
  diagnose and report the continuing intake problem.
481
+ - Abandoned ticket preparation (`ticket-preparation.resolved`, outcome
482
+ `abandoned`): automatic recovery stopped and left the ticket unchanged.
483
+ Inspect the named ticket and attempt and the recorded reason. A confirmed
484
+ claim may have left the ticket in its claimed state; an unconfirmed claim's
485
+ provider outcome is unknown, so check the ticket's actual state rather than
486
+ assuming it sits in Doing. Decide whether to leave it finished or cancelled,
487
+ or return it to Ready for another attempt. Each abandonment reports once;
488
+ history does not replay.
422
489
 
423
490
  Do not re-derive history the build's events already tell you; read events
424
491
  with a cursor and keep it short.
@@ -447,6 +514,10 @@ Stop and ask the human — in plain streamed text — whenever:
447
514
  - You would be guessing about product direction, priorities, or scope.
448
515
  - A tool refusal repeats and you cannot resolve it with the tools you have.
449
516
  - The attention event is one you cannot act on with the tools you have at all.
517
+ - A queue diagnostic says a target node is being built by another store, or a
518
+ startup warning says cross-store branch protection is unavailable. Don't
519
+ retarget or reclaim; tell the human the repository's dispatchers should
520
+ share one store (`ab connect`).
450
521
 
451
522
  Filing a ticket is acting — do it when the request is concrete. Default to
452
523
  resolving attention yourself within these boundaries; ask the human only
@@ -509,12 +580,16 @@ candidates. Entries include the target, branch preview, candidate head/parent,
509
580
  verification receipts and node children/completeness. Unknown completeness is
510
581
  not zero children. A changed head or parent must regain current verification;
511
582
  unfinished or automatically authorized candidates do not ask for attention.
583
+ Queued and held candidates hold no capacity slot; one that must re-verify or
584
+ reconcile waits for a slot ahead of new ticket claims, so a full repository
585
+ delays it without failing it.
512
586
 
513
587
  Select a queue build in the terminal and use `l merge` or `o hold`, or run
514
588
  `ab merge <slug>` / `ab hold <slug>`. MCP uses `builds.control` with action `merge`
515
589
  or `hold`. Hold is available before readiness and suppresses automatic merge.
516
590
  Merge rechecks readiness and live node completeness, so act on failures by
517
- refreshing the facts. Open children keep a node collecting. When integration
591
+ refreshing the facts. Open children keep a node collecting; a child moved to
592
+ the rejected role no longer does. When integration
518
593
  verification fails, file a repair child targeting that node and let it merge
519
594
  before retrying the node cycle.
520
595
 
@@ -529,7 +604,7 @@ entry position: resuming suppresses the same episode, while a new candidate or
529
604
  exit/re-entry can notify again. Explicit `--event` globs remain event-only.
530
605
  Use `ab wait --for consent --for node-merged --for restack-conflicted --json`
531
606
  for one wake; state waits return immediately when already satisfied. `--for
532
- attention` also includes current failed node verification, consent readiness, janitor failure attention and merge/conflict attention.
607
+ attention` also includes current failed node verification, consent readiness, janitor failure attention, an open janitor escalation and merge/conflict attention.
533
608
  Resume event backlogs with `--since <cursor>`; keep handling emitted records
534
609
  before interpreting terminal completion.
535
610
 
@@ -542,6 +617,16 @@ Repeated classified read failures park immediately again; they do not consume
542
617
  the phase failure allowance. Default watch and attention waits deliver the new
543
618
  raise with its own event type.
544
619
 
620
+ ### Janitor escalation attention
621
+
622
+ `build.janitor-escalated` is ordinary blocked attention for a janitor failure
623
+ episode that outlasted `policy.janitorFailureEscalationSeconds`. Its question
624
+ names the failing operation, the last error, the failed attempt count and when
625
+ the episode started. Diagnose and fix the cause within the Boundaries, then
626
+ answer with a bare retry so the janitor attempts on its next tick. The janitor
627
+ keeps retrying underneath, so the escalation may also close on its own when an
628
+ attempt succeeds; reconcile current status before acting on it.
629
+
545
630
  ## Forge failure recovery
546
631
 
547
632
  A historical `publication.lost` does not prove that every copy of its candidate
@@ -571,12 +656,41 @@ Classified rate limits retain repository cooldown and consume no publication
571
656
  retry allowance. Rejected pushes, lease conflicts, dirty trees and unclassified
572
657
  errors retain their existing behavior.
573
658
 
659
+ When the forge refuses a dispatcher-side finalize PR create with a
660
+ non-transient, non-rate-limit answer, such as a 4xx validation error or
661
+ GitHub's "No commits between" 422, the build raises one `finalize` escalation
662
+ (`policy`, `non-retryable-phase-failure`) whose question quotes the forge, the
663
+ HTTP status and its message. It consumes no `maxInfrastructureAttempts` and
664
+ needs no provider cleanup, and the dispatcher makes no further attempt while it
665
+ is open. Compare the branch with its base first. A bare retry re-attempts the
666
+ PR create once, a repeat refusal raises a new escalation, and abort ends the
667
+ build. An implement round with no commits over its base escalates at
668
+ `implement` instead; answer it with guidance, a spec revision, or abort.
669
+
574
670
  Janitor failures are durable per-build episodes. Eligible failures retry after
575
671
  30, 60, 120, 240 seconds, then at the configured cap (300 seconds by default).
576
- Skipped polls preserve the episode across restart. After
577
- `policy.janitorFailureAttentionSeconds` (600 by default), `build.janitor-failing`
578
- notifies default watchers and appears on the build row. A successful attempt
579
- clears it. `policy.janitorBackoffMaxSeconds` sets the positive integer cap.
672
+ A classified forge rate limit is repository cooldown, not a janitor failure:
673
+ neither the first limited response nor the cooldown that follows starts an
674
+ episode or records an attempt, so a build that only waits out cooldown never
675
+ escalates. Skipped polls preserve the episode across restart. Both thresholds
676
+ below are wall-clock from the episode's first failed attempt and are checked
677
+ when an attempt fails, so cooldown inside an episode that already started still
678
+ counts. After `policy.janitorFailureAttentionSeconds` (600 by default),
679
+ `build.janitor-failing` notifies default watchers and appears on the build row.
680
+ After `policy.janitorFailureEscalationSeconds` (3600 by default), the build
681
+ raises one escalation through `build.janitor-escalated`, naming the failing
682
+ operation, the last error, the failed attempt count and when the episode
683
+ started. The build is then blocked and shows wherever open escalations show.
684
+ The janitor keeps retrying on its backoff underneath; a successful attempt
685
+ clears the attention, closes the escalation unanswered and the build continues.
686
+ Answering it with a bare retry makes the janitor attempt on its next tick. An
687
+ episode raises at most one escalation; a new episode after recovery can raise
688
+ another. `policy.janitorBackoffMaxSeconds` sets the positive integer cap.
689
+ A dispatcher that cannot execute Git for kernel node work (a missing or
690
+ unloadable `git` for the bare clone) records no janitor failures. It records
691
+ one durable `dispatcher.kernel-git-unavailable` repository condition, node work
692
+ waits, and `dispatcher.kernel-git-recovered` closes the condition once a clone
693
+ succeeds.
580
694
 
581
695
  A classified forge rate limit records repository degradation with `resetAt`.
582
696
  Forge work waits during cooldown; passing the deadline permits a recovery
@@ -169,7 +169,7 @@ On any round that proceeds rather than escalates, deposit a fresh
169
169
  ## If the spec is the problem
170
170
 
171
171
  If the spec is contradictory, unbuildable, or wrong — do not plan around it.
172
- Park the build for a human:
172
+ Park the build for external judgment from the operator agent or a human:
173
173
 
174
174
  ```
175
175
  ab escalate "…the question, concretely…" --refs "$AB_CONTEXT_DIR/spec.md"
@@ -97,10 +97,11 @@ that the spec does not settle. Do not guess away either side's behavior:
97
97
  ab escalate "The target changes the session-token format but the build keys its limiter on the old format. Which behavior should the limiter adopt?" --refs src/auth.ts
98
98
  ```
99
99
 
100
- A human answer in guidance is authoritative while the spec remains the contract.
101
- If they cannot both be satisfied, escalate the contradiction. Reconcile has no
102
- code-review round; risky resolutions need human judgment. The only successful
103
- terminal commands are `ab done` and `ab escalate`.
100
+ An operator answer in guidance is authoritative while the spec remains the
101
+ contract. If they cannot both be satisfied, escalate the contradiction.
102
+ Reconcile has no code-review round; escalate risky resolutions for external
103
+ judgment. The only successful terminal commands are `ab done` and
104
+ `ab escalate`.
104
105
 
105
106
  Read the manifest path printed by `ab context`. Its `materialized` keys are
106
107
  relative to `contextDir`: join them to locate collision-adjusted inputs.
@@ -111,10 +111,23 @@ from the ticket. If grooming named no destination, omit `--state`; the create
111
111
  then uses `[tickets].createState`, or the ticket source's own default when that
112
112
  setting is absent.
113
113
 
114
+ When the work originates from a forge issue, attach it at creation and still
115
+ cite it in Evidence: `--issues 824` when the ticket fully resolves the issue
116
+ (intent `closes`, the default), or `--issues 824:refs` when it only partly
117
+ addresses it. Separate several with commas. A source that cannot store issue
118
+ links refuses the create and names itself; file again without `--issues` and
119
+ keep the Evidence citation.
120
+
121
+ When grooming established that the ticket must go next — for example a fix
122
+ that unblocks a stuck build — create it with `--priority urgent` so the
123
+ dispatcher claims it before normal ready work. Otherwise omit the flag; normal
124
+ is the default. A source that cannot store priority refuses the create and
125
+ names itself; file it normal and tell the human so the operator can expedite it.
126
+
114
127
  When the explicitly named destination equals `[tickets].readyState`, tell the
115
128
  human in the completion response that the ticket may be claimed by the next
116
129
  dispatch once the repository's label, dependency, intake, capacity, and other
117
- readiness gates are satisfied. Before ready filing, follow
130
+ readiness gates are satisfied, after any urgent ready tickets. Before ready filing, follow
118
131
  [After filing: check operator presence](#after-filing-check-operator-presence):
119
132
  with a live operator, say the existing operator will pick it up; without one,
120
133
  say you will operate it. The human's explicit instructions override either default.
@@ -122,7 +135,7 @@ say you will operate it. The human's explicit instructions override either defau
122
135
  If grooming established prerequisites, follow the complete
123
136
  [safe blocker-filing workflow](../ab-guide/references/ticket-dependencies.md).
124
137
  A single `ab ticket create --blocked-by` invocation does not publish atomically:
125
- Linear exposes the issue before separate blocker writes.
138
+ Linear and GitHub expose the issue before separate blocker writes.
126
139
  For a ready destination, create in a known non-ready staging state, pass all
127
140
  blockers at creation, read back and verify them, then move to ready last. The
128
141
  human's requested final placement still wins; temporary staging needs no new