agentic-qe 3.11.4 → 3.11.5

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 (398) hide show
  1. package/.claude/hooks/aqe-hook.cjs +44 -10
  2. package/.claude/skills/skills-manifest.json +1 -1
  3. package/CHANGELOG.md +58 -0
  4. package/assets/skills/skills-manifest.json +1 -1
  5. package/dist/audit/witness-chain.d.ts +25 -0
  6. package/dist/audit/witness-chain.js +69 -22
  7. package/dist/audit/witness-key-manager.d.ts +11 -0
  8. package/dist/audit/witness-key-manager.js +24 -0
  9. package/dist/cli/brain-commands.js +2 -1
  10. package/dist/cli/bundle.js +5 -5
  11. package/dist/cli/chunks/adapter-KNM5R47J.js +2 -0
  12. package/dist/cli/chunks/{agent-booster-wasm-62I6ZNRW.js → agent-booster-wasm-CSTBLNYZ.js} +2 -2
  13. package/dist/cli/chunks/{agent-handler-E2TZKKBS.js → agent-handler-M4W4GTXN.js} +2 -2
  14. package/dist/cli/chunks/{agent-memory-branch-JHAHC2NH.js → agent-memory-branch-VGXFYLSQ.js} +2 -2
  15. package/dist/cli/chunks/aqe-learning-engine-MXPJLVR3.js +2 -0
  16. package/dist/cli/chunks/{arena-72ZV65BR.js → arena-FKSD3LLM.js} +4 -4
  17. package/dist/cli/chunks/{arena-KLG3YSSR.js → arena-IQBRGWAG.js} +2 -2
  18. package/dist/cli/chunks/audit-7NSGRR4Z.js +3 -0
  19. package/dist/cli/chunks/base-X4EXQ2AS.js +2 -0
  20. package/dist/cli/chunks/{hnswlib-node-LAFK5QZ4.js → better-sqlite3-2KR4LQRU.js} +2 -2
  21. package/dist/cli/chunks/brain-handler-M6A3UB66.js +89 -0
  22. package/dist/cli/chunks/{branch-enumerator-C7MPNYT7.js → branch-enumerator-2JGKY4BB.js} +2 -2
  23. package/dist/cli/chunks/{browser-UUDUDYLR.js → browser-J43WQPJL.js} +2 -2
  24. package/dist/cli/chunks/browser-workflow-4HX6RP5F.js +2 -0
  25. package/dist/cli/chunks/{chunk-UJMTKXPI.js → chunk-26WEI3P4.js} +2 -2
  26. package/dist/cli/chunks/{chunk-TQ373GGI.js → chunk-2XPMATEK.js} +2 -2
  27. package/dist/cli/chunks/{chunk-QJ5NCYJ3.js → chunk-2XQHG56O.js} +2 -2
  28. package/dist/cli/chunks/{chunk-EONKMHKO.js → chunk-354367AP.js} +2 -2
  29. package/dist/cli/chunks/{chunk-THKZVOZV.js → chunk-37ZUF5NX.js} +1 -1
  30. package/dist/cli/chunks/{chunk-5P7Q5YNC.js → chunk-3I4TCMOJ.js} +1 -1
  31. package/dist/cli/chunks/{chunk-PQUXFSN6.js → chunk-3JF5A72M.js} +2 -2
  32. package/dist/cli/chunks/{chunk-B5XUWHKQ.js → chunk-3LY7OCSO.js} +1 -1
  33. package/dist/cli/chunks/{chunk-HJ24KMC2.js → chunk-3V36WMIO.js} +1 -1
  34. package/dist/cli/chunks/{chunk-6JUOH6L4.js → chunk-3WR35GFF.js} +2 -2
  35. package/dist/cli/chunks/{chunk-T76RFXQX.js → chunk-4LODYRNV.js} +2 -2
  36. package/dist/cli/chunks/{chunk-D5S47YUS.js → chunk-4MHN7JWC.js} +3 -3
  37. package/dist/cli/chunks/chunk-4QOI5JS7.js +14 -0
  38. package/dist/cli/chunks/{chunk-63QUN3JK.js → chunk-4RTWPR3X.js} +1 -1
  39. package/dist/cli/chunks/chunk-4XJ2A3HY.js +65 -0
  40. package/dist/cli/chunks/{chunk-KUZMVH6N.js → chunk-4Y3LGBKJ.js} +3 -3
  41. package/dist/cli/chunks/{chunk-JFLSQH2X.js → chunk-52U5BFZP.js} +2 -2
  42. package/dist/cli/chunks/{chunk-YNK6SUPU.js → chunk-53YOYZW5.js} +2 -2
  43. package/dist/cli/chunks/{chunk-O7PVZ32A.js → chunk-5WMU7XCF.js} +1 -1
  44. package/dist/cli/chunks/{chunk-ZKCKOQJI.js → chunk-62OTU2AP.js} +2 -2
  45. package/dist/cli/chunks/{chunk-3SKIZDKL.js → chunk-62UM7Q5N.js} +1 -1
  46. package/dist/cli/chunks/{chunk-SFDUT5WM.js → chunk-6Q57K4YD.js} +2 -2
  47. package/dist/cli/chunks/{chunk-3SBUL72V.js → chunk-6R3YOAKO.js} +2 -2
  48. package/dist/cli/chunks/chunk-6T65OKUM.js +2 -0
  49. package/dist/cli/chunks/{chunk-TCVEKRPI.js → chunk-7BCRULCP.js} +2 -2
  50. package/dist/cli/chunks/{chunk-VKJQAKYG.js → chunk-7DTMENY6.js} +2 -2
  51. package/dist/cli/chunks/{chunk-XQ6DW5FV.js → chunk-7KXPNNMR.js} +2 -2
  52. package/dist/cli/chunks/{chunk-N2BJN6AO.js → chunk-7P6X4BFO.js} +3 -3
  53. package/dist/cli/chunks/{chunk-SL3SNOO2.js → chunk-7YSBATSN.js} +2 -2
  54. package/dist/cli/chunks/{chunk-5U2WHPXL.js → chunk-ABU64UWB.js} +1 -1
  55. package/dist/cli/chunks/{chunk-4RHNPRAP.js → chunk-AF6P5RWY.js} +2 -2
  56. package/dist/cli/chunks/{chunk-4JFH3MVA.js → chunk-AGJOGUP5.js} +1 -1
  57. package/dist/cli/chunks/{chunk-5Z4FBCBK.js → chunk-AL5VJJN4.js} +1 -1
  58. package/dist/cli/chunks/{chunk-Z2REKBD6.js → chunk-AOQYORVA.js} +2 -2
  59. package/dist/cli/chunks/{chunk-X64BEXUY.js → chunk-AOXJFDH5.js} +117 -113
  60. package/dist/cli/chunks/{chunk-DRMHVY4T.js → chunk-AXKWV5NF.js} +4 -4
  61. package/dist/cli/chunks/{chunk-3FJZMQJ7.js → chunk-B2VBDMDI.js} +2 -2
  62. package/dist/cli/chunks/{chunk-ARPBG6FQ.js → chunk-BJLA2IX7.js} +2 -2
  63. package/dist/cli/chunks/{chunk-6W3QHS45.js → chunk-BLPWJQTY.js} +2 -2
  64. package/dist/cli/chunks/{chunk-O5NEJIHB.js → chunk-BTLUWH4R.js} +2 -2
  65. package/dist/cli/chunks/{chunk-Y4AXOHW4.js → chunk-C4EZNOWK.js} +1 -1
  66. package/dist/cli/chunks/{chunk-FRFVN6AA.js → chunk-C5C4W572.js} +2 -2
  67. package/dist/cli/chunks/{chunk-7AWK43JN.js → chunk-CDJP6COA.js} +2 -2
  68. package/dist/cli/chunks/{chunk-VJGHRWMH.js → chunk-CKOF27L7.js} +2 -2
  69. package/dist/cli/chunks/{chunk-3E7D3A35.js → chunk-D45QLJEL.js} +1 -1
  70. package/dist/cli/chunks/{chunk-MALOUGSF.js → chunk-DFRRWOEX.js} +2 -2
  71. package/dist/cli/chunks/{chunk-JDFPAJGB.js → chunk-DLBVADWQ.js} +92 -92
  72. package/dist/cli/chunks/{chunk-7IKWF2AD.js → chunk-DPL762HU.js} +1 -1
  73. package/dist/cli/chunks/{chunk-RFQBDMAP.js → chunk-DVW66FPU.js} +1 -1
  74. package/dist/cli/chunks/{chunk-JPENUVCI.js → chunk-EDOGRFAG.js} +1 -1
  75. package/dist/cli/chunks/{chunk-HWBMYR5W.js → chunk-EEKG35K5.js} +5 -5
  76. package/dist/cli/chunks/{chunk-WQZ2WRO4.js → chunk-EK3HPH6A.js} +1 -1
  77. package/dist/cli/chunks/{chunk-WZYNY3VF.js → chunk-FGD6HINU.js} +1 -1
  78. package/dist/cli/chunks/{chunk-ZSBJNE35.js → chunk-FGSIID5C.js} +2 -2
  79. package/dist/cli/chunks/{chunk-TCWR6TDN.js → chunk-FHTYEAQ3.js} +2 -2
  80. package/dist/cli/chunks/{chunk-BRLUNIR4.js → chunk-FII3WCCY.js} +2 -2
  81. package/dist/cli/chunks/{chunk-VCUCD3B5.js → chunk-FIPKIIMS.js} +2 -2
  82. package/dist/cli/chunks/{chunk-6545AS2J.js → chunk-FMNXHVIN.js} +2 -2
  83. package/dist/cli/chunks/{chunk-VO6YJGB4.js → chunk-G2ZIJZJ7.js} +2 -2
  84. package/dist/cli/chunks/{chunk-7ADD2ZQL.js → chunk-GODAWJMZ.js} +2 -2
  85. package/dist/cli/chunks/{chunk-AQIEK4SY.js → chunk-GW6XWMX2.js} +2 -2
  86. package/dist/cli/chunks/{chunk-GOQ4P2PB.js → chunk-HC6KTVFR.js} +2 -2
  87. package/dist/cli/chunks/{chunk-2KNFS3L5.js → chunk-HJWT4KME.js} +1 -1
  88. package/dist/cli/chunks/{chunk-NV3TXXOW.js → chunk-I3ANRYQ6.js} +2 -2
  89. package/dist/cli/chunks/{chunk-IQBZBUP5.js → chunk-I3NWKPXJ.js} +2 -2
  90. package/dist/cli/chunks/chunk-IBDQWKI3.js +2 -0
  91. package/dist/cli/chunks/{chunk-LW5DHT3Z.js → chunk-IU5RSN6M.js} +2 -2
  92. package/dist/cli/chunks/{chunk-XHRLBJTM.js → chunk-J5XDKVI7.js} +2 -2
  93. package/dist/cli/chunks/{chunk-QEVX4GWF.js → chunk-J6PFPY7V.js} +2 -2
  94. package/dist/cli/chunks/{chunk-AE6HXMOG.js → chunk-JATLFS6A.js} +1 -1
  95. package/dist/cli/chunks/{chunk-HJO4RNOW.js → chunk-JBKZ5TUM.js} +2 -2
  96. package/dist/cli/chunks/{chunk-7QTB5XIQ.js → chunk-JDSHUECG.js} +2 -2
  97. package/dist/cli/chunks/{chunk-GRQ36XUH.js → chunk-K4C25BWV.js} +2 -2
  98. package/dist/cli/chunks/{chunk-BMQDELPA.js → chunk-K4I7UIU5.js} +1 -1
  99. package/dist/cli/chunks/{chunk-AJXGGTX7.js → chunk-KP3R2M2G.js} +1 -1
  100. package/dist/cli/chunks/chunk-KQVIWE3W.js +2 -0
  101. package/dist/cli/chunks/{chunk-ZFCVT43J.js → chunk-KVVJVMDM.js} +2 -2
  102. package/dist/cli/chunks/{chunk-WMIRAD3J.js → chunk-LOE2JETO.js} +2 -2
  103. package/dist/cli/chunks/{chunk-54B6P2WS.js → chunk-LPR2R3AN.js} +3 -3
  104. package/dist/cli/chunks/{chunk-EZRHSHOQ.js → chunk-M6FW56MV.js} +2 -2
  105. package/dist/cli/chunks/{chunk-IF3HPQNV.js → chunk-MCHEUSY4.js} +1 -1
  106. package/dist/cli/chunks/{chunk-NBBLPDJX.js → chunk-MEIU7457.js} +2 -2
  107. package/dist/cli/chunks/{chunk-4BFCLSDN.js → chunk-MHMQ6MCT.js} +2 -2
  108. package/dist/cli/chunks/{chunk-UQ72K44T.js → chunk-MIU5RUBJ.js} +2 -2
  109. package/dist/cli/chunks/{chunk-LKURMUBU.js → chunk-MMEXHZUC.js} +37 -12
  110. package/dist/cli/chunks/{chunk-SRVTNG6L.js → chunk-MTBGOWJA.js} +2 -2
  111. package/dist/cli/chunks/{chunk-TPMBFARK.js → chunk-NCSXLMDL.js} +67 -22
  112. package/dist/cli/chunks/{chunk-TU6YN43Q.js → chunk-O7J54OHN.js} +1 -1
  113. package/dist/cli/chunks/{chunk-JCTCM6IR.js → chunk-OGNTCZKK.js} +1 -1
  114. package/dist/cli/chunks/{chunk-FSGMRQFC.js → chunk-OS2HHJTM.js} +2 -2
  115. package/dist/cli/chunks/{chunk-TSWF3AGQ.js → chunk-OS62Y77J.js} +2 -2
  116. package/dist/cli/chunks/{chunk-VQU7DMEY.js → chunk-PVDXNQPL.js} +2 -2
  117. package/dist/cli/chunks/{chunk-DNOU2HVQ.js → chunk-PW72M2FE.js} +2 -2
  118. package/dist/cli/chunks/{chunk-HH6NCBSP.js → chunk-Q5TR6ETB.js} +22 -22
  119. package/dist/cli/chunks/{chunk-PFWJQPUC.js → chunk-QKK7VBVB.js} +2 -2
  120. package/dist/cli/chunks/{chunk-JNQN5DNS.js → chunk-RFLHPLET.js} +1 -1
  121. package/dist/cli/chunks/{chunk-IB3ZPLFA.js → chunk-RJN2RM76.js} +2 -2
  122. package/dist/cli/chunks/{chunk-PEIQDQXN.js → chunk-RKXZLTWR.js} +2 -2
  123. package/dist/cli/chunks/{chunk-5VSQAGA2.js → chunk-SE3JFUKP.js} +1 -1
  124. package/dist/cli/chunks/{chunk-LMJUMUQJ.js → chunk-SK754ZSH.js} +4 -4
  125. package/dist/cli/chunks/{chunk-UCYTY4LG.js → chunk-SO6G4IX3.js} +2 -2
  126. package/dist/cli/chunks/{chunk-ICCTQ5LO.js → chunk-SUL3I6QZ.js} +2 -2
  127. package/dist/cli/chunks/{chunk-G3TFNY4T.js → chunk-TBT3OFRW.js} +2 -2
  128. package/dist/cli/chunks/{chunk-AYGEWPN4.js → chunk-TEIWJ3GJ.js} +1 -1
  129. package/dist/cli/chunks/{chunk-YKSWC7I4.js → chunk-TRNBQFFG.js} +8 -20
  130. package/dist/cli/chunks/{chunk-NSPCZPTB.js → chunk-TTJJ4DQE.js} +2 -2
  131. package/dist/cli/chunks/{chunk-2WPSMQIL.js → chunk-UBI2EOS3.js} +1 -1
  132. package/dist/cli/chunks/{chunk-ADFKY3X2.js → chunk-UBY322ED.js} +2 -2
  133. package/dist/cli/chunks/{chunk-QSDIY3E2.js → chunk-UORTQXJ2.js} +1 -1
  134. package/dist/cli/chunks/{chunk-ODZSQVEW.js → chunk-URP75DL4.js} +1 -1
  135. package/dist/cli/chunks/{chunk-37ZDGJ3H.js → chunk-V6NAB5UZ.js} +1 -1
  136. package/dist/cli/chunks/{chunk-YZ5EQR37.js → chunk-VMFAANWX.js} +2 -2
  137. package/dist/cli/chunks/{chunk-NFJT7XXR.js → chunk-VMWRMINE.js} +1 -1
  138. package/dist/cli/chunks/{chunk-MCT4CD5M.js → chunk-VN2HHBZN.js} +2 -2
  139. package/dist/cli/chunks/{chunk-QMC5MTBV.js → chunk-W72FJA2H.js} +2 -2
  140. package/dist/cli/chunks/chunk-W7TYKPLY.js +27 -0
  141. package/dist/cli/chunks/{chunk-YUHM72VQ.js → chunk-WHHQIL4F.js} +2 -2
  142. package/dist/cli/chunks/{chunk-4YT5YN5G.js → chunk-WMZ2QGGS.js} +2 -2
  143. package/dist/cli/chunks/{chunk-Q7ORVHJB.js → chunk-WPSK237F.js} +3 -3
  144. package/dist/cli/chunks/{chunk-ZYZT2CDX.js → chunk-XKQY2Z3Q.js} +1 -1
  145. package/dist/cli/chunks/{chunk-WNMDWP5A.js → chunk-XLT3FYS7.js} +2 -2
  146. package/dist/cli/chunks/{chunk-U34OZXD6.js → chunk-XT4TDLOB.js} +2 -2
  147. package/dist/cli/chunks/{chunk-6GYGAW53.js → chunk-Y25PO65W.js} +2 -2
  148. package/dist/cli/chunks/{chunk-3SRPFBU7.js → chunk-Y6DWJKHU.js} +3 -3
  149. package/dist/cli/chunks/{chunk-D6CKKNYC.js → chunk-YBPLJRVT.js} +2 -2
  150. package/dist/cli/chunks/{chunk-LLUPRGOR.js → chunk-YFCULQBP.js} +2 -2
  151. package/dist/cli/chunks/{chunk-HT6WAYIR.js → chunk-YGVDP6X7.js} +1 -1
  152. package/dist/cli/chunks/{chunk-RCPD6F4R.js → chunk-YR2JKBZO.js} +2 -2
  153. package/dist/cli/chunks/{chunk-P6S6ZVB5.js → chunk-YZSTZUGJ.js} +1 -1
  154. package/dist/cli/chunks/{chunk-CNF3ZWLM.js → chunk-ZG5UAEEO.js} +2 -2
  155. package/dist/cli/chunks/{chunk-MWFJC5HR.js → chunk-ZLBY25MB.js} +1 -1
  156. package/dist/cli/chunks/chunk-ZMPAM4DY.js +2 -0
  157. package/dist/cli/chunks/{chunk-A4OMK3FO.js → chunk-ZPP57WQU.js} +2 -2
  158. package/dist/cli/chunks/{chunk-U3AVZGQA.js → chunk-ZXEWTZFR.js} +1 -1
  159. package/dist/cli/chunks/{ci-HQCRSCC7.js → ci-CBNVLOOQ.js} +2 -2
  160. package/dist/cli/chunks/{ci-output-YBVXLA6O.js → ci-output-I4HY2FYJ.js} +2 -2
  161. package/dist/cli/chunks/{circuit-breaker-ULGMF2QN.js → circuit-breaker-5VRBKGWL.js} +2 -2
  162. package/dist/cli/chunks/{claude-flow-setup-MKZ2LJXK.js → claude-flow-setup-XPJPKHIO.js} +2 -2
  163. package/dist/cli/chunks/client-AHXNCOHK.js +2 -0
  164. package/dist/cli/chunks/{cline-installer-WZQ6XBWN.js → cline-installer-OFRDUUWZ.js} +2 -2
  165. package/dist/cli/chunks/{code-H3KGH45S.js → code-QIZQVB3E.js} +2 -2
  166. package/dist/cli/chunks/{code-index-extractor-NUVEAJ7C.js → code-index-extractor-LMUUWEX4.js} +2 -2
  167. package/dist/cli/chunks/{codex-installer-JQI6E6CV.js → codex-installer-N2MKIZ2S.js} +2 -2
  168. package/dist/cli/chunks/{completions-NDF4PFE7.js → completions-Y36S3C5J.js} +2 -2
  169. package/dist/cli/chunks/{complexity-analyzer-XCZH66HG.js → complexity-analyzer-73YS3WUD.js} +2 -2
  170. package/dist/cli/chunks/{continuedev-installer-Z4AJGZ7S.js → continuedev-installer-SAOTP6J3.js} +2 -2
  171. package/dist/cli/chunks/{copilot-installer-K4IPAL7C.js → copilot-installer-A4HXF6HE.js} +2 -2
  172. package/dist/cli/chunks/core-handlers-EEFLLMAZ.js +2 -0
  173. package/dist/cli/chunks/{cost-tracker-35KXAB23.js → cost-tracker-P26XUVZS.js} +2 -2
  174. package/dist/cli/chunks/{coverage-QW5I4TYZ.js → coverage-HVNHSMVJ.js} +3 -3
  175. package/dist/cli/chunks/cross-domain-router-LT3H4SNJ.js +2 -0
  176. package/dist/cli/chunks/{cursor-installer-P4Z7RMIZ.js → cursor-installer-46BQFTYZ.js} +2 -2
  177. package/dist/cli/chunks/{daemon-WQWTCYBM.js → daemon-Y54O3FLT.js} +3 -3
  178. package/dist/cli/chunks/daemon-YE7K2AZF.js +10 -0
  179. package/dist/cli/chunks/{dag-attention-scheduler-7XD2VGON.js → dag-attention-scheduler-ETA7YY52.js} +2 -2
  180. package/dist/cli/chunks/{detect-GZ3P4DI7.js → detect-5WLQ2J3E.js} +2 -2
  181. package/dist/cli/chunks/{dist-node-6WWAW7OP.js → dist-node-45WW6I7J.js} +2 -2
  182. package/dist/cli/chunks/{domain-handler-3GTLWARQ.js → domain-handler-J7DQV74M.js} +2 -2
  183. package/dist/cli/chunks/domain-transfer-GD2EGQVR.js +2 -0
  184. package/dist/cli/chunks/dream-4K3BK4IG.js +2 -0
  185. package/dist/cli/chunks/{embed-and-insert-pattern-BGIMA77V.js → embed-and-insert-pattern-JELNEA2D.js} +2 -2
  186. package/dist/cli/chunks/{eval-SXV6DRDD.js → eval-A4PA5G2U.js} +2 -2
  187. package/dist/cli/chunks/{experience-capture-middleware-TT6WCT2S.js → experience-capture-middleware-MLHTYWTA.js} +3 -3
  188. package/dist/cli/chunks/{fast-paths-HTAZHEQP.js → fast-paths-QYDTITRV.js} +2 -2
  189. package/dist/cli/chunks/{feature-flags-WBUKU54W.js → feature-flags-H4MSY26Z.js} +2 -2
  190. package/dist/cli/chunks/{feature-flags-DIE3Z2B4.js → feature-flags-MQYYRHIK.js} +2 -2
  191. package/dist/cli/chunks/{file-discovery-SKDETFS3.js → file-discovery-RMFVJNGL.js} +2 -2
  192. package/dist/cli/chunks/{fleet-WCWEPAVU.js → fleet-7KZQOTAC.js} +4 -4
  193. package/dist/cli/chunks/{gnn-wrapper-KWZOWBYS.js → gnn-wrapper-NMZFTGVH.js} +2 -2
  194. package/dist/cli/chunks/{heartbeat-handler-3AGYHVG2.js → heartbeat-handler-7BQDK7MG.js} +4 -4
  195. package/dist/cli/chunks/heartbeat-scheduler-IMPPGQUK.js +2 -0
  196. package/dist/cli/chunks/hnsw-adapter-EIAA6R2L.js +2 -0
  197. package/dist/cli/chunks/hnsw-index-ZXXP6AXZ.js +2 -0
  198. package/dist/cli/chunks/{hnsw-legacy-bridge-6OJJDZHL.js → hnsw-legacy-bridge-TPPGBPKF.js} +2 -2
  199. package/dist/cli/chunks/{better-sqlite3-URULPKRF.js → hnswlib-node-E6NSZPP2.js} +2 -2
  200. package/dist/cli/chunks/{hooks-OXEBTLXV.js → hooks-CYZIUYSH.js} +48 -52
  201. package/dist/cli/chunks/hybrid-router-LXWG4MLH.js +2 -0
  202. package/dist/cli/chunks/{hypergraph-engine-NL74PRHD.js → hypergraph-engine-WC6DMTYQ.js} +2 -2
  203. package/dist/cli/chunks/{hypergraph-handler-KZ54AEEL.js → hypergraph-handler-GTGA3TXJ.js} +3 -3
  204. package/dist/cli/chunks/impact-analyzer-TP5LRFYH.js +2 -0
  205. package/dist/cli/chunks/{init-handler-XKZXRXPG.js → init-handler-N3Z72JNI.js} +6 -6
  206. package/dist/cli/chunks/init-wizard-AIOA5KOY.js +2 -0
  207. package/dist/cli/chunks/kernel-SQALRU6Q.js +2 -0
  208. package/dist/cli/chunks/{kilocode-installer-WISQMJK7.js → kilocode-installer-FUX4V6II.js} +2 -2
  209. package/dist/cli/chunks/{kiro-installer-O7TBB3GM.js → kiro-installer-ZSNZT7ZR.js} +2 -2
  210. package/dist/cli/chunks/knowledge-graph-JFVT6SNN.js +2 -0
  211. package/dist/cli/chunks/{learning-6IZBGVRU.js → learning-UQY64COU.js} +3 -3
  212. package/dist/cli/chunks/{llm-router-QDMQPPQ7.js → llm-router-CMHGGX6N.js} +4 -4
  213. package/dist/cli/chunks/llm-router-service-XHFKTH3I.js +2 -0
  214. package/dist/cli/chunks/{load-KLAJJGL5.js → load-E6WH4QN2.js} +2 -2
  215. package/dist/cli/chunks/load-test-JEIFJKNN.js +2 -0
  216. package/dist/cli/chunks/{mcp-SZOPQZIZ.js → mcp-UM5VTW6N.js} +2 -2
  217. package/dist/cli/chunks/{memory-G3WY74C6.js → memory-7Q3XDUE5.js} +5 -5
  218. package/dist/cli/chunks/memory-backend-NT7I37CP.js +2 -0
  219. package/dist/cli/chunks/memory-handlers-746D7NE7.js +2 -0
  220. package/dist/cli/chunks/{multi-model-executor-TDNQGTOT.js → multi-model-executor-LZENWVRR.js} +2 -2
  221. package/dist/cli/chunks/{opencode-installer-NGYGEDMV.js → opencode-installer-O2JAIPLF.js} +2 -2
  222. package/dist/cli/chunks/{orchestrator-KPI5DY2C.js → orchestrator-DKZWXDRI.js} +5 -5
  223. package/dist/cli/chunks/pattern-null-store-6QU6WHDW.js +2 -0
  224. package/dist/cli/chunks/pattern-usage-recorder-CLUL4M55.js +2 -0
  225. package/dist/cli/chunks/{pipeline-CSDCC675.js → pipeline-2VDLTR5J.js} +2 -2
  226. package/dist/cli/chunks/{platform-Q5XKEVKH.js → platform-4N4Q5XYX.js} +2 -2
  227. package/dist/cli/chunks/{plugin-XKKR3GVL.js → plugin-GY5AU5CS.js} +2 -2
  228. package/dist/cli/chunks/{prime-radiant-advanced-wasm-22QVNKEN.js → prime-radiant-advanced-wasm-TQ4DKDZS.js} +2 -2
  229. package/dist/cli/chunks/protocol-executor-GT2MZYUU.js +2 -0
  230. package/dist/cli/chunks/{protocol-handler-REQKTJGG.js → protocol-handler-T3LZ3WRG.js} +2 -2
  231. package/dist/cli/chunks/{prove-NOFUFSQN.js → prove-OV7S5J4W.js} +2 -2
  232. package/dist/cli/chunks/provider-manager-OATJ7R3D.js +2 -0
  233. package/dist/cli/chunks/qe-reasoning-bank-IJXNQ67O.js +2 -0
  234. package/dist/cli/chunks/{quality-3DQ2H5TK.js → quality-AXD4NLQA.js} +2 -2
  235. package/dist/cli/chunks/queen-coordinator-6RBHWCUG.js +2 -0
  236. package/dist/cli/chunks/{real-embeddings-FCGNYWLL.js → real-embeddings-2PUCC7FG.js} +2 -2
  237. package/dist/cli/chunks/{roocode-installer-HX3CNRIR.js → roocode-installer-WJ5ARGLW.js} +2 -2
  238. package/dist/cli/chunks/router-XKQRT5JK.js +2 -0
  239. package/dist/cli/chunks/routing-feedback-ACPSD4LW.js +2 -0
  240. package/dist/cli/chunks/{routing-handler-YRZ2LDCR.js → routing-handler-CU6657SZ.js} +2 -2
  241. package/dist/cli/chunks/{ruvector-commands-GCQVBJ4E.js → ruvector-commands-IIF6VSFW.js} +2 -2
  242. package/dist/cli/chunks/{rvf-dual-writer-B562P3ZC.js → rvf-dual-writer-YMQI7XO2.js} +2 -2
  243. package/dist/cli/chunks/{rvf-migration-adapter-NAGFKCMD.js → rvf-migration-adapter-HDE3PR2W.js} +2 -2
  244. package/dist/cli/chunks/{rvf-migration-coordinator-WWFBEJ5Q.js → rvf-migration-coordinator-MQV5OA7K.js} +2 -2
  245. package/dist/cli/chunks/rvf-native-adapter-SIWRKE33.js +2 -0
  246. package/dist/cli/chunks/safe-db-LCPUYMX4.js +2 -0
  247. package/dist/cli/chunks/schedule-HIQJCWXG.js +2 -0
  248. package/dist/cli/chunks/scheduler-QE5EJ5LE.js +2 -0
  249. package/dist/cli/chunks/{security-IFOYTD75.js → security-UM3IGDSM.js} +3 -3
  250. package/dist/cli/chunks/{shared-rvf-adapter-TYD5TQ35.js → shared-rvf-adapter-I3SOJ6M4.js} +2 -2
  251. package/dist/cli/chunks/{shared-rvf-dual-writer-YGOOVDQZ.js → shared-rvf-dual-writer-KQGC2UO7.js} +2 -2
  252. package/dist/cli/chunks/sqlite-persistence-EU54UTMH.js +2 -0
  253. package/dist/cli/chunks/status-handler-OX4CJZME.js +46 -0
  254. package/dist/cli/chunks/{structural-health-KZI6YMKV.js → structural-health-PYUMVBXJ.js} +2 -2
  255. package/dist/cli/chunks/{sync-Z5BDDBMK.js → sync-2TED3YTY.js} +2 -2
  256. package/dist/cli/chunks/{sync-ABZNNYRC.js → sync-VALFNTA6.js} +2 -2
  257. package/dist/cli/chunks/{task-handler-5ACZEPJ7.js → task-handler-VPGAJVPC.js} +2 -2
  258. package/dist/cli/chunks/{task-handlers-UZWDPL6A.js → task-handlers-IB4UAMU6.js} +3 -3
  259. package/dist/cli/chunks/{test-APO3MCVV.js → test-OMRJOZB6.js} +4 -4
  260. package/dist/cli/chunks/{test-scheduling-EFZA5G5C.js → test-scheduling-ZL3YFPBU.js} +3 -3
  261. package/dist/cli/chunks/{token-bootstrap-J2OPLNUK.js → token-bootstrap-DNWZI7SH.js} +2 -2
  262. package/dist/cli/chunks/{token-usage-VHWVNN4R.js → token-usage-IYO7RGFF.js} +2 -2
  263. package/dist/cli/chunks/{transformers-PX4HPO75.js → transformers-53ALC34T.js} +2 -2
  264. package/dist/cli/chunks/{tree-sitter-wasm-parser-44HA2Z3F.js → tree-sitter-wasm-parser-WUKJ2I2Q.js} +2 -2
  265. package/dist/cli/chunks/{types-IMOP7F4R.js → types-47FTEPMV.js} +2 -2
  266. package/dist/cli/chunks/unified-memory-CJLMC2I4.js +2 -0
  267. package/dist/cli/chunks/unified-memory-hnsw-FDGR4D2J.js +2 -0
  268. package/dist/cli/chunks/unified-persistence-UFH5GLDN.js +2 -0
  269. package/dist/cli/chunks/{upgrade-OZ3O6ZZI.js → upgrade-QPLMJA5Z.js} +2 -2
  270. package/dist/cli/chunks/{validate-DRY5BMWX.js → validate-3GVKZOVF.js} +2 -2
  271. package/dist/cli/chunks/{validate-swarm-QD3LYPUF.js → validate-swarm-XCRTLVM6.js} +2 -2
  272. package/dist/cli/chunks/{vibium-2J3H2ITD.js → vibium-CH4VPKVZ.js} +2 -2
  273. package/dist/cli/chunks/visual-security-4ARJ7J2Y.js +2 -0
  274. package/dist/cli/chunks/{web-tree-sitter-KRNUOGKI.js → web-tree-sitter-JDBNAZTV.js} +2 -2
  275. package/dist/cli/chunks/{windsurf-installer-PQIPH3WP.js → windsurf-installer-3MNPVJBP.js} +2 -2
  276. package/dist/cli/chunks/witness-chain-73QC33ED.js +2 -0
  277. package/dist/cli/chunks/{witness-chain-HPLOYPS7.js → witness-chain-HR5UBV5J.js} +2 -2
  278. package/dist/cli/chunks/witness-key-manager-G5SQTIBZ.js +2 -0
  279. package/dist/cli/chunks/{workflow-OAQ3FWCY.js → workflow-43EMD5FY.js} +4 -4
  280. package/dist/cli/chunks/workflow-orchestrator-RKMMPXNA.js +2 -0
  281. package/dist/cli/chunks/{wrappers-UPIU6S5S.js → wrappers-3N7AYNM3.js} +2 -2
  282. package/dist/cli/commands/audit.d.ts +12 -0
  283. package/dist/cli/commands/audit.js +64 -4
  284. package/dist/cli/commands/hooks-handlers/hooks-dream-learning.js +45 -19
  285. package/dist/cli/commands/hooks-handlers/hooks-shared.d.ts +13 -0
  286. package/dist/cli/commands/hooks-handlers/hooks-shared.js +38 -0
  287. package/dist/cli/commands/hooks-handlers/task-hooks.js +19 -1
  288. package/dist/cli/handlers/status-handler.d.ts +18 -0
  289. package/dist/cli/handlers/status-handler.js +47 -0
  290. package/dist/coordination/mincut/queen-integration.js +24 -7
  291. package/dist/coordination/protocol-executor.js +2 -1
  292. package/dist/coordination/queen-lifecycle.js +4 -1
  293. package/dist/domains/code-intelligence/coordinator.js +10 -6
  294. package/dist/domains/code-intelligence/services/product-factors-bridge.js +3 -1
  295. package/dist/domains/defect-intelligence/services/defect-predictor.d.ts +6 -0
  296. package/dist/domains/defect-intelligence/services/defect-predictor.js +21 -0
  297. package/dist/domains/learning-optimization/interfaces.d.ts +7 -0
  298. package/dist/domains/learning-optimization/plugin.js +5 -0
  299. package/dist/domains/learning-optimization/services/learning-coordinator.d.ts +10 -0
  300. package/dist/domains/learning-optimization/services/learning-coordinator.js +57 -0
  301. package/dist/domains/test-execution/plugin.js +2 -2
  302. package/dist/domains/test-execution/services/flaky-detector.js +1 -1
  303. package/dist/domains/test-generation/coordinator.js +22 -8
  304. package/dist/domains/test-generation/interfaces.d.ts +3 -0
  305. package/dist/domains/test-generation/services/test-generator.js +9 -1
  306. package/dist/integrations/ruvector/delta-tracker.js +10 -1
  307. package/dist/integrations/ruvector/sona-persistence.d.ts +24 -0
  308. package/dist/integrations/ruvector/sona-persistence.js +76 -0
  309. package/dist/integrations/ruvector/sona-three-loop.d.ts +15 -0
  310. package/dist/integrations/ruvector/sona-three-loop.js +17 -0
  311. package/dist/kernel/unified-memory-schemas.d.ts +2 -2
  312. package/dist/kernel/unified-memory-schemas.js +48 -2
  313. package/dist/kernel/unified-memory.d.ts +22 -0
  314. package/dist/kernel/unified-memory.js +43 -0
  315. package/dist/learning/aqe-learning-engine.js +3 -1
  316. package/dist/learning/dream/concept-graph.d.ts +31 -1
  317. package/dist/learning/dream/concept-graph.js +109 -3
  318. package/dist/learning/dream/dream-engine.d.ts +13 -1
  319. package/dist/learning/dream/dream-engine.js +146 -10
  320. package/dist/learning/dream/index.d.ts +1 -1
  321. package/dist/learning/dream/types.d.ts +23 -0
  322. package/dist/learning/pattern-store.d.ts +2 -2
  323. package/dist/learning/pattern-store.js +14 -3
  324. package/dist/learning/qe-reasoning-bank.js +34 -31
  325. package/dist/learning/routing-topology-gate.d.ts +12 -2
  326. package/dist/learning/routing-topology-gate.js +15 -3
  327. package/dist/learning/rvf-pattern-store.d.ts +1 -1
  328. package/dist/learning/rvf-pattern-store.js +21 -8
  329. package/dist/learning/sqlite-persistence.js +12 -9
  330. package/dist/mcp/bundle.js +516 -442
  331. package/dist/mcp/qe-tool-bridge.js +7 -2
  332. package/dist/mcp/tools/base.d.ts +29 -0
  333. package/dist/mcp/tools/base.js +25 -0
  334. package/dist/mcp/tools/coverage-analysis/index.js +6 -4
  335. package/dist/mcp/tools/learning-optimization/dream.d.ts +4 -13
  336. package/dist/mcp/tools/learning-optimization/dream.js +10 -96
  337. package/dist/mcp/tools/planning/goap-execute.d.ts +13 -1
  338. package/dist/mcp/tools/planning/goap-execute.js +33 -18
  339. package/dist/mcp/tools/registry.js +7 -2
  340. package/dist/persistence/rvf-migration-coordinator.js +2 -1
  341. package/dist/planning/actions/qe-action-library.js +124 -1
  342. package/dist/planning/goap-planner.d.ts +14 -2
  343. package/dist/planning/goap-planner.js +51 -9
  344. package/dist/planning/index.d.ts +1 -1
  345. package/dist/planning/plan-executor.d.ts +84 -4
  346. package/dist/planning/plan-executor.js +221 -56
  347. package/dist/planning/types.d.ts +27 -0
  348. package/dist/shared/events/domain-events.d.ts +2 -0
  349. package/dist/workers/workers/learning-consolidation.js +21 -1
  350. package/package.json +1 -1
  351. package/dist/cli/chunks/adapter-2HMUXHWY.js +0 -2
  352. package/dist/cli/chunks/aqe-learning-engine-M2NKRVRE.js +0 -2
  353. package/dist/cli/chunks/audit-EPB7ETMT.js +0 -3
  354. package/dist/cli/chunks/base-CCHC2DAC.js +0 -2
  355. package/dist/cli/chunks/brain-handler-FBMYEERK.js +0 -89
  356. package/dist/cli/chunks/browser-workflow-4DGHFYY3.js +0 -2
  357. package/dist/cli/chunks/chunk-5AQ7FXYG.js +0 -27
  358. package/dist/cli/chunks/chunk-KYTFIP6R.js +0 -2
  359. package/dist/cli/chunks/chunk-MYMIEQSZ.js +0 -65
  360. package/dist/cli/chunks/chunk-XXRTWG7O.js +0 -2
  361. package/dist/cli/chunks/chunk-ZSA6V5FH.js +0 -2
  362. package/dist/cli/chunks/client-2OVEDWGU.js +0 -2
  363. package/dist/cli/chunks/core-handlers-UXRRYP52.js +0 -2
  364. package/dist/cli/chunks/cross-domain-router-PV3VQVLO.js +0 -2
  365. package/dist/cli/chunks/daemon-ESUEM6VB.js +0 -10
  366. package/dist/cli/chunks/domain-transfer-TQYO3SVG.js +0 -2
  367. package/dist/cli/chunks/dream-UFUXVJQC.js +0 -2
  368. package/dist/cli/chunks/heartbeat-scheduler-MBG3SARO.js +0 -2
  369. package/dist/cli/chunks/hnsw-adapter-5HXA3QB3.js +0 -2
  370. package/dist/cli/chunks/hnsw-index-PZRQWBRG.js +0 -2
  371. package/dist/cli/chunks/hybrid-router-NQRIE2GG.js +0 -2
  372. package/dist/cli/chunks/impact-analyzer-46347ZDV.js +0 -2
  373. package/dist/cli/chunks/init-wizard-CJYP4WKO.js +0 -2
  374. package/dist/cli/chunks/kernel-22KQZ56U.js +0 -2
  375. package/dist/cli/chunks/knowledge-graph-KM3JDBGR.js +0 -2
  376. package/dist/cli/chunks/llm-router-service-IFO6GRRO.js +0 -2
  377. package/dist/cli/chunks/load-test-TTKCYAPB.js +0 -2
  378. package/dist/cli/chunks/memory-backend-ELHCX2ZT.js +0 -2
  379. package/dist/cli/chunks/memory-handlers-3SKYQZTL.js +0 -2
  380. package/dist/cli/chunks/pattern-null-store-TMXAYD43.js +0 -2
  381. package/dist/cli/chunks/protocol-executor-BPLR5EJC.js +0 -2
  382. package/dist/cli/chunks/provider-manager-4MMD5QKL.js +0 -2
  383. package/dist/cli/chunks/qe-reasoning-bank-P7KNT3WZ.js +0 -2
  384. package/dist/cli/chunks/queen-coordinator-NBZZ4MGC.js +0 -2
  385. package/dist/cli/chunks/router-2RXR6J2Q.js +0 -2
  386. package/dist/cli/chunks/routing-feedback-AVAA76TK.js +0 -2
  387. package/dist/cli/chunks/rvf-native-adapter-X2YDJA55.js +0 -2
  388. package/dist/cli/chunks/safe-db-4PRU65BK.js +0 -2
  389. package/dist/cli/chunks/schedule-2AST5CHW.js +0 -2
  390. package/dist/cli/chunks/scheduler-SW6II7OU.js +0 -2
  391. package/dist/cli/chunks/sqlite-persistence-OB5NEGAK.js +0 -2
  392. package/dist/cli/chunks/status-handler-HFPWSCBY.js +0 -45
  393. package/dist/cli/chunks/unified-memory-X7OJYGSD.js +0 -2
  394. package/dist/cli/chunks/unified-memory-hnsw-O6HOD5YL.js +0 -2
  395. package/dist/cli/chunks/unified-persistence-C332CER2.js +0 -2
  396. package/dist/cli/chunks/visual-security-MPUG5HPI.js +0 -2
  397. package/dist/cli/chunks/witness-chain-Q4BZHPDF.js +0 -2
  398. package/dist/cli/chunks/workflow-orchestrator-4NDWECYK.js +0 -2
@@ -474,6 +474,24 @@ export class DreamEngine {
474
474
  this.ensureInitialized();
475
475
  return this.graph.loadFromPatterns(patterns);
476
476
  }
477
+ /**
478
+ * Load real ADR-110 pattern-null (failure) data as 'error' concept nodes
479
+ * (A8-EXT) — public wrapper for direct/test use; `ensureConceptsLoaded()`
480
+ * calls this automatically from the real qe_pattern_nulls table.
481
+ */
482
+ async loadFailuresAsConcepts(failures) {
483
+ this.ensureInitialized();
484
+ return this.graph.loadFailuresAsErrors(failures);
485
+ }
486
+ /**
487
+ * Load real qe_pattern_usage success data as 'outcome' concept nodes
488
+ * (A8-EXT) — public wrapper for direct/test use; `ensureConceptsLoaded()`
489
+ * calls this automatically from the real qe_pattern_usage table.
490
+ */
491
+ async loadSuccessesAsConcepts(successes) {
492
+ this.ensureInitialized();
493
+ return this.graph.loadSuccessesAsOutcomes(successes);
494
+ }
477
495
  /**
478
496
  * Ensure sufficient concepts are loaded for dreaming.
479
497
  * If the concept graph has fewer nodes than minConceptsRequired,
@@ -483,17 +501,70 @@ export class DreamEngine {
483
501
  */
484
502
  async ensureConceptsLoaded() {
485
503
  this.ensureInitialized();
504
+ // A8-EXT follow-up fix: this refresh must NOT be gated behind the
505
+ // "do we have enough concepts to dream at all" check below — on any
506
+ // project that's run more than a handful of dream cycles,
507
+ // `existing.length` permanently exceeds `minConceptsRequired`, so the
508
+ // gate would make this whole block unreachable in real, automatic
509
+ // operation forever (only reachable via the direct
510
+ // loadFailuresAsConcepts()/loadSuccessesAsConcepts() test/manual
511
+ // wrappers). Runs on every call instead: loadFailuresAsErrors() /
512
+ // loadSuccessesAsOutcomes() are idempotent (synthetic
513
+ // `error:<id>`/`outcome:<id>` keys), and each query is a single
514
+ // indexed LIMIT-100 read, so refreshing every dream cycle is cheap.
515
+ try {
516
+ const failureRows = this.db.prepare(`SELECT n.id as id, n.pattern_id as sourcePatternId, p.qe_domain as domain, n.failure_mode as failureMode
517
+ FROM qe_pattern_nulls n
518
+ JOIN qe_patterns p ON p.id = n.pattern_id
519
+ ORDER BY n.updated_at DESC
520
+ LIMIT 100`).all();
521
+ if (failureRows.length > 0) {
522
+ await this.graph.loadFailuresAsErrors(failureRows);
523
+ }
524
+ const successRows = this.db.prepare(`SELECT u.id as id, u.pattern_id as sourcePatternId, p.qe_domain as domain,
525
+ ('Pattern "' || p.name || '" applied successfully') as description
526
+ FROM qe_pattern_usage u
527
+ JOIN qe_patterns p ON p.id = u.pattern_id
528
+ WHERE u.success = 1
529
+ ORDER BY u.created_at DESC
530
+ LIMIT 100`).all();
531
+ if (successRows.length > 0) {
532
+ await this.graph.loadSuccessesAsOutcomes(successRows);
533
+ }
534
+ }
535
+ catch (error) {
536
+ if (process.env.DEBUG) {
537
+ dreamLogger.debug('Error/outcome concept loading skipped', { error: toErrorMessage(error) });
538
+ }
539
+ }
486
540
  const existing = await this.graph.getActiveNodes(0);
487
541
  if (existing.length >= this.config.minConceptsRequired) {
488
542
  return 0;
489
543
  }
490
- // Load patterns from qe_patterns table in the shared unified DB
491
- const rows = this.db.prepare(`SELECT id, name, description, qe_domain as domain, pattern_type as patternType,
492
- confidence, success_rate as successRate
493
- FROM qe_patterns
494
- WHERE confidence >= 0.3
495
- ORDER BY quality_score DESC
496
- LIMIT 200`).all();
544
+ // Load patterns from qe_patterns table in the shared unified DB.
545
+ // A8-EXT: the top-160-by-quality pool alone starves detectOptimizations
546
+ // quality_score already weights success_rate at 0.5, so the best-quality
547
+ // patterns are, by construction, rarely the "room for improvement"
548
+ // candidates that detector looks for. Union in a genuine low-performer
549
+ // sample (bottom-40 by success_rate among confidence>=0.3 patterns) so
550
+ // real optimization candidates actually reach the detector.
551
+ const rows = this.db.prepare(`SELECT * FROM (
552
+ SELECT id, name, description, qe_domain as domain, pattern_type as patternType,
553
+ confidence, success_rate as successRate
554
+ FROM qe_patterns
555
+ WHERE confidence >= 0.3
556
+ ORDER BY quality_score DESC
557
+ LIMIT 160
558
+ )
559
+ UNION
560
+ SELECT * FROM (
561
+ SELECT id, name, description, qe_domain as domain, pattern_type as patternType,
562
+ confidence, success_rate as successRate
563
+ FROM qe_patterns
564
+ WHERE confidence >= 0.3 AND success_rate < 0.7
565
+ ORDER BY usage_count DESC
566
+ LIMIT 40
567
+ )`).all();
497
568
  if (rows.length === 0) {
498
569
  return 0;
499
570
  }
@@ -526,9 +597,59 @@ export class DreamEngine {
526
597
  error: 'Insight already applied',
527
598
  };
528
599
  }
529
- // Generate a pattern ID
530
- const patternId = `dream-pattern-${uuidv4()}`;
531
- // Mark insight as applied
600
+ // Create a REAL pattern in QEReasoningBank — this used to mint a fake
601
+ // `dream-pattern-<uuid>` that never resolved to any qe_patterns row.
602
+ // Single implementation shared with the MCP `apply` action (dream.ts)
603
+ // and the scheduler's autoApplyInsights, both of which call this method
604
+ // directly — no duplicate pattern-creation logic to drift out of sync.
605
+ const { getSharedMemoryBackend } = await import('../../mcp/tools/base.js');
606
+ const { createQEReasoningBank } = await import('../qe-reasoning-bank.js');
607
+ const memoryBackend = await getSharedMemoryBackend();
608
+ const reasoningBank = createQEReasoningBank(memoryBackend);
609
+ await reasoningBank.initialize();
610
+ // Wire RVF dual-writer (optional, best-effort — matches the prior
611
+ // MCP-only implementation's parity with other pattern-creation paths).
612
+ try {
613
+ const { getSharedRvfDualWriter } = await import('../../integrations/ruvector/shared-rvf-dual-writer.js');
614
+ const dualWriter = await getSharedRvfDualWriter();
615
+ if (dualWriter)
616
+ reasoningBank.setRvfDualWriter(dualWriter);
617
+ }
618
+ catch (e) {
619
+ if (process.env.DEBUG)
620
+ dreamLogger.debug('RVF wiring skipped', { error: toErrorMessage(e) });
621
+ }
622
+ let sourceConcepts = [];
623
+ try {
624
+ sourceConcepts = safeJsonParse(insightRow.source_concepts);
625
+ }
626
+ catch {
627
+ // Malformed source_concepts shouldn't block pattern creation.
628
+ }
629
+ const patternResult = await reasoningBank.storePattern({
630
+ patternType: mapInsightTypeToPatternType(insightRow.insight_type),
631
+ name: `Dream Insight: ${insightRow.insight_type}`,
632
+ description: `${insightRow.description} (confidence: ${insightRow.confidence_score.toFixed(2)})`,
633
+ template: {
634
+ type: 'workflow',
635
+ content: insightRow.suggested_action || insightRow.description,
636
+ variables: [],
637
+ },
638
+ context: {
639
+ tags: ['dream-generated', insightRow.insight_type, ...sourceConcepts.slice(0, 3)],
640
+ complexity: 'medium',
641
+ },
642
+ });
643
+ if (!patternResult.success) {
644
+ // Do NOT mark applied — leave it retryable rather than silently
645
+ // swallowing a real pattern-creation failure behind a fake success.
646
+ return {
647
+ success: false,
648
+ error: `Failed to create pattern: ${patternResult.error?.message ?? 'unknown error'}`,
649
+ };
650
+ }
651
+ const patternId = patternResult.value.id;
652
+ // Mark insight as applied — pattern_id now points at the REAL row.
532
653
  const stmt = this.db.prepare(`
533
654
  UPDATE dream_insights
534
655
  SET applied = 1, pattern_id = ?
@@ -725,6 +846,21 @@ export class DreamEngine {
725
846
  };
726
847
  }
727
848
  }
849
+ /**
850
+ * Map a dream insight type to the closest QEPatternType. Shared by
851
+ * DreamEngine.applyInsight — the single implementation used by both the
852
+ * MCP `apply` action and the scheduler's auto-apply path.
853
+ */
854
+ function mapInsightTypeToPatternType(insightType) {
855
+ const mapping = {
856
+ 'cross-domain': 'coverage-strategy',
857
+ 'novel-path': 'test-template',
858
+ 'cluster': 'refactor-safe',
859
+ 'high-activation': 'assertion-pattern',
860
+ 'bridge': 'mock-pattern',
861
+ };
862
+ return mapping[insightType] || 'test-template';
863
+ }
728
864
  // ============================================================================
729
865
  // Factory Function
730
866
  // ============================================================================
@@ -48,7 +48,7 @@
48
48
  *
49
49
  * @module learning/dream
50
50
  */
51
- export type { ConceptType, EdgeType, InsightType, DreamCycleStatus, ConceptNode, CreateConceptNodeInput, ConceptEdge, CreateEdgeInput, DreamCycle, DreamInsight, ConceptGraphStats, ConceptGraphConfig, PatternImportData, NeighborResult, DreamEngineConfig, DreamCycleResult, } from './types.js';
51
+ export type { ConceptType, EdgeType, InsightType, DreamCycleStatus, ConceptNode, CreateConceptNodeInput, ConceptEdge, CreateEdgeInput, DreamCycle, DreamInsight, ConceptGraphStats, ConceptGraphConfig, PatternImportData, FailureImportData, SuccessImportData, NeighborResult, DreamEngineConfig, DreamCycleResult, } from './types.js';
52
52
  export { DEFAULT_CONCEPT_GRAPH_CONFIG } from './types.js';
53
53
  export { ConceptGraph, createConceptGraph } from './concept-graph.js';
54
54
  export { SpreadingActivation, type ActivationConfig, type ActivationResult, DEFAULT_ACTIVATION_CONFIG, MAX_ACTIVATION_HISTORY_ENTRIES, MAX_COACTIVATION_ENTRIES, HISTORY_TRIM_TARGET_RATIO, } from './spreading-activation.js';
@@ -227,6 +227,29 @@ export interface PatternImportData {
227
227
  confidence?: number;
228
228
  successRate?: number;
229
229
  }
230
+ /**
231
+ * Real ADR-110 pattern-null (recorded failure) data for importing as
232
+ * 'error' concept nodes — A8-EXT.
233
+ */
234
+ export interface FailureImportData {
235
+ /** qe_pattern_nulls.id — unique, used as the node's synthetic patternId key */
236
+ id: string;
237
+ /** The pattern that failed (NOT used to create an edge — that would trivially satisfy "hasResolution") */
238
+ sourcePatternId: string;
239
+ domain: string;
240
+ failureMode: string;
241
+ }
242
+ /**
243
+ * Real qe_pattern_usage (successful application) data for importing as
244
+ * 'outcome' concept nodes — A8-EXT.
245
+ */
246
+ export interface SuccessImportData {
247
+ /** qe_pattern_usage.id — unique, used as the node's synthetic patternId key */
248
+ id: number;
249
+ sourcePatternId: string;
250
+ domain: string;
251
+ description: string;
252
+ }
230
253
  /**
231
254
  * Neighbor result with node and edge
232
255
  */
@@ -175,7 +175,7 @@ export interface IPatternStore {
175
175
  /** Search for patterns */
176
176
  search(query: string | number[], options?: PatternSearchOptions): Promise<Result<PatternSearchResult[]>>;
177
177
  /** Update pattern after use */
178
- recordUsage(id: string, success: boolean): Promise<Result<void>>;
178
+ recordUsage(id: string, success: boolean, metrics?: Record<string, unknown>, feedback?: string): Promise<Result<void>>;
179
179
  /** Promote pattern from short-term to long-term */
180
180
  promote(id: string): Promise<Result<void>>;
181
181
  /** Delete a pattern */
@@ -315,7 +315,7 @@ export declare class PatternStore implements IPatternStore {
315
315
  /**
316
316
  * Record pattern usage and update stats
317
317
  */
318
- recordUsage(id: string, success: boolean): Promise<Result<void>>;
318
+ recordUsage(id: string, success: boolean, metrics?: Record<string, unknown>, feedback?: string): Promise<Result<void>>;
319
319
  /**
320
320
  * Promote pattern from short-term to long-term storage
321
321
  */
@@ -436,7 +436,18 @@ export class PatternStore {
436
436
  // Persist to SQLite (pattern + embedding atomically)
437
437
  if (this.sqliteStore) {
438
438
  try {
439
- this.sqliteStore.storePattern(pattern, pattern.embedding);
439
+ const actualId = this.sqliteStore.storePattern(pattern, pattern.embedding);
440
+ // #447: ON CONFLICT(name, qe_domain, pattern_type) may preserve an
441
+ // existing row's id instead of the one we generated — realign the
442
+ // in-memory indices (and pattern.id itself) or every later
443
+ // recordUsage()/promote()/delete() call for this pattern throws
444
+ // "Pattern not found" against SQLite while silently succeeding
445
+ // in-memory, permanently desyncing usage stats from qe_pattern_usage.
446
+ if (actualId && actualId !== pattern.id) {
447
+ this.unindexPattern(pattern);
448
+ pattern.id = actualId;
449
+ this.indexPattern(pattern);
450
+ }
440
451
  }
441
452
  catch (error) {
442
453
  console.warn(`[PatternStore] SQLite persist failed for ${pattern.id}:`, toErrorMessage(error));
@@ -987,7 +998,7 @@ export class PatternStore {
987
998
  /**
988
999
  * Record pattern usage and update stats
989
1000
  */
990
- async recordUsage(id, success) {
1001
+ async recordUsage(id, success, metrics, feedback) {
991
1002
  const pattern = await this.get(id);
992
1003
  if (!pattern) {
993
1004
  return err(new Error(`Pattern not found: ${id}`));
@@ -1016,7 +1027,7 @@ export class PatternStore {
1016
1027
  // Persist usage to SQLite
1017
1028
  if (this.sqliteStore) {
1018
1029
  try {
1019
- this.sqliteStore.recordUsage(id, success);
1030
+ this.sqliteStore.recordUsage(id, success, metrics, feedback);
1020
1031
  }
1021
1032
  catch (error) {
1022
1033
  console.warn(`[PatternStore] SQLite recordUsage failed for ${id}:`, toErrorMessage(error));
@@ -343,16 +343,12 @@ export class QEReasoningBank {
343
343
  if (!this.config.enableLearning) {
344
344
  return ok(undefined);
345
345
  }
346
- const result = await this.patternStore.recordUsage(outcome.patternId, outcome.success);
347
- // Persist usage to SQLite (updates qe_patterns row AND inserts qe_pattern_usage)
348
- try {
349
- const store = this.getSqliteStore();
350
- store.recordUsage(outcome.patternId, outcome.success, outcome.metrics, outcome.feedback);
351
- }
352
- catch (persistError) {
353
- // Non-critical — don't fail if persistence fails
354
- logger.warn('SQLite pattern usage persist failed', { error: toErrorMessage(persistError) });
355
- }
346
+ // Single writer (#486 Gap B): patternStore.recordUsage() persists to SQLite
347
+ // itself (updates qe_patterns row AND inserts qe_pattern_usage) when a
348
+ // SQLitePatternStore is wired via setSqliteStore(). A second explicit
349
+ // SQLite write here previously double-counted every outcome — two
350
+ // qe_pattern_usage rows and a +2 usage_count for one recordOutcome() call.
351
+ const result = await this.patternStore.recordUsage(outcome.patternId, outcome.success, outcome.metrics, outcome.feedback);
356
352
  if (result.success) {
357
353
  this.stats.learningOutcomes++;
358
354
  if (outcome.success) {
@@ -608,9 +604,18 @@ export class QEReasoningBank {
608
604
  // DB fallback (#454): in-memory `this.stats` is reset on every process
609
605
  // start, but every hook invocation spawns a fresh node. Without a DB
610
606
  // fallback, `aqe hooks stats` always reports zeros even when historical
611
- // routing_outcomes / qe_pattern_usage rows exist. We use the in-memory
612
- // counters when they're non-zero (live, current-process data), otherwise
613
- // fall back to aggregated DB totals.
607
+ // routing_outcomes / qe_pattern_usage rows exist.
608
+ //
609
+ // routing_outcomes / qe_pattern_usage are written synchronously on every
610
+ // recordOutcome()/routeTask() call, so the DB aggregate is always a
611
+ // superset of (>=) the in-memory counters for this process. Previously
612
+ // this only consulted the DB when the in-memory counter was exactly
613
+ // zero, which made reported totals regress the moment in-memory ticked
614
+ // past zero mid-session — a cold-start call would correctly report the
615
+ // historical DB total, then the very next call after one recordOutcome()
616
+ // would drop to reporting just "1" instead of "historical total + 1".
617
+ // Taking the max keeps the number monotonic while still tolerating a
618
+ // failed/unavailable DB aggregate (falls back to in-memory).
614
619
  let routingRequests = this.stats.routingRequests;
615
620
  let avgRoutingConfidence = this.stats.routingRequests > 0
616
621
  ? this.stats.totalRoutingConfidence / this.stats.routingRequests
@@ -619,27 +624,25 @@ export class QEReasoningBank {
619
624
  let patternSuccessRate = this.stats.learningOutcomes > 0
620
625
  ? this.stats.successfulOutcomes / this.stats.learningOutcomes
621
626
  : 0;
622
- if (routingRequests === 0 || learningOutcomes === 0) {
623
- try {
624
- const agg = this.getSqliteStore().getAggregateOutcomeStats();
625
- if (routingRequests === 0 && agg.routingRequests > 0) {
626
- routingRequests = agg.routingRequests;
627
- avgRoutingConfidence = agg.avgRoutingConfidence;
628
- }
629
- if (learningOutcomes === 0 && agg.learningOutcomes > 0) {
630
- learningOutcomes = agg.learningOutcomes;
631
- // Prefer per-usage success rate (closer to recordOutcome semantics);
632
- // fall back to qe_patterns.success_rate aggregate when no usage rows.
633
- patternSuccessRate =
634
- agg.learningOutcomes > 0
635
- ? agg.successfulOutcomes / agg.learningOutcomes
636
- : agg.avgPatternSuccessRate;
637
- }
627
+ try {
628
+ const agg = this.getSqliteStore().getAggregateOutcomeStats();
629
+ if (agg.routingRequests > routingRequests) {
630
+ routingRequests = agg.routingRequests;
631
+ avgRoutingConfidence = agg.avgRoutingConfidence;
638
632
  }
639
- catch {
640
- // best-effort — never let stats reporting crash the host
633
+ if (agg.learningOutcomes > learningOutcomes) {
634
+ learningOutcomes = agg.learningOutcomes;
635
+ // Prefer per-usage success rate (closer to recordOutcome semantics);
636
+ // fall back to qe_patterns.success_rate aggregate when no usage rows.
637
+ patternSuccessRate =
638
+ agg.learningOutcomes > 0
639
+ ? agg.successfulOutcomes / agg.learningOutcomes
640
+ : agg.avgPatternSuccessRate;
641
641
  }
642
642
  }
643
+ catch {
644
+ // best-effort — never let stats reporting crash the host
645
+ }
643
646
  return {
644
647
  totalPatterns: patternStoreStats.totalPatterns,
645
648
  byDomain,
@@ -20,8 +20,18 @@
20
20
  * permanently dampened in the exact deployment case ADR-095 was meant
21
21
  * to help.
22
22
  *
23
- * Treat empty/uninitialized graph as "no signal" (full ε rate). Only
24
- * consult `isCritical()` when the graph has actual vertices.
23
+ * A16 correction (2026-07-06): `graph.isEmpty()` alone doesn't catch
24
+ * this `QueenMinCutBridge` always seeds ~14 `domain:*` scaffold
25
+ * vertices + workflow edges on init, so `isEmpty()` is false as soon as
26
+ * Queen starts, even with zero real agents ever spawned. The mincut
27
+ * over those scaffold-only edges (one-directional, `defect-intelligence`
28
+ * a pure sink) computes to exactly 0.0 — still degenerate, still
29
+ * "critical" by the threshold check. Check for real `agent:*` vertices
30
+ * specifically (same fix `QueenMinCutBridge.isEmptyTopology()` already
31
+ * applies internally), not raw vertex count.
32
+ *
33
+ * Treat a graph with no real agent vertices as "no signal" (full ε rate).
34
+ * Only consult `isCritical()` once at least one agent has actually spawned.
25
35
  */
26
36
  /**
27
37
  * Returns true ONLY when:
@@ -20,8 +20,18 @@
20
20
  * permanently dampened in the exact deployment case ADR-095 was meant
21
21
  * to help.
22
22
  *
23
- * Treat empty/uninitialized graph as "no signal" (full ε rate). Only
24
- * consult `isCritical()` when the graph has actual vertices.
23
+ * A16 correction (2026-07-06): `graph.isEmpty()` alone doesn't catch
24
+ * this `QueenMinCutBridge` always seeds ~14 `domain:*` scaffold
25
+ * vertices + workflow edges on init, so `isEmpty()` is false as soon as
26
+ * Queen starts, even with zero real agents ever spawned. The mincut
27
+ * over those scaffold-only edges (one-directional, `defect-intelligence`
28
+ * a pure sink) computes to exactly 0.0 — still degenerate, still
29
+ * "critical" by the threshold check. Check for real `agent:*` vertices
30
+ * specifically (same fix `QueenMinCutBridge.isEmptyTopology()` already
31
+ * applies internally), not raw vertex count.
32
+ *
33
+ * Treat a graph with no real agent vertices as "no signal" (full ε rate).
34
+ * Only consult `isCritical()` once at least one agent has actually spawned.
25
35
  */
26
36
  import { getSharedMinCutGraph, getSharedMinCutMonitor, isSharedMinCutGraphInitialized, isSharedMinCutMonitorInitialized, } from '../coordination/mincut/shared-singleton.js';
27
37
  /**
@@ -44,7 +54,9 @@ export function resolveTopologyCriticalFromSharedMincut() {
44
54
  if (!isSharedMinCutGraphInitialized())
45
55
  return false;
46
56
  const graph = getSharedMinCutGraph();
47
- if (graph.isEmpty())
57
+ // Domain-coordinator scaffold vertices/edges are always present once
58
+ // Queen initializes; they don't count as "the graph has real signal".
59
+ if (graph.getVerticesByType('agent').length === 0)
48
60
  return false;
49
61
  return getSharedMinCutMonitor().isCritical();
50
62
  }
@@ -63,7 +63,7 @@ export declare class RvfPatternStore implements IPatternStore {
63
63
  create(options: CreateQEPatternOptions): Promise<Result<QEPattern>>;
64
64
  get(id: string): Promise<QEPattern | null>;
65
65
  search(query: string | number[], options?: PatternSearchOptions): Promise<Result<PatternSearchResult[]>>;
66
- recordUsage(id: string, success: boolean): Promise<Result<void>>;
66
+ recordUsage(id: string, success: boolean, metrics?: Record<string, unknown>, feedback?: string): Promise<Result<void>>;
67
67
  promote(id: string): Promise<Result<void>>;
68
68
  delete(id: string): Promise<Result<void>>;
69
69
  getStats(): Promise<PatternStoreStats>;
@@ -372,12 +372,12 @@ export class RvfPatternStore {
372
372
  // --------------------------------------------------------------------------
373
373
  // IPatternStore — Mutation operations
374
374
  // --------------------------------------------------------------------------
375
- async recordUsage(id, success) {
375
+ async recordUsage(id, success, metrics, feedback) {
376
376
  if (!this.sqliteStore) {
377
377
  return err(new Error('No SQLite store attached'));
378
378
  }
379
379
  try {
380
- this.sqliteStore.recordUsage(id, success);
380
+ this.sqliteStore.recordUsage(id, success, metrics, feedback);
381
381
  return ok(undefined);
382
382
  }
383
383
  catch (error) {
@@ -419,18 +419,31 @@ export class RvfPatternStore {
419
419
  }
420
420
  async getStats() {
421
421
  const rvfStatus = this.adapter?.status();
422
- // Get pattern count from RVF if available, otherwise fall back to SQLite
423
- let totalPatterns = rvfStatus?.totalVectors ?? 0;
424
- if (totalPatterns === 0 && this.sqliteStore) {
422
+ // qe_patterns (SQLite) is the source of truth for pattern count and
423
+ // domain/tier breakdown the RVF vector index only covers patterns
424
+ // that have actually been embedded, and is reported separately via
425
+ // hnswStats.vectorCount. Previously this used RVF's totalVectors as the
426
+ // headline count, which silently hid any pattern stored without a
427
+ // matching embedding (#553).
428
+ let totalPatterns = 0;
429
+ let byDomain = {};
430
+ let byTier = { shortTerm: 0, longTerm: 0 };
431
+ if (this.sqliteStore) {
425
432
  try {
426
- totalPatterns = this.sqliteStore.getStats().totalPatterns;
433
+ const sqliteStats = this.sqliteStore.getStats();
434
+ totalPatterns = sqliteStats.totalPatterns;
435
+ byDomain = sqliteStats.byDomain;
436
+ byTier = {
437
+ shortTerm: sqliteStats.byTier['short-term'] ?? 0,
438
+ longTerm: sqliteStats.byTier['long-term'] ?? 0,
439
+ };
427
440
  }
428
441
  catch { /* best effort */ }
429
442
  }
430
443
  return {
431
444
  totalPatterns,
432
- byTier: { shortTerm: 0, longTerm: 0 },
433
- byDomain: {},
445
+ byTier,
446
+ byDomain,
434
447
  byType: {},
435
448
  avgConfidence: 0,
436
449
  avgQualityScore: 0,
@@ -391,24 +391,27 @@ export class SQLitePatternStore {
391
391
  if (!insertPattern || !insertEmbedding) {
392
392
  throw new Error('Prepared statements not ready');
393
393
  }
394
+ let actualId = id;
394
395
  // Use transaction for atomicity
395
396
  const transaction = this.db.transaction(() => {
396
397
  insertPattern.run(id, pattern.patternType, pattern.qeDomain, pattern.domain, pattern.name, pattern.description || '', pattern.confidence, pattern.tier || 'short-term', JSON.stringify(pattern.template), JSON.stringify(pattern.context));
398
+ // #447: ON CONFLICT(name, qe_domain, pattern_type) preserves the
399
+ // existing row's id instead of `id`. Resolve the actual id BEFORE
400
+ // inserting the embedding — qe_pattern_embeddings.pattern_id has a
401
+ // FOREIGN KEY on qe_patterns(id), so inserting under the discarded
402
+ // `id` (no such row) throws "FOREIGN KEY constraint failed".
403
+ const actualRow = this.db
404
+ .prepare('SELECT id FROM qe_patterns WHERE name = ? AND qe_domain = ? AND pattern_type = ?')
405
+ .get(pattern.name, pattern.qeDomain ?? '', pattern.patternType ?? '');
406
+ actualId = actualRow ? actualRow.id : id;
397
407
  if (embedding) {
398
408
  // Store embedding as BLOB (Float32Array)
399
409
  const buffer = Buffer.from(new Float32Array(embedding).buffer);
400
- insertEmbedding.run(id, buffer, embedding.length, 'all-MiniLM-L6-v2');
410
+ insertEmbedding.run(actualId, buffer, embedding.length, 'all-MiniLM-L6-v2');
401
411
  }
402
412
  });
403
413
  transaction();
404
- // #447: ON CONFLICT(name, qe_domain, pattern_type) preserves the existing
405
- // row's id, so the new `id` we just tried to insert may not be what's
406
- // actually stored. SELECT the actual id back so callers (rvf-pattern-store,
407
- // qe-hooks) can stay consistent with HNSW and downstream usage tables.
408
- const actualRow = this.db
409
- .prepare('SELECT id FROM qe_patterns WHERE name = ? AND qe_domain = ? AND pattern_type = ?')
410
- .get(pattern.name, pattern.qeDomain ?? '', pattern.patternType ?? '');
411
- return actualRow ? actualRow.id : id;
414
+ return actualId;
412
415
  }
413
416
  /**
414
417
  * Get a pattern by ID