@attalabs/vinaya 0.32.0 → 0.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (218) hide show
  1. package/README.md +1 -1
  2. package/aeg-root/contracts/principal-operator.md +18 -5
  3. package/aeg-root/enforcement.md +1 -1
  4. package/aeg-root/glossary.md +4 -0
  5. package/aeg-root/roles/developer.md +3 -0
  6. package/aeg-root/roles/operator.md +89 -16
  7. package/aeg-root/roles/planner/reference.md +3 -2
  8. package/aeg-root/roles/planner.md +3 -1
  9. package/aeg-root/roles/tranche-archivist.md +1 -0
  10. package/aeg-root/skills/aeg-context-packets/SKILL.md +1 -1
  11. package/aeg-root/skills/aeg-context-packets/examples/operator-start.md +1 -1
  12. package/aeg-root/templates/brief-template.md +9 -7
  13. package/aeg-root/templates/pr-report-template.md +3 -1
  14. package/dist/checks/bin/check-body-bare-digits.js +213 -41
  15. package/dist/checks/bin/check-branch-topology.js +164 -41
  16. package/dist/checks/bin/check-brief-shape.js +219 -46
  17. package/dist/checks/bin/check-changeset-coverage.js +669 -152
  18. package/dist/checks/bin/check-closes-n.js +164 -41
  19. package/dist/checks/bin/check-coherence.js +220 -43
  20. package/dist/checks/bin/check-dead-branch-push.js +159 -40
  21. package/dist/checks/bin/check-dispatch-readiness.js +218 -42
  22. package/dist/checks/bin/check-doc-coverage-push.js +665 -148
  23. package/dist/checks/bin/check-doc-coverage.js +667 -150
  24. package/dist/checks/bin/check-doctrine-no-procedures.js +213 -41
  25. package/dist/checks/bin/check-doctrine-portability.js +666 -149
  26. package/dist/checks/bin/check-evidence-fresh.js +643 -125
  27. package/dist/checks/bin/check-exec-bits.js +663 -146
  28. package/dist/checks/bin/check-first-push-dispatch.js +218 -42
  29. package/dist/checks/bin/check-issue-assignment.js +164 -41
  30. package/dist/checks/bin/check-issue-milestone-attach.js +159 -40
  31. package/dist/checks/bin/check-issue-objectives-numbering.js +685 -41
  32. package/dist/checks/bin/check-issue-parts-coverage.js +159 -40
  33. package/dist/checks/bin/check-issue-surface-globs.js +258 -48
  34. package/dist/checks/bin/check-issue-title-grammar.js +159 -40
  35. package/dist/checks/bin/check-issue-tranche-label.js +159 -40
  36. package/dist/checks/bin/check-main-branch-refusal.js +159 -40
  37. package/dist/checks/bin/check-no-disk-state.js +159 -40
  38. package/dist/checks/bin/check-pr-premise-reassert.js +213 -41
  39. package/dist/checks/bin/check-pr-report-density.js +159 -40
  40. package/dist/checks/bin/check-principal-test-plan-wait.js +159 -40
  41. package/dist/checks/bin/check-quoted-command.js +586 -103
  42. package/dist/checks/bin/check-reader-resolvable-prose.js +637 -111
  43. package/dist/checks/bin/check-registry-gates.js +159 -40
  44. package/dist/checks/bin/check-retired-vocabulary.js +586 -103
  45. package/dist/checks/bin/check-review-gate.js +284 -152
  46. package/dist/checks/bin/check-single-plan-pr.js +159 -40
  47. package/dist/checks/bin/check-surface-scope.js +164 -41
  48. package/dist/checks/bin/check-test-plan.js +159 -40
  49. package/dist/checks/bin/check-token-collection-wired.js +159 -40
  50. package/dist/checks/bin/check-token-report.js +159 -40
  51. package/dist/checks/bin/check-workspace-escape.js +664 -147
  52. package/dist/index.js +3932 -1118
  53. package/dist/lib/pre-push-cache-test-run.js +507 -72
  54. package/dist/lib/pre-push-select-tests.js +136 -13
  55. package/package.json +1 -1
  56. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/actions.ts +10 -12
  57. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/anchored-region.ts +5 -5
  58. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/archive-task.ts +42 -17
  59. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/baseline-capture.ts +1 -2
  60. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/branch-topology-gate.ts +3 -3
  61. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +554 -95
  62. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-validation.ts +264 -44
  63. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/claude-code-transcript.ts +9 -9
  64. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/coherence-checks.ts +211 -30
  65. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/consumer-enumeration.ts +2 -2
  66. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/index.ts +75 -0
  67. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/local.ts +961 -0
  68. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/migration.ts +222 -0
  69. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/outcomes.ts +135 -0
  70. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/records.ts +394 -0
  71. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dead-branch-push-audit.ts +1 -2
  72. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dead-branch-push-guard.ts +1 -1
  73. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/derive-section7.ts +2 -2
  74. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/assess-round.ts +514 -0
  75. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/fakes.ts +110 -0
  76. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/index.ts +30 -0
  77. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/journal-reconstruction.ts +219 -0
  78. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/render-summary.ts +97 -0
  79. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/types.ts +240 -0
  80. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/diagram-model.ts +1 -1
  81. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/direct-main-push.ts +1 -2
  82. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dispatch-gate.ts +65 -22
  83. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doc-claim.ts +238 -0
  84. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doc-owners.ts +14 -1
  85. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/docs-coherence.ts +1 -1
  86. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/legacy-anchors.ts +1 -1
  87. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/node-route.ts +1 -1
  88. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/surfaced-manifest.ts +1 -1
  89. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doctrine-no-procedures.ts +1 -1
  90. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doctrine-portability.ts +5 -5
  91. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/ensure-label.ts +1 -1
  92. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/first-push-dispatch-gate.ts +1 -1
  93. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/gate-audience.ts +14 -3
  94. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +425 -11
  95. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-assignment.ts +3 -4
  96. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +1450 -33
  97. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/leftover-detection.ts +1 -2
  98. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/local-anchor-coverage.ts +2 -2
  99. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/envelope.ts +119 -0
  100. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/index.ts +75 -0
  101. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/redact.ts +87 -0
  102. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/schema.ts +801 -0
  103. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/store.ts +373 -0
  104. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/main-branch-refusal.ts +2 -2
  105. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/metering-io-guard.ts +1 -1
  106. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/milestone-validation.ts +2 -3
  107. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/no-disk-state.ts +2 -2
  108. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/objectives.ts +288 -0
  109. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/parse-token-report.ts +3 -3
  110. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/parse-tranche.ts +1 -1
  111. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/pr-report-density.ts +30 -16
  112. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/pr-tier.ts +17 -1
  113. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/premise-check.ts +1 -1
  114. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/quoted-command.ts +1 -1
  115. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/reader-resolvable-prose.ts +267 -19
  116. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/registry-checks.ts +91 -24
  117. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/registry-scaffold.ts +6 -6
  118. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/report-tokens.ts +4 -4
  119. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-gate.ts +254 -110
  120. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-input-manifest.ts +384 -0
  121. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-policy.ts +208 -0
  122. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-status.ts +80 -28
  123. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/ruling-ordinal.ts +92 -0
  124. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/single-plan-pr.ts +4 -4
  125. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/state-machine-model.ts +40 -27
  126. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/symbol-collisions.ts +2 -2
  127. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-branch-identity.ts +38 -0
  128. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-phase-history.ts +194 -0
  129. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-tools.ts +712 -0
  130. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/test-plan-gate.ts +7 -9
  131. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/test-plan-section.ts +5 -5
  132. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/types.ts +4 -4
  133. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/verdict-extraction.ts +368 -56
  134. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/waiver-label.ts +2 -3
  135. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/workspace-escape.ts +3 -3
  136. package/studio-standalone/apps/vinaya-studio/web/.next/BUILD_ID +1 -1
  137. package/studio-standalone/apps/vinaya-studio/web/.next/build-manifest.json +3 -3
  138. package/studio-standalone/apps/vinaya-studio/web/.next/prerender-manifest.json +3 -3
  139. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.html +1 -1
  140. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.rsc +1 -1
  141. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  142. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  143. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  144. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  145. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  146. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page/server-reference-manifest.json +2 -2
  147. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  148. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  149. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js +1 -1
  150. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.nft.json +1 -1
  151. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page/server-reference-manifest.json +2 -2
  152. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js.nft.json +1 -1
  153. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page_client-reference-manifest.js +1 -1
  154. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page/server-reference-manifest.json +2 -2
  155. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js +1 -1
  156. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js.nft.json +1 -1
  157. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page_client-reference-manifest.js +1 -1
  158. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page/server-reference-manifest.json +2 -2
  159. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js +1 -1
  160. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js.nft.json +1 -1
  161. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page_client-reference-manifest.js +1 -1
  162. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page/server-reference-manifest.json +2 -2
  163. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js +1 -1
  164. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js.nft.json +1 -1
  165. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page_client-reference-manifest.js +1 -1
  166. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page/server-reference-manifest.json +3 -3
  167. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js +2 -2
  168. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js.nft.json +1 -1
  169. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page_client-reference-manifest.js +1 -1
  170. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page/server-reference-manifest.json +2 -2
  171. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js +1 -1
  172. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js.nft.json +1 -1
  173. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
  174. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page/server-reference-manifest.json +2 -2
  175. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js +1 -1
  176. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js.nft.json +1 -1
  177. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page_client-reference-manifest.js +1 -1
  178. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page/server-reference-manifest.json +2 -2
  179. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js +1 -1
  180. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js.nft.json +1 -1
  181. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page_client-reference-manifest.js +1 -1
  182. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/{[externals]__1agj1ww._.js → [externals]__0cki-x_._.js} +2 -2
  183. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[root-of-the-server]__02a-3g8._.js +6 -6
  184. 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
  185. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__074w9nf._.js +3 -0
  186. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__0r7e54g._.js → [root-of-the-server]__07uhu5z._.js} +1 -1
  187. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ls23oh._.js +1 -1
  188. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1gjqmhq._.js +1 -1
  189. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1wc4-ip._.js +1 -1
  190. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1r47dr7._.js → _08onyya._.js} +3 -3
  191. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_096f46i._.js +1 -1
  192. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0af2one._.js +1 -1
  193. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0e5tkdd._.js +1 -1
  194. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0kf2g72._.js +1 -1
  195. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0y1jv16._.js +1 -1
  196. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0zf4d27._.js +1 -1
  197. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1-wo68i._.js +1 -1
  198. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_15gdg48._.js +5 -5
  199. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1achbh9._.js +1 -1
  200. 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
  201. package/studio-standalone/apps/vinaya-studio/web/.next/server/middleware-build-manifest.js +3 -3
  202. package/studio-standalone/apps/vinaya-studio/web/.next/server/pages/500.html +1 -1
  203. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.js +1 -1
  204. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.json +4 -4
  205. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0bjnj-5fy4e7l.js +1 -0
  206. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ko698wh8xx2g.css +1 -0
  207. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{1dc2_-c_gavj1.js → 0q9p7c6vn-x2w.js} +4 -4
  208. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3xg6-flovrcx-.js → 2174nz5he_oc4.js} +1 -1
  209. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3xnma0-359j17.js +1 -0
  210. package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
  211. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0hstap0._.js +0 -3
  212. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0bm4nrrzwc7zi.css +0 -1
  213. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2t_rfsztmwu6y.js +0 -1
  214. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3ua4rm5f-a9k6.js +0 -1
  215. /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/{aeg-core → vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/aeg-core}/bin/verify-coherence.ts +0 -0
  216. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{e8XbZ2vlVz40KzHmlqhwP → HmoeqXdX1E4drt7GReFOO}/_buildManifest.js +0 -0
  217. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{e8XbZ2vlVz40KzHmlqhwP → HmoeqXdX1E4drt7GReFOO}/_clientMiddlewareManifest.js +0 -0
  218. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{e8XbZ2vlVz40KzHmlqhwP → HmoeqXdX1E4drt7GReFOO}/_ssgManifest.js +0 -0
@@ -13,8 +13,10 @@
13
13
  */
14
14
 
15
15
  import { type AnchorField, anchoredRegion, stripCode } from './anchored-region'
16
+ import { type Objective, objectivesVersion, objectivesOf } from './objectives'
16
17
  import { parsePremiseBlock, premiseBlockText } from './premise-check'
17
18
  import { locateTestPlanSection } from './test-plan-section'
19
+ import { isPrincipal } from './waiver-label'
18
20
 
19
21
  export type BriefSectionResult = { status: 'pass' | 'fail'; errors: string[] }
20
22
 
@@ -25,7 +27,7 @@ export type BriefSectionResult = { status: 'pass' | 'fail'; errors: string[] }
25
27
  * Anchoring field extraction here — shared with `archive-task.ts` — is what
26
28
  * stops prose in later sections that merely *mentions* a field name (e.g. a
27
29
  * "Decisions made" paragraph discussing the `Ticket:` field) from being
28
- * parsed as the field itself. Regression from #311's first live archivist
30
+ * parsed as the field itself. A regression from the first live archivist
29
31
  * run, where exactly that happened.
30
32
  */
31
33
  export function headerRegion(prBody: string): string {
@@ -93,7 +95,7 @@ export function checkTierField(prBody: string, readTier: (body: string) => 0 | 1
93
95
  * `checkTestPlanExclusivity` silently false-PASSED a self-contradictory one (a
94
96
  * bolded `unit-tests-only` **plus** tagged checkboxes never tripped it, because
95
97
  * its own guard clause never matched either) — the exact combination that guard
96
- * was built for in #340. Fixing the doc instead of the pattern was rejected:
98
+ * was built for. Fixing the doc instead of the pattern was rejected:
97
99
  * bold is the house convention for brief fields, so an unbolded Test Plan is the
98
100
  * odd one out and drifts back the moment someone tidies it.
99
101
  */
@@ -128,9 +130,9 @@ function testPlanRegion(prBody: string): string {
128
130
  */
129
131
  /**
130
132
  * Presence-only Test Plan detector — three acceptable shapes since task 12
131
- * (#387) rendered the `[agent]` half of a Test Plan as a fenced command list
133
+ * rendered the `[agent]` half of a Test Plan as a fenced command list
132
134
  * rather than a checkbox: the `unit-tests-only` sentinel; a
133
- * `**[agent]**`/`**[principal]**`-tagged checkbox line (the pre-#387 shape,
135
+ * `**[agent]**`/`**[principal]**`-tagged checkbox line (the older checkbox shape,
134
136
  * still valid on a PR below `AGENT_BOXES_REFUSED_SINCE_PR` and for
135
137
  * `[principal]` items on every PR); or a fenced code block anywhere in the
136
138
  * Test Plan region (the fenced-command-list shape). This gate does not judge
@@ -162,12 +164,12 @@ export function checkTestPlan(prBody: string): BriefSectionResult {
162
164
  }
163
165
 
164
166
  /**
165
- * Test Plan shape guard (aeg-governance-hardening task 20 follow-up, #340) —
167
+ * Test Plan shape guard —
166
168
  * `Test Plan: unit-tests-only` and a tagged checkbox item are mutually
167
169
  * exclusive per brief-authoring §9 ("The two fields are coupled; Brief
168
170
  * Validation cross-checks them"): `unit-tests-only` declares there is no
169
171
  * checklist because there is nothing runtime to check off, so a body
170
- * carrying both is self-contradictory. Regression source: PR #363's own
172
+ * carrying both is self-contradictory. Regression source: a real
171
173
  * original brief declared `unit-tests-only` while its Test Plan also listed
172
174
  * `- [x]`/`- [ ]` `[agent]`/`[principal]` items — a combination this gate
173
175
  * previously let through.
@@ -187,32 +189,38 @@ export function checkTestPlanExclusivity(prBody: string): BriefSectionResult {
187
189
  }
188
190
 
189
191
  /**
190
- * Principal-placeholder guard (aeg-governance-hardening task 20 follow-up,
191
- * #340) — a `**[principal]**` checkbox item whose content is a
192
+ * Principal-placeholder guard — a `**[principal]**` checkbox item whose content is a
192
193
  * none-placeholder ("None — …") is untickable by construction: nobody can
193
194
  * check a box asserting there is nothing to verify, so it blocks the merge
194
195
  * gate forever. If a brief genuinely has no principal-runnable surface, the
195
196
  * item must be omitted entirely, not declared and left permanently unticked.
197
+ *
198
+ * **O12 — reports every placeholder line, not only the first.** A body with
199
+ * more than one `**[principal]** None …` line used to `return` on the first
200
+ * `matchAll` hit, so an author fixing the reported line and re-running
201
+ * would meet the second violation only on the NEXT run — one round-trip per
202
+ * line for a mechanically-fixable body. Collecting into `errors` and
203
+ * falling through is the same shape every sibling exhaustive check in this
204
+ * file already uses (`checkCommandsCarryOutput`, `checkConsumerTests`,
205
+ * `checkObjectivesCoverage`).
196
206
  */
197
207
  export function checkPrincipalPlaceholder(prBody: string): BriefSectionResult {
198
208
  const region = testPlanRegion(prBody)
199
209
  const lineRe = /^-\s*\[[ xX]\]\s*\*{2}\[principal\]\*{2}(.*)$/gim
210
+ const errors: string[] = []
200
211
  for (const m of region.matchAll(lineRe)) {
201
212
  const content = m[1] ?? ''
202
213
  if (/^\s*None\b/i.test(content)) {
203
- return {
204
- status: 'fail',
205
- errors: [
206
- 'brief-validation Test Plan shape: a `**[principal]**` checkbox item is a "None" placeholder — if there is no principal-runnable surface, omit the item entirely; an untickable placeholder box blocks the merge gate forever.'
207
- ]
208
- }
214
+ errors.push(
215
+ `brief-validation Test Plan shape: a \`**[principal]**\` checkbox item is a "None" placeholder ("${content.trim()}") — if there is no principal-runnable surface, omit the item entirely; an untickable placeholder box blocks the merge gate forever.`
216
+ )
209
217
  }
210
218
  }
211
- return { status: 'pass', errors: [] }
219
+ return errors.length > 0 ? { status: 'fail', errors } : { status: 'pass', errors: [] }
212
220
  }
213
221
 
214
222
  /**
215
- * Premise coverage (this task, aeg-governance-hardening 11, #324) — pass iff
223
+ * Premise coverage — pass iff
216
224
  * either (a) at least one `Premise:` assertion's path matches a file in
217
225
  * `surfaceFiles` (the §4 surface map's file list — in practice, the PR's
218
226
  * actual changed-file list, the same diff-derived-truth philosophy
@@ -276,8 +284,8 @@ export function checkAutonomyClause(prBody: string): BriefSectionResult {
276
284
  * and tells the Reviewer whose behavior to verify). Must appear in the header
277
285
  * block, where the Archivist's provenance assembly also reads it — gate and
278
286
  * archivist share `headerRegion`, so a body that passes this gate can never
279
- * produce a DANGLING Project field in provenance. Added after #311 merged
280
- * without it: the Developer satisfied exactly the sections this gate checked
287
+ * produce a DANGLING Project field in provenance. Added after a real gap
288
+ * merged without it: the Developer satisfied exactly the sections this gate checked
281
289
  * and dropped everything it didn't — whatever the gate doesn't enforce, agents
282
290
  * will eventually omit (contract-gate parity is the fix, not discipline).
283
291
  */
@@ -313,8 +321,8 @@ export function checkForField(prBody: string): BriefSectionResult {
313
321
  * blocks + inline spans removed via `stripCode`), so it agrees byte-for-byte
314
322
  * with GitHub's own auto-close parser, which also ignores `Closes #N` inside
315
323
  * code. Without the strip, a body whose only closing reference is backticked
316
- * (`` `Closes #600` ``) passed this gate green yet merged **without** closing
317
- * its Issue — stranding #600 (PR #608) and #601 (PR #611) and reddening every
324
+ * (`` `Closes #NNN` ``) passed this gate green yet merged **without** closing
325
+ * its Issue — stranding real Issues and reddening every
318
326
  * open PR via the A3 `auto-close-misfire` oracle. "verify-docs green" must
319
327
  * imply "GitHub will auto-close"; stripping code here is what makes it so.
320
328
  *
@@ -322,13 +330,13 @@ export function checkForField(prBody: string): BriefSectionResult {
322
330
  * unbounded `\s*` around an optional `:` backtrack quadratically on a body of
323
331
  * the shape `closes` + long whitespace + no `#` — ~2.65 s at GitHub's
324
332
  * 65,536-char body cap, and this function runs the pattern twice on the fail
325
- * path (PR #617 security pass). A constant bound makes the work per start
333
+ * path (a security-review finding). A constant bound makes the work per start
326
334
  * position constant, so the scan is linear in body length. Eight is far past
327
335
  * any real separator; a body needing more is malformed by the brief's own
328
336
  * convention (a bare ref inside the `AEG:CLOSES` anchor) and fails with an
329
337
  * actionable message rather than silently stranding its Issue.
330
338
  */
331
- export function checkClosesN(prBody: string): BriefSectionResult {
339
+ export function checkClosesNPresence(prBody: string): BriefSectionResult {
332
340
  const closesPattern = /(?:close[sd]?|fix(?:e[sd])?|resolve[sd]?)\s{0,8}:?\s{0,8}#\d+/i
333
341
  if (closesPattern.test(stripCode(prBody))) {
334
342
  return { status: 'pass', errors: [] }
@@ -395,8 +403,8 @@ export function checkForgeTitle(title: string): BriefSectionResult {
395
403
 
396
404
  /**
397
405
  * Plan-PR Closes guard — a `plan/*` PR body must never carry a
398
- * `Closes #N` reference. Three confirmed live incidents (#294→#293,
399
- * #298→#297, #288→#287) show a plan PR's `Closes #N` prematurely closing
406
+ * `Closes #N` reference. Three confirmed live incidents
407
+ * show a plan PR's `Closes #N` prematurely closing
400
408
  * the task Issue when the *plan* merged — before the task itself ever ran.
401
409
  * `roles/planner.md`'s Plan-PR close-out section already forbids this in
402
410
  * prose ("a plan PR creates Issues; it does not resolve one"); this is the
@@ -433,17 +441,20 @@ export function checkPlanPrNoCloses(branch: string, prBody: string): BriefSectio
433
441
  const BRIEF_SHAPE_MARKERS = [checkSurfaceMap, checkDocUpdateList, checkStopConditions, checkAutonomyClause] as const
434
442
 
435
443
  /**
436
- * A task branch, per the topology naming convention (`task/<tranche>/<n>`).
444
+ * A task branch, per the topology naming convention (`task/<tranche>/<n>`)
445
+ * OR the tranche-less backlog-Issue convention (`task/issue-<n>`) —
446
+ * a task whose Issue is `<n>` with no tranche.
437
447
  * The one shared copy — `bin/verify-brief.ts`, `test-plan-gate.ts`, and
438
448
  * `archive-task.ts` each still define this pattern locally (out of this
439
449
  * export's blast radius; not deduped onto it here), but a new consumer
440
- * (`check-brief-shape.ts`, #870) reuses this one rather than adding a
450
+ * (`check-brief-shape.ts`) reuses this one rather than adding a
441
451
  * fourth copy.
442
452
  */
443
453
  const TASK_BRANCH_PATTERN = /^task\/[^/]+\/[^/]+$/
454
+ const TASK_ISSUE_BRANCH_PATTERN = /^task\/issue-\d+$/
444
455
 
445
456
  export function isTaskBranch(branch: string): boolean {
446
- return TASK_BRANCH_PATTERN.test(branch)
457
+ return TASK_BRANCH_PATTERN.test(branch) || TASK_ISSUE_BRANCH_PATTERN.test(branch)
447
458
  }
448
459
 
449
460
  /**
@@ -460,7 +471,7 @@ export function isTaskBranch(branch: string): boolean {
460
471
  * a brief, it must be a complete brief, whatever the branch is called.*
461
472
  *
462
473
  * Detection runs on `stripCode(prBody)` (the single shared stripper from
463
- * `anchored-region`, per #617's "one stripper, never a duplicated regex"). A PR
474
+ * `anchored-region`, per this codebase's "one stripper, never a duplicated regex" rule). A PR
464
475
  * that *quotes* a brief inside a fence — "here's a sample brief: ``` …Technical
465
476
  * surface map… ```" — is discussing a brief, not carrying one, and must stay
466
477
  * exempt; matching on raw text would force-validate it. Note this also rules out
@@ -513,9 +524,9 @@ export const BRIEF_RULES_SINCE_PR = 394
513
524
  /**
514
525
  * Rollout PR number for `checkNoAgentBoxes`, below — a second, distinct
515
526
  * cutover from `BRIEF_RULES_SINCE_PR` above, per the Principal's ruling
516
- * (2026-09-03, after PR #395): an agent never ticks a box or edits a PR
527
+ * (2026-09-03): an agent never ticks a box or edits a PR
517
528
  * body, so the `[agent]` half of a Test Plan stops being checkboxes and
518
- * becomes a fenced command list (task 12, #387). A PR numbered below this
529
+ * becomes a fenced command list. A PR numbered below this
519
530
  * is grandfathered — its checkbox `[agent]` items were written before the
520
531
  * ruling and are reported informationally, never a failure. `verify-brief.ts`
521
532
  * (authoring time, pre-dispatch) has no PR number and applies the rule
@@ -528,7 +539,7 @@ const AGENT_BOX_LINE_RE = /^-\s*\[[ xX]\]\s*\*{2}\[agent\]\*{2}/im
528
539
 
529
540
  /**
530
541
  * Refuses a Test Plan whose `[agent]` half is still a checkbox item — the
531
- * shape the fenced-command-list rule (task 12, #387) replaces. Presence-only
542
+ * shape the fenced-command-list rule replaces. Presence-only
532
543
  * within the Test Plan region (`testPlanRegion`), like every sibling check
533
544
  * in this file: whether the fenced list a body carries instead is any GOOD
534
545
  * is a Reviewer/Verification judgment, not this gate's.
@@ -665,7 +676,7 @@ const FILE_LINE_RE = /\b[\w./-]+\.(?:tsx?|jsx?|mjs|cjs|md|mdx|json|ya?ml|sh|py|t
665
676
  * but a single-backtick inline span is left as literal text — the PR #382
666
677
  * sentence was exactly an inline span, and this rule must still catch it.
667
678
  * This is why `maskCode` (which blanks inline spans too) is the wrong tool
668
- * here, unlike `checkClosesN`/`isBriefShaped` elsewhere in this file.
679
+ * here, unlike `checkClosesNPresence`/`isBriefShaped` elsewhere in this file.
669
680
  */
670
681
  export function checkNoUnpinnedCodeClaims(prBody: string): BriefSectionResult {
671
682
  const premiseText = premiseBlockText(prBody)
@@ -715,7 +726,7 @@ function isStep0Block(content: string): boolean {
715
726
  }
716
727
 
717
728
  /**
718
- * Rule (ii) (task 10, Issue #385; tightened by the round-2 ruling item 1) —
729
+ * Rule (ii) (tightened by a later ruling) —
719
730
  * in a brief's `§5` (Pre-flight checks) or `§6` (Numbered parts), a fenced
720
731
  * block that opens with a shell command must be immediately followed by
721
732
  * another fenced block that does NOT itself open with a shell command — its
@@ -735,7 +746,7 @@ function isStep0Block(content: string): boolean {
735
746
  * Deliberately loose about what sits *between* the two fences (the prose
736
747
  * separating them, never counted) — this brief's own pre-flight steps
737
748
  * (`§5` items 4-9) interleave a sentence of prose between a command fence
738
- * and its output fence ("Output the Brief Author obtained at authoring
749
+ * and its output fence ("Output the Planner obtained at authoring
739
750
  * time…"), and the rule must not fail the brief that documents it.
740
751
  */
741
752
  export function checkCommandsCarryOutput(prBody: string): BriefSectionResult {
@@ -763,8 +774,15 @@ export function checkCommandsCarryOutput(prBody: string): BriefSectionResult {
763
774
 
764
775
  const CONSUMER_TESTS_SENTINEL_RE = /consumer-tests\s*:\s*none\s*[-—–]\s*\S/i
765
776
 
766
- /** Every distinct `packages/<pkg>/` reference in `text` — the packages a §4 surface map names. */
767
- function packagesNamedIn(text: string): string[] {
777
+ /**
778
+ * Every distinct `packages/<pkg>/` reference in `text` — the packages a §4
779
+ * surface map names. Exported so `brief-render.ts`'s
780
+ * `renderSection4` can scan the same rendered text with the same regex
781
+ * before `checkConsumerTests` ever re-scans it — one implementation of the
782
+ * trigger, read on both sides, rather than a renderer-side heuristic that
783
+ * could silently disagree with this validator's own scan.
784
+ */
785
+ export function packagesNamedIn(text: string): string[] {
768
786
  const re = /\bpackages\/([A-Za-z0-9_-]+)\//g
769
787
  const pkgs = new Set<string>()
770
788
  let m: RegExpExecArray | null = re.exec(text)
@@ -775,15 +793,26 @@ function packagesNamedIn(text: string): string[] {
775
793
  return [...pkgs]
776
794
  }
777
795
 
778
- /** Whether `text` names a test-shaped path (`*.test.<ext>`) under workspace directory `consumerDir` (e.g. `apps/cli`, `packages/sources`). */
796
+ /**
797
+ * Whether `text` names a test-shaped path under workspace directory
798
+ * `consumerDir` (e.g. `apps/cli`, `packages/sources`) — either a real
799
+ * `*.test.<ext>` FILE, or a bare `tests`/`specs` DIRECTORY reference (task
800
+ * 17, O6: `brief-render.ts`'s `renderSection4` names the latter, never a
801
+ * file, whenever `boundaryNarrowsSurface` hides individual files from §4's
802
+ * Modify list — a directory-only brief must never fail the validator its
803
+ * own renderer produces). Segment equality for the directory form, the same
804
+ * convention `checkSurfaceOverlap`'s O4 exemption uses — `apps/testsuite`
805
+ * does not count as `apps/cli/tests` does.
806
+ */
779
807
  function hasTestPathForConsumer(text: string, consumerDir: string): boolean {
780
808
  const escaped = consumerDir.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
781
- const re = new RegExp(`${escaped}\\/[\\w./-]*\\.test\\.[A-Za-z0-9]+`)
782
- return re.test(text)
809
+ const filePathRe = new RegExp(`${escaped}\\/[\\w./-]*\\.test\\.[A-Za-z0-9]+`)
810
+ const testDirRe = new RegExp(`${escaped}\\/(?:[\\w-]+\\/)*(?:tests|specs)(?:\\/|\\b)`)
811
+ return filePathRe.test(text) || testDirRe.test(text)
783
812
  }
784
813
 
785
814
  /**
786
- * Rule (iii) (task 10, Issue #385) — a brief whose `§4` names a path under a
815
+ * Rule (iii) — a brief whose `§4` names a path under a
787
816
  * shared `packages/<pkg>/` must also name, for every workspace package that
788
817
  * depends on `@attalabs/<pkg>`, a test path proving that consumer still
789
818
  * works, or the sentinel `consumer-tests: none — <reason>` opting out with a
@@ -827,7 +856,7 @@ const FORGE_WRITE_COMMAND_RE =
827
856
  const DEFEAT_CASES_RE = /defeat cases\s*:/i
828
857
 
829
858
  /**
830
- * Rule (v) — Principal ruling amending Issue #385: a brief whose `§4`
859
+ * Rule (v) — a Principal ruling: a brief whose `§4`
831
860
  * names a check (a `check-<slug>.ts` bin, or its registry entry) or a
832
861
  * forge-writing command (`gh pr create`, `git push`, `vinaya pr create`, …)
833
862
  * must carry a `Defeat cases:` line in `§6` — the inputs that would defeat
@@ -853,6 +882,86 @@ export function checkDefeatCases(prBody: string): BriefSectionResult {
853
882
  }
854
883
  }
855
884
 
885
+ /**
886
+ * Every `Part <n> (<refs>)` citation's `O<n>` ids, across every match in
887
+ * `section6`. A Part with no parenthetical group after its number cites
888
+ * nothing and is not scrutinized either way by `checkObjectivesCoverage` —
889
+ * an administrative Part (a changeset commit, the final push) legitimately
890
+ * maps to no single objective; this brief's own §6 Part 5 ("changeset. Then
891
+ * the one push.") is exactly that shape.
892
+ */
893
+ export const PART_CITATION_RE = /Part\s+\d+\s*\(([^)]*)\)/gi
894
+ const OBJECTIVE_REF_RE = /O(\d+)/g
895
+
896
+ function citedObjectiveIds(section6: string): Set<number> {
897
+ const ids = new Set<number>()
898
+ for (const m of section6.matchAll(PART_CITATION_RE)) {
899
+ for (const r of (m[1] as string).matchAll(OBJECTIVE_REF_RE)) ids.add(Number.parseInt(r[1] as string, 10))
900
+ }
901
+ return ids
902
+ }
903
+
904
+ /**
905
+ * Objectives copy — the brief's
906
+ * own `## Objectives` section must match the Issue's, compared via
907
+ * `objectivesVersion` (normalised — an editor's whitespace must not fail
908
+ * this gate; one changed word must). `issueObjectives` is injected: the
909
+ * caller resolves it live from the forge (`Closes #N`'s Issue) on a task
910
+ * branch, or from the body's own section on a standalone brief with no
911
+ * Issue to compare against (verify-brief.ts/check-brief-shape.ts).
912
+ */
913
+ export function checkObjectivesCopy(prBody: string, issueObjectives: Objective[]): BriefSectionResult {
914
+ const parsed = objectivesOf(prBody)
915
+ if (!parsed.ok) {
916
+ return { status: 'fail', errors: parsed.errors.map((e) => `brief-validation objectives copy: ${e}`) }
917
+ }
918
+ if (objectivesVersion(parsed.objectives) !== objectivesVersion(issueObjectives)) {
919
+ return {
920
+ status: 'fail',
921
+ errors: [
922
+ "brief-validation objectives copy: the brief's `## Objectives` section does not match the Issue's — copy the Issue's `## Objectives` section (aeg-root/roles/developer.md)."
923
+ ]
924
+ }
925
+ }
926
+ return { status: 'pass', errors: [] }
927
+ }
928
+
929
+ /**
930
+ * Objectives coverage — every
931
+ * `O<n>` the brief's own `## Objectives` section declares must be cited by
932
+ * at least one `Part <n> (O<k>[, O<j>...])` line in §6, and a Part that DOES
933
+ * cite one must cite an objective that actually exists. Self-contained
934
+ * (needs only `prBody`) — unlike `checkObjectivesCopy`, this rule never
935
+ * depends on a live Issue read.
936
+ */
937
+ export function checkObjectivesCoverage(prBody: string): BriefSectionResult {
938
+ const parsed = objectivesOf(prBody)
939
+ if (!parsed.ok) {
940
+ return { status: 'fail', errors: parsed.errors.map((e) => `brief-validation objectives coverage: ${e}`) }
941
+ }
942
+ const declaredIds = new Set(parsed.objectives.map((o) => Number.parseInt(o.id.slice(1), 10)))
943
+ const section6 = extractNumberedSection(prBody, 6) ?? ''
944
+ const cited = citedObjectiveIds(section6)
945
+ const maxDeclared = Math.max(...declaredIds, 0)
946
+
947
+ const errors: string[] = []
948
+ for (const id of declaredIds) {
949
+ if (!cited.has(id)) {
950
+ errors.push(
951
+ `brief-validation objectives coverage: O${id} is not cited by any Part in §6 — every objective must be cited by at least one Part.`
952
+ )
953
+ }
954
+ }
955
+ for (const id of cited) {
956
+ if (!declaredIds.has(id)) {
957
+ errors.push(
958
+ `brief-validation objectives coverage: a Part in §6 cites O${id}, but the Objectives section ends at O${maxDeclared}.`
959
+ )
960
+ }
961
+ }
962
+ return errors.length === 0 ? { status: 'pass', errors: [] } : { status: 'fail', errors }
963
+ }
964
+
856
965
  /** Composition knobs for `checkBriefSections` — see each field. */
857
966
  export type BriefSectionsOptions = {
858
967
  /**
@@ -868,7 +977,7 @@ export type BriefSectionsOptions = {
868
977
  */
869
978
  requireClosesN?: boolean
870
979
  /**
871
- * Consumer enumeration for `checkConsumerTests` (task 10) — workspace
980
+ * Consumer enumeration for `checkConsumerTests` — workspace
872
981
  * directories (e.g. `apps/cli`) whose `package.json` depends on
873
982
  * `@attalabs/<pkg>`. Defaults to `() => []`, which makes rule (iii) a
874
983
  * no-op — the callers that don't wire a real dependency graph (tests,
@@ -876,6 +985,15 @@ export type BriefSectionsOptions = {
876
985
  * on an empty consumer list.
877
986
  */
878
987
  consumersOf?: (pkg: string) => string[]
988
+ /**
989
+ * The Issue's `## Objectives` list, for `checkObjectivesCopy`'s
990
+ * comparison — injected because resolving it is a live forge read
991
+ * (`gh issue view`), which this module stays pure of. `undefined` (the
992
+ * default) skips BOTH objectives checks entirely — the same no-op-when-
993
+ * unwired default `consumersOf` uses, so an existing caller that hasn't
994
+ * been taught to fetch the Issue keeps today's behavior.
995
+ */
996
+ issueObjectives?: Objective[]
879
997
  }
880
998
 
881
999
  /**
@@ -888,7 +1006,7 @@ export function checkBriefSections(
888
1006
  readTier: (body: string) => 0 | 1 | 3 | null,
889
1007
  options: BriefSectionsOptions = {}
890
1008
  ): { errors: string[] } {
891
- const { requireClosesN = true, consumersOf = () => [] } = options
1009
+ const { requireClosesN = true, consumersOf = () => [], issueObjectives } = options
892
1010
  const results = [
893
1011
  checkTierField(prBody, readTier),
894
1012
  checkTestPlan(prBody),
@@ -906,7 +1024,109 @@ export function checkBriefSections(
906
1024
  checkCommandsCarryOutput(prBody),
907
1025
  checkConsumerTests(prBody, consumersOf),
908
1026
  checkDefeatCases(prBody),
909
- ...(requireClosesN ? [checkClosesN(prBody)] : [])
1027
+ ...(issueObjectives !== undefined
1028
+ ? [checkObjectivesCopy(prBody, issueObjectives), checkObjectivesCoverage(prBody)]
1029
+ : []),
1030
+ ...(requireClosesN ? [checkClosesNPresence(prBody)] : [])
910
1031
  ]
911
1032
  return { errors: results.flatMap((r) => r.errors) }
912
1033
  }
1034
+
1035
+ /**
1036
+ * The marker line a dispatched task's frozen `aeg:brief:v1` Issue comment
1037
+ * starts with (`dispatch-task.ts`'s `dispatchTask`, `apps/cli`). Promoted
1038
+ * here so the comment-resolution logic that
1039
+ * needs it — `packages/aeg-core/bin/verify-brief.ts` (this package, cannot
1040
+ * import `apps/cli`) and `apps/cli`'s own `dispatch-task.ts`/
1041
+ * `check-brief-shape.ts` — read the SAME constant rather than four copies of
1042
+ * the same string that could quietly drift out of agreement.
1043
+ */
1044
+ export const AEG_BRIEF_V1_MARKER = '<!-- aeg:brief:v1 -->'
1045
+
1046
+ /**
1047
+ * Everything in a posted comment after its first `n` lines, as a raw
1048
+ * substring — never a line-split-then-rejoin, which would silently
1049
+ * renormalize whatever separates the header lines from the body beneath
1050
+ * them. The one canonical implementation (later widened to a variable
1051
+ * header length): `dispatch-task.ts`,
1052
+ * `verify-dispatch.ts` and `archive-task.ts` each carried their own
1053
+ * fixed-two-line copy before the first promotion — found live (code review),
1054
+ * the exact "N copies of hash-contract-critical logic with nothing proving
1055
+ * they agree" failure `edge-resolve.ts`'s own doc comment already warns this
1056
+ * codebase about.
1057
+ */
1058
+ export function contentAfterNLines(body: string, n: number): string {
1059
+ let idx = -1
1060
+ for (let i = 0; i < n; i++) {
1061
+ idx = body.indexOf('\n', idx + 1)
1062
+ if (idx === -1) return ''
1063
+ }
1064
+ return body.slice(idx + 1)
1065
+ }
1066
+
1067
+ /**
1068
+ * A frozen `aeg:brief:v1` comment's header is exactly two lines (the marker,
1069
+ * then `Brief hash: …`) — `contentAfterNLines(body, 2)`, kept as its own name
1070
+ * because every existing caller already spells it this way and a v1 comment's
1071
+ * shape is permanent (superseding never edits it). A superseding `v2`+
1072
+ * comment carries one more header line (`Supersedes: …`) — see
1073
+ * `frozenBriefContent`, the version-aware sibling of this function.
1074
+ */
1075
+ export function contentAfterTwoLines(body: string): string {
1076
+ return contentAfterNLines(body, 2)
1077
+ }
1078
+
1079
+ /** The marker line a dispatched task's `k`th frozen brief comment starts with — `k=1` is `AEG_BRIEF_V1_MARKER` itself. */
1080
+ export function briefMarkerFor(version: number): string {
1081
+ return `<!-- aeg:brief:v${version} -->`
1082
+ }
1083
+
1084
+ const BRIEF_MARKER_LINE_RE = /^<!-- aeg:brief:v(\d+) -->$/
1085
+
1086
+ /** Parses a comment's first line as an `aeg:brief:v<k>` marker — the version `k`, or `null` when the line isn't shaped like one (including `v0` or non-numeric). */
1087
+ export function parseBriefMarkerVersion(firstLine: string): number | null {
1088
+ const m = BRIEF_MARKER_LINE_RE.exec(firstLine.trim())
1089
+ if (!m) return null
1090
+ const version = Number.parseInt(m[1] as string, 10)
1091
+ return Number.isInteger(version) && version >= 1 ? version : null
1092
+ }
1093
+
1094
+ /**
1095
+ * A superseding comment (`version` ≥ 2) carries a third header line
1096
+ * (`Supersedes: <predecessor url> — <reason>`) that a plain `v1` comment
1097
+ * never has — `contentAfterNLines(body, version === 1 ? 2 : 3)`.
1098
+ */
1099
+ export function frozenBriefContent(body: string, version: number): string {
1100
+ return contentAfterNLines(body, version === 1 ? 2 : 3)
1101
+ }
1102
+
1103
+ /** The shape every frozen-brief-comment reader (`gh {issue,pr} view --json comments`) already has in hand: a comment's body and its author login, `null` when the forge reports no author (a deleted account). */
1104
+ export type FrozenBriefCandidate = { body: string; author: string | null }
1105
+
1106
+ /** `resolveNewestFrozenBrief`'s return: the winning candidate, its parsed `version`, and its header-stripped `content` — never re-derived by a second caller-side slice. */
1107
+ export type ResolvedFrozenBrief<C extends FrozenBriefCandidate> = C & { version: number; content: string }
1108
+
1109
+ /**
1110
+ * The single resolver every reader of "the frozen brief" uses: the loop (`dev-review-loop.ts`'s
1111
+ * `fetchFrozenBrief`), the objectives reader built on top of it, and
1112
+ * `check-brief-shape.ts`'s own Issue-comment read all call this instead of
1113
+ * each independently re-deriving "which comment is the frozen brief" — a
1114
+ * supersession is an APPENDED comment, never an edit to the one it replaces
1115
+ * (`dispatch-task.ts`'s `prepareTask`, `--supersede`), so "the frozen brief"
1116
+ * is always the highest `aeg:brief:v<k>` version found here among
1117
+ * principal-authored comments, never the first one posted. `null` when no
1118
+ * candidate qualifies (unauthored by a principal, or not marker-shaped).
1119
+ */
1120
+ export function resolveNewestFrozenBrief<C extends FrozenBriefCandidate>(
1121
+ comments: readonly C[],
1122
+ allowlist: readonly string[]
1123
+ ): ResolvedFrozenBrief<C> | null {
1124
+ let best: (C & { version: number }) | null = null
1125
+ for (const c of comments) {
1126
+ if (!isPrincipal(c.author, allowlist as string[])) continue
1127
+ const version = parseBriefMarkerVersion(c.body.split('\n')[0] ?? '')
1128
+ if (version === null) continue
1129
+ if (best === null || version > best.version) best = { ...c, version }
1130
+ }
1131
+ return best === null ? null : { ...best, content: frozenBriefContent(best.body, best.version) }
1132
+ }
@@ -120,14 +120,14 @@ export type MeteringCapability =
120
120
  * (unchanged) as the READABLE prefix of a pointer key and as the sole
121
121
  * derivation for a pre-migration (legacy) pointer filename — see
122
122
  * `legacyTranscriptPointerPath`. On its own it is not collision-resistant:
123
- * `/a/b` and `/a-b` both collapse to `-a-b` (`#315`).
123
+ * `/a/b` and `/a-b` both collapse to `-a-b`.
124
124
  */
125
125
  function sanitizeKey(value: string): string {
126
126
  return value.replace(/[^A-Za-z0-9]+/g, '-')
127
127
  }
128
128
 
129
129
  /**
130
- * Collision-resistant (`#315`). `sanitizeKey` alone collapses distinct paths
130
+ * Collision-resistant. `sanitizeKey` alone collapses distinct paths
131
131
  * that differ only in which non-alphanumeric characters they use — a full
132
132
  * SHA-256 digest of the UNCOLLAPSED, UNTRUNCATED original `value` restores
133
133
  * distinctness: two different `value`s can share a `sanitizeKey` prefix, but
@@ -155,7 +155,7 @@ function collisionResistantKey(value: string): string {
155
155
  * published `exports` map — the whole reason this probe exists is to work
156
156
  * where that path is unreachable.
157
157
  *
158
- * This is the PRIMARY (post-migration, `#315`) pointer path — collision-
158
+ * This is the PRIMARY (post-migration) pointer path — collision-
159
159
  * resistant. `resolvePointer` also consults `legacyTranscriptPointerPath`
160
160
  * as a fallback, so a pointer the shipped Stop hook already wrote under the
161
161
  * old, collision-prone name is still found rather than orphaned.
@@ -165,12 +165,12 @@ function transcriptPointerPath(projectDir: string, tmpDir: string): string {
165
165
  }
166
166
 
167
167
  /**
168
- * The pre-`#315` pointer filename — `sanitizeKey` alone, collision-prone.
168
+ * The pre-migration pointer filename — `sanitizeKey` alone, collision-prone.
169
169
  * Never the primary read or write target going forward; consulted only when
170
170
  * `transcriptPointerPath` is absent, so a pointer a not-yet-upgraded
171
171
  * `track-transcript.sh` (or one written before this fix shipped) already has
172
172
  * on disk is still readable. Removing this fallback would orphan every such
173
- * pointer the moment this fix ships, which `#315`'s Acceptance forbids.
173
+ * pointer the moment this fix ships, which that migration's Acceptance forbids.
174
174
  */
175
175
  function legacyTranscriptPointerPath(projectDir: string, tmpDir: string): string {
176
176
  return `${tmpDir}/claude-transcript-${sanitizeKey(projectDir)}.txt`
@@ -216,11 +216,11 @@ function resolvePointer(explicitTranscriptPath: string | undefined, deps: Meteri
216
216
  // `CLAUDE_CODE_SESSION_ID` there is nothing to cross-check against, so a
217
217
  // pointer left by an earlier session is indistinguishable from our own. A
218
218
  // plain human terminal is exactly that case, and gating its commits on
219
- // another session's leftovers is the false positive `#272` names as the
219
+ // another session's leftovers is the false positive a real regression names as the
220
220
  // expensive failure mode.
221
221
  const currentSessionId = deps.env.CLAUDE_CODE_SESSION_ID
222
222
 
223
- // `#315` migration: the primary (collision-resistant) path wins when both
223
+ // The migration: the primary (collision-resistant) path wins when both
224
224
  // exist — it is what any Stop hook upgraded past this fix writes. The
225
225
  // legacy path is consulted ONLY when the primary is absent, so a pointer
226
226
  // written before this fix shipped (or by a not-yet-upgraded hook script)
@@ -422,7 +422,7 @@ export function resolveMeteringCapability(
422
422
  }
423
423
 
424
424
  /**
425
- * The one fact `token-collection-wired` (task 5, #272) gates a commit on,
425
+ * The one fact `token-collection-wired` gates a commit on,
426
426
  * factored out here — contract-agnostic (a plain boolean, no `CheckError`
427
427
  * shape) — so both the shipped `apps/cli` check and this repo's own
428
428
  * self-hosting `bin/check-token-collection-wired.ts` gate consume the SAME
@@ -441,7 +441,7 @@ export function resolveMeteringCapability(
441
441
  * The corroboration condition is load-bearing in BOTH directions, and an
442
442
  * earlier revision got both wrong. Without it, a pointer left in a shared
443
443
  * `TMPDIR` by an unrelated session refuses a plain human's commit (a false
444
- * positive `#272` names as the expensive failure mode); and folding every
444
+ * positive a real regression names as the expensive failure mode); and folding every
445
445
  * pointer failure into `no-transcript-resolved` let an unreadable, malformed,
446
446
  * or stale pointer pass silently — the exact wired-but-unreachable state this
447
447
  * check exists to refuse.