@warpgogol/forge 9.4.1 → 9.6.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 (411) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +30 -0
  3. package/README.uk.md +30 -0
  4. package/bin/cli.ts +163 -53
  5. package/dist/bin/cli.js +137 -42
  6. package/dist/bin/cli.js.map +1 -1
  7. package/dist/os/codebase/codebase.module.d.ts +3 -0
  8. package/dist/os/codebase/codebase.module.d.ts.map +1 -0
  9. package/dist/os/codebase/codebase.module.js +53 -0
  10. package/dist/os/codebase/codebase.module.js.map +1 -0
  11. package/dist/os/codebase/handlers/codebase-measure-symbols.d.ts +15 -0
  12. package/dist/os/codebase/handlers/codebase-measure-symbols.d.ts.map +1 -0
  13. package/dist/os/codebase/handlers/codebase-measure-symbols.js +97 -0
  14. package/dist/os/codebase/handlers/codebase-measure-symbols.js.map +1 -0
  15. package/dist/os/codebase/handlers/codebase-measure.d.ts +22 -0
  16. package/dist/os/codebase/handlers/codebase-measure.d.ts.map +1 -0
  17. package/dist/os/codebase/handlers/codebase-measure.js +435 -0
  18. package/dist/os/codebase/handlers/codebase-measure.js.map +1 -0
  19. package/dist/os/codebase/index.d.ts +4 -0
  20. package/dist/os/codebase/index.d.ts.map +1 -0
  21. package/dist/os/codebase/index.js +13 -0
  22. package/dist/os/codebase/index.js.map +1 -0
  23. package/dist/os/codebase/types.d.ts +35 -0
  24. package/dist/os/codebase/types.d.ts.map +1 -0
  25. package/dist/os/codebase/types.js +17 -0
  26. package/dist/os/codebase/types.js.map +1 -0
  27. package/dist/os/core/handlers/package-health.d.ts +6 -4
  28. package/dist/os/core/handlers/package-health.d.ts.map +1 -1
  29. package/dist/os/core/handlers/package-health.js +15 -20
  30. package/dist/os/core/handlers/package-health.js.map +1 -1
  31. package/dist/os/correctness/anchors.d.ts +24 -0
  32. package/dist/os/correctness/anchors.d.ts.map +1 -0
  33. package/dist/os/correctness/anchors.js +156 -0
  34. package/dist/os/correctness/anchors.js.map +1 -0
  35. package/dist/os/correctness/audit/bindings-verify-substance.d.ts +7 -0
  36. package/dist/os/correctness/audit/bindings-verify-substance.d.ts.map +1 -0
  37. package/dist/os/correctness/audit/bindings-verify-substance.js +145 -0
  38. package/dist/os/correctness/audit/bindings-verify-substance.js.map +1 -0
  39. package/dist/os/correctness/audit/differential.d.ts +7 -0
  40. package/dist/os/correctness/audit/differential.d.ts.map +1 -0
  41. package/dist/os/correctness/audit/differential.js +105 -0
  42. package/dist/os/correctness/audit/differential.js.map +1 -0
  43. package/dist/os/correctness/audit/ledger-orphans.d.ts +6 -0
  44. package/dist/os/correctness/audit/ledger-orphans.d.ts.map +1 -0
  45. package/dist/os/correctness/audit/ledger-orphans.js +71 -0
  46. package/dist/os/correctness/audit/ledger-orphans.js.map +1 -0
  47. package/dist/os/correctness/audit/ledger.d.ts +29 -0
  48. package/dist/os/correctness/audit/ledger.d.ts.map +1 -0
  49. package/dist/os/correctness/audit/ledger.js +72 -0
  50. package/dist/os/correctness/audit/ledger.js.map +1 -0
  51. package/dist/os/correctness/audit/run.d.ts +27 -0
  52. package/dist/os/correctness/audit/run.d.ts.map +1 -0
  53. package/dist/os/correctness/audit/run.js +184 -0
  54. package/dist/os/correctness/audit/run.js.map +1 -0
  55. package/dist/os/correctness/audit/schema-db.d.ts +32 -0
  56. package/dist/os/correctness/audit/schema-db.d.ts.map +1 -0
  57. package/dist/os/correctness/audit/schema-db.js +166 -0
  58. package/dist/os/correctness/audit/schema-db.js.map +1 -0
  59. package/dist/os/correctness/audit/snapshot.d.ts +34 -0
  60. package/dist/os/correctness/audit/snapshot.d.ts.map +1 -0
  61. package/dist/os/correctness/audit/snapshot.js +190 -0
  62. package/dist/os/correctness/audit/snapshot.js.map +1 -0
  63. package/dist/os/correctness/audit/sql-scanner.d.ts +28 -0
  64. package/dist/os/correctness/audit/sql-scanner.d.ts.map +1 -0
  65. package/dist/os/correctness/audit/sql-scanner.js +279 -0
  66. package/dist/os/correctness/audit/sql-scanner.js.map +1 -0
  67. package/dist/os/correctness/audit/sql-schema-conform.d.ts +17 -0
  68. package/dist/os/correctness/audit/sql-schema-conform.d.ts.map +1 -0
  69. package/dist/os/correctness/audit/sql-schema-conform.js +163 -0
  70. package/dist/os/correctness/audit/sql-schema-conform.js.map +1 -0
  71. package/dist/os/correctness/audit/state-transitions-coverage.d.ts +19 -0
  72. package/dist/os/correctness/audit/state-transitions-coverage.d.ts.map +1 -0
  73. package/dist/os/correctness/audit/state-transitions-coverage.js +263 -0
  74. package/dist/os/correctness/audit/state-transitions-coverage.js.map +1 -0
  75. package/dist/os/correctness/audit/tests/git-fixture.d.ts +15 -0
  76. package/dist/os/correctness/audit/tests/git-fixture.d.ts.map +1 -0
  77. package/dist/os/correctness/audit/tests/git-fixture.js +85 -0
  78. package/dist/os/correctness/audit/tests/git-fixture.js.map +1 -0
  79. package/dist/os/correctness/audit/types.d.ts +58 -0
  80. package/dist/os/correctness/audit/types.d.ts.map +1 -0
  81. package/dist/os/correctness/audit/types.js +34 -0
  82. package/dist/os/correctness/audit/types.js.map +1 -0
  83. package/dist/os/correctness/correctness.module.d.ts +3 -0
  84. package/dist/os/correctness/correctness.module.d.ts.map +1 -0
  85. package/dist/os/correctness/correctness.module.js +173 -0
  86. package/dist/os/correctness/correctness.module.js.map +1 -0
  87. package/dist/os/correctness/gate/frozen.d.ts +52 -0
  88. package/dist/os/correctness/gate/frozen.d.ts.map +1 -0
  89. package/dist/os/correctness/gate/frozen.js +322 -0
  90. package/dist/os/correctness/gate/frozen.js.map +1 -0
  91. package/dist/os/correctness/gate/origin.d.ts +28 -0
  92. package/dist/os/correctness/gate/origin.d.ts.map +1 -0
  93. package/dist/os/correctness/gate/origin.js +139 -0
  94. package/dist/os/correctness/gate/origin.js.map +1 -0
  95. package/dist/os/correctness/gate/repo.d.ts +25 -0
  96. package/dist/os/correctness/gate/repo.d.ts.map +1 -0
  97. package/dist/os/correctness/gate/repo.js +88 -0
  98. package/dist/os/correctness/gate/repo.js.map +1 -0
  99. package/dist/os/correctness/gate/run.d.ts +22 -0
  100. package/dist/os/correctness/gate/run.d.ts.map +1 -0
  101. package/dist/os/correctness/gate/run.js +430 -0
  102. package/dist/os/correctness/gate/run.js.map +1 -0
  103. package/dist/os/correctness/gate/runner.d.ts +18 -0
  104. package/dist/os/correctness/gate/runner.d.ts.map +1 -0
  105. package/dist/os/correctness/gate/runner.js +123 -0
  106. package/dist/os/correctness/gate/runner.js.map +1 -0
  107. package/dist/os/correctness/gate/tests/gate-fixture.d.ts +36 -0
  108. package/dist/os/correctness/gate/tests/gate-fixture.d.ts.map +1 -0
  109. package/dist/os/correctness/gate/tests/gate-fixture.js +153 -0
  110. package/dist/os/correctness/gate/tests/gate-fixture.js.map +1 -0
  111. package/dist/os/correctness/gate/types.d.ts +102 -0
  112. package/dist/os/correctness/gate/types.d.ts.map +1 -0
  113. package/dist/os/correctness/gate/types.js +64 -0
  114. package/dist/os/correctness/gate/types.js.map +1 -0
  115. package/dist/os/correctness/handlers/audit.d.ts +4 -0
  116. package/dist/os/correctness/handlers/audit.d.ts.map +1 -0
  117. package/dist/os/correctness/handlers/audit.js +95 -0
  118. package/dist/os/correctness/handlers/audit.js.map +1 -0
  119. package/dist/os/correctness/handlers/gate.d.ts +4 -0
  120. package/dist/os/correctness/handlers/gate.d.ts.map +1 -0
  121. package/dist/os/correctness/handlers/gate.js +62 -0
  122. package/dist/os/correctness/handlers/gate.js.map +1 -0
  123. package/dist/os/correctness/handlers/validate.d.ts +19 -0
  124. package/dist/os/correctness/handlers/validate.d.ts.map +1 -0
  125. package/dist/os/correctness/handlers/validate.js +367 -0
  126. package/dist/os/correctness/handlers/validate.js.map +1 -0
  127. package/dist/os/correctness/index.d.ts +8 -0
  128. package/dist/os/correctness/index.d.ts.map +1 -0
  129. package/dist/os/correctness/index.js +23 -0
  130. package/dist/os/correctness/index.js.map +1 -0
  131. package/dist/os/correctness/manifest-schema.d.ts +155 -0
  132. package/dist/os/correctness/manifest-schema.d.ts.map +1 -0
  133. package/dist/os/correctness/manifest-schema.js +110 -0
  134. package/dist/os/correctness/manifest-schema.js.map +1 -0
  135. package/dist/os/correctness/references.d.ts +22 -0
  136. package/dist/os/correctness/references.d.ts.map +1 -0
  137. package/dist/os/correctness/references.js +129 -0
  138. package/dist/os/correctness/references.js.map +1 -0
  139. package/dist/os/correctness/tests/fixture-workspace.d.ts +23 -0
  140. package/dist/os/correctness/tests/fixture-workspace.d.ts.map +1 -0
  141. package/dist/os/correctness/tests/fixture-workspace.js +104 -0
  142. package/dist/os/correctness/tests/fixture-workspace.js.map +1 -0
  143. package/dist/os/correctness/workspace.d.ts +32 -0
  144. package/dist/os/correctness/workspace.d.ts.map +1 -0
  145. package/dist/os/correctness/workspace.js +147 -0
  146. package/dist/os/correctness/workspace.js.map +1 -0
  147. package/dist/os/flow/correctness-step.d.ts +19 -0
  148. package/dist/os/flow/correctness-step.d.ts.map +1 -0
  149. package/dist/os/flow/correctness-step.js +133 -0
  150. package/dist/os/flow/correctness-step.js.map +1 -0
  151. package/dist/os/flow/digest.d.ts +18 -0
  152. package/dist/os/flow/digest.d.ts.map +1 -1
  153. package/dist/os/flow/digest.js +28 -1
  154. package/dist/os/flow/digest.js.map +1 -1
  155. package/dist/os/flow/dirty-classify.d.ts +7 -0
  156. package/dist/os/flow/dirty-classify.d.ts.map +1 -1
  157. package/dist/os/flow/dirty-classify.js +11 -0
  158. package/dist/os/flow/dirty-classify.js.map +1 -1
  159. package/dist/os/flow/flow.module.d.ts.map +1 -1
  160. package/dist/os/flow/flow.module.js +19 -4
  161. package/dist/os/flow/flow.module.js.map +1 -1
  162. package/dist/os/flow/handlers/flow-check.d.ts.map +1 -1
  163. package/dist/os/flow/handlers/flow-check.js +9 -9
  164. package/dist/os/flow/handlers/flow-check.js.map +1 -1
  165. package/dist/os/flow/handlers/flow-digest.d.ts.map +1 -1
  166. package/dist/os/flow/handlers/flow-digest.js +11 -1
  167. package/dist/os/flow/handlers/flow-digest.js.map +1 -1
  168. package/dist/os/flow/handlers/flow-integrate.d.ts +11 -0
  169. package/dist/os/flow/handlers/flow-integrate.d.ts.map +1 -1
  170. package/dist/os/flow/handlers/flow-integrate.js +148 -30
  171. package/dist/os/flow/handlers/flow-integrate.js.map +1 -1
  172. package/dist/os/flow/handlers/flow-open.d.ts.map +1 -1
  173. package/dist/os/flow/handlers/flow-open.js +14 -19
  174. package/dist/os/flow/handlers/flow-open.js.map +1 -1
  175. package/dist/os/flow/index.d.ts +1 -0
  176. package/dist/os/flow/index.d.ts.map +1 -1
  177. package/dist/os/flow/index.js +5 -3
  178. package/dist/os/flow/index.js.map +1 -1
  179. package/dist/os/flow/post-rebase-regen.d.ts +33 -0
  180. package/dist/os/flow/post-rebase-regen.d.ts.map +1 -0
  181. package/dist/os/flow/post-rebase-regen.js +120 -0
  182. package/dist/os/flow/post-rebase-regen.js.map +1 -0
  183. package/dist/os/flow/preflight.d.ts +24 -0
  184. package/dist/os/flow/preflight.d.ts.map +1 -1
  185. package/dist/os/flow/preflight.js +364 -24
  186. package/dist/os/flow/preflight.js.map +1 -1
  187. package/dist/os/flow/publish.d.ts.map +1 -1
  188. package/dist/os/flow/publish.js +23 -4
  189. package/dist/os/flow/publish.js.map +1 -1
  190. package/dist/os/flow/registry.d.ts +6 -6
  191. package/dist/os/flow/tests/helpers.d.ts +9 -1
  192. package/dist/os/flow/tests/helpers.d.ts.map +1 -1
  193. package/dist/os/flow/tests/helpers.js +36 -2
  194. package/dist/os/flow/tests/helpers.js.map +1 -1
  195. package/dist/os/friction/types.d.ts +2 -2
  196. package/dist/os/gate-run/detach.d.ts +27 -0
  197. package/dist/os/gate-run/detach.d.ts.map +1 -0
  198. package/dist/os/gate-run/detach.js +85 -0
  199. package/dist/os/gate-run/detach.js.map +1 -0
  200. package/dist/os/gate-run/gate-run.module.d.ts +3 -0
  201. package/dist/os/gate-run/gate-run.module.d.ts.map +1 -0
  202. package/dist/os/gate-run/gate-run.module.js +23 -0
  203. package/dist/os/gate-run/gate-run.module.js.map +1 -0
  204. package/dist/os/gate-run/index.d.ts +7 -0
  205. package/dist/os/gate-run/index.d.ts.map +1 -0
  206. package/dist/os/gate-run/index.js +5 -0
  207. package/dist/os/gate-run/index.js.map +1 -0
  208. package/dist/os/gate-run/record.d.ts +47 -0
  209. package/dist/os/gate-run/record.d.ts.map +1 -0
  210. package/dist/os/gate-run/record.js +157 -0
  211. package/dist/os/gate-run/record.js.map +1 -0
  212. package/dist/os/gate-run/status.d.ts +53 -0
  213. package/dist/os/gate-run/status.d.ts.map +1 -0
  214. package/dist/os/gate-run/status.js +163 -0
  215. package/dist/os/gate-run/status.js.map +1 -0
  216. package/dist/os/gate-run/types.d.ts +47 -0
  217. package/dist/os/gate-run/types.d.ts.map +1 -0
  218. package/dist/os/gate-run/types.js +24 -0
  219. package/dist/os/gate-run/types.js.map +1 -0
  220. package/dist/os/program/schemas.d.ts +3 -3
  221. package/dist/os/queue/types.d.ts +2 -2
  222. package/dist/os/rfc/evidence-annotation.d.ts +26 -0
  223. package/dist/os/rfc/evidence-annotation.d.ts.map +1 -0
  224. package/dist/os/rfc/evidence-annotation.js +52 -0
  225. package/dist/os/rfc/evidence-annotation.js.map +1 -0
  226. package/dist/os/rfc/handlers/fixed-inputs.d.ts.map +1 -1
  227. package/dist/os/rfc/handlers/fixed-inputs.js +7 -1
  228. package/dist/os/rfc/handlers/fixed-inputs.js.map +1 -1
  229. package/dist/os/rfc/handlers/implement-stamp-promotes.d.ts +8 -0
  230. package/dist/os/rfc/handlers/implement-stamp-promotes.d.ts.map +1 -0
  231. package/dist/os/rfc/handlers/implement-stamp-promotes.js +65 -0
  232. package/dist/os/rfc/handlers/implement-stamp-promotes.js.map +1 -0
  233. package/dist/os/rfc/handlers/implement-stamp.d.ts.map +1 -1
  234. package/dist/os/rfc/handlers/implement-stamp.js +35 -29
  235. package/dist/os/rfc/handlers/implement-stamp.js.map +1 -1
  236. package/dist/os/rfc/handlers/validate-rules.d.ts.map +1 -1
  237. package/dist/os/rfc/handlers/validate-rules.js +152 -11
  238. package/dist/os/rfc/handlers/validate-rules.js.map +1 -1
  239. package/dist/os/rfc/rfc.module.d.ts.map +1 -1
  240. package/dist/os/rfc/rfc.module.js +20 -7
  241. package/dist/os/rfc/rfc.module.js.map +1 -1
  242. package/dist/os/rfc/types.d.ts +12 -3
  243. package/dist/os/rfc/types.d.ts.map +1 -1
  244. package/dist/os/rfc/types.js +5 -2
  245. package/dist/os/rfc/types.js.map +1 -1
  246. package/dist/os/rfc/verify-workspace.d.ts +12 -0
  247. package/dist/os/rfc/verify-workspace.d.ts.map +1 -1
  248. package/dist/os/rfc/verify-workspace.js +155 -0
  249. package/dist/os/rfc/verify-workspace.js.map +1 -1
  250. package/dist/os/system/task-schemas.d.ts +1 -1
  251. package/dist/os/system/tests/helpers.d.ts.map +1 -1
  252. package/dist/os/system/tests/helpers.js +6 -1
  253. package/dist/os/system/tests/helpers.js.map +1 -1
  254. package/dist/os/werkstatt/handlers/schema.d.ts +1 -1
  255. package/dist/src/cli-flags.d.ts.map +1 -1
  256. package/dist/src/cli-flags.js +6 -0
  257. package/dist/src/cli-flags.js.map +1 -1
  258. package/dist/src/command-modules.d.ts +4 -0
  259. package/dist/src/command-modules.d.ts.map +1 -0
  260. package/dist/src/command-modules.js +42 -0
  261. package/dist/src/command-modules.js.map +1 -0
  262. package/dist/src/config/forge-config.d.ts +16 -1
  263. package/dist/src/config/forge-config.d.ts.map +1 -1
  264. package/dist/src/config/forge-config.js +27 -11
  265. package/dist/src/config/forge-config.js.map +1 -1
  266. package/dist/src/correctness/index.d.ts +32 -0
  267. package/dist/src/correctness/index.d.ts.map +1 -0
  268. package/dist/src/correctness/index.js +157 -0
  269. package/dist/src/correctness/index.js.map +1 -0
  270. package/dist/src/correctness/schema-hash.d.ts +15 -0
  271. package/dist/src/correctness/schema-hash.d.ts.map +1 -0
  272. package/dist/src/correctness/schema-hash.js +44 -0
  273. package/dist/src/correctness/schema-hash.js.map +1 -0
  274. package/dist/src/knowledge/schema.d.ts +1 -1
  275. package/dist/src/onboarding/agents-generate.d.ts.map +1 -1
  276. package/dist/src/onboarding/agents-generate.js +20 -3
  277. package/dist/src/onboarding/agents-generate.js.map +1 -1
  278. package/dist/src/onboarding/create.d.ts +7 -0
  279. package/dist/src/onboarding/create.d.ts.map +1 -1
  280. package/dist/src/onboarding/create.js +62 -9
  281. package/dist/src/onboarding/create.js.map +1 -1
  282. package/dist/src/types.d.ts +7 -0
  283. package/dist/src/types.d.ts.map +1 -1
  284. package/dist/src/types.js +2 -8
  285. package/dist/src/types.js.map +1 -1
  286. package/docs/reference/correctness-audit.md +91 -0
  287. package/docs/reference/correctness-gate.md +102 -0
  288. package/docs/reference/correctness-manifest.md +142 -0
  289. package/docs/reference/forge-yaml.md +15 -0
  290. package/os/codebase/codebase.module.ts +57 -0
  291. package/os/codebase/handlers/codebase-measure-symbols.ts +131 -0
  292. package/os/codebase/handlers/codebase-measure.ts +503 -0
  293. package/os/codebase/index.ts +21 -0
  294. package/os/codebase/types.ts +55 -0
  295. package/os/core/handlers/package-health.test.ts +24 -2
  296. package/os/core/handlers/package-health.ts +16 -19
  297. package/os/correctness/anchors.ts +182 -0
  298. package/os/correctness/audit/bindings-verify-substance.test.ts +79 -0
  299. package/os/correctness/audit/bindings-verify-substance.ts +155 -0
  300. package/os/correctness/audit/differential.test.ts +113 -0
  301. package/os/correctness/audit/differential.ts +131 -0
  302. package/os/correctness/audit/ledger-orphans.test.ts +96 -0
  303. package/os/correctness/audit/ledger-orphans.ts +84 -0
  304. package/os/correctness/audit/ledger.test.ts +65 -0
  305. package/os/correctness/audit/ledger.ts +103 -0
  306. package/os/correctness/audit/run.ts +220 -0
  307. package/os/correctness/audit/schema-db.ts +208 -0
  308. package/os/correctness/audit/snapshot.ts +211 -0
  309. package/os/correctness/audit/sql-scanner.test.ts +84 -0
  310. package/os/correctness/audit/sql-scanner.ts +289 -0
  311. package/os/correctness/audit/sql-schema-conform.test.ts +170 -0
  312. package/os/correctness/audit/sql-schema-conform.ts +178 -0
  313. package/os/correctness/audit/state-transitions-coverage.test.ts +141 -0
  314. package/os/correctness/audit/state-transitions-coverage.ts +271 -0
  315. package/os/correctness/audit/tests/git-fixture.ts +98 -0
  316. package/os/correctness/audit/types.ts +91 -0
  317. package/os/correctness/correctness-capture.test.ts +107 -0
  318. package/os/correctness/correctness-chain.test.ts +232 -0
  319. package/os/correctness/correctness-coverage.test.ts +86 -0
  320. package/os/correctness/correctness-mode.test.ts +108 -0
  321. package/os/correctness/correctness-substrate.test.ts +64 -0
  322. package/os/correctness/correctness.module.ts +182 -0
  323. package/os/correctness/gate/anchor-events.test.ts +77 -0
  324. package/os/correctness/gate/freeze-coverage.test.ts +218 -0
  325. package/os/correctness/gate/freeze-diff.test.ts +110 -0
  326. package/os/correctness/gate/frozen.ts +399 -0
  327. package/os/correctness/gate/gate-mode.test.ts +76 -0
  328. package/os/correctness/gate/hardening.test.ts +175 -0
  329. package/os/correctness/gate/oracle-edit.test.ts +83 -0
  330. package/os/correctness/gate/oracle-origin.test.ts +142 -0
  331. package/os/correctness/gate/origin.ts +175 -0
  332. package/os/correctness/gate/repo.ts +102 -0
  333. package/os/correctness/gate/run.ts +547 -0
  334. package/os/correctness/gate/runner.ts +136 -0
  335. package/os/correctness/gate/substrate-attestation.test.ts +71 -0
  336. package/os/correctness/gate/tests/gate-fixture.ts +205 -0
  337. package/os/correctness/gate/tier-high.test.ts +92 -0
  338. package/os/correctness/gate/types.ts +144 -0
  339. package/os/correctness/handlers/audit.ts +107 -0
  340. package/os/correctness/handlers/gate.ts +75 -0
  341. package/os/correctness/handlers/validate.ts +514 -0
  342. package/os/correctness/index.ts +24 -0
  343. package/os/correctness/manifest-schema.ts +174 -0
  344. package/os/correctness/references.ts +143 -0
  345. package/os/correctness/tests/fixture-workspace.ts +119 -0
  346. package/os/correctness/workspace.ts +167 -0
  347. package/os/flow/correctness-step.ts +166 -0
  348. package/os/flow/digest.ts +40 -1
  349. package/os/flow/dirty-classify.ts +13 -0
  350. package/os/flow/flow.module.ts +20 -4
  351. package/os/flow/handlers/flow-check.ts +17 -18
  352. package/os/flow/handlers/flow-digest.ts +11 -1
  353. package/os/flow/handlers/flow-integrate.ts +191 -39
  354. package/os/flow/handlers/flow-open.ts +24 -31
  355. package/os/flow/index.ts +5 -7
  356. package/os/flow/post-rebase-regen.ts +170 -0
  357. package/os/flow/preflight.ts +361 -27
  358. package/os/flow/publish.ts +23 -4
  359. package/os/flow/tests/flow-detachable.test.ts +31 -0
  360. package/os/flow/tests/flow-digest-correctness-trail.test.ts +55 -0
  361. package/os/flow/tests/flow-integrate-correctness-gate.test.ts +275 -0
  362. package/os/flow/tests/flow-integrate.post-rebase-regen.test.ts +234 -0
  363. package/os/flow/tests/flow-integrate.preflight.test.ts +26 -5
  364. package/os/flow/tests/flow-integrate.test.ts +77 -10
  365. package/os/flow/tests/helpers.ts +45 -24
  366. package/os/flow/tests/lockfile-induced.test.ts +328 -0
  367. package/os/gate-run/detach.ts +106 -0
  368. package/os/gate-run/gate-run.module.ts +25 -0
  369. package/os/gate-run/index.ts +16 -0
  370. package/os/gate-run/record.ts +194 -0
  371. package/os/gate-run/status.ts +201 -0
  372. package/os/gate-run/tests/gate-run-detach.test.ts +144 -0
  373. package/os/gate-run/tests/gate-run-record.test.ts +200 -0
  374. package/os/gate-run/tests/gate-run-status.test.ts +114 -0
  375. package/os/gate-run/types.ts +73 -0
  376. package/os/rfc/evidence-annotation.ts +61 -0
  377. package/os/rfc/handlers/fixed-inputs.test.ts +70 -0
  378. package/os/rfc/handlers/fixed-inputs.ts +11 -1
  379. package/os/rfc/handlers/implement-stamp-promotes.test.ts +214 -0
  380. package/os/rfc/handlers/implement-stamp-promotes.ts +79 -0
  381. package/os/rfc/handlers/implement-stamp.ts +40 -29
  382. package/os/rfc/handlers/list-create.test.ts +14 -5
  383. package/os/rfc/handlers/validate-evidence-shape.test.ts +218 -0
  384. package/os/rfc/handlers/validate-probe-meta.test.ts +71 -0
  385. package/os/rfc/handlers/validate-rules.ts +211 -21
  386. package/os/rfc/handlers/validate-transient-probes.test.ts +222 -0
  387. package/os/rfc/rfc-0000-template.md +10 -10
  388. package/os/rfc/rfc.module.ts +21 -7
  389. package/os/rfc/types.ts +16 -2
  390. package/os/rfc/verify-workspace-manifest.test.ts +55 -0
  391. package/os/rfc/verify-workspace.ts +167 -0
  392. package/os/system/tests/helpers.ts +6 -1
  393. package/package.json +57 -1
  394. package/profiles/typescript.yaml +16 -0
  395. package/skills/_shared/agent-operating-model.md +4 -0
  396. package/skills/fo/fo-idea-audit/SKILL.md +4 -0
  397. package/skills/fo/fo-idea-create-rfc/SKILL.md +6 -2
  398. package/skills/fo/fo-idea-implement/SKILL.md +8 -2
  399. package/skills/fo/fo-review/SKILL.md +16 -2
  400. package/skills/fo/fo-session-retro/SKILL.md +4 -2
  401. package/src/cli-flags.ts +7 -0
  402. package/src/command-modules.ts +62 -0
  403. package/src/config/forge-config.ts +37 -11
  404. package/src/correctness/index.ts +192 -0
  405. package/src/correctness/schema-hash.ts +59 -0
  406. package/src/onboarding/agents-generate.ts +20 -3
  407. package/src/onboarding/create.ts +59 -9
  408. package/src/tests/agents-generate-detach.test.ts +126 -0
  409. package/src/tests/codebase-measure-rfc-1581.test.ts +260 -0
  410. package/src/tests/command-modules.test.ts +34 -0
  411. package/src/types.ts +9 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@warpgogol/forge",
3
- "version": "9.4.1",
3
+ "version": "9.6.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -176,10 +176,18 @@
176
176
  "types": "./os/queue/index.ts",
177
177
  "default": "./os/queue/index.ts"
178
178
  },
179
+ "./os/gate-run": {
180
+ "types": "./os/gate-run/index.ts",
181
+ "default": "./os/gate-run/index.ts"
182
+ },
179
183
  "./os/queue-module": {
180
184
  "types": "./os/queue/queue.module.ts",
181
185
  "default": "./os/queue/queue.module.ts"
182
186
  },
187
+ "./os/gate-run-module": {
188
+ "types": "./os/gate-run/gate-run.module.ts",
189
+ "default": "./os/gate-run/gate-run.module.ts"
190
+ },
183
191
  "./authority": {
184
192
  "types": "./src/authority/index.ts",
185
193
  "default": "./src/authority/index.ts"
@@ -232,6 +240,18 @@
232
240
  "types": "./os/friction/friction.module.ts",
233
241
  "default": "./os/friction/friction.module.ts"
234
242
  },
243
+ "./os/correctness": {
244
+ "types": "./os/correctness/index.ts",
245
+ "default": "./os/correctness/index.ts"
246
+ },
247
+ "./correctness": {
248
+ "types": "./src/correctness/index.ts",
249
+ "default": "./src/correctness/index.ts"
250
+ },
251
+ "./os/correctness-module": {
252
+ "types": "./os/correctness/correctness.module.ts",
253
+ "default": "./os/correctness/correctness.module.ts"
254
+ },
235
255
  "./os/yaml": {
236
256
  "types": "./os/yaml/index.ts",
237
257
  "default": "./os/yaml/index.ts"
@@ -280,6 +300,14 @@
280
300
  "types": "./os/checks/index.ts",
281
301
  "default": "./os/checks/index.ts"
282
302
  },
303
+ "./os/codebase": {
304
+ "types": "./os/codebase/index.ts",
305
+ "default": "./os/codebase/index.ts"
306
+ },
307
+ "./os/codebase-module": {
308
+ "types": "./os/codebase/codebase.module.ts",
309
+ "default": "./os/codebase/codebase.module.ts"
310
+ },
283
311
  "./os/context-module": {
284
312
  "types": "./os/context/context.module.ts",
285
313
  "default": "./os/context/context.module.ts"
@@ -498,10 +526,18 @@
498
526
  "types": "./dist/os/queue/index.d.ts",
499
527
  "default": "./dist/os/queue/index.js"
500
528
  },
529
+ "./os/gate-run": {
530
+ "types": "./dist/os/gate-run/index.d.ts",
531
+ "default": "./dist/os/gate-run/index.js"
532
+ },
501
533
  "./os/queue-module": {
502
534
  "types": "./dist/os/queue/queue.module.d.ts",
503
535
  "default": "./dist/os/queue/queue.module.js"
504
536
  },
537
+ "./os/gate-run-module": {
538
+ "types": "./dist/os/gate-run/gate-run.module.d.ts",
539
+ "default": "./dist/os/gate-run/gate-run.module.js"
540
+ },
505
541
  "./conformance": {
506
542
  "types": "./dist/src/conformance/index.d.ts",
507
543
  "default": "./dist/src/conformance/index.js"
@@ -546,6 +582,18 @@
546
582
  "types": "./dist/os/friction/friction.module.d.ts",
547
583
  "default": "./dist/os/friction/friction.module.js"
548
584
  },
585
+ "./os/correctness": {
586
+ "types": "./dist/os/correctness/index.d.ts",
587
+ "default": "./dist/os/correctness/index.js"
588
+ },
589
+ "./correctness": {
590
+ "types": "./dist/src/correctness/index.d.ts",
591
+ "default": "./dist/src/correctness/index.js"
592
+ },
593
+ "./os/correctness-module": {
594
+ "types": "./dist/os/correctness/correctness.module.d.ts",
595
+ "default": "./dist/os/correctness/correctness.module.js"
596
+ },
549
597
  "./os/yaml": {
550
598
  "types": "./dist/os/yaml/index.d.ts",
551
599
  "default": "./dist/os/yaml/index.js"
@@ -598,6 +646,14 @@
598
646
  "types": "./dist/os/context/context.module.d.ts",
599
647
  "default": "./dist/os/context/context.module.js"
600
648
  },
649
+ "./os/codebase": {
650
+ "types": "./dist/os/codebase/index.d.ts",
651
+ "default": "./dist/os/codebase/index.js"
652
+ },
653
+ "./os/codebase-module": {
654
+ "types": "./dist/os/codebase/codebase.module.d.ts",
655
+ "default": "./dist/os/codebase/codebase.module.js"
656
+ },
601
657
  "./os/context": {
602
658
  "types": "./dist/os/context/index.d.ts",
603
659
  "default": "./dist/os/context/index.js"
@@ -540,6 +540,19 @@ workspace:
540
540
  - Engine: @warpgogol/forge
541
541
  - Plugin: @warpgogol/werkstatt-typescript
542
542
  - Stack profile: typescript
543
+ - path: docs/correctness.yaml
544
+ content: |
545
+ # Product correctness manifest (RFC-1578, forge/correctness-manifest@1).
546
+ # Each entry roots a check in a requirement (req | dna | rfc-ac |
547
+ # fixed-input | domain), anchors it to @ai-invariant[INV-…] code
548
+ # markers, and lists oracles with their substrate (L0 double · L1
549
+ # engine · L2 runtime · L3 live). Validate with:
550
+ # pnpm exec forge correctness.manifest.validate
551
+ # Reference: node_modules/@warpgogol/forge/docs/reference/correctness-manifest.md
552
+ schema: forge/correctness-manifest@1
553
+ entries: []
554
+ support: []
555
+ exemptions: []
543
556
  - path: hooks/worktree-setup.sh
544
557
  content: |
545
558
  #!/bin/sh
@@ -564,5 +577,8 @@ workspace:
564
577
  pnpm run "$script"
565
578
  fi
566
579
  done
580
+ # RFC-1579: cross-artifact correctness audit from the PRIMARY checkout's
581
+ # forge install — the session under judgment cannot edit or pin it away.
582
+ "$FLOW_PRIMARY/node_modules/.bin/forge" correctness.audit --base "$FLOW_BASE_SHA"
567
583
  install:
568
584
  - pnpm add -wD @warpgogol/forge @warpgogol/werkstatt-typescript @warpgogol/werkstatt-engine @warpgogol/werkstatt-shared prettier vitest typescript
@@ -50,6 +50,8 @@ New automated tests need a concrete reason: a protected requirement, a reproduce
50
50
  - **HIGH** — security, access rights, contracts, data, migrations, critical integrations, significant external effects: additionally verify negative scenarios, boundaries, invariants, rollback, compatibility. Use independent verification where it genuinely reduces risk (e.g. clean-context review).
51
51
  - **FORMAL** — only for important, stable, precisely specifiable properties where formalization cost is justified. Tool by task: Lean (math/inductive), Dafny (algorithm correctness), Verus (supported Rust), TLA+/model checking (protocols/concurrency), property/fuzz (broad input classes without full proof). Not installed globally, never mandatory for ordinary changes; record spec, assumptions, proof scope, tool version, and unverified runtime boundaries — a successful proof does not prove business intent or the whole system. Only a mechanical checker verdict (`proof.check` → `proved`, bound to a `forge/proof-spec@1` file) counts as formal-tier evidence — an agent-written argument, a random-sampling property test, or an unavailable checker never does.
52
52
 
53
+ Product correctness tiers (`forge.yaml` `correctness.tier`, enforced by `correctness.gate` at `flow.integrate`): at `high` a manifest oracle covers only when its bytes came from the clean-context verifier (the last commit touching it carries the verifier trailer pair); at `formal` each manifest entry additionally needs a `proof:` oracle whose `proof.check` verdict is `proved`.
54
+
53
55
  ## 8. Expectation sources
54
56
 
55
57
  Every significant check has an expectation origin:
@@ -61,6 +63,8 @@ Every significant check has an expectation origin:
61
63
 
62
64
  Another AI agent is not automatically an independent verifier — independence is defined by criterion origin, access to normative sources, and real ability to catch the executor's error. Declare the class on probes via `expectationSource:`; declare what a check does not cover via `limitations:`. The `self` class is derived from git history of the implementation range (acceptance transition → HEAD), not taken on the author's word: a probe whose declaration or test file changed after acceptance is `self` unless the change came from the sanctioned independent-verifier workflow, and a declaration that history contradicts blocks the stamp. Declare `self` honestly for checks you wrote while implementing.
63
65
 
66
+ A `self` oracle never covers an anchor of a product correctness manifest: `correctness.gate` derives each manifest oracle's origin from git (verifier trailer pair, a committed `forge/oracle-review@1` record naming its current sha256, or byte-identity with the governing RFC's acceptance commit) and refuses an `enforce`-mode integration whose entry is covered only by `self` oracles. Frozen oracles, captures, and support files change only through the verifier workflow; any other byte change is a weakening that lands only in an isolated session the operator accepts (`flow.integrate --accept-weakening`).
67
+
64
68
  ## 9. Evidence trust boundary
65
69
 
66
70
  An agent's claim that a check ran is not a substitute for the tool's result. Evidence binds: requirement identifier → expected-result source → verified code version → applicable criteria/checks → method and executed command → environment/tool → observed result → machine-artifact link → check limitations. Group checks into one reproducible result; no per-action receipts for trivia.
@@ -23,6 +23,9 @@ triggerPhrases: ["audit this RFC", "check RFC for ecosystem fit", "review RFC ag
23
23
  <item>RFC-1097: sweep — SKILL.md headers + classification fixes
24
24
 
25
25
  Sweep batch 1: add Compass v2 headers to 45 SKILL.md files (purpose derived from frontmatter description). Fix non-skill-markdown exclusion to check filename not workspace-relative path (packages/AGENTS.md escaped it). Add .coverage to ignoredDirs.</item>
26
+ <item>RFC-1578: correctness manifest, validator, promotes gate
27
+
28
+ Add os/correctness (forge/correctness-manifest@1, correctness.manifest.validate CORR-01..09), bindings.paths.correctnessManifest, bindings.commands.checkRun and the correctness section, promotes with V-55 and RFC-IMP-16, the typescript profile skeleton, reference pages, and the promotes marking in fo-idea-create-rfc/fo-idea-audit. Repoint the RFC-1391 AC-8 registry test at src/command-modules.ts (stale since RFC-1573) and close the types.ts header comment without a glob-shaped terminator (EC-33).</item>
26
29
  </CHANGE_SUMMARY>
27
30
  -->
28
31
 
@@ -138,6 +141,7 @@ This ecosystem is forward-only — no backward compatibility layers, no expand-t
138
141
  - **Status gate**: the RFC does not contain self-authorizing language ("may proceed while draft", "implementation can start before acceptance"). Draft RFCs cannot grant implementation permission.
139
142
  - **Implementation notes** reference the correct governance rules: RFC-XXXX (accepted→implemented transition), RFC-XXXX (if touching agent surface), RFC-XXXX (supersede escalation on invariant conflict), RFC-XXXX (verification evidence for probe-bearing RFCs).
140
143
  - **Anti-fabrication**: if the RFC's acceptance criteria include content authoring (prose, business records, claims), the criteria distinguish between code changes an agent can make and content that requires human authoring. The RFC must not claim content will be "auto-generated" when it requires human authoring.
144
+ - **Criterion promotion**: every criterion describing lasting behaviour (a write, a transition, a schema match, an accepted response shape) is listed in `promotes`; one-off criteria (registered command, file exists, doc literal) are not. Report each mis-marked criterion as a finding — promotion decides whether the behaviour stays checked by the product's correctness manifest after the stamp.
141
145
  - **Storage policy**: if the RFC touches persistence, it does not introduce cookies (`document.cookie`, `Set-Cookie`). Client-side persistence is `localStorage` only; server-side is `unstorage`.
142
146
  - **NEEDS CLARIFICATION markers**: List all unresolved `NEEDS CLARIFICATION` markers with line numbers. If none are found, state "No unresolved markers." Markers in `draft` status are informational; markers in `reviewing`+ status are a blocking finding.
143
147
 
@@ -20,12 +20,14 @@ triggerPhrases: ["подготовим RFC", "draft an RFC", "create a full RFC"
20
20
  </non-goals>
21
21
  </MODULE_CONTRACT>
22
22
  <CHANGE_SUMMARY>
23
- <item>RFC-1247: triggerPhrases vocabulary sync — mined operator phrasing applied to this skill's trigger set.</item>
24
23
  <item>RFC-1361: path-scoped commits by default — EC-24 pre-commit message lint with governed-prefix exemption</item>
25
24
  <item>RFC-1433: friction fast-path — step-3 grilling skipped when the caller supplies open/flagged docs/frictions.yaml entry ids; entries carry the justification, output stays draft.</item>
26
25
  <item>RFC-1455: fixed inputs bound to outcome probes — V-50/V-51 + skills</item>
27
26
  <item>RFC-1460: recurring frictions escalate to mechanical measures — FRICTION-06/07/08, registry flips, session-retro escalation</item>
28
- <history>RFC-1097</history>
27
+ <item>RFC-1578: correctness manifest, validator, promotes gate
28
+
29
+ Add os/correctness (forge/correctness-manifest@1, correctness.manifest.validate CORR-01..09), bindings.paths.correctnessManifest, bindings.commands.checkRun and the correctness section, promotes with V-55 and RFC-IMP-16, the typescript profile skeleton, reference pages, and the promotes marking in fo-idea-create-rfc/fo-idea-audit. Repoint the RFC-1391 AC-8 registry test at src/command-modules.ts (stale since RFC-1573) and close the types.ts header comment without a glob-shaped terminator (EC-33).</item>
30
+ <history>RFC-1097, RFC-1247</history>
29
31
  </CHANGE_SUMMARY>
30
32
  -->
31
33
 
@@ -85,6 +87,8 @@ Address every concern the grilling raises by adjusting the metadata, scope, or c
85
87
 
86
88
  Every grilling answer that fixes an observable value — verbatim copy, a label, a name, a decided option value — becomes a row in the RFC's `## Fixed inputs` section plus the `AC-N` criterion and outcome probe that checks it. Texts supplied by clients or operators are pasted into the row in full, never referenced by pointer.
87
89
 
90
+ Mark criteria that describe **lasting behaviour** in the frontmatter `promotes: [AC-N, …]` list — behaviour the product must keep after the stamp (a transition is written, a query matches the schema, a response shape is accepted). One-off criteria (a command is registered, a file exists, a doc names a value) stay unpromoted. `rfc.validate` refuses an id that is not one of the RFC's criteria (V-55); in a project binding a correctness manifest, `rfc.implement.stamp` refuses until each promoted criterion has a `source: rfc-ac` manifest entry (RFC-IMP-16).
91
+
88
92
  #### Friction fast-path
89
93
 
90
94
  Step 3 is skipped when the caller supplies `frictions: [F-NNNN, ...]` — ids of `open` or recurrence-flagged entries in `docs/frictions.yaml`. The registry entries are the justification: the friction and its measure already answer the grilling's "why" question, and the created file lands at `draft` under normal human architecture review — operator authority lives at the `draft → accepted` transition, not at file creation.
@@ -20,7 +20,6 @@ triggerPhrases: ["implement this RFC", "execute the implementation plan", "reali
20
20
  </non-goals>
21
21
  </MODULE_CONTRACT>
22
22
  <CHANGE_SUMMARY>
23
- <item>COMMIT-02: commit templates — governed ids moved to the scope position (fix(rfc-xxxx): repair …, never fix: RFC-XXXX — …); illegal trace: prefix replaced with docs(adr-xxxx):</item>
24
23
  <item>RFC-1440: fo-reproduce skill + pipeline wiring
25
24
 
26
25
  New fo-reproduce skill (bounded 5-attempt reproduction loop, no-source-
@@ -33,7 +32,10 @@ compass inventory regenerated.</item>
33
32
  <item>RFC-1522: defer mid-session rule-file edits and add handoff state checkpoint
34
33
 
35
34
  fo-idea-implement + fo-idea-plan: rule-file edits collect during plan steps and apply in one pass before rfc.verification.emit (F-0002 — every save re-arms IDE rules re-resolution). fo-handoff: every handoff carries a compact state: YAML block (goal/constraints/verified/changed/validation/rejected/next); dying sessions write it to .agents/memory/daily/<date>.md.</item>
36
- <history>RFC-1097, RFC-1224, RFC-1250, RFC-1310, RFC-1317, RFC-1322, RFC-1332, RFC-1333</history>
35
+ <item>RFC-1580: digest trail, manifest review export, operating model and skills
36
+
37
+ flow.digest lists X-Correctness-Weakening trailers and verifier-trailer commits (correctnessTrail, part of digestId); rfc.verify.workspace --manifest exports the oracle-review surface with MANIFEST-REVIEW-BUNDLE.md hashes; operating model §7 product tiers and §8 'a self oracle never covers an anchor of a product correctness manifest'; fo-review oracle review mode producing forge/oracle-review@1; fo-idea-implement step 4.4c; correctness-gate reference page; forge AGENTS.md gate rules.</item>
38
+ <history>COMMIT-02, RFC-1097, RFC-1224, RFC-1250, RFC-1310, RFC-1317, RFC-1322, RFC-1332, RFC-1333</history>
37
39
  </CHANGE_SUMMARY>
38
40
  -->
39
41
 
@@ -213,6 +215,10 @@ Only when the document declares `verificationTier: high`. Run after the implemen
213
215
  5. Disputed counterexamples go to the decision ledger for the operator. Repeat with a fresh verifier at most two fix rounds; a third failure parks the item.
214
216
  6. Stamping requires a committed `verdict: pass`, `isolation: subagent` report whose candidate is followed only by verifier-trailer or docs commits.
215
217
 
218
+ #### 4.4c. Oracle review for product correctness-manifest oracles
219
+
220
+ When the session added or changed oracles of the product correctness manifest (`ref(forge.yaml bindings.paths.correctnessManifest)`) — every promoted acceptance criterion's oracle included — run one oracle review before integrating: commit the implementation, export with `rfc.verify.workspace --manifest --candidate <committed-sha>`, dispatch `fo-review` in oracle review mode as a fresh clean-context subagent on that export, and commit the returned `forge/oracle-review@1` record in its own commit with `X-Expectation-Origin: independent-verifier` + `X-Verifier-Report: <record path>`. Until that record lands, `correctness.gate` counts the oracles as `self` and an `enforce`-mode integration refuses. A later edit by you to a reviewed oracle makes it `self` again (and, once frozen on develop, a weakening). Never pass `flow.integrate --accept-weakening` on your own — it is an operator decision.
221
+
216
222
  #### 4.5. Fix errors
217
223
 
218
224
  If any check in step 4.4 fails, fix every error:
@@ -20,7 +20,6 @@ triggerPhrases: ["проверим всё ли сделали правильно
20
20
  </non-goals>
21
21
  </MODULE_CONTRACT>
22
22
  <CHANGE_SUMMARY>
23
- <item>RFC-1247: triggerPhrases vocabulary sync — mined operator phrasing applied to this skill's trigger set.</item>
24
23
  <item>RFC-1250: review wave — QUEUE-07 gates un-parked opens only, ledger binding checks, fail-closed loader
25
24
 
26
25
  REVIEW-RFC-1250-01 findings: QUEUE-07 no longer fires on parked entries
@@ -36,7 +35,10 @@ gain collect riders (ADR code-trace, NC markers, audit-verdict guard).</item>
36
35
  <item>RFC-1333: step 4 — acceptance verification mode in fo-review, step 4.4b in fo-idea-implement, RFC-IMP-12 docs</item>
37
36
  <item>RFC-1454: review deviations recorded in the RFC — IMP-15 gate, V-49 provenance, skill contract</item>
38
37
  <item>RFC-1460: recurring frictions escalate to mechanical measures — FRICTION-06/07/08, registry flips, session-retro escalation</item>
39
- <history>RFC-1097, RFC-1250</history>
38
+ <item>RFC-1580: digest trail, manifest review export, operating model and skills
39
+
40
+ flow.digest lists X-Correctness-Weakening trailers and verifier-trailer commits (correctnessTrail, part of digestId); rfc.verify.workspace --manifest exports the oracle-review surface with MANIFEST-REVIEW-BUNDLE.md hashes; operating model §7 product tiers and §8 'a self oracle never covers an anchor of a product correctness manifest'; fo-review oracle review mode producing forge/oracle-review@1; fo-idea-implement step 4.4c; correctness-gate reference page; forge AGENTS.md gate rules.</item>
41
+ <history>RFC-1097, RFC-1247, RFC-1250</history>
40
42
  </CHANGE_SUMMARY>
41
43
  -->
42
44
 
@@ -85,6 +87,18 @@ Invoked as `fo-review --acceptance --rfc <RFC-id> --workspace <path>` by `fo-ide
85
87
  - **Isolation and model:** dispatch a fresh clean-context subagent per round; record `isolation` truthfully (`subagent | isolated-inline | inline`) and the model actually used. A different vendor model may be requested where the platform allows.
86
88
  - **Loop cap:** at most two fix rounds (round 0 verification, then rounds 1 and 2 after fixes). A third failing verdict parks the item for operator arbitration; disputed counterexamples go to the decision ledger, never resolved by the executor.
87
89
 
90
+ ## Oracle review mode
91
+
92
+ Invoked as a clean-context subagent by `fo-idea-implement` (and by correctness retrofit tasks) when a session adds or changes product correctness-manifest oracles. Input: the tree exported by `rfc.verify.workspace --manifest --candidate <sha>` — manifest, requirement documents, anchored code, oracle and support files, captures, and `MANIFEST-REVIEW-BUNDLE.md` with each oracle's sha256; plans, reviews, sessions, and narrative are stripped. Never the implementer's story.
93
+
94
+ Per oracle, decide `pass` or `fail`:
95
+
96
+ 1. It exercises its entry's requirement (the `ref` / `statement`), not a neighbouring behaviour.
97
+ 2. It asserts against the handle it attests (`attestSubstrate`), not a second, mocked one — record `attestedHandleIsUnderTest`.
98
+ 3. Its declared substrate (L0 double · L1 engine · L2 runtime · L3 live) is plausible for what it runs on; lifecycle oracles verify `forge.anchor` events against the attested database.
99
+
100
+ Output: a `forge/oracle-review@1` YAML record (`schema`, `reviewedAt`, `isolation: subagent`, `candidate`, `export: "rfc.verify.workspace --manifest"`, overall `verdict`, and per oracle `check`, `sha256` copied from the bundle, `verdict`, `attestedHandleIsUnderTest`, `notes`). The dispatcher writes it under `ref(forge.yaml bindings.paths.oracleReviewsDir)` (default `docs/correctness/reviews/`) and commits it in its own commit carrying `X-Expectation-Origin: independent-verifier` and `X-Verifier-Report: <record path>`. One review pass covers every oracle the session added. The implementer never edits a record or writes the trailer pair itself.
101
+
88
102
  ## Process
89
103
 
90
104
  ### 1. Identify the diff
@@ -20,7 +20,6 @@ triggerPhrases: ["завершаем", "протокол завершения",
20
20
  </non-goals>
21
21
  </MODULE_CONTRACT>
22
22
  <CHANGE_SUMMARY>
23
- <item>RFC-1528: worktree-first preamble — session-end writes go through a dedicated session worktree; docs.archive prefers the kernel host</item>
24
23
  <item>RFC-1531: add flow.integrate remediation flags on the shared dirty classifier</item>
25
24
  <item>RFC-1534: lint probe patterns, sync amends counterparts, name next free ledger id</item>
26
25
  <item>ADR-0126: docs-rule batch — 16 friction measures landed</item>
@@ -30,7 +29,8 @@ RFC-1460 harvest wave 2026-11-09: five draft RFCs (derive-and-repair flow
30
29
  surfaces, quiet kernel output, staged-commit/invocation guards, fixed-branch
31
30
  onboarding-status routing, forge task prettier coverage), seven docs-rule
32
31
  landings, registry flips — 25 entries served, F-0025 stays external.</item>
33
- <history>ADR-0119, ADR-0121, RFC-1097, RFC-1247, RFC-1433, RFC-1460, RFC-1487, RFC-1491</history>
32
+ <item>RFC-1460: session-end teardown — stop worktree-held dev servers before flow.integrate</item>
33
+ <history>ADR-0119, ADR-0121, RFC-1097, RFC-1247, RFC-1433, RFC-1460, RFC-1487, RFC-1491, RFC-1528</history>
34
34
  </CHANGE_SUMMARY>
35
35
  -->
36
36
 
@@ -205,8 +205,10 @@ for d in missions/*/workpiece; do [ -d "$d/.git" ] && echo "=== $d ===" && rtk g
205
205
  **3e. Integrate or discard the session flow branch:**
206
206
 
207
207
  - This step applies only when the session's cwd is a flow worktree — its branch is a registered `auto/session-*` entry (check `flow.status`; repositories not on the fixed branch model have no registered branches → skip silently). When the worktree-first preamble opened a retro worktree, run the integration from that worktree — the whole session's writes ride it.
208
+ - Before integrating, stop processes that hold files inside the session worktree — dev servers (`astro dev`, `vite dev`, `node --watch`, …) started during the session keep `node_modules`/build-output handles open and make `git worktree remove` fail with FLOW-INT-04 ("Directory not empty"): the branch still integrates, but an orphaned directory shell plus a stale server stay behind. Detect holders via `/proc` cwd links — `for d in /proc/[0-9]*/cwd; do readlink "$d"; done | grep -F "<worktree path>"` (or `lsof +D <worktree>`) — terminate them, then integrate.
208
209
  - After the clean-tree commit, run `flow.integrate` from the session worktree — it rebases the branch onto `develop`, runs the primary checkout's `hooks/integration-gate.sh`, and fast-forwards `develop`.
209
210
  - On a FLOW-INT-02 (rebase conflict) or FLOW-INT-05 (gate refusal) diagnostic, report the refusal and leave the branch for the next session — do not force-resolve inside session end.
211
+ - A FLOW-INT-04 (worktree removal failed) means the branch already integrated — only teardown failed: stop the file-holding process, confirm the worktree is unregistered (`git worktree list`), then remove the leftover directory.
210
212
  - A FLOW-INT-01 dirty refusal is different: `data.entries` carries each path's class (`disposable`/`work`/…) — remediate via the flow.integrate remediation flags (`--auto-clean` when every entry is disposable, `--autocommit` to sweep the rest into the fixed-subject commit) or leave the branch for the next session with the classification reported.
211
213
  - When the operator said to drop the work, run `flow.discard --reason "<operator words>"` instead of `flow.integrate`.
212
214
 
package/src/cli-flags.ts CHANGED
@@ -14,6 +14,7 @@ with `TypeError: targetId.toLowerCase is not a function`.</purpose>
14
14
  <item>RFC-1389 (port of RFC-1381): bare `-m` rewrites to `--message` when the merged schema declares `message` — other `-x` tokens stay KERNEL-ARG-01, now with honest hints (a known declared short alias, the command's single unsatisfied required non-boolean flag, or a truthful see-`--help` fallback) instead of the fabricated `--id <token>` template; alias-shaped tokens are never consumed as flag values.</item>
15
15
  <item>RFC-1395: port --output → --json alias into forge CLI parser</item>
16
16
  <item>RFC-1485: sweep compass headers — forge-src + forge root eslint</item>
17
+ <item>RFC-1568: durable gate-run records, --detach mechanics, and forge CLI wiring</item>
17
18
  </CHANGE_SUMMARY>
18
19
  */
19
20
 
@@ -34,6 +35,11 @@ export const CLI_UNIVERSAL_FLAGS: Record<string, ForgeFlagSpec> = {
34
35
  "dry-run": { kind: "boolean", description: "Report intended mutations without writing them." },
35
36
  force: { kind: "boolean", description: "Bypass a normally-blocking safety check." },
36
37
  help: { kind: "boolean", description: "Print command help instead of executing." },
38
+ detach: {
39
+ kind: "boolean",
40
+ description:
41
+ "RFC-1568: run a `detachable` command as a detached child — returns immediately with a run id; poll via gate.run.status.",
42
+ },
37
43
  };
38
44
 
39
45
  /**
@@ -43,6 +49,7 @@ export const CLI_UNIVERSAL_FLAGS: Record<string, ForgeFlagSpec> = {
43
49
  */
44
50
  const CLI_BOOLEAN_FLAGS = new Set<string>([
45
51
  "all",
52
+ "detach",
46
53
  "all-apps",
47
54
  "approve-all",
48
55
  "dry-run",
@@ -0,0 +1,62 @@
1
+ /*
2
+ <MODULE_CONTRACT>
3
+ <purpose>RFC-1573 — the single list of forge command modules. `bin/cli.ts`
4
+ buildRegistry() registers them; `src/onboarding/agents-generate.ts` reads
5
+ their declarations (the detachable set) for generated agent instructions.</purpose>
6
+ <non-goals>
7
+ <item>No registration — callers own the registry they build.</item>
8
+ <item>No second list anywhere else — add new modules here only.</item>
9
+ </non-goals>
10
+ </MODULE_CONTRACT>
11
+ */
12
+ import type { ForgeModule } from "./forge-module.ts";
13
+
14
+ /** Load every forge command module in registration order (lazy imports keep CLI start-up cheap). */
15
+ export async function loadForgeCommandModules(): Promise<ForgeModule[]> {
16
+ const modules: Array<ForgeModule | null> = [
17
+ await import("../os/core/core.module.ts").then((m) => m.createForgeCoreModule()),
18
+ await import("../os/rfc/rfc.module.ts").then((m) => m.createForgeRfcModule()),
19
+ await import("../os/adr/adr.module.ts").then((m) => m.createForgeAdrModule()),
20
+ await import("../os/plan/plan.module.ts").then((m) => m.createForgePlanModule()),
21
+ await import("../os/audit/audit.module.ts").then((m) => m.createForgeAuditModule()),
22
+ await import("../os/mission/mission.module.ts").then((m) => m.createForgeMissionModule()),
23
+ await import("../os/spec/spec.module.ts").then((m) => m.createForgeSpecModule()),
24
+ await import("../os/program/program.module.ts").then((m) => m.createForgeProgramModule()),
25
+ await import("../os/plugin/plugin.module.ts").then((m) => m.forgePluginModule),
26
+ await import("../os/workflow/workflow.module.ts").then((m) => m.createForgeWorkflowModule()),
27
+ await import("../os/naming/naming.module.ts").then((m) => m.createForgeNamingModule()),
28
+ await import("../os/compass/compass.module.ts").then((m) => m.forgeCompassModule),
29
+ await import("../os/werkstatt/werkstatt.module.ts").then((m) => m.forgeWerkstattModule),
30
+ await import("../os/session/session.module.ts").then((m) => m.createForgeSessionModule()),
31
+ await import("../os/exploration/exploration.module.ts").then((m) =>
32
+ m.createForgeExplorationModule(),
33
+ ),
34
+ await import("../os/notes/notes.module.ts").then((m) => m.createForgeNotesModule()),
35
+ await import("../os/queue/queue.module.ts").then((m) => m.createForgeQueueModule()),
36
+ await import("../os/gate-run/gate-run.module.ts").then((m) => m.createForgeGateRunModule()),
37
+ await import("../os/authority/authority.module.ts").then((m) => m.createForgeAuthorityModule()),
38
+ await import("../os/conformance/conformance.module.ts").then((m) =>
39
+ m.createForgeConformanceModule(),
40
+ ),
41
+ await import("../os/flow/flow.module.ts").then((m) => m.createForgeFlowModule()),
42
+ await import("../os/system/system.module.ts").then((m) => m.createForgeSystemModule()),
43
+ await import("../os/formal/formal.module.ts").then((m) => m.createForgeFormalModule()),
44
+ await import("../os/friction/friction.module.ts").then((m) => m.createForgeFrictionModule()),
45
+ await import("../os/yaml/yaml.module.ts").then((m) => m.createForgeYamlModule()),
46
+ await import("../os/resolver/resolver.module.ts").then((m) => m.forgeResolverModule),
47
+ await import("../os/instructions/instructions.module.ts").then(
48
+ (m) => m.forgeInstructionsModule,
49
+ ),
50
+ await import("../os/agent/agent.module.ts").then((m) => m.forgeAgentModule),
51
+ await import("../os/knowledge/knowledge.module.ts").then((m) => m.forgeKnowledgeModule),
52
+ await import("../os/gate/gate.module.ts").then((m) => m.forgeGateModule),
53
+ await import("../os/checks/checks.module.ts").then((m) => m.forgeChecksModule),
54
+ await import("../os/context/context.module.ts").then((m) => m.forgeContextModule),
55
+ await import("../os/trajectory/trajectory.module.ts").then((m) => m.forgeTrajectoryModule),
56
+ await import("../os/correctness/correctness.module.ts").then((m) =>
57
+ m.createForgeCorrectnessModule(),
58
+ ),
59
+ await import("../os/codebase/codebase.module.ts").then((m) => m.createForgeCodebaseModule()),
60
+ ];
61
+ return modules.filter((m): m is ForgeModule => m !== null);
62
+ }
@@ -6,19 +6,18 @@
6
6
  </non-goals>
7
7
  </MODULE_CONTRACT>
8
8
  <CHANGE_SUMMARY>
9
- <item>RFC-1391: close RFC-1391 review r1 findings — evidence freshness, config classification, contract guards
10
-
11
- REVIEW-CODE-2026-10-24-04 (warning): a stale .cache/proofs report could
12
- fabricate proved; forge.yaml now resolves inside runProofCheck so a malformed
13
- config is error not unavailable, and both surfaces share one path; {entry} is
14
- required in formal.tools.command; spec/entry paths are confined to the
15
- workspace; the exhaustive entry dispatches per packageManager; proved runs
16
- record log, counterexample stays the refuted-path record.</item>
17
- <item>RFC-1453: executed outcome probes, IMP-14 surface gate, outcome.serve + V-47/V-48</item>
18
- <item>RFC-1481: close REVIEW-CODE-2026-11-01-11 findings on resolver safety, IO boundaries, and reporting</item>
19
9
  <item>RFC-1493: step 4 — remove per-commit version bump, PC-01..04, version log; one commit path with universal X-RFC/X-ADR trailers</item>
20
10
  <item>RFC-1539: package-sourced specs and published consumer validators in Forge</item>
21
- <history>RFC-0391, RFC-0393, RFC-0537, RFC-0538, RFC-0539, RFC-0540, RFC-0543, RFC-0546, RFC-0639, RFC-0640, RFC-0643, RFC-0661, RFC-0662, RFC-0704, RFC-1097, RFC-1224, RFC-1332, RFC-1365, RFC-1391</history>
11
+ <item>RFC-1578: correctness manifest, validator, promotes gate
12
+
13
+ Add os/correctness (forge/correctness-manifest@1, correctness.manifest.validate CORR-01..09), bindings.paths.correctnessManifest, bindings.commands.checkRun and the correctness section, promotes with V-55 and RFC-IMP-16, the typescript profile skeleton, reference pages, and the promotes marking in fo-idea-create-rfc/fo-idea-audit. Repoint the RFC-1391 AC-8 registry test at src/command-modules.ts (stale since RFC-1573) and close the types.ts header comment without a glob-shaped terminator (EC-33).</item>
14
+ <item>RFC-1579: correctness.audit auditors and differential attribution
15
+
16
+ Add os/correctness/audit: tree snapshots (working tree, index, base via one cat-file batch with git-grep prefilter), literal scanner + SQL classifier, wrangler D1 schema builder on node:sqlite, the four auditors (sql.schema.conform, ledger.orphans, state.transitions.coverage, bindings.verify.substance), subject-keyed differential attribution with allow-list, survival ledger, the correctness.audit handler and registration, and bindings.paths.correctnessLedger.</item>
17
+ <item>RFC-1580: correctness.gate and the flow.integrate step
18
+
19
+ Add os/correctness/gate (frozen set at --base, weakening diff incl. byte changes without verifier trailers and frozen exempt mode, git-derived oracle origin with forge/oracle-review@1 records, argv oracle runner with timeout, schema-hash substrate attestation, anchor events, tier high/formal, forge/correctness-bundle@1), the correctness.gate command, test-side helpers @warpgogol/forge/correctness, bindings.paths.oracleReviewsDir, and flow.integrate spawning the primary install's gate after hooks/integration-gate.sh (FLOW-INT-18, --accept-weakening with an X-Correctness-Weakening trailer commit). Flow and system test primaries get a stand-in forge binary; integration warnings now survive the cleanup report.</item>
20
+ <history>RFC-0391, RFC-0393, RFC-0537, RFC-0538, RFC-0539, RFC-0540, RFC-0543, RFC-0546, RFC-0639, RFC-0640, RFC-0643, RFC-0661, RFC-0662, RFC-0704, RFC-1097, RFC-1224, RFC-1332, RFC-1365, RFC-1391, RFC-1453, RFC-1481</history>
22
21
  </CHANGE_SUMMARY>
23
22
  */
24
23
 
@@ -62,6 +61,9 @@ export const forgeBindingsSchema = z.object({
62
61
  // serve ({target} → first stdout line {"url","pid"}, keep running).
63
62
  outcomeBuild: z.string().nullable().default(null),
64
63
  outcomeServe: z.string().nullable().default(null),
64
+ // RFC-1578: runs one correctness-manifest oracle ({file} placeholder);
65
+ // required when correctness.mode is enforce.
66
+ checkRun: z.string().nullable().default(null),
65
67
  // RFC-1224: consumer-defined command keys (e.g. createRfc) stay in the
66
68
  // parsed config so resolveBinding can resolve them.
67
69
  })
@@ -72,6 +74,12 @@ export const forgeBindingsSchema = z.object({
72
74
  reviewsDir: z.string().nullable().default(null),
73
75
  handoffsDir: z.string().nullable().default(null),
74
76
  sessionsDir: z.string().nullable().default(null),
77
+ // RFC-1578: product correctness manifest — null = no manifest declared.
78
+ correctnessManifest: z.string().nullable().default(null),
79
+ // RFC-1579: survival ledger written by `correctness.audit --write-ledger`.
80
+ correctnessLedger: z.string().nullable().default(null),
81
+ // RFC-1580: committed forge/oracle-review@1 records (null = docs/correctness/reviews).
82
+ oracleReviewsDir: z.string().nullable().default(null),
75
83
  }),
76
84
  terminology: z.record(z.string(), z.string()).default({}),
77
85
  // RFC-1096: consumer-level Compass policy overrides (same shape as the
@@ -129,6 +137,8 @@ export interface ForgeBindings {
129
137
  // RFC-1453: outcome-probe bindings ({target} placeholder).
130
138
  outcomeBuild: string | null;
131
139
  outcomeServe: string | null;
140
+ // RFC-1578: runs one correctness-manifest oracle ({file} placeholder).
141
+ checkRun?: string | null;
132
142
  };
133
143
  paths: {
134
144
  invariantsFile: string | null;
@@ -136,6 +146,12 @@ export interface ForgeBindings {
136
146
  reviewsDir: string | null;
137
147
  handoffsDir: string | null;
138
148
  sessionsDir: string | null;
149
+ // RFC-1578: product correctness manifest — null/absent = no manifest declared.
150
+ correctnessManifest?: string | null;
151
+ // RFC-1579: survival ledger (null/absent = docs/maintenance-debt/correctness.ledger.yaml).
152
+ correctnessLedger?: string | null;
153
+ // RFC-1580: oracle review records (null/absent = docs/correctness/reviews).
154
+ oracleReviewsDir?: string | null;
139
155
  };
140
156
  terminology: Record<string, string>;
141
157
  compass?: CompassPolicyOverrides;
@@ -360,6 +376,12 @@ export const forgeConfigSchema = z
360
376
  * passing outcome probe (RFC-IMP-14). Absent means no surfaces declared.
361
377
  */
362
378
  outcomeSurfaces: z.array(z.string()).default([]),
379
+ /**
380
+ * RFC-1578: product correctness section (`mode`, `tier`). Loosely typed
381
+ * here on purpose — `correctness.manifest.validate` reports invalid values
382
+ * as CORR-02 instead of every forge command failing to load forge.yaml.
383
+ */
384
+ correctness: z.record(z.string(), z.unknown()).optional(),
363
385
  // RFC-1224: consumer-owned top-level sections (e.g. `plugins:`) stay in the
364
386
  // parsed config so full-serialization writes do not silently drop them.
365
387
  })
@@ -407,6 +429,8 @@ export interface ForgeConfig {
407
429
  profileResolution?: "resolved" | "unknown" | "absent" | "catalog-unavailable";
408
430
  /** RFC-1453: picomatch globs naming user-visible outcome surfaces (RFC-IMP-14). */
409
431
  outcomeSurfaces: string[];
432
+ /** RFC-1578: raw `correctness:` section — validated by correctness.manifest.validate (CORR-02). */
433
+ correctness?: Record<string, unknown>;
410
434
  }
411
435
 
412
436
  // ---------------------------------------------------------------------------
@@ -478,6 +502,7 @@ export function applyCliBindingDefaults(pm: string): ForgeBindings["commands"] {
478
502
  verifyReproduction: null,
479
503
  outcomeBuild: null,
480
504
  outcomeServe: null,
505
+ checkRun: null,
481
506
  };
482
507
  for (const entry of FORGE_CLI_BINDING_DEFAULTS) {
483
508
  const bareKey = entry.key.replace("commands.", "") as keyof ForgeBindings["commands"];
@@ -525,6 +550,7 @@ export function defaultForgeConfig(projectName: string, packageManager?: string)
525
550
  reviewsDir: "docs/reviews",
526
551
  handoffsDir: "docs/handoffs",
527
552
  sessionsDir: "docs/sessions",
553
+ correctnessManifest: null,
528
554
  },
529
555
  terminology: {},
530
556
  compass: {},