agentic-qe 3.14.4 → 3.14.6

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 (486) hide show
  1. package/.claude/skills/skills-manifest.json +1 -1
  2. package/CHANGELOG.md +169 -0
  3. package/assets/skills/skills-manifest.json +1 -1
  4. package/dist/adapters/ag-ui/event-types.d.ts +1 -1
  5. package/dist/audit/witness-chain-hash.d.ts +18 -0
  6. package/dist/audit/witness-chain-hash.js +37 -0
  7. package/dist/audit/witness-chain-repair.d.ts +71 -0
  8. package/dist/audit/witness-chain-repair.js +203 -0
  9. package/dist/audit/witness-chain-verifier.d.ts +152 -0
  10. package/dist/audit/witness-chain-verifier.js +293 -0
  11. package/dist/audit/witness-chain.d.ts +10 -43
  12. package/dist/audit/witness-chain.js +43 -126
  13. package/dist/audit/witness-findings.js +4 -1
  14. package/dist/cli/bundle.js +13 -10
  15. package/dist/cli/chunks/adapter-UYOJPTOX.js +2 -0
  16. package/dist/cli/chunks/agent-booster-wasm-2YGML6OU.js +2 -0
  17. package/dist/cli/chunks/{agent-handler-RDNTK4CA.js → agent-handler-D5SSQYNU.js} +2 -2
  18. package/dist/cli/chunks/{agent-memory-branch-NAAMBWIR.js → agent-memory-branch-YHPLTITV.js} +2 -2
  19. package/dist/cli/chunks/aqe-learning-engine-JR5AVQXR.js +2 -0
  20. package/dist/cli/chunks/{arena-KXFHRWX4.js → arena-7BGOXGXO.js} +2 -2
  21. package/dist/cli/chunks/{arena-HXTWJ5YY.js → arena-MCE6EU7K.js} +4 -4
  22. package/dist/cli/chunks/audit-BMWTQECB.js +4 -0
  23. package/dist/cli/chunks/base-DRZ2LS6X.js +2 -0
  24. package/dist/cli/chunks/{better-sqlite3-UICJZIDG.js → better-sqlite3-PMUNGASU.js} +2 -2
  25. package/dist/cli/chunks/brain-handler-QPUFYX7F.js +94 -0
  26. package/dist/cli/chunks/{branch-enumerator-SS7UNVIA.js → branch-enumerator-WKFDGRN4.js} +2 -2
  27. package/dist/cli/chunks/{browser-77GI6KBE.js → browser-VY5HKH5X.js} +2 -2
  28. package/dist/cli/chunks/browser-workflow-CJ7T3MXF.js +2 -0
  29. package/dist/cli/chunks/{chunk-PZJOPURC.js → chunk-257E2A5M.js} +5 -5
  30. package/dist/cli/chunks/{chunk-55RWDRJD.js → chunk-2JVWITNK.js} +4 -4
  31. package/dist/cli/chunks/{chunk-BOARZKU3.js → chunk-2NPKIBAZ.js} +2 -2
  32. package/dist/cli/chunks/chunk-2TMWAQQ3.js +13 -0
  33. package/dist/cli/chunks/{chunk-M4WJKGVK.js → chunk-2YXGBZWV.js} +1 -1
  34. package/dist/cli/chunks/{chunk-3VOQRIQM.js → chunk-3EA536JF.js} +2 -2
  35. package/dist/cli/chunks/{chunk-ZZDIMOOV.js → chunk-3EZOZN25.js} +2 -2
  36. package/dist/cli/chunks/{chunk-MNW6QGNJ.js → chunk-3HZS4M3O.js} +2 -2
  37. package/dist/cli/chunks/{chunk-EKQ673SA.js → chunk-3NIG7S5W.js} +1 -1
  38. package/dist/cli/chunks/{chunk-7D777LTF.js → chunk-4N23RFDU.js} +2 -2
  39. package/dist/cli/chunks/{chunk-BOZZYWCR.js → chunk-5J6W7SIA.js} +1 -1
  40. package/dist/cli/chunks/{chunk-HIVA55CJ.js → chunk-5OOMJGFN.js} +1 -1
  41. package/dist/cli/chunks/{chunk-W7BWUTVV.js → chunk-5QQSIGUA.js} +2 -2
  42. package/dist/cli/chunks/{chunk-PAWXJ73E.js → chunk-5VFPCSK7.js} +1 -1
  43. package/dist/cli/chunks/{chunk-KPA7MZ6C.js → chunk-62N4NUJH.js} +2 -2
  44. package/dist/cli/chunks/chunk-64VGZQLB.js +2 -0
  45. package/dist/cli/chunks/{chunk-64PFWE2F.js → chunk-66VWCR67.js} +2 -2
  46. package/dist/cli/chunks/{chunk-XRT2WRMS.js → chunk-6LIHFV7O.js} +2 -2
  47. package/dist/cli/chunks/{chunk-STJCATGN.js → chunk-6OS76PHI.js} +2 -2
  48. package/dist/cli/chunks/{chunk-ZNPKDCZR.js → chunk-6RE3X4V5.js} +2 -2
  49. package/dist/cli/chunks/{chunk-BFP7KO7P.js → chunk-6SH5VZUD.js} +2 -2
  50. package/dist/cli/chunks/chunk-6SQM2MUX.js +4 -0
  51. package/dist/cli/chunks/{chunk-IPR4QP3H.js → chunk-6U7LNMWZ.js} +2 -2
  52. package/dist/cli/chunks/{chunk-MIQTXNBG.js → chunk-72KXSMWI.js} +1 -1
  53. package/dist/cli/chunks/chunk-7CUQCCMD.js +27 -0
  54. package/dist/cli/chunks/chunk-7D3V65N5.js +2 -0
  55. package/dist/cli/chunks/{chunk-JZ3ORVZ3.js → chunk-7J6QC567.js} +3 -3
  56. package/dist/cli/chunks/{chunk-4OYFXLBK.js → chunk-7LPR6HJG.js} +2 -2
  57. package/dist/cli/chunks/{chunk-4MHXCAG2.js → chunk-7NITCZWD.js} +1 -1
  58. package/dist/cli/chunks/{chunk-M5QUBZY6.js → chunk-7Z5LHRC3.js} +2 -2
  59. package/dist/cli/chunks/{chunk-CSU5NYOX.js → chunk-AHKELLIO.js} +4 -4
  60. package/dist/cli/chunks/{chunk-DHJPWQBR.js → chunk-AIRGNL55.js} +2 -2
  61. package/dist/cli/chunks/{chunk-C2WU3533.js → chunk-AJRUJAAK.js} +1 -1
  62. package/dist/cli/chunks/{chunk-HIYXCDEP.js → chunk-AVBJYI5I.js} +1 -1
  63. package/dist/cli/chunks/{chunk-U5K45TFH.js → chunk-B6D2CHEH.js} +1 -1
  64. package/dist/cli/chunks/{chunk-FRH6VAUS.js → chunk-B6MOJC3X.js} +1 -1
  65. package/dist/cli/chunks/{chunk-HUWNIPZ5.js → chunk-BAMN2CHI.js} +1 -1
  66. package/dist/cli/chunks/{chunk-ONII3572.js → chunk-BBT64TII.js} +3 -3
  67. package/dist/cli/chunks/{chunk-KSKEF7LZ.js → chunk-BJTJLJRZ.js} +3 -3
  68. package/dist/cli/chunks/chunk-BMAPORJ7.js +15 -0
  69. package/dist/cli/chunks/{chunk-CIZ5JPDC.js → chunk-BPEDWS6O.js} +3 -3
  70. package/dist/cli/chunks/{chunk-Z3RHREWF.js → chunk-BVR7RMC5.js} +1 -1
  71. package/dist/cli/chunks/{chunk-HDSAM2RE.js → chunk-C6KWXUFJ.js} +2 -2
  72. package/dist/cli/chunks/{chunk-ZBAKA4YB.js → chunk-CCK4BF76.js} +1 -1
  73. package/dist/cli/chunks/{chunk-IFCLB7FJ.js → chunk-CD542DNJ.js} +1 -1
  74. package/dist/cli/chunks/{chunk-6KJABXAR.js → chunk-CF2ISEOJ.js} +2 -2
  75. package/dist/cli/chunks/chunk-CM7U6TAX.js +5 -0
  76. package/dist/cli/chunks/{chunk-3X3DJZJJ.js → chunk-D45SG6CP.js} +1 -1
  77. package/dist/cli/chunks/{chunk-DAEFDCJ4.js → chunk-D6CJIGRU.js} +89 -83
  78. package/dist/cli/chunks/{chunk-MVPCNSPY.js → chunk-DBDPRORT.js} +2 -2
  79. package/dist/cli/chunks/{chunk-AUXFKCQL.js → chunk-DHVX5UB2.js} +2 -2
  80. package/dist/cli/chunks/{chunk-GPLQ6DOK.js → chunk-DK4XN4CU.js} +2 -2
  81. package/dist/cli/chunks/{chunk-SRKETSFF.js → chunk-DPYSUDAO.js} +1 -1
  82. package/dist/cli/chunks/{chunk-CNG6GQEZ.js → chunk-DUYOVM5I.js} +2 -2
  83. package/dist/cli/chunks/{chunk-VIHTL3U2.js → chunk-DZ3AUAAB.js} +2 -2
  84. package/dist/cli/chunks/{chunk-CU46J64M.js → chunk-E6G2RD5H.js} +2 -2
  85. package/dist/cli/chunks/{chunk-5YPYDPBJ.js → chunk-EAY2JMZG.js} +2 -2
  86. package/dist/cli/chunks/{chunk-V3QLFNA2.js → chunk-ELLBS5RP.js} +4 -4
  87. package/dist/cli/chunks/chunk-ENGZ4D5V.js +2 -0
  88. package/dist/cli/chunks/chunk-FBMN7B46.js +4 -0
  89. package/dist/cli/chunks/{chunk-EDJ3O7RH.js → chunk-FWASDOT2.js} +2 -2
  90. package/dist/cli/chunks/{chunk-MDWCE7YW.js → chunk-FZOBD67M.js} +1 -1
  91. package/dist/cli/chunks/{chunk-A4FYONNU.js → chunk-GDSXITFH.js} +2 -2
  92. package/dist/cli/chunks/{chunk-2JW3BCGG.js → chunk-GGRHV6D7.js} +1 -1
  93. package/dist/cli/chunks/{chunk-ISDMD6EU.js → chunk-GPYVDFB3.js} +90 -90
  94. package/dist/cli/chunks/{chunk-CDKG6EI7.js → chunk-GSF6MB64.js} +2 -2
  95. package/dist/cli/chunks/{chunk-WLG5AJ4N.js → chunk-H52HZ67P.js} +2 -2
  96. package/dist/cli/chunks/{chunk-FGYMFUE2.js → chunk-H5BS5VH7.js} +2 -2
  97. package/dist/cli/chunks/{chunk-34WO57CW.js → chunk-H6ZM3PUT.js} +1 -1
  98. package/dist/cli/chunks/{chunk-6CQN24ZK.js → chunk-HM6ZSCPI.js} +1 -1
  99. package/dist/cli/chunks/{chunk-DPFRKBOG.js → chunk-HNFVJP4I.js} +2 -2
  100. package/dist/cli/chunks/{chunk-TPGED2IF.js → chunk-I33ERSGB.js} +2 -2
  101. package/dist/cli/chunks/{chunk-UEM7ZF5K.js → chunk-IAF6T27S.js} +2 -2
  102. package/dist/cli/chunks/{chunk-KCZR45PA.js → chunk-IB27QACC.js} +2 -2
  103. package/dist/cli/chunks/{chunk-SGYJ4NFZ.js → chunk-ICTXTNQZ.js} +1 -1
  104. package/dist/cli/chunks/chunk-IG5GNEC6.js +4 -0
  105. package/dist/cli/chunks/{chunk-KHFNNVJA.js → chunk-IQO7UCFR.js} +2 -2
  106. package/dist/cli/chunks/{chunk-3TW5W5LX.js → chunk-IV5UZOHH.js} +2 -2
  107. package/dist/cli/chunks/{chunk-7ZIOFPL3.js → chunk-JBTPOIAC.js} +2 -2
  108. package/dist/cli/chunks/{chunk-ZNEMGX5O.js → chunk-JIXUMYKZ.js} +1 -1
  109. package/dist/cli/chunks/{chunk-MTZH7AHC.js → chunk-JMONHE4B.js} +1 -1
  110. package/dist/cli/chunks/{chunk-TDZ53WO2.js → chunk-JVNTSNWU.js} +2 -2
  111. package/dist/cli/chunks/{chunk-PFR4G3DJ.js → chunk-JXGFRBUO.js} +2 -2
  112. package/dist/cli/chunks/chunk-JZOS5FCX.js +2 -0
  113. package/dist/cli/chunks/{chunk-STM3UDNO.js → chunk-KNNISEDY.js} +2 -2
  114. package/dist/cli/chunks/{chunk-TWAWHOP7.js → chunk-L4RUBPLR.js} +2 -2
  115. package/dist/cli/chunks/chunk-LL3IGZBI.js +2 -0
  116. package/dist/cli/chunks/{chunk-CIKSHTEQ.js → chunk-MBRHSU6W.js} +10 -10
  117. package/dist/cli/chunks/{chunk-G6T45OIC.js → chunk-MJS53PRX.js} +2 -2
  118. package/dist/cli/chunks/{chunk-PO3IXGMQ.js → chunk-MQROI74N.js} +2 -2
  119. package/dist/cli/chunks/{chunk-DOTK76IJ.js → chunk-MUOG6QXR.js} +2 -2
  120. package/dist/cli/chunks/{chunk-MVNP7GIR.js → chunk-MW2GGZZ5.js} +1 -1
  121. package/dist/cli/chunks/{chunk-FWGOHAAB.js → chunk-NHWGMJAP.js} +2 -2
  122. package/dist/cli/chunks/{chunk-ZBJ4XOOV.js → chunk-NMAIY4PX.js} +4 -4
  123. package/dist/cli/chunks/{chunk-CDHQFHRP.js → chunk-NQZ5AR3D.js} +2 -2
  124. package/dist/cli/chunks/{chunk-FLYOJOKN.js → chunk-P6OYS755.js} +1 -1
  125. package/dist/cli/chunks/{chunk-BGE6FOLM.js → chunk-PI7TJS62.js} +2 -2
  126. package/dist/cli/chunks/chunk-PX5YDCRH.js +4 -0
  127. package/dist/cli/chunks/{chunk-Q5DO24IJ.js → chunk-PZPWRQ2M.js} +3 -3
  128. package/dist/cli/chunks/{chunk-R4VL6E65.js → chunk-Q5XTSMWR.js} +2 -2
  129. package/dist/cli/chunks/{chunk-JBNEE5UH.js → chunk-Q7EAGKAE.js} +2 -2
  130. package/dist/cli/chunks/{chunk-R5NE6B2M.js → chunk-QDFTT3RF.js} +2 -2
  131. package/dist/cli/chunks/{chunk-DFZCKIGY.js → chunk-QGA55PFM.js} +3 -3
  132. package/dist/cli/chunks/{chunk-RJCYCLZV.js → chunk-QW6VMTBR.js} +2 -2
  133. package/dist/cli/chunks/{chunk-6VRA2QGL.js → chunk-QZANMBIT.js} +1 -1
  134. package/dist/cli/chunks/{chunk-MEGDYJPV.js → chunk-RETBYIAC.js} +4 -4
  135. package/dist/cli/chunks/{chunk-XJ7QNVI5.js → chunk-RFNPJK6N.js} +3 -3
  136. package/dist/cli/chunks/{chunk-NJBGXDQ7.js → chunk-RG52OKAM.js} +1 -1
  137. package/dist/cli/chunks/{chunk-DA5K5754.js → chunk-RSXXCL4A.js} +1 -1
  138. package/dist/cli/chunks/{chunk-HV2J7KKQ.js → chunk-RTFO5UQH.js} +2 -2
  139. package/dist/cli/chunks/{chunk-6UWGMOND.js → chunk-RZZCUIAI.js} +2 -2
  140. package/dist/cli/chunks/chunk-SDRHUMJB.js +2 -0
  141. package/dist/cli/chunks/{chunk-TSRSV3LD.js → chunk-SE4WIB26.js} +1 -1
  142. package/dist/cli/chunks/{chunk-ODKLFVYC.js → chunk-SESK3ARK.js} +2 -2
  143. package/dist/cli/chunks/{chunk-AWWNB2T7.js → chunk-SJUXE4IC.js} +2 -2
  144. package/dist/cli/chunks/{chunk-QGIU2WRL.js → chunk-SMDN3BQZ.js} +1 -1
  145. package/dist/cli/chunks/{chunk-VD6QRULW.js → chunk-SNOBH4AZ.js} +2 -2
  146. package/dist/cli/chunks/{chunk-OSLYSG3B.js → chunk-SPV2VKC5.js} +2 -2
  147. package/dist/cli/chunks/chunk-TCHGOB2N.js +2 -0
  148. package/dist/cli/chunks/{chunk-MOBNBMFW.js → chunk-TVYY3OCX.js} +1 -1
  149. package/dist/cli/chunks/{chunk-UGVHCMUN.js → chunk-UCFQALXO.js} +3 -3
  150. package/dist/cli/chunks/{chunk-3QHGWY7T.js → chunk-UKA2KOXE.js} +2 -2
  151. package/dist/cli/chunks/{chunk-MCUJEZT6.js → chunk-UNFFDHER.js} +16 -11
  152. package/dist/cli/chunks/{chunk-6QYNWR7U.js → chunk-UQ32JHES.js} +2 -2
  153. package/dist/cli/chunks/{chunk-OULHKEVH.js → chunk-V4DM6ELU.js} +2 -2
  154. package/dist/cli/chunks/{chunk-M2JBBZQB.js → chunk-VGFFFKGK.js} +2 -2
  155. package/dist/cli/chunks/{chunk-OCWWP5PL.js → chunk-VMNWDJIZ.js} +2 -2
  156. package/dist/cli/chunks/chunk-W6HXLH5G.js +180 -0
  157. package/dist/cli/chunks/{chunk-AIHDEEJO.js → chunk-WCJBU2KI.js} +2 -2
  158. package/dist/cli/chunks/{chunk-ZBQY5GLF.js → chunk-WGM35YWL.js} +2 -2
  159. package/dist/cli/chunks/chunk-WO4QMXIG.js +3 -0
  160. package/dist/cli/chunks/{chunk-3UPAMMCB.js → chunk-XAS3XRYM.js} +1 -1
  161. package/dist/cli/chunks/chunk-Y3LZ35OG.js +2 -0
  162. package/dist/cli/chunks/{chunk-5R3QL7WN.js → chunk-Y3UOUNHM.js} +2 -2
  163. package/dist/cli/chunks/{chunk-ZJ26AQA5.js → chunk-YFBSPLJG.js} +1 -1
  164. package/dist/cli/chunks/{chunk-BDESSCVR.js → chunk-YHKEDEAA.js} +3 -3
  165. package/dist/cli/chunks/{chunk-CXQPR5MY.js → chunk-YS4FCTWF.js} +1 -1
  166. package/dist/cli/chunks/{chunk-CLTMDCSE.js → chunk-YSLL6VSL.js} +2 -2
  167. package/dist/cli/chunks/chunk-Z6GGIRQQ.js +65 -0
  168. package/dist/cli/chunks/{chunk-F3SBRQC6.js → chunk-Z7WODOTH.js} +2 -2
  169. package/dist/cli/chunks/chunk-ZCRTRYXK.js +14 -0
  170. package/dist/cli/chunks/{chunk-XRYF6JV7.js → chunk-ZEV3YTO7.js} +2 -2
  171. package/dist/cli/chunks/{chunk-YNXS6CGV.js → chunk-ZL6SYKUK.js} +1 -1
  172. package/dist/cli/chunks/{chunk-5SJHQ2CO.js → chunk-ZSPU4MOS.js} +2 -2
  173. package/dist/cli/chunks/{chunk-UDHKLT4C.js → chunk-ZVWVV4EX.js} +1 -1
  174. package/dist/cli/chunks/{ci-464KPQNP.js → ci-W6K6G2KZ.js} +2 -2
  175. package/dist/cli/chunks/{ci-output-I7FX2RSO.js → ci-output-LDT24TS3.js} +2 -2
  176. package/dist/cli/chunks/{circuit-breaker-3FW237WW.js → circuit-breaker-F5V4KITU.js} +2 -2
  177. package/dist/cli/chunks/claude-flow-setup-DT6WQQVD.js +2 -0
  178. package/dist/cli/chunks/client-KHWJT6FB.js +2 -0
  179. package/dist/cli/chunks/{cline-installer-UWFHT6VY.js → cline-installer-G7TJOAEX.js} +2 -2
  180. package/dist/cli/chunks/{code-KQSUT3FS.js → code-PGE6A42V.js} +3 -3
  181. package/dist/cli/chunks/{code-index-extractor-PABBNUSC.js → code-index-extractor-RNITH372.js} +2 -2
  182. package/dist/cli/chunks/codex-installer-LBX77AI3.js +14 -0
  183. package/dist/cli/chunks/{completions-7RWHAUAR.js → completions-4AWLAARX.js} +2 -2
  184. package/dist/cli/chunks/{complexity-analyzer-XPOAF33E.js → complexity-analyzer-ZPNSS476.js} +2 -2
  185. package/dist/cli/chunks/{continuedev-installer-V4F2FIZP.js → continuedev-installer-UAPWX6OA.js} +2 -2
  186. package/dist/cli/chunks/{copilot-installer-JMICURQB.js → copilot-installer-BJN2YJGI.js} +2 -2
  187. package/dist/cli/chunks/core-handlers-HING5RRG.js +2 -0
  188. package/dist/cli/chunks/{cost-tracker-5OFHEYFJ.js → cost-tracker-MHP2VJ63.js} +2 -2
  189. package/dist/cli/chunks/{coverage-QKN57JDS.js → coverage-PQB4IEFG.js} +3 -3
  190. package/dist/cli/chunks/cross-domain-router-PQTD6AZN.js +2 -0
  191. package/dist/cli/chunks/{cursor-installer-GBJ7YXSM.js → cursor-installer-ZXBWYAS3.js} +2 -2
  192. package/dist/cli/chunks/{daemon-GKP7CMEK.js → daemon-64C7R6OJ.js} +3 -3
  193. package/dist/cli/chunks/{daemon-IAVSO6HK.js → daemon-N2BEGEFY.js} +4 -4
  194. package/dist/cli/chunks/{dag-attention-scheduler-S225TCI7.js → dag-attention-scheduler-SPZDAPNL.js} +2 -2
  195. package/dist/cli/chunks/{detect-IUYH422U.js → detect-LXJBSSZW.js} +2 -2
  196. package/dist/cli/chunks/{dist-node-2YRE6A7C.js → dist-node-U3TKZ2IZ.js} +2 -2
  197. package/dist/cli/chunks/{domain-handler-PL2TZC6H.js → domain-handler-3DDWUVSR.js} +2 -2
  198. package/dist/cli/chunks/{domain-plugins-HCGLXKIT.js → domain-plugins-JJVWI4OQ.js} +2 -2
  199. package/dist/cli/chunks/domain-transfer-M36KUJ2U.js +2 -0
  200. package/dist/cli/chunks/dream-WUGRSNCV.js +2 -0
  201. package/dist/cli/chunks/embed-and-insert-pattern-JPAR7TXX.js +3 -0
  202. package/dist/cli/chunks/{eval-WCK7KNFN.js → eval-SOLG23EA.js} +2 -2
  203. package/dist/cli/chunks/{experience-capture-middleware-2MSQWSAR.js → experience-capture-middleware-T7G2VOOD.js} +4 -4
  204. package/dist/cli/chunks/{fast-paths-VYOSIBKF.js → fast-paths-32N3ELI4.js} +2 -2
  205. package/dist/cli/chunks/{feature-flags-WCFUKHNQ.js → feature-flags-APJDQ4N7.js} +2 -2
  206. package/dist/cli/chunks/{feature-flags-UJRHFBRX.js → feature-flags-NAHKLDRN.js} +2 -2
  207. package/dist/cli/chunks/{file-discovery-JDGL4ZWS.js → file-discovery-YKVM3MDB.js} +2 -2
  208. package/dist/cli/chunks/{fleet-ROXVMZ2F.js → fleet-55M5CJS4.js} +3 -3
  209. package/dist/cli/chunks/{gnn-wrapper-NIO4ZCO3.js → gnn-wrapper-UD6E6S6Z.js} +2 -2
  210. package/dist/cli/chunks/{heartbeat-handler-PI42WD3C.js → heartbeat-handler-OYVW3VSC.js} +4 -4
  211. package/dist/cli/chunks/heartbeat-scheduler-33XX5XNQ.js +2 -0
  212. package/dist/cli/chunks/hnsw-adapter-XQPERX3H.js +2 -0
  213. package/dist/cli/chunks/hnsw-index-2GNXTWHH.js +2 -0
  214. package/dist/cli/chunks/{hnsw-legacy-bridge-YLC7SPK2.js → hnsw-legacy-bridge-HBYIS3ZW.js} +2 -2
  215. package/dist/cli/chunks/{hnswlib-node-LG6OS3B7.js → hnswlib-node-EQPM42OU.js} +2 -2
  216. package/dist/cli/chunks/{hooks-WVALP5GX.js → hooks-5ZSSJWO6.js} +10 -10
  217. package/dist/cli/chunks/hybrid-backend-CCF7URKI.js +2 -0
  218. package/dist/cli/chunks/{hypergraph-engine-GJEMW3EG.js → hypergraph-engine-XBGVQ4PD.js} +2 -2
  219. package/dist/cli/chunks/{hypergraph-handler-BLF6LXEV.js → hypergraph-handler-CAWAQ673.js} +3 -3
  220. package/dist/cli/chunks/impact-analyzer-HGKAZWIG.js +2 -0
  221. package/dist/cli/chunks/{init-handler-K25RWRYY.js → init-handler-PRHXSARK.js} +6 -6
  222. package/dist/cli/chunks/init-wizard-72MFBI3G.js +2 -0
  223. package/dist/cli/chunks/kernel-BRCBVMSK.js +2 -0
  224. package/dist/cli/chunks/{kilocode-installer-BXN6WZ7G.js → kilocode-installer-F7LXBM7I.js} +2 -2
  225. package/dist/cli/chunks/{kiro-installer-PM362DLN.js → kiro-installer-NM723ZRG.js} +2 -2
  226. package/dist/cli/chunks/knowledge-graph-DG44IPEI.js +2 -0
  227. package/dist/cli/chunks/{learning-CPERDDRG.js → learning-5QYIDHH3.js} +3 -3
  228. package/dist/cli/chunks/{llm-router-GOAV5FPI.js → llm-router-43HKWPSX.js} +4 -4
  229. package/dist/cli/chunks/llm-router-service-24KXFX32.js +2 -0
  230. package/dist/cli/chunks/{load-2BG6SHAK.js → load-5YDBWSCS.js} +2 -2
  231. package/dist/cli/chunks/load-test-N4TAYJY3.js +2 -0
  232. package/dist/cli/chunks/mcp-UMAPMNMY.js +2 -0
  233. package/dist/cli/chunks/{memory-4NHBYT6S.js → memory-FWCPCQFP.js} +6 -6
  234. package/dist/cli/chunks/memory-backend-NVYFYVAU.js +2 -0
  235. package/dist/cli/chunks/memory-handlers-UTWCNCHL.js +2 -0
  236. package/dist/cli/chunks/multi-model-executor-2XTBGLE4.js +14 -0
  237. package/dist/cli/chunks/{opencode-installer-ATZLLK74.js → opencode-installer-GIXOJ6NS.js} +2 -2
  238. package/dist/cli/chunks/orchestrator-VW6BKHLI.js +393 -0
  239. package/dist/cli/chunks/pattern-null-store-SBPNYDBR.js +2 -0
  240. package/dist/cli/chunks/{pattern-usage-recorder-7VE4XDAI.js → pattern-usage-recorder-7CEUC3J7.js} +2 -2
  241. package/dist/cli/chunks/{pipeline-LQZSNDD2.js → pipeline-IGUQPPPO.js} +2 -2
  242. package/dist/cli/chunks/platform-2P636I7B.js +2 -0
  243. package/dist/cli/chunks/{plugin-EJ6K2MGU.js → plugin-NY6SWDPE.js} +2 -2
  244. package/dist/cli/chunks/{prime-radiant-advanced-wasm-OIHTKJMN.js → prime-radiant-advanced-wasm-2UUDTIO2.js} +2 -2
  245. package/dist/cli/chunks/project-root-IOISG5KX.js +2 -0
  246. package/dist/cli/chunks/protocol-executor-IBYEII5Q.js +2 -0
  247. package/dist/cli/chunks/{protocol-handler-NRBROAU7.js → protocol-handler-ZTPCRQ5W.js} +2 -2
  248. package/dist/cli/chunks/{prove-EJOGEGD3.js → prove-SQX5A3IG.js} +2 -2
  249. package/dist/cli/chunks/qe-reasoning-bank-7IETWW6W.js +2 -0
  250. package/dist/cli/chunks/{quality-E55UC73D.js → quality-DROILKRY.js} +2 -2
  251. package/dist/cli/chunks/{quality-gate-OIQATNT3.js → quality-gate-PWKWDJY2.js} +3 -3
  252. package/dist/cli/chunks/queen-coordinator-NHUK2MWJ.js +2 -0
  253. package/dist/cli/chunks/real-embeddings-P5U3MGYC.js +2 -0
  254. package/dist/cli/chunks/{ref-validation-OPO6J7OL.js → ref-validation-KY73NQXD.js} +2 -2
  255. package/dist/cli/chunks/{roocode-installer-ODY5KRWU.js → roocode-installer-6JPPRB3W.js} +2 -2
  256. package/dist/cli/chunks/router-SRSO3IHF.js +2 -0
  257. package/dist/cli/chunks/routing-feedback-PASRE5HY.js +2 -0
  258. package/dist/cli/chunks/{routing-handler-KQM6VWLC.js → routing-handler-VTJIVFUO.js} +2 -2
  259. package/dist/cli/chunks/{ruvector-commands-U2GVV6PF.js → ruvector-commands-C6RPSJJO.js} +2 -2
  260. package/dist/cli/chunks/rvf-dual-writer-4M4J67OU.js +2 -0
  261. package/dist/cli/chunks/rvf-migration-adapter-TSXGT5LF.js +2 -0
  262. package/dist/cli/chunks/rvf-migration-coordinator-R53URRIO.js +2 -0
  263. package/dist/cli/chunks/rvf-native-adapter-MOF3E7BR.js +2 -0
  264. package/dist/cli/chunks/{rvf-store-integrity-KMIHD3LP.js → rvf-store-integrity-MMXN5TEJ.js} +2 -2
  265. package/dist/cli/chunks/safe-db-QJLFO33B.js +2 -0
  266. package/dist/cli/chunks/schedule-YIVXW5O2.js +2 -0
  267. package/dist/cli/chunks/scheduler-AON7DWSJ.js +2 -0
  268. package/dist/cli/chunks/{security-P5NM353C.js → security-3B3R2NL4.js} +3 -3
  269. package/dist/cli/chunks/shared-rvf-adapter-VIJB7JUS.js +2 -0
  270. package/dist/cli/chunks/{shared-rvf-dual-writer-2CSG7C4W.js → shared-rvf-dual-writer-UVWGDUWC.js} +2 -2
  271. package/dist/cli/chunks/sqlite-persistence-75VHKKQB.js +2 -0
  272. package/dist/cli/chunks/standalone-memory-M4LWAAYZ.js +2 -0
  273. package/dist/cli/chunks/{status-handler-6TU6O37R.js → status-handler-YYFV6OZL.js} +2 -2
  274. package/dist/cli/chunks/{structural-health-KBIJSTXJ.js → structural-health-27E6LLKB.js} +2 -2
  275. package/dist/cli/chunks/sync-26CEGSTC.js +2 -0
  276. package/dist/cli/chunks/{sync-LNHI5SB7.js → sync-J3LJ56WN.js} +2 -2
  277. package/dist/cli/chunks/task-handler-4MCEBQZL.js +54 -0
  278. package/dist/cli/chunks/task-handlers-GYBAWKE2.js +9 -0
  279. package/dist/cli/chunks/{test-DHAAI3DU.js → test-MPC5HRH5.js} +4 -4
  280. package/dist/cli/chunks/{test-scheduling-XDBZ3QC2.js → test-scheduling-ZJBFRZ3J.js} +3 -3
  281. package/dist/cli/chunks/token-bootstrap-2Y2XITBX.js +2 -0
  282. package/dist/cli/chunks/{token-usage-Q2YG5YQN.js → token-usage-3X5WMTG2.js} +2 -2
  283. package/dist/cli/chunks/{transformers-F5UQTQCY.js → transformers-MVL4C5IX.js} +2 -2
  284. package/dist/cli/chunks/tree-sitter-wasm-parser-SLW65ZFO.js +2 -0
  285. package/dist/cli/chunks/{types-JQ7EQO5Q.js → types-TG5P3CRS.js} +2 -2
  286. package/dist/cli/chunks/unified-memory-UCQ6AB32.js +2 -0
  287. package/dist/cli/chunks/unified-memory-hnsw-IXYUMKRR.js +2 -0
  288. package/dist/cli/chunks/unified-persistence-7E6JQ4FZ.js +2 -0
  289. package/dist/cli/chunks/{upgrade-TJRVGHGD.js → upgrade-ETBHDEPY.js} +2 -2
  290. package/dist/cli/chunks/{validate-BWPCVHBN.js → validate-C2A73LZK.js} +2 -2
  291. package/dist/cli/chunks/{validate-swarm-QVVKCQLP.js → validate-swarm-67XN42ML.js} +2 -2
  292. package/dist/cli/chunks/{vibium-ZFATIWHO.js → vibium-NILGKHLN.js} +2 -2
  293. package/dist/cli/chunks/visual-security-4VZXPEVG.js +2 -0
  294. package/dist/cli/chunks/{web-tree-sitter-KPLY7ONR.js → web-tree-sitter-USJN77P4.js} +2 -2
  295. package/dist/cli/chunks/{windsurf-installer-H7XM7ISA.js → windsurf-installer-5GGZXGJW.js} +2 -2
  296. package/dist/cli/chunks/witness-chain-IWS5ZHHL.js +2 -0
  297. package/dist/cli/chunks/witness-chain-JQA2VPZI.js +2 -0
  298. package/dist/cli/chunks/witness-chain-repair-4UA7IPS3.js +2 -0
  299. package/dist/cli/chunks/witness-chain-verifier-3GEADWPE.js +2 -0
  300. package/dist/cli/chunks/{witness-key-manager-DFRL42GE.js → witness-key-manager-ZWEIK3VJ.js} +2 -2
  301. package/dist/cli/chunks/{workflow-2ZQO6WYI.js → workflow-KHMVVBBA.js} +4 -4
  302. package/dist/cli/chunks/workflow-orchestrator-GI5NQH7C.js +2 -0
  303. package/dist/cli/chunks/wrappers-N6XIK5PT.js +2 -0
  304. package/dist/cli/commands/audit.d.ts +20 -2
  305. package/dist/cli/commands/audit.js +158 -16
  306. package/dist/cli/commands/claude-flow-setup.js +5 -4
  307. package/dist/cli/commands/mcp.js +6 -0
  308. package/dist/cli/commands/memory.d.ts +1 -1
  309. package/dist/cli/commands/memory.js +8 -8
  310. package/dist/cli/commands/platform.js +15 -2
  311. package/dist/cli/commands/upgrade.d.ts +3 -3
  312. package/dist/cli/commands/upgrade.js +3 -3
  313. package/dist/cli/handlers/init-handler.d.ts +10 -0
  314. package/dist/cli/handlers/task-handler.js +24 -3
  315. package/dist/cli/helpers/standalone-memory.d.ts +12 -0
  316. package/dist/cli/helpers/standalone-memory.js +46 -0
  317. package/dist/cli/index.js +39 -42
  318. package/dist/cli/log-gate.d.ts +66 -0
  319. package/dist/cli/log-gate.js +170 -0
  320. package/dist/init/agents-installer.d.ts +4 -0
  321. package/dist/init/agents-installer.js +24 -11
  322. package/dist/init/codex-installer.js +22 -8
  323. package/dist/init/idempotent-write.d.ts +53 -0
  324. package/dist/init/idempotent-write.js +160 -0
  325. package/dist/init/orchestrator.js +1 -0
  326. package/dist/init/phases/05-learning.js +3 -1
  327. package/dist/init/phases/07-hooks.js +32 -16
  328. package/dist/init/phases/08-mcp.js +4 -2
  329. package/dist/init/phases/09-assets.d.ts +10 -0
  330. package/dist/init/phases/09-assets.js +3 -0
  331. package/dist/init/phases/10-workers.js +7 -5
  332. package/dist/init/phases/12-verification.js +7 -2
  333. package/dist/init/project-analyzer.d.ts +9 -0
  334. package/dist/init/project-analyzer.js +20 -1
  335. package/dist/init/self-configurator.d.ts +5 -3
  336. package/dist/init/self-configurator.js +18 -29
  337. package/dist/init/skills-installer.js +4 -2
  338. package/dist/init/token-bootstrap.d.ts +1 -1
  339. package/dist/init/token-bootstrap.js +12 -2
  340. package/dist/init/types.d.ts +16 -0
  341. package/dist/init/types.js +20 -24
  342. package/dist/integrations/coherence/coherence-service.js +84 -24
  343. package/dist/integrations/coherence/vote-tally.d.ts +38 -0
  344. package/dist/integrations/coherence/vote-tally.js +39 -0
  345. package/dist/integrations/ruvector/brain-exporter.js +17 -0
  346. package/dist/integrations/ruvector/brain-import-audit.d.ts +20 -0
  347. package/dist/integrations/ruvector/brain-import-audit.js +22 -0
  348. package/dist/integrations/ruvector/brain-rvf-exporter.js +16 -0
  349. package/dist/integrations/ruvector/brain-shared.js +1 -1
  350. package/dist/integrations/ruvector/rvf-dual-writer.js +6 -1
  351. package/dist/integrations/ruvector/shared-rvf-adapter.d.ts +23 -0
  352. package/dist/integrations/ruvector/shared-rvf-adapter.js +24 -0
  353. package/dist/kernel/hybrid-backend.d.ts +6 -0
  354. package/dist/kernel/hybrid-backend.js +18 -0
  355. package/dist/kernel/kernel.js +12 -16
  356. package/dist/kernel/project-root.d.ts +1 -1
  357. package/dist/kernel/project-root.js +24 -3
  358. package/dist/learning/embedder-identity-store.js +4 -3
  359. package/dist/learning/pattern-store.d.ts +11 -0
  360. package/dist/learning/pattern-store.js +31 -9
  361. package/dist/learning/qe-patterns.d.ts +6 -0
  362. package/dist/learning/qe-patterns.js +7 -1
  363. package/dist/learning/qe-reasoning-bank.js +3 -0
  364. package/dist/learning/real-embeddings.d.ts +8 -0
  365. package/dist/learning/real-embeddings.js +16 -0
  366. package/dist/learning/rvf-pattern-store.js +30 -10
  367. package/dist/learning/sqlite-persistence.d.ts +8 -1
  368. package/dist/learning/sqlite-persistence.js +49 -9
  369. package/dist/logging/console-logger.d.ts +2 -5
  370. package/dist/logging/console-logger.js +10 -46
  371. package/dist/logging/index.d.ts +2 -0
  372. package/dist/logging/index.js +1 -0
  373. package/dist/logging/redaction.d.ts +27 -0
  374. package/dist/logging/redaction.js +170 -0
  375. package/dist/mcp/bundle.js +463 -449
  376. package/dist/mcp/entry.js +2 -0
  377. package/dist/mcp/handlers/core-handlers.js +5 -4
  378. package/dist/mcp/handlers/memory-handlers.d.ts +6 -1
  379. package/dist/mcp/handlers/memory-handlers.js +44 -22
  380. package/dist/mcp/handlers/task-handlers.js +14 -1
  381. package/dist/mcp/protocol-server.js +3 -1
  382. package/dist/mcp/services/session-store.js +5 -1
  383. package/dist/mcp/tools/base.d.ts +9 -2
  384. package/dist/mcp/tools/base.js +7 -0
  385. package/dist/mcp/tools/coherence/consensus.js +51 -2
  386. package/dist/mcp/tools/planning/goap-plan.d.ts +20 -7
  387. package/dist/mcp/tools/planning/goap-plan.js +92 -20
  388. package/dist/mcp/tools/planning/goap-status.d.ts +37 -12
  389. package/dist/mcp/tools/planning/goap-status.js +52 -23
  390. package/dist/mcp/tools/planning/world-state.d.ts +101 -0
  391. package/dist/mcp/tools/planning/world-state.js +274 -0
  392. package/dist/mcp/types.d.ts +4 -2
  393. package/dist/planning/goap-planner.d.ts +60 -4
  394. package/dist/planning/goap-planner.js +218 -60
  395. package/dist/planning/index.d.ts +1 -1
  396. package/dist/planning/index.js +1 -1
  397. package/dist/planning/plan-executor.d.ts +20 -1
  398. package/dist/planning/plan-executor.js +209 -100
  399. package/dist/planning/types.d.ts +16 -0
  400. package/dist/planning/types.js +17 -0
  401. package/dist/plugins/cache.d.ts +2 -0
  402. package/dist/plugins/cache.js +15 -2
  403. package/dist/plugins/lifecycle.js +15 -2
  404. package/dist/plugins/manifest.js +7 -5
  405. package/dist/plugins/resolver.d.ts +13 -22
  406. package/dist/plugins/resolver.js +169 -61
  407. package/dist/plugins/version-policy.d.ts +13 -0
  408. package/dist/plugins/version-policy.js +18 -0
  409. package/dist/shared/types/index.d.ts +6 -0
  410. package/dist/shared/types/index.js +8 -0
  411. package/package.json +2 -1
  412. package/dist/cli/chunks/adapter-TNNNJRDG.js +0 -2
  413. package/dist/cli/chunks/agent-booster-wasm-5PC7D2FW.js +0 -2
  414. package/dist/cli/chunks/aqe-learning-engine-5ZRMYJLB.js +0 -2
  415. package/dist/cli/chunks/audit-YSGA7UWT.js +0 -3
  416. package/dist/cli/chunks/base-KWZHOPSH.js +0 -2
  417. package/dist/cli/chunks/brain-handler-ET6YAP4B.js +0 -90
  418. package/dist/cli/chunks/browser-workflow-2FZTKDUL.js +0 -2
  419. package/dist/cli/chunks/chunk-33YYYWBQ.js +0 -4
  420. package/dist/cli/chunks/chunk-5Z6XZV7K.js +0 -65
  421. package/dist/cli/chunks/chunk-6J62K3SW.js +0 -2
  422. package/dist/cli/chunks/chunk-6TPKK7LD.js +0 -15
  423. package/dist/cli/chunks/chunk-DEYLEDJN.js +0 -27
  424. package/dist/cli/chunks/chunk-J6GNQS62.js +0 -5
  425. package/dist/cli/chunks/chunk-KGT36Z42.js +0 -14
  426. package/dist/cli/chunks/chunk-NA7B2QYB.js +0 -2
  427. package/dist/cli/chunks/chunk-NDPFGIMJ.js +0 -13
  428. package/dist/cli/chunks/chunk-OBAP2TXZ.js +0 -2
  429. package/dist/cli/chunks/chunk-PEPFCPES.js +0 -2
  430. package/dist/cli/chunks/chunk-T6BVLVI5.js +0 -2
  431. package/dist/cli/chunks/chunk-TT23RRB7.js +0 -2
  432. package/dist/cli/chunks/chunk-XC7DYDSY.js +0 -180
  433. package/dist/cli/chunks/chunk-XWMZ6D6N.js +0 -2
  434. package/dist/cli/chunks/chunk-Y3MW3YBC.js +0 -3
  435. package/dist/cli/chunks/claude-flow-setup-6JKMBPGU.js +0 -2
  436. package/dist/cli/chunks/client-7E4LM2WW.js +0 -2
  437. package/dist/cli/chunks/codex-installer-CQ24DTP5.js +0 -14
  438. package/dist/cli/chunks/core-handlers-IFG3757P.js +0 -2
  439. package/dist/cli/chunks/cross-domain-router-EK7W4PGP.js +0 -2
  440. package/dist/cli/chunks/domain-transfer-KQJRUPXA.js +0 -2
  441. package/dist/cli/chunks/dream-NFSCSLY7.js +0 -2
  442. package/dist/cli/chunks/embed-and-insert-pattern-ZPAG7235.js +0 -3
  443. package/dist/cli/chunks/heartbeat-scheduler-ZATCDJDK.js +0 -2
  444. package/dist/cli/chunks/hnsw-adapter-WXQABRCA.js +0 -2
  445. package/dist/cli/chunks/hnsw-index-TPSWLEA5.js +0 -2
  446. package/dist/cli/chunks/impact-analyzer-HNIU45P5.js +0 -2
  447. package/dist/cli/chunks/init-wizard-JUIPBMHG.js +0 -2
  448. package/dist/cli/chunks/kernel-5BOZQ754.js +0 -2
  449. package/dist/cli/chunks/knowledge-graph-EWDAENWM.js +0 -2
  450. package/dist/cli/chunks/llm-router-service-3YT7JGBS.js +0 -2
  451. package/dist/cli/chunks/load-test-BP2CPLIV.js +0 -2
  452. package/dist/cli/chunks/mcp-5TTB37DC.js +0 -2
  453. package/dist/cli/chunks/memory-backend-4PYQBPRM.js +0 -2
  454. package/dist/cli/chunks/memory-handlers-2B27NITS.js +0 -2
  455. package/dist/cli/chunks/multi-model-executor-KCWSGCDT.js +0 -14
  456. package/dist/cli/chunks/orchestrator-RKB7XJRG.js +0 -393
  457. package/dist/cli/chunks/pattern-null-store-OYOQOV2O.js +0 -2
  458. package/dist/cli/chunks/platform-OD5H5U6G.js +0 -2
  459. package/dist/cli/chunks/protocol-executor-3ATJTXWG.js +0 -2
  460. package/dist/cli/chunks/qe-reasoning-bank-LLMYZT4X.js +0 -2
  461. package/dist/cli/chunks/queen-coordinator-RN7L6KG5.js +0 -2
  462. package/dist/cli/chunks/real-embeddings-FPFFNOSZ.js +0 -2
  463. package/dist/cli/chunks/router-MDHITQ2V.js +0 -2
  464. package/dist/cli/chunks/routing-feedback-5XLNJ3Y3.js +0 -2
  465. package/dist/cli/chunks/rvf-dual-writer-JBW4O3II.js +0 -2
  466. package/dist/cli/chunks/rvf-migration-adapter-BPPQL4XJ.js +0 -2
  467. package/dist/cli/chunks/rvf-migration-coordinator-V2GHCJKN.js +0 -2
  468. package/dist/cli/chunks/rvf-native-adapter-S4562CG5.js +0 -2
  469. package/dist/cli/chunks/safe-db-FIRHSXVF.js +0 -2
  470. package/dist/cli/chunks/schedule-RVXFB4HK.js +0 -2
  471. package/dist/cli/chunks/scheduler-IKKAMAOO.js +0 -2
  472. package/dist/cli/chunks/shared-rvf-adapter-LVIUOO4S.js +0 -2
  473. package/dist/cli/chunks/sqlite-persistence-SQ3HCUQ7.js +0 -2
  474. package/dist/cli/chunks/sync-UHOX6RJW.js +0 -2
  475. package/dist/cli/chunks/task-handler-AVDHMLGI.js +0 -49
  476. package/dist/cli/chunks/task-handlers-KYK4VTRA.js +0 -9
  477. package/dist/cli/chunks/token-bootstrap-GUTTLPZX.js +0 -2
  478. package/dist/cli/chunks/tree-sitter-wasm-parser-DEGOHS6F.js +0 -2
  479. package/dist/cli/chunks/unified-memory-CXHLHB5I.js +0 -2
  480. package/dist/cli/chunks/unified-memory-hnsw-I7WAE54M.js +0 -2
  481. package/dist/cli/chunks/unified-persistence-6CPF65WI.js +0 -2
  482. package/dist/cli/chunks/visual-security-GNPHME5H.js +0 -2
  483. package/dist/cli/chunks/witness-chain-RRN6NDCH.js +0 -2
  484. package/dist/cli/chunks/witness-chain-VT4UHHBR.js +0 -2
  485. package/dist/cli/chunks/workflow-orchestrator-DB3HIECD.js +0 -2
  486. package/dist/cli/chunks/wrappers-SUS6XEJD.js +0 -2
@@ -7,11 +7,12 @@ import { ALL_DOMAINS } from '../shared/types/index.js';
7
7
  import { InMemoryEventBus } from './event-bus.js';
8
8
  import { DefaultAgentCoordinator } from './agent-coordinator.js';
9
9
  import { DefaultPluginLoader } from './plugin-loader.js';
10
+ import { formatErrorForLog } from '../logging/redaction.js';
10
11
  import { InMemoryBackend } from './memory-backend.js';
11
- import { HybridMemoryBackend } from './hybrid-backend.js';
12
+ import { createKernelMemoryBackend } from './hybrid-backend.js';
12
13
  import { SemanticAntiDriftMiddleware, ToolCallSignatureTracker } from './anti-drift-middleware.js';
13
14
  import { LOOP_EVENT_TYPES } from './event-bus.js';
14
- import { AGENT_CONSTANTS, MEMORY_CONSTANTS } from './constants.js';
15
+ import { AGENT_CONSTANTS } from './constants.js';
15
16
  import { findProjectRoot } from './unified-memory.js';
16
17
  import { initializeUnifiedPersistence } from './unified-persistence.js';
17
18
  import * as path from 'path';
@@ -163,16 +164,7 @@ export class QEKernelImpl {
163
164
  else {
164
165
  // Use hybrid backend for persistent storage (default)
165
166
  // All data goes to unified memory.db via UnifiedMemoryManager
166
- this._memory = new HybridMemoryBackend({
167
- sqlite: {
168
- path: path.join(dataDir, 'memory.db'),
169
- walMode: true,
170
- poolSize: 3,
171
- busyTimeout: MEMORY_CONSTANTS.BUSY_TIMEOUT_MS,
172
- },
173
- enableFallback: true,
174
- defaultNamespace: 'qe-kernel',
175
- });
167
+ this._memory = createKernelMemoryBackend(dataDir);
176
168
  // Re-create plugins with the real memory backend
177
169
  this._plugins = new DefaultPluginLoader(this._eventBus, this._memory, this._config.lazyLoading);
178
170
  }
@@ -206,6 +198,9 @@ export class QEKernelImpl {
206
198
  const pluginCache = new PluginCache({ cacheDir: pluginCacheDir });
207
199
  const pluginLifecycle = new PluginLifecycleManager({ cache: pluginCache });
208
200
  const resolution = pluginLifecycle.resolveLoadOrder();
201
+ for (const error of resolution.errors) {
202
+ console.warn(`[QEKernel] External plugin ${error.plugin}: ${error.code}: ${error.message}`);
203
+ }
209
204
  for (const resolved of resolution.ordered) {
210
205
  const manifest = resolved.manifest;
211
206
  const cachedPlugin = pluginCache.get(manifest.name, manifest.version);
@@ -232,8 +227,9 @@ export class QEKernelImpl {
232
227
  }
233
228
  }
234
229
  }
235
- catch {
236
- // External plugin loading is best-effort — don't block kernel startup
230
+ catch (error) {
231
+ // External plugin loading is best-effort, but failures must be visible.
232
+ console.warn('[QEKernel] External plugin discovery failed:', error);
237
233
  }
238
234
  // Load plugins based on configuration
239
235
  if (!this._config.lazyLoading) {
@@ -493,7 +489,7 @@ export class QEKernelImpl {
493
489
  plugin = await this._plugins.load(domain);
494
490
  }
495
491
  catch (error) {
496
- console.error(`[QEKernel] Failed to lazy load domain ${domain}:`, error);
492
+ console.error(`[QEKernel] Failed to lazy load domain ${domain}:`, formatErrorForLog(error));
497
493
  return undefined;
498
494
  }
499
495
  }
@@ -516,7 +512,7 @@ export class QEKernelImpl {
516
512
  return true;
517
513
  }
518
514
  catch (error) {
519
- console.error(`[QEKernel] Failed to load domain ${domain}:`, error);
515
+ console.error(`[QEKernel] Failed to load domain ${domain}:`, formatErrorForLog(error));
520
516
  return false;
521
517
  }
522
518
  }
@@ -21,7 +21,7 @@ export declare function clearProjectRootCache(): void;
21
21
  *
22
22
  * Priority order:
23
23
  * 1. AQE_PROJECT_ROOT environment variable (set by MCP config or init)
24
- * 2. Walk up looking for the NEAREST .agentic-qe directory (existing AQE project)
24
+ * 2. Nearest .agentic-qe at or below the nearest .git boundary
25
25
  * 3. Walk up looking for .git directory (git repo root)
26
26
  * 4. Walk up looking for package.json WITHOUT node_modules sibling (monorepo root)
27
27
  * 5. Fallback to current working directory
@@ -12,6 +12,7 @@
12
12
  * @module kernel/project-root
13
13
  */
14
14
  import * as fs from 'fs';
15
+ import * as os from 'os';
15
16
  import * as path from 'path';
16
17
  /** Module-level cache for findProjectRoot result. */
17
18
  let _cachedProjectRoot = null;
@@ -24,12 +25,17 @@ export function clearProjectRootCache() {
24
25
  _cachedProjectRoot = null;
25
26
  _cachedStartDir = null;
26
27
  }
28
+ /** True when `dir` is `parent` or inside it. */
29
+ function isWithin(dir, parent) {
30
+ const rel = path.relative(parent, dir);
31
+ return rel === '' || (!rel.startsWith('..') && !path.isAbsolute(rel));
32
+ }
27
33
  /**
28
34
  * Find the project root by walking up the directory tree.
29
35
  *
30
36
  * Priority order:
31
37
  * 1. AQE_PROJECT_ROOT environment variable (set by MCP config or init)
32
- * 2. Walk up looking for the NEAREST .agentic-qe directory (existing AQE project)
38
+ * 2. Nearest .agentic-qe at or below the nearest .git boundary
33
39
  * 3. Walk up looking for .git directory (git repo root)
34
40
  * 4. Walk up looking for package.json WITHOUT node_modules sibling (monorepo root)
35
41
  * 5. Fallback to current working directory
@@ -47,6 +53,17 @@ export function findProjectRoot(startDir = process.cwd()) {
47
53
  return _cachedProjectRoot;
48
54
  _cachedStartDir = dir;
49
55
  const root = path.parse(dir).root;
56
+ // A store directly in $HOME is almost always a stray from an `aqe` run in
57
+ // the home directory. Outside any git repository there is no boundary to
58
+ // stop at, so never let it claim a descendant directory (#735/#516); an
59
+ // `aqe` run from $HOME itself still uses it, and AQE_PROJECT_ROOT overrides.
60
+ let home = null;
61
+ try {
62
+ home = path.resolve(os.homedir());
63
+ }
64
+ catch {
65
+ home = null;
66
+ }
50
67
  let checkDir = dir;
51
68
  let nearestAqeDir = null;
52
69
  let lowestGitDir = null;
@@ -55,8 +72,12 @@ export function findProjectRoot(startDir = process.cwd()) {
55
72
  // Issue #516: prefer the NEAREST (lowest) .agentic-qe, mirroring the
56
73
  // .git logic below. Keeping the topmost match let an ancestor store
57
74
  // (e.g. ~/.agentic-qe, created by any `aqe` run from $HOME) hijack
58
- // every descendant project and fragment its learning into $HOME.
59
- if (fs.existsSync(path.join(checkDir, '.agentic-qe'))) {
75
+ // every descendant project and fragment its learning into $HOME. Stop
76
+ // considering stores above the nearest git boundary, even when the repo
77
+ // has not been initialized with AQE yet.
78
+ const isHomeStoreAboveStart = checkDir === home && checkDir !== dir
79
+ && !isWithin(dir, path.join(checkDir, '.agentic-qe'));
80
+ if (lowestGitDir === null && !isHomeStoreAboveStart && fs.existsSync(path.join(checkDir, '.agentic-qe'))) {
60
81
  if (nearestAqeDir === null) {
61
82
  nearestAqeDir = checkDir;
62
83
  }
@@ -13,9 +13,10 @@
13
13
  * We never throw out of these helpers under expected conditions; failure
14
14
  * reasons are surfaced as thrown errors only for genuine I/O problems.
15
15
  */
16
- import { join } from 'node:path';
16
+ import { join, resolve } from 'node:path';
17
17
  import { existsSync, mkdirSync } from 'node:fs';
18
18
  import { createRequire } from 'node:module';
19
+ import { findProjectRoot } from '../kernel/project-root.js';
19
20
  // `require` is unavailable in pure ESM; createRequire gives us synchronous
20
21
  // access to CommonJS modules like better-sqlite3 from the ESM build output.
21
22
  const nodeRequire = createRequire(import.meta.url);
@@ -26,8 +27,8 @@ const nodeRequire = createRequire(import.meta.url);
26
27
  function getMemoryDbPath() {
27
28
  const env = process.env.AQE_MEMORY_PATH;
28
29
  if (env && env.length > 0)
29
- return env;
30
- return join(process.cwd(), '.agentic-qe', 'memory.db');
30
+ return env === ':memory:' ? env : resolve(findProjectRoot(), env);
31
+ return join(findProjectRoot(), '.agentic-qe', 'memory.db');
31
32
  }
32
33
  const NAMESPACE = '_system';
33
34
  const KEY_PREFIX = 'embedder_identity:';
@@ -128,6 +128,11 @@ export interface PatternSearchOptions {
128
128
  useVectorSearch?: boolean;
129
129
  /** Provenance of a pre-computed query vector. Required for semantic ranking. */
130
130
  embeddingSpaceId?: string;
131
+ /**
132
+ * Original text of a pre-computed query vector (#653). Lets FTS5 lexical
133
+ * scoring participate when the caller embedded the text before searching.
134
+ */
135
+ textQuery?: string;
131
136
  /**
132
137
  * Composable metadata filter expression (Task 1.2: ruvector-filter).
133
138
  * Applied post-search to refine results by domain, severity,
@@ -386,6 +391,12 @@ export declare class PatternStore implements IPatternStore {
386
391
  */
387
392
  searchHyperbolic(query: Float32Array | number[], k?: number): Promise<Result<PatternSearchResult[]>>;
388
393
  }
394
+ /**
395
+ * Hybrid score for a hit found by both vector and FTS5 search (#653):
396
+ * 75% vector + 25% BM25, but lexical agreement may only raise the vector
397
+ * score — a weak BM25 match must not demote a near-identical vector hit.
398
+ */
399
+ export declare function blendFtsScore(vectorScore: number, ftsScore: number): number;
389
400
  /**
390
401
  * Create a new pattern store instance.
391
402
  *
@@ -30,7 +30,7 @@ import { createVectorDeltaTracker, } from '../integrations/ruvector/vector-delta
30
30
  import { createHopfieldMemory } from '../integrations/ruvector/hopfield-memory.js';
31
31
  import { createHyperbolicPatternIndex, } from './hyperbolic-pattern-index.js';
32
32
  import { PatternNullStore } from './pattern-null-store.js';
33
- import { getActiveEmbeddingSpaceIdentity } from './real-embeddings.js';
33
+ import { ensureEndpointEmbeddingSpaceIdentity, getActiveEmbeddingSpaceIdentity } from './real-embeddings.js';
34
34
  import { PatternMutationError } from './pattern-mutation-error.js';
35
35
  // ============================================================================
36
36
  // R1: HDC Fingerprint Singleton (lazy-initialized)
@@ -244,6 +244,10 @@ export class PatternStore {
244
244
  */
245
245
  async initializeHNSWInternal() {
246
246
  try {
247
+ // #754: resolve a configured endpoint's identity before binding HNSW.
248
+ if (!getActiveEmbeddingSpaceIdentity() && !this.config.embeddingSpaceId) {
249
+ await ensureEndpointEmbeddingSpaceIdentity();
250
+ }
247
251
  this.hnswSpaceId = getActiveEmbeddingSpaceIdentity()?.spaceId ?? this.config.embeddingSpaceId ?? null;
248
252
  if (!this.hnswSpaceId) {
249
253
  throw new Error('VECTOR_SPACE_UNVERIFIED: cannot initialize HNSW without runtime provenance');
@@ -768,10 +772,11 @@ export class PatternStore {
768
772
  }
769
773
  }
770
774
  // FTS5 hybrid search: blend BM25 text relevance with vector similarity
771
- // 75% vector score + 25% FTS5 score for patterns found by both
772
- if (typeof query === 'string' && query.trim() && this.sqliteStore) {
775
+ // (see blendFtsScore) for patterns found by both
776
+ const ftsText = typeof query === 'string' ? query : options.textQuery;
777
+ if (ftsText?.trim() && this.sqliteStore) {
773
778
  try {
774
- const ftsResults = this.sqliteStore.searchFTS(query, limit * 2);
779
+ const ftsResults = this.sqliteStore.searchFTS(ftsText, limit * 2);
775
780
  if (ftsResults.length > 0) {
776
781
  const ftsScoreMap = new Map(ftsResults.map(r => [r.id, r.ftsScore]));
777
782
  const existingIds = new Set(results.map(r => r.pattern.id));
@@ -779,7 +784,7 @@ export class PatternStore {
779
784
  for (const result of results) {
780
785
  const ftsScore = ftsScoreMap.get(result.pattern.id);
781
786
  if (ftsScore !== undefined) {
782
- result.score = 0.75 * result.score + 0.25 * ftsScore;
787
+ result.score = blendFtsScore(result.score, ftsScore);
783
788
  }
784
789
  }
785
790
  // Add FTS5-only results not already in vector results
@@ -788,12 +793,19 @@ export class PatternStore {
788
793
  continue;
789
794
  const pattern = await this.get(ftsResult.id);
790
795
  if (pattern && this.matchesFilters(pattern, options)) {
791
- const reuseInfo = this.calculateReuseInfo(pattern, ftsResult.ftsScore);
796
+ // #653: ftsScore is normalized to the best hit, so only a
797
+ // whole-phrase hit may read as a near-duplicate; term-only hits
798
+ // report the conservative keyword score as their similarity.
799
+ // Scaled by query-term coverage so the best of a weak lexical
800
+ // set (e.g. one shared stopword) cannot outrank vector hits.
801
+ const keywordScore = 0.5 * ftsResult.ftsScore * ftsResult.coverage;
802
+ const similarity = ftsResult.phrase ? ftsResult.ftsScore : keywordScore;
803
+ const reuseInfo = this.calculateReuseInfo(pattern, similarity);
792
804
  results.push({
793
805
  pattern,
794
- score: 0.5 * ftsResult.ftsScore, // FTS-only: exact keyword match is valuable
806
+ score: keywordScore, // FTS-only: exact keyword match is valuable
795
807
  matchType: 'exact',
796
- similarity: ftsResult.ftsScore,
808
+ similarity,
797
809
  canReuse: reuseInfo.canReuse,
798
810
  estimatedTokenSavings: reuseInfo.estimatedTokenSavings,
799
811
  reuseConfidence: reuseInfo.reuseConfidence,
@@ -808,7 +820,9 @@ export class PatternStore {
808
820
  }
809
821
  // Text search fallback or additional
810
822
  if (typeof query === 'string' || results.length < limit) {
811
- const textResults = await this.searchByText(typeof query === 'string' ? query : '', options, limit - results.length);
823
+ // #653: with the caller's text, pad with text matches rather than
824
+ // unrelated patterns ranked by quality score alone.
825
+ const textResults = await this.searchByText(ftsText ?? '', options, limit - results.length);
812
826
  // Deduplicate: only add text results not already present
813
827
  const existingIds = new Set(results.map(r => r.pattern.id));
814
828
  for (const tr of textResults) {
@@ -1439,6 +1453,14 @@ export class PatternStore {
1439
1453
  // ============================================================================
1440
1454
  // Factory Functions
1441
1455
  // ============================================================================
1456
+ /**
1457
+ * Hybrid score for a hit found by both vector and FTS5 search (#653):
1458
+ * 75% vector + 25% BM25, but lexical agreement may only raise the vector
1459
+ * score — a weak BM25 match must not demote a near-identical vector hit.
1460
+ */
1461
+ export function blendFtsScore(vectorScore, ftsScore) {
1462
+ return Math.max(vectorScore, 0.75 * vectorScore + 0.25 * ftsScore);
1463
+ }
1442
1464
  /**
1443
1465
  * Create a new pattern store instance.
1444
1466
  *
@@ -201,6 +201,12 @@ export declare function calculateQualityScore(pattern: {
201
201
  * experience-capture, and shouldPromotePattern().
202
202
  */
203
203
  export declare const PROMOTION_THRESHOLD = 3;
204
+ /**
205
+ * Minimum success rate a pattern needs before it can be promoted to long-term
206
+ * storage. Paired with PROMOTION_THRESHOLD; `aqe init` reports both values in
207
+ * the generated settings so they match what the runtime enforces (#778).
208
+ */
209
+ export declare const PROMOTION_MIN_SUCCESS_RATE = 0.7;
204
210
  export interface PromotionCheck {
205
211
  meetsUsageCriteria: boolean;
206
212
  meetsQualityCriteria: boolean;
@@ -81,6 +81,12 @@ export function calculateQualityScore(pattern) {
81
81
  * experience-capture, and shouldPromotePattern().
82
82
  */
83
83
  export const PROMOTION_THRESHOLD = 3;
84
+ /**
85
+ * Minimum success rate a pattern needs before it can be promoted to long-term
86
+ * storage. Paired with PROMOTION_THRESHOLD; `aqe init` reports both values in
87
+ * the generated settings so they match what the runtime enforces (#778).
88
+ */
89
+ export const PROMOTION_MIN_SUCCESS_RATE = 0.7;
84
90
  /**
85
91
  * Check if pattern should be promoted to long-term storage
86
92
  * Requires 3+ successful uses as per ADR-021
@@ -92,7 +98,7 @@ export const PROMOTION_THRESHOLD = 3;
92
98
  */
93
99
  export function shouldPromotePattern(pattern, coherenceEnergy, coherenceThreshold = 0.4) {
94
100
  const meetsUsageCriteria = pattern.tier === 'short-term' && pattern.successfulUses >= PROMOTION_THRESHOLD;
95
- const meetsQualityCriteria = pattern.successRate >= 0.7 && pattern.confidence >= 0.6;
101
+ const meetsQualityCriteria = pattern.successRate >= PROMOTION_MIN_SUCCESS_RATE && pattern.confidence >= 0.6;
96
102
  // NEW: Coherence criteria - only block if coherence energy is provided and exceeds threshold
97
103
  const meetsCoherenceCriteria = coherenceEnergy === undefined || coherenceEnergy < coherenceThreshold;
98
104
  let blockReason;
@@ -342,6 +342,8 @@ export class QEReasoningBank {
342
342
  }
343
343
  return this.patternStore.search(searchQuery, {
344
344
  ...options,
345
+ // #653: keep the text so FTS5 hybrid scoring still runs on the vector path
346
+ textQuery: typeof query === 'string' && query.trim() ? query : options?.textQuery,
345
347
  useVectorSearch,
346
348
  embeddingSpaceId: typeof query === 'string'
347
349
  ? getActiveEmbeddingSpaceIdentity()?.spaceId
@@ -444,6 +446,7 @@ export class QEReasoningBank {
444
446
  limit: this.config.maxRoutingCandidates,
445
447
  domain: detectedDomains[0],
446
448
  useVectorSearch: true,
449
+ textQuery: request.task,
447
450
  });
448
451
  const patterns = patternResults.success
449
452
  ? patternResults.value.map((r) => r.pattern)
@@ -86,4 +86,12 @@ export declare function isUsingEndpoint(): boolean;
86
86
  export declare function getEndpointIdentity(): EndpointIdentity | null;
87
87
  /** Runtime-backed identity of the initialized embedding space. */
88
88
  export declare function getActiveEmbeddingSpaceIdentity(): EmbeddingSpaceIdentity | null;
89
+ /**
90
+ * #754: resolve the configured endpoint's embedding-space identity before an
91
+ * index binder (RVF pattern store, brain.rvf dual writer, SQLite HNSW) checks
92
+ * its space manifest. The endpoint runtime otherwise initializes lazily on the
93
+ * first embed call — after the binder has already refused for the process.
94
+ * Returns null when no endpoint is configured, so binders stay fail-closed.
95
+ */
96
+ export declare function ensureEndpointEmbeddingSpaceIdentity(): Promise<EmbeddingSpaceIdentity | null>;
89
97
  //# sourceMappingURL=real-embeddings.d.ts.map
@@ -410,4 +410,20 @@ export function getEndpointIdentity() {
410
410
  export function getActiveEmbeddingSpaceIdentity() {
411
411
  return activeEmbeddingSpaceIdentity;
412
412
  }
413
+ /**
414
+ * #754: resolve the configured endpoint's embedding-space identity before an
415
+ * index binder (RVF pattern store, brain.rvf dual writer, SQLite HNSW) checks
416
+ * its space manifest. The endpoint runtime otherwise initializes lazily on the
417
+ * first embed call — after the binder has already refused for the process.
418
+ * Returns null when no endpoint is configured, so binders stay fail-closed.
419
+ */
420
+ export async function ensureEndpointEmbeddingSpaceIdentity() {
421
+ if (activeEmbeddingSpaceIdentity)
422
+ return activeEmbeddingSpaceIdentity;
423
+ const endpoint = process.env.AQE_EMBEDDER_ENDPOINT;
424
+ if (!endpoint)
425
+ return null;
426
+ await initializeModel({ endpoint, endpointToken: process.env.AQE_EMBEDDER_TOKEN });
427
+ return activeEmbeddingSpaceIdentity;
428
+ }
413
429
  //# sourceMappingURL=real-embeddings.js.map
@@ -15,8 +15,8 @@ import { v4 as uuidv4 } from 'uuid';
15
15
  import { ok, err } from '../shared/types/index.js';
16
16
  import { toErrorMessage } from '../shared/error-utils.js';
17
17
  import { calculateQualityScore, validateQEPattern, mapQEDomainToAQE, PROMOTION_THRESHOLD, } from './qe-patterns.js';
18
- import { DEFAULT_PATTERN_STORE_CONFIG } from './pattern-store.js';
19
- import { getActiveEmbeddingSpaceIdentity } from './real-embeddings.js';
18
+ import { DEFAULT_PATTERN_STORE_CONFIG, blendFtsScore } from './pattern-store.js';
19
+ import { ensureEndpointEmbeddingSpaceIdentity, getActiveEmbeddingSpaceIdentity } from './real-embeddings.js';
20
20
  import { verifyOrCreateEmbeddingSpaceManifest } from './embedding-space.js';
21
21
  import { PatternMutationError } from './pattern-mutation-error.js';
22
22
  // ============================================================================
@@ -75,6 +75,12 @@ export class RvfPatternStore {
75
75
  return;
76
76
  }
77
77
  try {
78
+ // The endpoint runtime is lazy. Resolve its executable identity before
79
+ // binding a new RVF index; otherwise every fresh process sees null here
80
+ // and permanently disables RVF even though the endpoint is configured.
81
+ if (!this.embeddingSpaceId && !getActiveEmbeddingSpaceIdentity()) {
82
+ await ensureEndpointEmbeddingSpaceIdentity();
83
+ }
78
84
  this.adapter = this.createAdapter(this.rvfPath, this.config.embeddingDimension);
79
85
  const activeSpaceId = getActiveEmbeddingSpaceIdentity()?.spaceId ?? this.embeddingSpaceId ?? null;
80
86
  verifyOrCreateEmbeddingSpaceManifest(this.rvfPath, activeSpaceId, this.adapter.status()?.totalVectors ?? 0);
@@ -90,9 +96,10 @@ export class RvfPatternStore {
90
96
  this.adapter?.close();
91
97
  }
92
98
  catch { /* best effort */ }
93
- console.error(`[RvfPatternStore] ERROR: RVF native init failed — vector search is DISABLED. ` +
99
+ console.error(`[RvfPatternStore] ERROR: RVF initialization failed — vector search is DISABLED. ` +
94
100
  `Cause: ${this.rvfInitError}. ` +
95
- `Fix: install @ruvector/rvf-node native bindings, or set useRVFPatternStore=false to use SQLite HNSW.`);
101
+ `Fix: check the embedder endpoint and @ruvector/rvf-node binding, ` +
102
+ `or set RUVECTOR_USE_RVF_PATTERN_STORE=false to use SQLite HNSW.`);
96
103
  this.adapter = null;
97
104
  this.initialized = true; // mark initialized to prevent retry loops
98
105
  }
@@ -375,22 +382,35 @@ export class RvfPatternStore {
375
382
  }
376
383
  catch { /* SQLite unavailable */ }
377
384
  }
378
- // FTS5 text search fallback via SQLite
379
- if (typeof query === 'string' && query.trim() && this.sqliteStore) {
385
+ // FTS5 hybrid search via SQLite
386
+ const ftsText = typeof query === 'string' ? query : options.textQuery;
387
+ if (ftsText?.trim() && this.sqliteStore) {
380
388
  try {
381
- const ftsResults = this.sqliteStore.searchFTS(query, limit * 2);
389
+ const ftsResults = this.sqliteStore.searchFTS(ftsText, limit * 2);
382
390
  const existingIds = new Set(results.map(r => r.pattern.id));
391
+ // #653: same vector/FTS5 blend as PatternStore for hits found by
392
+ // both, so lexical relevance can reorder vector results.
393
+ const ftsScoreMap = new Map(ftsResults.map(r => [r.id, r.ftsScore]));
394
+ for (const result of results) {
395
+ const ftsScore = ftsScoreMap.get(result.pattern.id);
396
+ if (ftsScore !== undefined) {
397
+ result.score = blendFtsScore(result.score, ftsScore);
398
+ }
399
+ }
383
400
  for (const ftsResult of ftsResults) {
384
401
  if (existingIds.has(ftsResult.id))
385
402
  continue;
386
403
  const pattern = await this.get(ftsResult.id);
387
404
  if (pattern && this.matchesFilters(pattern, options)) {
388
- const reuseInfo = this.calculateReuseInfo(pattern, ftsResult.ftsScore);
405
+ // Same keyword-only similarity rule as PatternStore (#653)
406
+ const keywordScore = 0.5 * ftsResult.ftsScore * ftsResult.coverage;
407
+ const similarity = ftsResult.phrase ? ftsResult.ftsScore : keywordScore;
408
+ const reuseInfo = this.calculateReuseInfo(pattern, similarity);
389
409
  results.push({
390
410
  pattern,
391
- score: 0.5 * ftsResult.ftsScore,
411
+ score: keywordScore,
392
412
  matchType: 'exact',
393
- similarity: ftsResult.ftsScore,
413
+ similarity,
394
414
  canReuse: reuseInfo.canReuse,
395
415
  estimatedTokenSavings: reuseInfo.estimatedTokenSavings,
396
416
  reuseConfidence: reuseInfo.reuseConfidence,
@@ -91,12 +91,19 @@ export declare class SQLitePatternStore {
91
91
  }): QEPattern[];
92
92
  /**
93
93
  * FTS5 full-text search for patterns.
94
- * Returns pattern IDs with BM25 relevance scores.
94
+ * Returns pattern IDs with BM25 relevance scores. `phrase` marks hits that
95
+ * also contain the whole query as a phrase (near-duplicate evidence).
96
+ * `coverage` is the fraction of distinct query terms the hit contains: an
97
+ * absolute measure, unlike `ftsScore`, which is relative to the best hit.
95
98
  */
96
99
  searchFTS(query: string, limit?: number): Array<{
97
100
  id: string;
98
101
  ftsScore: number;
102
+ phrase: boolean;
103
+ coverage: number;
99
104
  }>;
105
+ /** IDs whose FTS5 text contains the whole query as one phrase. */
106
+ private searchFTSPhraseIds;
100
107
  /** Last FTS5 search latency in ms, for instrumentation */
101
108
  private _lastFtsLatencyMs;
102
109
  get lastFtsLatencyMs(): number;
@@ -54,6 +54,13 @@ export function hashEmbedding(text, dimension = 384) {
54
54
  }
55
55
  return embedding;
56
56
  }
57
+ /**
58
+ * Lowercased letter/digit tokens with diacritics removed, approximating the
59
+ * FTS5 unicode61 tokenizer so query terms and stored text compare alike.
60
+ */
61
+ function ftsTokens(text) {
62
+ return text.normalize('NFKD').replace(/\p{M}+/gu, '').toLowerCase().match(/[\p{L}\p{N}]+/gu) ?? [];
63
+ }
57
64
  /**
58
65
  * SQLite-based pattern persistence
59
66
  */
@@ -465,20 +472,29 @@ export class SQLitePatternStore {
465
472
  }
466
473
  /**
467
474
  * FTS5 full-text search for patterns.
468
- * Returns pattern IDs with BM25 relevance scores.
475
+ * Returns pattern IDs with BM25 relevance scores. `phrase` marks hits that
476
+ * also contain the whole query as a phrase (near-duplicate evidence).
477
+ * `coverage` is the fraction of distinct query terms the hit contains: an
478
+ * absolute measure, unlike `ftsScore`, which is relative to the best hit.
469
479
  */
470
480
  searchFTS(query, limit = 20) {
471
481
  if (!this.db)
472
482
  throw new Error('Database not initialized');
473
483
  if (!query.trim())
474
484
  return [];
475
- // Sanitize: wrap in double quotes to force literal phrase match,
476
- // escaping any internal double quotes to prevent FTS5 syntax injection
477
- const sanitized = '"' + query.replace(/"/g, '""') + '"';
485
+ // #653: match any query term (BM25 ranks docs matching more/rarer terms
486
+ // higher). A whole-query phrase almost never matched sentence-style task
487
+ // queries. Terms are letters/digits only, quoted, so FTS5 syntax can't leak in.
488
+ const terms = [...new Set(ftsTokens(query))]
489
+ .filter(term => term.length >= 2)
490
+ .slice(0, 32);
491
+ if (terms.length === 0)
492
+ return [];
493
+ const sanitized = terms.map(term => `"${term}"`).join(' OR ');
478
494
  const start = performance.now();
479
495
  try {
480
496
  const rows = this.db.prepare(`
481
- SELECT p.id, rank AS fts_score
497
+ SELECT p.id, rank AS fts_score, p.name, p.description, p.pattern_type, p.qe_domain
482
498
  FROM qe_patterns_fts fts
483
499
  JOIN qe_patterns p ON p.rowid = fts.rowid
484
500
  WHERE qe_patterns_fts MATCH ?
@@ -494,16 +510,40 @@ export class SQLitePatternStore {
494
510
  // Use Math.max(maxScore, 1.0) to prevent single-result inflation:
495
511
  // without this, a single FTS5 result always normalizes to 1.0
496
512
  const maxAbsScore = Math.max(...rows.map(r => Math.abs(r.fts_score)), 1.0);
497
- return rows.map(r => ({
498
- id: r.id,
499
- ftsScore: Math.abs(r.fts_score) / maxAbsScore,
500
- }));
513
+ const phraseIds = rows.length > 0 ? this.searchFTSPhraseIds(query, limit) : new Set();
514
+ return rows.map(r => {
515
+ const docTerms = new Set(ftsTokens([r.name, r.description, r.pattern_type, r.qe_domain].filter(Boolean).join(' ')));
516
+ const matched = terms.filter(term => docTerms.has(term)).length;
517
+ return {
518
+ id: r.id,
519
+ ftsScore: Math.abs(r.fts_score) / maxAbsScore,
520
+ phrase: phraseIds.has(r.id),
521
+ coverage: matched / terms.length,
522
+ };
523
+ });
501
524
  }
502
525
  catch {
503
526
  // FTS5 table may not exist yet (unified DB migrated before schema update)
504
527
  return [];
505
528
  }
506
529
  }
530
+ /** IDs whose FTS5 text contains the whole query as one phrase. */
531
+ searchFTSPhraseIds(query, limit) {
532
+ // Whole query quoted as one phrase, internal quotes escaped (FTS5 syntax-safe)
533
+ const phrase = '"' + query.replace(/"/g, '""') + '"';
534
+ try {
535
+ const rows = this.db.prepare(`
536
+ SELECT p.id FROM qe_patterns_fts fts
537
+ JOIN qe_patterns p ON p.rowid = fts.rowid
538
+ WHERE qe_patterns_fts MATCH ?
539
+ LIMIT ?
540
+ `).all(phrase, limit);
541
+ return new Set(rows.map(r => r.id));
542
+ }
543
+ catch {
544
+ return new Set();
545
+ }
546
+ }
507
547
  /** Last FTS5 search latency in ms, for instrumentation */
508
548
  _lastFtsLatencyMs = 0;
509
549
  get lastFtsLatencyMs() { return this._lastFtsLatencyMs; }
@@ -69,13 +69,10 @@ export declare class ConsoleLogger implements Logger {
69
69
  */
70
70
  private mergeContext;
71
71
  /**
72
- * Format context object for display
72
+ * Format context object for display. The context is first reduced to a
73
+ * redacted, bounded, cycle-free copy (#740), so it serializes safely.
73
74
  */
74
75
  private formatContext;
75
- /**
76
- * Create a JSON replacer that handles circular references and depth limiting
77
- */
78
- private createReplacer;
79
76
  }
80
77
  /**
81
78
  * No-op Logger implementation for use when logging is disabled