@warpgogol/forge 9.3.0 → 9.4.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 (472) hide show
  1. package/AGENTS.md +32 -0
  2. package/CHANGELOG.md +33 -0
  3. package/README.md +2 -2
  4. package/bin/cli.ts +4 -4
  5. package/dist/bin/cli.js +4 -4
  6. package/dist/bin/cli.js.map +1 -1
  7. package/dist/os/adr/handlers/list-create.d.ts.map +1 -1
  8. package/dist/os/adr/handlers/list-create.js +23 -2
  9. package/dist/os/adr/handlers/list-create.js.map +1 -1
  10. package/dist/os/adr/types.d.ts +2 -0
  11. package/dist/os/adr/types.d.ts.map +1 -1
  12. package/dist/os/adr/types.js +2 -2
  13. package/dist/os/adr/types.js.map +1 -1
  14. package/dist/os/compass/handlers/compass-audit-handler.d.ts.map +1 -1
  15. package/dist/os/compass/handlers/compass-audit-handler.js +3 -1
  16. package/dist/os/compass/handlers/compass-audit-handler.js.map +1 -1
  17. package/dist/os/compass/handlers/compass-header-scaffold-handler.d.ts.map +1 -1
  18. package/dist/os/compass/handlers/compass-header-scaffold-handler.js +6 -12
  19. package/dist/os/compass/handlers/compass-header-scaffold-handler.js.map +1 -1
  20. package/dist/os/compass/handlers/git-revision.d.ts +2 -0
  21. package/dist/os/compass/handlers/git-revision.d.ts.map +1 -1
  22. package/dist/os/compass/handlers/git-revision.js +7 -2
  23. package/dist/os/compass/handlers/git-revision.js.map +1 -1
  24. package/dist/os/compass/handlers/summary-record.d.ts.map +1 -1
  25. package/dist/os/compass/handlers/summary-record.js +24 -14
  26. package/dist/os/compass/handlers/summary-record.js.map +1 -1
  27. package/dist/os/conformance/conformance.module.d.ts.map +1 -1
  28. package/dist/os/conformance/conformance.module.js +21 -4
  29. package/dist/os/conformance/conformance.module.js.map +1 -1
  30. package/dist/os/conformance/handlers/conformance-validate.d.ts.map +1 -1
  31. package/dist/os/conformance/handlers/conformance-validate.js +64 -8
  32. package/dist/os/conformance/handlers/conformance-validate.js.map +1 -1
  33. package/dist/os/core/archive-regen.d.ts +99 -0
  34. package/dist/os/core/archive-regen.d.ts.map +1 -0
  35. package/dist/os/core/archive-regen.js +220 -0
  36. package/dist/os/core/archive-regen.js.map +1 -0
  37. package/dist/os/core/core.module.d.ts.map +1 -1
  38. package/dist/os/core/core.module.js +159 -18
  39. package/dist/os/core/core.module.js.map +1 -1
  40. package/dist/os/core/handlers/assets-helpers.d.ts.map +1 -1
  41. package/dist/os/core/handlers/assets-helpers.js +8 -3
  42. package/dist/os/core/handlers/assets-helpers.js.map +1 -1
  43. package/dist/os/core/handlers/forge-autonomy-validate.d.ts.map +1 -1
  44. package/dist/os/core/handlers/forge-autonomy-validate.js +3 -1
  45. package/dist/os/core/handlers/forge-autonomy-validate.js.map +1 -1
  46. package/dist/os/core/handlers/package-health.d.ts +130 -0
  47. package/dist/os/core/handlers/package-health.d.ts.map +1 -1
  48. package/dist/os/core/handlers/package-health.js +548 -7
  49. package/dist/os/core/handlers/package-health.js.map +1 -1
  50. package/dist/os/core/handlers/release-prepare.d.ts.map +1 -1
  51. package/dist/os/core/handlers/release-prepare.js +5 -2
  52. package/dist/os/core/handlers/release-prepare.js.map +1 -1
  53. package/dist/os/flow/digest.d.ts.map +1 -1
  54. package/dist/os/flow/digest.js +3 -1
  55. package/dist/os/flow/digest.js.map +1 -1
  56. package/dist/os/flow/dirty-classify.d.ts +48 -0
  57. package/dist/os/flow/dirty-classify.d.ts.map +1 -0
  58. package/dist/os/flow/dirty-classify.js +81 -0
  59. package/dist/os/flow/dirty-classify.js.map +1 -0
  60. package/dist/os/flow/flow.module.d.ts.map +1 -1
  61. package/dist/os/flow/flow.module.js +85 -19
  62. package/dist/os/flow/flow.module.js.map +1 -1
  63. package/dist/os/flow/gate-engine.d.ts +13 -0
  64. package/dist/os/flow/gate-engine.d.ts.map +1 -0
  65. package/dist/os/flow/gate-engine.js +32 -0
  66. package/dist/os/flow/gate-engine.js.map +1 -0
  67. package/dist/os/flow/git.d.ts +45 -4
  68. package/dist/os/flow/git.d.ts.map +1 -1
  69. package/dist/os/flow/git.js +95 -27
  70. package/dist/os/flow/git.js.map +1 -1
  71. package/dist/os/flow/handlers/flow-backmerge.d.ts.map +1 -1
  72. package/dist/os/flow/handlers/flow-backmerge.js +12 -5
  73. package/dist/os/flow/handlers/flow-backmerge.js.map +1 -1
  74. package/dist/os/flow/handlers/flow-check.d.ts.map +1 -1
  75. package/dist/os/flow/handlers/flow-check.js +25 -3
  76. package/dist/os/flow/handlers/flow-check.js.map +1 -1
  77. package/dist/os/flow/handlers/flow-cut.d.ts +4 -1
  78. package/dist/os/flow/handlers/flow-cut.d.ts.map +1 -1
  79. package/dist/os/flow/handlers/flow-cut.js +54 -31
  80. package/dist/os/flow/handlers/flow-cut.js.map +1 -1
  81. package/dist/os/flow/handlers/flow-discard.d.ts.map +1 -1
  82. package/dist/os/flow/handlers/flow-discard.js +33 -5
  83. package/dist/os/flow/handlers/flow-discard.js.map +1 -1
  84. package/dist/os/flow/handlers/flow-fix.d.ts.map +1 -1
  85. package/dist/os/flow/handlers/flow-fix.js +13 -10
  86. package/dist/os/flow/handlers/flow-fix.js.map +1 -1
  87. package/dist/os/flow/handlers/flow-hold.d.ts.map +1 -1
  88. package/dist/os/flow/handlers/flow-hold.js +13 -7
  89. package/dist/os/flow/handlers/flow-hold.js.map +1 -1
  90. package/dist/os/flow/handlers/flow-install.d.ts +2 -1
  91. package/dist/os/flow/handlers/flow-install.d.ts.map +1 -1
  92. package/dist/os/flow/handlers/flow-install.js +56 -13
  93. package/dist/os/flow/handlers/flow-install.js.map +1 -1
  94. package/dist/os/flow/handlers/flow-integrate.d.ts +48 -2
  95. package/dist/os/flow/handlers/flow-integrate.d.ts.map +1 -1
  96. package/dist/os/flow/handlers/flow-integrate.js +536 -65
  97. package/dist/os/flow/handlers/flow-integrate.js.map +1 -1
  98. package/dist/os/flow/handlers/flow-open.d.ts +14 -0
  99. package/dist/os/flow/handlers/flow-open.d.ts.map +1 -1
  100. package/dist/os/flow/handlers/flow-open.js +117 -12
  101. package/dist/os/flow/handlers/flow-open.js.map +1 -1
  102. package/dist/os/flow/handlers/flow-status.d.ts +13 -0
  103. package/dist/os/flow/handlers/flow-status.d.ts.map +1 -1
  104. package/dist/os/flow/handlers/flow-status.js +35 -14
  105. package/dist/os/flow/handlers/flow-status.js.map +1 -1
  106. package/dist/os/flow/index.d.ts +1 -0
  107. package/dist/os/flow/index.d.ts.map +1 -1
  108. package/dist/os/flow/index.js +3 -1
  109. package/dist/os/flow/index.js.map +1 -1
  110. package/dist/os/flow/line-version.d.ts.map +1 -1
  111. package/dist/os/flow/line-version.js +2 -1
  112. package/dist/os/flow/line-version.js.map +1 -1
  113. package/dist/os/flow/locks.d.ts +37 -1
  114. package/dist/os/flow/locks.d.ts.map +1 -1
  115. package/dist/os/flow/locks.js +34 -14
  116. package/dist/os/flow/locks.js.map +1 -1
  117. package/dist/os/flow/preflight.d.ts +114 -0
  118. package/dist/os/flow/preflight.d.ts.map +1 -0
  119. package/dist/os/flow/preflight.js +620 -0
  120. package/dist/os/flow/preflight.js.map +1 -0
  121. package/dist/os/flow/publish.d.ts +7 -0
  122. package/dist/os/flow/publish.d.ts.map +1 -1
  123. package/dist/os/flow/publish.js +165 -3
  124. package/dist/os/flow/publish.js.map +1 -1
  125. package/dist/os/flow/registry.d.ts +26 -1
  126. package/dist/os/flow/registry.d.ts.map +1 -1
  127. package/dist/os/flow/registry.js +27 -6
  128. package/dist/os/flow/registry.js.map +1 -1
  129. package/dist/os/flow/scripts.d.ts +4 -0
  130. package/dist/os/flow/scripts.d.ts.map +1 -1
  131. package/dist/os/flow/scripts.js +13 -3
  132. package/dist/os/flow/scripts.js.map +1 -1
  133. package/dist/os/flow/session-checkout.d.ts +33 -0
  134. package/dist/os/flow/session-checkout.d.ts.map +1 -0
  135. package/dist/os/flow/session-checkout.js +151 -0
  136. package/dist/os/flow/session-checkout.js.map +1 -0
  137. package/dist/os/flow/worktree-path.d.ts.map +1 -1
  138. package/dist/os/flow/worktree-path.js +9 -3
  139. package/dist/os/flow/worktree-path.js.map +1 -1
  140. package/dist/os/instructions/handlers/budget-validate.d.ts +1 -0
  141. package/dist/os/instructions/handlers/budget-validate.d.ts.map +1 -1
  142. package/dist/os/instructions/handlers/budget-validate.js +12 -4
  143. package/dist/os/instructions/handlers/budget-validate.js.map +1 -1
  144. package/dist/os/instructions/instructions.module.d.ts.map +1 -1
  145. package/dist/os/instructions/instructions.module.js +4 -1
  146. package/dist/os/instructions/instructions.module.js.map +1 -1
  147. package/dist/os/mission/open-missions.d.ts +8 -0
  148. package/dist/os/mission/open-missions.d.ts.map +1 -0
  149. package/dist/os/mission/open-missions.js +42 -0
  150. package/dist/os/mission/open-missions.js.map +1 -0
  151. package/dist/os/queue/manifest.d.ts.map +1 -1
  152. package/dist/os/queue/manifest.js +11 -1
  153. package/dist/os/queue/manifest.js.map +1 -1
  154. package/dist/os/rfc/acceptance.d.ts +14 -0
  155. package/dist/os/rfc/acceptance.d.ts.map +1 -1
  156. package/dist/os/rfc/acceptance.js +18 -10
  157. package/dist/os/rfc/acceptance.js.map +1 -1
  158. package/dist/os/rfc/decision-log.d.ts.map +1 -1
  159. package/dist/os/rfc/decision-log.js +11 -2
  160. package/dist/os/rfc/decision-log.js.map +1 -1
  161. package/dist/os/rfc/frontmatter-io.d.ts +23 -0
  162. package/dist/os/rfc/frontmatter-io.d.ts.map +1 -1
  163. package/dist/os/rfc/frontmatter-io.js +82 -1
  164. package/dist/os/rfc/frontmatter-io.js.map +1 -1
  165. package/dist/os/rfc/handlers/implement-stamp-deviations.d.ts.map +1 -1
  166. package/dist/os/rfc/handlers/implement-stamp-deviations.js +24 -2
  167. package/dist/os/rfc/handlers/implement-stamp-deviations.js.map +1 -1
  168. package/dist/os/rfc/handlers/implement-stamp.d.ts.map +1 -1
  169. package/dist/os/rfc/handlers/implement-stamp.js +16 -3
  170. package/dist/os/rfc/handlers/implement-stamp.js.map +1 -1
  171. package/dist/os/rfc/handlers/index-graph.d.ts.map +1 -1
  172. package/dist/os/rfc/handlers/index-graph.js +5 -4
  173. package/dist/os/rfc/handlers/index-graph.js.map +1 -1
  174. package/dist/os/rfc/handlers/list-create.d.ts.map +1 -1
  175. package/dist/os/rfc/handlers/list-create.js +83 -8
  176. package/dist/os/rfc/handlers/list-create.js.map +1 -1
  177. package/dist/os/rfc/handlers/rfc-evidence-sync.d.ts +48 -0
  178. package/dist/os/rfc/handlers/rfc-evidence-sync.d.ts.map +1 -1
  179. package/dist/os/rfc/handlers/rfc-evidence-sync.js +131 -2
  180. package/dist/os/rfc/handlers/rfc-evidence-sync.js.map +1 -1
  181. package/dist/os/rfc/handlers/validate-rules.d.ts +21 -1
  182. package/dist/os/rfc/handlers/validate-rules.d.ts.map +1 -1
  183. package/dist/os/rfc/handlers/validate-rules.js +77 -5
  184. package/dist/os/rfc/handlers/validate-rules.js.map +1 -1
  185. package/dist/os/rfc/handlers/validate.d.ts.map +1 -1
  186. package/dist/os/rfc/handlers/validate.js +64 -6
  187. package/dist/os/rfc/handlers/validate.js.map +1 -1
  188. package/dist/os/rfc/next-id.d.ts +38 -0
  189. package/dist/os/rfc/next-id.d.ts.map +1 -0
  190. package/dist/os/rfc/next-id.js +165 -0
  191. package/dist/os/rfc/next-id.js.map +1 -0
  192. package/dist/os/rfc/probe-batch.d.ts.map +1 -1
  193. package/dist/os/rfc/probe-batch.js +6 -1
  194. package/dist/os/rfc/probe-batch.js.map +1 -1
  195. package/dist/os/rfc/rfc.module.d.ts.map +1 -1
  196. package/dist/os/rfc/rfc.module.js +36 -8
  197. package/dist/os/rfc/rfc.module.js.map +1 -1
  198. package/dist/os/rfc/types.d.ts +35 -6
  199. package/dist/os/rfc/types.d.ts.map +1 -1
  200. package/dist/os/rfc/types.js +6 -6
  201. package/dist/os/rfc/types.js.map +1 -1
  202. package/dist/os/rfc/verification-evidence.d.ts +1 -1
  203. package/dist/os/rfc/verification-evidence.d.ts.map +1 -1
  204. package/dist/os/rfc/verification-evidence.js +81 -28
  205. package/dist/os/rfc/verification-evidence.js.map +1 -1
  206. package/dist/os/rfc/verification-origin.d.ts +8 -0
  207. package/dist/os/rfc/verification-origin.d.ts.map +1 -1
  208. package/dist/os/rfc/verification-origin.js +47 -0
  209. package/dist/os/rfc/verification-origin.js.map +1 -1
  210. package/dist/os/session/handlers/save.d.ts.map +1 -1
  211. package/dist/os/session/handlers/save.js +31 -7
  212. package/dist/os/session/handlers/save.js.map +1 -1
  213. package/dist/os/spec/spec-schema.d.ts +8 -0
  214. package/dist/os/spec/spec-schema.d.ts.map +1 -1
  215. package/dist/os/spec/spec-schema.js +1 -0
  216. package/dist/os/spec/spec-schema.js.map +1 -1
  217. package/dist/os/spec/spec-status.d.ts +8 -0
  218. package/dist/os/spec/spec-status.d.ts.map +1 -1
  219. package/dist/os/spec/spec-status.js +18 -6
  220. package/dist/os/spec/spec-status.js.map +1 -1
  221. package/dist/os/spec/spec-validate.d.ts.map +1 -1
  222. package/dist/os/spec/spec-validate.js +62 -15
  223. package/dist/os/spec/spec-validate.js.map +1 -1
  224. package/dist/os/spec/spec.module.d.ts.map +1 -1
  225. package/dist/os/spec/spec.module.js +13 -5
  226. package/dist/os/spec/spec.module.js.map +1 -1
  227. package/dist/os/system/handlers/system-map-validate.d.ts.map +1 -1
  228. package/dist/os/system/handlers/system-map-validate.js +2 -1
  229. package/dist/os/system/handlers/system-map-validate.js.map +1 -1
  230. package/dist/os/system/handlers/system-outbox-scan.d.ts +11 -0
  231. package/dist/os/system/handlers/system-outbox-scan.d.ts.map +1 -1
  232. package/dist/os/system/handlers/system-outbox-scan.js +54 -6
  233. package/dist/os/system/handlers/system-outbox-scan.js.map +1 -1
  234. package/dist/os/system/handlers/system-task-create.d.ts.map +1 -1
  235. package/dist/os/system/handlers/system-task-create.js +6 -1
  236. package/dist/os/system/handlers/system-task-create.js.map +1 -1
  237. package/dist/os/system/handlers/system-versionset-record.d.ts +14 -0
  238. package/dist/os/system/handlers/system-versionset-record.d.ts.map +1 -1
  239. package/dist/os/system/handlers/system-versionset-record.js +246 -6
  240. package/dist/os/system/handlers/system-versionset-record.js.map +1 -1
  241. package/dist/os/system/repo.d.ts +1 -1
  242. package/dist/os/system/repo.d.ts.map +1 -1
  243. package/dist/os/system/repo.js +53 -3
  244. package/dist/os/system/repo.js.map +1 -1
  245. package/dist/os/system/scenario-schemas.d.ts +109 -3
  246. package/dist/os/system/scenario-schemas.d.ts.map +1 -1
  247. package/dist/os/system/scenario-schemas.js +66 -10
  248. package/dist/os/system/scenario-schemas.js.map +1 -1
  249. package/dist/os/system/system.module.d.ts.map +1 -1
  250. package/dist/os/system/system.module.js +69 -17
  251. package/dist/os/system/system.module.js.map +1 -1
  252. package/dist/os/system/tests/contract-fixtures.d.ts +17 -0
  253. package/dist/os/system/tests/contract-fixtures.d.ts.map +1 -0
  254. package/dist/os/system/tests/contract-fixtures.js +109 -0
  255. package/dist/os/system/tests/contract-fixtures.js.map +1 -0
  256. package/dist/src/config/forge-config.d.ts +54 -18
  257. package/dist/src/config/forge-config.d.ts.map +1 -1
  258. package/dist/src/config/forge-config.js +41 -9
  259. package/dist/src/config/forge-config.js.map +1 -1
  260. package/dist/src/conformance/index.d.ts +6 -0
  261. package/dist/src/conformance/index.d.ts.map +1 -1
  262. package/dist/src/conformance/index.js +36 -1
  263. package/dist/src/conformance/index.js.map +1 -1
  264. package/dist/src/formal/proof-runner.d.ts.map +1 -1
  265. package/dist/src/formal/proof-runner.js +10 -2
  266. package/dist/src/formal/proof-runner.js.map +1 -1
  267. package/dist/src/migration-adapters/node-typescript-pnpm/index.js +3 -1
  268. package/dist/src/migration-adapters/node-typescript-pnpm/index.js.map +1 -1
  269. package/dist/src/migration-adapters/phaser-pnpm/index.js +3 -1
  270. package/dist/src/migration-adapters/phaser-pnpm/index.js.map +1 -1
  271. package/dist/src/onboarding/agents-generate.js +4 -4
  272. package/dist/src/onboarding/agents-generate.js.map +1 -1
  273. package/dist/src/onboarding/nested-agents-generate.d.ts.map +1 -1
  274. package/dist/src/onboarding/nested-agents-generate.js +3 -1
  275. package/dist/src/onboarding/nested-agents-generate.js.map +1 -1
  276. package/dist/src/onboarding/scaffold-project.js +2 -2
  277. package/dist/src/onboarding/scaffold-project.js.map +1 -1
  278. package/dist/src/onboarding/upgrade.d.ts.map +1 -1
  279. package/dist/src/onboarding/upgrade.js +14 -2
  280. package/dist/src/onboarding/upgrade.js.map +1 -1
  281. package/dist/src/onboarding/workspace-discovery.d.ts.map +1 -1
  282. package/dist/src/onboarding/workspace-discovery.js +3 -1
  283. package/dist/src/onboarding/workspace-discovery.js.map +1 -1
  284. package/dist/src/skill-schema.d.ts +3 -0
  285. package/dist/src/skill-schema.d.ts.map +1 -1
  286. package/dist/src/skill-schema.js +9 -2
  287. package/dist/src/skill-schema.js.map +1 -1
  288. package/dist/src/spec/resolve-spec-source.d.ts +45 -0
  289. package/dist/src/spec/resolve-spec-source.d.ts.map +1 -0
  290. package/dist/src/spec/resolve-spec-source.js +153 -0
  291. package/dist/src/spec/resolve-spec-source.js.map +1 -0
  292. package/dist/src/utils/command-inventory.d.ts +28 -0
  293. package/dist/src/utils/command-inventory.d.ts.map +1 -0
  294. package/dist/src/utils/command-inventory.js +84 -0
  295. package/dist/src/utils/command-inventory.js.map +1 -0
  296. package/dist/src/utils/io.d.ts.map +1 -1
  297. package/dist/src/utils/io.js +6 -1
  298. package/dist/src/utils/io.js.map +1 -1
  299. package/dist/src/utils/repo-path.d.ts +10 -0
  300. package/dist/src/utils/repo-path.d.ts.map +1 -0
  301. package/dist/src/utils/repo-path.js +52 -0
  302. package/dist/src/utils/repo-path.js.map +1 -0
  303. package/dist/src/utils/spawn.d.ts +23 -0
  304. package/dist/src/utils/spawn.d.ts.map +1 -0
  305. package/dist/src/utils/spawn.js +83 -0
  306. package/dist/src/utils/spawn.js.map +1 -0
  307. package/docs/branch-model.md +1 -1
  308. package/docs/guides/existing-project.md +1 -1
  309. package/docs/maintainers/publishing.md +1 -1
  310. package/docs/reference/cli.md +8 -2
  311. package/docs/reference/profiles.md +1 -1
  312. package/os/adr/handlers/list-create.ts +26 -2
  313. package/os/adr/types.ts +4 -2
  314. package/os/compass/handlers/compass-audit-handler.ts +6 -1
  315. package/os/compass/handlers/compass-header-scaffold-handler.ts +12 -11
  316. package/os/compass/handlers/git-revision.ts +8 -2
  317. package/os/compass/handlers/summary-record.ts +25 -14
  318. package/os/compass/handlers/tests/compass-invariant-binding.test.ts +3 -2
  319. package/os/conformance/conformance.module.ts +21 -4
  320. package/os/conformance/handlers/conformance-validate.ts +108 -16
  321. package/os/conformance/handlers/tests/conformance-package-consumer.test.ts +200 -0
  322. package/os/core/archive-regen.ts +279 -0
  323. package/os/core/core.module.ts +176 -29
  324. package/os/core/docs-archive.test.ts +413 -3
  325. package/os/core/handlers/assets-helpers.ts +8 -3
  326. package/os/core/handlers/forge-autonomy-validate.ts +3 -1
  327. package/os/core/handlers/package-health.test.ts +418 -4
  328. package/os/core/handlers/package-health.ts +629 -7
  329. package/os/core/handlers/release-prepare.ts +5 -2
  330. package/os/flow/digest.ts +3 -1
  331. package/os/flow/dirty-classify.ts +112 -0
  332. package/os/flow/flow.module.ts +92 -24
  333. package/os/flow/gate-engine.ts +45 -0
  334. package/os/flow/git.ts +117 -29
  335. package/os/flow/handlers/flow-backmerge.ts +14 -4
  336. package/os/flow/handlers/flow-check.ts +27 -2
  337. package/os/flow/handlers/flow-cut.ts +97 -46
  338. package/os/flow/handlers/flow-discard.ts +33 -5
  339. package/os/flow/handlers/flow-fix.ts +22 -10
  340. package/os/flow/handlers/flow-hold.ts +20 -7
  341. package/os/flow/handlers/flow-install.ts +59 -12
  342. package/os/flow/handlers/flow-integrate.ts +808 -182
  343. package/os/flow/handlers/flow-open.ts +135 -11
  344. package/os/flow/handlers/flow-status.ts +45 -13
  345. package/os/flow/index.ts +3 -1
  346. package/os/flow/line-version.ts +2 -1
  347. package/os/flow/locks.ts +56 -14
  348. package/os/flow/preflight.ts +763 -0
  349. package/os/flow/publish.ts +200 -5
  350. package/os/flow/registry.ts +43 -7
  351. package/os/flow/scripts.ts +23 -7
  352. package/os/flow/session-checkout.ts +186 -0
  353. package/os/flow/tests/dirty-classify.test.ts +116 -0
  354. package/os/flow/tests/fixtures/branch-names.yaml +40 -40
  355. package/os/flow/tests/flow-discard.test.ts +32 -0
  356. package/os/flow/tests/flow-guard-parity.test.ts +10 -2
  357. package/os/flow/tests/flow-install.test.ts +7 -3
  358. package/os/flow/tests/flow-integrate.gate-report.test.ts +144 -0
  359. package/os/flow/tests/flow-integrate.preflight.test.ts +561 -0
  360. package/os/flow/tests/flow-integrate.reattach.test.ts +197 -0
  361. package/os/flow/tests/flow-integrate.remediation.test.ts +254 -0
  362. package/os/flow/tests/flow-integrate.test.ts +348 -17
  363. package/os/flow/tests/flow-open.pending.test.ts +277 -0
  364. package/os/flow/tests/flow-open.test.ts +52 -9
  365. package/os/flow/tests/flow-push-publish.test.ts +124 -0
  366. package/os/flow/tests/flow-status.test.ts +31 -1
  367. package/os/flow/tests/locks.test.ts +39 -3
  368. package/os/flow/tests/scripts.test.ts +18 -2
  369. package/os/flow/tests/state-roots.test.ts +8 -5
  370. package/os/flow/worktree-path.ts +9 -3
  371. package/os/formal/handlers/proof-check.test.ts +6 -3
  372. package/os/instructions/budget.test.ts +31 -0
  373. package/os/instructions/handlers/budget-validate.ts +13 -4
  374. package/os/instructions/instructions.module.ts +4 -1
  375. package/os/mission/open-missions.ts +50 -0
  376. package/os/queue/decision-ledger.test.ts +18 -0
  377. package/os/queue/manifest.ts +17 -1
  378. package/os/rfc/acceptance.ts +30 -10
  379. package/os/rfc/decision-log.ts +13 -2
  380. package/os/rfc/frontmatter-io.ts +89 -1
  381. package/os/rfc/handlers/implement-stamp-deviations.test.ts +83 -0
  382. package/os/rfc/handlers/implement-stamp-deviations.ts +22 -2
  383. package/os/rfc/handlers/implement-stamp-stale.test.ts +5 -1
  384. package/os/rfc/handlers/implement-stamp.ts +16 -3
  385. package/os/rfc/handlers/index-graph.ts +5 -4
  386. package/os/rfc/handlers/lifecycle.test.ts +136 -0
  387. package/os/rfc/handlers/list-create.test.ts +82 -0
  388. package/os/rfc/handlers/list-create.ts +101 -8
  389. package/os/rfc/handlers/rfc-evidence-sync.test.ts +504 -0
  390. package/os/rfc/handlers/rfc-evidence-sync.ts +192 -2
  391. package/os/rfc/handlers/tests/index-graph.test.ts +2 -1
  392. package/os/rfc/handlers/validate-rules-rfc1454.test.ts +73 -0
  393. package/os/rfc/handlers/validate-rules.ts +103 -7
  394. package/os/rfc/handlers/validate.ts +68 -4
  395. package/os/rfc/next-id.ts +232 -0
  396. package/os/rfc/probe-batch.ts +6 -1
  397. package/os/rfc/rfc.module.ts +41 -8
  398. package/os/rfc/types.ts +28 -6
  399. package/os/rfc/verification-emit-freshness.test.ts +5 -1
  400. package/os/rfc/verification-emit.test.ts +5 -1
  401. package/os/rfc/verification-evidence.ts +99 -33
  402. package/os/rfc/verification-origin.ts +59 -0
  403. package/os/rfc/verification-refresh.test.ts +5 -1
  404. package/os/rfc/verifier/rfc-1333/imp12-binding.acceptance.test.ts +5 -1
  405. package/os/session/handlers/save.ts +35 -7
  406. package/os/session/tests/session-save.test.ts +154 -0
  407. package/os/spec/spec-schema.ts +3 -0
  408. package/os/spec/spec-status.ts +22 -6
  409. package/os/spec/spec-validate.package-source.test.ts +187 -0
  410. package/os/spec/spec-validate.ts +65 -14
  411. package/os/spec/spec.module.ts +13 -5
  412. package/os/system/handlers/system-map-validate.ts +4 -2
  413. package/os/system/handlers/system-outbox-scan.ts +65 -21
  414. package/os/system/handlers/system-task-create.ts +6 -1
  415. package/os/system/handlers/system-versionset-record.ts +301 -16
  416. package/os/system/repo.ts +59 -18
  417. package/os/system/scenario-schemas.ts +91 -12
  418. package/os/system/system.module.ts +70 -17
  419. package/os/system/tests/contract-fixtures.ts +139 -0
  420. package/os/system/tests/scenario-pin-drift-check.test.ts +114 -0
  421. package/os/system/tests/scenario-validator-check.test.ts +96 -0
  422. package/os/system/tests/system-task-dispatch.test.ts +4 -1
  423. package/os/system/tests/system-versionset.test.ts +7 -3
  424. package/os/system/tests/version-set-v2.test.ts +78 -0
  425. package/package.json +9 -1
  426. package/profiles/forge-shell.yaml +1 -2
  427. package/profiles/knowledge.yaml +1 -1
  428. package/profiles/system.yaml +2 -2
  429. package/profiles/typescript.yaml +0 -1
  430. package/skills/fo/fo-doctor/SKILL.md +151 -0
  431. package/skills/fo/fo-handoff/SKILL.md +22 -0
  432. package/skills/fo/fo-idea-create-rfc/acceptance-criteria-standard.md +2 -1
  433. package/skills/fo/fo-idea-implement/SKILL.md +5 -2
  434. package/skills/fo/fo-idea-plan/SKILL.md +5 -5
  435. package/skills/fo/fo-session-retro/SKILL.md +37 -11
  436. package/skills/fo/fo-spec-ingest/SKILL.md +8 -0
  437. package/skills/fo/fo-system-dispatch/SKILL.md +1 -0
  438. package/skills/meta/skill-create/SKILL.md +2 -1
  439. package/src/bin-entry.test.ts +3 -1
  440. package/src/config/forge-config.ts +57 -13
  441. package/src/conformance/index.ts +46 -1
  442. package/src/formal/proof-runner.ts +10 -2
  443. package/src/migration-adapters/node-typescript-pnpm/index.ts +3 -1
  444. package/src/migration-adapters/phaser-pnpm/index.ts +3 -1
  445. package/src/onboarding/agents-generate.ts +4 -4
  446. package/src/onboarding/nested-agents-generate.ts +3 -1
  447. package/src/onboarding/scaffold-project.ts +2 -2
  448. package/src/onboarding/upgrade.ts +13 -2
  449. package/src/onboarding/workspace-discovery.ts +3 -1
  450. package/src/pipeline-status.test.ts +1 -1
  451. package/src/skill-schema.ts +9 -2
  452. package/src/spec/resolve-spec-source.ts +184 -0
  453. package/src/tests/acceptance-probe-kinds.test.ts +3 -1
  454. package/src/tests/agents-generate-domain.test.ts +3 -2
  455. package/src/tests/agents-generate.test.ts +2 -1
  456. package/src/tests/create-flow.test.ts +3 -1
  457. package/src/tests/create.test.ts +12 -2
  458. package/src/tests/editable-generated-region.test.ts +2 -2
  459. package/src/tests/fixtures/agents-generate-business-before.txt +2 -0
  460. package/src/tests/implement-stamp.test.ts +5 -2
  461. package/src/tests/profile-flow-hooks.test.ts +15 -0
  462. package/src/tests/rfc-implement-stamp-governance.test.ts +6 -2
  463. package/src/tests/rfc-verification-verdict-ingest.test.ts +5 -1
  464. package/src/tests/scaffold-project.test.ts +3 -1
  465. package/src/tests/upgrade.test.ts +79 -3
  466. package/src/tests/workspace-discovery.test.ts +4 -3
  467. package/src/utils/command-inventory.ts +105 -0
  468. package/src/utils/io.ts +6 -1
  469. package/src/utils/repo-path.ts +49 -0
  470. package/src/utils/spawn.ts +88 -0
  471. package/src/tests/rfc-evidence-sync.test.ts +0 -369
  472. package/src/tests/skill-agents-sync.test.ts +0 -192
@@ -14,6 +14,10 @@ invocation attests "all generated artifacts + RFC evidence are current".
14
14
  <KEY_DECISIONS>
15
15
  <item>Step order is contract: the ecosystem manifest hashes the other artifacts, so ecosystem.manifest.generate runs last among the manifest steps.</item>
16
16
  <item>EVIDENCE_SYNC_STEPS is the canonical regen list</item>
17
+ <item>RFC-1516: the committed envelope is read via `git show HEAD:&lt;path&gt;`, never the worktree file — an uncommitted hand-edit can never become reusable input; every gate below green+matching+in-window falls back to full re-execution with its reason journalized.</item>
18
+ <item>RFC-1516: reuse is evaluated in emit (not in the sync orchestrator) so the direct `rfc.verification.emit` path, the sync chain, and the stamp's in-process emits share one decision; sync only forwards the escape flag and surfaces the verdict.</item>
19
+ <item>RFC-1516 review-r1: freshness binds to `resultsFrom ?? emittedAt`, not `emittedAt` alone — an envelope that replays records stamps the original execution's anchor, so chained emit+commit cycles cannot extend result age past the window.</item>
20
+ <item>RFC-1516 review-r1: a probes-count mismatch is `malformed` only after the acceptanceHash gate — a legitimately changed list reports `acceptance-changed`; a matching-hash envelope with a short or misshapen probes array is crafted bytes and degrades to full re-execution, never a crash or partial reuse.</item>
17
21
  </KEY_DECISIONS>
18
22
  <CHANGE_SUMMARY>
19
23
  <item>RFC-1306: initial — EVIDENCE_SYNC_STEPS chain + runRfcEvidenceSync via the ctx.invoke port; EVIDENCE-SYNC-01 fail-closed without a kernel host, EVIDENCE-SYNC-02 propagates a failed step's diagnostics verbatim; review-r1: try/catch maps thrown invokes into EVIDENCE-SYNC-02, dry-run exposes `planned` in data.</item>
@@ -26,6 +30,10 @@ import type {
26
30
  ForgeCommandResult,
27
31
  ForgeRuntimeContext,
28
32
  } from "../../../src/types.ts";
33
+ import { execFile } from "../../../src/utils/sync-fs.ts";
34
+ import { parse as yamlParse } from "yaml";
35
+ import { gitEnvForCwd } from "../verification-origin.ts";
36
+ import type { VerificationEvidence } from "../types.ts";
29
37
 
30
38
  /**
31
39
  * The canonical RFC-evidence regen order (RFC-1306). The emit step is
@@ -42,6 +50,127 @@ export const EVIDENCE_SYNC_STEPS: readonly string[] = [
42
50
 
43
51
  export const EVIDENCE_SYNC_EMIT_STEP = "rfc.verification.emit";
44
52
 
53
+ /** RFC-1516: the evidence-freshness window — a committed green envelope
54
+ * younger than this may replay its heavy-probe results instead of
55
+ * re-executing them. 4h covers every realistic stamp-retry session while
56
+ * bounding staleness. */
57
+ export const EVIDENCE_REUSE_WINDOW_MS = 14400000;
58
+
59
+ export type EvidenceReuseReason =
60
+ | "envelope-reused"
61
+ | "absent"
62
+ | "malformed"
63
+ | "not-green"
64
+ | "acceptance-changed"
65
+ | "expired"
66
+ | "disabled";
67
+
68
+ export interface EvidenceReuseVerdict {
69
+ reusable: boolean;
70
+ reason: EvidenceReuseReason;
71
+ /** The reused envelope's `emittedAt` when reusable — provenance, not a
72
+ * claim the probes just ran. */
73
+ reusedFrom?: string;
74
+ }
75
+
76
+ /** Reuse is strictly gated — anything short of a well-formed, green,
77
+ * acceptance-matching, in-window envelope falls back to full re-execution.
78
+ * `malformed` covers every unreadable/underspecified shape: unparsable
79
+ * YAML, a non-object body, missing contract fields, bad record elements —
80
+ * and a probes-array length that contradicts a matching acceptanceHash
81
+ * (a crafted envelope; a legitimately different list reports
82
+ * `acceptance-changed` first). */
83
+ export function evaluateEvidenceReuse(opts: {
84
+ committed: VerificationEvidence | null;
85
+ /** true when bytes existed but did not parse to the envelope contract. */
86
+ malformed?: boolean;
87
+ /** committed probes[].length ≠ the live acceptance list length. */
88
+ probeCountMismatch?: boolean;
89
+ acceptanceHashHex: string;
90
+ disabled: boolean;
91
+ now?: number;
92
+ }): EvidenceReuseVerdict {
93
+ if (opts.disabled) return { reusable: false, reason: "disabled" };
94
+ if (opts.malformed) return { reusable: false, reason: "malformed" };
95
+ const env = opts.committed;
96
+ if (!env) return { reusable: false, reason: "absent" };
97
+ if (env.overall !== "pass") return { reusable: false, reason: "not-green" };
98
+ if (env.acceptanceHash !== opts.acceptanceHashHex) {
99
+ return { reusable: false, reason: "acceptance-changed" };
100
+ }
101
+ if (opts.probeCountMismatch) return { reusable: false, reason: "malformed" };
102
+ // Freshness binds to the oldest replayed result, not the last emission:
103
+ // `resultsFrom` is stamped when an envelope replays committed records, so
104
+ // chained emit+commit cycles cannot extend result age past the window.
105
+ const anchor = typeof env.resultsFrom === "string" ? env.resultsFrom : env.emittedAt;
106
+ const anchorMs = Date.parse(anchor ?? "");
107
+ const now = opts.now ?? Date.now();
108
+ // Future timestamps are outside the window too (60s skew tolerance) —
109
+ // a negative age must never read as "fresh".
110
+ if (
111
+ !Number.isFinite(anchorMs) ||
112
+ now - anchorMs > EVIDENCE_REUSE_WINDOW_MS ||
113
+ anchorMs - now > 60_000
114
+ ) {
115
+ return { reusable: false, reason: "expired" };
116
+ }
117
+ return { reusable: true, reason: "envelope-reused", reusedFrom: env.emittedAt };
118
+ }
119
+
120
+ /** The committed envelope — read from HEAD bytes (`git show`), never the
121
+ * worktree file, so an uncommitted hand-edit can never become reusable
122
+ * input. Returns {envelope} on a contract-shaped parse, {malformed} on
123
+ * bytes that exist but don't satisfy it, {} when nothing is committed. */
124
+ export async function readCommittedEnvelope(
125
+ workspaceRoot: string,
126
+ relPath: string,
127
+ expectedProbeCount?: number,
128
+ ): Promise<{
129
+ envelope?: VerificationEvidence;
130
+ malformed?: boolean;
131
+ probeCountMismatch?: boolean;
132
+ }> {
133
+ const rel = relPath.replace(/\\/g, "/");
134
+ const stdout = await new Promise<string>((resolve) => {
135
+ execFile(
136
+ "git",
137
+ ["show", `HEAD:${rel}`],
138
+ { cwd: workspaceRoot, timeout: 5000, env: gitEnvForCwd() },
139
+ (err, out) => {
140
+ resolve(err ? "" : out);
141
+ },
142
+ );
143
+ });
144
+ if (stdout.trim().length === 0) return {};
145
+ let parsed: unknown;
146
+ try {
147
+ parsed = yamlParse(stdout);
148
+ } catch {
149
+ return { malformed: true };
150
+ }
151
+ if (typeof parsed !== "object" || parsed === null) return { malformed: true };
152
+ const env = parsed as Partial<VerificationEvidence>;
153
+ if (
154
+ typeof env.rfcId !== "string" ||
155
+ typeof env.emittedAt !== "string" ||
156
+ typeof env.acceptanceHash !== "string" ||
157
+ (env.overall !== "pass" && env.overall !== "fail") ||
158
+ !Array.isArray(env.probes) ||
159
+ env.probes.some(
160
+ (r) => r === null || typeof r !== "object" || typeof r.ok !== "boolean",
161
+ ) ||
162
+ (env.resultsFrom !== undefined && typeof env.resultsFrom !== "string")
163
+ ) {
164
+ return { malformed: true };
165
+ }
166
+ // A length mismatch is NOT malformed on its own — an acceptance-changed
167
+ // envelope legitimately describes a different-sized list. The verdict
168
+ // classifies it as malformed only when the hash still matches (crafted).
169
+ const probeCountMismatch =
170
+ expectedProbeCount !== undefined && env.probes.length !== expectedProbeCount;
171
+ return { envelope: env as VerificationEvidence, probeCountMismatch };
172
+ }
173
+
45
174
  export interface RfcEvidenceSyncStepResult {
46
175
  step: string;
47
176
  flags?: Record<string, unknown>;
@@ -65,6 +194,14 @@ export interface RfcEvidenceSyncResult {
65
194
  failedStep?: string;
66
195
  /** Dry-run only — the ordered step list that would execute. */
67
196
  planned?: Array<{ step: string; flags?: Record<string, string> }>;
197
+ /** RFC-1516: the emit step's freshness-window verdict — surfaced verbatim
198
+ * so a stamp-sync log shows whether heavy probes re-executed or the
199
+ * committed envelope replayed. */
200
+ reuse?: EvidenceReuseVerdict;
201
+ /** Criteria whose run/test/page/proof results carried over. */
202
+ heavyProbesReused?: string[];
203
+ /** Criteria re-resolved against the live tree. */
204
+ cheapProbesReRun?: string[];
68
205
  }
69
206
 
70
207
  interface SyncReport {
@@ -103,10 +240,23 @@ export async function runRfcEvidenceSync(
103
240
  const rfcId = input.flags["id"];
104
241
  const rfcIdStr = typeof rfcId === "string" && rfcId !== "" ? rfcId : undefined;
105
242
  const isDryRun = context.dryRun || input.flags["dry-run"] === true;
243
+ // RFC-1516: the escape flag forwards verbatim to the emit step — every
244
+ // probe then re-executes regardless of envelope freshness.
245
+ const noEvidenceReuse = input.flags["no-evidence-reuse"] === true;
106
246
 
107
247
  const plan: Array<{ step: string; flags?: Record<string, string> }> = [
108
248
  ...EVIDENCE_SYNC_STEPS.map((step) => ({ step })),
109
- ...(rfcIdStr ? [{ step: EVIDENCE_SYNC_EMIT_STEP, flags: { id: rfcIdStr } }] : []),
249
+ ...(rfcIdStr
250
+ ? [
251
+ {
252
+ step: EVIDENCE_SYNC_EMIT_STEP,
253
+ flags: {
254
+ id: rfcIdStr,
255
+ ...(noEvidenceReuse ? { "no-evidence-reuse": "true" } : {}),
256
+ },
257
+ },
258
+ ]
259
+ : []),
110
260
  ];
111
261
 
112
262
  if (isDryRun) {
@@ -151,6 +301,7 @@ export async function runRfcEvidenceSync(
151
301
  }
152
302
 
153
303
  const steps: RfcEvidenceSyncStepResult[] = [];
304
+ let emitReport: Awaited<ReturnType<typeof invoke>> | null = null;
154
305
  for (const planned of plan) {
155
306
  // A throwing invoke (unresolvable child, host/module failure) still maps
156
307
  // into the EVIDENCE-SYNC-02 contract — fail closed, never a raw exception.
@@ -182,11 +333,25 @@ export async function runRfcEvidenceSync(
182
333
  ...(report.summary ? { summary: report.summary } : {}),
183
334
  };
184
335
  steps.push(stepResult);
336
+ if (planned.step === EVIDENCE_SYNC_EMIT_STEP) emitReport = report;
185
337
  if (outputFormat === "pretty") {
186
338
  const changed = filesModified.length;
187
339
  logger.info(
188
340
  ` ${planned.step}: ${stepResult.status}${changed > 0 ? ` (${changed} file${changed === 1 ? "" : "s"} changed)` : ""}`,
189
341
  );
342
+ // RFC-1516: a one-line note keeps replayed probes visible — an old
343
+ // pass must never look like a fresh execution in pretty output.
344
+ if (planned.step === EVIDENCE_SYNC_EMIT_STEP && report.exitCode === 0) {
345
+ const emitted = (report.data as { emitted?: Array<{
346
+ reuse?: { reusable?: boolean; reusedFrom?: string };
347
+ heavyProbesReused?: string[];
348
+ }> } | null)?.emitted?.[0];
349
+ if (emitted?.reuse?.reusable === true) {
350
+ logger.info(
351
+ ` ${planned.step}: envelope-reused — ${emitted.heavyProbesReused?.length ?? 0} heavy probe(s) replayed from ${emitted.reuse.reusedFrom}`,
352
+ );
353
+ }
354
+ }
190
355
  }
191
356
 
192
357
  // EVIDENCE-SYNC-02: stop on the first failing step — a partial sync is
@@ -212,10 +377,35 @@ export async function runRfcEvidenceSync(
212
377
  }
213
378
 
214
379
  const changedFiles = [...new Set(steps.flatMap((s) => s.filesModified))];
380
+ // RFC-1516: surface the emit step's freshness-window verdict verbatim —
381
+ // a stamp-sync log shows whether heavy probes re-executed or the
382
+ // committed envelope replayed, never silently.
383
+ const emitStep = steps.find((s) => s.step === EVIDENCE_SYNC_EMIT_STEP);
384
+ const emitData =
385
+ emitStep !== undefined && emitReport !== null
386
+ ? (emitReport.data as {
387
+ emitted?: Array<{
388
+ reuse?: EvidenceReuseVerdict;
389
+ heavyProbesReused?: string[];
390
+ cheapProbesReRun?: string[];
391
+ }>;
392
+ } | null)
393
+ : null;
394
+ const emittedEntry = emitData?.emitted?.[0];
215
395
  return syncResult(
216
396
  "pass",
217
397
  [],
218
- { steps, ...(rfcIdStr ? { rfcId: rfcIdStr } : {}) },
398
+ {
399
+ steps,
400
+ ...(rfcIdStr ? { rfcId: rfcIdStr } : {}),
401
+ ...(emittedEntry?.reuse ? { reuse: emittedEntry.reuse } : {}),
402
+ ...(emittedEntry?.heavyProbesReused?.length
403
+ ? { heavyProbesReused: emittedEntry.heavyProbesReused }
404
+ : {}),
405
+ ...(emittedEntry?.cheapProbesReRun?.length
406
+ ? { cheapProbesReRun: emittedEntry.cheapProbesReRun }
407
+ : {}),
408
+ },
219
409
  `rfc.evidence.sync: ${steps.length} steps clean, ${changedFiles.length} file${changedFiles.length === 1 ? "" : "s"} changed`,
220
410
  );
221
411
  }
@@ -106,7 +106,8 @@ describe("rfc.index.generate — RFC-1364 concurrent-write robustness", () => {
106
106
  const result = await runRfcIndexGenerate(makeInput({ write: true }), makeContext(tmpDir));
107
107
  const data = result.data as { status: string; written?: string; count: number };
108
108
  expect(data.status).toBe("ok");
109
- expect(data.written).toBe(path.join("docs", "rfcs", "index.yaml"));
109
+ // `written` is a repo-relative logical path — forward slashes on all platforms.
110
+ expect(data.written).toBe("docs/rfcs/index.yaml");
110
111
  expect(data.count).toBe(2);
111
112
  const index = await fs.readFile(path.join(rfcDir, "index.yaml"), "utf-8");
112
113
  expect(index).toContain("RFC-0002");
@@ -15,6 +15,7 @@ repo because the committed-report index reads `git ls-tree`/`git show`.
15
15
  <item>RFC-1454: V-49 deviation-provenance validation tests.</item>
16
16
  <item>RFC-1454: review deviations recorded in the RFC — IMP-15 gate, V-49 provenance, skill contract</item>
17
17
  <item>RFC-1485: sweep compass headers — forge-os-rfc</item>
18
+ <item>RFC-1513: run-scoped committed-review index evidence (AC-1)</item>
18
19
  </CHANGE_SUMMARY>
19
20
  */
20
21
 
@@ -24,6 +25,7 @@ import { mkdtemp, mkdir, writeFile } from "node:fs/promises";
24
25
  import { join } from "node:path";
25
26
  import { tmpdir } from "node:os";
26
27
  import { validateSingleRfc, type AddViolationFn } from "./validate-rules.ts";
28
+ import type { CommittedReview } from "./implement-stamp-deviations.ts";
27
29
  import type { ParsedRfc } from "../frontmatter-io.ts";
28
30
 
29
31
  interface Seen {
@@ -135,3 +137,74 @@ describe("V-49 — deviations provenance resolves to committed reviews (AC-4)",
135
137
  expect(seen.filter((v) => v.rule === "V-49")).toHaveLength(0);
136
138
  });
137
139
  });
140
+
141
+ describe("RFC-1513 — run-scoped committed-review index (AC-1)", () => {
142
+ const runValidateWithIndex = async (
143
+ workspaceRoot: string,
144
+ body: string,
145
+ committedReviews: () => Promise<CommittedReview[]>,
146
+ ): Promise<Seen[]> => {
147
+ const seen: Seen[] = [];
148
+ const add: AddViolationFn = (_id, _file, rule, msg, severity) =>
149
+ void seen.push({ rule, severity, message: msg });
150
+ const parsed = makeParsed(body);
151
+ await validateSingleRfc(
152
+ "rfc-9999-test.md",
153
+ parsed,
154
+ new Map(),
155
+ new Map(),
156
+ new Set(),
157
+ new Set(),
158
+ new Set(Object.keys(parsed.frontmatter)),
159
+ workspaceRoot,
160
+ add,
161
+ undefined,
162
+ undefined,
163
+ committedReviews,
164
+ );
165
+ return seen;
166
+ };
167
+
168
+ test("the shared getter builds the index at most once across deviation-carrying RFCs", async () => {
169
+ // The injected index names a review the real repo does not carry —
170
+ // a per-RFC collection would report dangling provenance, so a clean
171
+ // V-49 proves the getter (not execGitLog) answered. `builds` counts
172
+ // index constructions behind the memoized promise.
173
+ const dir = await makeWorkspace({
174
+ "docs/reviews/code/r1.md": REVIEW("REVIEW-1"),
175
+ });
176
+ let builds = 0;
177
+ let promise: Promise<CommittedReview[]> | undefined;
178
+ const committedReviews = () => {
179
+ promise ??= (async () => {
180
+ builds++;
181
+ return [
182
+ {
183
+ path: "docs/reviews/code/x.md",
184
+ reviewId: "REVIEW-IDX",
185
+ deviations: [],
186
+ },
187
+ ];
188
+ })();
189
+ return promise;
190
+ };
191
+ const body = DEVIATIONS("- DEV-1 (review REVIEW-IDX): changed.");
192
+ const first = await runValidateWithIndex(dir, body, committedReviews);
193
+ const second = await runValidateWithIndex(dir, body, committedReviews);
194
+ expect(builds, "one index build serves every deviation-carrying RFC").toBe(1);
195
+ expect(first.filter((v) => v.rule === "V-49")).toHaveLength(0);
196
+ expect(second.filter((v) => v.rule === "V-49")).toHaveLength(0);
197
+ });
198
+
199
+ test("the getter stays un-consumed for an RFC without ## Deviations entries", async () => {
200
+ const dir = await makeWorkspace({});
201
+ let invoked = 0;
202
+ const committedReviews = async () => {
203
+ invoked++;
204
+ return [];
205
+ };
206
+ const seen = await runValidateWithIndex(dir, "# RFC-9999: Test RFC\n\nplain body\n", committedReviews);
207
+ expect(invoked).toBe(0);
208
+ expect(seen.filter((v) => v.rule === "V-49")).toHaveLength(0);
209
+ });
210
+ });
@@ -6,14 +6,21 @@
6
6
  </non-goals>
7
7
  </MODULE_CONTRACT>
8
8
  <CHANGE_SUMMARY>
9
- <item>RFC-1453: executed outcome probes, IMP-14 surface gate, outcome.serve + V-47/V-48</item>
10
9
  <item>RFC-1455: fixed inputs bound to outcome probes — V-50/V-51 + skills</item>
10
+ <item>RFC-1534: V-PROBE-META-01 metachar lint — warning on unescaped parens and `**` + slash glob shapes in file-contains/test probe patterns at authoring statuses; `probe-meta: intentional` comment suppresses per-pattern via raw frontmatterSource scan.</item>
11
11
  <item>RFC-1454: review deviations recorded in the RFC — IMP-15 gate, V-49 provenance, skill contract</item>
12
12
  <item>RFC-1467: block rfc.create on terminal-kind near-duplicates until --revisit acknowledges + V-52 validate mirror</item>
13
13
  <item>RFC-1489: batch test probes through one instrumented Vitest run + frontmatter corpus reads
14
14
 
15
15
  runProbeSet is the single shared execution point: barrier-free segments of test probes sharing one effective bound run in one vitest --reporter=json --outputFile process with per-(file,testName) attribution; missing files/reports yield unverified. run/page/proof and all non-test kinds are barriers. --no-batch escapes to the legacy path on acceptance.run, verification.emit and verification.refresh. rfc.validate reads non-target corpus files frontmatter-only via readRfcFrontmatter (64 KiB bound, full-parse fallback); emit/refresh/acceptance corpus scans use the same accessor. Corpus map slimmed to RfcCorpusEntry {fileName, frontmatter}.</item>
16
- <history>RFC-0303, RFC-0722, RFC-0755, RFC-0795, RFC-0997, RFC-1006, RFC-1097, RFC-1271, RFC-1322, RFC-1330, RFC-1334, RFC-1336, RFC-1391</history>
16
+ <item>RFC-1513: steps 2-4 — batched committed-review reads + run-scoped index
17
+
18
+ OriginGit gains optional showMany backed by one git cat-file --batch
19
+ process (per-spec null on missing objects, wholesale null on spawn or
20
+ framing failure). collectCommittedReviews prefers it and keeps the
21
+ sequential show loop for stubs. rfc.validate memoizes the index once
22
+ per run and V-49 consumes it — identical diagnostics, one batched read.</item>
23
+ <history>RFC-0303, RFC-0722, RFC-0755, RFC-0795, RFC-0997, RFC-1006, RFC-1097, RFC-1271, RFC-1322, RFC-1330, RFC-1334, RFC-1336, RFC-1391, RFC-1453</history>
17
24
  </CHANGE_SUMMARY>
18
25
  */
19
26
 
@@ -60,7 +67,11 @@ import { isPresenceProbe } from "../verification-origin.ts";
60
67
  import { loadForgeConfig } from "../../../src/config/forge-config.ts";
61
68
  import { runProbeMatchesOutcomeBuild } from "./implement-stamp-outcome.ts";
62
69
  import { evaluateFixedInputs } from "./fixed-inputs.ts";
63
- import { collectCommittedReviews, parseDeviationsSection } from "./implement-stamp-deviations.ts";
70
+ import {
71
+ collectCommittedReviews,
72
+ parseDeviationsSection,
73
+ type CommittedReview,
74
+ } from "./implement-stamp-deviations.ts";
64
75
  import { DNA_DOCS, AP_DOCS } from "./shared.ts";
65
76
 
66
77
  // Ambient default for helper fns without a context param — handlers override
@@ -522,6 +533,69 @@ export function collectMarkers(body: string, status: string, createdAt: string):
522
533
  return markers;
523
534
  }
524
535
 
536
+ // ─── RFC-1534: probe-pattern metachar lint (V-PROBE-META-01) ────────────────
537
+
538
+ export interface ProbeMetaHit {
539
+ criterion: string;
540
+ probe: "file-contains" | "test";
541
+ pattern: string;
542
+ chars: string[];
543
+ suggestion: string;
544
+ }
545
+
546
+ const PROBE_META_MARKER = "probe-meta: intentional";
547
+
548
+ /**
549
+ * Scans file-contains/test probe patterns for regexp-trap characters —
550
+ * patterns execute via `new RegExp(...)`, so an unescaped `(` or `)` groups
551
+ * instead of matching literally and a `**` + slash glob shape is a
552
+ * nested-quantifier error. A `# <!-- probe-meta: intentional -->` comment on the `pattern:` line
553
+ * (or the line directly above it) in the frontmatter suppresses the warning
554
+ * for that pattern only; YAML drops comments at parse time, so the marker is
555
+ * located in the raw frontmatter source.
556
+ */
557
+ export function collectProbeMetacharHits(
558
+ acceptance: unknown,
559
+ frontmatterSource: string,
560
+ ): ProbeMetaHit[] {
561
+ const probes = Array.isArray(acceptance) ? (acceptance as AcceptanceProbe[]) : [];
562
+ const fmLines = frontmatterSource.split("\n");
563
+ const suppressed = (field: string, value: string): boolean => {
564
+ for (let i = 0; i < fmLines.length; i++) {
565
+ const line = fmLines[i]!;
566
+ if (!line.includes(`${field}:`) || !line.includes(value)) continue;
567
+ return (
568
+ line.includes(PROBE_META_MARKER) || (fmLines[i - 1] ?? "").includes(PROBE_META_MARKER)
569
+ );
570
+ }
571
+ return false;
572
+ };
573
+ const hits: ProbeMetaHit[] = [];
574
+ for (const probe of probes) {
575
+ const kind = probe.probe;
576
+ if (kind !== "file-contains" && kind !== "test") continue;
577
+ // file-contains runs `new RegExp(pattern)`; test passes testName to
578
+ // `vitest -t` — a regexp filter on both paths.
579
+ const field = kind === "test" ? "testName" : "pattern";
580
+ const raw = (probe as unknown as Record<string, unknown>)[field];
581
+ const pattern = typeof raw === "string" ? raw : "";
582
+ if (!pattern) continue;
583
+ const chars: string[] = [];
584
+ if (/(^|[^\\])\(/.test(pattern)) chars.push("unescaped `(`");
585
+ if (/(^|[^\\])\)/.test(pattern)) chars.push("unescaped `)`");
586
+ if (pattern.includes("**/")) chars.push("`**/` glob shape");
587
+ if (chars.length === 0 || suppressed(field, pattern)) continue;
588
+ hits.push({
589
+ criterion: typeof probe.criterion === "string" ? probe.criterion : "?",
590
+ probe: kind,
591
+ pattern,
592
+ chars,
593
+ suggestion: pattern.replace(/\*\*\//g, "(?:.*/)?").replace(/([()])/g, "\\$1"),
594
+ });
595
+ }
596
+ return hits;
597
+ }
598
+
525
599
  export async function validateSingleRfc(
526
600
  fileName: string,
527
601
  parsed: ParsedRfc,
@@ -535,6 +609,8 @@ export async function validateSingleRfc(
535
609
  seenFilenameNumbers?: Map<number, string>,
536
610
  /** RFC-1467: memoized decision-log getter shared across drafts (V-52). */
537
611
  decisionLog?: () => Promise<DecisionLogEntry[]>,
612
+ /** RFC-1513: memoized committed-review index shared across RFCs (V-49). */
613
+ committedReviews?: () => Promise<CommittedReview[]>,
538
614
  ): Promise<Marker[]> {
539
615
  const fm = parsed.frontmatter;
540
616
  const body = parsed.body;
@@ -917,6 +993,24 @@ export async function validateSingleRfc(
917
993
  }
918
994
  }
919
995
 
996
+ // V-PROBE-META-01 (RFC-1534): regexp-trap metachar lint — warning at
997
+ // authoring statuses (draft/reviewing/accepted), never a blocking error;
998
+ // terminal statuses are archival and stay silent.
999
+ if (status === "draft" || status === "reviewing" || status === "accepted") {
1000
+ for (const hit of collectProbeMetacharHits(
1001
+ fm["acceptance"],
1002
+ parsed.frontmatterSource ?? "",
1003
+ )) {
1004
+ addViolation(
1005
+ rfcId,
1006
+ relFile,
1007
+ "V-PROBE-META-01",
1008
+ `${hit.criterion} ${hit.probe} pattern "${hit.pattern}" carries ${hit.chars.join(", ")} — probe patterns execute via new RegExp, so these characters group/glob instead of matching literally. Escape or rewrite (e.g. "${hit.suggestion}"); an intentional regexp takes a # <!-- probe-meta: intentional --> comment on the pattern line or the line above.`,
1009
+ "warning",
1010
+ );
1011
+ }
1012
+ }
1013
+
920
1014
  // V-38..V-42: criteria content rules (RFC-1006, post-cutoff only)
921
1015
  const isCriteriaPostCutoff = createdAt >= RFC_CRITERIA_CONTENT_CUTOFF && !isArchived;
922
1016
  if (isCriteriaPostCutoff) {
@@ -1191,10 +1285,12 @@ export async function validateSingleRfc(
1191
1285
  } catch {
1192
1286
  // forge.yaml unreadable → no committed-report index → entries dangle.
1193
1287
  }
1194
- const reviews = await collectCommittedReviews(
1195
- { run: (args) => execGitLog(workspaceRoot, args) },
1196
- reviewsDir,
1197
- );
1288
+ const reviews = committedReviews
1289
+ ? await committedReviews()
1290
+ : await collectCommittedReviews(
1291
+ { run: (args) => execGitLog(workspaceRoot, args) },
1292
+ reviewsDir,
1293
+ );
1198
1294
  const known = new Set(reviews.map((r) => r.reviewId));
1199
1295
  for (const entry of entries) {
1200
1296
  if (!known.has(entry.reviewId)) {
@@ -6,9 +6,6 @@
6
6
  </non-goals>
7
7
  </MODULE_CONTRACT>
8
8
  <CHANGE_SUMMARY>
9
- <item>RFC-1097: step 6 — compass.migrate codemod run
10
-
11
- Mechanical v1 to v2 header migration across the workspace: 942 files rewritten — CHANGE_SUMMARY windows collapsed into history, forbidden v1 blocks stripped, KEY_DECISIONS seeded from @ai-invariant comments (5 files) or TODO placeholders (103 files), blocks reordered to canonical order.</item>
12
9
  <item>RFC-1097: sweep — werkstatt-engine clean
13
10
 
14
11
  Sweep batch 4: 73 Compass headers on headerless engine files (certification, component-runtime, isolation, evolution, testing), real KEY_DECISIONS on 75 files (kernel, cache, dht, swim, gitmesh, runtime), ~80 purpose expansions (CONTRACT-02/PURPOSE-02), non-goals on 13 CONTRACT-03 files, CS-07 history literal fix repo-wide (253 files). Policy: .template.ts/.template.astro excludedPaths. werkstatt-engine now 0 diagnostics.</item>
@@ -17,13 +14,22 @@ Sweep batch 4: 73 Compass headers on headerless engine files (certification, com
17
14
  <item>RFC-1489: batch test probes through one instrumented Vitest run + frontmatter corpus reads
18
15
 
19
16
  runProbeSet is the single shared execution point: barrier-free segments of test probes sharing one effective bound run in one vitest --reporter=json --outputFile process with per-(file,testName) attribution; missing files/reports yield unverified. run/page/proof and all non-test kinds are barriers. --no-batch escapes to the legacy path on acceptance.run, verification.emit and verification.refresh. rfc.validate reads non-target corpus files frontmatter-only via readRfcFrontmatter (64 KiB bound, full-parse fallback); emit/refresh/acceptance corpus scans use the same accessor. Corpus map slimmed to RfcCorpusEntry {fileName, frontmatter}.</item>
20
- <history>RFC-0303</history>
17
+ <item>RFC-1534: --fix scoped to V-19 amends/amendedBy asymmetries — re-applies the line-level counterpart merge, then drops repaired violations.</item>
18
+ <item>RFC-1513: steps 2-4 — batched committed-review reads + run-scoped index
19
+
20
+ OriginGit gains optional showMany backed by one git cat-file --batch
21
+ process (per-spec null on missing objects, wholesale null on spawn or
22
+ framing failure). collectCommittedReviews prefers it and keeps the
23
+ sequential show loop for stubs. rfc.validate memoizes the index once
24
+ per run and V-49 consumes it — identical diagnostics, one batched read.</item>
25
+ <history>RFC-0303, RFC-1097</history>
21
26
  </CHANGE_SUMMARY>
22
27
  */
23
28
 
24
29
  import path from "node:path";
25
30
 
26
31
  import {
32
+ appendRfcFrontmatterListEntry,
27
33
  listRfcFiles,
28
34
  readAndParseRfc,
29
35
  readRfcFrontmatter,
@@ -48,6 +54,9 @@ import { collectRfcCommandLifecycleViolations } from "./lifecycle.ts";
48
54
  import { evaluateAcceptanceCriteria, computeProbeCoverage } from "./validate-rules.ts";
49
55
  import { validateSingleRfc, checkFrontmatterYamlParse } from "./validate-rules.ts";
50
56
  import { collectDecisionLog } from "../decision-log.ts";
57
+ import { collectCommittedReviews } from "./implement-stamp-deviations.ts";
58
+ import { createOriginGit } from "../verification-origin.ts";
59
+ import { loadForgeConfig } from "../../../src/config/forge-config.ts";
51
60
 
52
61
  export async function runRfcValidate(
53
62
  input: ForgeCommandInput,
@@ -130,6 +139,25 @@ export async function runRfcValidate(
130
139
  return decisionLogPromise;
131
140
  };
132
141
 
142
+ // RFC-1513: the committed-review index builds at most once per validate run
143
+ // — the getter memoizes so every `## Deviations`-carrying RFC shares one
144
+ // batched read instead of paying per-file `git show` calls (V-49).
145
+ let committedReviewsPromise:
146
+ | Promise<Awaited<ReturnType<typeof collectCommittedReviews>>>
147
+ | undefined;
148
+ const committedReviews = () => {
149
+ committedReviewsPromise ??= (async () => {
150
+ let reviewsDir: string | null = null;
151
+ try {
152
+ reviewsDir = loadForgeConfig(workspaceRoot).bindings?.paths?.reviewsDir ?? null;
153
+ } catch {
154
+ // forge.yaml unreadable → no committed-report index → entries dangle.
155
+ }
156
+ return collectCommittedReviews(createOriginGit(workspaceRoot), reviewsDir);
157
+ })();
158
+ return committedReviewsPromise;
159
+ };
160
+
133
161
  for (const fileName of filesToValidate) {
134
162
  const result = allParsedByFile.get(fileName);
135
163
  if (!result) continue;
@@ -146,6 +174,7 @@ export async function runRfcValidate(
146
174
  addViolation,
147
175
  seenFilenameNumbers,
148
176
  decisionLog,
177
+ committedReviews,
149
178
  );
150
179
  allMarkers.push(...markers);
151
180
 
@@ -176,6 +205,40 @@ export async function runRfcValidate(
176
205
  );
177
206
  }
178
207
 
208
+ // RFC-1534: --fix is scoped to the V-19 amends/amendedBy counterpart only —
209
+ // it re-applies the same line-level merge rfc.create --amends performs, then
210
+ // drops the repaired violations so the run reflects the post-fix state.
211
+ const fix = input.flags["fix"] === true;
212
+ const fixes: Array<{ file: string; key: string; added: string[] }> = [];
213
+ if (fix) {
214
+ const V19_ASYMMETRY =
215
+ /^(\S+)\.(amends|amendedBy) includes (\S+), but \3\.(amends|amendedBy) does not include \1$/;
216
+ const repaired = new Set<RfcValidationViolation>();
217
+ for (const v of violations) {
218
+ if (v.rule !== "V-19") continue;
219
+ const m = v.message.match(V19_ASYMMETRY);
220
+ if (!m) continue;
221
+ const [, fromId, , refId, missingKey] = m;
222
+ const entry = allParsed.get(refId!);
223
+ if (!entry) continue;
224
+ const wrote = await appendRfcFrontmatterListEntry(
225
+ path.join(rfcDirPath, entry.fileName),
226
+ missingKey!,
227
+ [fromId!],
228
+ );
229
+ if (wrote) {
230
+ repaired.add(v);
231
+ fixes.push({ file: `${RFC_DIR}/${entry.fileName}`, key: missingKey!, added: wrote.added });
232
+ }
233
+ }
234
+ for (const v of repaired) violations.splice(violations.indexOf(v), 1);
235
+ if (outputFormat === "pretty") {
236
+ for (const f of fixes) {
237
+ logger.info(`rfc.validate fix: merged ${f.added.join(", ")} into ${f.key} of ${f.file}`);
238
+ }
239
+ }
240
+ }
241
+
179
242
  const hasErrors = violations.some((v) => v.severity === "error");
180
243
  const resultStatus = hasErrors ? "fail" : "pass";
181
244
 
@@ -212,6 +275,7 @@ export async function runRfcValidate(
212
275
  violations,
213
276
  markers: allMarkers,
214
277
  coverage: coverage.length > 0 ? coverage : undefined,
278
+ ...(fixes.length > 0 ? { fixes } : {}),
215
279
  },
216
280
  exitCode: hasErrors ? 1 : 0,
217
281
  summary: hasErrors