@warpgogol/forge 9.3.1 → 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 (467) hide show
  1. package/AGENTS.md +32 -0
  2. package/CHANGELOG.md +25 -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 +8 -2
  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 +13 -2
  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 +5 -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/skills/fo/fo-doctor/SKILL.md +151 -0
  427. package/skills/fo/fo-handoff/SKILL.md +22 -0
  428. package/skills/fo/fo-idea-create-rfc/acceptance-criteria-standard.md +2 -1
  429. package/skills/fo/fo-idea-implement/SKILL.md +5 -2
  430. package/skills/fo/fo-idea-plan/SKILL.md +5 -5
  431. package/skills/fo/fo-session-retro/SKILL.md +37 -11
  432. package/skills/fo/fo-spec-ingest/SKILL.md +8 -0
  433. package/skills/fo/fo-system-dispatch/SKILL.md +1 -0
  434. package/skills/meta/skill-create/SKILL.md +2 -1
  435. package/src/bin-entry.test.ts +3 -1
  436. package/src/config/forge-config.ts +57 -13
  437. package/src/conformance/index.ts +46 -1
  438. package/src/formal/proof-runner.ts +10 -2
  439. package/src/migration-adapters/node-typescript-pnpm/index.ts +3 -1
  440. package/src/migration-adapters/phaser-pnpm/index.ts +3 -1
  441. package/src/onboarding/agents-generate.ts +4 -4
  442. package/src/onboarding/nested-agents-generate.ts +3 -1
  443. package/src/onboarding/scaffold-project.ts +2 -2
  444. package/src/onboarding/upgrade.ts +13 -2
  445. package/src/onboarding/workspace-discovery.ts +3 -1
  446. package/src/pipeline-status.test.ts +1 -1
  447. package/src/skill-schema.ts +9 -2
  448. package/src/spec/resolve-spec-source.ts +184 -0
  449. package/src/tests/acceptance-probe-kinds.test.ts +3 -1
  450. package/src/tests/agents-generate-domain.test.ts +3 -2
  451. package/src/tests/agents-generate.test.ts +2 -1
  452. package/src/tests/create-flow.test.ts +3 -1
  453. package/src/tests/create.test.ts +12 -2
  454. package/src/tests/editable-generated-region.test.ts +2 -2
  455. package/src/tests/fixtures/agents-generate-business-before.txt +2 -0
  456. package/src/tests/implement-stamp.test.ts +5 -2
  457. package/src/tests/rfc-implement-stamp-governance.test.ts +6 -2
  458. package/src/tests/rfc-verification-verdict-ingest.test.ts +5 -1
  459. package/src/tests/scaffold-project.test.ts +3 -1
  460. package/src/tests/upgrade.test.ts +79 -3
  461. package/src/tests/workspace-discovery.test.ts +4 -3
  462. package/src/utils/command-inventory.ts +105 -0
  463. package/src/utils/io.ts +6 -1
  464. package/src/utils/repo-path.ts +49 -0
  465. package/src/utils/spawn.ts +88 -0
  466. package/src/tests/rfc-evidence-sync.test.ts +0 -369
  467. package/src/tests/skill-agents-sync.test.ts +0 -192
@@ -10,11 +10,13 @@ Unit tests for lifecycle covering RFC-CMD-02/03 cutoff behavior. It also guards
10
10
  <CHANGE_SUMMARY>
11
11
  <item>RFC-1311: Compass header sweep — declares the lifecycle suite's contract for test-file scaffold coverage.</item>
12
12
  <item>RFC-1482: emit validation-compliant RFC skeletons and surface contract breaches at authoring time</item>
13
+ <item>RFC-1534: lint probe patterns, sync amends counterparts, name next free ledger id</item>
13
14
  </CHANGE_SUMMARY>
14
15
  */
15
16
 
16
17
  import { test, expect, describe } from "vitest";
17
18
  import { collectRfcCommandLifecycleViolations } from "./lifecycle.ts";
19
+ import { validateSingleRfc } from "./validate-rules.ts";
18
20
  import type { ParsedRfc } from "../frontmatter-io.ts";
19
21
  import type { CommandRegistry } from "../../../src/types.ts";
20
22
  import { tmpdir } from "node:os";
@@ -197,3 +199,137 @@ describe("RFC-1482 RFC-CMD-03 early warning on commands.changed", () => {
197
199
  expect(cmd03).toHaveLength(0);
198
200
  });
199
201
  });
202
+
203
+ // RFC-1534: V-PROBE-META-01 — warning on regexp-trap metacharacters in
204
+ // file-contains/test probe patterns at authoring statuses; a
205
+ // `probe-meta: intentional` comment on (or directly above) the pattern line
206
+ // in the frontmatter suppresses it per-pattern.
207
+ describe("RFC-1534 V-PROBE-META-01 probe-pattern lint", () => {
208
+ const KNOWN_KEYS = new Set([
209
+ "id", "title", "status", "kind", "scope", "owners", "createdAt", "updatedAt",
210
+ "acceptance", "commands", "satisfies", "related", "amends", "amendedBy",
211
+ "supersedes", "supersededBy", "reviewers", "enhancedAt", "implementedAt",
212
+ "closedAt", "specRef", "versionBump", "appsImpacted", "packagesImpacted",
213
+ "successSignals", "nonGoals", "verificationTier",
214
+ ]);
215
+
216
+ const lintParsed = (
217
+ status: string,
218
+ acceptance: unknown[],
219
+ frontmatterSource = "",
220
+ ): ParsedRfc => ({
221
+ frontmatter: {
222
+ id: "RFC-9999",
223
+ title: "Test RFC",
224
+ status,
225
+ kind: "policy",
226
+ scope: "workspace",
227
+ owners: ["architecture"],
228
+ createdAt: "2026-01-01",
229
+ updatedAt: "2026-01-01",
230
+ commands: {},
231
+ acceptance,
232
+ },
233
+ body: "",
234
+ frontmatterSource,
235
+ });
236
+
237
+ const runLint = async (parsed: ParsedRfc) => {
238
+ const violations: Array<{ rule: string; message: string; severity?: string }> = [];
239
+ await validateSingleRfc(
240
+ "rfc-9999-test.md",
241
+ parsed,
242
+ new Map([
243
+ ["RFC-9999", { fileName: "rfc-9999-test.md", frontmatter: parsed.frontmatter }],
244
+ ]),
245
+ new Map(),
246
+ new Set<number>(),
247
+ new Set<number>(),
248
+ KNOWN_KEYS,
249
+ testWorkspaceRoot,
250
+ (_rfcId, _file, rule, message, severity) => {
251
+ violations.push({ rule, message, severity });
252
+ },
253
+ );
254
+ return violations.filter((v) => v.rule === "V-PROBE-META-01");
255
+ };
256
+
257
+ test("AC-1: glob-shape + unescaped parens warn with criterion, chars, and a rewritten suggestion", async () => {
258
+ const hits = await runLint(
259
+ lintParsed("draft", [
260
+ { probe: "file-contains", criterion: "AC-2", path: "x.ts", pattern: "**/manifest-debt-zero.test.ts" },
261
+ { probe: "test", criterion: "AC-3", file: "t.ts", testName: "skipped: dependency-failed (WT-GATE-02)", expect: { exitCode: 0 } },
262
+ ]),
263
+ );
264
+ expect(hits).toHaveLength(2);
265
+ expect(hits[0]!.message).toContain("AC-2");
266
+ expect(hits[0]!.message).toContain("**");
267
+ expect(hits[1]!.message).toContain("AC-3");
268
+ expect(hits[1]!.message).toContain("`(`");
269
+ expect(hits[1]!.message).toContain("\\(WT-GATE-02\\)");
270
+ expect(hits.every((h) => h.severity === "warning")).toBe(true);
271
+ });
272
+
273
+ test("clean patterns stay silent — escaped parens and plain literals", async () => {
274
+ const hits = await runLint(
275
+ lintParsed("draft", [
276
+ { probe: "file-contains", criterion: "AC-1", path: "x.ts", pattern: "chore\\(flow\\): sweep session leftovers" },
277
+ ]),
278
+ );
279
+ expect(hits).toHaveLength(0);
280
+ });
281
+
282
+ test("AC-4: probe-meta: intentional marker suppresses only the marked pattern", async () => {
283
+ const fm = [
284
+ "acceptance:",
285
+ " - probe: file-contains",
286
+ " criterion: AC-1",
287
+ " path: x.ts",
288
+ " # <!-- probe-meta: intentional -->",
289
+ ' pattern: "^## (Decisions|Findings)$"',
290
+ " - probe: file-contains",
291
+ " criterion: AC-2",
292
+ " path: y.ts",
293
+ ' pattern: "unescaped (paren)"',
294
+ ].join("\n");
295
+ const hits = await runLint(
296
+ lintParsed("draft", [
297
+ { probe: "file-contains", criterion: "AC-1", path: "x.ts", pattern: "^## (Decisions|Findings)$" },
298
+ { probe: "file-contains", criterion: "AC-2", path: "y.ts", pattern: "unescaped (paren)" },
299
+ ], fm),
300
+ );
301
+ expect(hits).toHaveLength(1);
302
+ expect(hits[0]!.message).toContain("AC-2");
303
+ });
304
+
305
+ test("marker on the same line suppresses; implemented status is silent", async () => {
306
+ const fm = [
307
+ "acceptance:",
308
+ " - probe: file-contains",
309
+ " criterion: AC-1",
310
+ " path: x.ts",
311
+ ' pattern: "unescaped (paren)" # <!-- probe-meta: intentional -->',
312
+ ].join("\n");
313
+ const marked = await runLint(
314
+ lintParsed("draft", [
315
+ { probe: "file-contains", criterion: "AC-1", path: "x.ts", pattern: "unescaped (paren)" },
316
+ ], fm),
317
+ );
318
+ expect(marked).toHaveLength(0);
319
+ const terminal = await runLint(
320
+ lintParsed("implemented", [
321
+ { probe: "file-contains", criterion: "AC-1", path: "x.ts", pattern: "unescaped (paren)" },
322
+ ]),
323
+ );
324
+ expect(terminal).toHaveLength(0);
325
+ });
326
+
327
+ test("accepted status still warns (authoring surface)", async () => {
328
+ const hits = await runLint(
329
+ lintParsed("accepted", [
330
+ { probe: "file-contains", criterion: "AC-1", path: "x.ts", pattern: "unescaped (paren)" },
331
+ ]),
332
+ );
333
+ expect(hits).toHaveLength(1);
334
+ });
335
+ });
@@ -14,6 +14,8 @@ with candidates listed.
14
14
  <CHANGE_SUMMARY>
15
15
  <item>RFC-1485: sweep compass headers — forge-os-rfc</item>
16
16
  <item>RFC-1482: extract-safe RFC-1482 template path + changelog for 9.1.0</item>
17
+ <item>RFC-1514: attach corrected invocations to blocking diagnostics so retry is one-shot</item>
18
+ <item>RFC-1534: lint probe patterns, sync amends counterparts, name next free ledger id</item>
17
19
  </CHANGE_SUMMARY>
18
20
  */
19
21
 
@@ -113,6 +115,20 @@ describe("RFC-1467 rfc.create near-duplicate gate", () => {
113
115
  expect(Array.isArray(result.data?.consultedDecisions)).toBe(true);
114
116
  });
115
117
 
118
+ test("RFC-1514 AC-4: the refusal names score and matched title/text tokens", async () => {
119
+ const result = await runRfcCreate({ flags: flags() } as never, context());
120
+ expect(result.exitCode).toBe(1);
121
+ const hit = result.data?.colliding?.[0];
122
+ expect(hit?.score).toBeGreaterThanOrEqual(12);
123
+ // The proposed title is verbatim the rejected one — every title token hit.
124
+ expect(hit?.matchedTitleTokens).toContain("isolate");
125
+ expect(hit?.matchedTitleTokens).toContain("sessions");
126
+ expect(hit?.matchedTextTokens?.length).toBeGreaterThan(0);
127
+ // The remedy text carries the same attribution, not just the JSON payload.
128
+ expect(result.data?.remedy).toContain(`score ${hit!.score}`);
129
+ expect(result.data?.remedy).toContain("isolate");
130
+ });
131
+
116
132
  test("AC-3: --revisit scaffolds with related + NEEDS CLARIFICATION marker", async () => {
117
133
  const result = await runRfcCreate(
118
134
  { flags: flags({ revisit: "RFC-1312" }) } as never,
@@ -221,3 +237,69 @@ describe("RFC-1482 validation-compliant skeleton", () => {
221
237
  expect(body).not.toMatch(/^acceptance:/m);
222
238
  });
223
239
  });
240
+
241
+ // RFC-1534: --amends writes the amendedBy counterpart on the amended file in
242
+ // the same pass — the merge is by frontmatter key and never clobbers existing
243
+ // entries (F-0056).
244
+ const AMENDED_BODY = `---
245
+ id: RFC-1200
246
+ title: "Amended predecessor"
247
+ status: implemented
248
+ kind: architecture
249
+ scope: workspace
250
+ owners: [architecture]
251
+ createdAt: 2026-01-01
252
+ updatedAt: 2026-01-01
253
+ amends: []
254
+ amendedBy:
255
+ - RFC-1100
256
+ related: []
257
+ ---
258
+
259
+ # RFC-1200: Amended predecessor
260
+ `;
261
+
262
+ describe("RFC-1534 rfc.create --amends counterpart", () => {
263
+ beforeEach(async () => {
264
+ await seedRealTemplate();
265
+ await writeFile(join(root, "docs", "rfcs", "rfc-1200-amended.md"), AMENDED_BODY);
266
+ });
267
+ afterEach(async () => {
268
+ await rm(root, { recursive: true, force: true });
269
+ });
270
+
271
+ test("AC-2: --amends merges the new id into the amended file's amendedBy[] in the same pass", async () => {
272
+ const result = await runRfcCreate(
273
+ { flags: flags({ title: "Tame the registry loader", amends: "RFC-1200" }) } as never,
274
+ context(),
275
+ );
276
+ expect(result.data?.status).toBe("ok");
277
+ const newId = result.data!.id!;
278
+ expect(result.data?.amendsSync).toEqual({ amended: "RFC-1200", wroteCounterpart: true });
279
+
280
+ const draft = await readFile(join(root, result.data!.file!), "utf8");
281
+ expect(draft).toContain(`amends:\n - RFC-1200`);
282
+
283
+ const amended = await readFile(join(root, "docs", "rfcs", "rfc-1200-amended.md"), "utf8");
284
+ expect(amended).toContain(` - ${newId}`);
285
+ });
286
+
287
+ test("merge preserves existing amendedBy[] entries and stays idempotent (F-0056)", async () => {
288
+ const result = await runRfcCreate(
289
+ { flags: flags({ title: "Tame the registry loader", amends: "RFC-1200" }) } as never,
290
+ context(),
291
+ );
292
+ expect(result.data?.status).toBe("ok");
293
+ const amended = await readFile(join(root, "docs", "rfcs", "rfc-1200-amended.md"), "utf8");
294
+ expect(amended).toContain("amendedBy:\n - RFC-1100\n - RFC-");
295
+ });
296
+
297
+ test("--amends on a missing counterpart reports pending, does not fail the create", async () => {
298
+ const result = await runRfcCreate(
299
+ { flags: flags({ title: "Tame the registry loader", amends: "RFC-1201" }) } as never,
300
+ context(),
301
+ );
302
+ expect(result.data?.status).toBe("ok");
303
+ expect(result.data?.amendsSync).toEqual({ amended: "RFC-1201", wroteCounterpart: false });
304
+ });
305
+ });
@@ -6,22 +6,28 @@
6
6
  </non-goals>
7
7
  </MODULE_CONTRACT>
8
8
  <CHANGE_SUMMARY>
9
- <item>RFC-1139: second hint fix (rfc.list empty-state) + read-only test fix</item>
10
- <item>RFC-1364: robust rfc index generation — bounded retry, RFC-IDX-04, atomic writes</item>
11
9
  <item>RFC-1467: block rfc.create on terminal-kind near-duplicates until --revisit acknowledges + V-52 validate mirror</item>
12
10
  <item>RFC-1467: address review r1 findings — object-shaped colliding payload, cite all colliding siblings, reviewBand field, supersede.propose escalation, flag-shape guard</item>
13
11
  <item>RFC-1482: emit validation-compliant RFC skeletons and surface contract breaches at authoring time</item>
14
- <history>RFC-0303, RFC-1097, RFC-1138, RFC-1139</history>
12
+ <item>RFC-1534: --amends flag seeds amends: and merges the draft id into the amended file's amendedBy[] in the same pass (line-level, F-0056); unreadable counterpart downgrades to a pending report.</item>
13
+ <item>RFC-1514: attach corrected invocations to blocking diagnostics so retry is one-shot</item>
14
+ <item>RFC-1536: owning-checkout routing, FLOW-OPEN-01 dirty-primary warning, shared governance-id allocation (RFC+ADR)</item>
15
+ <history>RFC-0303, RFC-1097, RFC-1138, RFC-1139, RFC-1364</history>
15
16
  </CHANGE_SUMMARY>
16
17
  */
17
18
 
18
- import { ambientIo as fs } from "../../../src/utils/io.ts";
19
+ import { ambientIo as fs, resolveIo } from "../../../src/utils/io.ts";
19
20
  import { writeFileSync } from "../../../src/utils/sync-fs.ts";
20
21
  import { writeFileAtomic } from "../../../src/utils/fs-atomic.ts";
21
22
  import { existsSync } from "node:fs";
22
23
  import path from "node:path";
23
24
  import { toKebabCase } from "../../../src/utils/string-utils.ts";
24
- import { listRfcFiles, readAndParseRfc } from "../frontmatter-io.ts";
25
+ import {
26
+ appendRfcFrontmatterListEntry,
27
+ listRfcFiles,
28
+ readAndParseRfc,
29
+ rfcFileMatchesId,
30
+ } from "../frontmatter-io.ts";
25
31
  import type {
26
32
  ForgeCommandInput,
27
33
  ForgeCommandResult,
@@ -38,6 +44,8 @@ import type {
38
44
  } from "../types.ts";
39
45
  import { RFC_DIR, RFC_KINDS, RFC_SCOPES, RFC_METADATA_CUTOFF } from "../types.ts";
40
46
  import { DNA_DOCS, loadInvariantIds, toIsoDate, resolveRfcTemplate } from "./shared.ts";
47
+ import { allocateNextRfcId, appendReservation } from "../next-id.ts";
48
+ import { currentBranch } from "../../flow/git.ts";
41
49
  import {
42
50
  collectDecisionLog,
43
51
  scoreDecisions,
@@ -173,6 +181,15 @@ export async function runRfcCreate(
173
181
  const kind = (input.flags["kind"] as string | undefined) ?? "architecture";
174
182
  const scope = (input.flags["scope"] as string | undefined) ?? "workspace";
175
183
  const satisfies = parseSatisfiesFlag(input.flags["satisfies"]);
184
+ // RFC-1534: --amends RFC-NNNN declares the draft amends an existing RFC —
185
+ // the create pass writes the amendedBy counterpart on the amended file in
186
+ // the same pass so V-19 never sees the asymmetry.
187
+ const amendsRaw = input.flags["amends"];
188
+ const amendsId =
189
+ typeof amendsRaw === "string" ? amendsRaw.trim().toUpperCase() || undefined : undefined;
190
+ if (amendsId !== undefined && !/^RFC-\d{4}$/.test(amendsId)) {
191
+ throw new Error(`rfc.create: --amends must match RFC-NNNN, got "${amendsRaw as string}"`);
192
+ }
176
193
  // RFC-1482: seed commands.proposed/commands.added at authoring time so the
177
194
  // draft's acceptance block can carry reachable-probe stubs (V-45) instead of
178
195
  // discovering the breach on the first validate cycle.
@@ -252,6 +269,16 @@ export async function runRfcCreate(
252
269
  scoredAll.filter((d) => TERMINAL_KINDS.has(d.kind) && d.score >= REPROPOSED_SCORE),
253
270
  );
254
271
  const collidingIds = colliding.map((d) => d.rfcId);
272
+ // RFC-1514: one-shot correction evidence — the refusal names each
273
+ // precedent's score and which title/text tokens of the proposed title
274
+ // drove it, in pretty text and the machine-readable `colliding[]`.
275
+ const collidingDetail = (entries: ConsultedDecision[]): string =>
276
+ entries
277
+ .map(
278
+ (d) =>
279
+ `${d.rfcId} (score ${d.score}; title tokens: ${d.matchedTitleTokens.join(", ") || "—"}; text tokens: ${d.matchedTextTokens.join(", ") || "—"})`,
280
+ )
281
+ .join("; ");
255
282
  const reviewBand = byId(
256
283
  scoredAll.filter(
257
284
  (d) =>
@@ -267,6 +294,7 @@ export async function runRfcCreate(
267
294
  : "No terminal-kind precedent collides with this title — drop --revisit and scaffold normally.";
268
295
  if (outputFormat === "pretty") {
269
296
  logger.error(`rfc.create refused: ${remedy}`);
297
+ if (colliding.length > 0) logger.error(`collisions: ${collidingDetail(colliding)}`);
270
298
  }
271
299
  return {
272
300
  data: {
@@ -287,10 +315,11 @@ export async function runRfcCreate(
287
315
  `Re-run with --revisit ${collidingIds[0]} to acknowledge the precedent — the scaffold will cite it ` +
288
316
  `in related with a NEEDS CLARIFICATION marker and the draft's Decision must state why it differs ` +
289
317
  `from the rejection/supersession rationale. If this is genuinely different work, sharpen the title ` +
290
- `so it no longer collides at the reproposal threshold (score ≥ ${REPROPOSED_SCORE}).`;
318
+ `so it no longer collides at the reproposal threshold (score ≥ ${REPROPOSED_SCORE}). ` +
319
+ `Collisions: ${collidingDetail(colliding)}`;
291
320
  if (outputFormat === "pretty") {
292
321
  logger.error(
293
- `rfc.create blocked: ${collidingIds.length} terminal precedent(s) collide — ${collidingIds.join(", ")}`,
322
+ `rfc.create blocked: ${collidingIds.length} terminal precedent(s) collide — ${collidingDetail(colliding)}`,
294
323
  );
295
324
  logger.error(remedy);
296
325
  }
@@ -325,6 +354,7 @@ export async function runRfcCreate(
325
354
  let nextId = "";
326
355
  let relativeFile = "";
327
356
  let allocated = false;
357
+ let amendsSync: { amended: string; wroteCounterpart: boolean } | undefined;
328
358
 
329
359
  const files = await listRfcFiles(rfcDirPath);
330
360
  let maxId = 0;
@@ -336,7 +366,15 @@ export async function runRfcCreate(
336
366
  if (num > maxId) maxId = num;
337
367
  }
338
368
  }
339
- let candidate = maxId + 1;
369
+ // RFC-1536: seed from the shared surfaces — the worktree-local scan alone
370
+ // lags develop and every sibling session's reservations.
371
+ const io = resolveIo(context.io);
372
+ const allocation = await allocateNextRfcId(io, workspaceRoot, maxId);
373
+ let candidate = allocation.id;
374
+ const idSource = allocation.source;
375
+ for (const warning of allocation.warnings) {
376
+ if (outputFormat === "pretty") logger.warn(`rfc.create: ${warning}`);
377
+ }
340
378
 
341
379
  for (let attempt = 1; attempt <= MAX_CREATE_ATTEMPTS; attempt++) {
342
380
  const paddedNum = String(candidate).padStart(4, "0");
@@ -376,6 +414,9 @@ export async function runRfcCreate(
376
414
  `satisfies:\n${satisfies.map((id) => ` - ${id}`).join("\n")}`,
377
415
  );
378
416
  }
417
+ if (amendsId) {
418
+ content = content.replace(/^amends: \[\]$/m, `amends:\n - ${amendsId}`);
419
+ }
379
420
  if (proposed.length > 0) {
380
421
  content = content.replace(
381
422
  /^ proposed: \[\]$/m,
@@ -425,6 +466,21 @@ export async function runRfcCreate(
425
466
  content = content.replace(/^# RFC-0000: .+$/m, `# ${nextId}: ${title}`);
426
467
 
427
468
  const targetPath = path.join(rfcDirPath, fileName);
469
+ // RFC-1536: reserve on the shared surface BEFORE the file write — a
470
+ // sibling session sees the claimed id even if this write never lands.
471
+ const landed = new Set<number>(files.map((f) => {
472
+ const m = path.basename(f).match(/^rfc-(\d{4})/);
473
+ return m ? parseInt(m[1]!, 10) : 0;
474
+ }));
475
+ const reserved = await appendReservation(
476
+ io,
477
+ workspaceRoot,
478
+ { kind: "rfc", id: candidate, session: await currentBranch(workspaceRoot, io) },
479
+ landed,
480
+ );
481
+ for (const warning of reserved.warnings) {
482
+ if (outputFormat === "pretty") logger.warn(`rfc.create: ${warning}`);
483
+ }
428
484
  // RFC-1364: atomic write (temp + rename) so concurrent readers never
429
485
  // observe a half-written RFC. The claim file already guarantees single
430
486
  // id allocation; the existence check preserves the old `wx` behavior
@@ -437,6 +493,32 @@ export async function runRfcCreate(
437
493
  await writeFileAtomic(targetPath, content);
438
494
  relativeFile = path.join(RFC_DIR, fileName);
439
495
  allocated = true;
496
+ // RFC-1534: counterpart write in the same pass — merge by frontmatter
497
+ // key (re-read before merge, never blind-append). A missing/unreadable
498
+ // amended file downgrades to a pending report; V-19 keeps its error.
499
+ if (amendsId) {
500
+ let amendedFile: string | undefined;
501
+ for (const f of files) {
502
+ if (!rfcFileMatchesId(f, amendsId)) continue;
503
+ const r = await readAndParseRfc(rfcDirPath, f);
504
+ if (
505
+ r &&
506
+ "parsed" in r &&
507
+ String(r.parsed.frontmatter["id"] ?? "").toUpperCase() === amendsId
508
+ ) {
509
+ amendedFile = f;
510
+ break;
511
+ }
512
+ }
513
+ const wrote = amendedFile
514
+ ? await appendRfcFrontmatterListEntry(
515
+ path.join(rfcDirPath, amendedFile),
516
+ "amendedBy",
517
+ [nextId],
518
+ )
519
+ : undefined;
520
+ amendsSync = { amended: amendsId, wroteCounterpart: wrote !== undefined };
521
+ }
440
522
  } finally {
441
523
  await fs.rm(claimPath);
442
524
  }
@@ -461,6 +543,15 @@ export async function runRfcCreate(
461
543
  `Near-duplicate precedent(s) cited in related: ${reviewBandIds.join(", ")} — distinguish or cite them in the Decision`,
462
544
  );
463
545
  }
546
+ if (amendsSync) {
547
+ if (amendsSync.wroteCounterpart) {
548
+ logger.info(`amends: wrote amendedBy counterpart on the ${amendsSync.amended} file`);
549
+ } else {
550
+ logger.warn(
551
+ `amends: draft created but amendedBy counterpart on ${amendsSync.amended} is pending — write it by hand or run rfc.validate --fix`,
552
+ );
553
+ }
554
+ }
464
555
  logger.info("Status: draft (only a human with role 'architecture' may change status)");
465
556
  }
466
557
 
@@ -470,10 +561,12 @@ export async function runRfcCreate(
470
561
  status: "ok",
471
562
  file: relativeFile,
472
563
  id: nextId,
564
+ idSource,
473
565
  satisfies,
474
566
  consultedDecisions,
475
567
  ...(colliding.length > 0 ? { colliding, blocked: false } : {}),
476
568
  ...(reviewBand.length > 0 ? { reviewBand } : {}),
569
+ ...(amendsSync ? { amendsSync } : {}),
477
570
  },
478
571
  summary: `Created ${nextId}: ${title}`,
479
572
  nextSteps: [