@attalabs/vinaya 0.32.0 → 0.33.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 (209) hide show
  1. package/README.md +1 -1
  2. package/aeg-root/contracts/principal-operator.md +18 -5
  3. package/aeg-root/roles/operator.md +69 -16
  4. package/aeg-root/roles/planner/reference.md +1 -1
  5. package/aeg-root/roles/tranche-archivist.md +1 -0
  6. package/aeg-root/skills/aeg-context-packets/SKILL.md +1 -1
  7. package/aeg-root/skills/aeg-context-packets/examples/operator-start.md +1 -1
  8. package/dist/checks/bin/check-body-bare-digits.js +111 -15
  9. package/dist/checks/bin/check-branch-topology.js +83 -16
  10. package/dist/checks/bin/check-brief-shape.js +111 -15
  11. package/dist/checks/bin/check-changeset-coverage.js +342 -69
  12. package/dist/checks/bin/check-closes-n.js +83 -16
  13. package/dist/checks/bin/check-coherence.js +112 -16
  14. package/dist/checks/bin/check-dead-branch-push.js +82 -15
  15. package/dist/checks/bin/check-dispatch-readiness.js +112 -16
  16. package/dist/checks/bin/check-doc-coverage-push.js +342 -69
  17. package/dist/checks/bin/check-doc-coverage.js +342 -69
  18. package/dist/checks/bin/check-doctrine-no-procedures.js +111 -15
  19. package/dist/checks/bin/check-doctrine-portability.js +342 -69
  20. package/dist/checks/bin/check-evidence-fresh.js +343 -69
  21. package/dist/checks/bin/check-exec-bits.js +342 -69
  22. package/dist/checks/bin/check-first-push-dispatch.js +112 -16
  23. package/dist/checks/bin/check-issue-assignment.js +83 -16
  24. package/dist/checks/bin/check-issue-milestone-attach.js +82 -15
  25. package/dist/checks/bin/check-issue-objectives-numbering.js +82 -15
  26. package/dist/checks/bin/check-issue-parts-coverage.js +82 -15
  27. package/dist/checks/bin/check-issue-surface-globs.js +112 -16
  28. package/dist/checks/bin/check-issue-title-grammar.js +82 -15
  29. package/dist/checks/bin/check-issue-tranche-label.js +82 -15
  30. package/dist/checks/bin/check-main-branch-refusal.js +82 -15
  31. package/dist/checks/bin/check-no-disk-state.js +82 -15
  32. package/dist/checks/bin/check-pr-premise-reassert.js +111 -15
  33. package/dist/checks/bin/check-pr-report-density.js +82 -15
  34. package/dist/checks/bin/check-principal-test-plan-wait.js +82 -15
  35. package/dist/checks/bin/check-quoted-command.js +342 -69
  36. package/dist/checks/bin/check-reader-resolvable-prose.js +342 -69
  37. package/dist/checks/bin/check-registry-gates.js +82 -15
  38. package/dist/checks/bin/check-retired-vocabulary.js +342 -69
  39. package/dist/checks/bin/check-review-gate.js +179 -124
  40. package/dist/checks/bin/check-single-plan-pr.js +82 -15
  41. package/dist/checks/bin/check-surface-scope.js +83 -16
  42. package/dist/checks/bin/check-test-plan.js +82 -15
  43. package/dist/checks/bin/check-token-collection-wired.js +82 -15
  44. package/dist/checks/bin/check-token-report.js +82 -15
  45. package/dist/checks/bin/check-workspace-escape.js +342 -69
  46. package/dist/index.js +2495 -590
  47. package/dist/lib/pre-push-cache-test-run.js +317 -61
  48. package/dist/lib/pre-push-select-tests.js +91 -10
  49. package/package.json +1 -1
  50. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/actions.ts +10 -12
  51. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/anchored-region.ts +5 -5
  52. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/archive-task.ts +42 -17
  53. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/baseline-capture.ts +1 -2
  54. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/branch-topology-gate.ts +3 -3
  55. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +554 -95
  56. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-validation.ts +264 -44
  57. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/claude-code-transcript.ts +9 -9
  58. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/coherence-checks.ts +211 -30
  59. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/consumer-enumeration.ts +2 -2
  60. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/index.ts +75 -0
  61. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/local.ts +961 -0
  62. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/migration.ts +212 -0
  63. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/outcomes.ts +135 -0
  64. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/records.ts +394 -0
  65. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dead-branch-push-audit.ts +1 -2
  66. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dead-branch-push-guard.ts +1 -1
  67. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/derive-section7.ts +2 -2
  68. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/assess-round.ts +514 -0
  69. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/fakes.ts +110 -0
  70. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/index.ts +27 -0
  71. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/journal-reconstruction.ts +123 -0
  72. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/render-summary.ts +27 -0
  73. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/types.ts +240 -0
  74. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/diagram-model.ts +1 -1
  75. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/direct-main-push.ts +1 -2
  76. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dispatch-gate.ts +65 -22
  77. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doc-claim.ts +238 -0
  78. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doc-owners.ts +14 -1
  79. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/docs-coherence.ts +1 -1
  80. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/legacy-anchors.ts +1 -1
  81. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/node-route.ts +1 -1
  82. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/surfaced-manifest.ts +1 -1
  83. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doctrine-no-procedures.ts +1 -1
  84. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doctrine-portability.ts +5 -5
  85. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/ensure-label.ts +1 -1
  86. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/first-push-dispatch-gate.ts +1 -1
  87. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/gate-audience.ts +14 -3
  88. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +379 -11
  89. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-assignment.ts +3 -4
  90. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +1450 -33
  91. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/leftover-detection.ts +1 -2
  92. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/local-anchor-coverage.ts +2 -2
  93. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/envelope.ts +119 -0
  94. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/index.ts +75 -0
  95. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/redact.ts +87 -0
  96. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/schema.ts +801 -0
  97. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/store.ts +373 -0
  98. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/main-branch-refusal.ts +2 -2
  99. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/metering-io-guard.ts +1 -1
  100. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/milestone-validation.ts +2 -3
  101. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/no-disk-state.ts +2 -2
  102. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/objectives.ts +288 -0
  103. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/parse-token-report.ts +3 -3
  104. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/parse-tranche.ts +1 -1
  105. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/pr-report-density.ts +30 -16
  106. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/pr-tier.ts +17 -1
  107. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/premise-check.ts +1 -1
  108. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/quoted-command.ts +1 -1
  109. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/reader-resolvable-prose.ts +267 -19
  110. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/registry-checks.ts +91 -24
  111. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/registry-scaffold.ts +6 -6
  112. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/report-tokens.ts +4 -4
  113. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-gate.ts +239 -110
  114. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-input-manifest.ts +384 -0
  115. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-policy.ts +184 -0
  116. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-status.ts +65 -18
  117. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/ruling-ordinal.ts +76 -0
  118. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/single-plan-pr.ts +4 -4
  119. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/state-machine-model.ts +40 -27
  120. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/symbol-collisions.ts +2 -2
  121. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-branch-identity.ts +38 -0
  122. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-tools.ts +488 -0
  123. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/test-plan-gate.ts +7 -9
  124. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/test-plan-section.ts +5 -5
  125. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/types.ts +4 -4
  126. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/verdict-extraction.ts +314 -56
  127. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/waiver-label.ts +2 -3
  128. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/workspace-escape.ts +3 -3
  129. package/studio-standalone/apps/vinaya-studio/web/.next/BUILD_ID +1 -1
  130. package/studio-standalone/apps/vinaya-studio/web/.next/build-manifest.json +3 -3
  131. package/studio-standalone/apps/vinaya-studio/web/.next/prerender-manifest.json +3 -3
  132. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.html +1 -1
  133. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.rsc +1 -1
  134. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  135. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  136. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  137. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  138. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  139. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page/server-reference-manifest.json +2 -2
  140. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  141. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  142. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js +1 -1
  143. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.nft.json +1 -1
  144. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page/server-reference-manifest.json +2 -2
  145. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js.nft.json +1 -1
  146. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page_client-reference-manifest.js +1 -1
  147. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page/server-reference-manifest.json +2 -2
  148. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js +1 -1
  149. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js.nft.json +1 -1
  150. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page_client-reference-manifest.js +1 -1
  151. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page/server-reference-manifest.json +2 -2
  152. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js +1 -1
  153. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js.nft.json +1 -1
  154. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page_client-reference-manifest.js +1 -1
  155. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page/server-reference-manifest.json +2 -2
  156. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js +1 -1
  157. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js.nft.json +1 -1
  158. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page_client-reference-manifest.js +1 -1
  159. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page/server-reference-manifest.json +3 -3
  160. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js +2 -2
  161. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js.nft.json +1 -1
  162. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page_client-reference-manifest.js +1 -1
  163. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page/server-reference-manifest.json +2 -2
  164. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js +1 -1
  165. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js.nft.json +1 -1
  166. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
  167. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page/server-reference-manifest.json +2 -2
  168. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js +1 -1
  169. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js.nft.json +1 -1
  170. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page_client-reference-manifest.js +1 -1
  171. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page/server-reference-manifest.json +2 -2
  172. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js +1 -1
  173. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js.nft.json +1 -1
  174. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page_client-reference-manifest.js +1 -1
  175. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/{[externals]__1agj1ww._.js → [externals]__0cki-x_._.js} +2 -2
  176. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[root-of-the-server]__02a-3g8._.js +6 -6
  177. 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
  178. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__074w9nf._.js +3 -0
  179. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ls23oh._.js +1 -1
  180. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__0r7e54g._.js → [root-of-the-server]__18paley._.js} +1 -1
  181. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1gjqmhq._.js +1 -1
  182. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1wc4-ip._.js +1 -1
  183. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1r47dr7._.js → _08onyya._.js} +3 -3
  184. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_096f46i._.js +1 -1
  185. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0af2one._.js +1 -1
  186. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0e5tkdd._.js +1 -1
  187. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0kf2g72._.js +1 -1
  188. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0y1jv16._.js +1 -1
  189. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0zf4d27._.js +1 -1
  190. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1-wo68i._.js +1 -1
  191. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_15gdg48._.js +5 -5
  192. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1achbh9._.js +1 -1
  193. 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
  194. package/studio-standalone/apps/vinaya-studio/web/.next/server/middleware-build-manifest.js +3 -3
  195. package/studio-standalone/apps/vinaya-studio/web/.next/server/pages/500.html +1 -1
  196. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.js +1 -1
  197. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.json +4 -4
  198. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0bjnj-5fy4e7l.js +1 -0
  199. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{1dc2_-c_gavj1.js → 1ce2dj27_cgbj.js} +4 -4
  200. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3xg6-flovrcx-.js → 22s44f5k3ecmj.js} +1 -1
  201. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/34hhdtbp20krb.js +1 -0
  202. package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
  203. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0hstap0._.js +0 -3
  204. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2t_rfsztmwu6y.js +0 -1
  205. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3ua4rm5f-a9k6.js +0 -1
  206. /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/aeg-core}/bin/verify-coherence.ts +0 -0
  207. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{e8XbZ2vlVz40KzHmlqhwP → vl7QVqELe1AQ-9kaOd9mR}/_buildManifest.js +0 -0
  208. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{e8XbZ2vlVz40KzHmlqhwP → vl7QVqELe1AQ-9kaOd9mR}/_clientMiddlewareManifest.js +0 -0
  209. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{e8XbZ2vlVz40KzHmlqhwP → vl7QVqELe1AQ-9kaOd9mR}/_ssgManifest.js +0 -0
@@ -1,7 +1,6 @@
1
1
  /**
2
- * Reader-resolvable prose — classes 1 and 2 of the three-class analysis in
3
- * Issue #694: the two mechanizable classes of "words a reader cannot
4
- * resolve." Class 3 (register/slop — padding adjectives, first person,
2
+ * Reader-resolvable prose — classes 1 and 2 of a three-class analysis of
3
+ * "words a reader cannot resolve." Class 3 (register/slop — padding adjectives, first person,
5
4
  * narrating the work episode) is NOT here; it stays with the review role,
6
5
  * per the measurement below.
7
6
  *
@@ -36,7 +35,7 @@
36
35
  * `RegExp`, not `grep -E`, keeping them portable to either.
37
36
  */
38
37
 
39
- export type ProseFileClass = 'ships' | 'reader-facing' | 'internal'
38
+ export type ProseFileClass = 'ships' | 'reader-facing' | 'internal' | 'product' | 'spec'
40
39
 
41
40
  export type ProseSourceFile = { path: string; content: string }
42
41
 
@@ -44,14 +43,38 @@ export type ProseFinding = {
44
43
  file: string
45
44
  line: number
46
45
  message: string
46
+ blocking: boolean
47
+ }
48
+
49
+ /**
50
+ * Path prefixes under which a tranche-slug citation in product code is a
51
+ * blocking finding — copied verbatim (aeg-root dropped) from the scope list
52
+ * `retired-vocabulary.test.ts`'s `PATTERN_SCOPE[TRANCHE_SLUG_VN_PATTERN]` used
53
+ * to grep directly; that suite no longer greps these paths itself
54
+ * (`prose-product-scope.test.ts` pins this list against drift instead).
55
+ */
56
+ export const PRODUCT_SLUG_SCOPE: readonly string[] = [
57
+ 'apps/cli/src',
58
+ '.github/workflows',
59
+ '.vinaya',
60
+ 'apps/cli/README.md',
61
+ 'packages/sources/README.md'
62
+ ]
63
+
64
+ /** A path equal to, or nested under, `prefix` — never a bare-prefix substring match (`apps/cli/srcx` must not match `apps/cli/src`). */
65
+ function isUnderOrEqual(path: string, prefix: string): boolean {
66
+ return path === prefix || path.startsWith(`${prefix}/`)
67
+ }
68
+
69
+ function isProductScopeFile(path: string): boolean {
70
+ return PRODUCT_SLUG_SCOPE.some((prefix) => isUnderOrEqual(path, prefix))
47
71
  }
48
72
 
49
73
  /**
50
74
  * `aeg-root/**` by default — what this repo's own package carries and
51
75
  * `/docs` publishes. Every caller below takes `shipsPrefix` as its LAST,
52
76
  * defaulted parameter so an adopter whose installed doctrine tree lives
53
- * somewhere else (task 7, Issue #56 — de-hardcoding `doctrineRoot`) can
54
- * override it without breaking any existing positional call.
77
+ * somewhere else can override it without breaking any existing positional call.
55
78
  */
56
79
  const SHIPS_PREFIX = 'aeg-root/'
57
80
 
@@ -60,7 +83,17 @@ function shipsArchivePrefix(shipsPrefix: string): string {
60
83
  return `${shipsPrefix}tranches/completed/`
61
84
  }
62
85
 
63
- /** A per-product specs file (`apps/<product>/specs/**`) — this reader has this forge; references are legitimate here. */
86
+ /**
87
+ * A per-product specs file (`apps/<product>/specs/**`) — issue-657, O6:
88
+ * swept with the SAME rules `ships`/doctrine pages already carry (a spec is
89
+ * as reader-facing as a doctrine page; a fork or an export reads it with no
90
+ * forge to resolve a citation against, same as `aeg-root/**`). Formerly
91
+ * classified `internal` (exempt) on the theory that "this reader has this
92
+ * forge" — the wrong reader: a spec ships to the SAME audience doctrine
93
+ * does, and a spec that opened with a tranche name, an Issue number, and
94
+ * external documents as its authority reached a pull request unflagged
95
+ * under the old exemption (found live, 2026-09-19).
96
+ */
64
97
  function isSpecFile(path: string): boolean {
65
98
  return path.startsWith('apps/') && path.includes('/specs/') && path.endsWith('.md')
66
99
  }
@@ -97,7 +130,9 @@ export function classifyProseFile(
97
130
  if (path.startsWith(readerFacingPrefix) && path.endsWith(readerFacingSuffix)) {
98
131
  return 'reader-facing'
99
132
  }
100
- if (isSpecFile(path) || isClaudeMdFile(path)) return 'internal'
133
+ if (isClaudeMdFile(path)) return 'internal'
134
+ if (isSpecFile(path)) return 'spec'
135
+ if (isProductScopeFile(path)) return 'product'
101
136
  return null
102
137
  }
103
138
 
@@ -133,6 +168,18 @@ export function stripNonProse(path: string, content: string): string {
133
168
  return content
134
169
  }
135
170
 
171
+ /**
172
+ * Product-class scrubbing: still skips fenced/inline markdown code (a slug
173
+ * shown as a usage example in a README must not fire), but does NOT strip
174
+ * `.ts`/`.tsx` comments the way `stripNonProse` does for `ships`/
175
+ * `reader-facing` files — the motivating case is a tranche slug written into
176
+ * a CLI source *comment*, which reached CI specifically because nothing
177
+ * scanned comments in product code.
178
+ */
179
+ function stripNonProseForProduct(path: string, content: string): string {
180
+ return path.endsWith('.md') ? stripNonProse(path, content) : content
181
+ }
182
+
136
183
  function lineAt(content: string, index: number): number {
137
184
  let line = 1
138
185
  for (let i = 0; i < index; i++) {
@@ -141,10 +188,10 @@ function lineAt(content: string, index: number): number {
141
188
  return line
142
189
  }
143
190
 
144
- /** `#294`-shaped — a PR/Issue number cited bare, resolvable only inside this repo's own tracker. */
191
+ /** `#NNN`-shaped — a PR/Issue number cited bare, resolvable only inside this repo's own tracker. */
145
192
  export const FORGE_NUMBER_PATTERN = /#[0-9]{2,4}/g
146
193
 
147
- /** `aeg-forge-state-v1`-shaped — an internal tranche slug ending `-vN`. */
194
+ /** `example-tranche-vN`-shaped — an internal tranche slug ending `-vN`. */
148
195
  export const TRANCHE_SLUG_VN_PATTERN = /[a-z][a-z-]+-v[0-9]/g
149
196
 
150
197
  /**
@@ -173,17 +220,21 @@ export function legacySlugPattern(legacySlugs: readonly string[]): RegExp | null
173
220
  /**
174
221
  * Class 1 — unresolvable references. Runs the reference patterns over every
175
222
  * swept file (`ships`/`reader-facing`), skipping code-fenced/commented-out
176
- * non-prose first.
223
+ * non-prose first. A `product`-class file (a tranche-slug citation under
224
+ * `PRODUCT_SLUG_SCOPE`) is checked only against `TRANCHE_SLUG_VN_PATTERN`,
225
+ * and its finding is `blocking: true`; every other finding is `blocking: false`.
177
226
  */
178
227
  export function checkUnresolvableReferences(
179
228
  files: readonly ProseSourceFile[],
180
229
  readerFacingPrefix: string,
181
230
  readerFacingSuffix: string,
182
231
  legacySlugs: readonly string[] = [],
183
- shipsPrefix: string = SHIPS_PREFIX
232
+ shipsPrefix: string = SHIPS_PREFIX,
233
+ specGrandfather: readonly string[] = []
184
234
  ): ProseFinding[] {
185
235
  const findings: ProseFinding[] = []
186
236
  const legacyPattern = legacySlugPattern(legacySlugs)
237
+ const grandfathered = new Set(specGrandfather)
187
238
  // `group` names the capture holding the actual cited text — the plain
188
239
  // patterns have none (report the whole match), the boundary-checked
189
240
  // legacy-slug pattern reports its group 2 so the boundary chars around it
@@ -194,11 +245,26 @@ export function checkUnresolvableReferences(
194
245
  ...(legacyPattern ? [{ pattern: legacyPattern, what: 'an internal tranche slug', group: 2 }] : [])
195
246
  ]
196
247
 
248
+ const productPatterns: { pattern: RegExp; what: string; group?: number }[] = [
249
+ { pattern: TRANCHE_SLUG_VN_PATTERN, what: 'an internal tranche slug in product code' }
250
+ ]
251
+
197
252
  for (const file of files) {
198
253
  const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix)
199
- if (!cls || !SWEPT_CLASSES.has(cls)) continue
200
- const scrubbed = stripNonProse(file.path, file.content)
201
- for (const { pattern, what, group } of patterns) {
254
+ if (!cls || cls === 'internal') continue
255
+ if (cls !== 'product' && cls !== 'spec' && !SWEPT_CLASSES.has(cls)) continue
256
+ // issue-657, O6 — a spec explicitly listed by path is grandfathered
257
+ // stock (already failing when this sweep was extended to specs) and is
258
+ // skipped entirely, not merely down-graded: the list shrinks as later
259
+ // tasks rewrite each spec's prose, never grows.
260
+ if (cls === 'spec' && grandfathered.has(file.path)) continue
261
+ const blocking = cls === 'product' || cls === 'spec'
262
+ const scrubbed =
263
+ cls === 'product' ? stripNonProseForProduct(file.path, file.content) : stripNonProse(file.path, file.content)
264
+ // A spec is checked with the SAME rules a doctrine page is (O6) — the
265
+ // full reference pattern set, never the narrower product-code list.
266
+ const patternsToRun = cls === 'product' ? productPatterns : patterns
267
+ for (const { pattern, what, group } of patternsToRun) {
202
268
  pattern.lastIndex = 0
203
269
  let match: RegExpExecArray | null = pattern.exec(scrubbed)
204
270
  while (match !== null) {
@@ -206,7 +272,8 @@ export function checkUnresolvableReferences(
206
272
  findings.push({
207
273
  file: file.path,
208
274
  line: lineAt(scrubbed, match.index),
209
- message: `references ${what} ("${cited}") a reader outside this repo's tracker cannot resolve`
275
+ message: `references ${what} ("${cited}") a reader outside this repo's tracker cannot resolve`,
276
+ blocking
210
277
  })
211
278
  match = pattern.exec(scrubbed)
212
279
  }
@@ -285,13 +352,186 @@ export function checkUndefinedVocabulary(
285
352
  findings.push({
286
353
  file: file.path,
287
354
  line,
288
- message: `uses coined term "${term}" without defining it inline or linking the glossary`
355
+ message: `uses coined term "${term}" without defining it inline or linking the glossary`,
356
+ blocking: false
289
357
  })
290
358
  }
291
359
  }
292
360
  return findings
293
361
  }
294
362
 
363
+ /**
364
+ * `<slug>-vN`-shaped, source-comment class — deliberately
365
+ * looser than `TRANCHE_SLUG_VN_PATTERN` above (which requires at least two
366
+ * letters before the version suffix): this class's caller is a `.ts`
367
+ * comment, not doctrine prose, so a shorter coined identifier
368
+ * (`x-vN`) is still exactly the kind of internal citation a reader outside
369
+ * this repo cannot resolve.
370
+ */
371
+ export const SOURCE_COMMENT_TRANCHE_SLUG_PATTERN = /[a-z0-9]+(?:-[a-z0-9]+)*-v[0-9]+/g
372
+
373
+ /** `#NNN`-shaped, source-comment class — no upper digit-count bound (unlike `FORGE_NUMBER_PATTERN`'s `{2,4}`), since a forge's issue/PR numbering has no fixed ceiling. */
374
+ export const SOURCE_COMMENT_FORGE_NUMBER_PATTERN = /#[0-9]{2,}/g
375
+
376
+ /**
377
+ * The inverse of `stripNonProse`'s `.ts`/`.tsx` half: keeps ONLY the text
378
+ * inside `//` line comments and `/* *‍/` block comments, blanking code and
379
+ * string/template-literal content (so a URL or a slug-shaped identifier
380
+ * living in a string literal, not a comment, never reads as a citation),
381
+ * while preserving line count so reported line numbers stay accurate.
382
+ *
383
+ * A real tokenizer (not `stripNonProse`'s regex-based approach) because the
384
+ * source-comment class runs over this repo's *own* `.ts` source at `error`
385
+ * severity — a false positive from a `//` inside a string literal
386
+ * (`"https://…"`) would fail real pushes, not just print a warning.
387
+ */
388
+ export function extractComments(path: string, content: string): string {
389
+ if (!path.endsWith('.ts') && !path.endsWith('.tsx')) return content.replace(/[^\n]/g, '')
390
+
391
+ type State = 'code' | 'line-comment' | 'block-comment' | 'single-quote' | 'double-quote' | 'template'
392
+ let state: State = 'code'
393
+ let out = ''
394
+ const n = content.length
395
+ let i = 0
396
+
397
+ const blank = (ch: string): string => (ch === '\n' ? '\n' : ' ')
398
+
399
+ while (i < n) {
400
+ const c = content[i] as string
401
+ const next = i + 1 < n ? content[i + 1] : ''
402
+
403
+ if (state === 'code') {
404
+ if (c === '/' && next === '/') {
405
+ state = 'line-comment'
406
+ out += c
407
+ i++
408
+ continue
409
+ }
410
+ if (c === '/' && next === '*') {
411
+ state = 'block-comment'
412
+ out += c
413
+ i++
414
+ continue
415
+ }
416
+ if (c === "'") {
417
+ state = 'single-quote'
418
+ out += blank(c)
419
+ i++
420
+ continue
421
+ }
422
+ if (c === '"') {
423
+ state = 'double-quote'
424
+ out += blank(c)
425
+ i++
426
+ continue
427
+ }
428
+ if (c === '`') {
429
+ state = 'template'
430
+ out += blank(c)
431
+ i++
432
+ continue
433
+ }
434
+ out += blank(c)
435
+ i++
436
+ continue
437
+ }
438
+
439
+ if (state === 'line-comment') {
440
+ if (c === '\n') {
441
+ state = 'code'
442
+ out += '\n'
443
+ i++
444
+ continue
445
+ }
446
+ out += c
447
+ i++
448
+ continue
449
+ }
450
+
451
+ if (state === 'block-comment') {
452
+ if (c === '*' && next === '/') {
453
+ out += c
454
+ out += next
455
+ state = 'code'
456
+ i += 2
457
+ continue
458
+ }
459
+ out += c === '\n' ? '\n' : c
460
+ i++
461
+ continue
462
+ }
463
+
464
+ // single-quote / double-quote / template: blank everything, honouring a
465
+ // backslash escape so an escaped quote/backtick never ends the literal
466
+ // early (which would otherwise flip the scanner back to 'code' mid-string
467
+ // and risk reading the string's remainder as real source).
468
+ const closer = state === 'single-quote' ? "'" : state === 'double-quote' ? '"' : '`'
469
+ if (c === '\\') {
470
+ out += blank(c)
471
+ i++
472
+ if (i < n) {
473
+ out += blank(content[i] as string)
474
+ i++
475
+ }
476
+ continue
477
+ }
478
+ if (c === closer) {
479
+ state = 'code'
480
+ out += blank(c)
481
+ i++
482
+ continue
483
+ }
484
+ out += blank(c)
485
+ i++
486
+ }
487
+
488
+ return out
489
+ }
490
+
491
+ /**
492
+ * The source-comment class — scans comment lines of `.ts`
493
+ * files for a tranche-slug or forge-number citation. Unlike the `product`
494
+ * class above (a fixed, aeg-core-internal `PRODUCT_SLUG_SCOPE`), the file
495
+ * SET here is entirely the caller's choice: the bin resolves
496
+ * `proseGates.sourceComments.globs` into concrete files and passes them in,
497
+ * so this stays zero-I/O and adopter-configurable rather than hardcoded to
498
+ * this repo's own trees. `allowlist` is a set of exact repo-relative file
499
+ * paths a caller has decided deliberately/legitimately cite a slug or
500
+ * number in a comment (e.g. a test fixture pinning a historical tranche
501
+ * name) — skipped entirely, not merely down-graded.
502
+ */
503
+ export function checkSourceComments(
504
+ files: readonly ProseSourceFile[],
505
+ allowlist: readonly string[] = []
506
+ ): ProseFinding[] {
507
+ const findings: ProseFinding[] = []
508
+ const allowed = new Set(allowlist)
509
+ const patterns: { pattern: RegExp; what: string }[] = [
510
+ { pattern: SOURCE_COMMENT_TRANCHE_SLUG_PATTERN, what: 'a tranche-slug citation' },
511
+ { pattern: SOURCE_COMMENT_FORGE_NUMBER_PATTERN, what: 'a forge-number citation' }
512
+ ]
513
+
514
+ for (const file of files) {
515
+ if (!file.path.endsWith('.ts')) continue
516
+ if (allowed.has(file.path)) continue
517
+ const comments = extractComments(file.path, file.content)
518
+ for (const { pattern, what } of patterns) {
519
+ pattern.lastIndex = 0
520
+ let match: RegExpExecArray | null = pattern.exec(comments)
521
+ while (match !== null) {
522
+ findings.push({
523
+ file: file.path,
524
+ line: lineAt(comments, match.index),
525
+ message: `comment cites ${what} ("${match[0]}") a reader outside this repo's tracker cannot resolve`,
526
+ blocking: false
527
+ })
528
+ match = pattern.exec(comments)
529
+ }
530
+ }
531
+ }
532
+ return findings
533
+ }
534
+
295
535
  /** Runs both mechanizable classes over the given files in one pass. */
296
536
  export function checkReaderResolvableProse(
297
537
  files: readonly ProseSourceFile[],
@@ -299,10 +539,18 @@ export function checkReaderResolvableProse(
299
539
  readerFacingPrefix: string,
300
540
  readerFacingSuffix: string,
301
541
  legacySlugs: readonly string[] = [],
302
- shipsPrefix: string = SHIPS_PREFIX
542
+ shipsPrefix: string = SHIPS_PREFIX,
543
+ specGrandfather: readonly string[] = []
303
544
  ): ProseFinding[] {
304
545
  return [
305
- ...checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs, shipsPrefix),
546
+ ...checkUnresolvableReferences(
547
+ files,
548
+ readerFacingPrefix,
549
+ readerFacingSuffix,
550
+ legacySlugs,
551
+ shipsPrefix,
552
+ specGrandfather
553
+ ),
306
554
  ...checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix)
307
555
  ]
308
556
  }
@@ -9,16 +9,20 @@
9
9
  * mirroring `coherence-checks.ts`'s shape exactly (plain executables,
10
10
  * deterministic pass/fail, no config conditionals).
11
11
  *
12
- * Rollout policy: G2 ships report-only — it can only ever report `'info'`,
13
- * never `'fail'`, so it never affects CI's exit code (the accepted shape for
14
- * G2's inverse sweep, unchanged by task 8). G1 was report-only through its
15
- * own rollout window; task 8 flips it to blocking now that the orphan
16
- * backlog it existed to surface is clean (0 findings against the real
17
- * `enforcement.md` at the time of the flip). G3–G6 are blocking (`'fail'` on
18
- * any violation).
12
+ * Rollout policy: G1 was report-only through its own rollout window; task 8
13
+ * flipped it to blocking once the orphan backlog it existed to surface was
14
+ * clean (0 findings against the real `enforcement.md` at the time of the
15
+ * flip). G2 was report-only until this task, which found its
16
+ * entire remaining backlog was not orphans at all — fourteen files were the
17
+ * second physical form of an already-documented mechanism (`claimedCheckNames`
18
+ * twin-form recognition, see `checkG2`'s own doc comment), and two more were
19
+ * already `NON_GATE_BINS`-listed non-gate tooling — and flipped it to
20
+ * blocking in the same task, on the same reasoning: a permanent `'info'`
21
+ * finding on every run trains its readers to ignore it. G3–G6 are blocking
22
+ * (`'fail'` on any violation).
19
23
  */
20
24
 
21
- import { GATE_AUDIENCE, isShipped } from './gate-audience'
25
+ import { GATE_AUDIENCE, isShipped, NON_GATE_BINS } from './gate-audience'
22
26
  import type { GateRow } from './registry-parse'
23
27
 
24
28
  export type RegistryCheckStatus = 'pass' | 'fail' | 'info'
@@ -62,35 +66,98 @@ export function checkG1(rows: GateRow[], existsFn: (path: string) => boolean): R
62
66
  * duplicated here rather than imported to keep this module's zero-import
63
67
  * shape — the two are asserted equal by `registry-checks.test.ts`). A stub
64
68
  * that filled `implementation` alone would silence G2 outright (the whole
65
- * defect Issue #104 exists to close): this marker is what keeps a row G2
69
+ * defect this exists to close): this marker is what keeps a row G2
66
70
  * still flags loud until a human replaces it with the real "why". */
67
71
  const SCAFFOLD_PLACEHOLDER = '[undocumented — fill in why]'
68
72
 
73
+ /** Every `packages/aeg-core/bin/*` basename (no extension) that implements no gate/refusal/detection mechanism of its own — a forge writer, a one-shot reporter, an eval harness. G2's twin candidate for `NON_GATE_BINS`: a file this list already names has nothing to be named FOR, so asking G2 to find it named by some row is the wrong question, not an unanswered one. */
74
+ const NON_GATE_BIN_NAMES: readonly string[] = NON_GATE_BINS
75
+
76
+ /**
77
+ * `apps/cli/src/checks/bin/*.ts` candidates the general `claimedCheckNames`
78
+ * derivation cannot see, each for a distinct, structural reason — hand-
79
+ * maintained rather than folded into `GATE_AUDIENCE`, because each would
80
+ * break an existing invariant that map enforces:
81
+ *
82
+ * - `check-dead-branch-push.ts` / `check-issue-assignment.ts`: their aeg-core
83
+ * twins (`check-push-target.ts`, `assign-task-issue.ts`) are genuinely NOT
84
+ * the same mechanism, only a closely related one an existing row's own
85
+ * prose already cross-references — `check-push-target.ts` is a lower-level
86
+ * helper `dead-branch-push`'s row already names as `implementation` (a
87
+ * single-purpose forge query, not a second copy of the check), and
88
+ * `assign-task-issue.ts` WRITES the assignment `issue-assignment` only
89
+ * verifies. `GATE_AUDIENCE`/`NON_GATE_BINS` correctly keep both classified
90
+ * by what they actually do; forcing a `shippedAs` claim onto either to
91
+ * satisfy G2 would misdescribe them.
92
+ * - `check-closes-n.ts`: its twin, `verify-coherence.ts`, already ships as
93
+ * `coherence` (ring 0) via `GATE_AUDIENCE` — but `closes-n` is ring 1
94
+ * (`CLI_CHECK_RING`), and `ShippedGate` has exactly one `ring` per bin
95
+ * (`shipped-bin-audience.test.ts` asserts every name in a `shippedAs`
96
+ * array shares that one ring). One file genuinely ships as two checks at
97
+ * two different rings — `GATE_AUDIENCE`'s shape cannot say that without a
98
+ * type change out of this task's surface.
99
+ *
100
+ * Each entry names the ALREADY-DOCUMENTED row (by its `Action`/`CI check`
101
+ * column text) that covers this candidate's mechanism, so a reader can go
102
+ * verify the cross-reference by hand.
103
+ */
104
+ const TWIN_CANDIDATE_EXCEPTIONS: Readonly<Record<string, string>> = {
105
+ 'apps/cli/src/checks/bin/check-dead-branch-push.ts':
106
+ 'Ring 0 "Pushing to a branch whose pull request already resolved" (implementation: check-push-target.ts)',
107
+ 'apps/cli/src/checks/bin/check-issue-assignment.ts':
108
+ 'Ring 0 "A task branch\'s first push (Issue self-assignment)" (implementation: assign-task-issue.ts)',
109
+ 'apps/cli/src/checks/bin/check-closes-n.ts': 'Ring 1 "Closes linkage" (implementation: verify-coherence.ts)'
110
+ }
111
+
112
+ /** A `.claude/hooks/*.sh` file that is real, installed plumbing — feeding an already-documented mechanism's OWN inputs (a transcript pointer, an outbox line) — but performs no pass/fail decision of its own, so it is not itself a candidate "gate" G2 can ask "which row is this?" about. Grown by hand as new hook scripts are added; `gate-audience.test.ts`'s bin-directory enumeration has no `.claude/hooks/` equivalent today. */
113
+ const NON_GATE_HOOK_SCRIPTS: readonly string[] = ['.claude/hooks/track-transcript.sh']
114
+
69
115
  /**
70
116
  * G2 — every candidate hook/CLI file is named by SOME row's `implementation`,
71
117
  * AND no row still carries the scaffold's placeholder marker un-replaced.
72
118
  * `candidateFiles` is already-globbed by the caller (`.husky/*`,
73
119
  * `.claude/hooks/*.sh`, `packages/aeg-core/bin/*.ts`, excluding `.husky/_`).
74
- * Report-only this tranche — same as G1, never `'fail'`.
75
120
  *
76
- * The second half (placeholder scan) is what keeps a registry-scaffold stub
77
- * row visible: `implementation` presence alone would make a stub read as
78
- * "documented" to the ORPHAN half above, which is precisely the trap the
79
- * scaffold must not fall into. Scanned over `summary`/`description`/`spec`
80
- * — every cell a stub can carry the marker in — never `implementation`,
81
- * `action`, `category`, or `audience`, which the scaffold fills mechanically
82
- * and are never expected to carry it.
121
+ * **Twin-form recognition.** The same enforcement
122
+ * mechanism routinely ships as two physical files — a `packages/aeg-core/
123
+ * bin/*.ts` standalone form and an `apps/cli/src/checks/bin/check-*.ts`
124
+ * CLI-registered form — but a row's `implementation` cell holds exactly one
125
+ * path (`GateRow.implementation: string`). Naming only one form orphaned
126
+ * the other on every one of 14 checks this task found live: not a missing
127
+ * row, but the SAME fact (this mechanism is documented) read through a
128
+ * string-equality test too narrow to see its own second form. `claimedCheckNames`
129
+ * already derives the `coreCheckRegistry()` name either physical shape
130
+ * resolves to (G6 uses it for a row's `implementation`); calling it on the
131
+ * CANDIDATE path too and checking for overlap with any row's claimed names
132
+ * is the one-fact-one-implementation fix — no new row invents a second
133
+ * fact for what is really one, already-documented mechanism.
134
+ *
135
+ * A `NON_GATE_BINS`-listed aeg-core bin (`report-tokens.ts`,
136
+ * `eval-agent-compliance.ts`, …) and a listed non-gate hook script
137
+ * (`track-transcript.sh`) implement no gate of their own — per the doctrine
138
+ * this task also writes (`enforcement.md`), the honest fix for a candidate
139
+ * that names no row is that this gate stops asking, never an invented row.
140
+ *
141
+ * Blocking as of this task (re-graded from report-only: the twin-form gap
142
+ * above was G2's entire non-scaffold-placeholder backlog, and closing it
143
+ * rather than merely explaining it away is what makes a 0-finding G2 run
144
+ * mean something again).
83
145
  */
84
146
  export function checkG2(rows: GateRow[], candidateFiles: string[]): RegistryCheckResult {
85
147
  const implementations = new Set(rows.map((r) => r.implementation).filter((p) => p !== ''))
148
+ const claimedNames = new Set(rows.flatMap((r) => claimedCheckNames(r.implementation)))
86
149
  const findings: RegistryFinding[] = []
87
150
  for (const path of candidateFiles) {
88
- if (!implementations.has(path)) {
89
- findings.push({
90
- path,
91
- reason: `"${path}" is not named as the implementation of any row in enforcement.md's ring tables`
92
- })
93
- }
151
+ if (implementations.has(path)) continue
152
+ if (path.startsWith(AEG_CORE_BIN_PATH_PREFIX) && NON_GATE_BIN_NAMES.includes(basenameNoExt(path))) continue
153
+ if (NON_GATE_HOOK_SCRIPTS.includes(path)) continue
154
+ if (path in TWIN_CANDIDATE_EXCEPTIONS) continue
155
+ const candidateNames = claimedCheckNames(path)
156
+ if (candidateNames.length > 0 && candidateNames.some((n) => claimedNames.has(n))) continue
157
+ findings.push({
158
+ path,
159
+ reason: `"${path}" is not named as the implementation of any row in enforcement.md's ring tables`
160
+ })
94
161
  }
95
162
  for (const row of rows) {
96
163
  const carriesPlaceholder = [row.summary, row.description, row.spec].some((cell) => cell === SCAFFOLD_PLACEHOLDER)
@@ -102,7 +169,7 @@ export function checkG2(rows: GateRow[], candidateFiles: string[]): RegistryChec
102
169
  })
103
170
  }
104
171
  }
105
- return { check: 'G2', status: findings.length > 0 ? 'info' : 'pass', findings }
172
+ return { check: 'G2', status: findings.length > 0 ? 'fail' : 'pass', findings }
106
173
  }
107
174
 
108
175
  /**
@@ -10,16 +10,16 @@
10
10
  * aeg-core-local data table — see its own doc comment for why aeg-core
11
11
  * cannot instead import `apps/cli`'s `CORE_CHECK_RING` directly).
12
12
  *
13
- * Three derivation classes, per Issue #104's Principal decision (extended
14
- * by Issue #307 for the second registry-backed location):
13
+ * Three derivation classes, per a Principal decision (extended
14
+ * later for the second registry-backed location):
15
15
  * - a `packages/aeg-core/bin/*.ts` candidate that IS a registered check
16
16
  * (its basename resolves in `GATE_AUDIENCE` to a `ShippedGate`) gets a
17
17
  * stub in the ring `GATE_AUDIENCE` names for it;
18
18
  * - an `apps/cli/src/checks/bin/*.ts` candidate that IS a registered check
19
19
  * (its `check-`-stripped basename resolves in `CLI_CHECK_RING`) gets a
20
20
  * stub in the ring `CLI_CHECK_RING` names for it — most core check bins
21
- * live here, not under `packages/aeg-core/bin/` (Issue #307: 22 of 27 at
22
- * the time it was filed);
21
+ * live here, not under `packages/aeg-core/bin/` (the large majority did,
22
+ * at the time this was filed);
23
23
  * - a `.husky/*` or `.claude/hooks/*.sh` candidate is a managed hook by
24
24
  * construction — ring 0, no registry lookup needed.
25
25
  * Anything else (a bin with no registry entry — `internal`, `NON_GATE_BINS`,
@@ -30,7 +30,7 @@
30
30
  * Never touches an existing row: stubs are computed only for candidates
31
31
  * whose path is absent from every parsed row's `implementation` — the
32
32
  * identical predicate `checkG2` itself uses — so a candidate already
33
- * documented (including every row `#67` wrote by hand) is left alone, and
33
+ * documented (including every hand-written row) is left alone, and
34
34
  * running the scaffold twice inserts nothing the second time (the first
35
35
  * run's own stubs are now present, so the same predicate excludes them).
36
36
  *
@@ -175,7 +175,7 @@ function formatRow(cells: string[]): string {
175
175
  * Rewrites `content` to append the plan's stub rows to their ring tables.
176
176
  * Only ever APPENDS new lines after a ring table's last existing row —
177
177
  * never edits, reorders, or removes an existing line, so a hand-written row
178
- * (including every row task `#67` wrote) is untouched byte-for-byte.
178
+ * is untouched byte-for-byte.
179
179
  *
180
180
  * Rings are processed from the bottom of the file upward (ring 2 first,
181
181
  * then ring 1, then ring 0) so an earlier insertion's line numbers, computed
@@ -16,7 +16,7 @@
16
16
  * layers to one vendor — that coupling is the defect the split exists to
17
17
  * prevent, and this file is where it would reappear first.
18
18
  *
19
- * Historical note (misc-hardening-v1 task 1, #675): this module retracted
19
+ * Historical note: this module retracted
20
20
  * §12's earlier claim that a role reports exact tokens "from `/cost`" — an
21
21
  * operator-typed slash command no unattended agent session can invoke, in
22
22
  * that host or any other. §12 records the retraction; the fix was to collect
@@ -162,19 +162,19 @@ const DASH_CHARS = new Set(Object.keys(DASH_LOOKALIKES))
162
162
 
163
163
  /**
164
164
  * `formatTokenReportRow`'s own table cells escape `|` as `\|` because
165
- * `splitTableRow` reads that convention back on the other side (`#313`).
165
+ * `splitTableRow` reads that convention back on the other side.
166
166
  * This line has no such reader — nothing unescapes a backslash out of it —
167
167
  * so a literal `\|` here would just be a backslash followed by a visible
168
168
  * bar, one more hazardous character rather than fewer. A same-glyph
169
169
  * lookalike, matching `DASH_LOOKALIKES`'s own approach, neutralizes the
170
170
  * delimiter unconditionally (unlike a dash, no ordinary model id legitimately
171
171
  * contains a pipe, so there is no adjacency case to preserve): an
172
- * attacker-controlled `model` field (`#313`'s live reproduction: a transcript
172
+ * attacker-controlled `model` field (a real live reproduction: a transcript
173
173
  * whose `message.model` read `attacker | evil-injected-cell | extra`) must
174
174
  * not survive with a real `|` if this line is later quoted verbatim inside
175
175
  * an actual markdown table cell by anything downstream — `pr report --write`
176
176
  * already escapes correctly at its own render step (`formatTokenReportRow`),
177
- * but this line, not that one, is what `#313`'s reproduction actually
177
+ * but this line, not that one, is what that reproduction actually
178
178
  * printed, and it carries no such guarantee of its own once it leaves here.
179
179
  */
180
180
  const PIPE_LOOKALIKE = '|' // U+FF5C FULLWIDTH VERTICAL LINE