@defrex/autobuild 1.9.0 → 1.11.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 (537) hide show
  1. package/README.md +3 -3
  2. package/SPEC.md +2232 -175
  3. package/bin/ab-dispatch-generation.ts +5 -1
  4. package/docs/accounts.md +2 -1
  5. package/docs/agent-runtimes.md +30 -3
  6. package/docs/answering-blocked-builds.md +35 -7
  7. package/docs/architecture.md +436 -63
  8. package/docs/build-store.md +10 -7
  9. package/docs/builds.md +5 -0
  10. package/docs/cli.md +40 -2
  11. package/docs/configuration-overview.md +5 -1
  12. package/docs/configuration.md +649 -74
  13. package/docs/dispatcher.md +79 -6
  14. package/docs/forges.md +8 -1
  15. package/docs/getting-started.md +1 -1
  16. package/docs/integration-overview.md +4 -2
  17. package/docs/integration-tree.md +102 -11
  18. package/docs/merge-policy.md +30 -14
  19. package/docs/migration-1.0.md +2 -1
  20. package/docs/operating.md +36 -6
  21. package/docs/operator-api.md +251 -20
  22. package/docs/operator-surfaces.md +85 -0
  23. package/docs/optimization-nodes.md +1100 -0
  24. package/docs/overview.md +1 -1
  25. package/docs/plugin-authoring.md +83 -13
  26. package/docs/remote-store-protocol.md +137 -17
  27. package/docs/remote-ticket-protocol.md +90 -2
  28. package/docs/restacking.md +119 -15
  29. package/docs/seams.md +2 -2
  30. package/docs/setup.md +27 -4
  31. package/docs/skills.md +4 -2
  32. package/docs/spec-standard.md +2 -1
  33. package/docs/ticket-dependencies.md +15 -3
  34. package/docs/ticket-migration.md +4 -2
  35. package/docs/ticket-sources.md +54 -14
  36. package/docs/tickets.md +21 -6
  37. package/docs/troubleshooting.md +11 -2
  38. package/docs/verification.md +15 -3
  39. package/docs/workspaces.md +6 -1
  40. package/package.json +9 -5
  41. package/packages/core/src/accounts/chatgpt-oauth.ts +7 -5
  42. package/packages/core/src/cli/accounts.ts +7 -2
  43. package/packages/core/src/cli/attempt.ts +103 -0
  44. package/packages/core/src/cli/attention.ts +11 -2
  45. package/packages/core/src/cli/binary-direct.ts +54 -1
  46. package/packages/core/src/cli/binary-lifecycle.ts +2 -1
  47. package/packages/core/src/cli/binary.ts +5 -3
  48. package/packages/core/src/cli/build-control.ts +407 -67
  49. package/packages/core/src/cli/context.ts +272 -15
  50. package/packages/core/src/cli/dashboard/detail.ts +26 -2
  51. package/packages/core/src/cli/dashboard/facts.ts +89 -56
  52. package/packages/core/src/cli/dashboard/header.ts +101 -0
  53. package/packages/core/src/cli/dashboard/integration-detail.ts +7 -2
  54. package/packages/core/src/cli/dashboard/landing-display.ts +15 -2
  55. package/packages/core/src/cli/dashboard/model.ts +133 -66
  56. package/packages/core/src/cli/dashboard/objective-row.ts +221 -0
  57. package/packages/core/src/cli/dashboard/poll.ts +178 -76
  58. package/packages/core/src/cli/dashboard/render.ts +172 -227
  59. package/packages/core/src/cli/dashboard/reopen-display.ts +39 -0
  60. package/packages/core/src/cli/dashboard/row-text.ts +538 -0
  61. package/packages/core/src/cli/dashboard/timeline.ts +288 -0
  62. package/packages/core/src/cli/dashboard/tree.ts +12 -1
  63. package/packages/core/src/cli/dashboard/vocabulary.ts +188 -0
  64. package/packages/core/src/cli/dispatch-args.ts +44 -1
  65. package/packages/core/src/cli/dispatch-frontend.ts +29 -30
  66. package/packages/core/src/cli/dispatch-launch-stop.ts +73 -0
  67. package/packages/core/src/cli/dispatch-launcher.ts +41 -46
  68. package/packages/core/src/cli/dispatch-repository-feed.ts +1 -1
  69. package/packages/core/src/cli/dispatch-web.ts +155 -0
  70. package/packages/core/src/cli/dispatch.ts +216 -38
  71. package/packages/core/src/cli/env.ts +42 -0
  72. package/packages/core/src/cli/help.ts +293 -12
  73. package/packages/core/src/cli/init-agent.ts +4 -1
  74. package/packages/core/src/cli/init-readiness-remote.ts +3 -2
  75. package/packages/core/src/cli/init-validation.ts +5 -5
  76. package/packages/core/src/cli/init.ts +3 -2
  77. package/packages/core/src/cli/judge-entry.ts +82 -0
  78. package/packages/core/src/cli/judge.ts +233 -0
  79. package/packages/core/src/cli/landings.ts +3 -2
  80. package/packages/core/src/cli/main.ts +481 -148
  81. package/packages/core/src/cli/mcp.ts +35 -3
  82. package/packages/core/src/cli/measurement-text.ts +19 -0
  83. package/packages/core/src/cli/objective.ts +154 -0
  84. package/packages/core/src/cli/operator-preference.ts +57 -0
  85. package/packages/core/src/cli/publication-settlement.ts +106 -22
  86. package/packages/core/src/cli/repo-lease.ts +3 -0
  87. package/packages/core/src/cli/repo-state.ts +56 -6
  88. package/packages/core/src/cli/repository-status.ts +205 -56
  89. package/packages/core/src/cli/status.ts +275 -16
  90. package/packages/core/src/cli/store-opening.ts +4 -0
  91. package/packages/core/src/cli/terminal-restore.ts +32 -7
  92. package/packages/core/src/cli/terminals.ts +205 -8
  93. package/packages/core/src/cli/ticket-start.ts +53 -0
  94. package/packages/core/src/cli/ticket.ts +166 -38
  95. package/packages/core/src/cli/upgrade-agent.ts +12 -8
  96. package/packages/core/src/cli/wait.ts +22 -8
  97. package/packages/core/src/cli/watch.ts +361 -95
  98. package/packages/core/src/cli/web.ts +139 -0
  99. package/packages/core/src/config/create-labels.ts +23 -0
  100. package/packages/core/src/config/live.ts +101 -14
  101. package/packages/core/src/config/load.ts +61 -20
  102. package/packages/core/src/config/local.ts +212 -0
  103. package/packages/core/src/config/pipeline-source.ts +3 -3
  104. package/packages/core/src/config/reference.ts +18 -0
  105. package/packages/core/src/config/roles.ts +182 -73
  106. package/packages/core/src/config/schema.ts +157 -19
  107. package/packages/core/src/events/catalog.ts +43 -3
  108. package/packages/core/src/events/compatibility.ts +7 -1
  109. package/packages/core/src/events/payloads.ts +685 -1
  110. package/packages/core/src/events/policy.ts +63 -0
  111. package/packages/core/src/events/repository.ts +153 -27
  112. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +1797 -199
  113. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/017d8dd5bb6dd80b.json.gz +0 -0
  114. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/0ab2a90d0305dc9d.json.gz +0 -0
  115. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/10a4657408d4e121.json.gz +0 -0
  116. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/1152a2e97ee81728.json.gz +0 -0
  117. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/13ca84752c5f8b54.json.gz +0 -0
  118. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/1411d1cdbdd9911e.json.gz +0 -0
  119. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/1444fe1fa7fc802c.json.gz +0 -0
  120. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/1491ac0600349391.json.gz +0 -0
  121. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/178e12f1759b7552.json.gz +0 -0
  122. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/1921f86f752428c9.json.gz +0 -0
  123. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/1972c1d66008ef6b.json.gz +0 -0
  124. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/19e8e43e7f3f1a06.json.gz +0 -0
  125. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/20a85c143c3e8164.json.gz +0 -0
  126. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/21ce2c0bf58318e1.json.gz +0 -0
  127. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/293dcb3a94fb3470.json.gz +0 -0
  128. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/2ab7436356267118.json.gz +0 -0
  129. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/2d084641735caaff.json.gz +0 -0
  130. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/3237bcecf68e5db9.json.gz +0 -0
  131. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/33d0cc593610e56f.json.gz +0 -0
  132. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/3451ed2136dcc356.json.gz +0 -0
  133. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/358ec8693f2237e6.json.gz +0 -0
  134. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/35cf9ccc4478b2d2.json.gz +0 -0
  135. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/3649e7bd1203f154.json.gz +0 -0
  136. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/378da6dece82202a.json.gz +0 -0
  137. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/38c75099d9191471.json.gz +0 -0
  138. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/398952f1f01db1a3.json.gz +0 -0
  139. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/3b64d352d56c9121.json.gz +0 -0
  140. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/3dc486226c05372d.json.gz +0 -0
  141. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/431c9bb2ee8838e0.json.gz +0 -0
  142. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/4400dffca929e2f0.json.gz +0 -0
  143. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/49064fc079964a5c.json.gz +0 -0
  144. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/4932c70a2af97faf.json.gz +0 -0
  145. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/4edded75f17742f4.json.gz +0 -0
  146. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/4f00c0f2c8afd159.json.gz +0 -0
  147. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/516a5a7aadf97587.json.gz +0 -0
  148. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/516dc6ea85d67cd7.json.gz +0 -0
  149. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/536085773daf6b58.json.gz +0 -0
  150. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/584e2ba74608e051.json.gz +0 -0
  151. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/59ffaa6974094c72.json.gz +0 -0
  152. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/5bb43afb121674c6.json.gz +0 -0
  153. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/5f0ca42af862c4ee.json.gz +0 -0
  154. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/6118031132db9bfc.json.gz +0 -0
  155. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/63107a8d58776b63.json.gz +0 -0
  156. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/63546b08d4d6fa11.json.gz +0 -0
  157. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/643d70429ce03dad.json.gz +0 -0
  158. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/677ea92572c29082.json.gz +0 -0
  159. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/6ae5bf60504d6467.json.gz +0 -0
  160. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/6bd6275061aaffa5.json.gz +0 -0
  161. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/6efdc8defc75fccb.json.gz +0 -0
  162. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/71c53d33f09d8204.json.gz +0 -0
  163. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/7267ca2757cffba7.json.gz +0 -0
  164. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/76b7d4244082b3f9.json.gz +0 -0
  165. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/7749f918c6f10968.json.gz +0 -0
  166. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/7833e42d16301424.json.gz +0 -0
  167. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/7d4edad0614adaf1.json.gz +0 -0
  168. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/837365898d04f45a.json.gz +0 -0
  169. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/85f9f0c921b8b5bb.json.gz +0 -0
  170. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/8879f57a24733897.json.gz +0 -0
  171. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/88cb9e71bdec972d.json.gz +0 -0
  172. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/89625654b02e9ac1.json.gz +0 -0
  173. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/8a0cd6dd06cc155e.json.gz +0 -0
  174. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/8aa9ca8609dc051d.json.gz +0 -0
  175. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/8c8640255bd61658.json.gz +0 -0
  176. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/8cc15eb1807c0157.json.gz +0 -0
  177. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/8ced97c44bc0af3a.json.gz +0 -0
  178. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/8d4144004720b9f8.json.gz +0 -0
  179. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/8db633ead1807f8b.json.gz +0 -0
  180. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/8e42cdbd0994ab0c.json.gz +0 -0
  181. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/9011d0f6ff955ef9.json.gz +0 -0
  182. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/916ebc5433801c41.json.gz +0 -0
  183. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/9539b995af5c54a9.json.gz +0 -0
  184. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/95f391bfd7b7dbd7.json.gz +0 -0
  185. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/9613e8fa568a9281.json.gz +0 -0
  186. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/9a68f8753bd9038d.json.gz +0 -0
  187. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/9b25e58227080094.json.gz +0 -0
  188. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/9ee3919fbd4f9458.json.gz +0 -0
  189. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/a04a34cc2717147b.json.gz +0 -0
  190. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/a0b32c12e4e6edb6.json.gz +0 -0
  191. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/a55218252707bdd3.json.gz +0 -0
  192. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/a732fd08b31522a6.json.gz +0 -0
  193. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/a98af134be2da8a9.json.gz +0 -0
  194. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/a9d206a01f9039e5.json.gz +0 -0
  195. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/abf7fe3c92c82f2d.json.gz +0 -0
  196. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/ac928b04842c00db.json.gz +0 -0
  197. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/af953392d81911da.json.gz +0 -0
  198. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/b0d877c44810ecb0.json.gz +0 -0
  199. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/b0f7c6ebb2db57fc.json.gz +0 -0
  200. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/b905c22ec17eed31.json.gz +0 -0
  201. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/bce0c54e865f4b79.json.gz +0 -0
  202. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/c68b7ee2e2610f30.json.gz +0 -0
  203. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/c7f7e0378aeea237.json.gz +0 -0
  204. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/c98cb1659eb142b6.json.gz +0 -0
  205. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/ca830adf06ed55a1.json.gz +0 -0
  206. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/cb3a219f33e437ca.json.gz +0 -0
  207. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/cf1e0c0d82567e0c.json.gz +0 -0
  208. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/d008d86d9ff77b30.json.gz +0 -0
  209. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/d1432a819d8e48c5.json.gz +0 -0
  210. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/d185ed6aa9192aff.json.gz +0 -0
  211. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/d5d5ccca80a893d8.json.gz +0 -0
  212. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/d873fad29d6c7e55.json.gz +0 -0
  213. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/db84b12316e2da4a.json.gz +0 -0
  214. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/ddf6dc967d898767.json.gz +0 -0
  215. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/dfc64de6e7bfc0a0.json.gz +0 -0
  216. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/e2f18fa32fe1f6d0.json.gz +0 -0
  217. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/e37393fed29e84c5.json.gz +0 -0
  218. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/e6a8585e2a054ff6.json.gz +0 -0
  219. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/e7e9e327baca6903.json.gz +0 -0
  220. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/e86447af0571672c.json.gz +0 -0
  221. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/ea819202d22122e5.json.gz +0 -0
  222. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/eb4535585f2e84f6.json.gz +0 -0
  223. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/eb7ddd5319d09e27.json.gz +0 -0
  224. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/eca4959b2b87ae15.json.gz +0 -0
  225. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/ee10d7959ec4843c.json.gz +0 -0
  226. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/ef1b68347966ab26.json.gz +0 -0
  227. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/f3e55425cc41f230.json.gz +0 -0
  228. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/f40042c1cdb9fd43.json.gz +0 -0
  229. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/f48466215c790a3f.json.gz +0 -0
  230. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/f5b9ace9b59351e7.json.gz +0 -0
  231. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/f8155387eb5f375c.json.gz +0 -0
  232. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/fa8f1475a55be935.json.gz +0 -0
  233. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/fb21116a15d0b1f1.json.gz +0 -0
  234. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/fe95444fbeabe592.json.gz +0 -0
  235. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/09bf0a1611d07363.json +984 -0
  236. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/10eac4988d66e161.json +1067 -0
  237. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/1a436b5fb45aee3e.json +1116 -0
  238. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/249db6f7a41f90e2.json +161 -0
  239. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/25dcb2fb6eaa83f4.json +858 -0
  240. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/2e1bdc763924616f.json +4932 -0
  241. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/30e9dabce3c4263d.json +399 -0
  242. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/3c27f918b194e3b3.json +465 -0
  243. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/4898ef339c68fa36.json +83 -0
  244. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/51816c0ffa62af6e.json +417 -0
  245. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/561bf45320062a44.json +83 -0
  246. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/5672d0233085d050.json +84 -0
  247. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/5e39f42cbdbf35ef.json +163 -0
  248. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/7771a7a2250f9964.json +868 -0
  249. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/79f0e0f4ccd43ba2.json +455 -0
  250. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/859c09edac738823.json +1086 -0
  251. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/881c491321bec99a.json +1074 -0
  252. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/965f25c3af1d2cdc.json +160 -0
  253. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/9b76d89da575ca90.json +20 -0
  254. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/9eb485320a72a9ff.json +233 -0
  255. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/a283c1f3462b1cc1.json +81 -0
  256. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/a60448c01016135e.json +18 -0
  257. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/a6584fb61b6679bd.json +97 -0
  258. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/a6e570fb126991ff.json +36 -0
  259. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/a8acf22c968b6e3d.json +81 -0
  260. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/ba7b85895bf6698e.json +1153 -0
  261. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/c88365c25b3186d3.json +543 -0
  262. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/e8f0481b23f90056.json +711 -0
  263. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/ee55782ed40ebbac.json +110 -0
  264. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/fc5082fac8167f3d.json +98 -0
  265. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/fc66408cde0b6b04.json +637 -0
  266. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/fd55c329cfe921cc.json +1069 -0
  267. package/packages/core/src/kernel/attempt-creation-key.ts +20 -0
  268. package/packages/core/src/kernel/attempt-settlement.ts +125 -0
  269. package/packages/core/src/kernel/auto-merge-default.ts +1 -3
  270. package/packages/core/src/kernel/auto-merge.ts +1 -3
  271. package/packages/core/src/kernel/build-roster.ts +230 -0
  272. package/packages/core/src/kernel/dispatch-capacity.ts +316 -40
  273. package/packages/core/src/kernel/dispatch-placement.ts +1 -1
  274. package/packages/core/src/kernel/dispatch-settings.ts +1 -4
  275. package/packages/core/src/kernel/dispatch-status.ts +3 -5
  276. package/packages/core/src/kernel/dispatch-upgrade.ts +1 -1
  277. package/packages/core/src/kernel/engine.ts +152 -18
  278. package/packages/core/src/kernel/execution-intervals.ts +61 -0
  279. package/packages/core/src/kernel/forge-checks.ts +140 -0
  280. package/packages/core/src/kernel/forge-health.ts +2 -2
  281. package/packages/core/src/kernel/generated-files.ts +43 -0
  282. package/packages/core/src/kernel/generated-regeneration.ts +254 -0
  283. package/packages/core/src/kernel/generators/build-log.ts +30 -2
  284. package/packages/core/src/kernel/generators/optimization-log.ts +679 -0
  285. package/packages/core/src/kernel/generators/panel-log.ts +133 -0
  286. package/packages/core/src/kernel/generators/repository-journals.ts +13 -0
  287. package/packages/core/src/kernel/guarded-forge.ts +76 -11
  288. package/packages/core/src/kernel/harvest.ts +1 -4
  289. package/packages/core/src/kernel/head-paths.ts +4 -1
  290. package/packages/core/src/kernel/history-retention.ts +337 -0
  291. package/packages/core/src/kernel/incremental-fixtures.ts +6 -0
  292. package/packages/core/src/kernel/incremental.ts +14 -4
  293. package/packages/core/src/kernel/integration-landing.ts +64 -13
  294. package/packages/core/src/kernel/integration-stack.ts +123 -20
  295. package/packages/core/src/kernel/integration-state.ts +39 -2
  296. package/packages/core/src/kernel/janitor-failure.ts +2 -0
  297. package/packages/core/src/kernel/kernel-git.ts +1 -1
  298. package/packages/core/src/kernel/landing-measurement.ts +275 -0
  299. package/packages/core/src/kernel/landing-readiness.ts +2 -0
  300. package/packages/core/src/kernel/landing-state.ts +20 -1
  301. package/packages/core/src/kernel/leaf-restack-base.ts +33 -7
  302. package/packages/core/src/kernel/leaf-restack-state.ts +99 -4
  303. package/packages/core/src/kernel/log-index-value.ts +2 -0
  304. package/packages/core/src/kernel/log-index.ts +100 -3
  305. package/packages/core/src/kernel/measurement.ts +406 -0
  306. package/packages/core/src/kernel/mixed-version.ts +6 -3
  307. package/packages/core/src/kernel/node-landing.ts +92 -18
  308. package/packages/core/src/kernel/node-restack-state.ts +27 -1
  309. package/packages/core/src/kernel/node-restack-transaction.ts +80 -23
  310. package/packages/core/src/kernel/node-verification-context.ts +14 -4
  311. package/packages/core/src/kernel/open-pr-backpressure-state.ts +24 -0
  312. package/packages/core/src/kernel/open-pr-backpressure.ts +133 -0
  313. package/packages/core/src/kernel/optimization-admission.ts +490 -0
  314. package/packages/core/src/kernel/optimization.ts +953 -0
  315. package/packages/core/src/kernel/panel.ts +225 -0
  316. package/packages/core/src/kernel/phase-failures.ts +121 -0
  317. package/packages/core/src/kernel/phases.ts +42 -6
  318. package/packages/core/src/kernel/pr-attachments.ts +4 -16
  319. package/packages/core/src/kernel/pr-summary.ts +2 -2
  320. package/packages/core/src/kernel/published-branch-head.ts +60 -0
  321. package/packages/core/src/kernel/read-deferrals.ts +2 -2
  322. package/packages/core/src/kernel/read-facts.ts +69 -31
  323. package/packages/core/src/kernel/reconcile-restack.ts +352 -103
  324. package/packages/core/src/kernel/reducer-identity.ts +659 -0
  325. package/packages/core/src/kernel/reducer-registry.ts +62 -9
  326. package/packages/core/src/kernel/reducer-revisions.ts +75 -0
  327. package/packages/core/src/kernel/reducer.ts +269 -11
  328. package/packages/core/src/kernel/reopen-state.ts +48 -0
  329. package/packages/core/src/kernel/reopen.ts +143 -0
  330. package/packages/core/src/kernel/replay-retention.ts +208 -39
  331. package/packages/core/src/kernel/repository-attention.ts +1 -1
  332. package/packages/core/src/kernel/rollup.ts +61 -0
  333. package/packages/core/src/kernel/service-facts.ts +19 -7
  334. package/packages/core/src/kernel/setup-streak.ts +38 -0
  335. package/packages/core/src/kernel/step-durations.ts +257 -0
  336. package/packages/core/src/kernel/target-observation.ts +6 -1
  337. package/packages/core/src/kernel/target-rewrite-recovery.ts +116 -0
  338. package/packages/core/src/kernel/terminal-guard.ts +13 -5
  339. package/packages/core/src/kernel/ticket-handbacks.ts +1 -1
  340. package/packages/core/src/kernel/ticket-migrations.ts +1 -1
  341. package/packages/core/src/kernel/ticket-preparation.ts +1 -1
  342. package/packages/core/src/kernel/ticket-source-health.ts +1 -1
  343. package/packages/core/src/kernel/ticket-starts.ts +118 -0
  344. package/packages/core/src/kernel/ticket-wait.ts +37 -2
  345. package/packages/core/src/kernel/verify-diff-base.ts +67 -0
  346. package/packages/core/src/kernel/verify-stage-state.ts +1 -0
  347. package/packages/core/src/kernel/verify-stages.ts +51 -1
  348. package/packages/core/src/objective.ts +532 -0
  349. package/packages/core/src/ontology.ts +54 -6
  350. package/packages/core/src/operator/agent-context-serve.ts +631 -0
  351. package/packages/core/src/operator/annotations.ts +105 -4
  352. package/packages/core/src/operator/attention.ts +470 -0
  353. package/packages/core/src/operator/canonical-skills.ts +35 -0
  354. package/packages/core/src/operator/cli-equivalents.ts +270 -0
  355. package/packages/core/src/operator/context-prompts.ts +61 -0
  356. package/packages/core/src/operator/control.ts +2 -1
  357. package/packages/core/src/operator/index.ts +61 -1
  358. package/packages/core/src/operator/landings.ts +28 -19
  359. package/packages/core/src/operator/optimization.ts +314 -0
  360. package/packages/core/src/operator/protocol.ts +33 -1
  361. package/packages/core/src/operator/query.ts +137 -73
  362. package/packages/core/src/operator/read-view.ts +5 -2
  363. package/packages/core/src/operator/registry.ts +625 -59
  364. package/packages/core/src/operator/requests.ts +45 -20
  365. package/packages/core/src/operator/sandbox-host.ts +107 -11
  366. package/packages/core/src/operator/sandbox-resolver.ts +253 -0
  367. package/packages/core/src/operator/sandbox.ts +778 -82
  368. package/packages/core/src/operator/ticket-asset-list.ts +77 -0
  369. package/packages/core/src/operator/ticket-assets.ts +167 -0
  370. package/packages/core/src/operator/ticket-start.ts +152 -0
  371. package/packages/core/src/operator/tickets.ts +36 -4
  372. package/packages/core/src/plugin-sdk/index.ts +24 -0
  373. package/packages/core/src/plugins/manifest.ts +1 -1
  374. package/packages/core/src/plugins/registry.ts +1 -0
  375. package/packages/core/src/ports/forge/contract.ts +9 -0
  376. package/packages/core/src/ports/forge/fake.ts +114 -2
  377. package/packages/core/src/ports/forge/git-blob.ts +15 -0
  378. package/packages/core/src/ports/forge/git-rewrite.ts +6 -4
  379. package/packages/core/src/ports/forge/github-readiness.ts +1 -1
  380. package/packages/core/src/ports/forge/github-transport.ts +156 -1
  381. package/packages/core/src/ports/forge/github.ts +388 -100
  382. package/packages/core/src/ports/forge/local-git.ts +61 -1
  383. package/packages/core/src/ports/forge/readiness.ts +15 -3
  384. package/packages/core/src/ports/forge-failure.ts +46 -0
  385. package/packages/core/src/ports/forge-request-context.ts +23 -1
  386. package/packages/core/src/ports/forge-telemetry.ts +16 -0
  387. package/packages/core/src/ports/runner/antigravity-test.fixture.ts +149 -0
  388. package/packages/core/src/ports/runner/antigravity.ts +1071 -0
  389. package/packages/core/src/ports/runner/claude-test.fixture.ts +71 -0
  390. package/packages/core/src/ports/runner/claude.ts +6 -1
  391. package/packages/core/src/ports/runner/codex-test.fixture.ts +63 -0
  392. package/packages/core/src/ports/runner/codex.ts +11 -2
  393. package/packages/core/src/ports/runner/contract.ts +25 -1
  394. package/packages/core/src/ports/runner/fake.ts +2 -2
  395. package/packages/core/src/ports/runner/native-cli-fixture.ts +40 -5
  396. package/packages/core/src/ports/runner/native-process-fixture.ts +4 -1
  397. package/packages/core/src/ports/runner/pi.ts +23 -7
  398. package/packages/core/src/ports/runner/production.ts +19 -2
  399. package/packages/core/src/ports/runner/session-env.ts +65 -5
  400. package/packages/core/src/ports/runner/start-prompt.ts +6 -4
  401. package/packages/core/src/ports/tickets/contract.ts +75 -2
  402. package/packages/core/src/ports/tickets/fake.ts +11 -0
  403. package/packages/core/src/ports/tickets/file.ts +18 -0
  404. package/packages/core/src/ports/tickets/github-fake.ts +136 -4
  405. package/packages/core/src/ports/tickets/github.ts +407 -35
  406. package/packages/core/src/ports/tickets/hosted-index.ts +16 -1
  407. package/packages/core/src/ports/tickets/labels.ts +21 -0
  408. package/packages/core/src/ports/tickets/linear.ts +163 -0
  409. package/packages/core/src/ports/tickets/migration.ts +2 -0
  410. package/packages/core/src/ports/tickets/priority.ts +20 -0
  411. package/packages/core/src/ports/tickets/remote-protocol.ts +105 -6
  412. package/packages/core/src/ports/tickets/remote.ts +203 -17
  413. package/packages/core/src/ports/tickets/search.ts +139 -0
  414. package/packages/core/src/ports/tickets/tree.ts +17 -4
  415. package/packages/core/src/ports/types.ts +202 -6
  416. package/packages/core/src/ports/workspace/builtin-capabilities.ts +16 -4
  417. package/packages/core/src/ports/workspace/commit-preservation.ts +182 -64
  418. package/packages/core/src/ports/workspace/create.ts +18 -1
  419. package/packages/core/src/ports/workspace/fake.ts +340 -12
  420. package/packages/core/src/ports/workspace/git-worktree.ts +846 -43
  421. package/packages/core/src/ports/workspace/operator-sandbox.ts +129 -12
  422. package/packages/core/src/ports/workspace/process-group.ts +48 -0
  423. package/packages/core/src/ports/workspace/vercel-sandbox.ts +1539 -221
  424. package/packages/core/src/processes/agent-context-assemble.ts +576 -0
  425. package/packages/core/src/processes/agent-context.ts +469 -0
  426. package/packages/core/src/processes/build-execution-state.ts +1 -3
  427. package/packages/core/src/processes/build-runner.ts +1982 -528
  428. package/packages/core/src/processes/dispatch-failure-budget.ts +1 -1
  429. package/packages/core/src/processes/dispatcher-selectors.ts +15 -13
  430. package/packages/core/src/processes/dispatcher.ts +3003 -308
  431. package/packages/core/src/processes/execution-no-progress.ts +40 -1
  432. package/packages/core/src/processes/execution-settlement.ts +2 -6
  433. package/packages/core/src/processes/harvest-execution-state.ts +2 -6
  434. package/packages/core/src/processes/harvest-runner.ts +7 -2
  435. package/packages/core/src/processes/infrastructure-failure-budget.ts +1 -3
  436. package/packages/core/src/processes/judge-launcher.ts +38 -0
  437. package/packages/core/src/processes/measurement-runner.ts +235 -0
  438. package/packages/core/src/processes/optimization-activity.ts +120 -0
  439. package/packages/core/src/processes/optimization-merges.ts +101 -0
  440. package/packages/core/src/processes/optimization-stop.ts +179 -0
  441. package/packages/core/src/processes/panel-runner.ts +756 -0
  442. package/packages/core/src/processes/phase-failure-budget.ts +2 -0
  443. package/packages/core/src/processes/publication-state.ts +1 -4
  444. package/packages/core/src/processes/repo-view.ts +154 -6
  445. package/packages/core/src/processes/sandbox-state.ts +54 -10
  446. package/packages/core/src/processes/tick-publication.ts +2 -0
  447. package/packages/core/src/processes/tick-state.ts +1 -3
  448. package/packages/core/src/processes/workspace-preparation.ts +76 -0
  449. package/packages/core/src/processes/workspace-preservation.ts +67 -9
  450. package/packages/core/src/scenarios/harness.ts +19 -13
  451. package/packages/core/src/store/account-redaction.ts +1 -0
  452. package/packages/core/src/store/adapter.ts +52 -1
  453. package/packages/core/src/store/agent-context.ts +432 -0
  454. package/packages/core/src/store/build-feed.ts +291 -0
  455. package/packages/core/src/store/build-scope.ts +19 -1
  456. package/packages/core/src/store/contract.ts +955 -14
  457. package/packages/core/src/store/digest.ts +104 -9
  458. package/packages/core/src/store/histogram.ts +113 -0
  459. package/packages/core/src/store/judge-authority.ts +161 -0
  460. package/packages/core/src/store/local/schema.ts +62 -0
  461. package/packages/core/src/store/local/store.ts +628 -22
  462. package/packages/core/src/store/local/ticket-asset-heads.ts +23 -0
  463. package/packages/core/src/store/memory.ts +461 -69
  464. package/packages/core/src/store/open-builds.ts +19 -0
  465. package/packages/core/src/store/phase-session.ts +256 -6
  466. package/packages/core/src/store/reduced-reads.ts +24 -4
  467. package/packages/core/src/store/reducer-value-shapes.json +18023 -11824
  468. package/packages/core/src/store/reducer-values.ts +6 -1
  469. package/packages/core/src/store/remote/client.ts +220 -4
  470. package/packages/core/src/store/remote/compatibility.ts +1 -1
  471. package/packages/core/src/store/remote/credentials.ts +31 -1
  472. package/packages/core/src/store/remote/index.ts +41 -0
  473. package/packages/core/src/store/remote/protocol.ts +107 -0
  474. package/packages/core/src/store/remote/released-clients.json +22 -0
  475. package/packages/core/src/store/remote/released-reducer-values/1.10.0.json +34439 -0
  476. package/packages/core/src/store/remote/released-reducer-values/1.11.0.json +35680 -0
  477. package/packages/core/src/store/remote/released-reducer-values/index.ts +20 -16
  478. package/packages/core/src/store/remote/token.ts +13 -4
  479. package/packages/core/src/store/repo-state-events.ts +6 -8
  480. package/packages/core/src/store/retention.ts +23 -1
  481. package/packages/core/src/store/rollups.ts +337 -0
  482. package/packages/core/src/store/session-handle.ts +20 -2
  483. package/packages/core/src/store/session-reducer.ts +1 -4
  484. package/packages/core/src/store/snapshots.ts +10 -0
  485. package/packages/core/src/store/ticket-assets.ts +1 -3
  486. package/packages/core/src/store/types.ts +117 -9
  487. package/packages/core/src/testing/dispatch-read-budget.ts +1162 -2
  488. package/packages/core/src/testing/git-config-isolation.ts +27 -0
  489. package/packages/core/src/testing/index.ts +40 -0
  490. package/packages/core/src/testing/memory-operator-sandbox.ts +346 -0
  491. package/packages/core/src/testing/reduced-read-budget.ts +5349 -153
  492. package/packages/core/src/web/analytics-source.ts +303 -0
  493. package/packages/core/src/web/assets/Atkinson-OFL.txt +93 -0
  494. package/packages/core/src/web/assets/AtkinsonHyperlegibleNext.latin.woff2 +0 -0
  495. package/packages/core/src/web/assets/JetBrains-OFL.txt +93 -0
  496. package/packages/core/src/web/assets/JetBrainsMono.latin.woff2 +0 -0
  497. package/packages/core/src/web/assets/app.css +1 -0
  498. package/packages/core/src/web/assets/app.js +9 -0
  499. package/packages/core/src/web/assets/manifest.json +31 -0
  500. package/packages/core/src/web/assets/theme.js +1 -0
  501. package/packages/core/src/web/bounded.ts +31 -0
  502. package/packages/core/src/web/http.ts +315 -0
  503. package/packages/core/src/web/hub.ts +160 -0
  504. package/packages/core/src/web/options.ts +38 -0
  505. package/packages/core/src/web/overview-source.ts +322 -0
  506. package/packages/core/src/web/page.ts +56 -0
  507. package/packages/core/src/web/protocol.ts +151 -0
  508. package/packages/core/src/web/read-only.ts +23 -0
  509. package/packages/core/src/web/repository-source.ts +35 -0
  510. package/packages/core/src/web/server.ts +97 -0
  511. package/skills/code-review/SKILL.md +26 -2
  512. package/skills/finalize/SKILL.md +10 -4
  513. package/skills/guide/SKILL.md +743 -123
  514. package/skills/guide/references/accounts.md +2 -1
  515. package/skills/guide/references/integration-tree.md +102 -11
  516. package/skills/guide/references/merge-policy.md +30 -14
  517. package/skills/guide/references/migration-1.0.md +2 -1
  518. package/skills/guide/references/operator-api.md +251 -20
  519. package/skills/guide/references/optimization-nodes.md +1100 -0
  520. package/skills/guide/references/plugin-authoring.md +83 -13
  521. package/skills/guide/references/remote-store-protocol.md +137 -17
  522. package/skills/guide/references/remote-ticket-protocol.md +90 -2
  523. package/skills/guide/references/restacking.md +119 -15
  524. package/skills/guide/references/setup.md +27 -4
  525. package/skills/guide/references/spec-standard.md +2 -1
  526. package/skills/guide/references/ticket-dependencies.md +15 -3
  527. package/skills/guide/references/ticket-migration.md +4 -2
  528. package/skills/implement/SKILL.md +74 -5
  529. package/skills/judge/SKILL.md +43 -0
  530. package/skills/operate/SKILL.md +374 -57
  531. package/skills/plan/SKILL.md +28 -4
  532. package/skills/plan-review/SKILL.md +24 -3
  533. package/skills/propose/SKILL.md +121 -0
  534. package/skills/reconcile/SKILL.md +21 -2
  535. package/skills/spec/SKILL.md +63 -11
  536. package/skills/tickets/SKILL.md +94 -9
  537. package/templates/hosted-service/package.json +2 -2
@@ -0,0 +1,1100 @@
1
+ ---
2
+ title: "Optimization nodes"
3
+ group: "concepts"
4
+ description: "Let a node propose, measure and land its own attempts toward a metric or a judge panel, within a budget you approve once."
5
+ label: "Optimization"
6
+ order: 4.5
7
+ ---
8
+
9
+ # Optimization nodes
10
+
11
+ An optimization node is a node whose spec declares an objective: a metric, a
12
+ direction or a judge panel, a target, a budget and a purpose. Instead of
13
+ collecting children a human filed, it proposes its own attempts, measures each
14
+ one against its current head with a ruler the attempts cannot edit, lands only
15
+ the ones that improve it, and moves the rest to the rejected role. It stops on
16
+ a threshold, a plateau, its budget or your word, and then lands like any other
17
+ node, once you approve it.
18
+
19
+ This page covers when to use one, how a run goes from start to finish, how to
20
+ write the objective, and then the full contract: how the marker is found, what
21
+ refuses an objective, how a node and its attempts are measured, how the
22
+ objective is revised, which facts the log records, what is derived from them,
23
+ how the node proposes its own attempts, and how it stops and completes. The
24
+ objective is the only marker. The ticket's `kind` stays `node`, and no label,
25
+ ticket state or source setting marks it. Because the marker makes a node file
26
+ and dispatch its own work, the rules below leave no room for a false positive
27
+ and no silent fallback in either direction.
28
+
29
+ ## When to use one
30
+
31
+ Use an optimization node when:
32
+
33
+ - the goal is to improve a number, or a judgment two variants can be compared
34
+ on, rather than to ship a known change;
35
+ - you don't know which strategy will work, and many independent tries are
36
+ cheaper than deciding up front;
37
+ - a harness that attempts cannot edit can measure the code being improved.
38
+
39
+ Don't use one when the change is already known (file a work ticket or a plain
40
+ node), when two identical runs disagree by more than the gain you care about
41
+ (see the noise check under [opening](#opening)), when success needs
42
+ product judgment no rubric captures, or when your ticket source has no
43
+ rejected role.
44
+
45
+ ## A run, end to end
46
+
47
+ 1. You groom the node ticket with an objective block; see
48
+ [grooming an optimization node](#grooming-an-optimization-node).
49
+ 2. The dispatcher [opens](#opening) the node and pins the harness at its
50
+ opening commit.
51
+ 3. The node measures its opening head against itself for a starting value and
52
+ runs the [noise check](#opening).
53
+ 4. The [proposer](#proposer-phase) reads the objective and the ledger of
54
+ earlier attempts and proposes strategies; the dispatcher files each as a
55
+ ready attempt ticket that targets the node.
56
+ 5. Each [attempt](#attempts) builds like any work ticket: plan, review,
57
+ implement, review, verify.
58
+ 6. The [landing gate](#landing-and-settlement) measures each attempt against
59
+ the current node head, ratchet-style. An attempt lands only when it
60
+ improves the head; a sibling that lands first makes the others measure
61
+ again.
62
+ 7. Attempts that don't improve the head, or that their implementer declines,
63
+ close unmerged and their tickets move to the rejected role.
64
+ 8. The node [stops](#stopping-and-completion) on its threshold, a plateau,
65
+ its budget, an empty proposal or your `ab objective <node> --stop`.
66
+ 9. Once nothing is in flight, the node completes and verifies.
67
+ 10. You [land it](#landing-the-node) with `ab merge <node>`.
68
+
69
+ ## The marker
70
+
71
+ A node becomes an optimization node only when its spec carries exactly one
72
+ fenced block whose info string is exactly `autobuild-objective`.
73
+
74
+ The scan follows CommonMark fences:
75
+
76
+ - A fence opens on a line indented at most three spaces with three or more
77
+ backticks or tildes, and closes on a line of the same character, at least as
78
+ long, carrying no info string.
79
+ - Only a fence whose trimmed info string equals `autobuild-objective`,
80
+ case-sensitively, counts.
81
+ - A backtick line whose info string contains a backtick is inline code, not a
82
+ fence.
83
+
84
+ None of these count:
85
+
86
+ - a fence nested inside another open fence, so a Markdown example that shows
87
+ the block (as below) never marks the spec that contains it;
88
+ - a fence line that begins with a blockquote or list marker, or is indented
89
+ four or more spaces;
90
+ - a fence inside an HTML block, such as an HTML comment, so a commented-out
91
+ example never counts;
92
+ - a heading named "Objective";
93
+ - a `toml` block, or a fence with any other info string, such as
94
+ `Autobuild-Objective` or `autobuild-objective toml`;
95
+ - prose describing an objective, and inline code.
96
+
97
+ A node spec with no block is a plain node. A work ticket that carries the
98
+ block is refused at dispatch; see [Refusals](#refusals).
99
+
100
+ ## The objective
101
+
102
+ The block's content is TOML. This command objective is valid as written:
103
+
104
+ ````markdown
105
+ ```autobuild-objective
106
+ purpose = """
107
+ p95 latency of the catalog search query, because users wait on it at every
108
+ keystroke. Results, their order and the query's semantics must not change.
109
+ """
110
+
111
+ [metric]
112
+ kind = "command" # or "panel"
113
+ command = "bun bench/search.ts" # prints one JSON object: {"value": <number>}
114
+ direction = "minimize"
115
+ samples = 7 # paired runs per side
116
+ harness = ["bench/search/**", "bench/fixtures/catalog.sql"]
117
+
118
+ [target]
119
+ threshold = 40 # milliseconds; optional
120
+ epsilon = { relative = 0.03 } # or { absolute = 2 }
121
+
122
+ [budget] # at least one limit is required
123
+ maxAttempts = 60
124
+ maxHours = 24
125
+
126
+ [stop]
127
+ plateau = { attempts = 12 } # optional
128
+ mode = "abort" # or "drain"; default "abort"
129
+
130
+ [proposer]
131
+ concurrency = 4 # attempts in flight
132
+ ```
133
+ ````
134
+
135
+ A panel replaces the metric for work without a mechanical measure. Judges
136
+ compare two variants and state a preference, so a panel always maximizes a win
137
+ rate:
138
+
139
+ ```toml
140
+ [metric]
141
+ kind = "panel"
142
+ judges = 5
143
+ rubric = "evals/prose-rubric.md" # a harness path
144
+ harness = ["evals/**"]
145
+ ```
146
+
147
+ ### Schema
148
+
149
+ Every table is strict: an unknown key is refused and named, for example
150
+ `unknown field metric.cmd`. The stored objective is the normalized form, with
151
+ defaults applied.
152
+
153
+ | Field | Required | Constraint | Default |
154
+ |---|---|---|---|
155
+ | `purpose` | yes | Nonblank string. | — |
156
+ | `metric.kind` | yes | `"command"` or `"panel"`. | — |
157
+ | `metric.command` | command | Nonblank string. Refused for a panel. | — |
158
+ | `metric.direction` | command | `"minimize"` or `"maximize"`. Refused for a panel. | — |
159
+ | `metric.samples` | command | Integer from 1 to 100. Refused for a panel. | — |
160
+ | `metric.judges` | panel | Integer from 1 to 20. Refused for a command. | — |
161
+ | `metric.rubric` | panel | A literal repository-relative path, no `*` or `?`, matched by `metric.harness`. Refused for a command. | — |
162
+ | `metric.harness` | yes | Nonempty array of path selectors (below). | — |
163
+ | `target.epsilon` | yes | Exactly one of `{ absolute = n }` with n > 0, or `{ relative = n }` with 0 < n < 1. A panel accepts only an absolute value below 0.5. | — |
164
+ | `target.threshold` | no | A number. A panel threshold is a win rate in (0.5, 1]. | none |
165
+ | `budget.maxAttempts` | at least one | Integer ≥ 1. | none |
166
+ | `budget.maxHours` | at least one | Number > 0. | none |
167
+ | `stop.plateau.attempts` | no | Integer ≥ 1. | none |
168
+ | `stop.mode` | no | `"abort"` or `"drain"`. | `"abort"` |
169
+ | `proposer.concurrency` | no | Integer ≥ 1. | `1` |
170
+
171
+ Harness entries are path selectors, the grammar `[[merge]]` and verify `paths`
172
+ already use: positive, repository-relative, case-sensitive Git-style globs made
173
+ of literal characters, `*`, `?` and whole-segment `**`. Absolute paths,
174
+ backslashes, negation, empty or `.`/`..` segments, character classes, braces
175
+ and extglobs are refused, naming the entry, for example
176
+ `metric.harness[1]: path selectors must be repository-relative`.
177
+
178
+ ## Refusals
179
+
180
+ Each refusal names its reason:
181
+
182
+ | Condition | Reason |
183
+ |---|---|
184
+ | Two or more blocks | `exactly one autobuild-objective block (found N)` |
185
+ | A block never closed | `a valid autobuild-objective block: the fence is never closed` |
186
+ | A TOML syntax error | `a valid autobuild-objective block: TOML syntax error at line L: …` |
187
+ | A schema failure | `a valid autobuild-objective block: <field>: <message>`, for example `metric.rubric: must be inside metric.harness` |
188
+ | No budget limit | `a budget limit in the autobuild-objective block: set budget.maxAttempts or budget.maxHours` |
189
+ | No rejected role in the ticket source | `a rejected role for optimization attempts: set [tickets].rejectedState` |
190
+ | A work ticket carrying the block | `no autobuild-objective block in a work ticket: the block marks an optimization node (file it with --kind node)` |
191
+
192
+ The dispatcher checks the ticket body when it prepares a claimed ticket, before
193
+ any spec authoring. A refusal bounces the ticket back to triage with a comment
194
+ naming every reason and creates no build. A refused node never opens as a plain
195
+ node instead. Fix the block, or file the ticket with `--kind node`, and move it
196
+ to ready again.
197
+
198
+ ## Grooming an optimization node
199
+
200
+ The node ticket is still a spec-standard charter, with what and why,
201
+ acceptance criteria, out of scope and evidence. The block adds what to
202
+ improve and when to stop.
203
+
204
+ ### Writing the purpose
205
+
206
+ Write the purpose for an agent that will try to game the number. Say why
207
+ the metric matters, what it stands in for, and what must not change while it
208
+ moves: behavior, output, semantics, interfaces. "p95 latency of catalog search,
209
+ because users wait on it at every keystroke; results and their order must not
210
+ change" is a purpose. "Make search faster" is not.
211
+
212
+ ### Choosing the harness
213
+
214
+ Choose the harness as everything that decides the number. Include the
215
+ measurement command's script, its fixtures and datasets, and a panel's rubric.
216
+ The harness is the ruler, pinned at the node's opening commit (`harnessPin`),
217
+ not the code under improvement, so leave that code out. Keep selectors narrow:
218
+ a harness that covers the code being optimized pins the very code attempts are
219
+ meant to change.
220
+
221
+ ### Measuring where builds run
222
+
223
+ Measure the evidence, the threshold and ε in the environment builds run in.
224
+
225
+ - With a remote workspace such as a sandbox, get the benchmark run there.
226
+ - If you can't, say so in the evidence. Leave the threshold out, and set it
227
+ with `ab objective <node> --threshold n` once the node reports its starting
228
+ value.
229
+ - Why: absolute timings from a workstation don't transfer to a sandbox. The
230
+ node's opening measurement and noise check run in the build environment, so
231
+ a threshold or ε from elsewhere may be unreachable or below the noise.
232
+
233
+ ### Choosing ε and the noise check
234
+
235
+ Choose ε above the noise. ε is the smallest gain worth landing. Run the
236
+ command several times on the same tree first, in the environment builds run
237
+ in. If the median moves by more than
238
+ your ε between identical runs, raise ε or `samples`. The node checks this when
239
+ it opens: its starting measurement raises `optimization.noise-exceeded` when ε
240
+ is below the measured spread. A panel node judges its opening head against
241
+ itself the same way; raise ε or `judges` if that panel strays from 0.5 by more
242
+ than ε. A relative ε suits
243
+ metrics whose scale may change; an absolute ε suits metrics with a natural
244
+ unit. A panel's ε is a win-rate margin above 0.5, such as 0.1.
245
+
246
+ When the check fires, `ab watch` reports the node's
247
+ `optimization.noise-exceeded` as attention, naming ε and the spread. The node
248
+ still opens and runs. Raise ε in place with `ab objective <node> --epsilon …`
249
+ (see [revisions](#revisions)), or raise `samples` or `judges` with a spec
250
+ revision, before the gate starts accepting noise.
251
+
252
+ ### Writing a panel rubric
253
+
254
+ Write a panel's rubric for comparing two variants. Judges see two
255
+ variants side by side and say which is better, so write criteria a reader can
256
+ apply to a pair: "which explains the setup steps in fewer, clearer sentences"
257
+ compares; "scores 1–10 on clarity" does not. Name what must not be traded away,
258
+ and say that text written for the judges rather than for the reader counts
259
+ against a variant. Keep the rubric and any fixtures the judges read inside the
260
+ harness, so the pin fixes them. Choose `judges` for cost against noise: each
261
+ judge costs one agent session per comparison when its primary target succeeds,
262
+ and more judges narrow the win rate's spread. A judge that falls back to
263
+ provider alternates, or is retried after a failure, runs one more session for
264
+ each alternate or retry. Five suits most prose; use more when a single preference
265
+ should not decide an ε of 0.1. See [judge panels](#judge-panels).
266
+
267
+ ### Choosing a budget
268
+
269
+ Choose a budget you would sign off on unattended. It is the limit a human
270
+ approves once for the whole run. `maxAttempts` bounds cost; `maxHours` bounds
271
+ [active hours](#active-hours): time the node's attempts, proposer or
272
+ measurements actually run, not wall-clock time since opening. Time an attempt
273
+ spends queued for a slot, parked on an escalation or paused is not charged. Set a plateau when a run of failed strategies should end the search
274
+ early. Set a threshold only when there is a value at which you would stop
275
+ looking. Use `concurrency` above 1 only when attempts are independent enough to
276
+ run side by side.
277
+
278
+ ### Configure the rejected role
279
+
280
+ Configure the rejected role first. The ticket source must name
281
+ `[tickets].rejectedState`, or the node is refused. Every attempt that does not
282
+ land ends there.
283
+
284
+ ## Opening
285
+
286
+ Opening an optimization node records `optimization.objective-accepted` with the
287
+ objective, revision 1, a `harnessPin` equal to the node's opening commit, and
288
+ the spec revision it was parsed from. It is recorded before `node.opened`, so an
289
+ opened optimization node always has an accepted objective.
290
+
291
+ Every optimization node then measures its opening head against itself and
292
+ records `optimization.baseline-measured` with the starting value and the noise
293
+ spread. A command node uses the objective's pairing and sample count (see
294
+ [Measurement](#measurement)). A panel node runs one
295
+ [judge panel](#judge-panels) of its harness pin against itself: its starting
296
+ value is 0.5, and its spread is the distance of that self-comparison win rate
297
+ from 0.5. The dispatcher admits that run as it admits a node verification: the
298
+ node takes a runner slot, gets a workspace for the run, and releases it once
299
+ the starting value is recorded.
300
+
301
+ **Noise check.** When ε, in metric units, is smaller than the measured spread,
302
+ the gate would accept noise. A panel's ε is a win-rate margin, compared with
303
+ the self-comparison's distance from 0.5. The node records
304
+ `optimization.noise-exceeded` naming both numbers, which `ab watch` reports as
305
+ attention. The node still opens: raise `target.epsilon` with `ab objective`,
306
+ or raise `metric.samples` (a command) or `metric.judges` (a panel) with a spec
307
+ revision. A relative ε over a starting value of 0 is 0, so any spread exceeds
308
+ it.
309
+
310
+ ## Revisions
311
+
312
+ Two paths change the objective of an open optimization node.
313
+
314
+ **Quick revision.** `ab objective <node>` shows the effective objective and
315
+ progress. Flags revise the knobs that only change when to stop, how much to
316
+ spend or how large a gain must be:
317
+
318
+ ```sh
319
+ ab objective <node> [--threshold n] [--epsilon n|n%] [--max-attempts n] \
320
+ [--max-hours n] [--plateau n] [--stop-mode abort|drain] [--concurrency n] \
321
+ [--json] [--store <ref>]
322
+ ab objective <node> --stop [--drain | --abort] [--json] [--store <ref>]
323
+ ```
324
+
325
+ `--epsilon 2` is absolute; `--epsilon 3%` is relative 0.03. A revision records
326
+ `optimization.objective-revised` with the changes and the next revision, then
327
+ shows the result. The operator tool `optimization.revise` does the same; see the
328
+ [operator API](operator-api.md#optimization-objective-revision). Both refuse a
329
+ build that is not a node, a node with no accepted objective and a terminal node,
330
+ and the revised objective must still validate. Running attempts are unaffected
331
+ and nothing is replanned: the dispatcher checks the revised threshold, budget
332
+ and plateau on its next tick, so lowering the threshold to the current value or
333
+ the budget to what was already spent stops the node then. A stop is final; a
334
+ revision after it is recorded but never resumes proposing. `--stop` is
335
+ described under [stopping and completion](#stopping-and-completion).
336
+
337
+ **Spec revision.** `ab answer <node> --revise-spec <file>` or
338
+ `--revise-spec-from-ticket` changes anything else: the metric, the harness or
339
+ the purpose. The replacement may change the objective, but it must keep exactly
340
+ one valid block:
341
+
342
+ - removing the block from an optimization node is refused; close the node and
343
+ open a new one instead;
344
+ - adding a block to a plain node or a work build is refused;
345
+ - an invalid replacement block is refused, naming the field.
346
+
347
+ A refused revision records nothing. After an accepted one, the dispatcher
348
+ records `optimization.objective-accepted` again with the next revision. When the
349
+ metric changed, or the purpose of a panel (judges read it), it pins the harness
350
+ again at the current node head and starts a new ruler: earlier measurements stay
351
+ in history but are never compared with new ones, and the node measures the new
352
+ pin against itself for a new starting value and noise check; a panel node runs
353
+ a new self-comparison panel. Otherwise the pin is unchanged.
354
+
355
+ A quick revision is never written back to the ticket. `ab ticket show` prints
356
+ the effective objective of an open optimization node and marks each field that
357
+ differs from the ticket's block `(revised)`, so a stale ticket is visible. The
358
+ open build, not the ticket body, decides this: when an edit removes the block or
359
+ leaves it invalid, every field is marked.
360
+ `ab ticket tree` labels the ticket `[node, optimization]`, and status labels the
361
+ build `optimization node`.
362
+
363
+ ## Measurement
364
+
365
+ A measurement compares two heads in one execution, so both sides run on the
366
+ same hardware. A stored number from another machine is never a baseline.
367
+
368
+ **Pairing.** The measurer makes two detached worktrees, one at the candidate
369
+ and one at the baseline. A round runs the metric command once in each, and
370
+ the rounds alternate which side runs first, so a warming cache or a
371
+ throttling CPU cancels out. There are `samples` rounds. When `[commands].setup`
372
+ is configured, it runs once in each worktree first, because a fresh worktree
373
+ has no installed dependencies.
374
+
375
+ **Harness pinning.** Before any run, every path matched by `metric.harness` is
376
+ overwritten in both worktrees with its contents at `harnessPin`, and a harness
377
+ file the pin lacks is deleted. A candidate that edits the benchmark, or a
378
+ harness change arriving through a node restack, never moves the ruler.
379
+ Attempts can read and run the harness; they cannot change what counts.
380
+
381
+ **Output contract.** Each run must exit 0 and print exactly one JSON object
382
+ whose `value` is a finite number, such as `{"value": 41.7}`. Each run, and each
383
+ setup run, has a 30-minute timeout.
384
+
385
+ **Decision.** The value of a side is the median of its samples. The delta is
386
+ positive for an improvement: `baseline − candidate` when minimizing,
387
+ `candidate − baseline` when maximizing. ε in metric units is the absolute ε,
388
+ or the relative ε times the baseline median's magnitude. A delta of at least ε
389
+ is `improved`; anything less is `no-improvement`. A starting measurement's
390
+ value is the median of all samples, and its spread is the distance between the
391
+ two sides' medians. A panel decides by win rate instead, with ties counted as
392
+ half: a win rate of at least 0.5 + ε is `improved`, so 3 of 5 judges meets an
393
+ ε of 0.1, and anything less is `no-improvement`. Its delta is
394
+ `winRate − 0.5`.
395
+
396
+ **Spread beside every delta.** A command's `attempt.measured` carries the
397
+ node's starting spread as `spread`, and `ab watch` prints it next to the
398
+ delta, such as `delta 6 (noise ±0.4)`. The raw per-sample values, or a
399
+ panel's judgments, are deposited as a `measurement-samples` artifact
400
+ referenced by `report`.
401
+
402
+ **Attempts.** An `attempt.measurement-requested` names the candidate, the
403
+ baseline, the harness pin, the objective revision and the node's metric. A
404
+ panel request also carries the objective's purpose, which its judges read. A
405
+ parked attempt with such a request takes a runner slot as a re-verify does,
406
+ and its runner samples in the attempt's own workspace and records
407
+ `attempt.sampled`. For a panel, the runner runs one [judge
408
+ panel](#judge-panels) of the attempt's head against the node head and records
409
+ the win rate, with the judge count as `samples`. The runner reads only its own
410
+ build, so the dispatcher decides: it reads the node once, checks that the
411
+ request's revision and harness pin are still the node's ruler, and records
412
+ `attempt.measured` using the node's current ε and, for a command, its starting
413
+ spread. A panel decision needs no starting value. A quick ε revision made while
414
+ the samples ran therefore applies. A request whose ruler or pin was replaced
415
+ while it was sampled records no decision; the attempt needs a fresh request.
416
+ A request whose baseline is no longer the node head the attempt last observed
417
+ is skipped before sampling: it takes no slot, and the landing gate requests a
418
+ current pair once the attempt has restacked. The recorded decision and the
419
+ landing gate use the same effective ε, so they always agree.
420
+
421
+ **Failures.** None of these record a value or a decision:
422
+
423
+ - the command exits nonzero, times out, or prints anything other than one
424
+ JSON object with a numeric `value`;
425
+ - a worktree or setup command fails;
426
+ - a judge panel fails: a judge failed twice, or the variants could not be
427
+ prepared;
428
+ - a request names no metric, a panel request names no purpose, or its ruler
429
+ is no longer the node's.
430
+
431
+ Instead, the build escalates with target `measurement` and policy cause
432
+ `measurement-failed`. The question names the cause, the failing sample and
433
+ the output tail. Answering a runner failure measures again; for a panel the
434
+ answer starts a fresh panel, while a crash resumes the same one and keeps its
435
+ judgments. Abort still aborts. A refusal of samples taken under a replaced ruler stays refused after
436
+ the answer, because sampling the same request again cannot succeed.
437
+
438
+ ## Judge panels
439
+
440
+ A panel objective is measured by agent judges instead of a command. A panel
441
+ run compares two heads, a candidate and a baseline, under one harness pin, and
442
+ returns the candidate's win rate. A panel node runs one for its starting
443
+ measurement (its pin against itself; see [Opening](#opening)) and one for its
444
+ progress after each accepted attempt. Attempt acceptance runs a panel against the current node head and records
445
+ its decision in `attempt.measured.winRate` (see [Measurement](#measurement)
446
+ and [Landing and settlement](#landing-and-settlement)).
447
+
448
+ **Progress.** After each accepted attempt the node runs one panel: the head the
449
+ attempt landed as (the candidate) against the starting head (the baseline). It
450
+ records the win rate as `optimization.progress-measured`, which becomes the
451
+ node's current value; a panel threshold is that win rate. Every accepted head
452
+ gets its own panel, in landing order. While a progress panel is owed, the
453
+ node's next child waits to land (landing verdict `wait-progress`), so the node
454
+ head never moves past an unmeasured head. Progress is measured while a node
455
+ drains after a stop, too.
456
+
457
+ **Node panel failures.** A failed starting or progress panel records no value.
458
+ The node escalates with target `measurement` and policy cause
459
+ `measurement-failed`, naming the judge and its last outcome. A restart before
460
+ the answer resumes the same run. Answering it runs a new panel with fresh
461
+ judges.
462
+
463
+ **The run.** `panel.started` records the run's inputs: the candidate, the
464
+ baseline, the harness pin, the purpose, the rubric path, the harness and the
465
+ judge count. Every judge then runs in its own session, all of them at once,
466
+ under the `judge` role. Judges are build sessions, so the build's profile
467
+ applies to them.
468
+
469
+ **Blind, pinned variants.** Each judge gets a fresh root in the system
470
+ temporary directory, outside any repository. The root holds the two variants
471
+ as plain trees labeled `A/` and `B/`, a brief, and the `ab-judge` skill. Each
472
+ judge's order is drawn at random. Both trees carry the exact committed bytes
473
+ at every path, with no line-ending, filter or keyword conversion. Every harness
474
+ path, the rubric included, carries the harness pin's bytes, and a harness file
475
+ the pin lacks is absent. The skill is copied from the harness pin's
476
+ `.agents/skills/ab-judge/SKILL.md`, so a candidate cannot rewrite its own
477
+ judges' instructions. The variants are checked out from private Git material
478
+ outside the roots, and that material is deleted before any judge starts.
479
+
480
+ **Protected locations.** The workspace, its checkout, its Git common directory,
481
+ the main checkout that owns that directory, and a local store are protected
482
+ locations. Before writing anything, the runner refuses a temporary directory
483
+ at or under one of them. It checks each judge root again after preparing it.
484
+ Git discovery from the scratch location runs across filesystem boundaries, and
485
+ only a clean "not a git repository" counts as outside. Any other result, such
486
+ as a dubious-ownership error, fails the run. A failed check names the cause,
487
+ not the path. Point `TMPDIR` outside any repository.
488
+
489
+ **What a judge can learn.** Nothing Autobuild gives a judge reveals which
490
+ variant is the candidate or where it came from. That covers its context, its
491
+ environment, its labels, the location and names of its variant trees, its
492
+ store credential, any Git metadata reachable from its working directory, its
493
+ `ab` command and that command's process arguments. Nothing under the judge's
494
+ root links back to the repository it was prepared from, and no value Autobuild
495
+ supplies names a protected location.
496
+
497
+ - The judge's inherited environment is scrubbed: every value that names a
498
+ protected location is dropped, such as `INIT_CWD` or `npm_package_json`, and
499
+ so is every `PATH` entry under one. A path counts whether it names the real
500
+ location or reaches it through a symlinked checkout, ancestor or file, and
501
+ whether it stands alone, follows a prefix such as `-I`, or sits on one line
502
+ of a multiline value; a path that cannot be resolved is dropped as well. This can also drop a provider variable
503
+ whose value points inside the repository. Keep runtime credentials and tools
504
+ outside it.
505
+ - The judge's `ab` is a self-contained, judge-only launcher written beside the
506
+ roots in the temporary directory. It is not a path into the Autobuild
507
+ installation. It runs `ab judge context` and `ab judge prefer` and refuses
508
+ every other command. Its content names no protected location and no
509
+ installation path, and it runs as `bun <launcher> judge …`.
510
+ - If the `bun` interpreter or the judge runtime's executable resolves only at
511
+ or under a protected location, for example only in the repository's
512
+ `node_modules/.bin`, the run fails before any judge starts. Install both
513
+ outside the repository. A runtime that would load Autobuild files from a
514
+ protected location by path fails the judge's start the same way: the `pi`
515
+ runtime does this with its bridge extension when Autobuild is installed
516
+ inside the repository.
517
+
518
+ The guarantee covers what Autobuild supplies. A judge process that
519
+ deliberately searches the filesystem outside its root, for example through
520
+ `/proc`, the home directory or a scan for repositories, crosses the shared
521
+ trust boundary of unconfined local agent sessions. Autobuild does not claim a
522
+ general sandbox.
523
+
524
+ **The order is recorded where judges cannot read it.** The kernel records each
525
+ judge's order in `panel.judge-started` before the session starts. No judge
526
+ channel reads the log. The judge's environment carries `AB_JUDGE`
527
+ (`<build>:<panel>:<judge>`), `AB_SESSION` and `AB_CONTEXT_DIR`. Only with a
528
+ remote store does it also carry `AB_STORE` and a `build-judge` credential in
529
+ `AB_TOKEN`. It carries no `AB_BUILD`, no `AB_PHASE`, no inherited `AB_*` or
530
+ `GIT_*` value and no `PWD`. A judge never learns a local store's path. The
531
+ remote credential is write-only: it can append exactly one `panel.preferred`
532
+ for its own panel, judge and session while the session is open, and every read
533
+ is refused. Any read command run with `AB_JUDGE` set fails.
534
+
535
+ **The terminal.** A judge runs `ab judge context`, which writes `purpose.md`,
536
+ `rubric.md` and `context.json` from its brief and reads no store. It compares
537
+ `A/` and `B/` and ends with exactly one
538
+ `ab judge prefer <A|B|tie> --reason "<paragraph>"`. The reason must not be
539
+ blank, and a second call is refused. With a remote store, the preference is
540
+ appended over the write-only credential. The server checks the session and
541
+ appends in one conditional step, so two concurrent calls from one session
542
+ record at most one preference, and the other is refused. With a local store,
543
+ `ab judge prefer` saves the preference once to `preference.json` in the
544
+ judge's context directory, and a second or concurrent call is refused. The
545
+ runner commits that file as the judge's `panel.preferred` when the turn ends,
546
+ with the same atomic check. After the turn, the kernel records `panel.judged`
547
+ with the judge's index, its order, the preference and the reason.
548
+
549
+ **Win rate.** A judge who prefers the candidate scores 1, a tie scores 0.5 and
550
+ a preference for the baseline scores 0. The win rate is the mean over the
551
+ recorded judgments, so ties count as half.
552
+
553
+ **Resumption.** A run resumed after a crash or restart keeps every recorded
554
+ judgment. A dangling session is closed as `reclaimed`. A preference a local
555
+ judge saved before the crash is committed first, while its session is still
556
+ open. A dangling session's stream, if it has one, is closed after that
557
+ commit and before the `reclaimed` end. A judge whose preference was recorded is completed from that preference
558
+ and its recorded order without a new session. Only judges with no recorded preference run
559
+ again, each with a freshly drawn order.
560
+
561
+ **Failures.** A judge's turn that ends without a preference (`no-terminal`),
562
+ fails (`failed`) or exceeds the session budget (`expired`) counts as a
563
+ failure. A failure that a provider alternate replaced does not count; only the
564
+ last session of a judge's chain does. An alternate whose executable is
565
+ refused is not started, and the failure it would have replaced counts. After two counted failures for one judge, the run fails and names the
566
+ judge and its last outcome. A shutdown records `interrupted`, which does not
567
+ count. A run that cannot prepare its variants fails with the Git output tail.
568
+ A variant holding a committed symlink that resolves outside its judge root
569
+ fails the run before any judge starts, naming the link. A temporary directory
570
+ in a protected location, an interpreter or runtime executable found only
571
+ inside one, and a launcher that would name one also fail the run before any
572
+ judge starts. A local judge's saved preference that is malformed, or names
573
+ another judge or session, ends that judge as `no-terminal` with the reason.
574
+ Every judge root and the launcher directory are removed when the run ends.
575
+
576
+ **Provider alternates.** A judge launch follows the `judge` role's provider
577
+ alternates under the same eligibility rules as a build phase: an availability
578
+ or exhaustion failure, or a thrown start, moves to the next target; a
579
+ credentials or configuration failure, a failed credential delegation, an
580
+ expired budget and a shutdown do not. Each target is its own judge session in
581
+ the same root and with the same order, with its own `panel.judge-started`
582
+ (whose `substitution` names the failed session), credential, stream and
583
+ transcript. Before an alternate launches, its executable is checked against
584
+ the judge's filtered `PATH` and protected locations, like the primary's; a
585
+ refused alternate is not started, ends the chain, and its reason is appended
586
+ to the failed session's error. An alternate starts only after the failed
587
+ session's saved preference is settled and its `panel.judge-ended` is recorded,
588
+ and never after any preference, saved outbox or unreadable outbox for that
589
+ judge.
590
+
591
+ **Watching a judge.** A judge session streams like any other build session
592
+ when its runtime can stream: the stream's session identity carries the `judge`
593
+ role, the runtime and the phase `judge:<panel>:<judge>`, and never the order,
594
+ a side or the root. Its id is recorded on `panel.judge-started`, and it closes
595
+ before `panel.judge-ended`, `completed` when the session preferred and
596
+ `aborted` otherwise. The dashboard's session rows show each judge session,
597
+ including replaced ones, attributed to the panel and judge, without the
598
+ blinded order.
599
+
600
+ ## Events
601
+
602
+ | Event | Log | Facts |
603
+ |---|---|---|
604
+ | `optimization.objective-accepted` | node | objective, revision, harnessPin, specRev |
605
+ | `optimization.objective-revised` | node | changes, revision (human) |
606
+ | `optimization.baseline-measured` | node | revision, head, harnessPin, samples, median, spread, report |
607
+ | `optimization.noise-exceeded` | node | revision, head, harnessPin, median, spread, epsilon, effective ε (advisory) |
608
+ | `optimization.proposal-requested` | node | id, node head, room, budget used (attempts, active hours) (dispatcher) |
609
+ | `optimization.attempts-proposed` | node | request, proposals (id, ticket, title, strategy), reason when empty; recorded after every ticket exists (dispatcher) |
610
+ | `attempt.measurement-requested` | attempt | id, node, candidate, baseline, harnessPin, revision, metric, purpose (panel) |
611
+ | `attempt.sampled` | attempt | request, candidate, baseline, harnessPin, revision, samples (judges for a panel), medians or win rate, report |
612
+ | `attempt.measured` | attempt | request, candidate, baseline, harnessPin, revision, samples, medians or win rate, delta, decision, spread, report |
613
+ | `optimization.proposal-deferred` | node | reason: `paused`, `blocked`, `command`, `restack`, `integration`, `landing` or `compatibility` (dispatcher) |
614
+ | `optimization.proposal-withdrawn` | node | request, reason: `stopped`, `budget` or `concurrency` (dispatcher) |
615
+ | `propose.started` | node | round, request (kernel) |
616
+ | `propose.completed` | node | round, request, proposal ids, `attempts` artifact (proposer) |
617
+ | `optimization.progress-measured` | node | revision, head, starting head, win rate, judges |
618
+ | `implement.declined` | attempt | round, reason, artifact? (agent) |
619
+ | `attempt.settled` | node | attempt (proposal, ticket, build, branch?), outcome, measurement (revision, baseline, candidate, delta), policy?, mergedSha?, note, head (accepted only) |
620
+ | `attempt.merged-unmeasured` | node | proposal, ticket, build, merged head (sha?), reason, measuredCandidate? |
621
+ | `optimization.stopped` | node | cause, mode |
622
+ | `optimization.activity-recorded` | node | attempt execution facts (build, n, instance, started or ended, at), accounted counts, released builds?, watermark, starts?, settles? (dispatcher) |
623
+ | `execution.accounted` | attempt | count: execution facts the node has accounted (dispatcher, advisory) |
624
+ | `attempt.ticket-rejected` | node | proposal, ticket, rejected state the ticket moved to |
625
+ | `attempt.branch-deleted` | node | proposal, build, branch |
626
+ | `attempt.branch-cleanup-failed` | node | proposal, build?, branch, error |
627
+ | `panel.started` | panel host | panel, candidate, baseline, harnessPin, purpose, rubric, harness, judges |
628
+ | `panel.judge-started` | panel host | panel, judge, session, order, runner, model?, account?, stream?, substitution? |
629
+ | `panel.preferred` | panel host | panel, judge, session, preference, reason (agent) |
630
+ | `panel.judged` | panel host | panel, judge, session, order, preference, reason |
631
+ | `panel.judge-ended` | panel host | panel, judge, session, outcome, error?, transcript? |
632
+
633
+ `decision` is `improved`, `no-improvement`, `non-regressing` or `regressed`.
634
+ `outcome` is `accepted`, `no-improvement`, `declined`, `stopped`, `aborted` or
635
+ `merged-unmeasured`. `accepted` and `no-improvement` carry their measurement.
636
+ `merged-unmeasured` carries a `policy` and never a measurement. Only `declined`
637
+ and `no-improvement` carry a `branch` to clean up. A `reason` is `absent`,
638
+ `stale-head`, `unrelated` or `unresolvable`; only `unresolvable` lacks the
639
+ merged head. `cause` is
640
+ `threshold`, `plateau`, `budget`, `exhausted` or `operator`. `report`,
641
+ `spread`, a request's `metric` and a settlement's `head` are optional: older
642
+ facts lack them. `head` is the node head an `accepted` attempt landed as, which
643
+ a panel node's progress panel measures.
644
+ `attempt.sampled` records samples, never a decision; `attempt.measured` is the
645
+ decision.
646
+ The panel facts live on the log of the build that runs the panel. `order` is
647
+ `candidate-first` or `baseline-first`, `preference` is `A`, `B` or `tie`, and
648
+ a judge's `outcome` is `completed`, `no-terminal`, `failed`, `expired`,
649
+ `interrupted` or `reclaimed`. `panel.preferred` never carries the order.
650
+ The dispatcher records `exhausted` after two consecutive empty proposals.
651
+
652
+ A positive delta is an improvement in the objective's direction:
653
+ `baseline − candidate` when minimizing, `candidate − baseline` when maximizing,
654
+ and `winRate − 0.5` for a panel. `revision` counts every acceptance and quick
655
+ revision, starting at 1; measurement facts carry the revision they ran under.
656
+
657
+ ## Progress
658
+
659
+ Progress is derived from the node's log, never recorded:
660
+
661
+ - **Starting value and noise spread** from the baseline measurement under the
662
+ current ruler. A panel's starting value is 0.5, and its spread comes from
663
+ the self-comparison panel.
664
+ - **Current value**: for a command, the candidate value of the latest accepted
665
+ attempt, else the starting value; for a panel, the latest
666
+ `optimization.progress-measured` win rate against the starting head, else
667
+ 0.5. **Best value** in the objective's direction.
668
+ - **Attempts**: filed, accepted, rejected (no-improvement, declined, stopped or
669
+ aborted), merged unmeasured (released by an operator) and running. Two kinds
670
+ of attempt still occupy a concurrency slot: settled attempts whose ticket has
671
+ not yet moved to the rejected role or whose branch is not yet deleted, and
672
+ running attempts that merged without a landing measurement. A tracker or
673
+ forge that refuses its step therefore stalls new proposals instead of piling
674
+ them up. `ab objective` lists each unmeasured merge (`unmeasured merge: …;
675
+ holds a concurrency slot until settled`) and each pending branch cleanup
676
+ (`branch cleanup pending: <branch> (<build>)[: <error>]`). `ab build status
677
+ <node>` prints the same lines, and the objective row adds `N merged
678
+ unmeasured (slot held)` while any remain.
679
+ - **Plateau counter**: consecutive `no-improvement` or `declined` settlements
680
+ since the last `accepted`; `stopped` and `aborted` leave it unchanged.
681
+ - **Budget used**: [active hours](#active-hours), against `maxHours`, and
682
+ attempts filed, against `maxAttempts`.
683
+ - **Stop eligibility** by threshold, plateau and budget, and whether the node
684
+ has stopped. Once stopped, `ab objective` also shows what still blocks
685
+ completion, or `ready for node verification`.
686
+
687
+ The attempt ledger holds one entry per settled attempt: strategy, outcome,
688
+ measured delta and closing note. A **near miss** is a `no-improvement`
689
+ settlement that improved by less than ε (0 < delta < ε, with a relative ε
690
+ scaled by the baseline's magnitude).
691
+
692
+ ## Where progress appears
693
+
694
+ Every surface shows the same objective row, read from the node's digest alone:
695
+
696
+ - The terminal dashboard prints it under the node's progress bar and as the
697
+ `Objective` field of the detail view.
698
+ - `ab status` prints it on a continuation line under the node's row, and
699
+ `ab build status <node>` prints it under `optimization node: objective
700
+ revision N`.
701
+ - `--json` summaries, the `builds.list` and `builds.get` operator tools, and
702
+ `ab watch --json` records (`state.objective`) carry it as `objective`;
703
+ `builds.get` also carries the dashboard's `objectiveRow`. `ab watch` appends
704
+ it to the line of every optimization event.
705
+
706
+ ```text
707
+ objective 50 → 44 (minimize) · threshold 35 · noise ±1.5
708
+ attempts 1 accepted · 3 rejected · 0 running
709
+ budget 4/60 attempts · 3.1/24 active hours
710
+ stopped plateau (drain)
711
+ ```
712
+
713
+ A panel shows `win rate 50% → 70%` instead. Only configured budgets appear,
714
+ `no threshold` and `objective not measured` stand in for absent values, and
715
+ the `stopped` segment appears once the node stops. Budget hours are active
716
+ hours and stop growing at the stop; `(settling)` follows them until the
717
+ dispatcher has accounted attempt runs from before the stop. A watch record
718
+ evaluates them at its own timestamp. `ab objective`
719
+ remains the full view, with the best value, plateau and stop eligibility.
720
+
721
+ ## Proposer phase
722
+
723
+ An optimization node proposes its own attempts. Its grammar is
724
+ `branch opening → starting measurement → (propose → collecting)*`, followed by
725
+ the node's normal completion, verification and merge. Grooming the objective,
726
+ its purpose, budget and stop policy, is the dispatch decision for every attempt
727
+ the node generates: the proposer's attempts go straight to ready, within that
728
+ budget, and each must pass the measurement gate before it lands.
729
+
730
+ **Admission.** The dispatcher records `optimization.proposal-requested` when
731
+ the node is open, has not stopped and no stop cause is eligible, has a starting measurement under the
732
+ current ruler, has no open request, has fewer than two consecutive empty
733
+ proposals, and has room. Room is the smaller of the free concurrency slots
734
+ (`proposer.concurrency` minus attempts queued or running) and the attempts
735
+ the budget still allows, and is 0 once the attempts or hours budget is spent.
736
+ An open request reserves the node's single outstanding proposal round, so no
737
+ second request is made while it is open. It may be waiting for capacity,
738
+ running, or awaiting filing after its session deposited. A proposer session is
739
+ running only once its matching phase and session have started, not merely
740
+ because a request is open. A node that is paused, blocked, has a pending command, an active or
741
+ conflicted node restack, a landing intent or a merged or closed PR, or is
742
+ deferred for runtime compatibility gets `optimization.proposal-deferred` with
743
+ that reason instead, and is reconsidered once a fact that can clear it lands.
744
+ The request takes a slot ahead of normal ticket claims, like node reconcile and
745
+ verification. Before the session starts, the dispatcher re-checks the request:
746
+ when the node stopped, the active-hours budget is spent, or room fell below the
747
+ recorded room, it records `optimization.proposal-withdrawn`, which clears the
748
+ request and never counts as an empty proposal. A session that already started
749
+ keeps the room it was granted.
750
+
751
+ **Context.** The session runs the `ab-propose` skill on the node head, checked
752
+ out detached. `ab context` writes:
753
+
754
+ - `objective.json`: the effective objective, its revision and the fields
755
+ quick-revised since its latest acceptance;
756
+ - `progress.json`: starting, current, best and threshold values, attempt
757
+ counts, attempts in flight, the plateau counter, consecutive empty proposals,
758
+ the opening time (`openedAt`), `activeHours` and the request (`id`, `head`,
759
+ `room`). `activeHours` is the active-hours budget used so far, evaluated when
760
+ the context is materialized; `openedAt` is opening metadata, not the budget
761
+ clock;
762
+ - `ledger.json`: `settled`, one entry per settled attempt with `nearMiss: true`
763
+ on a near miss, and `inFlight`, the running attempts with their titles and
764
+ strategies;
765
+
766
+ plus the spec, answered guidance and ticket assets. The manifest's
767
+ `optimization` names the request, head and room.
768
+
769
+ **`ab propose`.** The session ends with `ab propose <file>`,
770
+ `ab propose --none <reason>` or `ab escalate`; `ab done` and `ab verdict` are
771
+ refused. The file is JSON:
772
+
773
+ ```json
774
+ {"proposals": [{"id": "batch-index-lookups", "title": "…", "strategy": "…", "body": "…"}], "reason": "…"}
775
+ ```
776
+
777
+ - `id` matches `^[a-z0-9][a-z0-9-]{0,63}$`, is unique in the file and was never
778
+ used by this node before, whether settled, pending or in flight.
779
+ - `title` is one line of at most 200 characters; `strategy` is one line of at
780
+ most 300 characters naming one strategy.
781
+ - `body` meets the [spec standard](spec-standard.md) (what and why,
782
+ `## Acceptance criteria` with at least one item, `## Out of scope`) and
783
+ carries no `autobuild-objective` block.
784
+ - The count is at most the request's room. An empty list needs a `reason`.
785
+
786
+ A valid file is deposited as an `attempts` artifact together with
787
+ `propose.completed`. The proposer never creates tickets.
788
+
789
+ **Filing.** The dispatcher reads the deposit once and creates one work ticket
790
+ per proposal, targeting the node, in the source's ready role. Each ticket
791
+ carries every `readyLabels` entry and any `[tickets].createLabels` and, when
792
+ `[tickets].readyAssignee` is set,
793
+ is assigned to that user, adopted tickets included, so intake lists it. Each creation
794
+ carries an idempotency key derived from the repository, the node and the
795
+ proposal id, so a crash between the deposit, the creation and the record
796
+ adopts the ticket an earlier try created instead of filing it twice. Until the
797
+ record lands, intake withholds ready tickets whose creation key matches a
798
+ deposited proposal. Once every ticket exists, the dispatcher records
799
+ `optimization.attempts-proposed` and releases the node's workspace. If that
800
+ release never happens, after a crash, a failed release or a runner still
801
+ leased, a later dispatcher pass releases any optimization-node workspace that
802
+ no runner, starting or progress measurement, proposal, restack or integration work owns. A ticket source without integration-tree support, or an unreadable deposit, raises an
803
+ escalation on the node instead of creating anything.
804
+
805
+ **Exhausted.** Two consecutive empty proposals stop the node: the dispatcher
806
+ records `optimization.stopped` with cause `exhausted` and the objective's stop
807
+ mode, and requests no further proposals. The shared stop enforcer applies the
808
+ recorded mode to attempts already in flight, just as for every other stop cause.
809
+
810
+ Starting and progress measurements have precedence over new proposer admission.
811
+ An open but unstarted proposer request waits while a measurement is owed or running.
812
+ A proposer already admitted when a measurement becomes due finishes or resumes
813
+ with its granted allowance, and its deposit is filed normally. Measurement runs
814
+ next, before another proposer. The node workspace remains held while either a
815
+ starting or progress measurement or a
816
+ proposal request or session needs it; neither owner releases the other’s workspace.
817
+
818
+ ## Attempts
819
+
820
+ A build is an attempt of a node exactly when its ticket was created from a
821
+ recorded proposal of that node (`optimization.attempts-proposed`), which the
822
+ dispatcher files from the proposer's deposit. Children
823
+ filed any other way, for example a repair child, are not attempts and count
824
+ toward neither the budget nor the plateau. The proposal's ticket and the
825
+ build's ticket are compared through any recorded ticket-source migration, so a
826
+ proposal recorded before a migration still matches its child. When that
827
+ continuity cannot be resolved, the command refuses with `cannot resolve
828
+ optimization attempt identity for build <slug>: …` rather than treating the
829
+ build as an ordinary child.
830
+
831
+ An attempt keeps the ordinary work grammar: plan, plan review, implement, code
832
+ review, verify and finalize.
833
+
834
+ An attempt claims at its node's priority. `ab priority <node> urgent` puts
835
+ the node's attempts claimed afterwards in the urgent tier; an attempt already
836
+ claimed keeps its build's priority. Nothing is reserved: an attempt waits for
837
+ a free slot like any ready ticket, preempts nothing, and follows the source's
838
+ order within its tier.
839
+
840
+ ### Attempt context
841
+
842
+ In every phase of an attempt, `ab context` writes a derived `objective.md` and
843
+ adds an `attempt` block to the manifest. Reviewers need the purpose as much as
844
+ the implementer does. The document names the node and the objective revision
845
+ and gives:
846
+
847
+ - the purpose, verbatim;
848
+ - the measurement: the command, its direction and samples, or a panel's judges
849
+ and rubric;
850
+ - the harness selectors, with a note that the harness is pinned and `ab done`
851
+ refuses any change to it;
852
+ - ε, the threshold if any, and the node's current value ("not measured yet"
853
+ before a baseline), with the best and starting values when present.
854
+
855
+ The manifest block is
856
+ `{node, proposal, revision, purpose, metric: {kind, command?, direction?,
857
+ samples?, judges?, rubric?}, harness, current?, path}`, where `path` is the
858
+ workspace-relative `objective.md`.
859
+
860
+ ### Harness edits are refused
861
+
862
+ The harness is the ruler. In an attempt's implement phase, `ab done` compares
863
+ the net contribution (`base..head`, renames as delete plus add) with
864
+ `metric.harness`. A change to a matching path is refused before anything is
865
+ deposited or published, as other invalid deposits are, so no event is written
866
+ and code review never sees it:
867
+
868
+ ```text
869
+ publication rejected: an optimization attempt must not change its harness (the measurement's ruler):
870
+ bench/search/run.ts
871
+ Revert these paths to the contribution base, commit, then retry 'ab done'.
872
+ ```
873
+
874
+ Only the net diff counts: a harness edit reverted in a later commit changes
875
+ nothing the ruler measures. Children that are not attempts are not checked.
876
+
877
+ ### Declining
878
+
879
+ When a strategy finds no real gain, the implementer declines:
880
+
881
+ ```sh
882
+ ab done --no-improvement "<what was tried and why it did not help>" [--notes <file>]
883
+ ```
884
+
885
+ It records `implement.declined {round, reason, artifact?}`, with the notes as
886
+ `implement-notes` when `--notes` is given. The reason is trimmed and must be 1
887
+ to 4000 characters. Declining needs no commits and no clean worktree, and it
888
+ publishes nothing. No review, verification, finalize or measurement follows.
889
+ The dispatcher then appends `attempt.settled {outcome: declined, note}` to the
890
+ node with the reason as the note, releases the attempt's workspace, and
891
+ completes the build `closed-unmerged`. A declined settlement enters the ledger
892
+ the proposer reads and advances the plateau counter. If an earlier implement
893
+ round published the attempt's branch, the node's poll deletes it before moving
894
+ the ticket (see [Landing and settlement](#landing-and-settlement)).
895
+
896
+ Declining is a successful outcome: a specific reason tells the proposer what
897
+ not to try again. The flag is refused outside implement (`'--no-improvement'
898
+ is only valid in implement of an optimization attempt`) and in a build that is
899
+ not an attempt (`ab done --no-improvement is only for optimization attempts:
900
+ build <slug> is not an attempt of an optimization node`).
901
+
902
+ ## Landing and settlement
903
+
904
+ Passing verify and finalize is not enough for a child of an optimization node
905
+ to land. Verify asks whether a change is correct; measurement asks whether it
906
+ helped. Once a child is ready to land, the dispatcher records
907
+ `attempt.measurement-requested` on the child's log for one exact pair: the
908
+ child's candidate head and the node head it would land on. The child lands only
909
+ with an `attempt.measured` result for that same pair, under the accepted
910
+ harness pin and the current ruler. The node writer's guarded merge is guarded
911
+ on that measured node head.
912
+
913
+ - **Freshness.** When a sibling lands first, the node head moves and the
914
+ measurement no longer applies. The child restacks and a new measurement is
915
+ requested. A request the child already saw superseded is never sampled, so
916
+ no paired measurement is spent on a pair that cannot land; samples already
917
+ running when the head moves are recorded and then rejected as stale.
918
+ A clean restack keeps verification; it never keeps a measurement.
919
+ The node writer is never held while a measurement runs.
920
+ A landing interrupted after its writer reservation publishes on recovery only
921
+ while that pair still passes the gate; after a revision it does not pass, the
922
+ reservation is abandoned.
923
+ - **Attempts must improve.** An attempt lands when its delta is at least ε;
924
+ on a panel objective, when its win rate against the current node head
925
+ reaches 0.5 + ε. Anything less settles it `no-improvement`: its PR closes
926
+ without merging and no further implement round runs.
927
+ - **Other children must not regress.** A child that is not an attempt lands
928
+ when its delta is at least −ε, or its win rate at least 0.5 − ε. A
929
+ regressing child escalates with both medians or the win rate, the delta and
930
+ ε; answering asks for a fresh measurement. These
931
+ children never settle and count toward neither budget nor plateau.
932
+ - **Harness edits escalate.** An attempt whose head changes a harness path is
933
+ never measured. It escalates naming the paths, and that head stays
934
+ unmeasured even after an answer; revise the attempt or abort it.
935
+ - **Turn.** An attempt overtaken by sibling landings three consecutive times
936
+ gets the next turn. Later candidates neither request measurements nor land
937
+ until it lands, closes, or escalates.
938
+ - **Progress first.** While a panel node owes a progress panel for an accepted
939
+ head, a child that would otherwise land waits (`wait-progress`). Its
940
+ measurement may still run; it lands once the progress is recorded.
941
+
942
+ `ab watch` and `ab build status <child>` print the recorded measurement: a
943
+ command's medians or a panel's win rate, the delta and the decision, such as
944
+ `win rate 0.8: delta 0.3 → improved`.
945
+
946
+ Every attempt settles exactly once, on the node's log. A measured settlement
947
+ records the medians, or for a panel a baseline of 0.5 and the win rate as the
948
+ candidate:
949
+
950
+ | How the attempt ends | Outcome | Ticket role |
951
+ |---|---|---|
952
+ | Merged into the node, with a measurement of the merged head; records the merged head | `accepted` | done |
953
+ | Landing measurement shows no improvement | `no-improvement` | rejected |
954
+ | Its implementer declines it (`ab done --no-improvement`) | `declined` | rejected |
955
+ | Node stops | `stopped` | rejected |
956
+ | Operator abort, or a human closes its PR | `aborted` | rejected |
957
+ | Merged without a measurement of the merged head, then released by an operator | `merged-unmeasured` | done |
958
+
959
+ **Unmeasured merges.** A human forge merge bypasses the landing gate. An
960
+ attempt settles `accepted` only with a result for exactly the merged head that
961
+ answers this node's request. Otherwise the dispatcher records
962
+ `attempt.merged-unmeasured` on the node once, with its reason, and one followup
963
+ observation on the child. The attempt stays in flight and keeps its concurrency
964
+ slot. Its build and ticket still complete. The dispatcher reconciles merges that
965
+ completed without either record on its next node tick. Release the slot
966
+ explicitly:
967
+
968
+ ```sh
969
+ ab objective <node> --settle-unmeasured <proposal|build> --policy release-unmeasured [--note <text>]
970
+ ```
971
+
972
+ A connected agent calls the operator tool `optimization.settle-unmeasured`
973
+ with `{repo, slug, attempt, policy, note?}`. The policy is required.
974
+ `release-unmeasured` records `attempt.settled {outcome: merged-unmeasured,
975
+ policy, mergedSha}` with you as the actor. The slot is released exactly once
976
+ and the attempt is counted as merged unmeasured, never accepted. The current
977
+ and best values, the baseline and the plateau counter do not move, and the
978
+ ledger entry has no measurement. The action works on a stopped node. It refuses
979
+ an attempt that is not in flight, has not merged unmeasured, or whose merged
980
+ head has a valid measurement, and it refuses a terminal node.
981
+
982
+ **Rejected tickets and branch cleanup.** This is the one case in which the
983
+ dispatcher moves a ticket into the rejected role. Once the attempt's build is
984
+ done (or it never had one), the node's poll moves the ticket, comments the
985
+ outcome, and records `attempt.ticket-rejected`. An aborted or closed attempt
986
+ never returns to triage. A completed node keeps being polled until every such
987
+ move has committed.
988
+
989
+ A `declined` or `no-improvement` attempt that published its branch (it
990
+ completed an implement round or opened a PR) leaves a cleanup obligation on
991
+ that pending rejection. Before moving the ticket, the poll deletes exactly that
992
+ build's branch from the forge and records `attempt.branch-deleted`. A branch
993
+ that is already gone counts as deleted. The poll never deletes the node's
994
+ branch, its base or another build's branch. A failed or refused deletion
995
+ records `attempt.branch-cleanup-failed` once per distinct error, keeps the
996
+ slot, and retries on later polls without changing the settlement. An attempt
997
+ that never published needs no deletion. Aborted and stopped attempts keep abort
998
+ cleanup's own branch deletion.
999
+
1000
+ ## Active hours
1001
+
1002
+ `maxHours` counts the time the node's optimization work actually runs:
1003
+
1004
+ - **What counts.** An attempt from its `execution.started` to its
1005
+ `execution.ended`, and the node's own runs that started while its proposer
1006
+ or a measurement was due. Overlapping runs count once.
1007
+ - **What doesn't.** An attempt queued for a slot has no execution. A runner
1008
+ ends its execution whenever the build waits: paused, blocked on an
1009
+ escalation, on a ticket wait or awaiting merge. Other node runs, such as a
1010
+ branch reconcile, don't count.
1011
+ - **How it is kept.** The node's digest holds an exact union of execution
1012
+ intervals. Its own runs fold from its log. Attempt runs arrive in
1013
+ `optimization.activity-recorded` batches: on each tick the dispatcher reads
1014
+ an attempt build's `executionIntervals` value only when the build's digest
1015
+ shows new execution facts, records them on the node, then acknowledges them
1016
+ on the build with `execution.accounted`. An idle tick reads nothing. The
1017
+ first pass over a node starts its clock with a `starts` batch, so an
1018
+ attempt that settles before the dispatcher saw it run is still charged.
1019
+ - **At a stop.** `optimization.stopped` closes every interval at the stop
1020
+ time, so the value never grows afterwards. The next tick records one
1021
+ settling batch with every attempt run from before the stop the node had not
1022
+ yet accounted; a large one is chunked, and only its last chunk settles. Until then surfaces show `settling`, because that batch may
1023
+ change the value once.
1024
+ - **Nodes opened before active hours.** Their own past proposer and
1025
+ measurement runs count. Attempts still in flight are charged their whole
1026
+ run history once the dispatcher first sees them; attempts that settled
1027
+ before the clock's starting batch are not charged. A completed node reports its own runs,
1028
+ clipped at its stop.
1029
+
1030
+ ## Stopping and completion
1031
+
1032
+ An optimization node is done when the number is good enough, when it stops
1033
+ getting better, when the budget runs out, or when an operator takes the
1034
+ progress so far. Every accepted attempt improved the node head, so stopping at
1035
+ any point lands real, verified progress.
1036
+
1037
+ **Causes.** The node records `optimization.stopped {cause, mode}` once:
1038
+
1039
+ | Cause | When |
1040
+ |---|---|
1041
+ | `threshold` | The node head's current value has reached `target.threshold` in the objective's direction; for a panel, the head's recorded win rate against the starting head. |
1042
+ | `plateau` | `stop.plateau.attempts` consecutive `no-improvement` or `declined` settlements. |
1043
+ | `budget` | Attempts filed reached `maxAttempts`, or [active hours](#active-hours) reached `maxHours`. |
1044
+ | `exhausted` | The proposer has nothing left to try. |
1045
+ | `operator` | A human stopped it with `ab objective <node> --stop` or `optimization.stop`. |
1046
+
1047
+ The dispatcher checks every open, unpaused optimization node on every tick and
1048
+ records the first eligible of threshold, plateau and budget, with the
1049
+ objective's stop mode. It checks the effective objective, so a quick revision
1050
+ takes effect on the next tick.
1051
+
1052
+ **Stopping by hand.** `ab objective <node> --stop` uses the objective's stop
1053
+ mode, `abort` unless the objective says otherwise; `--stop --drain` and
1054
+ `--stop --abort` override it for this stop. The operator tool
1055
+ `optimization.stop` takes an optional `mode`; see the
1056
+ [operator API](operator-api.md#optimization-stop). Both refuse a build that is
1057
+ not a node, a plain node, a terminal node and a node that has already stopped.
1058
+ `--stop` cannot be combined with revision flags.
1059
+
1060
+ **Modes.** Every cause, `exhausted` included, applies the same modes:
1061
+
1062
+ - **abort**: queued attempts are cancelled and running attempts are aborted
1063
+ through the ordinary abort saga, with a dispatcher `build.abort-requested`
1064
+ naming the stop. Those aborted by the stop settle `stopped`.
1065
+ - **drain**: queued attempts are cancelled and settle `stopped`; running
1066
+ attempts finish and face the landing gate.
1067
+
1068
+ The first recorded `build.abort-requested` fixes the abort's cause. A node-stop
1069
+ request records `origin {kind: optimization-stop, node}`; an operator request has
1070
+ operator origin (no node-stop origin). Abort cleanup alone settles an aborted
1071
+ build: `stopped` for a node-stop request, `aborted` for an operator request.
1072
+ An existing request is never replaced: identical repeats are idempotent and
1073
+ conflicting operator requests are refused. The stop enforcer waits for a pending
1074
+ abort, so an operator abort before a stop remains `aborted`; an operator abort
1075
+ during drain is also `aborted`. Settlement is conditional on the attempt still
1076
+ being in flight, and the existing node sweep alone moves its ticket to rejected.
1077
+
1078
+ An attempt with no build yet is cancelled and settles `stopped` in both modes. No new proposer
1079
+ session is admitted after a stop. A proposer session that had already started
1080
+ keeps the allowance it was granted and may finish or resume; its deposited
1081
+ proposals are filed and recorded, but the stopped node's attempt handling
1082
+ cancels and settles those attempts, so no fresh attempt work runs. Dispatch
1083
+ refuses an attempt ticket of a stopped node with
1084
+ `target optimization node <id> has stopped; attempt <ticket> is cancelled`.
1085
+ Children filed by hand, such as repair tickets, are still admitted.
1086
+
1087
+ **Completion.** The node is complete when it has stopped, no attempt is running
1088
+ or waiting to land, and every child is otherwise resolved under the ordinary
1089
+ node completion rule. It then verifies, authorizes and merges like any other
1090
+ node. Stopping is not consent: once the node is ready, land it with
1091
+ `ab merge <node>`. `ab merge` refuses an optimization node that has not
1092
+ stopped, or whose attempts are still in flight, and names which.
1093
+
1094
+ ## Landing the node
1095
+
1096
+ `ab merge <node>` approves the node's branch: the verified accumulation of
1097
+ every accepted attempt, each of which improved the head it landed on, plus any
1098
+ children filed by hand. Rejected attempts never reach the node branch, because
1099
+ the landing gate closes them unmerged. The node then lands into its target
1100
+ like any other node; see [integration trees](integration-tree.md).