agentic-qe 3.10.1 → 3.10.3

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 (412) hide show
  1. package/.claude/hooks/README.txt +17 -0
  2. package/.claude/hooks/aqe-hook.cjs +98 -0
  3. package/.claude/hooks/cross-phase-memory.yaml +296 -0
  4. package/.claude/hooks/post-task-sync.sh +113 -0
  5. package/.claude/hooks/v3-domain-workers.json +121 -0
  6. package/.claude/skills/release/SKILL.md +10 -10
  7. package/.claude/skills/skills-manifest.json +1 -1
  8. package/CHANGELOG.md +131 -0
  9. package/assets/grammars/tree-sitter-c_sharp.wasm +0 -0
  10. package/assets/grammars/tree-sitter-java.wasm +0 -0
  11. package/assets/grammars/tree-sitter-javascript.wasm +0 -0
  12. package/assets/grammars/tree-sitter-python.wasm +0 -0
  13. package/assets/grammars/tree-sitter-rust.wasm +0 -0
  14. package/assets/grammars/tree-sitter-swift.wasm +0 -0
  15. package/assets/grammars/tree-sitter-tsx.wasm +0 -0
  16. package/assets/grammars/tree-sitter-typescript.wasm +0 -0
  17. package/assets/skills/skills-manifest.json +1 -1
  18. package/dist/agents/claim-verifier/claim-verifier-service.js +4 -2
  19. package/dist/agents/claim-verifier/verifiers/test-verifier.js +31 -23
  20. package/dist/agents/devils-advocate/agent.js +1 -1
  21. package/dist/cli/bundle.js +5 -5
  22. package/dist/cli/chunks/adapter-BHPUKMJ5.js +2 -0
  23. package/dist/cli/chunks/{agent-booster-wasm-FZLWOPSX.js → agent-booster-wasm-NGC6LSQP.js} +2 -2
  24. package/dist/cli/chunks/{agent-handler-KAGRVCKS.js → agent-handler-P2IJE4GK.js} +2 -2
  25. package/dist/cli/chunks/{agent-memory-branch-JJKFEXQW.js → agent-memory-branch-JXRJ5GKQ.js} +2 -2
  26. package/dist/cli/chunks/aqe-learning-engine-JQ5WD2HM.js +2 -0
  27. package/dist/cli/chunks/{audit-DN5SY4JJ.js → audit-BMQ3VESB.js} +2 -2
  28. package/dist/cli/chunks/base-E32WLGY2.js +2 -0
  29. package/dist/cli/chunks/{hnswlib-node-YX6OOBN6.js → better-sqlite3-HP4JZS6K.js} +2 -2
  30. package/dist/cli/chunks/{brain-handler-O7MP5BGY.js → brain-handler-SACNDFSW.js} +3 -3
  31. package/dist/cli/chunks/{branch-enumerator-ZPTN5J6V.js → branch-enumerator-LFOTVUDA.js} +2 -2
  32. package/dist/cli/chunks/{browser-PAZE2JSD.js → browser-FK7PRF3W.js} +2 -2
  33. package/dist/cli/chunks/browser-workflow-LNNXXAJG.js +2 -0
  34. package/dist/cli/chunks/{chunk-BF7MUYWC.js → chunk-2EQVYYBF.js} +2 -2
  35. package/dist/cli/chunks/{chunk-BGBSYF3K.js → chunk-2L73WXA4.js} +2 -2
  36. package/dist/cli/chunks/{chunk-W2DT3CDE.js → chunk-2ULVCLOW.js} +2 -2
  37. package/dist/cli/chunks/{chunk-FJSR2U65.js → chunk-3HBWDG62.js} +2 -2
  38. package/dist/cli/chunks/{chunk-WPNZSL4S.js → chunk-3JAOFKEU.js} +2 -2
  39. package/dist/cli/chunks/{chunk-2TDWCXZ6.js → chunk-3LRK7PYN.js} +2 -2
  40. package/dist/cli/chunks/{chunk-MVGVD6LS.js → chunk-3RZL4QTT.js} +2 -2
  41. package/dist/cli/chunks/chunk-3VF3HCG4.js +2 -0
  42. package/dist/cli/chunks/{chunk-6E7GI2UB.js → chunk-3X2ZQ55B.js} +4 -4
  43. package/dist/cli/chunks/{chunk-6QFONVEE.js → chunk-4CYLSXA6.js} +2 -2
  44. package/dist/cli/chunks/{chunk-VOIWDPIU.js → chunk-4OUAHZX2.js} +2 -2
  45. package/dist/cli/chunks/{chunk-EIROAH6N.js → chunk-4QFAUSWQ.js} +2 -2
  46. package/dist/cli/chunks/{chunk-ZEMXMDD3.js → chunk-5ER3COX3.js} +2 -2
  47. package/dist/cli/chunks/{chunk-ECPB7IAH.js → chunk-5EWWA4QP.js} +4 -4
  48. package/dist/cli/chunks/{chunk-AUVC3DDB.js → chunk-5G5AAEFF.js} +2 -2
  49. package/dist/cli/chunks/{chunk-RRLQFFCO.js → chunk-5IBJURYB.js} +3 -3
  50. package/dist/cli/chunks/chunk-5LON3MLI.js +2 -0
  51. package/dist/cli/chunks/{chunk-WMG5F6R6.js → chunk-5SGEOO2F.js} +2 -2
  52. package/dist/cli/chunks/{chunk-SQBB2DC6.js → chunk-6B4S7PKP.js} +3 -3
  53. package/dist/cli/chunks/{chunk-H44WD7QX.js → chunk-6FL3GN4T.js} +2 -2
  54. package/dist/cli/chunks/{chunk-7MSYTHZM.js → chunk-6GCOIIHY.js} +2 -2
  55. package/dist/cli/chunks/{chunk-KKNBYXYA.js → chunk-6Q2PPOOF.js} +1 -1
  56. package/dist/cli/chunks/{chunk-K4T3RDCB.js → chunk-6ZK24V2Y.js} +2 -2
  57. package/dist/cli/chunks/{chunk-G3BQU3Q6.js → chunk-72LE6PHL.js} +3 -3
  58. package/dist/cli/chunks/{chunk-F3OVFA6W.js → chunk-7RMZAVGO.js} +2 -2
  59. package/dist/cli/chunks/{chunk-YYWIA5FX.js → chunk-7SEHQTYD.js} +1 -1
  60. package/dist/cli/chunks/{chunk-UU2Q6XWF.js → chunk-7YYTTWGY.js} +1 -1
  61. package/dist/cli/chunks/{chunk-XKOKMS5A.js → chunk-7ZSPCGTI.js} +2 -2
  62. package/dist/cli/chunks/{chunk-RWYW573C.js → chunk-ADV4DH3W.js} +5 -5
  63. package/dist/cli/chunks/{chunk-OC3OJWLB.js → chunk-AEJVOJPT.js} +2 -2
  64. package/dist/cli/chunks/{chunk-2UN4DOBJ.js → chunk-B5MMDMH6.js} +2 -2
  65. package/dist/cli/chunks/{chunk-WQEZKAUR.js → chunk-BO2OV2RH.js} +2 -2
  66. package/dist/cli/chunks/{chunk-NPSBMDVU.js → chunk-BT3QLWII.js} +2 -2
  67. package/dist/cli/chunks/{chunk-6VQ5MFJ6.js → chunk-BWP3UVPE.js} +7 -7
  68. package/dist/cli/chunks/{chunk-SLNGJW4G.js → chunk-C6BBRM2J.js} +1 -1
  69. package/dist/cli/chunks/{chunk-4AWJ5PE4.js → chunk-CAMEFWRK.js} +1 -1
  70. package/dist/cli/chunks/{chunk-BECU52UY.js → chunk-CNEWYJKT.js} +4 -4
  71. package/dist/cli/chunks/{chunk-EO4B5GS4.js → chunk-CTDO2UB2.js} +1 -1
  72. package/dist/cli/chunks/{chunk-GTGONWGX.js → chunk-D2FBUOAR.js} +1 -1
  73. package/dist/cli/chunks/{chunk-OQP5OFRR.js → chunk-DF3MJ2YL.js} +1 -1
  74. package/dist/cli/chunks/{chunk-KEC5FBAW.js → chunk-DY5KEOHX.js} +1 -1
  75. package/dist/cli/chunks/{chunk-EBQ6YKP2.js → chunk-E2BJT6A7.js} +3 -3
  76. package/dist/cli/chunks/{chunk-WDTCCPK4.js → chunk-EETVN2OJ.js} +1 -1
  77. package/dist/cli/chunks/{chunk-UDVX34ZG.js → chunk-ERYMAYJW.js} +20 -17
  78. package/dist/cli/chunks/{chunk-ELUERFGA.js → chunk-FJGSEPFL.js} +2 -2
  79. package/dist/cli/chunks/{chunk-BN7ERYXI.js → chunk-FLTPHVZ3.js} +1 -1
  80. package/dist/cli/chunks/{chunk-OVENSL64.js → chunk-FND6V2RV.js} +22 -22
  81. package/dist/cli/chunks/{chunk-5ZCVMR5E.js → chunk-FU77CDEM.js} +2 -2
  82. package/dist/cli/chunks/{chunk-VKRMVTWU.js → chunk-GELF4ILR.js} +37 -37
  83. package/dist/cli/chunks/{chunk-H22MMMYY.js → chunk-GHNNJHH3.js} +2 -2
  84. package/dist/cli/chunks/{chunk-32R7EA7B.js → chunk-GJUGSH7T.js} +3 -3
  85. package/dist/cli/chunks/{chunk-HPNEZ7YN.js → chunk-GL3HZN3O.js} +1 -1
  86. package/dist/cli/chunks/{chunk-WL2J6ECN.js → chunk-H56AROF2.js} +2 -2
  87. package/dist/cli/chunks/{chunk-GTRXZJNX.js → chunk-HAO3SPOE.js} +2 -2
  88. package/dist/cli/chunks/{chunk-PUXDXIUE.js → chunk-HM523MTQ.js} +1 -1
  89. package/dist/cli/chunks/{chunk-KRXKU54J.js → chunk-HMFEPKAR.js} +2 -2
  90. package/dist/cli/chunks/{chunk-3YOPJ7DY.js → chunk-HQJMCTWN.js} +2 -2
  91. package/dist/cli/chunks/{chunk-LF7URN2X.js → chunk-HRLXU4LH.js} +2 -2
  92. package/dist/cli/chunks/{chunk-TL5F2S3Z.js → chunk-HWM2XJ3P.js} +24 -24
  93. package/dist/cli/chunks/{chunk-6A2NIR2E.js → chunk-I42R57ON.js} +2 -2
  94. package/dist/cli/chunks/chunk-IL2KOW5W.js +2 -0
  95. package/dist/cli/chunks/{chunk-CR4ERDS2.js → chunk-IRR7YA3Q.js} +2 -2
  96. package/dist/cli/chunks/{chunk-Y2DPXMOR.js → chunk-JD2PG4KS.js} +1 -1
  97. package/dist/cli/chunks/{chunk-TFNLXAK5.js → chunk-JE3C7JYN.js} +1 -1
  98. package/dist/cli/chunks/{chunk-ZTMWJQTZ.js → chunk-JLL27IGU.js} +2 -2
  99. package/dist/cli/chunks/{chunk-YPOTBXPU.js → chunk-JOLDCS6X.js} +2 -2
  100. package/dist/cli/chunks/chunk-JP63XACW.js +62 -0
  101. package/dist/cli/chunks/{chunk-AABKTWXC.js → chunk-JSFYPLMQ.js} +2 -2
  102. package/dist/cli/chunks/{chunk-KCTH5MHE.js → chunk-JTF6D2RJ.js} +4 -4
  103. package/dist/cli/chunks/{chunk-GRG3OP34.js → chunk-JTZ3Q2QS.js} +2 -2
  104. package/dist/cli/chunks/chunk-JXIPRMAY.js +95 -0
  105. package/dist/cli/chunks/{chunk-TNGGVMPQ.js → chunk-KG5SM36Y.js} +1 -1
  106. package/dist/cli/chunks/{chunk-QNW335PD.js → chunk-KTRB3L53.js} +2 -2
  107. package/dist/cli/chunks/{chunk-XRK7FBTY.js → chunk-L74CHKFR.js} +2 -2
  108. package/dist/cli/chunks/{chunk-IHDUWPFY.js → chunk-LZ6TNTGO.js} +2 -2
  109. package/dist/cli/chunks/{chunk-Y357YFLF.js → chunk-M5CDW2ZH.js} +2 -2
  110. package/dist/cli/chunks/{chunk-GRYXNWPF.js → chunk-MBSJ5G4I.js} +12 -12
  111. package/dist/cli/chunks/{chunk-IPRDHKSI.js → chunk-MC7K44M4.js} +2 -2
  112. package/dist/cli/chunks/{chunk-TP77PNN6.js → chunk-MQOFFRTA.js} +2 -2
  113. package/dist/cli/chunks/{chunk-JLKHPIQF.js → chunk-N7IBYDW5.js} +1 -1
  114. package/dist/cli/chunks/{chunk-G5DTENO3.js → chunk-NEYYLAYS.js} +5 -5
  115. package/dist/cli/chunks/{chunk-TNVYKYTO.js → chunk-NNVXHC74.js} +3 -3
  116. package/dist/cli/chunks/{chunk-HRDGN3OK.js → chunk-NNZMEYLT.js} +1 -1
  117. package/dist/cli/chunks/{chunk-25QGPRWN.js → chunk-NRCL3WCP.js} +2 -2
  118. package/dist/cli/chunks/{chunk-NRLT44YB.js → chunk-NXPFGPHV.js} +1 -1
  119. package/dist/cli/chunks/{chunk-PXFQSVA2.js → chunk-NZHOKLII.js} +3 -3
  120. package/dist/cli/chunks/{chunk-7SQD2TTQ.js → chunk-OG7CWWFR.js} +1 -1
  121. package/dist/cli/chunks/{chunk-XGUQYVJR.js → chunk-OPDTDKN3.js} +2 -2
  122. package/dist/cli/chunks/{chunk-2KTRRSKD.js → chunk-OX4R55T3.js} +2 -2
  123. package/dist/cli/chunks/{chunk-COZDJLIL.js → chunk-PFCAMX6H.js} +1 -1
  124. package/dist/cli/chunks/{chunk-UDFLR7GR.js → chunk-PL5SLO2W.js} +1 -1
  125. package/dist/cli/chunks/{chunk-6ZRMQXVL.js → chunk-PZHZPX3O.js} +4 -4
  126. package/dist/cli/chunks/{chunk-57NJQV57.js → chunk-Q7EBD24B.js} +1 -1
  127. package/dist/cli/chunks/{chunk-6D57DWQ6.js → chunk-QEODION5.js} +2 -2
  128. package/dist/cli/chunks/{chunk-K22TPWOJ.js → chunk-QM65UGPV.js} +2 -2
  129. package/dist/cli/chunks/{chunk-2ETDES5W.js → chunk-QWG76RHA.js} +2 -2
  130. package/dist/cli/chunks/{chunk-GXJ4BCGC.js → chunk-R5ONQAQL.js} +2 -2
  131. package/dist/cli/chunks/{chunk-KZJXVIAW.js → chunk-RNF47IJ5.js} +4 -4
  132. package/dist/cli/chunks/{chunk-IK6AJX3C.js → chunk-RTDHWOAG.js} +1 -1
  133. package/dist/cli/chunks/{chunk-NQZYUH6S.js → chunk-RZCAA2PZ.js} +1 -1
  134. package/dist/cli/chunks/{chunk-DQIS6J77.js → chunk-SL6YZAT4.js} +2 -2
  135. package/dist/cli/chunks/{chunk-RPL6K623.js → chunk-SNTMAVPH.js} +5 -5
  136. package/dist/cli/chunks/{chunk-MQYTW2IN.js → chunk-SWOG3PBD.js} +2 -2
  137. package/dist/cli/chunks/{chunk-DMIYWPQQ.js → chunk-T63EK6GH.js} +2 -2
  138. package/dist/cli/chunks/chunk-U6UK3UMX.js +59 -0
  139. package/dist/cli/chunks/{chunk-2S4XHK26.js → chunk-U7NMPZE2.js} +2 -2
  140. package/dist/cli/chunks/{chunk-WS4XVJHI.js → chunk-UDV4YB42.js} +1 -1
  141. package/dist/cli/chunks/{chunk-P7T5Y735.js → chunk-UHDBM7QS.js} +2 -2
  142. package/dist/cli/chunks/{chunk-5EU2VQK3.js → chunk-UIJFU4KD.js} +2 -2
  143. package/dist/cli/chunks/{chunk-Q24OJX44.js → chunk-USFZ4IJD.js} +2 -2
  144. package/dist/cli/chunks/{chunk-Q5VHBI4U.js → chunk-UZL366ZI.js} +1 -1
  145. package/dist/cli/chunks/{chunk-GMKGLZJU.js → chunk-VDTFRMES.js} +2 -2
  146. package/dist/cli/chunks/{chunk-EUJHHXE6.js → chunk-VIWIO27R.js} +3 -3
  147. package/dist/cli/chunks/{chunk-PLRSKAFZ.js → chunk-VRXY4T22.js} +2 -2
  148. package/dist/cli/chunks/{chunk-NDCPEXDN.js → chunk-WPVCSFDA.js} +2 -2
  149. package/dist/cli/chunks/{chunk-TX7SNQKL.js → chunk-WWD5IWTV.js} +1 -1
  150. package/dist/cli/chunks/{chunk-T3UXMPXX.js → chunk-X2B7SANM.js} +1 -1
  151. package/dist/cli/chunks/{chunk-7CKVAYP3.js → chunk-X3RJ6SFC.js} +1 -1
  152. package/dist/cli/chunks/{chunk-6LRCMFLV.js → chunk-XTP2GHI7.js} +2 -2
  153. package/dist/cli/chunks/{chunk-W6ZF2CPN.js → chunk-YDDZJCKY.js} +1 -1
  154. package/dist/cli/chunks/{chunk-5KFCH7RH.js → chunk-YDKYLNKZ.js} +1 -1
  155. package/dist/cli/chunks/{chunk-ELZ67OHQ.js → chunk-YIYV2JB6.js} +2 -2
  156. package/dist/cli/chunks/{chunk-PW6MOFXG.js → chunk-YX2HY4MX.js} +2 -2
  157. package/dist/cli/chunks/{chunk-DVOH75S4.js → chunk-YXH2CVAF.js} +1 -1
  158. package/dist/cli/chunks/{chunk-IITKJCPK.js → chunk-YYAPO3CU.js} +3 -3
  159. package/dist/cli/chunks/{chunk-5OTYBWRL.js → chunk-Z2K5IZM6.js} +2 -2
  160. package/dist/cli/chunks/{chunk-NOCYYXK4.js → chunk-ZG4P3DTL.js} +2 -2
  161. package/dist/cli/chunks/{chunk-YGRTMAWB.js → chunk-ZXQNE4QV.js} +1 -1
  162. package/dist/cli/chunks/{ci-EHRUN7O6.js → ci-AWZ3S5OT.js} +6 -6
  163. package/dist/cli/chunks/{ci-output-EXDXVXKB.js → ci-output-JLCYTIMT.js} +2 -2
  164. package/dist/cli/chunks/{circuit-breaker-LM4QRAAL.js → circuit-breaker-BJDKBDIL.js} +2 -2
  165. package/dist/cli/chunks/{claude-flow-setup-ZHUCZVW7.js → claude-flow-setup-KKOP5ZMO.js} +2 -2
  166. package/dist/cli/chunks/client-2UKBYFX4.js +2 -0
  167. package/dist/cli/chunks/{cline-installer-WMFLQOW2.js → cline-installer-7M525SEA.js} +2 -2
  168. package/dist/cli/chunks/{code-L7KRLU5E.js → code-27SUVJDO.js} +20 -19
  169. package/dist/cli/chunks/{code-index-extractor-FTMUYQC6.js → code-index-extractor-TTQQZLAK.js} +2 -2
  170. package/dist/cli/chunks/{codex-installer-B3F6WI3Z.js → codex-installer-GHNGNPKP.js} +2 -2
  171. package/dist/cli/chunks/{completions-3JZQRNB6.js → completions-JPJD24DG.js} +2 -2
  172. package/dist/cli/chunks/{complexity-analyzer-LB2FFEKX.js → complexity-analyzer-Q74EJV33.js} +2 -2
  173. package/dist/cli/chunks/{continuedev-installer-WH6IMV7R.js → continuedev-installer-ULTRDIML.js} +2 -2
  174. package/dist/cli/chunks/{copilot-installer-NOIEOFJM.js → copilot-installer-EK52X4CG.js} +2 -2
  175. package/dist/cli/chunks/{cost-tracker-IKX2VYSA.js → cost-tracker-2GKBRYXL.js} +2 -2
  176. package/dist/cli/chunks/{coverage-TD37CYSY.js → coverage-YCLC3W2A.js} +3 -3
  177. package/dist/cli/chunks/cross-domain-router-FPM3L27L.js +2 -0
  178. package/dist/cli/chunks/{cursor-installer-4NSVGRM5.js → cursor-installer-B3ALFW5E.js} +2 -2
  179. package/dist/cli/chunks/{daemon-UWEBUIDT.js → daemon-YWINEHG4.js} +4 -4
  180. package/dist/cli/chunks/{daemon-LYDV7NRW.js → daemon-ZKEBVLJA.js} +3 -3
  181. package/dist/cli/chunks/{dag-attention-scheduler-NECJGCHC.js → dag-attention-scheduler-OQPJ6ULA.js} +2 -2
  182. package/dist/cli/chunks/{detect-4XGC7ILO.js → detect-YMYIQH3Q.js} +2 -2
  183. package/dist/cli/chunks/{dist-node-GGJDXRKJ.js → dist-node-R4FAYQRY.js} +2 -2
  184. package/dist/cli/chunks/{domain-handler-UOFONAUT.js → domain-handler-IGWXLF2S.js} +2 -2
  185. package/dist/cli/chunks/{domain-transfer-6JLNOYPA.js → domain-transfer-A7YNO76C.js} +2 -2
  186. package/dist/cli/chunks/dream-XM33US3V.js +2 -0
  187. package/dist/cli/chunks/{embed-and-insert-pattern-ZM75DQ4J.js → embed-and-insert-pattern-KODZAS7Y.js} +2 -2
  188. package/dist/cli/chunks/{eval-CYZJTHEB.js → eval-ALQW7Q2S.js} +3 -3
  189. package/dist/cli/chunks/{experience-capture-middleware-RBOJLDUB.js → experience-capture-middleware-3WK4RXWK.js} +3 -3
  190. package/dist/cli/chunks/{fast-paths-S5BWZR3L.js → fast-paths-PQWDFIJZ.js} +2 -2
  191. package/dist/cli/chunks/{feature-flags-DUNQPDU3.js → feature-flags-6X33B3WX.js} +2 -2
  192. package/dist/cli/chunks/{feature-flags-6E7H3NYP.js → feature-flags-JRUAZCND.js} +2 -2
  193. package/dist/cli/chunks/{file-discovery-PFFKDGYG.js → file-discovery-SA3YU3IH.js} +2 -2
  194. package/dist/cli/chunks/{fleet-RCDZZFXN.js → fleet-7TXCAOKQ.js} +3 -3
  195. package/dist/cli/chunks/{gnn-wrapper-5AG3WDWF.js → gnn-wrapper-ZKNYACEC.js} +2 -2
  196. package/dist/cli/chunks/{heartbeat-handler-O2KAEX4Y.js → heartbeat-handler-KRZRZ23F.js} +4 -4
  197. package/dist/cli/chunks/heartbeat-scheduler-GM3M2MTG.js +2 -0
  198. package/dist/cli/chunks/hnsw-adapter-K62GEHIL.js +2 -0
  199. package/dist/cli/chunks/hnsw-index-VCAK3TWN.js +2 -0
  200. package/dist/cli/chunks/{hnsw-legacy-bridge-C7FG6YGW.js → hnsw-legacy-bridge-LVHQ5SG7.js} +2 -2
  201. package/dist/cli/chunks/{better-sqlite3-XGPW4HK5.js → hnswlib-node-64EGGWIC.js} +2 -2
  202. package/dist/cli/chunks/{hooks-FUHNE2P7.js → hooks-6Y3UHYI2.js} +14 -14
  203. package/dist/cli/chunks/hybrid-router-432QNCNG.js +2 -0
  204. package/dist/cli/chunks/{hypergraph-engine-LQRYBNPV.js → hypergraph-engine-2EZBZMFK.js} +2 -2
  205. package/dist/cli/chunks/{hypergraph-handler-AFFNLZVD.js → hypergraph-handler-GLPWYII2.js} +3 -3
  206. package/dist/cli/chunks/impact-analyzer-VTSISNN4.js +2 -0
  207. package/dist/cli/chunks/{init-handler-BQ6IDBX4.js → init-handler-ZSDO5VMA.js} +6 -6
  208. package/dist/cli/chunks/init-wizard-COB5AH7Q.js +2 -0
  209. package/dist/cli/chunks/kernel-ROK7X5FM.js +2 -0
  210. package/dist/cli/chunks/{kilocode-installer-KS72HUSG.js → kilocode-installer-ATYSDWIV.js} +2 -2
  211. package/dist/cli/chunks/{kiro-installer-2ZEFLGRX.js → kiro-installer-K66YT6PC.js} +2 -2
  212. package/dist/cli/chunks/knowledge-graph-YUWIDIWW.js +2 -0
  213. package/dist/cli/chunks/{learning-GGHGJ6B6.js → learning-BVYCC4RI.js} +3 -3
  214. package/dist/cli/chunks/{llm-router-LP6K5BJF.js → llm-router-VBCXE6DN.js} +12 -12
  215. package/dist/cli/chunks/llm-router-service-7VLXJ7VE.js +2 -0
  216. package/dist/cli/chunks/{load-2MLKXOT2.js → load-AREDQE2U.js} +2 -2
  217. package/dist/cli/chunks/load-test-32524DL3.js +2 -0
  218. package/dist/cli/chunks/{mcp-CDJBJG5H.js → mcp-NG6H6UC5.js} +2 -2
  219. package/dist/cli/chunks/{memory-4LAX7JZS.js → memory-Y65EHG6N.js} +5 -5
  220. package/dist/cli/chunks/memory-backend-BI2V5AAB.js +2 -0
  221. package/dist/cli/chunks/memory-handlers-NSOFWVFN.js +2 -0
  222. package/dist/cli/chunks/{multi-model-executor-SLJV73HE.js → multi-model-executor-VRPRFUZT.js} +2 -2
  223. package/dist/cli/chunks/{opencode-installer-M76SONWV.js → opencode-installer-CKQXPM5R.js} +3 -3
  224. package/dist/cli/chunks/{orchestrator-TJPUDJMP.js → orchestrator-I7JBKD6G.js} +19 -19
  225. package/dist/cli/chunks/{pipeline-2PVNFT6J.js → pipeline-MV2RWCBI.js} +2 -2
  226. package/dist/cli/chunks/{platform-KCSEDKEE.js → platform-VU5P3SOG.js} +2 -2
  227. package/dist/cli/chunks/{plugin-QX47QF5U.js → plugin-6TERLKCB.js} +2 -2
  228. package/dist/cli/chunks/{prime-radiant-advanced-wasm-L6VWL7VR.js → prime-radiant-advanced-wasm-WIUIN2DL.js} +2 -2
  229. package/dist/cli/chunks/protocol-executor-2UPB7SPI.js +2 -0
  230. package/dist/cli/chunks/{protocol-handler-WDNJDEUE.js → protocol-handler-HKWBGARO.js} +2 -2
  231. package/dist/cli/chunks/{prove-3B75DA3S.js → prove-7CQPHBRJ.js} +2 -2
  232. package/dist/cli/chunks/provider-manager-PDT37MIJ.js +2 -0
  233. package/dist/cli/chunks/qe-reasoning-bank-AQQ2BI4V.js +2 -0
  234. package/dist/cli/chunks/{quality-UGASS5WM.js → quality-VLUVXKVG.js} +2 -2
  235. package/dist/cli/chunks/queen-coordinator-6DVDVEU4.js +2 -0
  236. package/dist/cli/chunks/{real-embeddings-COBP2LHS.js → real-embeddings-JPZ64KK2.js} +2 -2
  237. package/dist/cli/chunks/{roocode-installer-TOZ4VLFT.js → roocode-installer-NONVB3UE.js} +2 -2
  238. package/dist/cli/chunks/router-O2G4KQ6L.js +2 -0
  239. package/dist/cli/chunks/routing-feedback-TAGTD3KQ.js +2 -0
  240. package/dist/cli/chunks/{routing-handler-5TDVSILX.js → routing-handler-YYXDT4J2.js} +2 -2
  241. package/dist/cli/chunks/{ruvector-commands-AM63KWQN.js → ruvector-commands-5PFMNDLR.js} +2 -2
  242. package/dist/cli/chunks/{rvf-dual-writer-UANIFE2M.js → rvf-dual-writer-TF6H7AXH.js} +2 -2
  243. package/dist/cli/chunks/{rvf-migration-adapter-LNPYWAPI.js → rvf-migration-adapter-VNGIUZCO.js} +2 -2
  244. package/dist/cli/chunks/{rvf-migration-coordinator-U47L63DQ.js → rvf-migration-coordinator-VA52YAIY.js} +2 -2
  245. package/dist/cli/chunks/rvf-native-adapter-46GRWQJR.js +2 -0
  246. package/dist/cli/chunks/safe-db-LNIPXXHH.js +2 -0
  247. package/dist/cli/chunks/schedule-AUH3ZALY.js +2 -0
  248. package/dist/cli/chunks/scheduler-KK3OYPWW.js +2 -0
  249. package/dist/cli/chunks/{security-KDQ2AH7G.js → security-62HEETBF.js} +3 -3
  250. package/dist/cli/chunks/{shared-rvf-adapter-5MAGLLYJ.js → shared-rvf-adapter-XWTQPGCT.js} +2 -2
  251. package/dist/cli/chunks/{shared-rvf-dual-writer-GF2OPPM5.js → shared-rvf-dual-writer-JTZK7LRD.js} +2 -2
  252. package/dist/cli/chunks/sqlite-persistence-CYESP7NG.js +2 -0
  253. package/dist/cli/chunks/{status-handler-XZKEL7LO.js → status-handler-LSUPUKRF.js} +2 -2
  254. package/dist/cli/chunks/{structural-health-27QKWW25.js → structural-health-Z75A666N.js} +2 -2
  255. package/dist/cli/chunks/{sync-INNKS6UK.js → sync-M3O4T3A3.js} +2 -2
  256. package/dist/cli/chunks/{sync-V3HGPEJT.js → sync-VI37UHHH.js} +2 -2
  257. package/dist/cli/chunks/{task-handler-LDUVOM6G.js → task-handler-AQBSZAQC.js} +2 -2
  258. package/dist/cli/chunks/{task-handlers-HTCPV7OO.js → task-handlers-BOZP247V.js} +3 -3
  259. package/dist/cli/chunks/{test-PCUVGVJL.js → test-FTEGPNN2.js} +4 -4
  260. package/dist/cli/chunks/{test-scheduling-GYVXWCAA.js → test-scheduling-IGR4U2VQ.js} +4 -4
  261. package/dist/cli/chunks/{token-bootstrap-MJ2ANC4P.js → token-bootstrap-2DFRVMBM.js} +2 -2
  262. package/dist/cli/chunks/{token-usage-ZREHROTF.js → token-usage-VCHV47EO.js} +3 -3
  263. package/dist/cli/chunks/{transformers-6B3FWFYL.js → transformers-M27QSNFH.js} +2 -2
  264. package/dist/cli/chunks/tree-sitter-wasm-parser-IIGEJYFU.js +2 -0
  265. package/dist/cli/chunks/{types-MVZTJI2F.js → types-RQFPUUKA.js} +2 -2
  266. package/dist/cli/chunks/unified-memory-RISHEANP.js +2 -0
  267. package/dist/cli/chunks/unified-memory-hnsw-2IKXGMNZ.js +2 -0
  268. package/dist/cli/chunks/unified-persistence-ZTTUJNTU.js +2 -0
  269. package/dist/cli/chunks/{upgrade-MKTFEILD.js → upgrade-VJMYX3AL.js} +2 -2
  270. package/dist/cli/chunks/{validate-IABGALSW.js → validate-ML7HUAU5.js} +4 -4
  271. package/dist/cli/chunks/{validate-swarm-RHF53RF6.js → validate-swarm-RCR6EYRC.js} +7 -7
  272. package/dist/cli/chunks/{vibium-RAKW6FMF.js → vibium-ZOOS3W5L.js} +2 -2
  273. package/dist/cli/chunks/visual-security-D66DTAO5.js +2 -0
  274. package/dist/cli/chunks/{web-tree-sitter-PYK7F4JZ.js → web-tree-sitter-2YPGYLWK.js} +2 -2
  275. package/dist/cli/chunks/{windsurf-installer-S3U2HWZ4.js → windsurf-installer-GOJWUWC5.js} +2 -2
  276. package/dist/cli/chunks/{witness-chain-435NKQLB.js → witness-chain-3MGSS3Q4.js} +2 -2
  277. package/dist/cli/chunks/witness-chain-RHWHHDLV.js +2 -0
  278. package/dist/cli/chunks/{workflow-5UHJCZ6J.js → workflow-B5Q77BI4.js} +4 -4
  279. package/dist/cli/chunks/workflow-orchestrator-OQMFW2TC.js +2 -0
  280. package/dist/cli/chunks/{wrappers-RD3NCMLK.js → wrappers-MM5VLEPG.js} +2 -2
  281. package/dist/cli/commands/code.js +6 -0
  282. package/dist/cli/commands/hooks-handlers/command-hooks.js +1 -1
  283. package/dist/cli/commands/hooks-handlers/routing-hooks.js +1 -1
  284. package/dist/cli/commands/hooks-handlers/task-hooks.js +1 -1
  285. package/dist/cli/commands/learning.js +5 -5
  286. package/dist/cli/commands/llm-router.js +1 -1
  287. package/dist/cli/commands/workflow.js +1 -0
  288. package/dist/coordination/consensus/providers/native-learning-provider.d.ts +1 -1
  289. package/dist/coordination/consensus/providers/ollama-provider.d.ts +1 -1
  290. package/dist/coordination/consensus/providers/openrouter-provider.d.ts +1 -1
  291. package/dist/coordination/handlers/code-intelligence-handlers.js +6 -0
  292. package/dist/coordination/mincut/neural-goap.js +24 -20
  293. package/dist/coordination/protocols/code-intelligence-index.js +31 -25
  294. package/dist/coordination/queen-coordinator.js +4 -0
  295. package/dist/coordination/queen-work-stealing.js +1 -2
  296. package/dist/domains/chaos-resilience/coordinator.js +19 -15
  297. package/dist/domains/chaos-resilience/services/chaos-engineer.js +5 -2
  298. package/dist/domains/chaos-resilience/services/load-tester.js +15 -11
  299. package/dist/domains/code-intelligence/interfaces.d.ts +5 -0
  300. package/dist/domains/code-intelligence/services/c4-model/index.js +12 -6
  301. package/dist/domains/code-intelligence/services/impact-analyzer.js +6 -2
  302. package/dist/domains/code-intelligence/services/knowledge-graph.d.ts +42 -0
  303. package/dist/domains/code-intelligence/services/knowledge-graph.js +278 -93
  304. package/dist/domains/code-intelligence/services/semantic-analyzer.js +8 -2
  305. package/dist/domains/contract-testing/coordinator.js +1 -1
  306. package/dist/domains/coverage-analysis/coordinator.js +4 -2
  307. package/dist/domains/learning-optimization/coordinator.js +1 -0
  308. package/dist/domains/quality-assessment/coherence/gate-controller.js +32 -26
  309. package/dist/domains/requirements-validation/coordinator.js +1 -0
  310. package/dist/domains/test-execution/services/e2e/wait-condition-handler.js +1 -1
  311. package/dist/domains/test-execution/services/retry-handler.js +18 -12
  312. package/dist/domains/test-generation/coordinator.js +1 -1
  313. package/dist/domains/test-generation/services/pattern-matcher.js +7 -5
  314. package/dist/domains/test-generation/services/test-generator.js +3 -2
  315. package/dist/domains/visual-accessibility/coordinator.js +24 -20
  316. package/dist/index.d.ts +2 -2
  317. package/dist/index.js +2 -2
  318. package/dist/init/init-wizard-hooks.js +271 -271
  319. package/dist/init/phases/07-hooks.d.ts +7 -0
  320. package/dist/init/phases/07-hooks.js +132 -96
  321. package/dist/init/phases/12-verification.js +3 -3
  322. package/dist/integrations/agentic-flow/model-router/router.js +1 -1
  323. package/dist/integrations/embeddings/base/EmbeddingGenerator.js +11 -7
  324. package/dist/integrations/ruvector/hypergraph-engine.js +2 -2
  325. package/dist/integrations/ruvector/spectral-math.js +2 -2
  326. package/dist/integrations/ruvector/spectral-sparsifier.js +1 -1
  327. package/dist/kernel/kernel.js +1 -1
  328. package/dist/kernel/unified-memory-hnsw.js +1 -0
  329. package/dist/learning/agent-routing.d.ts +19 -0
  330. package/dist/learning/agent-routing.js +27 -1
  331. package/dist/learning/dream/dream-scheduler.d.ts +11 -36
  332. package/dist/learning/dream/dream-scheduler.js +44 -0
  333. package/dist/learning/experience-capture.js +1 -1
  334. package/dist/learning/experience-consolidation.d.ts +16 -0
  335. package/dist/learning/experience-consolidation.js +55 -11
  336. package/dist/learning/pattern-lifecycle.d.ts +21 -0
  337. package/dist/learning/pattern-lifecycle.js +70 -6
  338. package/dist/learning/qe-reasoning-bank.js +9 -1
  339. package/dist/learning/qe-unified-memory.js +8 -6
  340. package/dist/mcp/bundle.js +371 -368
  341. package/dist/mcp/handlers/core-handlers.js +2 -2
  342. package/dist/mcp/handlers/cross-phase-handlers.js +5 -3
  343. package/dist/mcp/handlers/handler-factory.d.ts +5 -0
  344. package/dist/mcp/handlers/handler-factory.js +44 -4
  345. package/dist/mcp/http-server.js +1 -0
  346. package/dist/mcp/protocol-server.js +15 -16
  347. package/dist/mcp/tools/code-intelligence/analyze.js +1 -1
  348. package/dist/mcp/tools/learning-optimization/optimize.js +1 -1
  349. package/dist/mcp/tools/qx-analysis/heuristics-engine.js +195 -173
  350. package/dist/mcp/tools/visual-accessibility/index.js +1 -1
  351. package/dist/mcp/transport/stdio.d.ts +20 -0
  352. package/dist/mcp/transport/stdio.js +35 -2
  353. package/dist/mcp/transport/websocket/websocket-transport.js +1 -0
  354. package/dist/optimization/auto-tuner.js +1 -1
  355. package/dist/planning/goap-planner.js +1 -0
  356. package/dist/routing/agent-dependency-graph.js +4 -1
  357. package/dist/shared/llm/router/config-store.js +1 -1
  358. package/dist/shared/metrics/system-metrics.js +6 -4
  359. package/dist/shared/parsers/tree-sitter-wasm-parser.d.ts +12 -0
  360. package/dist/shared/parsers/tree-sitter-wasm-parser.js +35 -0
  361. package/dist/shared/parsers/treesitter-ts-extractor.d.ts +39 -0
  362. package/dist/shared/parsers/treesitter-ts-extractor.js +196 -0
  363. package/dist/shared/utils/rabitq.d.ts +133 -0
  364. package/dist/shared/utils/rabitq.js +201 -0
  365. package/dist/shared/utils/safe-expression-evaluator.js +8 -5
  366. package/dist/sync/cloud/postgres-writer.js +2 -0
  367. package/dist/sync/readers/json-reader.js +1 -1
  368. package/dist/test-scheduling/git-aware/test-selector.js +1 -1
  369. package/dist/workers/quality-daemon/index.js +26 -24
  370. package/package.json +12 -5
  371. package/dist/cli/chunks/adapter-3JS2CN7C.js +0 -2
  372. package/dist/cli/chunks/aqe-learning-engine-Q4GFNGU6.js +0 -2
  373. package/dist/cli/chunks/base-Q3MAL22Y.js +0 -2
  374. package/dist/cli/chunks/browser-workflow-JX3M2UWG.js +0 -2
  375. package/dist/cli/chunks/chunk-622MIAOR.js +0 -59
  376. package/dist/cli/chunks/chunk-CKECJH2A.js +0 -2
  377. package/dist/cli/chunks/chunk-IJ4BUSJN.js +0 -95
  378. package/dist/cli/chunks/chunk-VPCE5CIT.js +0 -2
  379. package/dist/cli/chunks/chunk-WO7KYT3X.js +0 -62
  380. package/dist/cli/chunks/client-PA3UJIHH.js +0 -2
  381. package/dist/cli/chunks/cross-domain-router-BVJRP2ZX.js +0 -2
  382. package/dist/cli/chunks/dream-BXZUEIW2.js +0 -2
  383. package/dist/cli/chunks/heartbeat-scheduler-LEKAWFJF.js +0 -2
  384. package/dist/cli/chunks/hnsw-adapter-2TCEG5M2.js +0 -2
  385. package/dist/cli/chunks/hnsw-index-VDPUTEES.js +0 -2
  386. package/dist/cli/chunks/hybrid-router-2EMDIYIG.js +0 -2
  387. package/dist/cli/chunks/impact-analyzer-HFD6CPWC.js +0 -2
  388. package/dist/cli/chunks/init-wizard-552QIVRC.js +0 -2
  389. package/dist/cli/chunks/kernel-5DN6O6EE.js +0 -2
  390. package/dist/cli/chunks/knowledge-graph-76Y77MB6.js +0 -2
  391. package/dist/cli/chunks/llm-router-service-4O6GCEFH.js +0 -2
  392. package/dist/cli/chunks/load-test-FCI2IWRJ.js +0 -2
  393. package/dist/cli/chunks/memory-backend-MKNCBNDE.js +0 -2
  394. package/dist/cli/chunks/memory-handlers-OBAFR4WV.js +0 -2
  395. package/dist/cli/chunks/protocol-executor-IA7WNT23.js +0 -2
  396. package/dist/cli/chunks/provider-manager-3K5KB5A6.js +0 -2
  397. package/dist/cli/chunks/qe-reasoning-bank-V5Z3BBYY.js +0 -2
  398. package/dist/cli/chunks/queen-coordinator-QOMPA27Z.js +0 -2
  399. package/dist/cli/chunks/router-P5RZUPC4.js +0 -2
  400. package/dist/cli/chunks/routing-feedback-3PS3OZQC.js +0 -2
  401. package/dist/cli/chunks/rvf-native-adapter-TT7OJPKM.js +0 -2
  402. package/dist/cli/chunks/safe-db-PEW7VBAE.js +0 -2
  403. package/dist/cli/chunks/schedule-QHOTHBQE.js +0 -2
  404. package/dist/cli/chunks/scheduler-KXJBYTRT.js +0 -2
  405. package/dist/cli/chunks/sqlite-persistence-TPXJK34J.js +0 -2
  406. package/dist/cli/chunks/tree-sitter-wasm-parser-JVV234MN.js +0 -2
  407. package/dist/cli/chunks/unified-memory-ROS2NKR5.js +0 -2
  408. package/dist/cli/chunks/unified-memory-hnsw-FLEUF3XO.js +0 -2
  409. package/dist/cli/chunks/unified-persistence-QC5L7UNQ.js +0 -2
  410. package/dist/cli/chunks/visual-security-NLIOUQCR.js +0 -2
  411. package/dist/cli/chunks/witness-chain-U7X6JX5J.js +0 -2
  412. package/dist/cli/chunks/workflow-orchestrator-APE6BAXH.js +0 -2
@@ -172,6 +172,9 @@ export class HooksPhase extends BasePhase {
172
172
  this.installBrainCheckpoint(projectRoot, context);
173
173
  // Install statusline-v3 helper into .claude/helpers/
174
174
  this.installStatusline(projectRoot, context);
175
+ // Install the resilient hook shim into .claude/hooks/ — the generated
176
+ // settings.json hooks invoke it (`node .../aqe-hook.cjs <cmd>`).
177
+ this.installHookShim(projectRoot, context);
175
178
  // Install cross-phase memory config
176
179
  const crossPhasePath = join(hooksDir, 'cross-phase-memory.yaml');
177
180
  if (!existsSync(crossPhasePath)) {
@@ -290,40 +293,73 @@ export class HooksPhase extends BasePhase {
290
293
  context.services.log(' Installed statusline-v3.cjs (generated)');
291
294
  }
292
295
  }
296
+ /**
297
+ * Install the resilient hook shim (aqe-hook.cjs) into .claude/hooks/.
298
+ * The generated settings.json hooks run `node .../aqe-hook.cjs <cmd>` — the
299
+ * shim resolves a project-local AQE bundle (or falls back to npx), strips
300
+ * init noise from stdout, swallows stderr, and always exits 0.
301
+ */
302
+ installHookShim(projectRoot, context) {
303
+ const destDir = join(projectRoot, '.claude', 'hooks');
304
+ if (!existsSync(destDir)) {
305
+ mkdirSync(destDir, { recursive: true });
306
+ }
307
+ const destPath = join(destDir, 'aqe-hook.cjs');
308
+ // Source candidates: the installed dependency, then this package's own copy
309
+ // (resolved relative to the compiled init module — works for npx too).
310
+ const sourcePaths = [
311
+ join(projectRoot, 'node_modules', 'agentic-qe', '.claude', 'hooks', 'aqe-hook.cjs'),
312
+ join(__dirname, '..', '..', '..', '.claude', 'hooks', 'aqe-hook.cjs'),
313
+ ];
314
+ for (const src of sourcePaths) {
315
+ if (existsSync(src) && src !== destPath) {
316
+ const { copyFileSync } = require('fs');
317
+ copyFileSync(src, destPath);
318
+ context.services.log(' Installed aqe-hook.cjs (copied)');
319
+ return;
320
+ }
321
+ }
322
+ if (existsSync(destPath)) {
323
+ // Already present (e.g. dogfooding this repo) — leave it.
324
+ return;
325
+ }
326
+ // Should not happen for a real install (the file ships in the package).
327
+ context.services.log(' ⚠ aqe-hook.cjs source not found — hooks will fall back to `npx agentic-qe`');
328
+ }
293
329
  /**
294
330
  * Generate a minimal statusline-v3.cjs script as a fallback.
295
331
  * Used when the full asset isn't available for copying.
296
332
  */
297
333
  generateMinimalStatuslineScript() {
298
- return `#!/usr/bin/env node
299
- /**
300
- * Agentic QE v3 Statusline (minimal fallback, generated by aqe init)
301
- * For the full statusline, reinstall: npx agentic-qe init --auto
302
- */
303
- const fs = require('fs');
304
- const path = require('path');
305
- const { execFileSync } = require('child_process');
306
-
307
- function q(bin, args, d) { try { return execFileSync(bin, args, { encoding: 'utf-8', timeout: 3000, stdio: ['pipe', 'pipe', 'pipe'] }).trim(); } catch { return d || ''; } }
308
-
309
- const dir = path.resolve(__dirname, '..', '..');
310
- const dbPath = path.join(dir, '.agentic-qe', 'memory.db');
311
- let patterns = 0;
312
- try {
313
- if (fs.existsSync(dbPath)) {
314
- const Database = require('better-sqlite3');
315
- const db = new Database(dbPath, { readonly: true, fileMustExist: true });
316
- db.pragma('busy_timeout = 5000');
317
- patterns = db.prepare("SELECT COUNT(*) AS c FROM qe_patterns WHERE usage_count > 0 OR quality_score > 0 OR name NOT LIKE 'bench-%'").get()?.c || 0;
318
- db.close();
319
- }
320
- } catch { /* ignore */ }
321
-
322
- const branch = q('git', ['branch', '--show-current']);
323
- const branchStr = branch ? \` \\x1b[34m⎇ \${branch}\\x1b[0m\` : '';
324
- const patStr = patterns > 0 ? \` \\x1b[35m🎓 \${patterns} patterns\\x1b[0m\` : '';
325
-
326
- console.log(\`\\x1b[1m\\x1b[35m▊ Agentic QE v3\\x1b[0m\${branchStr}\${patStr}\`);
334
+ return `#!/usr/bin/env node
335
+ /**
336
+ * Agentic QE v3 Statusline (minimal fallback, generated by aqe init)
337
+ * For the full statusline, reinstall: npx agentic-qe init --auto
338
+ */
339
+ const fs = require('fs');
340
+ const path = require('path');
341
+ const { execFileSync } = require('child_process');
342
+
343
+ function q(bin, args, d) { try { return execFileSync(bin, args, { encoding: 'utf-8', timeout: 3000, stdio: ['pipe', 'pipe', 'pipe'] }).trim(); } catch { return d || ''; } }
344
+
345
+ const dir = path.resolve(__dirname, '..', '..');
346
+ const dbPath = path.join(dir, '.agentic-qe', 'memory.db');
347
+ let patterns = 0;
348
+ try {
349
+ if (fs.existsSync(dbPath)) {
350
+ const Database = require('better-sqlite3');
351
+ const db = new Database(dbPath, { readonly: true, fileMustExist: true });
352
+ db.pragma('busy_timeout = 5000');
353
+ patterns = db.prepare("SELECT COUNT(*) AS c FROM qe_patterns WHERE usage_count > 0 OR quality_score > 0 OR name NOT LIKE 'bench-%'").get()?.c || 0;
354
+ db.close();
355
+ }
356
+ } catch { /* ignore */ }
357
+
358
+ const branch = q('git', ['branch', '--show-current']);
359
+ const branchStr = branch ? \` \\x1b[34m⎇ \${branch}\\x1b[0m\` : '';
360
+ const patStr = patterns > 0 ? \` \\x1b[35m🎓 \${patterns} patterns\\x1b[0m\` : '';
361
+
362
+ console.log(\`\\x1b[1m\\x1b[35m▊ Agentic QE v3\\x1b[0m\${branchStr}\${patStr}\`);
327
363
  `;
328
364
  }
329
365
  /**
@@ -331,62 +367,62 @@ console.log(\`\\x1b[1m\\x1b[35m▊ Agentic QE v3\\x1b[0m\${branchStr}\${patStr}\
331
367
  * Used when the source file isn't available for copying.
332
368
  */
333
369
  generateBrainCheckpointScript() {
334
- return `#!/usr/bin/env node
335
- /**
336
- * Brain Checkpoint Helper (generated by aqe init)
337
- *
338
- * Usage:
339
- * node brain-checkpoint.cjs export # Export brain to aqe.rvf (session-end)
340
- * node brain-checkpoint.cjs verify # Verify aqe.rvf exists (session-start)
341
- */
342
- const { execFileSync } = require('child_process');
343
- const fs = require('fs');
344
- const path = require('path');
345
-
346
- const PROJECT_ROOT = path.resolve(__dirname, '..', '..');
347
- const AQE_DIR = path.join(PROJECT_ROOT, '.agentic-qe');
348
- const RVF_PATH = path.join(AQE_DIR, 'aqe.rvf');
349
- const DB_PATH = path.join(AQE_DIR, 'memory.db');
350
- const MAX_AGE_HOURS = 24;
351
-
352
- function log(msg) { process.stderr.write('[brain-checkpoint] ' + msg + '\\n'); }
353
-
354
- function exportBrain() {
355
- if (!fs.existsSync(DB_PATH)) { log('No memory.db, skipping'); return { exported: false }; }
356
- try {
357
- if (fs.existsSync(RVF_PATH)) fs.unlinkSync(RVF_PATH);
358
- const idmap = RVF_PATH + '.idmap.json';
359
- if (fs.existsSync(idmap)) fs.unlinkSync(idmap);
360
- const result = execFileSync(
361
- 'npx', ['agentic-qe', 'brain', 'export', '-o', RVF_PATH, '--format', 'rvf'],
362
- { timeout: 60000, encoding: 'utf-8' }
363
- );
364
- const m = result.match(/Patterns:\\s+(\\d+)/);
365
- const p = m ? m[1] : '0';
366
- log('Exported ' + p + ' patterns to aqe.rvf');
367
- return { exported: true, patterns: parseInt(p) };
368
- } catch (e) {
369
- log('Export failed: ' + e.message);
370
- return { exported: false, reason: e.message };
371
- }
372
- }
373
-
374
- function verifyBrain() {
375
- if (!fs.existsSync(RVF_PATH)) {
376
- log('No aqe.rvf found');
377
- return { valid: false, reason: 'missing' };
378
- }
379
- const stat = fs.statSync(RVF_PATH);
380
- const ageH = (Date.now() - stat.mtimeMs) / 3600000;
381
- if (stat.size < 1024) { log('aqe.rvf too small'); return { valid: false, reason: 'too-small' }; }
382
- if (ageH > MAX_AGE_HOURS) { log('aqe.rvf is ' + ageH.toFixed(1) + 'h old'); return { valid: true, stale: true }; }
383
- log('aqe.rvf OK (' + (stat.size/1048576).toFixed(1) + ' MB)');
384
- return { valid: true, stale: false };
385
- }
386
-
387
- const cmd = process.argv[2] || 'verify';
388
- const result = cmd === 'export' ? exportBrain() : verifyBrain();
389
- if (process.argv.includes('--json')) process.stdout.write(JSON.stringify(result));
370
+ return `#!/usr/bin/env node
371
+ /**
372
+ * Brain Checkpoint Helper (generated by aqe init)
373
+ *
374
+ * Usage:
375
+ * node brain-checkpoint.cjs export # Export brain to aqe.rvf (session-end)
376
+ * node brain-checkpoint.cjs verify # Verify aqe.rvf exists (session-start)
377
+ */
378
+ const { execFileSync } = require('child_process');
379
+ const fs = require('fs');
380
+ const path = require('path');
381
+
382
+ const PROJECT_ROOT = path.resolve(__dirname, '..', '..');
383
+ const AQE_DIR = path.join(PROJECT_ROOT, '.agentic-qe');
384
+ const RVF_PATH = path.join(AQE_DIR, 'aqe.rvf');
385
+ const DB_PATH = path.join(AQE_DIR, 'memory.db');
386
+ const MAX_AGE_HOURS = 24;
387
+
388
+ function log(msg) { process.stderr.write('[brain-checkpoint] ' + msg + '\\n'); }
389
+
390
+ function exportBrain() {
391
+ if (!fs.existsSync(DB_PATH)) { log('No memory.db, skipping'); return { exported: false }; }
392
+ try {
393
+ if (fs.existsSync(RVF_PATH)) fs.unlinkSync(RVF_PATH);
394
+ const idmap = RVF_PATH + '.idmap.json';
395
+ if (fs.existsSync(idmap)) fs.unlinkSync(idmap);
396
+ const result = execFileSync(
397
+ 'npx', ['agentic-qe', 'brain', 'export', '-o', RVF_PATH, '--format', 'rvf'],
398
+ { timeout: 60000, encoding: 'utf-8' }
399
+ );
400
+ const m = result.match(/Patterns:\\s+(\\d+)/);
401
+ const p = m ? m[1] : '0';
402
+ log('Exported ' + p + ' patterns to aqe.rvf');
403
+ return { exported: true, patterns: parseInt(p) };
404
+ } catch (e) {
405
+ log('Export failed: ' + e.message);
406
+ return { exported: false, reason: e.message };
407
+ }
408
+ }
409
+
410
+ function verifyBrain() {
411
+ if (!fs.existsSync(RVF_PATH)) {
412
+ log('No aqe.rvf found');
413
+ return { valid: false, reason: 'missing' };
414
+ }
415
+ const stat = fs.statSync(RVF_PATH);
416
+ const ageH = (Date.now() - stat.mtimeMs) / 3600000;
417
+ if (stat.size < 1024) { log('aqe.rvf too small'); return { valid: false, reason: 'too-small' }; }
418
+ if (ageH > MAX_AGE_HOURS) { log('aqe.rvf is ' + ageH.toFixed(1) + 'h old'); return { valid: true, stale: true }; }
419
+ log('aqe.rvf OK (' + (stat.size/1048576).toFixed(1) + ' MB)');
420
+ return { valid: true, stale: false };
421
+ }
422
+
423
+ const cmd = process.argv[2] || 'verify';
424
+ const result = cmd === 'export' ? exportBrain() : verifyBrain();
425
+ if (process.argv.includes('--json')) process.stdout.write(JSON.stringify(result));
390
426
  `;
391
427
  }
392
428
  /**
@@ -410,7 +446,7 @@ if (process.argv.includes('--json')) process.stdout.write(JSON.stringify(result)
410
446
  hooks: [
411
447
  {
412
448
  type: 'command',
413
- command: 'npx agentic-qe hooks guard --file "$TOOL_INPUT_file_path" --json',
449
+ command: 'node "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/aqe-hook.cjs" guard --file "$TOOL_INPUT_file_path" --json',
414
450
  timeout: 3000,
415
451
  continueOnError: true,
416
452
  },
@@ -422,7 +458,7 @@ if (process.argv.includes('--json')) process.stdout.write(JSON.stringify(result)
422
458
  hooks: [
423
459
  {
424
460
  type: 'command',
425
- command: 'npx agentic-qe hooks pre-edit --file "$TOOL_INPUT_file_path" --json',
461
+ command: 'node "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/aqe-hook.cjs" pre-edit --file "$TOOL_INPUT_file_path" --json',
426
462
  timeout: 5000,
427
463
  continueOnError: true,
428
464
  },
@@ -434,7 +470,7 @@ if (process.argv.includes('--json')) process.stdout.write(JSON.stringify(result)
434
470
  hooks: [
435
471
  {
436
472
  type: 'command',
437
- command: 'npx agentic-qe hooks pre-command --command "$TOOL_INPUT_command" --json',
473
+ command: 'node "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/aqe-hook.cjs" pre-command --command "$TOOL_INPUT_command" --json',
438
474
  timeout: 3000,
439
475
  continueOnError: true,
440
476
  },
@@ -446,7 +482,7 @@ if (process.argv.includes('--json')) process.stdout.write(JSON.stringify(result)
446
482
  hooks: [
447
483
  {
448
484
  type: 'command',
449
- command: 'npx agentic-qe hooks pre-task --description "$TOOL_INPUT_prompt" --json',
485
+ command: 'node "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/aqe-hook.cjs" pre-task --description "$TOOL_INPUT_prompt" --json',
450
486
  timeout: 5000,
451
487
  continueOnError: true,
452
488
  },
@@ -459,7 +495,7 @@ if (process.argv.includes('--json')) process.stdout.write(JSON.stringify(result)
459
495
  hooks: [
460
496
  {
461
497
  type: 'command',
462
- command: 'npx agentic-qe hooks post-edit --file "$TOOL_INPUT_file_path" --success --json',
498
+ command: 'node "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/aqe-hook.cjs" post-edit --file "$TOOL_INPUT_file_path" --success --json',
463
499
  timeout: 5000,
464
500
  continueOnError: true,
465
501
  },
@@ -470,7 +506,7 @@ if (process.argv.includes('--json')) process.stdout.write(JSON.stringify(result)
470
506
  hooks: [
471
507
  {
472
508
  type: 'command',
473
- command: 'npx agentic-qe hooks post-command --command "$TOOL_INPUT_command" --success --json',
509
+ command: 'node "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/aqe-hook.cjs" post-command --command "$TOOL_INPUT_command" --success true --json',
474
510
  timeout: 5000,
475
511
  continueOnError: true,
476
512
  },
@@ -481,7 +517,7 @@ if (process.argv.includes('--json')) process.stdout.write(JSON.stringify(result)
481
517
  hooks: [
482
518
  {
483
519
  type: 'command',
484
- command: 'npx agentic-qe hooks post-task --task-id "$TOOL_RESULT_agent_id" --success --json',
520
+ command: 'node "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/aqe-hook.cjs" post-task --task-id "$TOOL_RESULT_agent_id" --agent "$TOOL_INPUT_subagent_type" --success true --description "$TOOL_INPUT_prompt" --json',
485
521
  timeout: 5000,
486
522
  continueOnError: true,
487
523
  },
@@ -496,7 +532,7 @@ if (process.argv.includes('--json')) process.stdout.write(JSON.stringify(result)
496
532
  // (e.g. {"prompt":"..."}). $PROMPT is NOT exposed as an env
497
533
  // var, so we let the CLI read stdin directly.
498
534
  type: 'command',
499
- command: 'npx agentic-qe hooks route --json',
535
+ command: 'node "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/aqe-hook.cjs" route --json',
500
536
  timeout: 5000,
501
537
  continueOnError: true,
502
538
  },
@@ -508,7 +544,7 @@ if (process.argv.includes('--json')) process.stdout.write(JSON.stringify(result)
508
544
  hooks: [
509
545
  {
510
546
  type: 'command',
511
- command: 'npx agentic-qe hooks session-start --session-id "$SESSION_ID" --json',
547
+ command: 'node "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/aqe-hook.cjs" session-start --session-id "$SESSION_ID" --json',
512
548
  timeout: 10000,
513
549
  continueOnError: true,
514
550
  },
@@ -530,7 +566,7 @@ if (process.argv.includes('--json')) process.stdout.write(JSON.stringify(result)
530
566
  hooks: [
531
567
  {
532
568
  type: 'command',
533
- command: 'npx agentic-qe hooks session-end --save-state --json',
569
+ command: 'node "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/aqe-hook.cjs" session-end --save-state --json',
534
570
  timeout: 5000,
535
571
  continueOnError: true,
536
572
  },
@@ -544,7 +580,7 @@ if (process.argv.includes('--json')) process.stdout.write(JSON.stringify(result)
544
580
  // — without this, `routing_outcomes` accumulates quality_score=-1
545
581
  // rows forever in direct-work sessions (no Task/Agent spawned).
546
582
  type: 'command',
547
- command: 'npx agentic-qe hooks post-route --success true --json',
583
+ command: 'node "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/aqe-hook.cjs" post-route --success true --json',
548
584
  timeout: 5000,
549
585
  continueOnError: true,
550
586
  },
@@ -179,7 +179,7 @@ export class VerificationPhase extends BasePhase {
179
179
  continue;
180
180
  }
181
181
  // Second-level key (2-space indent)
182
- const subMatch = line.match(/^ (\w+):\s*(.*)$/);
182
+ const subMatch = line.match(/^ {2}(\w+):\s*(.*)$/);
183
183
  if (subMatch && currentSection) {
184
184
  currentSubSection = subMatch[1];
185
185
  const value = subMatch[2].trim();
@@ -196,7 +196,7 @@ export class VerificationPhase extends BasePhase {
196
196
  }
197
197
  // Third-level key (4-space indent)
198
198
  // Use [\w-]+ to match hyphenated keys like "pattern-consolidator"
199
- const thirdMatch = line.match(/^ ([\w-]+):\s*(.*)$/);
199
+ const thirdMatch = line.match(/^ {4}([\w-]+):\s*(.*)$/);
200
200
  if (thirdMatch && currentSection && currentSubSection) {
201
201
  const key = thirdMatch[1];
202
202
  const value = thirdMatch[2].trim();
@@ -210,7 +210,7 @@ export class VerificationPhase extends BasePhase {
210
210
  continue;
211
211
  }
212
212
  // Array item (4-space indent with dash)
213
- const arrayMatch = line.match(/^ - "?([^"]*)"?$/);
213
+ const arrayMatch = line.match(/^ {4}- "?([^"]*)"?$/);
214
214
  if (arrayMatch && currentSection && currentSubSection) {
215
215
  const section = result[currentSection];
216
216
  if (!Array.isArray(section[currentSubSection])) {
@@ -375,7 +375,7 @@ export class ModelRouter {
375
375
  // Step 2: Analyze complexity
376
376
  const complexityAnalysis = await this.complexityAnalyzer.analyze(input);
377
377
  // Step 3: Get recommended tier from complexity
378
- let recommendedTier = complexityAnalysis.recommendedTier;
378
+ const recommendedTier = complexityAnalysis.recommendedTier;
379
379
  // Step 4: Estimate cost for this tier
380
380
  const estimatedCostUsd = this.estimateCost(recommendedTier, input.task.length);
381
381
  // Step 5: Check budget
@@ -208,17 +208,21 @@ export class EmbeddingGenerator {
208
208
  return new Float32Array(vector.map((v) => Math.fround(v)));
209
209
  case 'int8':
210
210
  // Quantize to int8 range [-128, 127]
211
- const max = Math.max(...vector.map(Math.abs));
212
- return new Int8Array(vector.map((v) => Math.round((v / max) * 127)));
211
+ {
212
+ const max = Math.max(...vector.map(Math.abs));
213
+ return new Int8Array(vector.map((v) => Math.round((v / max) * 127)));
214
+ }
213
215
  case 'binary':
214
216
  // Binary quantization (sign bit only)
215
- const binaryBytes = new Uint8Array(Math.ceil(vector.length / 8));
216
- for (let i = 0; i < vector.length; i++) {
217
- if (vector[i] >= 0) {
218
- binaryBytes[Math.floor(i / 8)] |= 1 << (i % 8);
217
+ {
218
+ const binaryBytes = new Uint8Array(Math.ceil(vector.length / 8));
219
+ for (let i = 0; i < vector.length; i++) {
220
+ if (vector[i] >= 0) {
221
+ binaryBytes[Math.floor(i / 8)] |= 1 << (i % 8);
222
+ }
219
223
  }
224
+ return binaryBytes;
220
225
  }
221
- return binaryBytes;
222
226
  case 'none':
223
227
  default:
224
228
  return vector;
@@ -657,8 +657,8 @@ export class HypergraphEngine {
657
657
  const startTime = Date.now();
658
658
  let nodesSynced = 0;
659
659
  let edgesSynced = 0;
660
- let nodesAdded = 0;
661
- let nodesRemoved = 0;
660
+ const nodesAdded = 0;
661
+ const nodesRemoved = 0;
662
662
  // Get all nodes from hypergraph
663
663
  const hgNodes = await this.findNodes({});
664
664
  for (const node of hgNodes) {
@@ -114,7 +114,7 @@ export function approximateFiedlerValue(adjacency, n, maxIter = 100, tol = 1e-6)
114
114
  // The trivial eigenvector of L: normalized all-ones
115
115
  const trivial = new Float64Array(n).fill(1 / Math.sqrt(n));
116
116
  // First, estimate lambda_max using a few power iterations on L
117
- let maxVec = new Float64Array(n);
117
+ const maxVec = new Float64Array(n);
118
118
  for (let i = 0; i < n; i++)
119
119
  maxVec[i] = Math.random() - 0.5;
120
120
  deflateVector(maxVec, trivial);
@@ -134,7 +134,7 @@ export function approximateFiedlerValue(adjacency, n, maxIter = 100, tol = 1e-6)
134
134
  // Now use power iteration on (lambdaMax * I - L) to find the
135
135
  // eigenvector corresponding to the LARGEST eigenvalue of (lambdaMax*I - L),
136
136
  // which corresponds to the SMALLEST non-trivial eigenvalue of L.
137
- let v = new Float64Array(n);
137
+ const v = new Float64Array(n);
138
138
  for (let i = 0; i < n; i++)
139
139
  v[i] = Math.random() - 0.5;
140
140
  deflateVector(v, trivial);
@@ -276,7 +276,7 @@ export class SpectralSparsifier {
276
276
  // Use a different pattern for each deflation round to avoid
277
277
  // starting in the null-space of the deflated matrix
278
278
  const round = previousEigenvectors.length;
279
- let v = new Array(n);
279
+ const v = new Array(n);
280
280
  for (let i = 0; i < n; i++) {
281
281
  v[i] = Math.sin((i + 1) * (round + 1) * 1.618033988749895) + 0.1 * (i - n / 2);
282
282
  }
@@ -566,7 +566,7 @@ export class QEKernelImpl {
566
566
  const activeCount = this._coordinator.getActiveCount();
567
567
  // Get memory stats - handle both backend types
568
568
  let memUsed = 0;
569
- let memAvailable = Number.MAX_SAFE_INTEGER;
569
+ const memAvailable = Number.MAX_SAFE_INTEGER;
570
570
  if (this._memory instanceof InMemoryBackend) {
571
571
  const memStats = this._memory.getStats();
572
572
  memUsed = memStats.entries + memStats.vectors;
@@ -76,6 +76,7 @@ export class BinaryHeap {
76
76
  }
77
77
  sinkDown(i) {
78
78
  const n = this.data.length;
79
+ // eslint-disable-next-line no-constant-condition -- heap sift-down; loop breaks internally
79
80
  while (true) {
80
81
  let smallest = i;
81
82
  const left = 2 * i + 1;
@@ -78,6 +78,25 @@ export declare const MAX_Q_WEIGHT = 0.4;
78
78
  * decision. Adjust downward if cold-start latency proves problematic.
79
79
  */
80
80
  export declare const QWEIGHT_RAMP_VISITS = 20;
81
+ /**
82
+ * De-dilution cap for the domain-match denominator (#510 item 2).
83
+ *
84
+ * Domain score is `(domainMatch / denom) * 0.4`. The original `denom` was the
85
+ * full count of *detected* domains, but AQE's domain detector routinely emits
86
+ * 7-12 domains per task, so a perfect single-domain specialist scored
87
+ * `(1/11)*0.4 ≈ 0.04` — relevance washed out by detector breadth, leaving
88
+ * confidence dominated by the fixed performance term (measured easy task
89
+ * 37.3%, hard task 20.5%, with hard tasks mis-routing to high-performance
90
+ * but domain-irrelevant agents).
91
+ *
92
+ * Capping the denominator models the fact that a task has only a few *truly
93
+ * relevant* domains. With cap=3: a precise detector (1-2 domains) is
94
+ * unchanged, while a broad detector no longer dilutes a real match below
95
+ * usefulness. Proportionality across agents is preserved (an agent matching 2
96
+ * relevant domains still beats one matching 1). Tunable; raise toward the old
97
+ * behavior, lower to weight domain relevance more heavily.
98
+ */
99
+ export declare const DOMAIN_DENOM_CAP = 3;
81
100
  /**
82
101
  * Q-value lookup callback supplied by the caller (QEReasoningBank.routeTask).
83
102
  * Returns undefined when the (stateKey, agentType) pair has no recorded
@@ -99,6 +99,25 @@ export const MAX_Q_WEIGHT = 0.4;
99
99
  * decision. Adjust downward if cold-start latency proves problematic.
100
100
  */
101
101
  export const QWEIGHT_RAMP_VISITS = 20;
102
+ /**
103
+ * De-dilution cap for the domain-match denominator (#510 item 2).
104
+ *
105
+ * Domain score is `(domainMatch / denom) * 0.4`. The original `denom` was the
106
+ * full count of *detected* domains, but AQE's domain detector routinely emits
107
+ * 7-12 domains per task, so a perfect single-domain specialist scored
108
+ * `(1/11)*0.4 ≈ 0.04` — relevance washed out by detector breadth, leaving
109
+ * confidence dominated by the fixed performance term (measured easy task
110
+ * 37.3%, hard task 20.5%, with hard tasks mis-routing to high-performance
111
+ * but domain-irrelevant agents).
112
+ *
113
+ * Capping the denominator models the fact that a task has only a few *truly
114
+ * relevant* domains. With cap=3: a precise detector (1-2 domains) is
115
+ * unchanged, while a broad detector no longer dilutes a real match below
116
+ * usefulness. Proportionality across agents is preserved (an agent matching 2
117
+ * relevant domains still beats one matching 1). Tunable; raise toward the old
118
+ * behavior, lower to weight domain relevance more heavily.
119
+ */
120
+ export const DOMAIN_DENOM_CAP = 3;
102
121
  /**
103
122
  * Sigmoid mapping R → (0, 1) for Q-value normalization before blending.
104
123
  * A fresh row with q_value = 0 contributes 0.5 (neutral); negative q_values
@@ -265,7 +284,14 @@ qValueLookup) {
265
284
  const reasoning = [];
266
285
  // Domain match (0-0.4)
267
286
  const domainMatch = detectedDomains.filter((d) => profile.domains.includes(d)).length;
268
- const domainScore = domainMatch > 0 ? (domainMatch / detectedDomains.length) * 0.4 : 0;
287
+ // De-dilute by capping the denominator (#510 item 2): dividing by the full
288
+ // count of *detected* domains (7-12) washed out real matches. Cap models
289
+ // the few truly-relevant domains a task actually has. Math.min(...,1)
290
+ // guards the case where domainMatch exceeds the cap.
291
+ const domainDenom = Math.min(detectedDomains.length, DOMAIN_DENOM_CAP);
292
+ const domainScore = domainMatch > 0
293
+ ? Math.min(domainMatch / domainDenom, 1) * 0.4
294
+ : 0;
269
295
  score += domainScore * routingWeights.similarity;
270
296
  if (domainScore > 0) {
271
297
  reasoning.push(`Domain match: ${(domainScore * 100).toFixed(0)}%`);
@@ -101,42 +101,6 @@ export interface DreamSchedulerDependencies {
101
101
  /** Memory backend for persisting scheduler state (optional) */
102
102
  memoryBackend?: MemoryBackend;
103
103
  }
104
- /**
105
- * DreamScheduler manages automatic triggering of dream cycles.
106
- *
107
- * It follows the dependency injection pattern - all required dependencies
108
- * (DreamEngine, EventBus) must be provided via the constructor.
109
- *
110
- * @example
111
- * ```typescript
112
- * const scheduler = new DreamScheduler({
113
- * dreamEngine,
114
- * eventBus,
115
- * memoryBackend, // optional
116
- * });
117
- *
118
- * await scheduler.initialize();
119
- * scheduler.start();
120
- *
121
- * // Record experiences as they happen
122
- * scheduler.recordExperience({
123
- * id: 'exp-1',
124
- * agentType: 'tester',
125
- * domain: 'test-execution',
126
- * taskType: 'run-tests',
127
- * success: true,
128
- * duration: 5000,
129
- * timestamp: new Date(),
130
- * });
131
- *
132
- * // Manually trigger a dream
133
- * const result = await scheduler.triggerDream();
134
- *
135
- * // Stop and cleanup
136
- * scheduler.stop();
137
- * await scheduler.dispose();
138
- * ```
139
- */
140
104
  export declare class DreamScheduler {
141
105
  private readonly config;
142
106
  private readonly dreamEngine;
@@ -320,6 +284,17 @@ export declare class DreamScheduler {
320
284
  * Publish a dream completed event.
321
285
  */
322
286
  private publishDreamCompletedEvent;
287
+ /**
288
+ * #509: Reconcile the SessionStart-read `dream-scheduler:hook-state` row after
289
+ * a successful dream cycle. The post-task hook only ever INCREMENTS that row's
290
+ * experienceCount; this kernel scheduler is the entity that actually dreams
291
+ * (ADR-094) but historically never wrote it back, so the SessionStart readout
292
+ * showed lastDreamTime:null and a pendingExperiences counter that only grew.
293
+ * We stamp { lastDreamTime: now, experienceCount: 0, totalDreamsThisSession++ }
294
+ * using the SAME key + DEFAULT namespace the hook path uses. Best-effort: a
295
+ * failure here must never break a dream cycle.
296
+ */
297
+ private reconcileHookState;
323
298
  /**
324
299
  * Save scheduler state to memory backend.
325
300
  */
@@ -81,6 +81,17 @@ export const DEFAULT_DREAM_SCHEDULER_CONFIG = {
81
81
  * await scheduler.dispose();
82
82
  * ```
83
83
  */
84
+ /**
85
+ * kv_store key that the SessionStart hook reads for its dream readout and the
86
+ * post-task hook increments. Mirrors `DREAM_STATE_KEY` in
87
+ * cli/commands/hooks-handlers/hooks-dream-learning.ts — kept as a local literal
88
+ * (not imported) to avoid a learning→cli layering dependency. MUST match that
89
+ * value and use the DEFAULT namespace (the hook path passes no namespace).
90
+ * #509: this scheduler is the entity that actually dreams (ADR-094) but never
91
+ * reset this row, so SessionStart showed lastDreamTime:null + an ever-growing
92
+ * pendingExperiences. reconcileHookState() below stamps the truth per cycle.
93
+ */
94
+ const DREAM_HOOK_STATE_KEY = 'dream-scheduler:hook-state';
84
95
  export class DreamScheduler {
85
96
  config;
86
97
  dreamEngine;
@@ -351,6 +362,10 @@ export class DreamScheduler {
351
362
  this.totalDreamsCompleted++;
352
363
  // Clear experience buffer after successful dream
353
364
  this.clearExperienceBuffer();
365
+ // #509: reconcile the SessionStart-read hook-state row. The post-task hook
366
+ // only increments its experienceCount and nothing on the active dream path
367
+ // reset it, so the readout was perpetually stale. Best-effort.
368
+ await this.reconcileHookState();
354
369
  // Auto-apply high-confidence insights if enabled
355
370
  if (this.config.autoApplyHighConfidenceInsights) {
356
371
  await this.autoApplyInsights(result);
@@ -698,6 +713,35 @@ export class DreamScheduler {
698
713
  // ==========================================================================
699
714
  // Private: State Persistence
700
715
  // ==========================================================================
716
+ /**
717
+ * #509: Reconcile the SessionStart-read `dream-scheduler:hook-state` row after
718
+ * a successful dream cycle. The post-task hook only ever INCREMENTS that row's
719
+ * experienceCount; this kernel scheduler is the entity that actually dreams
720
+ * (ADR-094) but historically never wrote it back, so the SessionStart readout
721
+ * showed lastDreamTime:null and a pendingExperiences counter that only grew.
722
+ * We stamp { lastDreamTime: now, experienceCount: 0, totalDreamsThisSession++ }
723
+ * using the SAME key + DEFAULT namespace the hook path uses. Best-effort: a
724
+ * failure here must never break a dream cycle.
725
+ */
726
+ async reconcileHookState() {
727
+ if (!this.memoryBackend)
728
+ return;
729
+ try {
730
+ const prev = await this.memoryBackend.get(DREAM_HOOK_STATE_KEY);
731
+ const next = {
732
+ lastDreamTime: (this.lastDreamTime ?? new Date()).toISOString(),
733
+ experienceCount: 0,
734
+ sessionStartTime: prev?.sessionStartTime,
735
+ totalDreamsThisSession: (prev?.totalDreamsThisSession ?? 0) + 1,
736
+ };
737
+ await this.memoryBackend.set(DREAM_HOOK_STATE_KEY, next);
738
+ }
739
+ catch (err) {
740
+ logger.warn('Dream hook-state reconcile failed (non-critical)', {
741
+ error: err instanceof Error ? err.message : String(err),
742
+ });
743
+ }
744
+ }
701
745
  /**
702
746
  * Save scheduler state to memory backend.
703
747
  */