@warpgogol/forge 9.0.0 → 9.1.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 (383) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/bin/cli.ts +3 -2
  3. package/dist/bin/cli.js +3 -2
  4. package/dist/bin/cli.js.map +1 -1
  5. package/dist/os/agent/handlers/agent-tiers-validate.d.ts.map +1 -1
  6. package/dist/os/agent/handlers/agent-tiers-validate.js +5 -1
  7. package/dist/os/agent/handlers/agent-tiers-validate.js.map +1 -1
  8. package/dist/os/agent/index.d.ts.map +1 -1
  9. package/dist/os/agent/index.js +4 -0
  10. package/dist/os/agent/index.js.map +1 -1
  11. package/dist/os/authority/handlers/delegate.d.ts.map +1 -1
  12. package/dist/os/authority/handlers/delegate.js +2 -1
  13. package/dist/os/authority/handlers/delegate.js.map +1 -1
  14. package/dist/os/authority/index.d.ts.map +1 -1
  15. package/dist/os/authority/index.js +2 -1
  16. package/dist/os/authority/index.js.map +1 -1
  17. package/dist/os/checks/checks.module.d.ts.map +1 -1
  18. package/dist/os/checks/checks.module.js +5 -1
  19. package/dist/os/checks/checks.module.js.map +1 -1
  20. package/dist/os/checks/handlers/contribution-report.d.ts.map +1 -1
  21. package/dist/os/checks/handlers/contribution-report.js +5 -4
  22. package/dist/os/checks/handlers/contribution-report.js.map +1 -1
  23. package/dist/os/checks/handlers/counters-export.d.ts.map +1 -1
  24. package/dist/os/checks/handlers/counters-export.js +4 -0
  25. package/dist/os/checks/handlers/counters-export.js.map +1 -1
  26. package/dist/os/checks/handlers/counters-journal.d.ts.map +1 -1
  27. package/dist/os/checks/handlers/counters-journal.js +2 -1
  28. package/dist/os/checks/handlers/counters-journal.js.map +1 -1
  29. package/dist/os/checks/handlers/counters-validate.d.ts.map +1 -1
  30. package/dist/os/checks/handlers/counters-validate.js +5 -1
  31. package/dist/os/checks/handlers/counters-validate.js.map +1 -1
  32. package/dist/os/checks/index.d.ts.map +1 -1
  33. package/dist/os/checks/index.js +11 -0
  34. package/dist/os/checks/index.js.map +1 -1
  35. package/dist/os/compass/handlers/compass-docs-scaffold.js +1 -1
  36. package/dist/os/compass/handlers/compass-header-scaffold.d.ts.map +1 -1
  37. package/dist/os/compass/handlers/compass-header-scaffold.js +6 -1
  38. package/dist/os/compass/handlers/compass-header-scaffold.js.map +1 -1
  39. package/dist/os/compass/handlers/compass-invariants-generate.d.ts.map +1 -1
  40. package/dist/os/compass/handlers/compass-invariants-generate.js +3 -2
  41. package/dist/os/compass/handlers/compass-invariants-generate.js.map +1 -1
  42. package/dist/os/context/context.module.d.ts.map +1 -1
  43. package/dist/os/context/context.module.js +6 -1
  44. package/dist/os/context/context.module.js.map +1 -1
  45. package/dist/os/context/handlers/context-assemble.d.ts.map +1 -1
  46. package/dist/os/context/handlers/context-assemble.js +5 -1
  47. package/dist/os/context/handlers/context-assemble.js.map +1 -1
  48. package/dist/os/context/handlers/context-slate-eval.d.ts.map +1 -1
  49. package/dist/os/context/handlers/context-slate-eval.js +4 -0
  50. package/dist/os/context/handlers/context-slate-eval.js.map +1 -1
  51. package/dist/os/context/handlers/index-build.d.ts.map +1 -1
  52. package/dist/os/context/handlers/index-build.js +8 -5
  53. package/dist/os/context/handlers/index-build.js.map +1 -1
  54. package/dist/os/context/index.d.ts.map +1 -1
  55. package/dist/os/context/index.js +11 -0
  56. package/dist/os/context/index.js.map +1 -1
  57. package/dist/os/gate/handlers/gate-probe-catalog.d.ts.map +1 -1
  58. package/dist/os/gate/handlers/gate-probe-catalog.js +4 -0
  59. package/dist/os/gate/handlers/gate-probe-catalog.js.map +1 -1
  60. package/dist/os/gate/handlers/gate-probe.d.ts.map +1 -1
  61. package/dist/os/gate/handlers/gate-probe.js +4 -0
  62. package/dist/os/gate/handlers/gate-probe.js.map +1 -1
  63. package/dist/os/gate/index.d.ts.map +1 -1
  64. package/dist/os/gate/index.js +11 -0
  65. package/dist/os/gate/index.js.map +1 -1
  66. package/dist/os/instructions/instructions.module.d.ts.map +1 -1
  67. package/dist/os/instructions/instructions.module.js +2 -1
  68. package/dist/os/instructions/instructions.module.js.map +1 -1
  69. package/dist/os/knowledge/handlers/knowledge-authz-probe.d.ts.map +1 -1
  70. package/dist/os/knowledge/handlers/knowledge-authz-probe.js +7 -3
  71. package/dist/os/knowledge/handlers/knowledge-authz-probe.js.map +1 -1
  72. package/dist/os/knowledge/handlers/knowledge-conflicts-resolve.d.ts +11 -0
  73. package/dist/os/knowledge/handlers/knowledge-conflicts-resolve.d.ts.map +1 -0
  74. package/dist/os/knowledge/handlers/knowledge-conflicts-resolve.js +428 -0
  75. package/dist/os/knowledge/handlers/knowledge-conflicts-resolve.js.map +1 -0
  76. package/dist/os/knowledge/handlers/knowledge-rebuild.d.ts.map +1 -1
  77. package/dist/os/knowledge/handlers/knowledge-rebuild.js +4 -0
  78. package/dist/os/knowledge/handlers/knowledge-rebuild.js.map +1 -1
  79. package/dist/os/knowledge/index.d.ts +1 -0
  80. package/dist/os/knowledge/index.d.ts.map +1 -1
  81. package/dist/os/knowledge/index.js +13 -0
  82. package/dist/os/knowledge/index.js.map +1 -1
  83. package/dist/os/knowledge/knowledge.module.d.ts.map +1 -1
  84. package/dist/os/knowledge/knowledge.module.js +35 -1
  85. package/dist/os/knowledge/knowledge.module.js.map +1 -1
  86. package/dist/os/queue/manifest.d.ts.map +1 -1
  87. package/dist/os/queue/manifest.js +8 -7
  88. package/dist/os/queue/manifest.js.map +1 -1
  89. package/dist/os/resolver/resolver.module.d.ts.map +1 -1
  90. package/dist/os/resolver/resolver.module.js +2 -1
  91. package/dist/os/resolver/resolver.module.js.map +1 -1
  92. package/dist/os/rfc/handlers/implement-stamp-deviations.d.ts +1 -0
  93. package/dist/os/rfc/handlers/implement-stamp-deviations.d.ts.map +1 -1
  94. package/dist/os/rfc/handlers/implement-stamp-deviations.js +3 -0
  95. package/dist/os/rfc/handlers/implement-stamp-deviations.js.map +1 -1
  96. package/dist/os/rfc/handlers/implement-stamp-origin.d.ts.map +1 -1
  97. package/dist/os/rfc/handlers/implement-stamp-origin.js +10 -2
  98. package/dist/os/rfc/handlers/implement-stamp-origin.js.map +1 -1
  99. package/dist/os/rfc/handlers/implement-stamp-outcome.d.ts +2 -0
  100. package/dist/os/rfc/handlers/implement-stamp-outcome.d.ts.map +1 -1
  101. package/dist/os/rfc/handlers/implement-stamp-outcome.js +2 -0
  102. package/dist/os/rfc/handlers/implement-stamp-outcome.js.map +1 -1
  103. package/dist/os/rfc/handlers/implement-stamp.d.ts.map +1 -1
  104. package/dist/os/rfc/handlers/implement-stamp.js +176 -59
  105. package/dist/os/rfc/handlers/implement-stamp.js.map +1 -1
  106. package/dist/os/rfc/handlers/lifecycle.d.ts.map +1 -1
  107. package/dist/os/rfc/handlers/lifecycle.js +13 -6
  108. package/dist/os/rfc/handlers/lifecycle.js.map +1 -1
  109. package/dist/os/rfc/handlers/list-create.d.ts.map +1 -1
  110. package/dist/os/rfc/handlers/list-create.js +28 -2
  111. package/dist/os/rfc/handlers/list-create.js.map +1 -1
  112. package/dist/os/rfc/reachable-symbol.d.ts.map +1 -1
  113. package/dist/os/rfc/reachable-symbol.js +4 -2
  114. package/dist/os/rfc/reachable-symbol.js.map +1 -1
  115. package/dist/os/rfc/rfc.module.d.ts.map +1 -1
  116. package/dist/os/rfc/rfc.module.js +23 -7
  117. package/dist/os/rfc/rfc.module.js.map +1 -1
  118. package/dist/os/rfc/types.d.ts +22 -2
  119. package/dist/os/rfc/types.d.ts.map +1 -1
  120. package/dist/os/rfc/types.js +18 -2
  121. package/dist/os/rfc/types.js.map +1 -1
  122. package/dist/os/rfc/verifier/rfc-1391/support.d.ts.map +1 -1
  123. package/dist/os/rfc/verifier/rfc-1391/support.js +4 -0
  124. package/dist/os/rfc/verifier/rfc-1391/support.js.map +1 -1
  125. package/dist/os/session/handlers/save.d.ts.map +1 -1
  126. package/dist/os/session/handlers/save.js +5 -2
  127. package/dist/os/session/handlers/save.js.map +1 -1
  128. package/dist/os/session/handlers/session-audit-report.d.ts.map +1 -1
  129. package/dist/os/session/handlers/session-audit-report.js +4 -0
  130. package/dist/os/session/handlers/session-audit-report.js.map +1 -1
  131. package/dist/os/session/handlers/session-audit.d.ts.map +1 -1
  132. package/dist/os/session/handlers/session-audit.js +4 -0
  133. package/dist/os/session/handlers/session-audit.js.map +1 -1
  134. package/dist/os/trajectory/handlers/journal-io.d.ts +9 -0
  135. package/dist/os/trajectory/handlers/journal-io.d.ts.map +1 -1
  136. package/dist/os/trajectory/handlers/journal-io.js +20 -2
  137. package/dist/os/trajectory/handlers/journal-io.js.map +1 -1
  138. package/dist/os/trajectory/handlers/outcome-record.d.ts.map +1 -1
  139. package/dist/os/trajectory/handlers/outcome-record.js +4 -1
  140. package/dist/os/trajectory/handlers/outcome-record.js.map +1 -1
  141. package/dist/os/trajectory/handlers/trajectory-index.d.ts.map +1 -1
  142. package/dist/os/trajectory/handlers/trajectory-index.js +30 -8
  143. package/dist/os/trajectory/handlers/trajectory-index.js.map +1 -1
  144. package/dist/os/trajectory/handlers/trajectory-recall.d.ts.map +1 -1
  145. package/dist/os/trajectory/handlers/trajectory-recall.js +7 -4
  146. package/dist/os/trajectory/handlers/trajectory-recall.js.map +1 -1
  147. package/dist/os/trajectory/index.d.ts.map +1 -1
  148. package/dist/os/trajectory/index.js +11 -0
  149. package/dist/os/trajectory/index.js.map +1 -1
  150. package/dist/os/trajectory/trajectory.module.d.ts.map +1 -1
  151. package/dist/os/trajectory/trajectory.module.js +16 -9
  152. package/dist/os/trajectory/trajectory.module.js.map +1 -1
  153. package/dist/os/werkstatt/handlers/session-close.d.ts.map +1 -1
  154. package/dist/os/werkstatt/handlers/session-close.js +3 -0
  155. package/dist/os/werkstatt/handlers/session-close.js.map +1 -1
  156. package/dist/os/werkstatt/handlers/session-engine.d.ts.map +1 -1
  157. package/dist/os/werkstatt/handlers/session-engine.js +3 -0
  158. package/dist/os/werkstatt/handlers/session-engine.js.map +1 -1
  159. package/dist/os/werkstatt/handlers/session-open.d.ts.map +1 -1
  160. package/dist/os/werkstatt/handlers/session-open.js +3 -0
  161. package/dist/os/werkstatt/handlers/session-open.js.map +1 -1
  162. package/dist/os/werkstatt/handlers/session-status.d.ts.map +1 -1
  163. package/dist/os/werkstatt/handlers/session-status.js +3 -0
  164. package/dist/os/werkstatt/handlers/session-status.js.map +1 -1
  165. package/dist/os/yaml/handlers/scalars-validate.d.ts +28 -0
  166. package/dist/os/yaml/handlers/scalars-validate.d.ts.map +1 -0
  167. package/dist/os/yaml/handlers/scalars-validate.js +311 -0
  168. package/dist/os/yaml/handlers/scalars-validate.js.map +1 -0
  169. package/dist/os/yaml/index.d.ts +4 -0
  170. package/dist/os/yaml/index.d.ts.map +1 -0
  171. package/dist/os/yaml/index.js +15 -0
  172. package/dist/os/yaml/index.js.map +1 -0
  173. package/dist/os/yaml/yaml.module.d.ts +3 -0
  174. package/dist/os/yaml/yaml.module.d.ts.map +1 -0
  175. package/dist/os/yaml/yaml.module.js +58 -0
  176. package/dist/os/yaml/yaml.module.js.map +1 -0
  177. package/dist/src/authority/delegations.d.ts.map +1 -1
  178. package/dist/src/authority/delegations.js +5 -4
  179. package/dist/src/authority/delegations.js.map +1 -1
  180. package/dist/src/cli-flags.d.ts.map +1 -1
  181. package/dist/src/cli-flags.js +1 -5
  182. package/dist/src/cli-flags.js.map +1 -1
  183. package/dist/src/compass/invariant-parser.d.ts.map +1 -1
  184. package/dist/src/compass/invariant-parser.js +2 -1
  185. package/dist/src/compass/invariant-parser.js.map +1 -1
  186. package/dist/src/config/forge-config.d.ts +17 -0
  187. package/dist/src/config/forge-config.d.ts.map +1 -1
  188. package/dist/src/config/forge-config.js +33 -10
  189. package/dist/src/config/forge-config.js.map +1 -1
  190. package/dist/src/formal/exhaustive.d.ts.map +1 -1
  191. package/dist/src/formal/exhaustive.js +3 -2
  192. package/dist/src/formal/exhaustive.js.map +1 -1
  193. package/dist/src/formal/index.d.ts.map +1 -1
  194. package/dist/src/formal/index.js +4 -0
  195. package/dist/src/formal/index.js.map +1 -1
  196. package/dist/src/formal/proof-runner.d.ts.map +1 -1
  197. package/dist/src/formal/proof-runner.js +4 -3
  198. package/dist/src/formal/proof-runner.js.map +1 -1
  199. package/dist/src/formal/proof-spec.d.ts.map +1 -1
  200. package/dist/src/formal/proof-spec.js +3 -2
  201. package/dist/src/formal/proof-spec.js.map +1 -1
  202. package/dist/src/index.d.ts +1 -1
  203. package/dist/src/index.d.ts.map +1 -1
  204. package/dist/src/index.js +1 -1
  205. package/dist/src/index.js.map +1 -1
  206. package/dist/src/knowledge/index.d.ts +2 -2
  207. package/dist/src/knowledge/index.d.ts.map +1 -1
  208. package/dist/src/knowledge/index.js +4 -3
  209. package/dist/src/knowledge/index.js.map +1 -1
  210. package/dist/src/knowledge/parse.d.ts +1 -0
  211. package/dist/src/knowledge/parse.d.ts.map +1 -1
  212. package/dist/src/knowledge/parse.js +20 -18
  213. package/dist/src/knowledge/parse.js.map +1 -1
  214. package/dist/src/knowledge/schema.d.ts.map +1 -1
  215. package/dist/src/knowledge/schema.js +5 -4
  216. package/dist/src/knowledge/schema.js.map +1 -1
  217. package/dist/src/knowledge/sync.d.ts +61 -0
  218. package/dist/src/knowledge/sync.d.ts.map +1 -1
  219. package/dist/src/knowledge/sync.js +202 -7
  220. package/dist/src/knowledge/sync.js.map +1 -1
  221. package/dist/src/onboarding/agents-generate.js +1 -1
  222. package/dist/src/onboarding/compass-docs/semantic-layer-block.js +1 -1
  223. package/dist/src/onboarding/doctor.d.ts +2 -0
  224. package/dist/src/onboarding/doctor.d.ts.map +1 -1
  225. package/dist/src/onboarding/doctor.js +166 -26
  226. package/dist/src/onboarding/doctor.js.map +1 -1
  227. package/dist/src/onboarding/nested-agents-generate.js +1 -1
  228. package/dist/src/onboarding/nested-agents-templates.js +1 -1
  229. package/dist/src/onboarding/upgrade.d.ts.map +1 -1
  230. package/dist/src/onboarding/upgrade.js +18 -10
  231. package/dist/src/onboarding/upgrade.js.map +1 -1
  232. package/dist/src/reachability/command-mentions.d.ts.map +1 -1
  233. package/dist/src/reachability/command-mentions.js +4 -2
  234. package/dist/src/reachability/command-mentions.js.map +1 -1
  235. package/dist/src/registry.d.ts +20 -0
  236. package/dist/src/registry.d.ts.map +1 -1
  237. package/dist/src/registry.js +129 -67
  238. package/dist/src/registry.js.map +1 -1
  239. package/dist/src/validators/skill-validate.d.ts +5 -0
  240. package/dist/src/validators/skill-validate.d.ts.map +1 -1
  241. package/dist/src/validators/skill-validate.js +34 -8
  242. package/dist/src/validators/skill-validate.js.map +1 -1
  243. package/os/agent/handlers/agent-tiers-validate.ts +5 -1
  244. package/os/agent/index.ts +4 -0
  245. package/os/authority/handlers/delegate.ts +2 -1
  246. package/os/authority/index.ts +2 -1
  247. package/os/checks/checks.module.ts +5 -1
  248. package/os/checks/handlers/contribution-report.test.ts +6 -0
  249. package/os/checks/handlers/contribution-report.ts +5 -4
  250. package/os/checks/handlers/counters-export.test.ts +6 -0
  251. package/os/checks/handlers/counters-export.ts +4 -0
  252. package/os/checks/handlers/counters-journal.test.ts +6 -0
  253. package/os/checks/handlers/counters-journal.ts +2 -1
  254. package/os/checks/handlers/counters-validate.test.ts +6 -0
  255. package/os/checks/handlers/counters-validate.ts +5 -1
  256. package/os/checks/handlers/variant-candidates.test.ts +6 -0
  257. package/os/checks/index.ts +12 -0
  258. package/os/compass/handlers/compass-docs-scaffold.ts +1 -1
  259. package/os/compass/handlers/compass-header-scaffold.ts +6 -1
  260. package/os/compass/handlers/compass-invariants-generate.ts +3 -2
  261. package/os/context/context.module.ts +6 -1
  262. package/os/context/handlers/context-assemble.test.ts +6 -0
  263. package/os/context/handlers/context-assemble.ts +5 -1
  264. package/os/context/handlers/context-slate-eval.test.ts +6 -0
  265. package/os/context/handlers/context-slate-eval.ts +4 -0
  266. package/os/context/handlers/index-build.test.ts +33 -0
  267. package/os/context/handlers/index-build.ts +8 -5
  268. package/os/context/handlers/no-model-deps.test.ts +6 -0
  269. package/os/context/handlers/slate-fill.test.ts +6 -0
  270. package/os/context/index.ts +12 -0
  271. package/os/gate/handlers/gate-probe-catalog.test.ts +6 -0
  272. package/os/gate/handlers/gate-probe-catalog.ts +4 -0
  273. package/os/gate/handlers/gate-probe.test.ts +6 -0
  274. package/os/gate/handlers/gate-probe.ts +4 -0
  275. package/os/gate/index.ts +12 -0
  276. package/os/instructions/budget.test.ts +6 -0
  277. package/os/instructions/instructions.module.ts +2 -1
  278. package/os/knowledge/handlers/knowledge-authz-probe.test.ts +21 -0
  279. package/os/knowledge/handlers/knowledge-authz-probe.ts +7 -3
  280. package/os/knowledge/handlers/knowledge-conflicts-resolve.ts +571 -0
  281. package/os/knowledge/handlers/knowledge-rebuild.test.ts +6 -0
  282. package/os/knowledge/handlers/knowledge-rebuild.ts +4 -0
  283. package/os/knowledge/index.ts +14 -0
  284. package/os/knowledge/knowledge.module.ts +36 -1
  285. package/os/queue/decision-ledger.test.ts +32 -1
  286. package/os/queue/manifest.ts +8 -7
  287. package/os/resolver/handlers/resolver-doors-audit.test.ts +3 -0
  288. package/os/resolver/resolver.module.ts +2 -1
  289. package/os/rfc/handlers/implement-stamp-deviations.ts +4 -1
  290. package/os/rfc/handlers/implement-stamp-origin.ts +10 -2
  291. package/os/rfc/handlers/implement-stamp-outcome.ts +4 -2
  292. package/os/rfc/handlers/implement-stamp-stale.test.ts +2 -1
  293. package/os/rfc/handlers/implement-stamp.ts +188 -58
  294. package/os/rfc/handlers/lifecycle.test.ts +59 -1
  295. package/os/rfc/handlers/lifecycle.ts +25 -15
  296. package/os/rfc/handlers/list-create.test.ts +81 -0
  297. package/os/rfc/handlers/list-create.ts +34 -2
  298. package/os/rfc/handlers/validate-rules-rfc1334.test.ts +2 -1
  299. package/os/rfc/handlers/validate-rules-rfc1453.test.ts +2 -1
  300. package/os/rfc/handlers/validate-rules-rfc1454.test.ts +2 -1
  301. package/os/rfc/handlers/validate-rules-rfc1455.test.ts +2 -1
  302. package/os/rfc/reachable-symbol.ts +4 -2
  303. package/os/rfc/rfc-0000-template.md +16 -0
  304. package/os/rfc/rfc.module.ts +26 -7
  305. package/os/rfc/types.ts +32 -2
  306. package/os/rfc/verifier/rfc-1333/imp12-binding.acceptance.test.ts +12 -0
  307. package/os/rfc/verifier/rfc-1333/imp12-gate.acceptance.test.ts +12 -0
  308. package/os/rfc/verifier/rfc-1333/skills-and-types.acceptance.test.ts +12 -0
  309. package/os/rfc/verifier/rfc-1333/verify-workspace.acceptance.test.ts +12 -0
  310. package/os/rfc/verifier/rfc-1391/fixtures/no-report.proof.test.ts +4 -0
  311. package/os/rfc/verifier/rfc-1391/fixtures/small-domain.proof.test.ts +4 -0
  312. package/os/rfc/verifier/rfc-1391/support.ts +4 -0
  313. package/os/session/handlers/save.ts +5 -2
  314. package/os/session/handlers/session-audit-detectors.test.ts +6 -0
  315. package/os/session/handlers/session-audit-report.test.ts +6 -0
  316. package/os/session/handlers/session-audit-report.ts +4 -0
  317. package/os/session/handlers/session-audit.test.ts +6 -0
  318. package/os/session/handlers/session-audit.ts +4 -0
  319. package/os/trajectory/handlers/extract-units.test.ts +7 -1
  320. package/os/trajectory/handlers/journal-io.ts +20 -2
  321. package/os/trajectory/handlers/outcome-record.test.ts +6 -0
  322. package/os/trajectory/handlers/outcome-record.ts +4 -1
  323. package/os/trajectory/handlers/producer-trust.test.ts +6 -0
  324. package/os/trajectory/handlers/trajectory-index.test.ts +29 -0
  325. package/os/trajectory/handlers/trajectory-index.ts +31 -8
  326. package/os/trajectory/handlers/trajectory-recall.test.ts +27 -0
  327. package/os/trajectory/handlers/trajectory-recall.ts +7 -4
  328. package/os/trajectory/handlers/trajectory.test.ts +6 -0
  329. package/os/trajectory/handlers/verdict-binding.test.ts +40 -0
  330. package/os/trajectory/index.ts +12 -0
  331. package/os/trajectory/trajectory.module.ts +16 -9
  332. package/os/werkstatt/handlers/session-close.ts +3 -0
  333. package/os/werkstatt/handlers/session-engine.ts +3 -0
  334. package/os/werkstatt/handlers/session-open.ts +3 -0
  335. package/os/werkstatt/handlers/session-status.ts +3 -0
  336. package/os/yaml/handlers/scalars-validate.ts +343 -0
  337. package/os/yaml/index.ts +23 -0
  338. package/os/yaml/scalars.test.ts +152 -0
  339. package/os/yaml/yaml.module.ts +61 -0
  340. package/package.json +17 -1
  341. package/skills/fo/fo-knowledge-distill/SKILL.md +6 -5
  342. package/skills/fo/fo-memory-sync/SKILL.md +3 -0
  343. package/skills/fo/fo-memory-sync/fix-patterns.md +65 -0
  344. package/skills/fo/fo-memory-sync/learned-principles.md +10 -0
  345. package/skills/fo/fo-memory-sync/qa-log.md +30 -0
  346. package/skills/fo/fo-session-save/SKILL.md +2 -0
  347. package/skills/shared/grilling/SKILL.md +3 -0
  348. package/skills/shared/writing-great-skills/SKILL.md +12 -9
  349. package/src/authority/delegations.ts +5 -4
  350. package/src/cli-flags.ts +1 -5
  351. package/src/compass/invariant-parser.ts +2 -1
  352. package/src/config/forge-config.ts +40 -14
  353. package/src/formal/exhaustive.ts +3 -2
  354. package/src/formal/index.ts +4 -0
  355. package/src/formal/proof-runner.ts +4 -3
  356. package/src/formal/proof-spec.ts +3 -2
  357. package/src/index.ts +1 -0
  358. package/src/knowledge/index.ts +11 -2
  359. package/src/knowledge/parse.ts +20 -17
  360. package/src/knowledge/schema.ts +5 -4
  361. package/src/knowledge/sync.ts +281 -7
  362. package/src/onboarding/agents-generate.ts +1 -1
  363. package/src/onboarding/compass-docs/semantic-layer-block.ts +1 -1
  364. package/src/onboarding/doctor.ts +184 -26
  365. package/src/onboarding/nested-agents-generate.ts +1 -1
  366. package/src/onboarding/nested-agents-templates.ts +1 -1
  367. package/src/onboarding/upgrade.ts +18 -10
  368. package/src/reachability/command-mentions.ts +4 -2
  369. package/src/registry.ts +153 -74
  370. package/src/tests/cli-flags.test.ts +1 -1
  371. package/src/tests/discover-pack-skills.test.ts +26 -0
  372. package/src/tests/doctor-autonomy.test.ts +144 -0
  373. package/src/tests/doctor-dist-freshness.test.ts +24 -0
  374. package/src/tests/doctor-knowledge-conflicts.test.ts +135 -0
  375. package/src/tests/doctor-nested-agents.test.ts +30 -1
  376. package/src/tests/implement-stamp.test.ts +191 -8
  377. package/src/tests/knowledge-conflicts-resolve.pbt.test.ts +38 -0
  378. package/src/tests/knowledge-conflicts-resolve.test.ts +648 -0
  379. package/src/tests/knowledge-parse.test.ts +26 -1
  380. package/src/tests/session-handlers.test.ts +47 -0
  381. package/src/tests/skill-validate-knowledge.test.ts +93 -2
  382. package/src/tests/upgrade.test.ts +38 -0
  383. package/src/validators/skill-validate.ts +37 -9
@@ -12,12 +12,12 @@ verification evidence, and atomically mutates RFC frontmatter.
12
12
  </non-goals>
13
13
  </MODULE_CONTRACT>
14
14
  <CHANGE_SUMMARY>
15
- <item>RFC-1333: steps 1-3 — report contract, rfc.verify.workspace export, RFC-IMP-12 gate, RFC-IMP-11 blocking</item>
16
15
  <item>RFC-1333: CX-1/CX-2 fixes — docs/** binding, waiver covers a missing report, IMP-12 for probe-less RFCs; merge-aware fail-closed binding.</item>
17
16
  <item>RFC-1391: make the formal verification tier checker-bound (RFC-1391)</item>
18
17
  <item>RFC-1453: executed outcome probes, IMP-14 surface gate, outcome.serve + V-47/V-48</item>
19
18
  <item>RFC-1454: review deviations recorded in the RFC — IMP-15 gate, V-49 provenance, skill contract</item>
20
- <history>RFC-0268, RFC-0476, RFC-0756, RFC-0795, RFC-0997, RFC-1053, RFC-1097, RFC-1249, RFC-1271, RFC-1306, RFC-1310, RFC-1321, RFC-1322, RFC-1330, RFC-1383, RFC-IMP-07</history>
19
+ <item>RFC-1483: self-sufficient implement stamp — default repair pass, ordered remediation checklist, --no-repair</item>
20
+ <history>RFC-0268, RFC-0476, RFC-0756, RFC-0795, RFC-0997, RFC-1053, RFC-1097, RFC-1249, RFC-1271, RFC-1306, RFC-1310, RFC-1321, RFC-1322, RFC-1330, RFC-1333, RFC-1383, RFC-IMP-07</history>
21
21
  </CHANGE_SUMMARY>
22
22
  */
23
23
 
@@ -41,6 +41,7 @@ import { evaluateDeviationGate } from "./implement-stamp-deviations.ts";
41
41
  import { toIsoDate } from "./shared.ts";
42
42
  import { byteHashHex, normalizeProbes, runRfcVerificationEmit } from "../verification-evidence.ts";
43
43
  import {
44
+ PREREQUISITE_ORDER,
44
45
  RFC_DIR,
45
46
  RFC_METADATA_CUTOFF,
46
47
  RFC_ORIGIN_CUTOFF,
@@ -66,6 +67,7 @@ import type {
66
67
  RfcImplementStampViolation,
67
68
  RfcImplementStampResult,
68
69
  AcceptanceProbe,
70
+ StampRepair,
69
71
  VerificationEvidence,
70
72
  } from "../types.ts";
71
73
  import type { WorkspaceIO } from "../../../src/types.ts";
@@ -522,6 +524,22 @@ async function evaluateStampEvidenceGates(opts: {
522
524
  implementationCommit?: string;
523
525
  /** RFC-1453: operator waiver for the outcome gate (--waive-outcome). */
524
526
  waiveOutcome?: string;
527
+ /**
528
+ * RFC-1483: restrict evaluation to one phase of the gateset.
529
+ * - "independent" — gates that do not read the evidence envelope
530
+ * (RFC-IMP-10/11/12/15); runs pre-lock so composite reporting is
531
+ * preserved while the envelope refresh is still pending.
532
+ * - "dependent" — envelope-reading gates (RFC-IMP-06/09/13/14); runs
533
+ * in-lock after the emit-if-needed refresh.
534
+ * Omitted — the full gateset (no-repair path, stale-state evaluation).
535
+ */
536
+ gatePhase?: "independent" | "dependent";
537
+ /**
538
+ * RFC-1483: used only for the doomed-run composite report — skips the
539
+ * repairable staleness findings (RFC-IMP-06/09) that the refresh would
540
+ * fix anyway, while still naming envelope-record verdicts (IMP-13/14).
541
+ */
542
+ suppressRepairable?: boolean;
525
543
  }): Promise<{
526
544
  violations: RfcImplementStampViolation[];
527
545
  warnings: RfcImplementStampViolation[];
@@ -531,11 +549,13 @@ async function evaluateStampEvidenceGates(opts: {
531
549
  const violations: RfcImplementStampViolation[] = [];
532
550
  const warnings: RfcImplementStampViolation[] = [];
533
551
  let evidenceRelPath: string | undefined;
552
+ const runIndependent = opts.gatePhase !== "dependent";
553
+ const runDependent = opts.gatePhase !== "independent";
534
554
 
535
555
  // ── RFC-IMP-10 / RFC-IMP-11: git-derived origin gates (RFC-1330) ─────────
536
556
  // Derived fresh at stamp time (head = HEAD) — the committed envelope's
537
557
  // origin records are volatile context and may predate later commits.
538
- if (hasProbes && String(opts.frontmatter["createdAt"] ?? "") >= RFC_ORIGIN_CUTOFF) {
558
+ if (runIndependent && hasProbes && String(opts.frontmatter["createdAt"] ?? "") >= RFC_ORIGIN_CUTOFF) {
539
559
  const probes = acceptance as AcceptanceProbe[];
540
560
  const origins = await deriveProbeOrigins({
541
561
  git: createOriginGit(opts.workspaceRoot),
@@ -557,31 +577,35 @@ async function evaluateStampEvidenceGates(opts: {
557
577
 
558
578
  // RFC-IMP-12 applies to every post-cutoff HIGH-tier RFC, probe-bearing or not.
559
579
  // ── RFC-IMP-12: acceptance-verification report (RFC-1333) ─────────────
560
- const acc = await evaluateAcceptanceVerificationGate({
561
- targetId,
562
- frontmatter: opts.frontmatter,
563
- reports: await readAcceptanceReports(opts.workspaceRoot, targetId),
564
- isCandidateBound: (sha) => candidateBoundToHead(opts.workspaceRoot, sha),
565
- waiverReason: opts.waiverReason,
566
- });
567
- violations.push(...acc.errors);
568
- warnings.push(...acc.warnings);
580
+ if (runIndependent) {
581
+ const acc = await evaluateAcceptanceVerificationGate({
582
+ targetId,
583
+ frontmatter: opts.frontmatter,
584
+ reports: await readAcceptanceReports(opts.workspaceRoot, targetId),
585
+ isCandidateBound: (sha) => candidateBoundToHead(opts.workspaceRoot, sha),
586
+ waiverReason: opts.waiverReason,
587
+ });
588
+ violations.push(...acc.errors);
589
+ warnings.push(...acc.warnings);
590
+ }
569
591
 
570
592
  // ── RFC-IMP-13: formal tier requires proved proof probes (RFC-1391) ────────
571
593
  // No waiver path — formal evidence is a mechanical checker verdict by
572
594
  // definition. Reads the committed envelope's proof verdicts.
573
- const formal = evaluateFormalProofGate({
574
- targetId,
575
- frontmatter: opts.frontmatter,
576
- probes: (Array.isArray(acceptance) ? acceptance : []) as AcceptanceProbe[],
577
- evidenceRecords: evidenceCheck.envelope?.probes,
578
- });
579
- violations.push(...formal.errors);
580
- warnings.push(...formal.warnings);
595
+ if (runDependent) {
596
+ const formal = evaluateFormalProofGate({
597
+ targetId,
598
+ frontmatter: opts.frontmatter,
599
+ probes: (Array.isArray(acceptance) ? acceptance : []) as AcceptanceProbe[],
600
+ evidenceRecords: evidenceCheck.envelope?.probes,
601
+ });
602
+ violations.push(...formal.errors);
603
+ warnings.push(...formal.warnings);
604
+ }
581
605
 
582
606
  // ── RFC-IMP-14: outcome-surface diffs need a passing outcome probe (RFC-1453) ──
583
607
  // Evaluates the committed envelope's recorded verdicts — never re-executes.
584
- {
608
+ if (runDependent) {
585
609
  let outcomeSurfaces: string[] = [];
586
610
  let outcomeBuild: string | null = null;
587
611
  try {
@@ -609,7 +633,7 @@ async function evaluateStampEvidenceGates(opts: {
609
633
  }
610
634
 
611
635
  // ── RFC-IMP-15: amend review deviations recorded in ## Deviations (RFC-1454) ──
612
- {
636
+ if (runIndependent) {
613
637
  let reviewsDir: string | null = null;
614
638
  try {
615
639
  reviewsDir = loadForgeConfig(opts.workspaceRoot).bindings?.paths?.reviewsDir ?? null;
@@ -626,11 +650,12 @@ async function evaluateStampEvidenceGates(opts: {
626
650
  }
627
651
 
628
652
  // ── RFC-IMP-06: probe-bearing post-cutoff RFCs need a passing envelope ────
629
- if (requiresEvidence) {
653
+ if (requiresEvidence && runDependent && !opts.suppressRepairable) {
630
654
  if (!evidenceCheck.exists || evidenceCheck.overall !== "pass") {
631
655
  violations.push({
632
656
  rule: "RFC-IMP-06",
633
657
  message: `RFC ${targetId} declares acceptance probes but evidence file is missing or overall is not "pass" (got "${evidenceCheck.overall}"). Run: site-kernel run rfc.verification.emit --id ${targetId}`,
658
+ fixHint: `run rfc.verification.emit --id ${targetId} and fix the failing probe(s) — the default repair pass emits a missing/stale envelope in-process but cannot make a failing probe pass`,
634
659
  });
635
660
  } else {
636
661
  evidenceRelPath = join(VERIFICATION_DIR, `${targetId.toLowerCase()}.generated.yaml`);
@@ -642,16 +667,18 @@ async function evaluateStampEvidenceGates(opts: {
642
667
  // (the RFC file must be committed-clean to stamp) the compared bytes are
643
668
  // effectively the committed bytes — deliberate, keeps the gate honest
644
669
  // without a second git read.
645
- if (evidenceCheck.exists) {
670
+ if (evidenceCheck.exists && runDependent && !opts.suppressRepairable) {
646
671
  if (evidenceCheck.malformed || !evidenceCheck.envelope) {
647
672
  violations.push({
648
673
  rule: "RFC-IMP-09",
649
674
  message: `RFC ${targetId} evidence envelope is malformed (unreadable YAML or non-object content). Re-run: site-kernel run rfc.verification.emit --id ${targetId}, then commit the envelope — or delete the stale envelope file.`,
675
+ fixHint: `re-run rfc.verification.emit --id ${targetId} and commit the envelope, or delete the stale envelope file`,
650
676
  });
651
677
  } else if (!hasProbes) {
652
678
  violations.push({
653
679
  rule: "RFC-IMP-09",
654
680
  message: `RFC ${targetId} has a committed evidence envelope but no acceptance: list — probes were deleted after emission, which is a criteria change. Either restore the probes and re-run: site-kernel run rfc.verification.emit --id ${targetId}, then commit the envelope — or delete the stale envelope file (rfc.verification.emit skips probe-less RFCs, so re-emit alone cannot clear this).`,
681
+ fixHint: `restore the deleted probes and re-run rfc.verification.emit --id ${targetId}, or delete the stale envelope file`,
655
682
  });
656
683
  } else {
657
684
  const rfcMarkdown = await opts.io.readFile(rfcFilePath);
@@ -662,6 +689,7 @@ async function evaluateStampEvidenceGates(opts: {
662
689
  violations.push({
663
690
  rule: "RFC-IMP-09",
664
691
  message: `RFC ${targetId} evidence envelope lacks hash fields (pre-RFC-0330 format). Re-run: site-kernel run rfc.verification.emit --id ${targetId}, then commit the envelope.`,
692
+ fixHint: `re-run rfc.verification.emit --id ${targetId} and commit the refreshed envelope`,
665
693
  });
666
694
  } else if (
667
695
  env.rfcFileHash !== currentFileHash ||
@@ -676,6 +704,7 @@ async function evaluateStampEvidenceGates(opts: {
676
704
  violations.push({
677
705
  rule: "RFC-IMP-09",
678
706
  message: `RFC ${targetId} evidence is stale: ${staleFields} mismatch — the RFC file or its acceptance list changed after emission. Re-run: site-kernel run rfc.verification.emit --id ${targetId}, then commit the envelope.`,
707
+ fixHint: `re-run rfc.verification.emit --id ${targetId} after committing the RFC bytes, then commit the refreshed envelope`,
679
708
  });
680
709
  }
681
710
  }
@@ -801,7 +830,12 @@ export async function runRfcImplementStamp(
801
830
  // RFC-1322: the stamp performs the checkbox flips itself — but only for
802
831
  // criteria whose (evidence: ...) annotation resolves — and refreshes a
803
832
  // missing/stale envelope in-process before the gates evaluate it.
804
- const checkCriteria = input.flags["check-criteria"] === true;
833
+ // RFC-1483: the --check-criteria repair machinery is the default path —
834
+ // the flag stays an accepted alias for script stability; --no-repair
835
+ // restores fail-fast gating and wins when both are passed.
836
+ const noRepair = input.flags["no-repair"] === true;
837
+ const repairEnabled = !noRepair;
838
+ const repaired: StampRepair[] = [];
805
839
 
806
840
  // ── Find the target RFC ───────────────────────────────────────────────────
807
841
  const files = await listRfcFiles(rfcDirPath);
@@ -879,24 +913,28 @@ export async function runRfcImplementStamp(
879
913
  }
880
914
 
881
915
  // ── RFC-IMP-02: criterion checks (V-26/V-27 semantics) ────────────────────
882
- // Under --check-criteria both branches defer: unchecked lines become flip
883
- // candidates for the auto-check pass, and checkedWithoutEvidence re-runs on
884
- // the post-flip body — a flipped line always keeps its annotation.
916
+ // Under the default repair pass both branches defer: unchecked lines become
917
+ // flip candidates for the auto-check pass, and checkedWithoutEvidence
918
+ // re-runs on the post-flip body — a flipped line always keeps its
919
+ // annotation. --no-repair restores these blocking branches.
885
920
  const criteriaEval = evaluateAcceptanceCriteria(body);
886
- // RFC-1383: the unchecked violation names the remedy — --check-criteria
887
- // auto-verifies resolvable criteria in-place. This branch only runs when
888
- // the flag was NOT passed, so the hint can never offer a no-op.
921
+ // RFC-1383: the unchecked violation names the remedy — dropping --no-repair
922
+ // lets the default repair pass auto-verify resolvable criteria in-place.
923
+ // This branch only runs under --no-repair, so the hint can never offer a
924
+ // no-op.
889
925
  const criteriaTotal = criteriaEval.totalChecked + criteriaEval.totalUnchecked;
890
- if (!checkCriteria && criteriaEval.totalUnchecked > 0) {
926
+ if (!repairEnabled && criteriaEval.totalUnchecked > 0) {
891
927
  violations.push({
892
928
  rule: "RFC-IMP-02",
893
- message: `${criteriaEval.totalUnchecked} acceptance criteria are unchecked. All criteria must be checked before stamping: ${criteriaEval.uncheckedLines.join("; ")}. Re-run with --check-criteria to auto-verify resolvable criteria, or annotate evidence on each criterion and re-run.`,
929
+ message: `${criteriaEval.totalUnchecked} acceptance criteria are unchecked. All criteria must be checked before stamping: ${criteriaEval.uncheckedLines.join("; ")}. Re-run without --no-repair to let the default repair pass auto-verify resolvable criteria, or annotate evidence on each criterion and re-run.`,
930
+ fixHint: `re-run without --no-repair (the default repair pass flips criteria whose (evidence: test:<path>|file:<path>|<path>:<line>|probe:AC-N) annotation resolves), or annotate evidence on each listed criterion`,
894
931
  });
895
932
  }
896
- if (!checkCriteria && criteriaEval.checkedWithoutEvidence.length > 0) {
933
+ if (!repairEnabled && criteriaEval.checkedWithoutEvidence.length > 0) {
897
934
  violations.push({
898
935
  rule: "RFC-IMP-02",
899
936
  message: `${criteriaEval.checkedWithoutEvidence.length} checked criteria lack inline (evidence: ...) annotation: ${criteriaEval.checkedWithoutEvidence.join("; ")}`,
937
+ fixHint: `add an inline (evidence: ...) annotation to each listed checked criterion`,
900
938
  });
901
939
  }
902
940
 
@@ -935,6 +973,7 @@ export async function runRfcImplementStamp(
935
973
  violations.push({
936
974
  rule: "RFC-IMP-03",
937
975
  message: `No commit referencing ${targetId} found in git history. Pass --implementation-commit <SHA> explicitly.`,
976
+ fixHint: `land an implementation commit via ecosystem.commit referencing ${targetId}, then pass --implementation-commit <sha>`,
938
977
  });
939
978
  } else {
940
979
  // Auto-resolve when exactly one candidate looks like an implementation
@@ -965,6 +1004,7 @@ export async function runRfcImplementStamp(
965
1004
  violations.push({
966
1005
  rule: "RFC-IMP-03",
967
1006
  message: `Multiple commits reference ${targetId}:\n${candidateList}\nPass --implementation-commit <SHA> to specify which one.${suggestion}`,
1007
+ fixHint: `pass --implementation-commit <sha> naming the commit that carries the implementation payload`,
968
1008
  });
969
1009
  }
970
1010
  }
@@ -980,6 +1020,7 @@ export async function runRfcImplementStamp(
980
1020
  violations.push({
981
1021
  rule: "RFC-IMP-04",
982
1022
  message: `RFC file ${rfcRelPath} has uncommitted changes. Commit the RFC file before stamping.`,
1023
+ fixHint: `commit or stash the uncommitted changes to ${rfcRelPath}, then re-run`,
983
1024
  });
984
1025
  }
985
1026
 
@@ -990,6 +1031,7 @@ export async function runRfcImplementStamp(
990
1031
  violations.push({
991
1032
  rule: "RFC-IMP-03",
992
1033
  message: `Implementation commit ${implementationCommit} is not reachable from HEAD. The commit must be an ancestor of the current HEAD.`,
1034
+ fixHint: `pass --implementation-commit <sha> naming an ancestor of HEAD`,
993
1035
  });
994
1036
  } else {
995
1037
  const referencesRfc = await commitReferencesRfc(
@@ -1001,6 +1043,7 @@ export async function runRfcImplementStamp(
1001
1043
  violations.push({
1002
1044
  rule: "RFC-IMP-03",
1003
1045
  message: `Implementation commit ${implementationCommit} does not reference ${targetId} in its message or changed files.`,
1046
+ fixHint: `pass --implementation-commit <sha> naming a commit that references ${targetId} in its message or changed files`,
1004
1047
  });
1005
1048
  } else {
1006
1049
  // ── RFC-1310 STAMP-GOV-01: commit-time governance provenance ──────
@@ -1023,6 +1066,7 @@ export async function runRfcImplementStamp(
1023
1066
  violations.push({
1024
1067
  rule: "STAMP-GOV-01",
1025
1068
  message: `Implementation commit(s) for ${targetId} carry no governance provenance (no X-RFC: ${targetId} trailer, no injected CHANGE_SUMMARY item) — scanned: ${scanShas.join(", ")}. Retro-fix: hand-edit CHANGE_SUMMARY <item>${targetId}: …</item> entries into the touched files' headers in the worktree, then land a follow-up ecosystem.commit --rfc ${targetId} --message "docs(${targetId.toLowerCase()}): retrofit governance provenance" and re-stamp.`,
1069
+ fixHint: `re-commit the implementation via ecosystem.commit so it carries governance provenance (or apply the retro-fix in the message), then pass --implementation-commit <sha>`,
1026
1070
  });
1027
1071
  }
1028
1072
  }
@@ -1054,13 +1098,16 @@ export async function runRfcImplementStamp(
1054
1098
  // must also be evaluated when hasProbes is now false, because probe
1055
1099
  // deletion IS a criteria change and would otherwise slip past
1056
1100
  // requiresEvidence entirely (RFC-IMP-08 exempts policy/deprecation kinds).
1057
- // let — --check-criteria re-reads the envelope after the emit-if-needed pass.
1101
+ // let — the repair pass re-reads the envelope after the emit-if-needed pass.
1058
1102
  let evidenceCheck = await checkExistingEvidence(workspaceRoot, targetId);
1059
1103
 
1060
- // Default path: IMP-06 + IMP-09 fire pre-lock via the shared evaluator —
1061
- // under --check-criteria the same ruleset runs inside the lock, after the
1062
- // emit-if-needed pass may have refreshed the envelope.
1063
- if (!checkCriteria) {
1104
+ // Default path: the shared evaluator fires pre-lock. --no-repair runs the
1105
+ // full gateset here; the default repair pass runs only the
1106
+ // envelope-independent subset (RFC-IMP-10/11/12/15) so composite reporting
1107
+ // is preserved — the envelope-dependent gates (RFC-IMP-06/09/13/14)
1108
+ // evaluate in-lock after the emit-if-needed pass may have refreshed the
1109
+ // envelope.
1110
+ {
1064
1111
  const gates = await evaluateStampEvidenceGates({
1065
1112
  evidenceCheck,
1066
1113
  requiresEvidence,
@@ -1074,6 +1121,7 @@ export async function runRfcImplementStamp(
1074
1121
  waiverReason,
1075
1122
  implementationCommit,
1076
1123
  waiveOutcome,
1124
+ gatePhase: repairEnabled ? "independent" : undefined,
1077
1125
  });
1078
1126
  violations.push(...gates.violations);
1079
1127
  stampWarnings.push(...gates.warnings);
@@ -1093,15 +1141,43 @@ export async function runRfcImplementStamp(
1093
1141
  });
1094
1142
  }
1095
1143
 
1144
+ // RFC-1463 composite reporting under the default repair pass: when the
1145
+ // run is already doomed pre-lock, the envelope-dependent gates still
1146
+ // evaluate on the current state (minus the repairable staleness findings
1147
+ // the refresh would fix anyway) so one report names every real blocker
1148
+ // instead of surfacing them serially across re-runs.
1149
+ if (repairEnabled && violations.length > 0) {
1150
+ const gates = await evaluateStampEvidenceGates({
1151
+ evidenceCheck,
1152
+ requiresEvidence,
1153
+ hasProbes,
1154
+ targetId,
1155
+ rfcFilePath,
1156
+ acceptance,
1157
+ io,
1158
+ frontmatter: fm,
1159
+ workspaceRoot,
1160
+ waiverReason,
1161
+ implementationCommit,
1162
+ waiveOutcome,
1163
+ gatePhase: "dependent",
1164
+ suppressRepairable: true,
1165
+ });
1166
+ violations.push(...gates.violations);
1167
+ stampWarnings.push(...gates.warnings);
1168
+ for (const w of gates.warnings) logger.warn(`${w.rule}: ${w.message}`);
1169
+ if (gates.evidenceRelPath) evidenceRelPath = gates.evidenceRelPath;
1170
+ }
1171
+
1096
1172
  // If any violations found, return without mutation
1097
1173
  if (violations.length > 0) {
1098
1174
  return stampFailResult(violations, isDryRun, outputFormat, logger);
1099
1175
  }
1100
1176
 
1101
1177
  // ── RFC-IMP-05: acquire RFC-specific exclusive lock ───────────────────────
1102
- // Under --check-criteria the lock must precede the FIRST write — which is
1103
- // the emit-if-needed envelope refresh, not the stamp mutation — so all
1104
- // envelope-independent gates above abort before this point.
1178
+ // Under the default repair pass the lock must precede the FIRST write —
1179
+ // which is the emit-if-needed envelope refresh, not the stamp mutation —
1180
+ // so all envelope-independent gates above abort before this point.
1105
1181
  const { acquired, lockPath } = await acquireRfcLock(workspaceRoot, targetId);
1106
1182
  if (!acquired) {
1107
1183
  violations.push({
@@ -1114,15 +1190,16 @@ export async function runRfcImplementStamp(
1114
1190
  try {
1115
1191
  // ── Atomic mutation ──────────────────────────────────────────────────────
1116
1192
  const rfcSource = await io.readFile(rfcFilePath);
1117
- // RFC-1322: the mutation-bound source — under --check-criteria it carries
1118
- // the auto-check flips; without the flag it is the committed file text.
1193
+ // RFC-1322: the mutation-bound source — under the default repair pass it
1194
+ // carries the auto-check flips; under --no-repair it is the committed
1195
+ // file text.
1119
1196
  let stampSource = rfcSource;
1120
1197
  let criteriaAutoChecked: string[] | undefined;
1121
1198
  let criteriaPendingRefresh: string[] = [];
1122
1199
  let evidenceWouldRefresh = false;
1123
1200
  let effectiveCriteriaChecked = criteriaEval.totalChecked;
1124
1201
 
1125
- if (checkCriteria) {
1202
+ if (repairEnabled) {
1126
1203
  // Emit-if-needed (RFC-1322 order step 4): a missing, malformed, or
1127
1204
  // hash-stale envelope is refreshed in-process through the same direct
1128
1205
  // runRfcVerificationEmit call the post-stamp re-emit uses — on the
@@ -1130,6 +1207,14 @@ export async function runRfcImplementStamp(
1130
1207
  // freshness precheck (RFC-1320) gates this emit exactly as a manual one.
1131
1208
  const needsEmit = hasProbes && envelopeNeedsRefresh(evidenceCheck, rfcSource, acceptance);
1132
1209
  evidenceWouldRefresh = needsEmit;
1210
+ // RFC-1483: the envelope emit is the first link of the repair chain —
1211
+ // computed for dry-run too, executed only on a real run.
1212
+ if (needsEmit) {
1213
+ repaired.push({
1214
+ kind: "envelope-emitted",
1215
+ detail: join(VERIFICATION_DIR, `${targetId.toLowerCase()}.generated.yaml`),
1216
+ });
1217
+ }
1133
1218
  if (needsEmit && !isDryRun) {
1134
1219
  let emitOk = false;
1135
1220
  let emitSummary = "";
@@ -1150,6 +1235,7 @@ export async function runRfcImplementStamp(
1150
1235
  violations.push({
1151
1236
  rule: "EVIDENCE-SYNC-02",
1152
1237
  message: `pre-stamp evidence emit for ${targetId} threw: ${emitErr instanceof Error ? emitErr.message : String(emitErr)}. Resolve the failing step and re-run the stamp.`,
1238
+ fixHint: `resolve the failing emit step, then re-run the stamp`,
1153
1239
  });
1154
1240
  return stampFailResult(violations, isDryRun, outputFormat, logger);
1155
1241
  }
@@ -1157,10 +1243,34 @@ export async function runRfcImplementStamp(
1157
1243
  violations.push({
1158
1244
  rule: "EVIDENCE-SYNC-02",
1159
1245
  message: `pre-stamp evidence emit for ${targetId} failed${emitSummary ? `: ${emitSummary}` : ""}. Resolve the failing step and re-run the stamp.`,
1246
+ fixHint: `resolve the failing emit step, then re-run the stamp`,
1160
1247
  });
1248
+ // Composite-gate semantics (RFC-1463): the failed emit is not the
1249
+ // whole story — evaluate the envelope-dependent gates against the
1250
+ // unrefreshed state so the report still names the violations the
1251
+ // refresh would have had to satisfy (e.g. RFC-IMP-13 on a missing
1252
+ // envelope). The independent subset already ran pre-lock.
1253
+ const stale = await evaluateStampEvidenceGates({
1254
+ evidenceCheck,
1255
+ requiresEvidence,
1256
+ hasProbes,
1257
+ targetId,
1258
+ rfcFilePath,
1259
+ acceptance,
1260
+ io,
1261
+ frontmatter: fm,
1262
+ workspaceRoot,
1263
+ waiverReason,
1264
+ implementationCommit,
1265
+ waiveOutcome,
1266
+ gatePhase: "dependent",
1267
+ });
1268
+ violations.push(...stale.violations);
1269
+ stampWarnings.push(...stale.warnings);
1270
+ for (const w of stale.warnings) logger.warn(`${w.rule}: ${w.message}`);
1161
1271
  return stampFailResult(violations, isDryRun, outputFormat, logger);
1162
1272
  }
1163
- logger.info(`[rfc.implement.stamp] --check-criteria: refreshed stale/missing envelope`);
1273
+ logger.info(`[rfc.implement.stamp] repair: refreshed stale/missing envelope`);
1164
1274
  evidenceCheck = await checkExistingEvidence(workspaceRoot, targetId);
1165
1275
  }
1166
1276
 
@@ -1184,11 +1294,13 @@ export async function runRfcImplementStamp(
1184
1294
  `${auto.failures.length} unchecked acceptance criteria lack resolvable (evidence: ...) annotations — ` +
1185
1295
  `supply a resolvable reference (test:<path>, file:<path>, <path>:<line>, or probe:AC-N bound to a passing envelope probe): ` +
1186
1296
  auto.failures.map((f) => `${f.criterion} [${f.annotation}]`).join("; "),
1297
+ fixHint: `annotate each listed criterion with a resolvable evidence reference — test:<path>, file:<path>, <path>:<line>, or probe:AC-N bound to a passing envelope probe`,
1187
1298
  });
1188
1299
  }
1189
1300
 
1190
1301
  if (auto.flippable.length > 0) {
1191
1302
  stampSource = flipCriteriaInSource(rfcSource, new Set(auto.flippable));
1303
+ repaired.push({ kind: "criteria-checked", detail: auto.flippedIds.join(",") });
1192
1304
  }
1193
1305
 
1194
1306
  // Post-flip criteria gates on the mutation-bound bytes (step 6): a
@@ -1203,21 +1315,24 @@ export async function runRfcImplementStamp(
1203
1315
  if (residualUnchecked.length > 0) {
1204
1316
  violations.push({
1205
1317
  rule: "RFC-IMP-02",
1206
- message: `${residualUnchecked.length} acceptance criteria remain unchecked after the --check-criteria pass: ${residualUnchecked.join("; ")}`,
1318
+ message: `${residualUnchecked.length} acceptance criteria remain unchecked after the repair pass: ${residualUnchecked.join("; ")}`,
1319
+ fixHint: `the repair pass could not flip these criteria — annotate a resolvable evidence reference on each and re-run`,
1207
1320
  });
1208
1321
  }
1209
1322
  if (postFlipEval.checkedWithoutEvidence.length > 0) {
1210
1323
  violations.push({
1211
1324
  rule: "RFC-IMP-02",
1212
1325
  message: `${postFlipEval.checkedWithoutEvidence.length} checked criteria lack inline (evidence: ...) annotation: ${postFlipEval.checkedWithoutEvidence.join("; ")}`,
1326
+ fixHint: `add an inline (evidence: ...) annotation to each listed checked criterion`,
1213
1327
  });
1214
1328
  }
1215
1329
  effectiveCriteriaChecked = postFlipEval.totalChecked;
1216
1330
 
1217
- // IMP-06 + IMP-09 against the (possibly just-refreshed) envelope via
1218
- // the shared evaluator — skipped in dry-run when a refresh would run,
1219
- // since committed-bytes verdicts are not predictive of the post-emit
1220
- // state the real stamp evaluates.
1331
+ // Envelope-dependent gates (RFC-IMP-06/09/13/14) against the (possibly
1332
+ // just-refreshed) envelope — skipped in dry-run when a refresh would
1333
+ // run, since committed-bytes verdicts are not predictive of the
1334
+ // post-emit state the real stamp evaluates. The independent subset
1335
+ // already reported pre-lock.
1221
1336
  if (!(isDryRun && needsEmit)) {
1222
1337
  const gates = await evaluateStampEvidenceGates({
1223
1338
  evidenceCheck,
@@ -1232,6 +1347,7 @@ export async function runRfcImplementStamp(
1232
1347
  waiverReason,
1233
1348
  implementationCommit,
1234
1349
  waiveOutcome,
1350
+ gatePhase: "dependent",
1235
1351
  });
1236
1352
  violations.push(...gates.violations);
1237
1353
  stampWarnings.push(...gates.warnings);
@@ -1277,13 +1393,15 @@ export async function runRfcImplementStamp(
1277
1393
  stampedAt,
1278
1394
  criteriaChecked: effectiveCriteriaChecked,
1279
1395
  criteriaTotal,
1280
- ...(checkCriteria
1396
+ dryRun: true,
1397
+ ...(repairEnabled
1281
1398
  ? {
1282
1399
  criteriaAutoChecked: criteriaAutoChecked ?? [],
1283
1400
  criteriaPendingRefresh,
1284
1401
  evidenceWouldRefresh,
1285
1402
  }
1286
1403
  : {}),
1404
+ ...(repaired.length > 0 ? { repaired } : {}),
1287
1405
  ...(evidenceRelPath ? { evidencePath: evidenceRelPath } : {}),
1288
1406
  },
1289
1407
  violations: [],
@@ -1293,7 +1411,7 @@ export async function runRfcImplementStamp(
1293
1411
  };
1294
1412
  }
1295
1413
 
1296
- // Write the mutated RFC file atomically — under --check-criteria this
1414
+ // Write the mutated RFC file atomically — under the repair pass this
1297
1415
  // single write carries the checkbox flips AND the frontmatter mutation.
1298
1416
  await writeFileAtomic(rfcFilePath, mutatedSource);
1299
1417
 
@@ -1368,7 +1486,8 @@ export async function runRfcImplementStamp(
1368
1486
  stampedAt,
1369
1487
  criteriaChecked: effectiveCriteriaChecked,
1370
1488
  criteriaTotal,
1371
- ...(checkCriteria ? { criteriaAutoChecked: criteriaAutoChecked ?? [] } : {}),
1489
+ ...(repairEnabled ? { criteriaAutoChecked: criteriaAutoChecked ?? [] } : {}),
1490
+ ...(repaired.length > 0 ? { repaired } : {}),
1372
1491
  ...(evidenceRelPath ? { evidencePath: evidenceRelPath } : {}),
1373
1492
  ...(hasProbes ? { evidenceReEmitted } : {}),
1374
1493
  ...(metricsPath ? { metricsPath } : {}),
@@ -1396,18 +1515,29 @@ function stampFailResult(
1396
1515
  logger: { warn: (msg: string) => void; info: (msg: string) => void },
1397
1516
  ): ForgeCommandResult<RfcImplementStampResult> {
1398
1517
  const prefix = isDryRun ? "[dry-run] " : "";
1518
+ // RFC-1483: the printed list IS the ordered remediation checklist —
1519
+ // prerequisite-rule violations sort by PREREQUISITE_ORDER; unlisted rules
1520
+ // keep their original relative order after the listed ones.
1521
+ const ordered = [...violations].sort((a, b) => {
1522
+ const ai = PREREQUISITE_ORDER.indexOf(a.rule);
1523
+ const bi = PREREQUISITE_ORDER.indexOf(b.rule);
1524
+ if (ai === -1 && bi === -1) return 0;
1525
+ if (ai === -1) return 1;
1526
+ if (bi === -1) return -1;
1527
+ return ai - bi;
1528
+ });
1399
1529
  if (outputFormat === "pretty") {
1400
- for (const v of violations) {
1401
- logger.warn(`${prefix}${v.rule}: ${v.message}`);
1530
+ for (const v of ordered) {
1531
+ logger.warn(`${prefix}${v.rule}: ${v.message}${v.fixHint ? `\n fix: ${v.fixHint}` : ""}`);
1402
1532
  }
1403
1533
  }
1404
1534
  return {
1405
1535
  data: {
1406
1536
  command: "rfc.implement.stamp",
1407
1537
  status: "fail",
1408
- violations,
1538
+ violations: ordered,
1409
1539
  },
1410
1540
  exitCode: 1,
1411
- summary: `${prefix}rfc.implement.stamp: ${violations.length} violation${violations.length === 1 ? "" : "s"}`,
1541
+ summary: `${prefix}rfc.implement.stamp: ${ordered.length} violation${ordered.length === 1 ? "" : "s"}`,
1412
1542
  };
1413
1543
  }
@@ -9,6 +9,7 @@ Unit tests for lifecycle covering RFC-CMD-02/03 cutoff behavior. It also guards
9
9
  </MODULE_CONTRACT>
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
+ <item>RFC-1482: emit validation-compliant RFC skeletons and surface contract breaches at authoring time</item>
12
13
  </CHANGE_SUMMARY>
13
14
  */
14
15
 
@@ -24,7 +25,7 @@ const testWorkspaceRoot = join(tmpdir(), "test");
24
25
  function makeParsed(
25
26
  status: string,
26
27
  createdAt: string,
27
- commands: { added?: string[]; changed?: string[] },
28
+ commands: { added?: string[]; changed?: string[]; removed?: string[] },
28
29
  ): ParsedRfc {
29
30
  return {
30
31
  frontmatter: {
@@ -139,3 +140,60 @@ describe("RFC-CMD-02/03 cutoff behavior", () => {
139
140
  expect(cmd02).toHaveLength(0);
140
141
  });
141
142
  });
143
+
144
+ describe("RFC-1482 RFC-CMD-03 early warning on commands.changed", () => {
145
+ async function collect(status: string, createdAt: string, commands: { changed?: string[]; removed?: string[] }, registry: string[] = []) {
146
+ const parsed = makeParsed(status, createdAt, commands);
147
+ const preParsed = new Map([["rfc-9999-test.md", { fileName: "rfc-9999-test.md", parsed }]]);
148
+ const { violations } = await collectRfcCommandLifecycleViolations(
149
+ testWorkspaceRoot,
150
+ ["rfc-9999-test.md"],
151
+ preParsed,
152
+ mockRegistry(registry),
153
+ );
154
+ return violations.filter((v) => v.rule === "RFC-CMD-03");
155
+ }
156
+
157
+ test("draft + unregistered changed name → warning (surfaced early)", async () => {
158
+ const cmd03 = await collect("draft", "2026-07-08", { changed: ["nonexistent.command"] });
159
+ expect(cmd03).toHaveLength(1);
160
+ expect(cmd03[0]?.severity).toBe("warning");
161
+ });
162
+
163
+ test("accepted + unregistered changed name → warning", async () => {
164
+ const cmd03 = await collect("accepted", "2026-07-08", { changed: ["nonexistent.command"] });
165
+ expect(cmd03).toHaveLength(1);
166
+ expect(cmd03[0]?.severity).toBe("warning");
167
+ });
168
+
169
+ test("implemented + unregistered changed name → error (blocking gate preserved)", async () => {
170
+ const cmd03 = await collect("implemented", "2026-07-08", { changed: ["nonexistent.command"] });
171
+ expect(cmd03).toHaveLength(1);
172
+ expect(cmd03[0]?.severity).toBe("error");
173
+ expect(cmd03[0]?.message).toContain(
174
+ 'implemented RFC lists "nonexistent.command" under commands.changed, but no live command is registered',
175
+ );
176
+ });
177
+
178
+ test("changed name present in commands.removed → no violation at any status", async () => {
179
+ for (const status of ["draft", "accepted", "implemented"]) {
180
+ const cmd03 = await collect(status, "2026-07-08", {
181
+ changed: ["nonexistent.command"],
182
+ removed: ["nonexistent.command"],
183
+ });
184
+ expect(cmd03, `status ${status}`).toHaveLength(0);
185
+ }
186
+ });
187
+
188
+ test("registered changed name → no violation", async () => {
189
+ for (const status of ["draft", "accepted", "implemented"]) {
190
+ const cmd03 = await collect(status, "2026-07-08", { changed: ["live.command"] }, ["live.command"]);
191
+ expect(cmd03, `status ${status}`).toHaveLength(0);
192
+ }
193
+ });
194
+
195
+ test("pre-cutoff draft → no warning", async () => {
196
+ const cmd03 = await collect("draft", "2026-01-01", { changed: ["nonexistent.command"] });
197
+ expect(cmd03).toHaveLength(0);
198
+ });
199
+ });