agentic-qe 3.13.12 → 3.14.1

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 (502) hide show
  1. package/.claude/helpers/brain-checkpoint.cjs +2 -1
  2. package/.claude/helpers/validate-v3-config.sh +6 -5
  3. package/.claude/hooks/aqe-hook.cjs +14 -14
  4. package/.claude/skills/qe-browser/evals/qe-browser.yaml +30 -41
  5. package/.claude/skills/qe-browser/fixtures/serve-skills.js +37 -0
  6. package/.claude/skills/qe-browser/scripts/lib/vibium.js +1 -1
  7. package/.claude/skills/qe-browser/scripts/smoke-test.sh +56 -25
  8. package/.claude/skills/qe-browser/scripts/visual-diff.js +24 -15
  9. package/.claude/skills/qe-court/SKILL.md +4 -4
  10. package/.claude/skills/qe-court/config-schema.json +38 -0
  11. package/.claude/skills/qe-court/evals/qe-court.yaml +8 -8
  12. package/.claude/skills/skills-manifest.json +1 -1
  13. package/CHANGELOG.md +130 -0
  14. package/assets/skills/qe-browser/evals/qe-browser.yaml +30 -41
  15. package/assets/skills/qe-browser/fixtures/serve-skills.js +37 -0
  16. package/assets/skills/qe-browser/scripts/lib/vibium.js +1 -1
  17. package/assets/skills/qe-browser/scripts/smoke-test.sh +56 -25
  18. package/assets/skills/qe-browser/scripts/visual-diff.js +24 -15
  19. package/assets/skills/qe-court/SKILL.md +4 -4
  20. package/assets/skills/qe-court/config-schema.json +38 -0
  21. package/assets/skills/qe-court/evals/qe-court.yaml +8 -8
  22. package/assets/skills/skills-manifest.json +1 -1
  23. package/dist/cli/brain-commands.d.ts +1 -0
  24. package/dist/cli/brain-commands.js +1 -0
  25. package/dist/cli/bundle.js +7 -7
  26. package/dist/cli/chunks/adapter-I2N7PEKG.js +2 -0
  27. package/dist/cli/chunks/{agent-booster-wasm-7I7LZFNC.js → agent-booster-wasm-OY5Y2CUM.js} +2 -2
  28. package/dist/cli/chunks/{agent-handler-QZZT52BH.js → agent-handler-TUOH55LD.js} +2 -2
  29. package/dist/cli/chunks/{agent-memory-branch-MLQS5Y26.js → agent-memory-branch-XM3IYKT3.js} +2 -2
  30. package/dist/cli/chunks/aqe-learning-engine-U4ALUH6A.js +2 -0
  31. package/dist/cli/chunks/{arena-WRIY37EJ.js → arena-DOCLIEBL.js} +4 -4
  32. package/dist/cli/chunks/{arena-IM4CP6LP.js → arena-UMFJZKG7.js} +2 -2
  33. package/dist/cli/chunks/{audit-BSAQ4EFN.js → audit-KZLU5VLW.js} +3 -3
  34. package/dist/cli/chunks/base-RCYIBNHM.js +2 -0
  35. package/dist/cli/chunks/{better-sqlite3-X2XZUXWZ.js → better-sqlite3-MIEZBNUI.js} +2 -2
  36. package/dist/cli/chunks/brain-handler-6PZN46B7.js +90 -0
  37. package/dist/cli/chunks/{branch-enumerator-NI4Q7DSJ.js → branch-enumerator-XCETHA4F.js} +2 -2
  38. package/dist/cli/chunks/{browser-PXBLORUZ.js → browser-UEXISDCJ.js} +2 -2
  39. package/dist/cli/chunks/browser-workflow-L6TDB5O5.js +2 -0
  40. package/dist/cli/chunks/{chunk-5PNQNBDZ.js → chunk-3AYNHOWS.js} +1 -1
  41. package/dist/cli/chunks/{chunk-NL2SCAGJ.js → chunk-3BRR2FLH.js} +3 -3
  42. package/dist/cli/chunks/chunk-3FFMUB3B.js +14 -0
  43. package/dist/cli/chunks/{chunk-GJJWXRAD.js → chunk-3JMSXOU4.js} +2 -2
  44. package/dist/cli/chunks/{chunk-MB2KLJ6Q.js → chunk-3TMUCJNJ.js} +1 -1
  45. package/dist/cli/chunks/{chunk-JVFZAJ5N.js → chunk-3WSH4HD2.js} +2 -2
  46. package/dist/cli/chunks/{chunk-SCQNISGS.js → chunk-3XRXUVUI.js} +1 -1
  47. package/dist/cli/chunks/{chunk-Z56BBX77.js → chunk-45S5553E.js} +2 -2
  48. package/dist/cli/chunks/{chunk-6BSZHNOC.js → chunk-4MT62HKK.js} +1 -1
  49. package/dist/cli/chunks/{chunk-PVINNJ4P.js → chunk-4ZLFUO4I.js} +2 -2
  50. package/dist/cli/chunks/{chunk-MYVKTG55.js → chunk-5F5V4QYU.js} +3 -3
  51. package/dist/cli/chunks/{chunk-2W3D5A4R.js → chunk-5KP62DC3.js} +2 -2
  52. package/dist/cli/chunks/{chunk-BODFJ3DC.js → chunk-5NSSJUWW.js} +2 -2
  53. package/dist/cli/chunks/{chunk-KXSUDN46.js → chunk-5T6PAUZD.js} +1 -1
  54. package/dist/cli/chunks/{chunk-7ZVO7I4Q.js → chunk-5TYGSQOL.js} +1 -1
  55. package/dist/cli/chunks/{chunk-M7CPJW53.js → chunk-5Y2QFSVZ.js} +2 -2
  56. package/dist/cli/chunks/{chunk-VQD2ELNL.js → chunk-6B77GPWL.js} +2 -2
  57. package/dist/cli/chunks/{chunk-GJUGG6UR.js → chunk-6DDMHZWH.js} +2 -2
  58. package/dist/cli/chunks/{chunk-IPZEBALY.js → chunk-6HMNN2Y2.js} +54 -54
  59. package/dist/cli/chunks/{chunk-M73KM3AZ.js → chunk-6YIMLUH6.js} +160 -26
  60. package/dist/cli/chunks/{chunk-UBOGJHWC.js → chunk-6Z6Y3YBX.js} +1 -1
  61. package/dist/cli/chunks/{chunk-M3354CE4.js → chunk-75SC3GEX.js} +2 -2
  62. package/dist/cli/chunks/{chunk-TJVTV3HP.js → chunk-7AF55H2D.js} +2 -2
  63. package/dist/cli/chunks/{chunk-3XVZHJQT.js → chunk-7AYTM426.js} +1 -1
  64. package/dist/cli/chunks/{chunk-U5G6OC2C.js → chunk-7GF6IRSU.js} +2 -2
  65. package/dist/cli/chunks/{chunk-LRO74LPA.js → chunk-7XL2D56F.js} +4 -4
  66. package/dist/cli/chunks/{chunk-MGKH4LCM.js → chunk-A6RB34Y6.js} +1 -1
  67. package/dist/cli/chunks/{chunk-X2SZCVDA.js → chunk-AESYVAPH.js} +8 -7
  68. package/dist/cli/chunks/{chunk-3ASVQILY.js → chunk-AZUC7E5S.js} +2 -2
  69. package/dist/cli/chunks/{chunk-R7LGVJMZ.js → chunk-B6Y6AF4M.js} +2 -2
  70. package/dist/cli/chunks/chunk-C3XNFIOM.js +2 -0
  71. package/dist/cli/chunks/{chunk-ZSAGRDXA.js → chunk-CBWF42ET.js} +2 -2
  72. package/dist/cli/chunks/{chunk-VNODKACB.js → chunk-CCZZZBAO.js} +2 -2
  73. package/dist/cli/chunks/{chunk-5E76HULA.js → chunk-CGDW47WP.js} +2 -2
  74. package/dist/cli/chunks/chunk-CGZ7LTUK.js +2 -0
  75. package/dist/cli/chunks/{chunk-6KI6LAAZ.js → chunk-D6RCRTTR.js} +2 -2
  76. package/dist/cli/chunks/{chunk-TB2N3CAK.js → chunk-DFXQLHQM.js} +2 -2
  77. package/dist/cli/chunks/chunk-DKSLJZVA.js +2 -0
  78. package/dist/cli/chunks/{chunk-JTYCOFTD.js → chunk-DKUKGBJE.js} +1 -1
  79. package/dist/cli/chunks/{chunk-AN5CGTTJ.js → chunk-DKXSJDII.js} +2 -2
  80. package/dist/cli/chunks/chunk-EEJP3WTQ.js +4 -0
  81. package/dist/cli/chunks/{chunk-ZMYV4R32.js → chunk-EHW62JL2.js} +1 -1
  82. package/dist/cli/chunks/{chunk-WYFAPA2G.js → chunk-EPBWFTHH.js} +2 -2
  83. package/dist/cli/chunks/{chunk-P6EFKHNI.js → chunk-ERTGGFXZ.js} +2 -2
  84. package/dist/cli/chunks/{chunk-G45AOQDZ.js → chunk-F7TRO2OM.js} +1 -1
  85. package/dist/cli/chunks/{chunk-XT473WPO.js → chunk-FFRKTZYP.js} +2 -2
  86. package/dist/cli/chunks/{chunk-5VSS2RBD.js → chunk-FH7SCX2I.js} +2 -2
  87. package/dist/cli/chunks/{chunk-44NPKZGI.js → chunk-FHBGALBG.js} +2 -2
  88. package/dist/cli/chunks/{chunk-NTALX2YC.js → chunk-FOAFRC2W.js} +2 -2
  89. package/dist/cli/chunks/{chunk-7LATB5IR.js → chunk-FPBQ7BXU.js} +2 -2
  90. package/dist/cli/chunks/{chunk-AKUDUB3O.js → chunk-FRRRDCXY.js} +2 -2
  91. package/dist/cli/chunks/{chunk-NG6A7LCG.js → chunk-FZ47ZCRL.js} +1 -1
  92. package/dist/cli/chunks/{chunk-VD53LBF7.js → chunk-GH3NJOTC.js} +3 -3
  93. package/dist/cli/chunks/{chunk-NDRZZSD5.js → chunk-GO66DCIZ.js} +2 -2
  94. package/dist/cli/chunks/{chunk-Z6DSYLAG.js → chunk-GRVR3Y6I.js} +1 -1
  95. package/dist/cli/chunks/chunk-GYTWUOKU.js +65 -0
  96. package/dist/cli/chunks/{chunk-6KKVMPPR.js → chunk-H2DX36SC.js} +2 -2
  97. package/dist/cli/chunks/{chunk-NJ3QXJ54.js → chunk-H5LSXVWY.js} +2 -2
  98. package/dist/cli/chunks/{chunk-HQWFZQMJ.js → chunk-HBAQVJDP.js} +2 -2
  99. package/dist/cli/chunks/{chunk-33YZGOT6.js → chunk-HCCILQGN.js} +2 -2
  100. package/dist/cli/chunks/{chunk-KRZYWVS3.js → chunk-HJD52N32.js} +2 -2
  101. package/dist/cli/chunks/{chunk-IPDM3CAK.js → chunk-HKU5PPS7.js} +1 -1
  102. package/dist/cli/chunks/{chunk-7RVLVIAI.js → chunk-HPQU6XZH.js} +1 -1
  103. package/dist/cli/chunks/{chunk-TWUWLSGQ.js → chunk-HRUQWABO.js} +10 -10
  104. package/dist/cli/chunks/{chunk-HAJG44BD.js → chunk-IGRTQ6VT.js} +2 -2
  105. package/dist/cli/chunks/{chunk-WXU7FAEB.js → chunk-IIBXGHZT.js} +2 -2
  106. package/dist/cli/chunks/{chunk-QG5L2JM5.js → chunk-IYB3GRXF.js} +10 -10
  107. package/dist/cli/chunks/{chunk-NNLZAVFH.js → chunk-IYIMLLUV.js} +1 -1
  108. package/dist/cli/chunks/{chunk-SXFSJJZF.js → chunk-J2VF7ZO7.js} +2 -2
  109. package/dist/cli/chunks/{chunk-4FVOJBEU.js → chunk-J33LKXVH.js} +1 -1
  110. package/dist/cli/chunks/{chunk-IOJ34SXJ.js → chunk-J7VAD4RG.js} +2 -2
  111. package/dist/cli/chunks/{chunk-VQCLSX7T.js → chunk-JJ4GUO4K.js} +1 -1
  112. package/dist/cli/chunks/{chunk-QM4Z7TQH.js → chunk-JMULRLD4.js} +1 -1
  113. package/dist/cli/chunks/{chunk-LXVT6JXO.js → chunk-JNSTKE3K.js} +2 -2
  114. package/dist/cli/chunks/{chunk-SOS37ECY.js → chunk-JZUWPDVS.js} +1 -1
  115. package/dist/cli/chunks/chunk-KHUO4NCW.js +11 -0
  116. package/dist/cli/chunks/chunk-KXMW7XTJ.js +2 -0
  117. package/dist/cli/chunks/{chunk-4AITMWFZ.js → chunk-KXTN3FR4.js} +2 -2
  118. package/dist/cli/chunks/{chunk-4Z4X2ND4.js → chunk-L4WATX6B.js} +2 -2
  119. package/dist/cli/chunks/{chunk-GMLRIZ4E.js → chunk-L66BWYQH.js} +1 -1
  120. package/dist/cli/chunks/{chunk-52VGZJSD.js → chunk-LJ63HPPN.js} +1 -1
  121. package/dist/cli/chunks/{chunk-WE3VKDMK.js → chunk-LMPK63PO.js} +3 -3
  122. package/dist/cli/chunks/{chunk-S6WHYOWV.js → chunk-LQDFWLKK.js} +27 -25
  123. package/dist/cli/chunks/{chunk-EG73WYAW.js → chunk-LSXQPMPI.js} +2 -2
  124. package/dist/cli/chunks/{chunk-NJ4YVAG7.js → chunk-MDLLEUFN.js} +3 -3
  125. package/dist/cli/chunks/{chunk-YQOQVSYU.js → chunk-MFAN5W27.js} +1 -1
  126. package/dist/cli/chunks/{chunk-A5RWLPVT.js → chunk-MZ2PJUN6.js} +2 -2
  127. package/dist/cli/chunks/{chunk-HRTSYT4N.js → chunk-N22LMACN.js} +2 -2
  128. package/dist/cli/chunks/{chunk-L3GBNX7B.js → chunk-NAJCQJSK.js} +2 -2
  129. package/dist/cli/chunks/{chunk-XM5I7J5S.js → chunk-ND6JBUVH.js} +2 -2
  130. package/dist/cli/chunks/{chunk-YL2GOJF6.js → chunk-NEEZ6M4W.js} +2 -2
  131. package/dist/cli/chunks/{chunk-DGFINXUE.js → chunk-NNJ63W77.js} +1 -1
  132. package/dist/cli/chunks/{chunk-G6FJHDUG.js → chunk-O7KF3GBV.js} +1 -1
  133. package/dist/cli/chunks/{chunk-RP2BRRLX.js → chunk-OBKMLOHU.js} +2 -2
  134. package/dist/cli/chunks/{chunk-AOOCV56W.js → chunk-OBLHI4HA.js} +1 -1
  135. package/dist/cli/chunks/{chunk-OZ53BIY5.js → chunk-ODNLKYOM.js} +1 -1
  136. package/dist/cli/chunks/{chunk-VBHA4SDU.js → chunk-PMREFRPP.js} +2 -2
  137. package/dist/cli/chunks/{chunk-ASWWBNX2.js → chunk-PMUF7WU6.js} +2 -2
  138. package/dist/cli/chunks/{chunk-I5SXLV7D.js → chunk-PS5NIMWJ.js} +2 -2
  139. package/dist/cli/chunks/chunk-PS6Y662P.js +13 -0
  140. package/dist/cli/chunks/{chunk-N4OQ4D4V.js → chunk-PYAH4K2U.js} +2 -2
  141. package/dist/cli/chunks/{chunk-H3GAR4SV.js → chunk-PZZX57ZA.js} +2 -2
  142. package/dist/cli/chunks/chunk-QAE4BOIV.js +2 -0
  143. package/dist/cli/chunks/{chunk-7A4WTRWI.js → chunk-QIY43XQJ.js} +1 -1
  144. package/dist/cli/chunks/{chunk-MLXLGBQZ.js → chunk-QM6EJHP5.js} +1 -1
  145. package/dist/cli/chunks/{chunk-4ANJV6I4.js → chunk-QMTBWHGR.js} +3 -3
  146. package/dist/cli/chunks/{chunk-IT5QIUUA.js → chunk-RCHDSUVU.js} +2 -2
  147. package/dist/cli/chunks/{chunk-AYH3DMW2.js → chunk-RUEHSOE6.js} +1 -1
  148. package/dist/cli/chunks/{chunk-DCVFHVPR.js → chunk-RVCMZUSJ.js} +2 -2
  149. package/dist/cli/chunks/{chunk-2JAC57JE.js → chunk-RXHI6CKK.js} +1 -1
  150. package/dist/cli/chunks/{chunk-QXO35J6F.js → chunk-RXPHQ4ZE.js} +2 -2
  151. package/dist/cli/chunks/{chunk-FI6J3UHJ.js → chunk-RYHCYTFE.js} +1 -1
  152. package/dist/cli/chunks/{chunk-DFLASG3B.js → chunk-S4WIAKPL.js} +1 -1
  153. package/dist/cli/chunks/{chunk-2VY7FL6A.js → chunk-S53ZUAVI.js} +2 -2
  154. package/dist/cli/chunks/{chunk-4M7YZ2X7.js → chunk-SEKOMKNG.js} +1 -1
  155. package/dist/cli/chunks/{chunk-UC4EIULB.js → chunk-SZRDEPUY.js} +19 -19
  156. package/dist/cli/chunks/chunk-T7XYQX5G.js +24 -0
  157. package/dist/cli/chunks/{chunk-OG3DBHIV.js → chunk-TF33GKWA.js} +2 -2
  158. package/dist/cli/chunks/{chunk-2VTX4SYW.js → chunk-TGFJUL6M.js} +2 -2
  159. package/dist/cli/chunks/{chunk-4THFPRFM.js → chunk-TLD727EF.js} +2 -2
  160. package/dist/cli/chunks/{chunk-7PCIN7UN.js → chunk-TQ2JZVZ3.js} +2 -2
  161. package/dist/cli/chunks/{chunk-UWZYXI3R.js → chunk-TT7DF2GX.js} +2 -2
  162. package/dist/cli/chunks/{chunk-X3JNFQW2.js → chunk-UCJEAK7D.js} +2 -2
  163. package/dist/cli/chunks/{chunk-AM42ROKZ.js → chunk-UN7EHLRV.js} +1 -1
  164. package/dist/cli/chunks/{chunk-42AS3HPO.js → chunk-UUE5CBZQ.js} +2 -2
  165. package/dist/cli/chunks/{chunk-E67ZXRG6.js → chunk-UWRMPRY5.js} +1 -1
  166. package/dist/cli/chunks/{chunk-4YFXF5AQ.js → chunk-VEWYUEVY.js} +5 -5
  167. package/dist/cli/chunks/{chunk-UJUK6T4V.js → chunk-VUXHJPUS.js} +2 -2
  168. package/dist/cli/chunks/{chunk-VA2ORJB5.js → chunk-VVP2ROXD.js} +2 -2
  169. package/dist/cli/chunks/{chunk-BZIPYXSW.js → chunk-WFJKLM6Z.js} +3 -3
  170. package/dist/cli/chunks/{chunk-MLFELTJX.js → chunk-X5G3UDWP.js} +2 -2
  171. package/dist/cli/chunks/{chunk-IQH2RDN3.js → chunk-Y63V33M6.js} +5 -5
  172. package/dist/cli/chunks/{chunk-XIKYUBIV.js → chunk-YXN47QOI.js} +2 -2
  173. package/dist/cli/chunks/{chunk-RP5VFZJO.js → chunk-Z5YU2TDS.js} +2 -2
  174. package/dist/cli/chunks/{chunk-KYJBJ56M.js → chunk-ZAHCVRR7.js} +2 -2
  175. package/dist/cli/chunks/{chunk-66OQ7AB3.js → chunk-ZC3HC6FO.js} +1 -1
  176. package/dist/cli/chunks/{ci-QAUD62WH.js → ci-Q2VX75PS.js} +2 -2
  177. package/dist/cli/chunks/{ci-output-TZDVTNE7.js → ci-output-MD5GTVR2.js} +2 -2
  178. package/dist/cli/chunks/{circuit-breaker-ZWPHJ7YJ.js → circuit-breaker-JMRLG2XI.js} +2 -2
  179. package/dist/cli/chunks/{claude-flow-setup-SCB4EURN.js → claude-flow-setup-IMXYALBU.js} +2 -2
  180. package/dist/cli/chunks/client-L4PIXCGV.js +2 -0
  181. package/dist/cli/chunks/{cline-installer-EHZLMLXF.js → cline-installer-HWFASEGE.js} +2 -2
  182. package/dist/cli/chunks/{code-3N6PBJMK.js → code-3V37TCAD.js} +2 -2
  183. package/dist/cli/chunks/{code-index-extractor-6DIKHNRI.js → code-index-extractor-5V54WGFL.js} +2 -2
  184. package/dist/cli/chunks/codex-installer-UCA5AVE6.js +14 -0
  185. package/dist/cli/chunks/{completions-5MKWWCCE.js → completions-2DMRCQU6.js} +2 -2
  186. package/dist/cli/chunks/{complexity-analyzer-TPM4IPEK.js → complexity-analyzer-MMQRXBTD.js} +2 -2
  187. package/dist/cli/chunks/{continuedev-installer-VXODKGVX.js → continuedev-installer-FAARXP3S.js} +2 -2
  188. package/dist/cli/chunks/{copilot-installer-PVD5O56P.js → copilot-installer-AKQALMB5.js} +2 -2
  189. package/dist/cli/chunks/core-handlers-KROSXP4V.js +2 -0
  190. package/dist/cli/chunks/{cost-tracker-JOMZEQF3.js → cost-tracker-AXWHDND5.js} +2 -2
  191. package/dist/cli/chunks/{coverage-HTXLEV3B.js → coverage-ZLSKKCG5.js} +3 -3
  192. package/dist/cli/chunks/cross-domain-router-WMTYBOON.js +2 -0
  193. package/dist/cli/chunks/{cursor-installer-SHKDTDDZ.js → cursor-installer-UALCQKVD.js} +2 -2
  194. package/dist/cli/chunks/{daemon-FCFEWVVJ.js → daemon-4LNOPJGN.js} +3 -3
  195. package/dist/cli/chunks/{daemon-PN4FEPLE.js → daemon-K3DFGCXC.js} +4 -4
  196. package/dist/cli/chunks/{dag-attention-scheduler-PLOHU5SR.js → dag-attention-scheduler-LCQ7MYKC.js} +2 -2
  197. package/dist/cli/chunks/{detect-F3H4ZEZY.js → detect-P7PEN3MZ.js} +2 -2
  198. package/dist/cli/chunks/{dist-node-5TC665N6.js → dist-node-I72BJC2D.js} +2 -2
  199. package/dist/cli/chunks/{domain-handler-ZIWVFXCU.js → domain-handler-LROF6KWN.js} +2 -2
  200. package/dist/cli/chunks/{domain-transfer-7Q5JYMYR.js → domain-transfer-M2ZSSTPV.js} +2 -2
  201. package/dist/cli/chunks/dream-AV63YQ2Y.js +2 -0
  202. package/dist/cli/chunks/embed-and-insert-pattern-MTBPUGO4.js +3 -0
  203. package/dist/cli/chunks/{eval-E2K2T75A.js → eval-O24ALB3W.js} +2 -2
  204. package/dist/cli/chunks/{experience-capture-middleware-Z5SE2O53.js → experience-capture-middleware-7JXEOGRE.js} +3 -3
  205. package/dist/cli/chunks/{fast-paths-3H52RSUK.js → fast-paths-4CFYJV4U.js} +2 -2
  206. package/dist/cli/chunks/{feature-flags-ONIKUZVK.js → feature-flags-CHPUA7IM.js} +2 -2
  207. package/dist/cli/chunks/{feature-flags-LUHSMHPS.js → feature-flags-E6PIM6ZB.js} +2 -2
  208. package/dist/cli/chunks/{file-discovery-FLYSYSS4.js → file-discovery-2ANIAUCP.js} +2 -2
  209. package/dist/cli/chunks/{fleet-6OJUAAKV.js → fleet-2MQ3OGCP.js} +3 -3
  210. package/dist/cli/chunks/{gnn-wrapper-PUL6B7KZ.js → gnn-wrapper-P7JW3622.js} +2 -2
  211. package/dist/cli/chunks/{heartbeat-handler-HGHHDUDY.js → heartbeat-handler-WWWZSA7V.js} +4 -4
  212. package/dist/cli/chunks/heartbeat-scheduler-5IZUGMC2.js +2 -0
  213. package/dist/cli/chunks/hnsw-adapter-NV2NNBJL.js +2 -0
  214. package/dist/cli/chunks/hnsw-index-GRJ3KA2O.js +2 -0
  215. package/dist/cli/chunks/{hnsw-legacy-bridge-NDZSNMYX.js → hnsw-legacy-bridge-W634ZOTV.js} +2 -2
  216. package/dist/cli/chunks/{hnswlib-node-PISLKSO2.js → hnswlib-node-SLZDLMKM.js} +2 -2
  217. package/dist/cli/chunks/{hooks-WYG54MRI.js → hooks-3BFAZGG7.js} +10 -10
  218. package/dist/cli/chunks/{hypergraph-engine-EDHKHZZ2.js → hypergraph-engine-XJSGXP2J.js} +2 -2
  219. package/dist/cli/chunks/{hypergraph-handler-OCHZAPPL.js → hypergraph-handler-RVUWZMOX.js} +3 -3
  220. package/dist/cli/chunks/impact-analyzer-YM4QUWVH.js +2 -0
  221. package/dist/cli/chunks/{init-handler-5TCJ672H.js → init-handler-FYOZNNNO.js} +9 -8
  222. package/dist/cli/chunks/init-wizard-YESXGIK6.js +2 -0
  223. package/dist/cli/chunks/kernel-VH5SKESU.js +2 -0
  224. package/dist/cli/chunks/{kilocode-installer-SWUQRCTZ.js → kilocode-installer-MAAKFVSB.js} +2 -2
  225. package/dist/cli/chunks/{kiro-installer-L22EBAM5.js → kiro-installer-GX3TLZC5.js} +2 -2
  226. package/dist/cli/chunks/knowledge-graph-F3NL4WJV.js +2 -0
  227. package/dist/cli/chunks/learning-T4QZ6C26.js +122 -0
  228. package/dist/cli/chunks/{llm-router-F2L4LFT2.js → llm-router-N2M4WXOC.js} +14 -14
  229. package/dist/cli/chunks/llm-router-service-HQYCJMPK.js +2 -0
  230. package/dist/cli/chunks/{load-A4ZF2KHC.js → load-6RU3G4P2.js} +2 -2
  231. package/dist/cli/chunks/load-test-GWRGKWMN.js +2 -0
  232. package/dist/cli/chunks/{mcp-T2Z46NNK.js → mcp-EFBO7BAU.js} +2 -2
  233. package/dist/cli/chunks/{memory-PUC3J6XC.js → memory-AXU2M3DN.js} +5 -5
  234. package/dist/cli/chunks/memory-backend-7A2PFKPV.js +2 -0
  235. package/dist/cli/chunks/memory-handlers-65CXN76C.js +2 -0
  236. package/dist/cli/chunks/{multi-model-executor-U5L4FI4O.js → multi-model-executor-W7AFGVNH.js} +2 -2
  237. package/dist/cli/chunks/{opencode-installer-UWI6KHYH.js → opencode-installer-KJE2RLCH.js} +2 -2
  238. package/dist/cli/chunks/{orchestrator-3BEI7R5D.js → orchestrator-CL6MLGVU.js} +22 -24
  239. package/dist/cli/chunks/pattern-null-store-K2WPRYCP.js +2 -0
  240. package/dist/cli/chunks/{pattern-usage-recorder-EGWUI5LU.js → pattern-usage-recorder-7SNSJ7K2.js} +2 -2
  241. package/dist/cli/chunks/{pipeline-JG6M4RHD.js → pipeline-3UU6ON3F.js} +2 -2
  242. package/dist/cli/chunks/platform-SNMPIDIT.js +2 -0
  243. package/dist/cli/chunks/{plugin-EEGN3PMK.js → plugin-65IIUUCU.js} +2 -2
  244. package/dist/cli/chunks/{prime-radiant-advanced-wasm-7KZAINFT.js → prime-radiant-advanced-wasm-WWWJRLRP.js} +2 -2
  245. package/dist/cli/chunks/protocol-executor-TJDLEHND.js +2 -0
  246. package/dist/cli/chunks/{protocol-handler-UCEHYK2R.js → protocol-handler-SEBHCLLJ.js} +2 -2
  247. package/dist/cli/chunks/{prove-JSNG75VD.js → prove-N4X7CCJ4.js} +2 -2
  248. package/dist/cli/chunks/qe-reasoning-bank-CGRMFPDM.js +2 -0
  249. package/dist/cli/chunks/{quality-7SRM2HBM.js → quality-LBCJWXMU.js} +2 -2
  250. package/dist/cli/chunks/quality-gate-KZIQI7QT.js +7 -0
  251. package/dist/cli/chunks/queen-coordinator-FKP6QZAQ.js +2 -0
  252. package/dist/cli/chunks/real-embeddings-XCZFHFME.js +2 -0
  253. package/dist/cli/chunks/{roocode-installer-UYQK64BZ.js → roocode-installer-P3O6B7PT.js} +2 -2
  254. package/dist/cli/chunks/router-KZ5BISAM.js +2 -0
  255. package/dist/cli/chunks/routing-feedback-O4Y5TTR6.js +2 -0
  256. package/dist/cli/chunks/{routing-handler-PY3KPDTH.js → routing-handler-OXZ4DOV4.js} +2 -2
  257. package/dist/cli/chunks/{ruvector-commands-GCAOUTYS.js → ruvector-commands-PSY5IDSL.js} +2 -2
  258. package/dist/cli/chunks/rvf-dual-writer-NG3UF3D5.js +2 -0
  259. package/dist/cli/chunks/rvf-migration-adapter-PUHVTKQY.js +2 -0
  260. package/dist/cli/chunks/rvf-migration-coordinator-4SUT7GTJ.js +2 -0
  261. package/dist/cli/chunks/rvf-native-adapter-ODXFKZ6G.js +2 -0
  262. package/dist/cli/chunks/{rvf-store-integrity-HNDKOM4L.js → rvf-store-integrity-TCKC22FH.js} +2 -2
  263. package/dist/cli/chunks/safe-db-BUQDNH2R.js +2 -0
  264. package/dist/cli/chunks/schedule-ZXNDZNNB.js +2 -0
  265. package/dist/cli/chunks/scheduler-YUQQWWW3.js +2 -0
  266. package/dist/cli/chunks/{security-MQ2VB7PY.js → security-RQGUQGSI.js} +3 -3
  267. package/dist/cli/chunks/{shared-rvf-adapter-TAZEU6QK.js → shared-rvf-adapter-ZJFN52C2.js} +2 -2
  268. package/dist/cli/chunks/{shared-rvf-dual-writer-B7N6AOCY.js → shared-rvf-dual-writer-V2R37HWV.js} +2 -2
  269. package/dist/cli/chunks/sqlite-persistence-HVSX46C7.js +2 -0
  270. package/dist/cli/chunks/{status-handler-NZP7DFHE.js → status-handler-XEKWNVDR.js} +2 -2
  271. package/dist/cli/chunks/{structural-health-ALLUQ4X6.js → structural-health-QMIW6WUN.js} +2 -2
  272. package/dist/cli/chunks/{sync-WJJG5J6V.js → sync-GDYJ2ULT.js} +2 -2
  273. package/dist/cli/chunks/{sync-MM7OCUYD.js → sync-H5SXWXPP.js} +2 -2
  274. package/dist/cli/chunks/{task-handler-CAQUEEB4.js → task-handler-EPLKCQHY.js} +2 -2
  275. package/dist/cli/chunks/{task-handlers-25BJ7D3W.js → task-handlers-22NTLWTC.js} +3 -3
  276. package/dist/cli/chunks/{test-HW7GVGVN.js → test-WHJFRZ3F.js} +4 -4
  277. package/dist/cli/chunks/{test-scheduling-HTMFJMSP.js → test-scheduling-KZVFZOQN.js} +3 -3
  278. package/dist/cli/chunks/token-bootstrap-BW5WA6PY.js +2 -0
  279. package/dist/cli/chunks/{token-usage-RJZDMBDP.js → token-usage-4A4O57R6.js} +2 -2
  280. package/dist/cli/chunks/{transformers-3YFW3EUO.js → transformers-FYTBRV46.js} +2 -2
  281. package/dist/cli/chunks/{tree-sitter-wasm-parser-U3PQPIK7.js → tree-sitter-wasm-parser-TZIJPLF3.js} +2 -2
  282. package/dist/cli/chunks/{types-7Q762WDO.js → types-B2L6LKFA.js} +2 -2
  283. package/dist/cli/chunks/unified-memory-AHN4RVBP.js +2 -0
  284. package/dist/cli/chunks/unified-memory-hnsw-XB7JPF74.js +2 -0
  285. package/dist/cli/chunks/unified-persistence-53KWNFQJ.js +2 -0
  286. package/dist/cli/chunks/{upgrade-F7MKJWBQ.js → upgrade-O6U7EA7V.js} +2 -2
  287. package/dist/cli/chunks/{validate-B27AVRA6.js → validate-FHNZ5XL3.js} +2 -2
  288. package/dist/cli/chunks/{validate-swarm-GYZR3GNL.js → validate-swarm-YOLLUEHE.js} +2 -2
  289. package/dist/cli/chunks/{vibium-W4XQMPJP.js → vibium-UXRPEIXB.js} +2 -2
  290. package/dist/cli/chunks/visual-security-CRPYS7L7.js +2 -0
  291. package/dist/cli/chunks/{web-tree-sitter-I7CDCFJU.js → web-tree-sitter-JJ5UIYFD.js} +2 -2
  292. package/dist/cli/chunks/{windsurf-installer-UYLHFDHU.js → windsurf-installer-I4QMQPIL.js} +2 -2
  293. package/dist/cli/chunks/witness-chain-5WCR2CAS.js +2 -0
  294. package/dist/cli/chunks/{witness-chain-B66SYZKU.js → witness-chain-BIJ7WDGS.js} +2 -2
  295. package/dist/cli/chunks/{witness-key-manager-U4JPAHVW.js → witness-key-manager-3SMMLJLP.js} +2 -2
  296. package/dist/cli/chunks/{workflow-DYMO47FF.js → workflow-33PUXXJV.js} +4 -4
  297. package/dist/cli/chunks/workflow-orchestrator-RZWCLTT5.js +2 -0
  298. package/dist/cli/chunks/{wrappers-7S6DQTEA.js → wrappers-ASAU36VK.js} +2 -2
  299. package/dist/cli/commands/learning.js +44 -0
  300. package/dist/cli/commands/llm-router.js +27 -21
  301. package/dist/cli/commands/platform.d.ts +1 -0
  302. package/dist/cli/commands/platform.js +28 -6
  303. package/dist/cli/commands/quality-gate.js +25 -3
  304. package/dist/cli/handlers/brain-handler.js +2 -0
  305. package/dist/cli/handlers/init-handler.d.ts +5 -0
  306. package/dist/cli/handlers/init-handler.js +6 -0
  307. package/dist/cli/index.js +4 -1
  308. package/dist/context/compaction/index.d.ts +1 -0
  309. package/dist/context/compaction/index.js +3 -0
  310. package/dist/context/compaction/instruction-provenance.d.ts +20 -0
  311. package/dist/context/compaction/instruction-provenance.js +18 -0
  312. package/dist/context/compaction/tier2-session-summary.d.ts +8 -0
  313. package/dist/context/compaction/tier2-session-summary.js +20 -0
  314. package/dist/context/compaction/tier3-llm-compact.d.ts +4 -0
  315. package/dist/context/compaction/tier3-llm-compact.js +32 -4
  316. package/dist/contracts/verdicts.d.ts +625 -0
  317. package/dist/contracts/verdicts.js +202 -14
  318. package/dist/coordination/handlers/coverage-handlers.js +8 -1
  319. package/dist/domains/chaos-resilience/diagnosis/corpus.d.ts +5 -0
  320. package/dist/domains/chaos-resilience/diagnosis/corpus.js +141 -0
  321. package/dist/domains/chaos-resilience/diagnosis/detectors.d.ts +11 -0
  322. package/dist/domains/chaos-resilience/diagnosis/detectors.js +109 -0
  323. package/dist/domains/chaos-resilience/diagnosis/index.d.ts +5 -0
  324. package/dist/domains/chaos-resilience/diagnosis/index.js +5 -0
  325. package/dist/domains/chaos-resilience/diagnosis/scorer.d.ts +8 -0
  326. package/dist/domains/chaos-resilience/diagnosis/scorer.js +128 -0
  327. package/dist/domains/chaos-resilience/diagnosis/types.d.ts +171 -0
  328. package/dist/domains/chaos-resilience/diagnosis/types.js +3 -0
  329. package/dist/domains/chaos-resilience/index.d.ts +1 -0
  330. package/dist/domains/chaos-resilience/index.js +1 -0
  331. package/dist/domains/index.d.ts +1 -0
  332. package/dist/domains/index.js +1 -0
  333. package/dist/early-exit/early-exit-controller.d.ts +4 -2
  334. package/dist/early-exit/early-exit-controller.js +95 -7
  335. package/dist/early-exit/index.d.ts +1 -1
  336. package/dist/early-exit/speculative-executor.js +3 -0
  337. package/dist/early-exit/types.d.ts +51 -0
  338. package/dist/early-exit/types.js +3 -0
  339. package/dist/index.d.ts +4 -2
  340. package/dist/index.js +2 -1
  341. package/dist/init/browser-engine-installer.d.ts +11 -0
  342. package/dist/init/browser-engine-installer.js +35 -5
  343. package/dist/init/codex-installer.d.ts +11 -1
  344. package/dist/init/codex-installer.js +90 -24
  345. package/dist/init/init-wizard-hooks.js +11 -11
  346. package/dist/init/orchestrator.js +2 -0
  347. package/dist/init/phases/07-hooks.d.ts +3 -3
  348. package/dist/init/phases/07-hooks.js +19 -21
  349. package/dist/init/phases/09-assets.d.ts +4 -0
  350. package/dist/init/phases/09-assets.js +13 -10
  351. package/dist/init/phases/phase-interface.d.ts +2 -0
  352. package/dist/init/types.d.ts +4 -0
  353. package/dist/integrations/embeddings/base/EmbeddingGenerator.js +4 -2
  354. package/dist/integrations/ruvector/brain-exporter.d.ts +1 -1
  355. package/dist/integrations/ruvector/brain-exporter.js +15 -3
  356. package/dist/integrations/ruvector/brain-rvf-exporter.d.ts +4 -0
  357. package/dist/integrations/ruvector/brain-rvf-exporter.js +118 -37
  358. package/dist/integrations/ruvector/brain-search.d.ts +1 -1
  359. package/dist/integrations/ruvector/brain-search.js +1 -1
  360. package/dist/integrations/ruvector/brain-shared.d.ts +4 -2
  361. package/dist/integrations/ruvector/brain-shared.js +11 -4
  362. package/dist/integrations/ruvector/brain-table-ddl.d.ts +2 -2
  363. package/dist/integrations/ruvector/brain-table-ddl.js +20 -8
  364. package/dist/integrations/ruvector/cognitive-container.js +1 -1
  365. package/dist/integrations/ruvector/rvf-dual-writer.d.ts +4 -0
  366. package/dist/integrations/ruvector/rvf-dual-writer.js +57 -9
  367. package/dist/integrations/ruvector/rvf-store-integrity.js +1 -1
  368. package/dist/kernel/unified-memory-schemas.d.ts +4 -3
  369. package/dist/kernel/unified-memory-schemas.js +19 -9
  370. package/dist/kernel/unified-memory.d.ts +2 -0
  371. package/dist/kernel/unified-memory.js +19 -0
  372. package/dist/learning/embed-and-insert-pattern.js +6 -3
  373. package/dist/learning/embedding-space.d.ts +50 -0
  374. package/dist/learning/embedding-space.js +128 -0
  375. package/dist/learning/evidence-admission-store.d.ts +15 -0
  376. package/dist/learning/evidence-admission-store.js +68 -0
  377. package/dist/learning/index.d.ts +7 -0
  378. package/dist/learning/index.js +4 -0
  379. package/dist/learning/learning-evidence-admission.d.ts +44 -0
  380. package/dist/learning/learning-evidence-admission.js +97 -0
  381. package/dist/learning/pattern-mutation-error.d.ts +9 -0
  382. package/dist/learning/pattern-mutation-error.js +14 -0
  383. package/dist/learning/pattern-store.d.ts +5 -0
  384. package/dist/learning/pattern-store.js +60 -9
  385. package/dist/learning/qe-flywheel/coupled-anchor.d.ts +8 -0
  386. package/dist/learning/qe-flywheel/coupled-anchor.js +46 -3
  387. package/dist/learning/qe-reasoning-bank.js +28 -5
  388. package/dist/learning/real-embeddings.d.ts +3 -0
  389. package/dist/learning/real-embeddings.js +40 -3
  390. package/dist/learning/real-qe-reasoning-bank.js +7 -3
  391. package/dist/learning/rvf-pattern-migration.d.ts +2 -0
  392. package/dist/learning/rvf-pattern-migration.js +5 -3
  393. package/dist/learning/rvf-pattern-store.d.ts +3 -0
  394. package/dist/learning/rvf-pattern-store.js +44 -6
  395. package/dist/learning/sqlite-persistence.d.ts +7 -2
  396. package/dist/learning/sqlite-persistence.js +58 -21
  397. package/dist/learning/structural-retrieval/corpus.d.ts +5 -0
  398. package/dist/learning/structural-retrieval/corpus.js +97 -0
  399. package/dist/learning/structural-retrieval/evaluate.d.ts +7 -0
  400. package/dist/learning/structural-retrieval/evaluate.js +124 -0
  401. package/dist/learning/structural-retrieval/index.d.ts +6 -0
  402. package/dist/learning/structural-retrieval/index.js +4 -0
  403. package/dist/learning/structural-retrieval/receipt.d.ts +14 -0
  404. package/dist/learning/structural-retrieval/receipt.js +36 -0
  405. package/dist/learning/structural-retrieval/types.d.ts +83 -0
  406. package/dist/learning/structural-retrieval/types.js +2 -0
  407. package/dist/mcp/bundle.js +589 -433
  408. package/dist/mcp/handlers/memory-handlers.js +6 -2
  409. package/dist/mcp/services/session-resume.d.ts +15 -19
  410. package/dist/mcp/services/session-resume.js +204 -194
  411. package/dist/mcp/tools/quality-assessment/gate.d.ts +8 -5
  412. package/dist/mcp/tools/quality-assessment/gate.js +9 -4
  413. package/dist/migrations/20260830_add_learning_evidence_tables.d.ts +7 -0
  414. package/dist/migrations/20260830_add_learning_evidence_tables.js +173 -0
  415. package/dist/persistence/rvf-migration-adapter.d.ts +2 -0
  416. package/dist/persistence/rvf-migration-adapter.js +56 -12
  417. package/dist/shared/llm/llm-router-service.d.ts +8 -0
  418. package/dist/shared/llm/llm-router-service.js +21 -3
  419. package/dist/shared/sql-safety.js +4 -0
  420. package/dist/skills/qe-court/cli.d.ts +3 -0
  421. package/dist/skills/qe-court/cli.js +54 -0
  422. package/dist/validation/quality-gate-runner.d.ts +27 -4
  423. package/dist/validation/quality-gate-runner.js +33 -4
  424. package/dist/validation/verification-reach.d.ts +90 -0
  425. package/dist/validation/verification-reach.js +187 -0
  426. package/dist/verification/adversarial-verify/calibrate.d.ts +46 -2
  427. package/dist/verification/adversarial-verify/calibrate.js +104 -2
  428. package/dist/verification/adversarial-verify/index.d.ts +2 -2
  429. package/dist/verification/adversarial-verify/index.js +1 -1
  430. package/dist/verification/adversarial-verify/measurement-receipt.d.ts +13 -0
  431. package/dist/verification/adversarial-verify/measurement-receipt.js +136 -0
  432. package/dist/verification/adversarial-verify/synthesize.js +7 -10
  433. package/dist/verification/adversarial-verify/types.d.ts +35 -0
  434. package/dist/verification/adversarial-verify/verify.js +6 -1
  435. package/package.json +14 -6
  436. package/schemas/coverage-gap.schema.json +41 -0
  437. package/schemas/finding-verdict.schema.json +470 -0
  438. package/schemas/risk-decision.schema.json +41 -0
  439. package/dist/cli/chunks/adapter-FUV6LBJT.js +0 -2
  440. package/dist/cli/chunks/aqe-learning-engine-QNFNA3J4.js +0 -2
  441. package/dist/cli/chunks/base-37W2XIXC.js +0 -2
  442. package/dist/cli/chunks/brain-handler-TVTTWZGP.js +0 -89
  443. package/dist/cli/chunks/browser-workflow-PDIUEK7B.js +0 -2
  444. package/dist/cli/chunks/chunk-5PI75QYP.js +0 -4
  445. package/dist/cli/chunks/chunk-EDRPTLAX.js +0 -2
  446. package/dist/cli/chunks/chunk-GEQWCK4F.js +0 -2
  447. package/dist/cli/chunks/chunk-GQLJYTXN.js +0 -2
  448. package/dist/cli/chunks/chunk-NLZUGANH.js +0 -11
  449. package/dist/cli/chunks/chunk-O4BWESH5.js +0 -2
  450. package/dist/cli/chunks/chunk-PGFCKE4G.js +0 -12
  451. package/dist/cli/chunks/chunk-RACWX2ZX.js +0 -9
  452. package/dist/cli/chunks/chunk-SNC73DWF.js +0 -2
  453. package/dist/cli/chunks/chunk-TDVMILKO.js +0 -2
  454. package/dist/cli/chunks/chunk-TK5XLF3Z.js +0 -65
  455. package/dist/cli/chunks/chunk-UQ4UCHO7.js +0 -2
  456. package/dist/cli/chunks/chunk-VZGP77YU.js +0 -12
  457. package/dist/cli/chunks/chunk-WA6CSEOX.js +0 -2
  458. package/dist/cli/chunks/chunk-WYIXNHPF.js +0 -2
  459. package/dist/cli/chunks/client-4W3KWTAU.js +0 -2
  460. package/dist/cli/chunks/codex-installer-P7DPQMYL.js +0 -15
  461. package/dist/cli/chunks/core-handlers-BDU2XBLO.js +0 -2
  462. package/dist/cli/chunks/cross-domain-router-BPB6IHN4.js +0 -2
  463. package/dist/cli/chunks/dream-WFCZGFDY.js +0 -2
  464. package/dist/cli/chunks/embed-and-insert-pattern-VESJQSYD.js +0 -3
  465. package/dist/cli/chunks/heartbeat-scheduler-HWS4SHRM.js +0 -2
  466. package/dist/cli/chunks/hnsw-adapter-7QOBHKRB.js +0 -2
  467. package/dist/cli/chunks/hnsw-index-6WUKYJH7.js +0 -2
  468. package/dist/cli/chunks/hybrid-router-525JTRA5.js +0 -2
  469. package/dist/cli/chunks/impact-analyzer-GG6CJEOK.js +0 -2
  470. package/dist/cli/chunks/init-wizard-4VFAOK4Y.js +0 -2
  471. package/dist/cli/chunks/kernel-N3FQGOST.js +0 -2
  472. package/dist/cli/chunks/knowledge-graph-I5QIHB4G.js +0 -2
  473. package/dist/cli/chunks/learning-TQOGG3CR.js +0 -119
  474. package/dist/cli/chunks/llm-router-service-NCJZYJLG.js +0 -2
  475. package/dist/cli/chunks/load-test-DCJEYIXD.js +0 -2
  476. package/dist/cli/chunks/memory-backend-O6KO2KTX.js +0 -2
  477. package/dist/cli/chunks/memory-handlers-4Z43WEKD.js +0 -2
  478. package/dist/cli/chunks/pattern-null-store-5WIJKX2K.js +0 -2
  479. package/dist/cli/chunks/platform-F76G6RUI.js +0 -2
  480. package/dist/cli/chunks/protocol-executor-5TPNAZTB.js +0 -2
  481. package/dist/cli/chunks/provider-manager-3VMOZ6HV.js +0 -2
  482. package/dist/cli/chunks/qe-reasoning-bank-BATV4NTT.js +0 -2
  483. package/dist/cli/chunks/quality-gate-A5MPWHST.js +0 -7
  484. package/dist/cli/chunks/queen-coordinator-EIHGYBUO.js +0 -2
  485. package/dist/cli/chunks/real-embeddings-ZBF5EQOG.js +0 -2
  486. package/dist/cli/chunks/router-EMVGY4HU.js +0 -2
  487. package/dist/cli/chunks/routing-feedback-JUP4OFB2.js +0 -2
  488. package/dist/cli/chunks/rvf-dual-writer-BUNP4SKD.js +0 -2
  489. package/dist/cli/chunks/rvf-migration-adapter-VSOAPLMB.js +0 -2
  490. package/dist/cli/chunks/rvf-migration-coordinator-LSWEHAWX.js +0 -2
  491. package/dist/cli/chunks/rvf-native-adapter-LOC42TQ6.js +0 -2
  492. package/dist/cli/chunks/safe-db-WQ62IQKV.js +0 -2
  493. package/dist/cli/chunks/schedule-XJRP57TE.js +0 -2
  494. package/dist/cli/chunks/scheduler-EZH5SDIM.js +0 -2
  495. package/dist/cli/chunks/sqlite-persistence-HPEVCTIB.js +0 -2
  496. package/dist/cli/chunks/token-bootstrap-F2DCLWGW.js +0 -2
  497. package/dist/cli/chunks/unified-memory-ATILROKR.js +0 -2
  498. package/dist/cli/chunks/unified-memory-hnsw-XJXAX7DW.js +0 -2
  499. package/dist/cli/chunks/unified-persistence-3TN5PBWE.js +0 -2
  500. package/dist/cli/chunks/visual-security-VFWRBCNA.js +0 -2
  501. package/dist/cli/chunks/witness-chain-JC5LEXRV.js +0 -2
  502. package/dist/cli/chunks/workflow-orchestrator-TKQUF2KN.js +0 -2
@@ -293,7 +293,7 @@ export class HooksPhase extends BasePhase {
293
293
  /**
294
294
  * Install the resilient hook shim (aqe-hook.cjs) into .claude/hooks/.
295
295
  * The generated settings.json hooks run `node .../aqe-hook.cjs <cmd>` — the
296
- * shim resolves a project-local AQE bundle (or falls back to npx), strips
296
+ * shim resolves a project-local AQE bundle (or an installed aqe binary), strips
297
297
  * init noise from stdout, swallows stderr, and always exits 0.
298
298
  */
299
299
  installHookShim(projectRoot, context) {
@@ -321,7 +321,7 @@ export class HooksPhase extends BasePhase {
321
321
  return;
322
322
  }
323
323
  // Should not happen for a real install (the file ships in the package).
324
- context.services.log(' ⚠ aqe-hook.cjs source not found — hooks will fall back to `npx agentic-qe`');
324
+ context.services.log(' ⚠ aqe-hook.cjs source not found — lifecycle hooks cannot run until AQE is reinstalled');
325
325
  }
326
326
  /**
327
327
  * Generate a minimal statusline-v3.cjs script as a fallback.
@@ -381,17 +381,15 @@ const AQE_DIR = path.join(PROJECT_ROOT, '.agentic-qe');
381
381
  const RVF_PATH = path.join(AQE_DIR, 'aqe.rvf');
382
382
  const DB_PATH = path.join(AQE_DIR, 'memory.db');
383
383
  const MAX_AGE_HOURS = 24;
384
+ const AQE_BIN = process.env.AQE_HOOK_BIN || (process.platform === 'win32' ? 'aqe.cmd' : 'aqe');
384
385
 
385
386
  function log(msg) { process.stderr.write('[brain-checkpoint] ' + msg + '\\n'); }
386
387
 
387
388
  function exportBrain() {
388
389
  if (!fs.existsSync(DB_PATH)) { log('No memory.db, skipping'); return { exported: false }; }
389
390
  try {
390
- if (fs.existsSync(RVF_PATH)) fs.unlinkSync(RVF_PATH);
391
- const idmap = RVF_PATH + '.idmap.json';
392
- if (fs.existsSync(idmap)) fs.unlinkSync(idmap);
393
391
  const result = execFileSync(
394
- 'npx', ['agentic-qe', 'brain', 'export', '-o', RVF_PATH, '--format', 'rvf'],
392
+ AQE_BIN, ['brain', 'export', '-o', RVF_PATH, '--format', 'rvf'],
395
393
  { timeout: 60000, encoding: 'utf-8' }
396
394
  );
397
395
  const m = result.match(/Patterns:\\s+(\\d+)/);
@@ -425,8 +423,8 @@ if (process.argv.includes('--json')) process.stdout.write(JSON.stringify(result)
425
423
  /**
426
424
  * Generate hooks configuration
427
425
  *
428
- * Uses `npx agentic-qe` for portability - works without global installation.
429
- * All hooks use --json output for structured data and fail silently with continueOnError.
426
+ * Timeout values use Claude Code's native seconds unit. The shim itself uses
427
+ * a smaller millisecond budget so it can record failures before the host stops it.
430
428
  */
431
429
  generateHooksConfig(_config, _projectRoot) {
432
430
  // Shell injection safety: env vars like $TOOL_INPUT_file_path are set by
@@ -444,7 +442,7 @@ if (process.argv.includes('--json')) process.stdout.write(JSON.stringify(result)
444
442
  {
445
443
  type: 'command',
446
444
  command: 'node "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/aqe-hook.cjs" guard --file "$TOOL_INPUT_file_path" --json',
447
- timeout: 3000,
445
+ timeout: 3,
448
446
  continueOnError: true,
449
447
  },
450
448
  ],
@@ -456,7 +454,7 @@ if (process.argv.includes('--json')) process.stdout.write(JSON.stringify(result)
456
454
  {
457
455
  type: 'command',
458
456
  command: 'node "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/aqe-hook.cjs" pre-edit --file "$TOOL_INPUT_file_path" --json',
459
- timeout: 5000,
457
+ timeout: 5,
460
458
  continueOnError: true,
461
459
  },
462
460
  ],
@@ -468,7 +466,7 @@ if (process.argv.includes('--json')) process.stdout.write(JSON.stringify(result)
468
466
  {
469
467
  type: 'command',
470
468
  command: 'node "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/aqe-hook.cjs" pre-command --command "$TOOL_INPUT_command" --json',
471
- timeout: 3000,
469
+ timeout: 3,
472
470
  continueOnError: true,
473
471
  },
474
472
  ],
@@ -480,7 +478,7 @@ if (process.argv.includes('--json')) process.stdout.write(JSON.stringify(result)
480
478
  {
481
479
  type: 'command',
482
480
  command: 'node "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/aqe-hook.cjs" pre-task --description "$TOOL_INPUT_prompt" --json',
483
- timeout: 5000,
481
+ timeout: 5,
484
482
  continueOnError: true,
485
483
  },
486
484
  ],
@@ -493,7 +491,7 @@ if (process.argv.includes('--json')) process.stdout.write(JSON.stringify(result)
493
491
  {
494
492
  type: 'command',
495
493
  command: 'node "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/aqe-hook.cjs" post-edit --file "$TOOL_INPUT_file_path" --success --json',
496
- timeout: 5000,
494
+ timeout: 5,
497
495
  continueOnError: true,
498
496
  },
499
497
  ],
@@ -504,7 +502,7 @@ if (process.argv.includes('--json')) process.stdout.write(JSON.stringify(result)
504
502
  {
505
503
  type: 'command',
506
504
  command: 'node "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/aqe-hook.cjs" post-command --command "$TOOL_INPUT_command" --success true --json',
507
- timeout: 5000,
505
+ timeout: 5,
508
506
  continueOnError: true,
509
507
  },
510
508
  ],
@@ -515,7 +513,7 @@ if (process.argv.includes('--json')) process.stdout.write(JSON.stringify(result)
515
513
  {
516
514
  type: 'command',
517
515
  command: 'node "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/aqe-hook.cjs" post-task --task-id "$TOOL_RESULT_agent_id" --agent "$TOOL_INPUT_subagent_type" --success true --description "$TOOL_INPUT_prompt" --json',
518
- timeout: 5000,
516
+ timeout: 5,
519
517
  continueOnError: true,
520
518
  },
521
519
  ],
@@ -530,7 +528,7 @@ if (process.argv.includes('--json')) process.stdout.write(JSON.stringify(result)
530
528
  // var, so we let the CLI read stdin directly.
531
529
  type: 'command',
532
530
  command: 'node "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/aqe-hook.cjs" route --json',
533
- timeout: 5000,
531
+ timeout: 5,
534
532
  continueOnError: true,
535
533
  },
536
534
  ],
@@ -542,7 +540,7 @@ if (process.argv.includes('--json')) process.stdout.write(JSON.stringify(result)
542
540
  {
543
541
  type: 'command',
544
542
  command: 'node "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/aqe-hook.cjs" session-start --session-id "$SESSION_ID" --json',
545
- timeout: 10000,
543
+ timeout: 10,
546
544
  continueOnError: true,
547
545
  },
548
546
  ],
@@ -552,7 +550,7 @@ if (process.argv.includes('--json')) process.stdout.write(JSON.stringify(result)
552
550
  {
553
551
  type: 'command',
554
552
  command: 'sh -c \'exec node "${CLAUDE_PROJECT_DIR:-.}/.claude/helpers/brain-checkpoint.cjs" verify --json\'',
555
- timeout: 5000,
553
+ timeout: 5,
556
554
  continueOnError: true,
557
555
  },
558
556
  ],
@@ -564,7 +562,7 @@ if (process.argv.includes('--json')) process.stdout.write(JSON.stringify(result)
564
562
  {
565
563
  type: 'command',
566
564
  command: 'node "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/aqe-hook.cjs" session-end --save-state --json',
567
- timeout: 5000,
565
+ timeout: 5,
568
566
  continueOnError: true,
569
567
  },
570
568
  ],
@@ -578,7 +576,7 @@ if (process.argv.includes('--json')) process.stdout.write(JSON.stringify(result)
578
576
  // rows forever in direct-work sessions (no Task/Agent spawned).
579
577
  type: 'command',
580
578
  command: 'node "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/aqe-hook.cjs" post-route --success true --json',
581
- timeout: 5000,
579
+ timeout: 5,
582
580
  continueOnError: true,
583
581
  },
584
582
  ],
@@ -588,7 +586,7 @@ if (process.argv.includes('--json')) process.stdout.write(JSON.stringify(result)
588
586
  {
589
587
  type: 'command',
590
588
  command: 'sh -c \'exec node "${CLAUDE_PROJECT_DIR:-.}/.claude/helpers/brain-checkpoint.cjs" export --json\'',
591
- timeout: 60000,
589
+ timeout: 60,
592
590
  continueOnError: true,
593
591
  },
594
592
  ],
@@ -16,6 +16,10 @@ export interface AssetsResult {
16
16
  kiroHooks: number;
17
17
  platformsConfigured: string[];
18
18
  browserEngine?: BrowserEngineInstallResult;
19
+ codexGuidance?: {
20
+ policy: 'full' | 'compact' | 'none';
21
+ ownedBytes: number;
22
+ };
19
23
  }
20
24
  /**
21
25
  * Assets phase - installs skills and agents
@@ -8,7 +8,7 @@ import { BasePhase, } from './phase-interface.js';
8
8
  import { createSkillsInstaller } from '../skills-installer.js';
9
9
  import { createAgentsInstaller } from '../agents-installer.js';
10
10
  import { createN8nInstaller } from '../n8n-installer.js';
11
- import { installBrowserEngine, DEFAULT_VIBIUM_SPEC, } from '../browser-engine-installer.js';
11
+ import { installBrowserEngine, detectBrowserEngine, diagnosePlatform, DEFAULT_VIBIUM_SPEC, } from '../browser-engine-installer.js';
12
12
  import { initializeOverlays } from '../../routing/qe-agent-registry.js';
13
13
  /**
14
14
  * Assets phase - installs skills and agents
@@ -36,6 +36,7 @@ export class AssetsPhase extends BasePhase {
36
36
  let kiroAgents = 0;
37
37
  let kiroSkills = 0;
38
38
  let kiroHooks = 0;
39
+ let codexGuidance;
39
40
  if (options.upgrade) {
40
41
  context.services.log(` Upgrade mode: overwriting existing files`);
41
42
  }
@@ -93,15 +94,14 @@ export class AssetsPhase extends BasePhase {
93
94
  try {
94
95
  // Pre-flight check: if vibium is already on PATH, skip the loud
95
96
  // banner so we don't scare users on the common path.
96
- const alreadyHere = installBrowserEngine({
97
- skip: false,
98
- // Use a tiny timeout for the pre-flight detect-only call. The
99
- // installer will short-circuit on already-installed without
100
- // ever invoking npm.
101
- timeoutMs: 5_000,
102
- });
103
- if (alreadyHere.status === 'already-installed') {
104
- browserEngine = alreadyHere;
97
+ const detected = detectBrowserEngine();
98
+ if (detected.status === 'ready') {
99
+ browserEngine = {
100
+ status: 'already-installed',
101
+ version: detected.version,
102
+ packageSpec: DEFAULT_VIBIUM_SPEC,
103
+ platformHint: diagnosePlatform(),
104
+ };
105
105
  context.services.log(` Browser engine: vibium ${browserEngine.version} (already installed)`);
106
106
  }
107
107
  else {
@@ -298,9 +298,11 @@ export class AssetsPhase extends BasePhase {
298
298
  overwrite: shouldOverwrite,
299
299
  installMcp: !options.noMcp,
300
300
  includeRuflo: options.withRuflo,
301
+ guidancePolicy: options.codexGuidance,
301
302
  memoryBackend: options.memoryBackend === 'memory' ? 'memory' : undefined,
302
303
  });
303
304
  const res = await installer.install();
305
+ codexGuidance = { policy: res.guidancePolicy, ownedBytes: res.ownedGuidanceBytes };
304
306
  if (res.mcpConfigured)
305
307
  platformsConfigured.push('codex');
306
308
  if (res.errors.length > 0)
@@ -358,6 +360,7 @@ export class AssetsPhase extends BasePhase {
358
360
  kiroHooks,
359
361
  platformsConfigured,
360
362
  browserEngine,
363
+ codexGuidance,
361
364
  };
362
365
  }
363
366
  /**
@@ -123,6 +123,8 @@ export interface InitOptions {
123
123
  withCodex?: boolean;
124
124
  /** Include optional Ruflo guidance and Codex lifecycle integration */
125
125
  withRuflo?: boolean;
126
+ /** Codex AGENTS.md guidance policy. */
127
+ codexGuidance?: 'full' | 'compact' | 'none';
126
128
  /** Install Windsurf MCP config and rules */
127
129
  withWindsurf?: boolean;
128
130
  /** Install Continue.dev MCP config and rules */
@@ -223,6 +223,10 @@ export interface InitResult {
223
223
  agents: number;
224
224
  skills: number;
225
225
  };
226
+ codexGuidance?: {
227
+ policy: 'full' | 'compact' | 'none';
228
+ ownedBytes: number;
229
+ };
226
230
  };
227
231
  totalDurationMs: number;
228
232
  timestamp: Date;
@@ -68,9 +68,11 @@ export class EmbeddingGenerator {
68
68
  }
69
69
  catch (err) {
70
70
  throw new Error('Local (in-process) embeddings require the optional dependency ' +
71
- '"@huggingface/transformers", which is not installed. Either run ' +
72
- '`npm install @huggingface/transformers`, or configure an embedding ' +
71
+ '"@huggingface/transformers", which is not installed. Configure an embedding ' +
73
72
  'endpoint (e.g. Cognitum /v1/embeddings) so the local backend is not needed. ' +
73
+ 'Installing @huggingface/transformers@4.2.0 is an explicit security opt-in: ' +
74
+ 'its compatible dependency chain currently has unresolved HIGH advisories ' +
75
+ 'GHSA-xcpc-8h2w-3j85 and GHSA-f88m-g3jw-g9cj. ' +
74
76
  `Underlying import error: ${err instanceof Error ? err.message : String(err)}`);
75
77
  }
76
78
  this.model = await pipeline('feature-extraction', this.config.model, {
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * QE Brain Export/Import System
3
3
  *
4
- * Exports learning state (25 tables) into a portable directory format
4
+ * Exports learning state (31 tables) into a portable directory format
5
5
  * that can be imported by another AQE instance.
6
6
  *
7
7
  * Export format (.aqe-brain directory):
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * QE Brain Export/Import System
3
3
  *
4
- * Exports learning state (25 tables) into a portable directory format
4
+ * Exports learning state (31 tables) into a portable directory format
5
5
  * that can be imported by another AQE instance.
6
6
  *
7
7
  * Export format (.aqe-brain directory):
@@ -51,9 +51,21 @@ function exportTableRows(db, config, options, outDir) {
51
51
  writeJsonl(join(outDir, config.fileName), []);
52
52
  return { count: 0, rows: [] };
53
53
  }
54
- const [where, params] = config.domainColumn
54
+ let [where, params] = config.domainColumn
55
55
  ? domainFilterForColumn(options.domains, config.domainColumn)
56
56
  : [undefined, []];
57
+ if (options.domains && options.domains.length > 0 && !config.domainColumn) {
58
+ const placeholders = options.domains.map(() => '?').join(',');
59
+ const manifestFilter = `manifest_id IN (SELECT id FROM learning_evidence_manifests WHERE task_family IN (${placeholders}))`;
60
+ if (['learning_evidence_segments', 'learning_segment_edges', 'learning_evidence_admissions'].includes(config.tableName)) {
61
+ where = manifestFilter;
62
+ params = [...options.domains];
63
+ }
64
+ else if (['pattern_manifest_lineage', 'pattern_segment_lineage'].includes(config.tableName)) {
65
+ where = `${manifestFilter} AND pattern_id IN (SELECT id FROM qe_patterns WHERE qe_domain IN (${placeholders}))`;
66
+ params = [...options.domains, ...options.domains];
67
+ }
68
+ }
57
69
  const rowCount = countRows(db, config.tableName, where, params);
58
70
  // For large tables, stream to avoid OOM
59
71
  if (rowCount >= STREAMING_THRESHOLD) {
@@ -232,7 +244,7 @@ export function importBrain(db, containerPath, options) {
232
244
  let result;
233
245
  if (config.dedupColumns && config.dedupColumns.length > 0) {
234
246
  // Append-only tables (witness_chain, qe_pattern_usage)
235
- result = mergeAppendOnlyRow(db, config.tableName, row, config.dedupColumns);
247
+ result = mergeAppendOnlyRow(db, config.tableName, row, config.dedupColumns, config.preserveId);
236
248
  }
237
249
  else {
238
250
  // Tables with TEXT PK
@@ -17,6 +17,8 @@ export interface RvfBrainManifest {
17
17
  readonly dreamInsightCount: number;
18
18
  readonly witnessChainLength: number;
19
19
  readonly totalRecords?: number;
20
+ /** Per-table row counts used by the recovery-mirror richness guard. */
21
+ readonly tableCounts?: Readonly<Record<string, number>>;
20
22
  };
21
23
  readonly domains: readonly string[];
22
24
  readonly checksum: string;
@@ -44,6 +46,8 @@ export interface RvfBrainExportOptions {
44
46
  readonly sign?: boolean;
45
47
  /** Key identifier to record in manifest when signing */
46
48
  readonly signerKeyId?: string;
49
+ /** Explicit operator acknowledgement that a richer existing mirror may be replaced. */
50
+ readonly allowOverwriteRicher?: boolean;
47
51
  }
48
52
  export interface RvfBrainImportOptions {
49
53
  readonly mergeStrategy: MergeStrategy;
@@ -110,6 +110,25 @@ export function exportBrainToRvf(db, options, sourceDbLabel = 'memory.db') {
110
110
  ? domainFilterForColumn(options.domains, config.domainColumn)
111
111
  : [undefined, []];
112
112
  let rows = queryAll(db, config.tableName, where, params);
113
+ if (options.domains && options.domains.length > 0) {
114
+ const manifestIds = new Set((allTableData.learning_evidence_manifests ?? []).map(row => row.id));
115
+ const patternIds = new Set((allTableData.qe_patterns ?? []).map(row => row.id));
116
+ if (['learning_evidence_segments', 'learning_segment_edges', 'learning_evidence_admissions'].includes(config.tableName)) {
117
+ rows = rows.filter(row => manifestIds.has(row.manifest_id));
118
+ }
119
+ else if (config.tableName === 'pattern_manifest_lineage') {
120
+ rows = rows.filter(row => {
121
+ const lineage = row;
122
+ return manifestIds.has(lineage.manifest_id) && patternIds.has(lineage.pattern_id);
123
+ });
124
+ }
125
+ else if (config.tableName === 'pattern_segment_lineage') {
126
+ rows = rows.filter(row => {
127
+ const lineage = row;
128
+ return manifestIds.has(lineage.manifest_id) && patternIds.has(lineage.pattern_id);
129
+ });
130
+ }
131
+ }
113
132
  if (config.tableName === 'qe_patterns') {
114
133
  for (const p of rows) {
115
134
  if (p.qe_domain)
@@ -128,50 +147,28 @@ export function exportBrainToRvf(db, options, sourceDbLabel = 'memory.db') {
128
147
  let embeddingCount = 0;
129
148
  const embeddingEntries = [];
130
149
  if (tableExists(db, 'qe_pattern_embeddings')) {
131
- const rows = db.prepare('SELECT pattern_id, embedding, dimension FROM qe_pattern_embeddings').all();
150
+ const hasSpaceId = db.prepare("PRAGMA table_info('qe_pattern_embeddings')").all()
151
+ .some((column) => column.name === 'space_id');
152
+ const rows = db.prepare(`SELECT pattern_id, embedding, dimension, ${hasSpaceId ? 'space_id' : 'NULL'} AS space_id
153
+ FROM qe_pattern_embeddings`).all();
132
154
  for (const row of rows) {
133
- if (row.embedding && row.dimension === dimension) {
155
+ // Legacy vectors without executable provenance remain in the embedded
156
+ // SQLite kernel for re-embedding, but must never enter the portable ANN
157
+ // index where their space would be indistinguishable from query vectors.
158
+ if (row.embedding && row.dimension === dimension && row.space_id) {
134
159
  embeddingEntries.push({
135
160
  id: `pe:${row.pattern_id}`,
136
161
  vector: new Float32Array(row.embedding.buffer, row.embedding.byteOffset, dimension),
137
- metadata: { tableName: 'qe_pattern_embeddings' },
138
- });
139
- }
140
- }
141
- }
142
- if (tableExists(db, 'captured_experiences')) {
143
- const rows = db.prepare('SELECT id, embedding, embedding_dimension, domain, quality FROM captured_experiences WHERE embedding IS NOT NULL').all();
144
- for (const row of rows) {
145
- if (row.embedding_dimension === dimension) {
146
- embeddingEntries.push({
147
- id: `exp:${row.id}`,
148
- vector: new Float32Array(row.embedding.buffer, row.embedding.byteOffset, dimension),
149
- metadata: {
150
- tableName: 'captured_experiences',
151
- domain: row.domain,
152
- confidence: row.quality,
153
- },
154
- });
155
- }
156
- }
157
- }
158
- if (tableExists(db, 'sona_patterns')) {
159
- const rows = db.prepare('SELECT id, state_embedding, domain, confidence FROM sona_patterns WHERE state_embedding IS NOT NULL').all();
160
- for (const row of rows) {
161
- const dim = row.state_embedding.byteLength / 4;
162
- if (dim === dimension) {
163
- embeddingEntries.push({
164
- id: `sona:${row.id}`,
165
- vector: new Float32Array(row.state_embedding.buffer, row.state_embedding.byteOffset, dimension),
166
- metadata: {
167
- tableName: 'sona_patterns',
168
- domain: row.domain,
169
- confidence: row.confidence,
170
- },
162
+ metadata: { tableName: 'qe_pattern_embeddings', spaceId: row.space_id },
171
163
  });
172
164
  }
173
165
  }
174
166
  }
167
+ // captured_experiences and sona_patterns are still included in the kernel
168
+ // below, but their schemas do not yet carry embedding-space provenance.
169
+ // Mixing them into this ANN index would violate #633 even when dimensions
170
+ // and model labels happen to match, so they are intentionally excluded
171
+ // until their own write paths persist a space_id.
175
172
  if (embeddingEntries.length > 0) {
176
173
  const result = rvf.ingest(embeddingEntries);
177
174
  embeddingCount = result.accepted;
@@ -210,6 +207,7 @@ export function exportBrainToRvf(db, options, sourceDbLabel = 'memory.db') {
210
207
  dreamInsightCount: (allTableData['dream_insights'] || []).length,
211
208
  witnessChainLength: (allTableData['witness_chain'] || []).length,
212
209
  totalRecords,
210
+ tableCounts: Object.fromEntries(TABLE_CONFIGS.map(({ tableName }) => [tableName, allTableData[tableName]?.length ?? 0])),
213
211
  },
214
212
  domains: brainData.domains,
215
213
  checksum,
@@ -235,6 +233,53 @@ export function exportBrainToRvf(db, options, sourceDbLabel = 'memory.db') {
235
233
  // sidecar, so renaming any earlier would publish an incomplete store.
236
234
  rvf.close();
237
235
  closed = true;
236
+ // Issue #629: a stage-2 mirror must not be destroyed when SQLite has just
237
+ // been recreated from seed data. Compare every mirrored table in the fully
238
+ // materialized candidate with the still-published store immediately before
239
+ // promotion. Inspection is fail-closed when the RVF itself remains readable
240
+ // but its kernel cannot yield a complete table inventory. A genuinely
241
+ // unreadable/corrupt RVF remains replaceable to preserve #563 recovery.
242
+ if (existsSync(outPath) && !options.allowOverwriteRicher) {
243
+ let existing;
244
+ try {
245
+ existing = brainInfoFromRvf(outPath);
246
+ }
247
+ catch (error) {
248
+ if (hasReadableBrainKernel(outPath) || !isKnownUnusableRvfError(error)) {
249
+ const detail = error instanceof Error ? error.message : String(error);
250
+ throw new Error(`RVF_MIRROR_INSPECTION_AMBIGUOUS: the existing mirror is readable but its ` +
251
+ `richness could not be established (${detail}). Preserve/import it before retrying, ` +
252
+ `or repeat with --force-overwrite-richer after preserving a backup.`);
253
+ }
254
+ }
255
+ if (existing) {
256
+ const existingCounts = existing.stats.tableCounts;
257
+ const candidateCounts = manifest.stats.tableCounts;
258
+ const missing = TABLE_CONFIGS
259
+ .map(({ tableName }) => tableName)
260
+ .filter((tableName) => !existingCounts || !Number.isSafeInteger(existingCounts[tableName]));
261
+ if (missing.length > 0) {
262
+ throw new Error(`RVF_MIRROR_INSPECTION_AMBIGUOUS: existing mirror lacks trustworthy counts for ` +
263
+ `${missing.join(', ')}. Preserve/import it before retrying, or repeat with ` +
264
+ `--force-overwrite-richer after preserving a backup.`);
265
+ }
266
+ const richer = TABLE_CONFIGS
267
+ .map(({ tableName }) => ({
268
+ tableName,
269
+ existing: existingCounts[tableName],
270
+ candidate: candidateCounts[tableName],
271
+ }))
272
+ .filter(({ existing: existingCount, candidate }) => existingCount > candidate);
273
+ if (richer.length > 0) {
274
+ const differences = richer
275
+ .map(({ tableName, existing: existingCount, candidate }) => `${tableName} ${existingCount} -> ${candidate}`)
276
+ .join(', ');
277
+ throw new Error(`RVF_MIRROR_RICHER: refusing to replace richer mirrored tables: ${differences}. ` +
278
+ `Restore/import the mirror first, or repeat with --force-overwrite-richer after ` +
279
+ `preserving a backup.`);
280
+ }
281
+ }
282
+ }
238
283
  // Promote tmp → final. The store itself goes last: until it lands, the
239
284
  // previous store (if any) is still the one on disk, and a crash mid-promote
240
285
  // leaves the old store readable rather than a half-written new one.
@@ -263,6 +308,36 @@ export function exportBrainToRvf(db, options, sourceDbLabel = 'memory.db') {
263
308
  throw err;
264
309
  }
265
310
  }
311
+ /**
312
+ * Distinguish a corrupt/unopenable store (#563, replaceable) from a readable
313
+ * store whose richness inspection failed (ambiguous, therefore protected).
314
+ */
315
+ function hasReadableBrainKernel(rvfPath) {
316
+ let rvf;
317
+ try {
318
+ rvf = openRvfStoreReadonly(resolve(rvfPath));
319
+ const kernel = rvf.extractKernel();
320
+ return Boolean(kernel?.image);
321
+ }
322
+ catch {
323
+ return false;
324
+ }
325
+ finally {
326
+ try {
327
+ rvf?.close();
328
+ }
329
+ catch { /* best-effort probe cleanup */ }
330
+ }
331
+ }
332
+ /**
333
+ * Only known structural corruption is replaceable without an operator
334
+ * override. Permission, locking, I/O, and programmer errors are ambiguous and
335
+ * must fail closed instead of being mistaken for disposable corruption.
336
+ */
337
+ function isKnownUnusableRvfError(error) {
338
+ const message = error instanceof Error ? error.message : String(error);
339
+ return /ManifestNotFound|InvalidMagic|ChecksumMismatch|CorruptStore/i.test(message);
340
+ }
266
341
  /** Legacy field-to-table mapping for older RVF exports. */
267
342
  const LEGACY_FIELD_MAP = {
268
343
  patterns: 'qe_patterns',
@@ -359,7 +434,7 @@ export function importBrainFromRvf(db, rvfPath, options) {
359
434
  for (const row of rows) {
360
435
  let result;
361
436
  if (config.dedupColumns && config.dedupColumns.length > 0) {
362
- result = mergeAppendOnlyRow(db, config.tableName, row, config.dedupColumns);
437
+ result = mergeAppendOnlyRow(db, config.tableName, row, config.dedupColumns, config.preserveId);
363
438
  }
364
439
  else {
365
440
  const idCol = PK_COLUMNS[config.tableName] || 'id';
@@ -418,6 +493,11 @@ export function brainInfoFromRvf(rvfPath) {
418
493
  const qValueCount = t ? (t['rl_q_values']?.length ?? 0) : (brainData.qValues?.length ?? 0);
419
494
  const dreamInsightCount = t ? (t['dream_insights']?.length ?? 0) : (brainData.dreamInsights?.length ?? 0);
420
495
  const witnessChainLength = t ? (t['witness_chain']?.length ?? 0) : (brainData.witnessChain?.length ?? 0);
496
+ const tableCounts = t && typeof t === 'object' && !Array.isArray(t)
497
+ ? Object.fromEntries(Object.entries(t)
498
+ .filter((entry) => Array.isArray(entry[1]))
499
+ .map(([tableName, rows]) => [tableName, rows.length]))
500
+ : undefined;
421
501
  return {
422
502
  version: '3.0',
423
503
  format: 'rvf',
@@ -429,6 +509,7 @@ export function brainInfoFromRvf(rvfPath) {
429
509
  qValueCount,
430
510
  dreamInsightCount,
431
511
  witnessChainLength,
512
+ ...(tableCounts ? { tableCounts } : {}),
432
513
  },
433
514
  domains: brainData.domains ?? [],
434
515
  checksum: sha256(brainJson),
@@ -4,7 +4,7 @@
4
4
  * Offline, read-only filtered search over a JSONL brain export directory.
5
5
  * Useful for exploring what a snapshot contains without importing it.
6
6
  *
7
- * Defaults to searching qe_patterns but can target any of the 25 exported
7
+ * Defaults to searching qe_patterns but can target any of the 31 exported
8
8
  * tables via the `table` option. Supports filters by domain, pattern_type,
9
9
  * date range, and a substring query that matches `name` + `description`.
10
10
  *
@@ -4,7 +4,7 @@
4
4
  * Offline, read-only filtered search over a JSONL brain export directory.
5
5
  * Useful for exploring what a snapshot contains without importing it.
6
6
  *
7
- * Defaults to searching qe_patterns but can target any of the 25 exported
7
+ * Defaults to searching qe_patterns but can target any of the 31 exported
8
8
  * tables via the `table` option. Supports filters by domain, pattern_type,
9
9
  * date range, and a substring query that matches `name` + `description`.
10
10
  *
@@ -7,7 +7,7 @@
7
7
  * This module owns:
8
8
  * - Row type interfaces (PatternRow, QValueRow, DreamInsightRow, WitnessRow)
9
9
  * - Merge result type and merge strategy type
10
- * - TABLE_CONFIGS: data-driven list of all 25 exportable tables
10
+ * - TABLE_CONFIGS: data-driven list of all 31 exportable tables
11
11
  * - All 4 legacy merge functions + generic mergeGenericRow / mergeAppendOnlyRow
12
12
  * - All SQL insert/update helpers
13
13
  * - Utility functions (sha256, tableExists, queryAll, domainFilter, countRows)
@@ -94,6 +94,8 @@ export interface TableExportConfig {
94
94
  readonly blobColumns?: readonly string[];
95
95
  /** For tables with AUTOINCREMENT PK, specify dedup columns. */
96
96
  readonly dedupColumns?: readonly string[];
97
+ /** Preserve an `id` column when a deduplicated table does not use AUTOINCREMENT. */
98
+ readonly preserveId?: boolean;
97
99
  }
98
100
  /** PK column for tables with non-standard PK names. Default is 'id'. */
99
101
  export declare const PK_COLUMNS: Record<string, string>;
@@ -138,7 +140,7 @@ export declare function mergeGenericRow(db: Database.Database, tableName: string
138
140
  * Merge for append-only tables (AUTOINCREMENT PK).
139
141
  * Deduplicates by checking composite columns; inserts if no match found.
140
142
  */
141
- export declare function mergeAppendOnlyRow(db: Database.Database, tableName: string, row: Record<string, unknown>, dedupColumns: readonly string[]): MergeResult;
143
+ export declare function mergeAppendOnlyRow(db: Database.Database, tableName: string, row: Record<string, unknown>, dedupColumns: readonly string[], preserveId?: boolean): MergeResult;
142
144
  export declare function mergePattern(db: Database.Database, pattern: PatternRow, strategy: MergeStrategy): MergeResult;
143
145
  export declare function mergeQValue(db: Database.Database, qv: QValueRow, strategy: MergeStrategy): MergeResult;
144
146
  export declare function mergeDreamInsight(db: Database.Database, insight: DreamInsightRow, strategy: MergeStrategy): MergeResult;