@attalabs/vinaya 0.36.0 → 0.38.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 (292) hide show
  1. package/README.md +6 -6
  2. package/aeg-root/contracts/developer-reviewer.md +1 -1
  3. package/aeg-root/contracts/planner-operator.md +1 -1
  4. package/aeg-root/contracts/principal-operator.md +6 -6
  5. package/aeg-root/contracts/security-archivist.md +1 -1
  6. package/aeg-root/enforcement.md +14 -14
  7. package/aeg-root/process.md +3 -1
  8. package/aeg-root/roles/archivist.md +2 -2
  9. package/aeg-root/roles/developer/reference.md +36 -37
  10. package/aeg-root/roles/developer.md +9 -5
  11. package/aeg-root/roles/operator.md +18 -18
  12. package/aeg-root/roles/planner/reference.md +15 -4
  13. package/aeg-root/roles/principal.md +6 -1
  14. package/aeg-root/roles/reviewer.md +14 -6
  15. package/aeg-root/roles/security.md +22 -11
  16. package/aeg-root/roles/tranche-archivist.md +14 -2
  17. package/aeg-root/state-machine.md +12 -11
  18. package/aeg-root/templates/brief-template.md +8 -6
  19. package/aeg-root/templates/pr-report-template.md +1 -9
  20. package/aeg-root/tranche-model.md +10 -4
  21. package/dist/checks/bin/check-body-bare-digits.js +823 -595
  22. package/dist/checks/bin/check-branch-topology.js +796 -478
  23. package/dist/checks/bin/check-brief-shape.js +824 -596
  24. package/dist/checks/bin/check-changeset-coverage.js +1337 -747
  25. package/dist/checks/bin/check-closes-n.js +796 -478
  26. package/dist/checks/bin/check-coherence.js +914 -611
  27. package/dist/checks/bin/check-dead-branch-push.js +705 -462
  28. package/dist/checks/bin/check-dispatch-readiness.js +941 -624
  29. package/dist/checks/bin/check-doc-coverage-push.js +1332 -742
  30. package/dist/checks/bin/check-doc-coverage.js +1339 -742
  31. package/dist/checks/bin/check-doctrine-no-procedures.js +821 -593
  32. package/dist/checks/bin/check-doctrine-portability.js +1332 -742
  33. package/dist/checks/bin/check-evidence-fresh.js +1339 -918
  34. package/dist/checks/bin/check-exec-bits.js +1331 -741
  35. package/dist/checks/bin/check-first-push-dispatch.js +917 -614
  36. package/dist/checks/bin/check-issue-assignment.js +796 -478
  37. package/dist/checks/bin/check-issue-milestone-attach.js +705 -462
  38. package/dist/checks/bin/check-issue-objectives-numbering.js +821 -593
  39. package/dist/checks/bin/check-issue-parts-coverage.js +705 -462
  40. package/dist/checks/bin/check-issue-surface-globs.js +925 -613
  41. package/dist/checks/bin/check-issue-title-grammar.js +705 -462
  42. package/dist/checks/bin/check-issue-tranche-label.js +705 -462
  43. package/dist/checks/bin/check-main-branch-refusal.js +705 -462
  44. package/dist/checks/bin/check-no-disk-state.js +705 -462
  45. package/dist/checks/bin/check-pr-premise-reassert.js +821 -593
  46. package/dist/checks/bin/check-pr-report-density.js +705 -462
  47. package/dist/checks/bin/check-principal-test-plan-wait.js +705 -462
  48. package/dist/checks/bin/check-quoted-command.js +1816 -1228
  49. package/dist/checks/bin/check-reader-resolvable-prose.js +1835 -1235
  50. package/dist/checks/bin/check-registry-gates.js +993 -526
  51. package/dist/checks/bin/check-retired-vocabulary.js +1810 -1222
  52. package/dist/checks/bin/check-review-gate.js +832 -604
  53. package/dist/checks/bin/check-single-plan-pr.js +705 -462
  54. package/dist/checks/bin/check-surface-scope.js +796 -478
  55. package/dist/checks/bin/check-test-plan.js +705 -462
  56. package/dist/checks/bin/check-token-collection-wired.js +705 -462
  57. package/dist/checks/bin/check-workspace-escape.js +1332 -742
  58. package/dist/checks/bin/verify-dispatch.js +3849 -0
  59. package/dist/index.js +20876 -10091
  60. package/dist/lib/pre-push-cache-test-run.js +1045 -682
  61. package/dist/lib/pre-push-changed-files.js +16 -11
  62. package/dist/lib/pre-push-select-tests.js +785 -500
  63. package/package.json +2 -2
  64. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/anchored-region.ts +7 -6
  65. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +71 -15
  66. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-validation.ts +51 -12
  67. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/index.ts +1 -0
  68. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/local.ts +31 -0
  69. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/records.ts +50 -2
  70. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/assess-round.ts +443 -28
  71. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/fakes.ts +18 -5
  72. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/index.ts +6 -4
  73. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/journal-reconstruction.ts +13 -13
  74. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/render-summary.ts +46 -110
  75. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/types.ts +169 -11
  76. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doc-claim.ts +32 -6
  77. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/index.ts +3 -1
  78. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/published-prose.ts +30 -0
  79. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doctrine-portability.ts +6 -2
  80. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/gate-audience.ts +0 -1
  81. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +82 -8
  82. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +754 -7
  83. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/leftover-detection.ts +24 -6
  84. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/custom.ts +157 -0
  85. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/envelope.ts +44 -6
  86. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/fixtures/executions.ts +493 -0
  87. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/fixtures/fact-sheets.ts +111 -0
  88. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/fixtures/generator.ts +155 -0
  89. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/fixtures/index.ts +12 -0
  90. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/index.ts +128 -0
  91. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/catches.ts +63 -0
  92. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/checks.ts +146 -0
  93. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/common.ts +137 -0
  94. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/completion.ts +137 -0
  95. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/convergence.ts +420 -0
  96. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/determinism.ts +65 -0
  97. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/index.ts +69 -0
  98. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/judgment.ts +132 -0
  99. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/labels.ts +21 -0
  100. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/time.ts +167 -0
  101. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/usage.ts +139 -0
  102. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/schema.ts +226 -15
  103. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/store.ts +7 -7
  104. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/cache-contract.ts +207 -0
  105. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/contracts.ts +105 -0
  106. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/engine.ts +308 -0
  107. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/index.ts +34 -0
  108. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/measured.ts +20 -0
  109. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/memory-cache.ts +78 -0
  110. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/normalize.ts +156 -0
  111. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/row.ts +103 -0
  112. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/reader-resolvable-prose.ts +34 -6
  113. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/registry-checks.ts +70 -6
  114. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-gate.ts +52 -4
  115. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-input-manifest.ts +19 -14
  116. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-policy.ts +201 -24
  117. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-status.ts +5 -2
  118. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-phase-history.ts +46 -0
  119. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-tools.ts +15 -28
  120. package/studio-standalone/apps/vinaya-studio/web/.next/BUILD_ID +1 -1
  121. package/studio-standalone/apps/vinaya-studio/web/.next/app-path-routes-manifest.json +0 -1
  122. package/studio-standalone/apps/vinaya-studio/web/.next/build-manifest.json +3 -3
  123. package/studio-standalone/apps/vinaya-studio/web/.next/prerender-manifest.json +3 -3
  124. package/studio-standalone/apps/vinaya-studio/web/.next/required-server-files.json +0 -5
  125. package/studio-standalone/apps/vinaya-studio/web/.next/routes-manifest.json +0 -6
  126. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error/page.js +1 -1
  127. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error/page.js.nft.json +1 -1
  128. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  129. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.html +1 -1
  130. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.rsc +1 -1
  131. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  132. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  133. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  134. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  135. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  136. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page/server-reference-manifest.json +2 -2
  137. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js +1 -1
  138. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  139. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  140. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page/server-reference-manifest.json +2 -2
  141. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js +1 -1
  142. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js.nft.json +1 -1
  143. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page_client-reference-manifest.js +1 -1
  144. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page/server-reference-manifest.json +2 -2
  145. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js +3 -3
  146. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js.nft.json +1 -1
  147. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page_client-reference-manifest.js +1 -1
  148. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page/server-reference-manifest.json +2 -2
  149. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js +3 -3
  150. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js.nft.json +1 -1
  151. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page_client-reference-manifest.js +1 -1
  152. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page/server-reference-manifest.json +2 -2
  153. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js +3 -3
  154. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js.nft.json +1 -1
  155. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page_client-reference-manifest.js +1 -1
  156. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page/server-reference-manifest.json +3 -3
  157. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js +5 -5
  158. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js.nft.json +1 -1
  159. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page_client-reference-manifest.js +1 -1
  160. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page/server-reference-manifest.json +2 -2
  161. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js +3 -3
  162. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js.nft.json +1 -1
  163. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
  164. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page/server-reference-manifest.json +2 -2
  165. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js +3 -3
  166. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js.nft.json +1 -1
  167. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page_client-reference-manifest.js +1 -1
  168. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page/server-reference-manifest.json +2 -2
  169. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js +3 -3
  170. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js.nft.json +1 -1
  171. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page_client-reference-manifest.js +1 -1
  172. package/studio-standalone/apps/vinaya-studio/web/.next/server/app-paths-manifest.json +0 -1
  173. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/044u_vinaya-studio_web_src_app_studio_backlog__components_BacklogTable_tsx_0oha0bt._.js +3 -0
  174. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/1q96_modules_@clerk_nextjs_dist_esm_app-router_client_keyless-creator-reader_0lom2js.js +1 -1
  175. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1bh2awk._.js → [root-of-the-server]__038scsm._.js} +2 -2
  176. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1widio3._.js → [root-of-the-server]__03__s45._.js} +2 -2
  177. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{_15gdg48._.js → [root-of-the-server]__04adkz-._.js} +3 -3
  178. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__05zwn98._.js +14 -0
  179. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__08e39jo._.js +3 -0
  180. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0h9yhwx._.js +1 -1
  181. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1wy7w66._.js → [root-of-the-server]__0jdjsxe._.js} +2 -2
  182. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ls23oh._.js +1 -1
  183. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__10riywf._.js +3 -0
  184. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__13znegp._.js → [root-of-the-server]__134x-65._.js} +2 -2
  185. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__13eeix2._.js → [root-of-the-server]__1_l_l1u._.js} +2 -2
  186. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1f4bb3_._.js +3 -0
  187. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1gjqmhq._.js +1 -1
  188. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1dky4g0._.js → [root-of-the-server]__1my83lt._.js} +2 -2
  189. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1ng2x88._.js +3 -0
  190. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__040smoa._.js → [root-of-the-server]__1qpc6at._.js} +2 -2
  191. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1snpgaw._.js +56 -0
  192. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1wc4-ip._.js +2 -2
  193. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_06h3wbl._.js +3 -0
  194. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_08onyya._.js +1 -1
  195. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_096f46i._.js +1 -1
  196. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0af2one._.js +1 -1
  197. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0e5tkdd._.js +1 -1
  198. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0gs4gvl._.js +3 -0
  199. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0kf2g72._.js +1 -1
  200. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0zf4d27._.js +1 -1
  201. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1-wo68i._.js +1 -1
  202. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_121lrn5._.js +3 -0
  203. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1achbh9._.js +1 -1
  204. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1o4v6lb._.js +3 -0
  205. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1q7h5mz._.js +1 -1
  206. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1ztd4i3._.js +3 -0
  207. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_209-ugd._.js +3 -0
  208. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_214d71c._.js +3 -0
  209. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/apps_vinaya-studio_web_src_app_studio_projects_[name]_tranches_[slug]_17dho0f._.js +3 -0
  210. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/node_modules_@clerk_nextjs_dist_esm_app-router_server-actions_1x7vfhn.js +2 -2
  211. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/node_modules_next_dist_1lzmr5o._.js +1 -1
  212. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_animate_components_index_ts_186fje1._.js +1 -1
  213. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_basic_components_index_ts_0xk1vda._.js +1 -1
  214. package/studio-standalone/apps/vinaya-studio/web/.next/server/middleware-build-manifest.js +3 -3
  215. package/studio-standalone/apps/vinaya-studio/web/.next/server/pages/500.html +1 -1
  216. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.js +1 -1
  217. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.json +4 -4
  218. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/09fcolor69bun.js +1 -0
  219. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0lcwmwzxacdie.js +1 -0
  220. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ojry7lrbzkfd.css +1 -0
  221. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1-acpmtfmrc35.js +1 -0
  222. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1giu47hrbhroj.js +1 -0
  223. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1shz6lwruld25.js +1 -0
  224. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1ytvuy1mmnc6j.js +1 -0
  225. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3oxhhhm_psozq.js → 21a6_5cr956wj.js} +1 -1
  226. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{2o9l0b7eqbr57.js → 2f2y8xxok8zph.js} +1 -1
  227. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2g8mwnydod96u.js +1 -0
  228. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3li0ueedy-ozv.js → 2nrnuawd5fwpv.js} +1 -1
  229. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2nw47832_uvfe.js +1 -0
  230. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2qdxnj8wk2h0s.js +1 -0
  231. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3lqjwjrcvq481.js → 2xevgia1h8g0y.js} +2 -2
  232. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3b9q75p-z5ma5.js +1 -0
  233. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3cv-oe7153242.js +1 -0
  234. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3m310lbjj4p5u.js +1 -0
  235. package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
  236. package/studio-standalone/apps/vinaya-studio/web/server.js +1 -1
  237. package/dist/checks/bin/check-token-report.js +0 -6526
  238. package/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/aeg-core/bin/verify-coherence.ts +0 -1089
  239. package/studio-standalone/_node_modules/next/dist/compiled/next-server/app-route-turbo.runtime.prod.js +0 -6
  240. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route/app-paths-manifest.json +0 -3
  241. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route/build-manifest.json +0 -9
  242. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route/server-reference-manifest.json +0 -4
  243. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js +0 -6
  244. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.map +0 -5
  245. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.nft.json +0 -1
  246. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route_client-reference-manifest.js +0 -3
  247. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/044u_vinaya-studio_web__next-internal_server_app_api_coherence_route_actions_1rnzea1.js +0 -3
  248. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[externals]__0cki-x_._.js +0 -3
  249. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[root-of-the-server]__02a-3g8._.js +0 -15
  250. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[turbopack]_runtime.js +0 -903
  251. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__074w9nf._.js +0 -3
  252. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ln09ua._.js +0 -3
  253. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0oegopp._.js +0 -3
  254. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__13yxbjd._.js +0 -51
  255. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1duqmtm._.js +0 -3
  256. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1z7dml9._.js +0 -9
  257. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0bfs_u4._.js +0 -3
  258. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0g8_eot._.js +0 -3
  259. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0hrh_v-._.js +0 -181
  260. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0i4-dea._.js +0 -3
  261. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0o54suy._.js +0 -3
  262. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0rxd7s0._.js +0 -3
  263. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0y1jv16._.js +0 -3
  264. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_151m4rz._.js +0 -3
  265. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1a9dieq._.js +0 -3
  266. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1sxsf5q._.js +0 -3
  267. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1sy_yfr._.js +0 -3
  268. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_219v2an._.js +0 -3
  269. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/apps_vinaya-studio_web_src_app_studio_projects_[name]_tranches_[slug]_05ufo8i._.js +0 -3
  270. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_basic_components_form_input_tsx_0es8d8b._.js +0 -3
  271. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_brutal_components_index_ts_0n_lcc4._.js +0 -3
  272. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_retro_components_index_ts_0wvpm_z._.js +0 -3
  273. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/00z3-ljjd1gj9.js +0 -1
  274. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0bjnj-5fy4e7l.js +0 -1
  275. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0c8uwz_-m8s99.js +0 -165
  276. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ct0c-xj0baf6.js +0 -1
  277. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ko698wh8xx2g.css +0 -1
  278. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0t5n_r4xm__t-.js +0 -1
  279. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0vc2u252q5q6o.js +0 -1
  280. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/16r_o07lw0vm0.js +0 -1
  281. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1cah7_e5a1zvu.js +0 -1
  282. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1gjo9-6dz7nup.js +0 -1
  283. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/24tz8aro1uto4.js +0 -1
  284. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2ef2g5fozszw7.js +0 -1
  285. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2ka8dg687auhj.js +0 -1
  286. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2pf3f50gbrkyv.js +0 -1
  287. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2qq49pct3q51-.js +0 -1
  288. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3et66z7glk65w.js +0 -1
  289. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3y6u3prmrkea-.js +0 -1
  290. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{z1fTSBP6ZlUjObzFIp-qq → yNZEFRSjP9BLUfdf96Eol}/_buildManifest.js +0 -0
  291. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{z1fTSBP6ZlUjObzFIp-qq → yNZEFRSjP9BLUfdf96Eol}/_clientMiddlewareManifest.js +0 -0
  292. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{z1fTSBP6ZlUjObzFIp-qq → yNZEFRSjP9BLUfdf96Eol}/_ssgManifest.js +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@attalabs/vinaya",
3
- "version": "0.36.0",
3
+ "version": "0.38.0",
4
4
  "description": "Vinaya — Agentic Engineering Harness. Deterministic checks every AI coding agent must satisfy before merge.",
5
5
  "type": "module",
6
6
  "license": "FSL-1.1-ALv2",
@@ -37,7 +37,7 @@
37
37
  "code-review"
38
38
  ],
39
39
  "engines": {
40
- "node": ">=20"
40
+ "node": ">=22.13"
41
41
  },
42
42
  "scripts": {
43
43
  "build": "bun scripts/build.ts",
@@ -42,7 +42,7 @@
42
42
  * Deliberately minimal: seven field names, one shape. This is a delimiting
43
43
  * convention, not a metadata DSL; resist adding structure to it.
44
44
  *
45
- * `EVIDENCE` (fix/pr-report-emitter) differs from the other six in one way:
45
+ * `EVIDENCE` (fix/pr-report-emitter) differs from the other five in one way:
46
46
  * it is never hand-typed. `vinaya pr report --write` is the only writer, and
47
47
  * `check-evidence-fresh` is the only reader — no prose-fallback recognition
48
48
  * exists or is planned for this field, unlike the anchor-optional grammar
@@ -52,12 +52,13 @@
52
52
  import { maskCode } from '@attalabs/aeg-forge-state/strip-code'
53
53
 
54
54
  /**
55
- * The seven gate-read fields with an anchored home. `TOKENS`
56
- * joined here rather than through a second, parallel field list —
57
- * `pr-report.ts`'s own `AEG:TOKENS:START`/`:END` markers already use this
58
- * exact grammar, so the registry is the fix, not a workaround beside it.
55
+ * The six gate-read fields with an anchored home. A `TOKENS` entry belonged
56
+ * here while a pull-request body carried a token table; that table is retired
57
+ * — token use is recorded as the Vinaya log's own `usage` event — so nothing
58
+ * writes or reads that anchor any more. An older body that still carries the
59
+ * pair keeps it: no reader here resolves it, and no writer touches it.
59
60
  */
60
- export const ANCHOR_FIELDS = ['CLOSES', 'PROJECT', 'TIER', 'PREMISE', 'TEST-PLAN', 'EVIDENCE', 'TOKENS'] as const
61
+ export const ANCHOR_FIELDS = ['CLOSES', 'PROJECT', 'TIER', 'PREMISE', 'TEST-PLAN', 'EVIDENCE'] as const
61
62
 
62
63
  export type AnchorField = (typeof ANCHOR_FIELDS)[number]
63
64
 
@@ -26,6 +26,7 @@ import {
26
26
  globCoversPath,
27
27
  type IssueDocumentation,
28
28
  type IssuePart,
29
+ type IssuePremise,
29
30
  type IssueSurface,
30
31
  type IssueTestPlan
31
32
  } from './issue-validation'
@@ -53,6 +54,32 @@ function renderDocumentation(documentation: IssueDocumentation): string {
53
54
  ].join('\n')
54
55
  }
55
56
 
57
+ /**
58
+ * Renders the Issue's `## Premises` section — one line per premise, under its
59
+ * own heading, so the Developer reads them as **checked facts** rather than as
60
+ * more of the Boundary's prose. Every line here was asserted against the
61
+ * checkout when the Issue was cut (or deferred to a declared dependency) and
62
+ * asserted again against the default branch immediately before this render, so
63
+ * the lead sentence is a statement about what the pipeline did, not an
64
+ * invitation to re-verify by hand.
65
+ *
66
+ * Called only when `facts.premises` is non-empty (see the join in
67
+ * `renderBrief`): the section is optional on the Issue, and a brief with an
68
+ * empty heading would read as "checked, nothing to check".
69
+ */
70
+ function renderPremises(premises: readonly IssuePremise[]): string {
71
+ return [
72
+ '## Premises',
73
+ '',
74
+ 'Checked against the code when this task Issue was cut, and again against the default branch at dispatch — facts, not claims.',
75
+ '',
76
+ ...premises.map((p) => {
77
+ const prefix = p.afterIssue === null ? '' : `after #${p.afterIssue}: `
78
+ return `- ${prefix}\`${p.path}\` contains \`${p.text}\``
79
+ })
80
+ ].join('\n')
81
+ }
82
+
56
83
  export type RationaleFieldKey =
57
84
  | 'boundary'
58
85
  | 'dependencyRationale'
@@ -250,6 +277,16 @@ export type BriefFacts = {
250
277
  * legitimate explicit opt-out and is rendered, never treated as absent.
251
278
  */
252
279
  documentation: IssueDocumentation
280
+ /**
281
+ * The Issue's `## Premises` list (`issue-validation.ts`'s
282
+ * `parseIssuePremises`) — the facts about the code this plan rests on, each
283
+ * already re-asserted against the default branch by the caller before this
284
+ * render. `[]` is the absent-section sentinel, same convention as
285
+ * `objectives`/`parts`/`stopConditions`, and the section is genuinely
286
+ * optional: an Issue whose Boundary states nothing about the code as it
287
+ * stands owes no premise.
288
+ */
289
+ premises: IssuePremise[]
253
290
  /**
254
291
  * The resolved gate cutovers (`resolveGateCutovers`, `apps/cli/src/lib/config.ts`).
255
292
  * The renderer's missing-fact refusal for a missing `## Objectives`/
@@ -620,29 +657,43 @@ function renderSection4(facts: BriefFacts): string {
620
657
  return lines.join('\n')
621
658
  }
622
659
 
660
+ /**
661
+ * O2 : Step 0 runs as-written from the Developer's own working directory,
662
+ * which IS the task worktree the driver created — it neither creates nor even
663
+ * ENTERS one. The driver (`dev-review-loop.ts`'s `createTaskWorktree`) creates
664
+ * `.worktrees/<branch>` and pushes the branch to the remote, FROM that
665
+ * worktree, before the first Developer dispatch ever runs — outside any
666
+ * sandbox, so neither vendor's own filesystem confinement (which denies
667
+ * writing the main checkout's `.git`) stands between a dispatched Developer and
668
+ * a worktree it would otherwise have had to create itself. The dispatched
669
+ * session's `cwd` IS that worktree, so Step 0 no longer starts with `cd
670
+ * .worktrees/<branch> &&` — a leading `cd` would read as entering a
671
+ * `.worktrees/` path that does not exist relative to a cwd already inside it.
672
+ * `bun install` stays in Step 0: a fresh worktree still needs its own
673
+ * `node_modules` before the dispatched session can run its own toolchain.
674
+ */
623
675
  function renderSection5(facts: BriefFacts): string {
624
- const branch = developerBranchForFacts(facts)
625
- // The portable form first — `dispatch-readiness` is a shipped check every
626
- // reader of this brief can run. The authoring repository's own fuller
627
- // derivation follows only when `facts` says that repository has one, and
628
- // takes the task arguments from this render rather than from a placeholder.
629
- const unabridgedTarget =
630
- facts.trancheSlug !== null ? `${facts.trancheSlug} ${facts.taskId}` : `--issue ${facts.issue}`
676
+ // Never names the shipped check's or the authoring repository's own
677
+ // fuller derivation as a literal command the Developer runs — the driver
678
+ // runs both itself, from its own unsandboxed process, and stages the
679
+ // result (`dev-review-loop.ts`'s `dispatchDeveloperOnce`); naming the
680
+ // invocation here would read as an instruction to re-run it inside the
681
+ // Developer's own sandbox, where either script's own `gh` call fails
682
+ // (`isolation.md` §4a).
631
683
  const unabridged =
632
684
  facts.localGateCommands.dispatchReadiness !== null
633
- ? ` This repository also ships the unabridged derivation — \`${facts.localGateCommands.dispatchReadiness} ${unabridgedTarget}\` → \`READY TO DISPATCH\`.`
685
+ ? ' plus, on this repository toolchain, its own fuller derivation'
634
686
  : ''
635
687
  const verifyLine =
636
- `2. \`${facts.cliInvocation} check dispatch-readiness\` → pass (re-derived at render time: it was ready).` +
637
- ' Known gap: its prior-tranche-archival predicate always reports empty — confirm that predicate yourself.' +
638
- unabridged
688
+ `2. Under \`${facts.cliInvocation} dispatch\`/the review loop, the driver has already run the dispatch-readiness gate${unabridged} from its own unsandboxed process before dispatching you (re-derived at render time: it was ready), and staged the combined verdict in this round's own Developer folder — read it there; either script's own \`gh\` call fails inside your sandbox. Working manually, with no driver behind you, fall back to ` +
689
+ "`roles/developer.md`'s own items 3/5/7 prose — each a complete, hand-run forge check in its own right."
639
690
  const lines = [
640
691
  '## 5. Pre-flight checks',
641
692
  '',
642
693
  '**Step 0 (mandatory, verbatim):**',
643
694
  '',
644
695
  '```',
645
- `git worktree add .worktrees/${branch} -b ${branch} --no-track origin/main && cd .worktrees/${branch} && git config push.autoSetupRemote true && bun install --frozen-lockfile --silent`,
696
+ 'bun install --frozen-lockfile --silent',
646
697
  '```',
647
698
  '',
648
699
  '1. Clean status; parent `origin/main`; branch suffix literal-matches the task id.',
@@ -727,7 +778,11 @@ function renderSection6(facts: BriefFacts): string {
727
778
  return lines.join('\n')
728
779
  })
729
780
 
730
- return ['## 6. Numbered parts — commit after EACH part; push once, before opening the PR', '', ...rendered].join('\n')
781
+ return [
782
+ '## 6. Numbered parts — call `publish_changes` after EACH part; `open_pull_request` once the first part is published',
783
+ '',
784
+ ...rendered
785
+ ].join('\n')
731
786
  }
732
787
 
733
788
  function renderSection7(section7Pointers: string[]): string {
@@ -764,7 +819,7 @@ function renderSection8(facts: BriefFacts): string {
764
819
  // never a command a check or `pr report` executes — `evidence-fresh`
765
820
  // re-running it under the twenty-six sibling checks CI had just built
766
821
  // deleted their own `dist` out from under them.
767
- `- The pre-push hook already ran the affected suite on your one push and refused it on failure — do not additionally run it yourself; \`${facts.cliInvocation} pr report --write\`/\`--push\` separately re-runs it with \`--force\` to attest the command and its output in the Evidence block.`,
822
+ "- The pre-push hook already ran the affected suite on your one push and refused it on failure — do not additionally run it yourself; the `refresh_evidence` tool regenerates the PR body's Evidence block for the current head, re-running the checks it attests to record their command and output there.",
768
823
  "- The full `bun run test` suite is CI's to run, on the one push — never run it locally.",
769
824
  '- Every blast-radius consumer named in §4, re-verified by name.',
770
825
  `- The tier checklist in \`${facts.cliInvocation} doctrine --role developer --print\` genuinely satisfied, and ${docGateCommand(facts)}.`
@@ -858,7 +913,7 @@ function renderSection12(facts: BriefFacts): string {
858
913
  '## 12. Deliverable',
859
914
  '',
860
915
  `- PR title (exact): \`${prTitle}\``,
861
- `- Open the PR only via \`${facts.cliInvocation} pr create --body-file <path> --title "<title above>"\`.`,
916
+ '- Open the PR only via the `open_pull_request` tool (title and body); publish your commits with `publish_changes` and update the body with `update_pull_request_body`/`refresh_evidence` — you hold no `gh`/`git push` credential.',
862
917
  `- PR body = the Developer's PR report (print it with \`${facts.cliInvocation} doctrine --template pr-report --print\`), with this entire brief pasted as the reference copy inside a collapsed \`<details>\` block, and \`Closes #${facts.issue}\` at the top of the header block.`,
863
918
  `- Pre-open gate: tier checklist satisfied, and ${docGateCommand(facts)}.`,
864
919
  '- Include `git diff main --stat` and a token report (if unavailable, state so).',
@@ -1005,6 +1060,7 @@ export function renderBrief(facts: BriefFacts, template: string): RenderResult {
1005
1060
  ...(facts.documentation.kind === 'none' || facts.documentation.sources.length > 0
1006
1061
  ? [withCli(renderDocumentation(facts.documentation)), '']
1007
1062
  : []),
1063
+ ...(facts.premises.length > 0 ? [renderPremises(facts.premises), ''] : []),
1008
1064
  withCli(renderSection2(facts)),
1009
1065
  '',
1010
1066
  withCli(renderSection3(facts)),
@@ -249,11 +249,28 @@ export function checkDocUpdateList(prBody: string): BriefSectionResult {
249
249
  return headingCheck(prBody, '(?:documentation|doc)[- ]update(?:\\s+list)?', 'Documentation-update list')
250
250
  }
251
251
 
252
+ /**
253
+ * Step 0 no longer creates the worktree (`git worktree add`) — the driver does
254
+ * that before the first Developer dispatch — and no longer enters one either
255
+ * (`cd .worktrees/<branch> && …`): O2, the dispatched session's own `cwd` IS
256
+ * that worktree, so Step 0 is just `bun install --frozen-lockfile …`. Accepts
257
+ * ALL THREE shapes so a brief rendered at any generation passes — the oldest
258
+ * (`git worktree add`), the middle one (`cd .worktrees/`), and the newest
259
+ * (a bare frozen-lockfile install). This gate judges presence of a Step 0
260
+ * marker, never which generation rendered it.
261
+ */
252
262
  export function checkWorktreeStep0(prBody: string): BriefSectionResult {
253
- if (/git worktree add/.test(prBody)) return { status: 'pass', errors: [] }
263
+ if (
264
+ /git worktree add/.test(prBody) ||
265
+ /cd \.worktrees\//.test(prBody) ||
266
+ /bun install --frozen-lockfile/.test(prBody)
267
+ )
268
+ return { status: 'pass', errors: [] }
254
269
  return {
255
270
  status: 'fail',
256
- errors: ['brief-validation worktree Step 0: no `git worktree add` command found in the PR body.']
271
+ errors: [
272
+ 'brief-validation worktree Step 0: no `git worktree add`, `cd .worktrees/`, or `bun install --frozen-lockfile` command found in the PR body.'
273
+ ]
257
274
  }
258
275
  }
259
276
 
@@ -502,16 +519,26 @@ export function isBriefShaped(prBody: string): boolean {
502
519
  }
503
520
 
504
521
  /**
505
- * The branch a brief declares for itself, read from its Step 0 command. At
506
- * authoring time there is no `BRANCH` env var and no branch yet — but every
507
- * brief carries `git worktree add <path> -b <branch> origin/main`, so the brief
508
- * states what it is going to be, and `verify-brief --body-file` can grade it as
509
- * that. Matched on the RAW body, not `stripCode`'s output: Step 0 lives inside a
510
- * fence in every real brief, so the stripped text never contains it.
522
+ * The branch a brief declares for itself. Older generations stated it in
523
+ * their Step 0 command — `git worktree add <path> -b <branch> origin/main`
524
+ * (oldest) or `cd .worktrees/<branch> && …` (the driver creates the worktree,
525
+ * Step 0 only enters it) — so those are read first, on the RAW body (Step 0
526
+ * lives inside a fence, so `stripCode`'s output never contains it); the `-b`
527
+ * form is tried first so an OLD brief quoting both shapes still reads the
528
+ * worktree-creation branch, not a later, unrelated `cd`. O2: the newest
529
+ * generation's Step 0 carries no branch at all — it is a bare `bun install`,
530
+ * run from a `cwd` already inside the worktree — so this falls back to §2's own
531
+ * `Branch \`<branch>\`` identity line, the one other place every brief states
532
+ * its branch, letting `verify-brief --body-file` grade a brief of any
533
+ * generation.
511
534
  */
512
535
  export function inferBranchFromBody(prBody: string): string {
513
- const m = prBody.match(/git worktree add\s+\S+\s+-b\s+(\S+)/)
514
- return m?.[1] ?? ''
536
+ const created = prBody.match(/git worktree add\s+\S+\s+-b\s+(\S+)/)
537
+ if (created) return created[1] ?? ''
538
+ const entered = prBody.match(/cd \.worktrees\/(\S+?)(?=\s|&&|$)/)
539
+ if (entered?.[1]) return entered[1]
540
+ const declared = prBody.match(/Branch `([^`]+)`/)
541
+ return declared?.[1] ?? ''
515
542
  }
516
543
 
517
544
  /**
@@ -783,9 +810,21 @@ function isCommandBlock(content: string): boolean {
783
810
  return (COMMAND_WORDS as readonly string[]).includes(commandWordOf(firstNonBlankLine(content)))
784
811
  }
785
812
 
786
- /** The Step 0 exemption — `git worktree add …` is a command with no separate output block by convention. */
813
+ /**
814
+ * The Step 0 exemption — a command with no separate output block by
815
+ * convention. Matches any generation: `git worktree add …` (an older
816
+ * rendering), `cd .worktrees/… && …` (the driver creates the worktree, Step 0
817
+ * only enters it), or a bare `bun install --frozen-lockfile …` (O2: the driver
818
+ * now ALSO places the Developer's own `cwd` inside that worktree, so Step 0 no
819
+ * longer enters one either — it is just the install).
820
+ */
787
821
  function isStep0Block(content: string): boolean {
788
- return firstNonBlankLine(content).startsWith('git worktree add')
822
+ const first = firstNonBlankLine(content)
823
+ return (
824
+ first.startsWith('git worktree add') ||
825
+ first.startsWith('cd .worktrees/') ||
826
+ first.startsWith('bun install --frozen-lockfile')
827
+ )
789
828
  }
790
829
 
791
830
  /**
@@ -40,6 +40,7 @@ export {
40
40
  markEffectUncertain,
41
41
  mkdirNoSymlinks,
42
42
  readCurrentOwnership,
43
+ readEarliestOwnership,
43
44
  readEffect,
44
45
  readEscalation,
45
46
  readInput,
@@ -536,6 +536,37 @@ export function readCurrentOwnership(
536
536
  return { epoch: best ? bestEpoch : 0, record: best, corruptEpochs }
537
537
  }
538
538
 
539
+ /**
540
+ * The EARLIEST ownership epoch validly recorded for `task`, and when it was
541
+ * acquired — `null` for a task nothing has ever claimed.
542
+ *
543
+ * Every epoch file is created with `O_EXCL` and never overwritten
544
+ * (`attemptEpochClaim`), so epoch 1's `acquiredAt` is the oldest durable
545
+ * timestamp the control store holds for a task and survives every driver
546
+ * restart, re-exec and takeover. That makes it the floor a caller measuring a
547
+ * task's total wall-clock time falls back to when nothing better was recorded:
548
+ * an epoch is claimed the first time the task writes anything durable, so the
549
+ * real start is at or before it, never after — the safe direction for a
550
+ * budget, which then fires no earlier than it should.
551
+ *
552
+ * A corrupt epoch file is skipped rather than reported: this read exists to
553
+ * find the oldest timestamp available, and a torn file carries none. Callers
554
+ * that need to know about corruption read `readCurrentOwnership`, which
555
+ * reports it.
556
+ */
557
+ export function readEarliestOwnership(deps: Pick<ControlStoreDeps, 'root'>, task: number): OwnershipRecord | null {
558
+ const dir = ownershipDir(deps.root(), task)
559
+ if (!existsSync(dir)) return null
560
+ let best: OwnershipRecord | null = null
561
+ for (const entry of readdirSync(dir)) {
562
+ if (!EPOCH_FILENAME.exec(entry)) continue
563
+ const parsed = parseOwnershipRecord(readIfExists(join(dir, entry)))
564
+ if (parsed.status !== 'ok') continue
565
+ if (best === null || parsed.value.epoch < best.epoch) best = parsed.value
566
+ }
567
+ return best
568
+ }
569
+
539
570
  export type AcquireResult =
540
571
  | { acquired: true; epoch: number; record: OwnershipRecord }
541
572
  | { acquired: false; currentEpoch: number; currentOwnerId: string | null }
@@ -119,8 +119,10 @@ export type TransitionRecord = z.infer<typeof TransitionRecordSchema>
119
119
  * against: repository and work (the PR/branch this round belongs to), base and
120
120
  * candidate (`baseSha`/`headSha`), instruction and criteria versions
121
121
  * (`briefHash`/`objectivesVersion`), rulings (`rulingOrdinal`), and the
122
- * complete effective policy identity (`policyDigest`, which folds in the
123
- * round-policy field). `baseSha`/`briefHash`/`objectivesVersion` are nullable
122
+ * blocking-threshold policy identity (`policyDigest`, which covers
123
+ * `codeReviewThreshold`/`securityThreshold` only — the loop's own limits
124
+ * `maxRounds`/`maxTaskMinutes` are left out; see `review-input-manifest.ts`).
125
+ * `baseSha`/`briefHash`/`objectivesVersion` are nullable
124
126
  * exactly where the manifest itself is (`review-input-manifest.ts`'s own
125
127
  * `null` = "nothing resolvable to bind against"); `rulingOrdinal`/
126
128
  * `policyDigest` are never null, the same as on the manifest.
@@ -204,6 +206,52 @@ export const LoopStateRecordSchema = z
204
206
  heldResult: roundHeadIdentity.nullable(),
205
207
  /** The round+head whose findings have already been delivered to the developer once — `null` until a delivery happens; read back so a later attach never redelivers the same (round, head) pair. */
206
208
  deliveredFindings: roundHeadIdentity.nullable(),
209
+ /**
210
+ * The loop's two repeat detectors, carried across a process boundary:
211
+ * the previous reviewed round's blocking-and-open finding keys, and the
212
+ * previous attempt's mechanical failure. Both live in the driver's
213
+ * in-memory `LoopState`, which a re-exec (the driver replacing itself
214
+ * when the base branch moves over its own code) and an attach both
215
+ * start fresh — so without this field the very next round would re-send
216
+ * the developer at a finding or a failure that had in fact already
217
+ * repeated, the exact outcome the two repeat stops exist to prevent.
218
+ * Optional: a record written before this field existed still parses, and
219
+ * reads back as no memory rather than as a corrupt record.
220
+ */
221
+ repeatMemory: z
222
+ .object({
223
+ blockingFindings: z.array(z.string()),
224
+ lastFailure: z.object({ signature: z.string(), message: z.string() }).nullable()
225
+ })
226
+ .strict()
227
+ .optional(),
228
+ /** The original or deliberately advanced task-branch base used by publication checks. */
229
+ publicationExpectedBase: z
230
+ .string()
231
+ .regex(/^[0-9a-f]{40}$/)
232
+ .nullable()
233
+ .optional(),
234
+ /**
235
+ * When the loop FIRST started on this task, as the first driver to persist
236
+ * state for it recorded — carried forward unchanged by every later write,
237
+ * including writes by a driver that took the task over, so the task's own
238
+ * wall-clock budget is measured from one fixed instant rather than
239
+ * restarting with each process. Optional: a record written before this
240
+ * field existed reads back as no recorded start, which a caller reads as
241
+ * "fall back to the earliest ownership epoch" rather than as a corrupt
242
+ * record.
243
+ */
244
+ taskStartedAt: isoTimestamp.optional(),
245
+ /**
246
+ * Milliseconds the loop has recorded against each phase it worked in,
247
+ * keyed by the same `phase` vocabulary the field above uses. Accumulated
248
+ * across driver restarts (each write carries the running totals it read
249
+ * back), and narration only: the task's budget is decided on elapsed time,
250
+ * never on this map, so a run whose earlier phases were recorded by a
251
+ * driver that has since died still stops on time and simply reports less
252
+ * about where the time went.
253
+ */
254
+ phaseMs: z.record(z.string(), z.number().nonnegative()).optional(),
207
255
  recordedAt: isoTimestamp
208
256
  })
209
257
  .strict()