agentic-qe 3.10.9 → 3.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (474) hide show
  1. package/.claude/agents/v3/qe-learning-coordinator.md +1 -1
  2. package/.claude/commands/agents/README.md +50 -0
  3. package/.claude/commands/agents/agent-capabilities.md +140 -0
  4. package/.claude/commands/agents/agent-coordination.md +28 -0
  5. package/.claude/commands/agents/agent-spawning.md +28 -0
  6. package/.claude/commands/agents/agent-types.md +216 -0
  7. package/.claude/commands/agents/health.md +139 -0
  8. package/.claude/commands/agents/list.md +100 -0
  9. package/.claude/commands/agents/logs.md +130 -0
  10. package/.claude/commands/agents/metrics.md +122 -0
  11. package/.claude/commands/agents/pool.md +127 -0
  12. package/.claude/commands/agents/spawn.md +140 -0
  13. package/.claude/commands/agents/status.md +115 -0
  14. package/.claude/commands/agents/stop.md +102 -0
  15. package/.claude/commands/claude-flow-help.md +1 -1
  16. package/.claude/commands/coordination/README.md +9 -0
  17. package/.claude/commands/coordination/agent-spawn.md +25 -0
  18. package/.claude/commands/coordination/init.md +44 -0
  19. package/.claude/commands/coordination/orchestrate.md +43 -0
  20. package/.claude/commands/coordination/spawn.md +45 -0
  21. package/.claude/commands/coordination/swarm-init.md +85 -0
  22. package/.claude/commands/coordination/task-orchestrate.md +25 -0
  23. package/.claude/commands/github/code-review-swarm.md +1 -1
  24. package/.claude/commands/github/issue-tracker.md +3 -3
  25. package/.claude/commands/github/release-manager.md +5 -3
  26. package/.claude/commands/github/release-swarm.md +1 -1
  27. package/.claude/commands/github/repo-architect.md +2 -2
  28. package/.claude/commands/github/swarm-issue.md +4 -1
  29. package/.claude/commands/github/swarm-pr.md +6 -3
  30. package/.claude/commands/github/sync-coordinator.md +3 -1
  31. package/.claude/commands/github/workflow-automation.md +2 -2
  32. package/.claude/commands/hive-mind/README.md +17 -0
  33. package/.claude/commands/hive-mind/hive-mind-consensus.md +8 -0
  34. package/.claude/commands/hive-mind/hive-mind-init.md +18 -0
  35. package/.claude/commands/hive-mind/hive-mind-memory.md +8 -0
  36. package/.claude/commands/hive-mind/hive-mind-metrics.md +8 -0
  37. package/.claude/commands/hive-mind/hive-mind-resume.md +8 -0
  38. package/.claude/commands/hive-mind/hive-mind-sessions.md +8 -0
  39. package/.claude/commands/hive-mind/hive-mind-spawn.md +21 -0
  40. package/.claude/commands/hive-mind/hive-mind-status.md +8 -0
  41. package/.claude/commands/hive-mind/hive-mind-stop.md +8 -0
  42. package/.claude/commands/hive-mind/hive-mind-wizard.md +8 -0
  43. package/.claude/commands/hive-mind/hive-mind.md +27 -0
  44. package/.claude/commands/memory/README.md +9 -0
  45. package/.claude/commands/memory/memory-persist.md +25 -0
  46. package/.claude/commands/memory/memory-search.md +25 -0
  47. package/.claude/commands/memory/memory-usage.md +25 -0
  48. package/.claude/commands/memory/neural.md +47 -0
  49. package/.claude/commands/swarm/README.md +15 -0
  50. package/.claude/commands/swarm/analysis.md +95 -0
  51. package/.claude/commands/swarm/development.md +96 -0
  52. package/.claude/commands/swarm/examples.md +168 -0
  53. package/.claude/commands/swarm/maintenance.md +102 -0
  54. package/.claude/commands/swarm/optimization.md +117 -0
  55. package/.claude/commands/swarm/research.md +136 -0
  56. package/.claude/commands/swarm/swarm-analysis.md +8 -0
  57. package/.claude/commands/swarm/swarm-background.md +8 -0
  58. package/.claude/commands/swarm/swarm-init.md +19 -0
  59. package/.claude/commands/swarm/swarm-modes.md +8 -0
  60. package/.claude/commands/swarm/swarm-monitor.md +8 -0
  61. package/.claude/commands/swarm/swarm-spawn.md +19 -0
  62. package/.claude/commands/swarm/swarm-status.md +8 -0
  63. package/.claude/commands/swarm/swarm-strategies.md +8 -0
  64. package/.claude/commands/swarm/swarm.md +87 -0
  65. package/.claude/commands/swarm/testing.md +131 -0
  66. package/.claude/commands/workflows/README.md +9 -0
  67. package/.claude/commands/workflows/development.md +78 -0
  68. package/.claude/commands/workflows/research.md +63 -0
  69. package/.claude/commands/workflows/workflow-create.md +25 -0
  70. package/.claude/commands/workflows/workflow-execute.md +25 -0
  71. package/.claude/commands/workflows/workflow-export.md +25 -0
  72. package/.claude/helpers/auto-commit.sh +1 -1
  73. package/.claude/helpers/auto-memory-hook.mjs +37 -4
  74. package/.claude/helpers/github-safe.js +90 -40
  75. package/.claude/helpers/github-setup.sh +30 -13
  76. package/.claude/helpers/hook-handler.cjs +68 -49
  77. package/.claude/helpers/intelligence.cjs +156 -27
  78. package/.claude/helpers/post-commit +1 -1
  79. package/.claude/helpers/pre-commit +1 -1
  80. package/.claude/helpers/quick-start.sh +4 -4
  81. package/.claude/helpers/router.js +70 -31
  82. package/.claude/helpers/ruflo-hook.cjs +59 -0
  83. package/.claude/helpers/session.js +28 -6
  84. package/.claude/helpers/setup-mcp.sh +3 -3
  85. package/.claude/helpers/statusline.cjs +584 -468
  86. package/.claude/helpers/statusline.js +47 -11
  87. package/.claude/skills/README.md +2 -2
  88. package/.claude/skills/agentic-quality-engineering/SKILL.md +6 -5
  89. package/.claude/skills/agentic-quality-engineering/schemas/output.json +7 -3
  90. package/.claude/skills/github-code-review/SKILL.md +2 -17
  91. package/.claude/skills/github-multi-repo/SKILL.md +4 -16
  92. package/.claude/skills/github-project-management/SKILL.md +18 -33
  93. package/.claude/skills/github-release-management/SKILL.md +4 -21
  94. package/.claude/skills/github-workflow-automation/SKILL.md +8 -26
  95. package/.claude/skills/holistic-testing-pact/SKILL.md +50 -17
  96. package/.claude/skills/pair-programming/SKILL.md +2 -2
  97. package/.claude/skills/reasoningbank-intelligence/SKILL.md +2 -2
  98. package/.claude/skills/skill-builder/SKILL.md +0 -103
  99. package/.claude/skills/skills-manifest.json +6 -6
  100. package/.claude/skills/sparc-methodology/SKILL.md +2 -11
  101. package/.claude/skills/stream-chain/SKILL.md +0 -3
  102. package/.claude/skills/swarm-advanced/SKILL.md +2 -5
  103. package/.claude/skills/swarm-orchestration/SKILL.md +1 -1
  104. package/.claude/skills/verification-quality/SKILL.md +121 -93
  105. package/.opencode/skills/qe-agentic-quality-engineering.yaml +5 -5
  106. package/.opencode/skills/qe-holistic-testing-pact.yaml +11 -11
  107. package/CHANGELOG.md +100 -0
  108. package/README.md +17 -0
  109. package/assets/agents/v3/qe-learning-coordinator.md +1 -1
  110. package/assets/skills/README.md +2 -2
  111. package/assets/skills/agentic-quality-engineering/SKILL.md +6 -5
  112. package/assets/skills/agentic-quality-engineering/schemas/output.json +7 -3
  113. package/assets/skills/holistic-testing-pact/SKILL.md +50 -17
  114. package/assets/skills/pair-programming/SKILL.md +2 -2
  115. package/assets/skills/skills-manifest.json +6 -6
  116. package/assets/skills/verification-quality/SKILL.md +121 -93
  117. package/dist/audit/witness-chain.d.ts +1 -1
  118. package/dist/audit/witness-findings.d.ts +50 -0
  119. package/dist/audit/witness-findings.js +41 -0
  120. package/dist/cli/bundle.js +5 -5
  121. package/dist/cli/chunks/adapter-A6GCBONS.js +2 -0
  122. package/dist/cli/chunks/{agent-booster-wasm-RPAOJXZ3.js → agent-booster-wasm-3OJAT664.js} +2 -2
  123. package/dist/cli/chunks/{agent-handler-SMD5CAS6.js → agent-handler-6TCTI5AT.js} +2 -2
  124. package/dist/cli/chunks/{agent-memory-branch-3IOQIQ7Y.js → agent-memory-branch-FAWCYEGJ.js} +2 -2
  125. package/dist/cli/chunks/aqe-learning-engine-FRCSXNMG.js +2 -0
  126. package/dist/cli/chunks/{arena-AP2J62WO.js → arena-O2TCUQBF.js} +4 -4
  127. package/dist/cli/chunks/{arena-GT3D6EAO.js → arena-UVYIGYUF.js} +2 -2
  128. package/dist/cli/chunks/{audit-Q3GJ5354.js → audit-AYESKHAJ.js} +2 -2
  129. package/dist/cli/chunks/base-CZ3EHBU5.js +2 -0
  130. package/dist/cli/chunks/{hnswlib-node-YTK7S7GL.js → better-sqlite3-MJNUEPYB.js} +2 -2
  131. package/dist/cli/chunks/{brain-handler-2Z4ILQF3.js → brain-handler-KSJBVTHZ.js} +3 -3
  132. package/dist/cli/chunks/{branch-enumerator-EZWGL4UM.js → branch-enumerator-4O3S42EG.js} +2 -2
  133. package/dist/cli/chunks/{browser-YZELFPLJ.js → browser-5VXK323P.js} +2 -2
  134. package/dist/cli/chunks/browser-workflow-EKTGQQBQ.js +2 -0
  135. package/dist/cli/chunks/{chunk-CDJIYJIA.js → chunk-22FHOXEE.js} +1 -1
  136. package/dist/cli/chunks/{chunk-OIN3Y4BY.js → chunk-2RE32VOF.js} +1 -1
  137. package/dist/cli/chunks/{chunk-RSWQY4NZ.js → chunk-3D4HNUZM.js} +2 -2
  138. package/dist/cli/chunks/{chunk-6TR3OM7C.js → chunk-3DS7ZHA7.js} +2 -2
  139. package/dist/cli/chunks/{chunk-HGKZOSAI.js → chunk-3G25ZBQ6.js} +1 -1
  140. package/dist/cli/chunks/{chunk-QHPLU5BU.js → chunk-3IMEDZIS.js} +3 -3
  141. package/dist/cli/chunks/{chunk-EL6F72JN.js → chunk-3V5DAM37.js} +2 -2
  142. package/dist/cli/chunks/{chunk-IR7PJUO7.js → chunk-3XCEFSUK.js} +2 -2
  143. package/dist/cli/chunks/{chunk-L5NEEGKO.js → chunk-437XL5VZ.js} +2 -2
  144. package/dist/cli/chunks/{chunk-C6GQIUKW.js → chunk-44HXRFOP.js} +2 -2
  145. package/dist/cli/chunks/{chunk-KAMFT25W.js → chunk-4565IIF6.js} +2 -2
  146. package/dist/cli/chunks/{chunk-X7677BX3.js → chunk-4BMPFEEG.js} +2 -2
  147. package/dist/cli/chunks/{chunk-3YKJGKOY.js → chunk-4G4GTF36.js} +4 -4
  148. package/dist/cli/chunks/{chunk-352W5G4G.js → chunk-4OYC5TIZ.js} +2 -2
  149. package/dist/cli/chunks/{chunk-VHCHBMZC.js → chunk-4RUS5E3Q.js} +2 -2
  150. package/dist/cli/chunks/{chunk-QHICG2NI.js → chunk-4S3UIY3G.js} +2 -2
  151. package/dist/cli/chunks/{chunk-FD37QFXW.js → chunk-4UHWZ47M.js} +1 -1
  152. package/dist/cli/chunks/{chunk-UU7OCRZM.js → chunk-56PICCZN.js} +2 -2
  153. package/dist/cli/chunks/chunk-57WGS6BI.js +2 -0
  154. package/dist/cli/chunks/{chunk-RRSJ7BMF.js → chunk-5LDUW2FD.js} +1 -1
  155. package/dist/cli/chunks/{chunk-J6GKKXCP.js → chunk-5PSIKJL5.js} +2 -2
  156. package/dist/cli/chunks/{chunk-QE3CZGAC.js → chunk-5QFZEEJ2.js} +3 -3
  157. package/dist/cli/chunks/{chunk-RHOBDQXA.js → chunk-5Y7GXQOM.js} +2 -2
  158. package/dist/cli/chunks/{chunk-5X73HV2P.js → chunk-6CH7476R.js} +1 -1
  159. package/dist/cli/chunks/{chunk-BG2FN5K2.js → chunk-6WNYBIPS.js} +2 -2
  160. package/dist/cli/chunks/{chunk-G4KVGUQN.js → chunk-6YNXH6H4.js} +2 -2
  161. package/dist/cli/chunks/{chunk-2WRVNEIR.js → chunk-6ZAUNPAI.js} +2 -2
  162. package/dist/cli/chunks/{chunk-2I5QLMQF.js → chunk-72UPBNVF.js} +2 -2
  163. package/dist/cli/chunks/{chunk-VDL277DX.js → chunk-76UVJLPM.js} +2 -2
  164. package/dist/cli/chunks/{chunk-4EJTE5TL.js → chunk-7DQLYWLR.js} +1 -1
  165. package/dist/cli/chunks/{chunk-4D3LVXUD.js → chunk-7GP7ZG3K.js} +2 -2
  166. package/dist/cli/chunks/{chunk-757YHKIJ.js → chunk-7OAKIXNM.js} +2 -2
  167. package/dist/cli/chunks/{chunk-7S6D5K4X.js → chunk-7QICU44H.js} +2 -2
  168. package/dist/cli/chunks/{chunk-ABJPFKHE.js → chunk-7SRSOZMP.js} +1 -1
  169. package/dist/cli/chunks/{chunk-2WSEJHFQ.js → chunk-7WQKKYYG.js} +1 -1
  170. package/dist/cli/chunks/{chunk-7NT34MLU.js → chunk-AEZMNFXM.js} +1 -1
  171. package/dist/cli/chunks/{chunk-MDED3HJI.js → chunk-AG4BYKUV.js} +2 -2
  172. package/dist/cli/chunks/{chunk-QL7OOCPO.js → chunk-AL54LED5.js} +2 -2
  173. package/dist/cli/chunks/{chunk-I7RTTJH5.js → chunk-ATQTTGSE.js} +2 -2
  174. package/dist/cli/chunks/{chunk-HQZX4XYH.js → chunk-B5EE63VE.js} +2 -2
  175. package/dist/cli/chunks/{chunk-QWXJRZEH.js → chunk-B6U56VWG.js} +1 -1
  176. package/dist/cli/chunks/{chunk-5HLOQEKL.js → chunk-BOQNPFO5.js} +1 -1
  177. package/dist/cli/chunks/{chunk-I5C7O5IQ.js → chunk-BR4ERWVD.js} +2 -2
  178. package/dist/cli/chunks/{chunk-GPALZJD3.js → chunk-BVFNF3RW.js} +1 -1
  179. package/dist/cli/chunks/{chunk-NYBAH76S.js → chunk-BXLWERBR.js} +3 -3
  180. package/dist/cli/chunks/{chunk-YQBL5XTM.js → chunk-C27UV6DO.js} +1 -1
  181. package/dist/cli/chunks/{chunk-UUA2NVUN.js → chunk-C7FYDE5F.js} +244 -233
  182. package/dist/cli/chunks/{chunk-6HPI6YX3.js → chunk-CIDTFU3C.js} +2 -2
  183. package/dist/cli/chunks/{chunk-VIHFC67B.js → chunk-CII57TME.js} +1 -1
  184. package/dist/cli/chunks/{chunk-57XCLC55.js → chunk-CN2HMHIY.js} +2 -2
  185. package/dist/cli/chunks/{chunk-CREORFJV.js → chunk-CXIFCN6G.js} +1 -1
  186. package/dist/cli/chunks/{chunk-EYGRNXQT.js → chunk-CZU5G6J4.js} +1 -1
  187. package/dist/cli/chunks/{chunk-HZSYCVLC.js → chunk-D4DAZ3P2.js} +2 -2
  188. package/dist/cli/chunks/{chunk-3HT4CT6F.js → chunk-D6MPGK7R.js} +2 -2
  189. package/dist/cli/chunks/{chunk-DK6WWNCL.js → chunk-DZT4A7R3.js} +2 -2
  190. package/dist/cli/chunks/{chunk-H7AQ7M3J.js → chunk-EFRIMR74.js} +1 -1
  191. package/dist/cli/chunks/{chunk-S73EBPI5.js → chunk-EJSDQQZH.js} +3 -3
  192. package/dist/cli/chunks/{chunk-X6YUGKMM.js → chunk-EQYDPF52.js} +1 -1
  193. package/dist/cli/chunks/{chunk-BYVARYGB.js → chunk-EZBXCEBV.js} +2 -2
  194. package/dist/cli/chunks/{chunk-L5IO7QNO.js → chunk-FBOPSWF6.js} +2 -2
  195. package/dist/cli/chunks/{chunk-K23XK33X.js → chunk-FK3XYV3A.js} +2 -2
  196. package/dist/cli/chunks/{chunk-4BB75U6N.js → chunk-FOD6JEEU.js} +2 -2
  197. package/dist/cli/chunks/{chunk-TIR3Z6TE.js → chunk-GUSW3OGX.js} +1 -1
  198. package/dist/cli/chunks/{chunk-2K2X75UF.js → chunk-H4V6WCF7.js} +2 -2
  199. package/dist/cli/chunks/{chunk-AHUX7QSE.js → chunk-H5GCRC2D.js} +2 -2
  200. package/dist/cli/chunks/{chunk-R2M3RMCN.js → chunk-HMVL55QX.js} +2 -2
  201. package/dist/cli/chunks/{chunk-NOWGQ6YZ.js → chunk-HOFEAA4R.js} +1 -1
  202. package/dist/cli/chunks/{chunk-PFGH7TWL.js → chunk-HYT5EMES.js} +2 -2
  203. package/dist/cli/chunks/{chunk-AU4DQMLJ.js → chunk-IAHJ62JS.js} +4 -4
  204. package/dist/cli/chunks/{chunk-ZVF7QY4R.js → chunk-IIX5Y7BO.js} +1 -1
  205. package/dist/cli/chunks/{chunk-QAP5S7YC.js → chunk-ILZHECWZ.js} +3 -3
  206. package/dist/cli/chunks/{chunk-ZT2DGSIO.js → chunk-IUVAWWQG.js} +2 -2
  207. package/dist/cli/chunks/{chunk-ABVBHH7P.js → chunk-IVZVVZZ3.js} +3 -3
  208. package/dist/cli/chunks/{chunk-DZWZASDV.js → chunk-J2LAYCYZ.js} +1 -1
  209. package/dist/cli/chunks/{chunk-G7V2HDTH.js → chunk-JGHEGMLD.js} +3 -3
  210. package/dist/cli/chunks/{chunk-QFIKEZB5.js → chunk-K3BBLIWW.js} +2 -2
  211. package/dist/cli/chunks/{chunk-BSMUT672.js → chunk-K7XPKGOL.js} +2 -2
  212. package/dist/cli/chunks/{chunk-YHFCLJMY.js → chunk-KIBP3LGY.js} +1 -1
  213. package/dist/cli/chunks/{chunk-U6TZVACK.js → chunk-KRUKMGPF.js} +2 -2
  214. package/dist/cli/chunks/{chunk-UX4UHYLE.js → chunk-L2QHZFC3.js} +1 -1
  215. package/dist/cli/chunks/{chunk-O36VC7B7.js → chunk-LNV76GGB.js} +2 -2
  216. package/dist/cli/chunks/{chunk-NMQEU4BG.js → chunk-LOPM3YIO.js} +2 -2
  217. package/dist/cli/chunks/{chunk-LT6QHDPK.js → chunk-LSZLXLZA.js} +2 -2
  218. package/dist/cli/chunks/{chunk-NLUWPS2H.js → chunk-MILWEZSZ.js} +3 -3
  219. package/dist/cli/chunks/{chunk-LHKQW72O.js → chunk-MX6M2VPB.js} +1 -1
  220. package/dist/cli/chunks/{chunk-KRAWWBX5.js → chunk-N4OWZLH5.js} +2 -2
  221. package/dist/cli/chunks/{chunk-4MUZGQPE.js → chunk-N52WQO3G.js} +2 -2
  222. package/dist/cli/chunks/{chunk-246Z3PH6.js → chunk-N6NSZG7Z.js} +2 -2
  223. package/dist/cli/chunks/{chunk-OQUH7657.js → chunk-N6RSJGTW.js} +5 -5
  224. package/dist/cli/chunks/{chunk-WOGWIMQK.js → chunk-NKCL6RAF.js} +2 -2
  225. package/dist/cli/chunks/{chunk-C6JULAWA.js → chunk-NVJIOCS5.js} +5 -5
  226. package/dist/cli/chunks/{chunk-TKZABUHO.js → chunk-NYWK7ZSX.js} +1 -1
  227. package/dist/cli/chunks/{chunk-DNE6MVNA.js → chunk-O5NF6BBD.js} +1 -1
  228. package/dist/cli/chunks/{chunk-CWRSQQHV.js → chunk-O75SVMMB.js} +2 -2
  229. package/dist/cli/chunks/{chunk-OD4OIPXO.js → chunk-OHBZON7T.js} +1 -1
  230. package/dist/cli/chunks/{chunk-CLJNAQXB.js → chunk-OUBYADPD.js} +2 -2
  231. package/dist/cli/chunks/{chunk-PYQZ4OA3.js → chunk-OUSD2RWO.js} +2 -2
  232. package/dist/cli/chunks/{chunk-TVU6NMO3.js → chunk-OX2PGDUM.js} +3 -3
  233. package/dist/cli/chunks/{chunk-XLK4GP3I.js → chunk-P7CMWL7Y.js} +2 -2
  234. package/dist/cli/chunks/{chunk-7C5HI4ZA.js → chunk-PY4YQDBM.js} +4 -4
  235. package/dist/cli/chunks/{chunk-5U5SEO7C.js → chunk-QEDS3MOJ.js} +2 -2
  236. package/dist/cli/chunks/{chunk-WPBVLIWQ.js → chunk-QMN563LV.js} +18 -18
  237. package/dist/cli/chunks/{chunk-D2JCSWYM.js → chunk-QOR4YAZY.js} +2 -2
  238. package/dist/cli/chunks/{chunk-H4SHHYRD.js → chunk-QUTKELAS.js} +2 -2
  239. package/dist/cli/chunks/{chunk-42FBJF73.js → chunk-QXDZN2WX.js} +1 -1
  240. package/dist/cli/chunks/{chunk-OSP5AJAB.js → chunk-S456W64P.js} +2 -2
  241. package/dist/cli/chunks/{chunk-VHYNRISI.js → chunk-S7IHSELP.js} +2 -2
  242. package/dist/cli/chunks/{chunk-62MH7QAQ.js → chunk-S7ZHD6VN.js} +2 -2
  243. package/dist/cli/chunks/{chunk-QL6ZJ7RV.js → chunk-SU4YXUVK.js} +2 -2
  244. package/dist/cli/chunks/{chunk-JZNMU63B.js → chunk-SZPTUV3B.js} +2 -2
  245. package/dist/cli/chunks/{chunk-FALB6Z2Y.js → chunk-T7PUM6OY.js} +1 -1
  246. package/dist/cli/chunks/{chunk-BVEQPMOF.js → chunk-TCKBICJ3.js} +2 -2
  247. package/dist/cli/chunks/{chunk-Z6FRNWQA.js → chunk-TOQJWLJV.js} +2 -2
  248. package/dist/cli/chunks/{chunk-YB3PQ3UV.js → chunk-TUEDIQHY.js} +1 -1
  249. package/dist/cli/chunks/{chunk-CVRTXIYP.js → chunk-U5GCSSYX.js} +1 -1
  250. package/dist/cli/chunks/{chunk-WWGGL3TR.js → chunk-UDLN2THT.js} +1 -1
  251. package/dist/cli/chunks/{chunk-CLSHSVMY.js → chunk-V6YDM37M.js} +1 -1
  252. package/dist/cli/chunks/{chunk-ILPIH4Z6.js → chunk-VGR65B4Y.js} +1 -1
  253. package/dist/cli/chunks/{chunk-XEMP2PNW.js → chunk-VRHLHGKR.js} +2 -2
  254. package/dist/cli/chunks/{chunk-BM52ZEAD.js → chunk-VS2G6LX5.js} +2 -2
  255. package/dist/cli/chunks/{chunk-TOGD2JH2.js → chunk-W6RS5S4Q.js} +2 -2
  256. package/dist/cli/chunks/{chunk-UJBIHPU5.js → chunk-WEPZOCN7.js} +1 -1
  257. package/dist/cli/chunks/{chunk-OF3EMOWN.js → chunk-WIC5UZCQ.js} +2 -2
  258. package/dist/cli/chunks/{chunk-D7NWDUY3.js → chunk-X2OVUBF6.js} +2 -2
  259. package/dist/cli/chunks/{chunk-XYRJL7YN.js → chunk-X4GKYSOH.js} +2 -2
  260. package/dist/cli/chunks/{chunk-TXWUV3S5.js → chunk-XEVUW4QL.js} +2 -2
  261. package/dist/cli/chunks/{chunk-HAC7NB6R.js → chunk-XMDZRULK.js} +2 -2
  262. package/dist/cli/chunks/{chunk-UPGKS6Z3.js → chunk-YFY35CSD.js} +2 -2
  263. package/dist/cli/chunks/{chunk-7D5JE46U.js → chunk-Z6ADE3KJ.js} +2 -2
  264. package/dist/cli/chunks/{chunk-KJA5A3TV.js → chunk-ZKPOKMJZ.js} +2 -2
  265. package/dist/cli/chunks/{chunk-7PYEJ4NV.js → chunk-ZRWAFMM7.js} +2 -2
  266. package/dist/cli/chunks/{ci-KDEFR2X3.js → ci-KTWY7BZT.js} +2 -2
  267. package/dist/cli/chunks/{ci-output-Z3WXRRFI.js → ci-output-WOX6QBMS.js} +2 -2
  268. package/dist/cli/chunks/{circuit-breaker-GS44DEW2.js → circuit-breaker-6XKOSFIF.js} +2 -2
  269. package/dist/cli/chunks/{claude-flow-setup-OHVMHAAH.js → claude-flow-setup-5JA4MNE4.js} +2 -2
  270. package/dist/cli/chunks/client-X3KUJ6R5.js +2 -0
  271. package/dist/cli/chunks/{cline-installer-5TCF4MZD.js → cline-installer-Z2ANHEKW.js} +2 -2
  272. package/dist/cli/chunks/{code-3KCGTG7Z.js → code-NO4ZKNDU.js} +2 -2
  273. package/dist/cli/chunks/{code-index-extractor-LJBI54MZ.js → code-index-extractor-VV4OEPG7.js} +2 -2
  274. package/dist/cli/chunks/{codex-installer-IB62Z6LA.js → codex-installer-BP7Y2NYR.js} +2 -2
  275. package/dist/cli/chunks/{completions-JDXX7KKB.js → completions-YULJQUF4.js} +2 -2
  276. package/dist/cli/chunks/{complexity-analyzer-6JVDXXXP.js → complexity-analyzer-D7XYPQ76.js} +2 -2
  277. package/dist/cli/chunks/{continuedev-installer-PUB45QVR.js → continuedev-installer-E3L7UF72.js} +2 -2
  278. package/dist/cli/chunks/{copilot-installer-QWJ36P22.js → copilot-installer-5TRUMJC5.js} +2 -2
  279. package/dist/cli/chunks/core-handlers-A2EQB3UH.js +2 -0
  280. package/dist/cli/chunks/{cost-tracker-J3KEJDL5.js → cost-tracker-QTYSJMSV.js} +2 -2
  281. package/dist/cli/chunks/{coverage-FWKRI2EY.js → coverage-D5DKZ3XT.js} +3 -3
  282. package/dist/cli/chunks/cross-domain-router-OKZ2PDHT.js +2 -0
  283. package/dist/cli/chunks/{cursor-installer-2HYCUCTH.js → cursor-installer-UDBHGUIG.js} +2 -2
  284. package/dist/cli/chunks/{daemon-G3DBRWDQ.js → daemon-2GXYN7F7.js} +3 -3
  285. package/dist/cli/chunks/{daemon-BVP66DIZ.js → daemon-IVWUMQKL.js} +4 -4
  286. package/dist/cli/chunks/{dag-attention-scheduler-2AQLNB4B.js → dag-attention-scheduler-PWXR4QTU.js} +2 -2
  287. package/dist/cli/chunks/{detect-RUM5SHNE.js → detect-C6P7ONFB.js} +2 -2
  288. package/dist/cli/chunks/{dist-node-GX7MJHFT.js → dist-node-2BUFM2JK.js} +2 -2
  289. package/dist/cli/chunks/{domain-handler-OFBGZ2U5.js → domain-handler-Q2GWZLDM.js} +2 -2
  290. package/dist/cli/chunks/{domain-transfer-6CGRPRGR.js → domain-transfer-GMUBAM3J.js} +2 -2
  291. package/dist/cli/chunks/dream-ZBP4Z5C3.js +2 -0
  292. package/dist/cli/chunks/{embed-and-insert-pattern-MUOEVQX2.js → embed-and-insert-pattern-EFUERRM2.js} +2 -2
  293. package/dist/cli/chunks/{eval-SJMG67DE.js → eval-24FIC43F.js} +2 -2
  294. package/dist/cli/chunks/{experience-capture-middleware-ICKN6IXX.js → experience-capture-middleware-R4UP2Q2M.js} +3 -3
  295. package/dist/cli/chunks/{fast-paths-HXLBG3J4.js → fast-paths-RQCGGTXB.js} +2 -2
  296. package/dist/cli/chunks/{feature-flags-CRUB2ASU.js → feature-flags-APTWWVNQ.js} +2 -2
  297. package/dist/cli/chunks/{feature-flags-JYZSSQJC.js → feature-flags-SOXVYIBN.js} +2 -2
  298. package/dist/cli/chunks/{file-discovery-YHHC7NTJ.js → file-discovery-66KRMXVF.js} +2 -2
  299. package/dist/cli/chunks/{fleet-2VGDL4YL.js → fleet-EMBNKO5Q.js} +3 -3
  300. package/dist/cli/chunks/{gnn-wrapper-7ZAGD4S4.js → gnn-wrapper-6TKDWFJF.js} +2 -2
  301. package/dist/cli/chunks/{heartbeat-handler-HAW3JRHN.js → heartbeat-handler-4ODKJ75H.js} +4 -4
  302. package/dist/cli/chunks/heartbeat-scheduler-6JUWQXWG.js +2 -0
  303. package/dist/cli/chunks/hnsw-adapter-JT4BU7XJ.js +2 -0
  304. package/dist/cli/chunks/hnsw-index-JC5YELJX.js +2 -0
  305. package/dist/cli/chunks/{hnsw-legacy-bridge-BO325POX.js → hnsw-legacy-bridge-25KFCLUC.js} +2 -2
  306. package/dist/cli/chunks/{better-sqlite3-6A6EAXAT.js → hnswlib-node-FUWQTM2D.js} +2 -2
  307. package/dist/cli/chunks/{hooks-HKM3JTFQ.js → hooks-JIDA2COE.js} +10 -10
  308. package/dist/cli/chunks/hybrid-router-SLTXHUFG.js +2 -0
  309. package/dist/cli/chunks/{hypergraph-engine-LGLGHK6B.js → hypergraph-engine-3YDFDPE3.js} +2 -2
  310. package/dist/cli/chunks/{hypergraph-handler-6QDVREZA.js → hypergraph-handler-VWZX2OJX.js} +3 -3
  311. package/dist/cli/chunks/impact-analyzer-JXHCMZXY.js +2 -0
  312. package/dist/cli/chunks/{init-handler-XUQ7XHIE.js → init-handler-DH7VQAMF.js} +6 -6
  313. package/dist/cli/chunks/init-wizard-EX37TYOG.js +2 -0
  314. package/dist/cli/chunks/kernel-JPHAG27D.js +2 -0
  315. package/dist/cli/chunks/{kilocode-installer-6CEZLVIX.js → kilocode-installer-2W2KZCGH.js} +2 -2
  316. package/dist/cli/chunks/{kiro-installer-6CJGATOS.js → kiro-installer-E5KP7OMD.js} +2 -2
  317. package/dist/cli/chunks/knowledge-graph-5QJZIRYB.js +2 -0
  318. package/dist/cli/chunks/{learning-EIYTYZJY.js → learning-XJRUVPLF.js} +3 -3
  319. package/dist/cli/chunks/{llm-router-J4CI7VHU.js → llm-router-AEEKEMF5.js} +4 -4
  320. package/dist/cli/chunks/llm-router-service-SE2RO4P5.js +2 -0
  321. package/dist/cli/chunks/{load-CQPWGLQQ.js → load-PZ4YOTBJ.js} +2 -2
  322. package/dist/cli/chunks/load-test-LOTBWIIS.js +2 -0
  323. package/dist/cli/chunks/{mcp-THOATWCO.js → mcp-IVA6LC2S.js} +2 -2
  324. package/dist/cli/chunks/{memory-NZHMHMRK.js → memory-Y3DHXFQE.js} +5 -5
  325. package/dist/cli/chunks/memory-backend-BSDKTFAN.js +2 -0
  326. package/dist/cli/chunks/{memory-handlers-L2J54AQE.js → memory-handlers-V5PXEJWL.js} +2 -2
  327. package/dist/cli/chunks/{multi-model-executor-3P5E773H.js → multi-model-executor-646G4S4Y.js} +2 -2
  328. package/dist/cli/chunks/{opencode-installer-IRZMKSNG.js → opencode-installer-P6KOOTUS.js} +2 -2
  329. package/dist/cli/chunks/{orchestrator-UADLXTKP.js → orchestrator-T2GVKYMX.js} +5 -5
  330. package/dist/cli/chunks/pattern-null-store-LRSXCZWM.js +2 -0
  331. package/dist/cli/chunks/{pipeline-QEH3XHXJ.js → pipeline-CK2ON45P.js} +2 -2
  332. package/dist/cli/chunks/{platform-NEZ3NXLT.js → platform-OQNSD3A3.js} +2 -2
  333. package/dist/cli/chunks/{plugin-O33HR2VO.js → plugin-UOG6RNRM.js} +2 -2
  334. package/dist/cli/chunks/{prime-radiant-advanced-wasm-MBUMFEX7.js → prime-radiant-advanced-wasm-37UE6TG5.js} +2 -2
  335. package/dist/cli/chunks/protocol-executor-WPUVJEL7.js +2 -0
  336. package/dist/cli/chunks/{protocol-handler-L455UOUT.js → protocol-handler-V722S6YH.js} +2 -2
  337. package/dist/cli/chunks/{prove-3XA3SMAA.js → prove-ANGY6W3W.js} +2 -2
  338. package/dist/cli/chunks/provider-manager-EVPWSH3E.js +2 -0
  339. package/dist/cli/chunks/qe-reasoning-bank-IH63FG33.js +2 -0
  340. package/dist/cli/chunks/{quality-H6Z5JH5B.js → quality-KG4ALI2L.js} +2 -2
  341. package/dist/cli/chunks/queen-coordinator-TTCAGYQO.js +2 -0
  342. package/dist/cli/chunks/{real-embeddings-5DNJ4KEM.js → real-embeddings-GUZDO5UN.js} +2 -2
  343. package/dist/cli/chunks/{roocode-installer-KHXKR2FK.js → roocode-installer-WROAR6MJ.js} +2 -2
  344. package/dist/cli/chunks/router-64Q4ILOQ.js +2 -0
  345. package/dist/cli/chunks/routing-feedback-KCZV4XXC.js +2 -0
  346. package/dist/cli/chunks/{routing-handler-WAMGESEM.js → routing-handler-UFPSSS5D.js} +2 -2
  347. package/dist/cli/chunks/{ruvector-commands-4J7XC6XY.js → ruvector-commands-XJQMKDRM.js} +2 -2
  348. package/dist/cli/chunks/{rvf-dual-writer-3PZEN6XN.js → rvf-dual-writer-QPRMDKYX.js} +2 -2
  349. package/dist/cli/chunks/{rvf-migration-adapter-OIUNRQSU.js → rvf-migration-adapter-SOHBK23K.js} +2 -2
  350. package/dist/cli/chunks/{rvf-migration-coordinator-QZXDI4I5.js → rvf-migration-coordinator-MTWUSPEJ.js} +2 -2
  351. package/dist/cli/chunks/rvf-native-adapter-GNJKMURU.js +2 -0
  352. package/dist/cli/chunks/safe-db-6VBZQIJI.js +2 -0
  353. package/dist/cli/chunks/schedule-4V7O5IPX.js +2 -0
  354. package/dist/cli/chunks/scheduler-CQDMHEHN.js +2 -0
  355. package/dist/cli/chunks/{security-5NY77AMD.js → security-5MAMQKP6.js} +3 -3
  356. package/dist/cli/chunks/{shared-rvf-adapter-MHPUZIMW.js → shared-rvf-adapter-YEUBSRNN.js} +2 -2
  357. package/dist/cli/chunks/{shared-rvf-dual-writer-ITLDYHCX.js → shared-rvf-dual-writer-DBQJHG42.js} +2 -2
  358. package/dist/cli/chunks/sqlite-persistence-7DHUFTHL.js +2 -0
  359. package/dist/cli/chunks/{status-handler-7RBRIXZD.js → status-handler-ZUB2UKQZ.js} +2 -2
  360. package/dist/cli/chunks/{structural-health-MQPY6GA6.js → structural-health-B2GHENWX.js} +2 -2
  361. package/dist/cli/chunks/{sync-66KCEANE.js → sync-7VMXJTR2.js} +2 -2
  362. package/dist/cli/chunks/{sync-USVQTHKN.js → sync-YCUUW3IP.js} +2 -2
  363. package/dist/cli/chunks/{task-handler-4UI4FPPW.js → task-handler-N7LJTXZM.js} +2 -2
  364. package/dist/cli/chunks/{task-handlers-KRII3GVV.js → task-handlers-GDHNJV2E.js} +3 -3
  365. package/dist/cli/chunks/{test-JHN2MVEG.js → test-6COGC5KI.js} +4 -4
  366. package/dist/cli/chunks/{test-scheduling-ZWTEGS3S.js → test-scheduling-CUERHJMF.js} +3 -3
  367. package/dist/cli/chunks/{token-bootstrap-YWXL6AS5.js → token-bootstrap-JTGSL6PP.js} +2 -2
  368. package/dist/cli/chunks/{token-usage-INII2XM3.js → token-usage-LSG3JYGX.js} +2 -2
  369. package/dist/cli/chunks/{transformers-DVFGDNZC.js → transformers-ODIITRCT.js} +2 -2
  370. package/dist/cli/chunks/{tree-sitter-wasm-parser-W2XJT3XF.js → tree-sitter-wasm-parser-KSP7ZZ5H.js} +2 -2
  371. package/dist/cli/chunks/{types-GBZ5Q2GP.js → types-6N6SUU2O.js} +2 -2
  372. package/dist/cli/chunks/unified-memory-MQA72NLP.js +2 -0
  373. package/dist/cli/chunks/unified-memory-hnsw-K7HA3CWV.js +2 -0
  374. package/dist/cli/chunks/unified-persistence-2DXB4OE4.js +2 -0
  375. package/dist/cli/chunks/{upgrade-2JEXEGQX.js → upgrade-7SCVOCPS.js} +2 -2
  376. package/dist/cli/chunks/{validate-GDCM5YTS.js → validate-762ISH2Y.js} +2 -2
  377. package/dist/cli/chunks/{validate-swarm-QZ5RSJEU.js → validate-swarm-R6WYYXGO.js} +2 -2
  378. package/dist/cli/chunks/{vibium-I5BMT734.js → vibium-5GZYSUDQ.js} +2 -2
  379. package/dist/cli/chunks/visual-security-UD6CARIJ.js +2 -0
  380. package/dist/cli/chunks/{web-tree-sitter-3QY2LMLP.js → web-tree-sitter-VYYVAJTY.js} +2 -2
  381. package/dist/cli/chunks/{windsurf-installer-V7OBPLOB.js → windsurf-installer-RRIOR3B6.js} +2 -2
  382. package/dist/cli/chunks/witness-chain-LWALPPMC.js +2 -0
  383. package/dist/cli/chunks/{witness-chain-BNJ4VSZX.js → witness-chain-SRVBEKDB.js} +2 -2
  384. package/dist/cli/chunks/{workflow-3FJSNLPI.js → workflow-XNUDHGEC.js} +4 -4
  385. package/dist/cli/chunks/workflow-orchestrator-QU652FLH.js +2 -0
  386. package/dist/cli/chunks/{wrappers-ERTQNIPK.js → wrappers-3STST7QW.js} +2 -2
  387. package/dist/domains/requirements-validation/coordinator.d.ts +16 -2
  388. package/dist/domains/requirements-validation/coordinator.js +112 -7
  389. package/dist/domains/requirements-validation/plugin.js +20 -1
  390. package/dist/domains/test-generation/coordinator.d.ts +26 -1
  391. package/dist/domains/test-generation/coordinator.js +119 -2
  392. package/dist/domains/test-generation/plugin.js +23 -1
  393. package/dist/integrations/darwin/index.d.ts +10 -0
  394. package/dist/integrations/darwin/index.js +2 -0
  395. package/dist/integrations/darwin/qe-fitness.d.ts +83 -0
  396. package/dist/integrations/darwin/qe-fitness.js +147 -0
  397. package/dist/integrations/darwin/types.d.ts +69 -0
  398. package/dist/integrations/darwin/types.js +21 -0
  399. package/dist/mcp/bundle.js +390 -379
  400. package/dist/mcp/tool-scoping.d.ts +8 -2
  401. package/dist/mcp/tool-scoping.js +13 -0
  402. package/dist/routing/escalation/auto-escalation-tracker.d.ts +34 -15
  403. package/dist/routing/escalation/auto-escalation-tracker.js +24 -15
  404. package/dist/routing/free-tier/coordinator-support.d.ts +90 -0
  405. package/dist/routing/free-tier/coordinator-support.js +78 -0
  406. package/dist/routing/free-tier/executor.d.ts +161 -0
  407. package/dist/routing/free-tier/executor.js +182 -0
  408. package/dist/routing/free-tier/feedback-sink.d.ts +49 -0
  409. package/dist/routing/free-tier/feedback-sink.js +52 -0
  410. package/dist/routing/free-tier/index.d.ts +15 -0
  411. package/dist/routing/free-tier/index.js +6 -0
  412. package/dist/routing/free-tier/ladder.d.ts +41 -0
  413. package/dist/routing/free-tier/ladder.js +78 -0
  414. package/dist/routing/free-tier/provider.d.ts +57 -0
  415. package/dist/routing/free-tier/provider.js +111 -0
  416. package/dist/routing/free-tier/types.d.ts +80 -0
  417. package/dist/routing/free-tier/types.js +16 -0
  418. package/dist/routing/value-score.d.ts +49 -0
  419. package/dist/routing/value-score.js +54 -0
  420. package/dist/shared/optional-module.d.ts +23 -0
  421. package/dist/shared/optional-module.js +46 -0
  422. package/dist/verification/adversarial-verify/calibrate.d.ts +32 -0
  423. package/dist/verification/adversarial-verify/calibrate.js +33 -0
  424. package/dist/verification/adversarial-verify/gate.d.ts +38 -0
  425. package/dist/verification/adversarial-verify/gate.js +32 -0
  426. package/dist/verification/adversarial-verify/index.d.ts +20 -0
  427. package/dist/verification/adversarial-verify/index.js +6 -0
  428. package/dist/verification/adversarial-verify/prompts.d.ts +14 -0
  429. package/dist/verification/adversarial-verify/prompts.js +17 -0
  430. package/dist/verification/adversarial-verify/synthesize.d.ts +18 -0
  431. package/dist/verification/adversarial-verify/synthesize.js +35 -0
  432. package/dist/verification/adversarial-verify/types.d.ts +59 -0
  433. package/dist/verification/adversarial-verify/types.js +10 -0
  434. package/dist/verification/adversarial-verify/verify.d.ts +20 -0
  435. package/dist/verification/adversarial-verify/verify.js +34 -0
  436. package/package.json +14 -1
  437. package/dist/cli/chunks/adapter-TRSV37EA.js +0 -2
  438. package/dist/cli/chunks/aqe-learning-engine-CVJRJOSO.js +0 -2
  439. package/dist/cli/chunks/base-BX4A2D4V.js +0 -2
  440. package/dist/cli/chunks/browser-workflow-O3RL7EYT.js +0 -2
  441. package/dist/cli/chunks/chunk-OPKEQYAC.js +0 -2
  442. package/dist/cli/chunks/client-T263ZXVV.js +0 -2
  443. package/dist/cli/chunks/core-handlers-ODKKGCFK.js +0 -2
  444. package/dist/cli/chunks/cross-domain-router-APU725GC.js +0 -2
  445. package/dist/cli/chunks/dream-PJ5GKY3J.js +0 -2
  446. package/dist/cli/chunks/heartbeat-scheduler-4ZHUIW3Q.js +0 -2
  447. package/dist/cli/chunks/hnsw-adapter-UVJJ6TTP.js +0 -2
  448. package/dist/cli/chunks/hnsw-index-K6HS34JZ.js +0 -2
  449. package/dist/cli/chunks/hybrid-router-25S7OH2Y.js +0 -2
  450. package/dist/cli/chunks/impact-analyzer-UP4RDMJH.js +0 -2
  451. package/dist/cli/chunks/init-wizard-2PAJ3GEC.js +0 -2
  452. package/dist/cli/chunks/kernel-7WOQGMMT.js +0 -2
  453. package/dist/cli/chunks/knowledge-graph-FN2AWHGR.js +0 -2
  454. package/dist/cli/chunks/llm-router-service-C3UPBAS3.js +0 -2
  455. package/dist/cli/chunks/load-test-PQSGLDXJ.js +0 -2
  456. package/dist/cli/chunks/memory-backend-6FR4RT5O.js +0 -2
  457. package/dist/cli/chunks/pattern-null-store-B2UX4NZY.js +0 -2
  458. package/dist/cli/chunks/protocol-executor-OQ6SL7SR.js +0 -2
  459. package/dist/cli/chunks/provider-manager-DQWHW2RG.js +0 -2
  460. package/dist/cli/chunks/qe-reasoning-bank-3JS2CZAE.js +0 -2
  461. package/dist/cli/chunks/queen-coordinator-KXCWEM3Y.js +0 -2
  462. package/dist/cli/chunks/router-OVLIKT55.js +0 -2
  463. package/dist/cli/chunks/routing-feedback-2BYCXNXX.js +0 -2
  464. package/dist/cli/chunks/rvf-native-adapter-YNUYOQ5C.js +0 -2
  465. package/dist/cli/chunks/safe-db-6TYYEU7C.js +0 -2
  466. package/dist/cli/chunks/schedule-XVH7RTVY.js +0 -2
  467. package/dist/cli/chunks/scheduler-DHZBN5HA.js +0 -2
  468. package/dist/cli/chunks/sqlite-persistence-NR5WXTPN.js +0 -2
  469. package/dist/cli/chunks/unified-memory-WJEZ5YAK.js +0 -2
  470. package/dist/cli/chunks/unified-memory-hnsw-6ZA2PMYO.js +0 -2
  471. package/dist/cli/chunks/unified-persistence-SWH6R7MA.js +0 -2
  472. package/dist/cli/chunks/visual-security-PH5JQZCZ.js +0 -2
  473. package/dist/cli/chunks/witness-chain-WYMBNGSL.js +0 -2
  474. package/dist/cli/chunks/workflow-orchestrator-56JIXCI4.js +0 -2
@@ -47,6 +47,33 @@ const session = safeRequire(path.join(helpersDir, 'session.js'));
47
47
  const memory = safeRequire(path.join(helpersDir, 'memory.js'));
48
48
  const intelligence = safeRequire(path.join(helpersDir, 'intelligence.cjs'));
49
49
 
50
+ // ── Intelligence timeout protection (fixes #1530, #1531) ───────────────────
51
+ const INTELLIGENCE_TIMEOUT_MS = 3000;
52
+ // Race the (possibly-async) work against a real timeout. The previous version
53
+ // called fn() and clearTimeout(timer) immediately, so an async fn returned a
54
+ // pending promise that resolved THROUGH the race — the timeout protected
55
+ // nothing. This settles on whichever finishes first, then clears the timer.
56
+ //
57
+ // LIMITATION: a synchronous blocking fn (the current intelligence.init() does
58
+ // blocking fs reads) cannot be interrupted by any in-process timer — the event
59
+ // loop is blocked. The real guard for that case is the readJSON file-size
60
+ // limit in intelligence.cjs. This util only bounds work that yields (async I/O).
61
+ function runWithTimeout(fn, label) {
62
+ let timer;
63
+ const timeout = new Promise((resolve) => {
64
+ timer = setTimeout(() => {
65
+ process.stderr.write("[WARN] " + label + " timed out after " + INTELLIGENCE_TIMEOUT_MS + "ms, skipping\n");
66
+ resolve(null);
67
+ }, INTELLIGENCE_TIMEOUT_MS);
68
+ });
69
+ const work = Promise.resolve().then(fn).catch(() => null);
70
+ return Promise.race([work, timeout]).then((result) => {
71
+ clearTimeout(timer);
72
+ return result;
73
+ });
74
+ }
75
+
76
+
50
77
  // Get the command from argv
51
78
  const [,, command, ...args] = process.argv;
52
79
 
@@ -70,6 +97,13 @@ async function readStdin() {
70
97
  }
71
98
 
72
99
  async function main() {
100
+ // Global safety timeout: hooks must NEVER hang (#1530, #1531)
101
+ const safetyTimer = setTimeout(() => {
102
+ process.stderr.write("[WARN] Hook handler global timeout (5s), forcing exit\n");
103
+ process.exit(0);
104
+ }, 5000);
105
+ safetyTimer.unref(); // don't keep process alive just for this timer
106
+
73
107
  let stdinData = '';
74
108
  try { stdinData = await readStdin(); } catch (e) { /* ignore stdin errors */ }
75
109
 
@@ -78,8 +112,16 @@ async function main() {
78
112
  try { hookInput = JSON.parse(stdinData); } catch (e) { /* ignore parse errors */ }
79
113
  }
80
114
 
81
- // Merge stdin data into prompt resolution: prefer stdin fields, then env, then argv
82
- const prompt = hookInput.prompt || hookInput.command || hookInput.toolInput
115
+ // Normalize snake_case/camelCase: Claude Code sends tool_input/tool_name (snake_case)
116
+ const toolInput = hookInput.toolInput || hookInput.tool_input || {};
117
+ const toolName = hookInput.toolName || hookInput.tool_name || '';
118
+
119
+ // Merge stdin data into prompt resolution: prefer stdin fields, then env, then argv.
120
+ // `toolInput` is an object (e.g. {command:"ls"}) — it's truthy but not a string,
121
+ // so falling back to it directly bound `prompt` to the object and tripped
122
+ // `.toLowerCase()` / `.substring()` on every Bash hook (#1944). Use the
123
+ // `.command` field instead, which is the actual string the hook needs.
124
+ const prompt = hookInput.prompt || hookInput.command || toolInput.command
83
125
  || process.env.PROMPT || process.env.TOOL_INPUT_command || args.join(' ') || '';
84
126
 
85
127
  const handlers = {
@@ -93,39 +135,15 @@ const handlers = {
93
135
  }
94
136
  if (router && router.routeTask) {
95
137
  const result = router.routeTask(prompt);
96
- // Format output for Claude Code hook consumption
138
+ // Format output for Claude Code hook consumption — real data only
97
139
  const output = [
98
140
  `[INFO] Routing task: ${prompt.substring(0, 80) || '(no prompt)'}`,
99
141
  '',
100
- 'Routing Method',
101
- ' - Method: keyword',
102
- ' - Backend: keyword matching',
103
- ` - Latency: ${(Math.random() * 0.5 + 0.1).toFixed(3)}ms`,
104
- ' - Matched Pattern: keyword-fallback',
105
- '',
106
- 'Semantic Matches:',
107
- ' bugfix-task: 15.0%',
108
- ' devops-task: 14.0%',
109
- ' testing-task: 13.0%',
110
- '',
111
142
  '+------------------- Primary Recommendation -------------------+',
112
143
  `| Agent: ${result.agent.padEnd(53)}|`,
113
144
  `| Confidence: ${(result.confidence * 100).toFixed(1)}%${' '.repeat(44)}|`,
114
- `| Reason: ${result.reason.substring(0, 53).padEnd(53)}|`,
145
+ `| Reason: ${(result.reason || '').substring(0, 53).padEnd(53)}|`,
115
146
  '+--------------------------------------------------------------+',
116
- '',
117
- 'Alternative Agents',
118
- '+------------+------------+-------------------------------------+',
119
- '| Agent Type | Confidence | Reason |',
120
- '+------------+------------+-------------------------------------+',
121
- '| researcher | 60.0% | Alternative agent for researcher... |',
122
- '| tester | 50.0% | Alternative agent for tester cap... |',
123
- '+------------+------------+-------------------------------------+',
124
- '',
125
- 'Estimated Metrics',
126
- ' - Success Probability: 70.0%',
127
- ' - Estimated Duration: 10-30 min',
128
- ' - Complexity: LOW',
129
147
  ];
130
148
  console.log(output.join('\n'));
131
149
  } else {
@@ -134,8 +152,12 @@ const handlers = {
134
152
  },
135
153
 
136
154
  'pre-bash': () => {
137
- // Basic command safety check — prefer stdin command data from Claude Code
138
- const cmd = (hookInput.command || prompt).toLowerCase();
155
+ // Basic command safety check — prefer stdin command data from Claude Code.
156
+ // String() wrap is belt-and-suspenders for #2017: even if a future regression
157
+ // re-binds `prompt` or `hookInput.command` to a non-string, `.toLowerCase()`
158
+ // can no longer throw a TypeError that the global try/catch would swallow
159
+ // (silently exiting 0 and letting the dangerous command through).
160
+ const cmd = String(hookInput.command || toolInput.command || prompt || '').toLowerCase();
139
161
  const dangerous = ['rm -rf /', 'format c:', 'del /s /q c:\\', ':(){:|:&};:'];
140
162
  for (const d of dangerous) {
141
163
  if (cmd.includes(d)) {
@@ -154,7 +176,7 @@ const handlers = {
154
176
  // Record edit for intelligence consolidation — prefer stdin data from Claude Code
155
177
  if (intelligence && intelligence.recordEdit) {
156
178
  try {
157
- const file = hookInput.file_path || (hookInput.toolInput && hookInput.toolInput.file_path)
179
+ const file = hookInput.file_path || toolInput.file_path
158
180
  || process.env.TOOL_INPUT_file_path || args[0] || '';
159
181
  intelligence.recordEdit(file);
160
182
  } catch (e) { /* non-fatal */ }
@@ -162,7 +184,7 @@ const handlers = {
162
184
  console.log('[OK] Edit recorded');
163
185
  },
164
186
 
165
- 'session-restore': () => {
187
+ 'session-restore': async () => {
166
188
  if (session) {
167
189
  // Try restore first, fall back to start
168
190
  const existing = session.restore && session.restore();
@@ -186,26 +208,22 @@ const handlers = {
186
208
  console.log('| Memory Entries | 0 |');
187
209
  console.log('+----------------+-------+');
188
210
  }
189
- // Initialize intelligence graph after session restore
211
+ // Initialize intelligence graph after session restore (with timeout — #1530)
190
212
  if (intelligence && intelligence.init) {
191
- try {
192
- const result = intelligence.init();
193
- if (result && result.nodes > 0) {
194
- console.log(`[INTELLIGENCE] Loaded ${result.nodes} patterns, ${result.edges} edges`);
195
- }
196
- } catch (e) { /* non-fatal */ }
213
+ const initResult = await runWithTimeout(() => intelligence.init(), 'intelligence.init()');
214
+ if (initResult && initResult.nodes > 0) {
215
+ console.log(`[INTELLIGENCE] Loaded ${initResult.nodes} patterns, ${initResult.edges} edges`);
216
+ }
197
217
  }
198
218
  },
199
219
 
200
- 'session-end': () => {
201
- // Consolidate intelligence before ending session
220
+ 'session-end': async () => {
221
+ // Consolidate intelligence before ending session (with timeout — #1530)
202
222
  if (intelligence && intelligence.consolidate) {
203
- try {
204
- const result = intelligence.consolidate();
205
- if (result && result.entries > 0) {
206
- console.log(`[INTELLIGENCE] Consolidated: ${result.entries} entries, ${result.edges} edges${result.newEntries > 0 ? `, ${result.newEntries} new` : ''}, PageRank recomputed`);
207
- }
208
- } catch (e) { /* non-fatal */ }
223
+ const consResult = await runWithTimeout(() => intelligence.consolidate(), 'intelligence.consolidate()');
224
+ if (consResult && consResult.entries > 0) {
225
+ console.log(`[INTELLIGENCE] Consolidated: ${consResult.entries} entries, ${consResult.edges} edges${consResult.newEntries > 0 ? `, ${consResult.newEntries} new` : ''}, PageRank recomputed`);
226
+ }
209
227
  }
210
228
  if (session && session.end) {
211
229
  session.end();
@@ -249,7 +267,7 @@ const handlers = {
249
267
  // Execute the handler
250
268
  if (command && handlers[command]) {
251
269
  try {
252
- handlers[command]();
270
+ await Promise.resolve(handlers[command]());
253
271
  } catch (e) {
254
272
  // Hooks should never crash Claude Code - fail silently
255
273
  console.log(`[WARN] Hook ${command} encountered an error: ${e.message}`);
@@ -267,5 +285,6 @@ const handlers = {
267
285
  process.exitCode = 0;
268
286
  main().catch((e) => {
269
287
  try { console.log(`[WARN] Hook handler error: ${e.message}`); } catch (_) {}
270
- process.exitCode = 0;
288
+ }).finally(() => {
289
+ process.exit(0);
271
290
  });
@@ -25,6 +25,10 @@ const PENDING_PATH = path.join(DATA_DIR, 'pending-insights.jsonl');
25
25
  const SESSION_DIR = path.join(process.cwd(), '.claude-flow', 'sessions');
26
26
  const SESSION_FILE = path.join(SESSION_DIR, 'current.json');
27
27
 
28
+ // ── Safety limits (fixes #1530, #1531) ─────────────────────────────────────
29
+ const MAX_DATA_FILE_SIZE = 10 * 1024 * 1024; // 10 MB — skip files larger than this
30
+ const MAX_GRAPH_NODES = 5000; // skip PageRank if graph exceeds this
31
+
28
32
  // ── Stop words for trigram matching ──────────────────────────────────────────
29
33
 
30
34
  const STOP_WORDS = new Set([
@@ -46,6 +50,14 @@ function ensureDataDir() {
46
50
  }
47
51
 
48
52
  function readJSON(filePath) {
53
+ // Safety: skip files exceeding MAX_DATA_FILE_SIZE (#1531)
54
+ try {
55
+ const stat = fs.statSync(filePath);
56
+ if (stat.size > MAX_DATA_FILE_SIZE) {
57
+ process.stderr.write("[INTELLIGENCE] WARN: Skipping " + path.basename(filePath) + " (" + Math.round(stat.size / 1048576) + "MB exceeds 10MB limit)\n");
58
+ return null;
59
+ }
60
+ } catch { /* file may not exist yet */ }
49
61
  try {
50
62
  if (fs.existsSync(filePath)) return JSON.parse(fs.readFileSync(filePath, 'utf-8'));
51
63
  } catch { /* corrupt file — start fresh */ }
@@ -80,6 +92,63 @@ function jaccardSimilarity(setA, setB) {
80
92
  return intersection / (setA.size + setB.size - intersection);
81
93
  }
82
94
 
95
+ // ── Deduplication helper (fixes #1518) ──────────────────────────────────────
96
+
97
+ function deduplicateById(entries) {
98
+ if (!entries || !Array.isArray(entries)) return entries;
99
+ const seen = new Map();
100
+ for (const entry of entries) {
101
+ const id = entry.id || entry.key;
102
+ if (id) {
103
+ seen.set(id, entry);
104
+ } else {
105
+ seen.set(`__no_id_${seen.size}`, entry);
106
+ }
107
+ }
108
+ return Array.from(seen.values());
109
+ }
110
+
111
+ // ADR-095 G6 — content-hash dedup. The April audit measured 5,706 entries
112
+ // in the auto-memory store with only ~20 unique by content; 5,686 dupes
113
+ // were the same MEMORY.md sections imported from sibling project dirs
114
+ // with different IDs. deduplicateById can't catch these (the IDs really
115
+ // are different); we need a content fingerprint.
116
+ //
117
+ // Fast non-cryptographic fingerprint — collisions on 64-bit FNV-1a are
118
+ // vanishingly rare for human prose at the scale of an auto-memory store.
119
+ // Whitespace-normalized so trivially-different formatting doesn't bypass dedup.
120
+ function fingerprintContent(text) {
121
+ if (typeof text !== 'string' || text.length === 0) return '0';
122
+ const norm = text.replace(/\s+/g, ' ').trim().toLowerCase();
123
+ // FNV-1a 64-bit (split into 32-bit halves to stay within Number safe int)
124
+ let h1 = 0x811c9dc5, h2 = 0xcbf29ce4;
125
+ for (let i = 0; i < norm.length; i++) {
126
+ const c = norm.charCodeAt(i);
127
+ h1 ^= c; h1 = Math.imul(h1, 0x01000193) >>> 0;
128
+ h2 ^= c; h2 = Math.imul(h2, 0x100000001b3 & 0xffffffff) >>> 0;
129
+ }
130
+ return `${h1.toString(16)}_${h2.toString(16)}_${norm.length}`;
131
+ }
132
+
133
+ function deduplicateByContent(entries) {
134
+ if (!entries || !Array.isArray(entries)) return entries;
135
+ const seen = new Map();
136
+ for (const entry of entries) {
137
+ const content = entry.content || entry.summary || entry.value || '';
138
+ const fp = fingerprintContent(typeof content === 'string' ? content : JSON.stringify(content));
139
+ if (!seen.has(fp)) {
140
+ seen.set(fp, entry);
141
+ } else {
142
+ // Keep the entry with the higher accessCount or earlier createdAt
143
+ const existing = seen.get(fp);
144
+ const existingAccess = existing.accessCount || 0;
145
+ const candidateAccess = entry.accessCount || 0;
146
+ if (candidateAccess > existingAccess) seen.set(fp, entry);
147
+ }
148
+ }
149
+ return Array.from(seen.values());
150
+ }
151
+
83
152
  // ── Session state helpers ────────────────────────────────────────────────────
84
153
 
85
154
  function sessionGet(key) {
@@ -189,14 +258,24 @@ function buildEdges(entries) {
189
258
  }
190
259
  }
191
260
 
192
- // Similarity edges within categories (Jaccard > 0.3)
261
+ // Similarity edges within categories (Jaccard > 0.3).
262
+ // ADR-095 G6 perf: hoist the trigram computation outside the inner
263
+ // loop. Previously we re-tokenized + re-trigrammed group[j] for every
264
+ // i — O(n²) extra work for nothing. Now compute once per entry.
193
265
  for (const cat of Object.keys(byCategory)) {
194
266
  const group = byCategory[cat];
267
+ if (group.length < 2) continue;
268
+
269
+ // Cache trigram sets for every entry in the group.
270
+ const triCache = new Array(group.length);
195
271
  for (let i = 0; i < group.length; i++) {
196
- const triA = trigrams(tokenize(group[i].content || group[i].summary || ''));
272
+ triCache[i] = trigrams(tokenize(group[i].content || group[i].summary || ''));
273
+ }
274
+
275
+ for (let i = 0; i < group.length; i++) {
276
+ const triA = triCache[i];
197
277
  for (let j = i + 1; j < group.length; j++) {
198
- const triB = trigrams(tokenize(group[j].content || group[j].summary || ''));
199
- const sim = jaccardSimilarity(triA, triB);
278
+ const sim = jaccardSimilarity(triA, triCache[j]);
200
279
  if (sim > 0.3) {
201
280
  edges.push({
202
281
  sourceId: group[i].id,
@@ -236,15 +315,17 @@ function bootstrapFromMemoryFiles() {
236
315
  for (const base of candidates) {
237
316
  if (!fs.existsSync(base)) continue;
238
317
 
239
- // For the projects dir, scan subdirectories for memory/
318
+ // For the projects dir, scope to CURRENT project only (not all 51+ dirs)
240
319
  if (base.endsWith('projects')) {
241
320
  try {
242
- const projectDirs = fs.readdirSync(base);
243
- for (const pdir of projectDirs) {
244
- const memDir = path.join(base, pdir, 'memory');
245
- if (fs.existsSync(memDir)) {
246
- parseMemoryDir(memDir, entries);
247
- }
321
+ // Match Claude Code's project-dir slug: every non-alphanumeric char -> '-'
322
+ // (e.g. "G:\\My Drive\\TJ_Vault" -> "G--My-Drive-TJ-Vault"). The old version
323
+ // only handled POSIX '/', so on Windows the slug kept ':' and '\\' and never
324
+ // matched the real <projects>/<slug>/memory dir — bootstrap found nothing (FIX 5).
325
+ const projectSlug = cwd.replace(/[^a-zA-Z0-9]/g, '-');
326
+ const memDir = path.join(base, projectSlug, 'memory');
327
+ if (fs.existsSync(memDir)) {
328
+ parseMemoryDir(memDir, entries);
248
329
  }
249
330
  } catch { /* skip */ }
250
331
  } else if (fs.existsSync(base)) {
@@ -255,6 +336,16 @@ function bootstrapFromMemoryFiles() {
255
336
  return entries;
256
337
  }
257
338
 
339
+ // Truncation transparency (FIX 4): mark the cut with an ellipsis and warn under
340
+ // debug, so later reasoning isn't silently built on severed text.
341
+ const CLIP_DEBUG = !!(process.env.RUFLO_DEBUG || process.env.DEBUG);
342
+ function clip(text, max, label) {
343
+ text = text == null ? '' : String(text);
344
+ if (text.length <= max) return text;
345
+ if (CLIP_DEBUG) process.stderr.write(`[INTELLIGENCE] WARN: truncated ${label || 'value'} from ${text.length} to ${max} chars\n`);
346
+ return text.slice(0, max - 1) + '…';
347
+ }
348
+
258
349
  function parseMemoryDir(dir, entries) {
259
350
  try {
260
351
  const files = fs.readdirSync(dir).filter(f => f.endsWith('.md'));
@@ -265,17 +356,18 @@ function parseMemoryDir(dir, entries) {
265
356
 
266
357
  // Parse markdown sections as separate entries
267
358
  const sections = content.split(/^##?\s+/m).filter(Boolean);
268
- for (const section of sections) {
359
+ for (let sIdx = 0; sIdx < sections.length; sIdx++) {
360
+ const section = sections[sIdx];
269
361
  const lines = section.trim().split('\n');
270
362
  const title = lines[0].trim();
271
363
  const body = lines.slice(1).join('\n').trim();
272
364
  if (!body || body.length < 10) continue;
273
365
 
274
- const id = `mem-${file.replace('.md', '')}-${title.replace(/[^a-z0-9]/gi, '-').toLowerCase().slice(0, 30)}`;
366
+ const id = `mem-${file.replace('.md', '')}-${title.replace(/[^a-z0-9]/gi, '-').toLowerCase().slice(0, 30)}-${sIdx}`;
275
367
  entries.push({
276
368
  id,
277
369
  key: title.toLowerCase().replace(/[^a-z0-9]+/g, '-').slice(0, 50),
278
- content: body.slice(0, 500),
370
+ content: clip(body, 500, 'memory content'),
279
371
  summary: title,
280
372
  namespace: file === 'MEMORY.md' ? 'core' : file.replace('.md', ''),
281
373
  type: 'semantic',
@@ -312,8 +404,27 @@ function init() {
312
404
  }
313
405
  }
314
406
 
407
+ // Deduplicate store entries by ID (fixes #1518 — 194MB → ~79KB)
408
+ let deduped = deduplicateById(store);
409
+ // ADR-095 G6: also dedupe by content fingerprint. The April audit
410
+ // measured 5,706 entries with only ~20 unique by content because the
411
+ // same MEMORY.md sections get imported from sibling project dirs with
412
+ // different IDs. deduplicateById can't catch that; deduplicateByContent
413
+ // can. Cuts the graph from O(n²) over near-identical duplicates down
414
+ // to O(unique²), which is the difference between a 100MB graph-state
415
+ // and a kilobytes-scale one for typical workloads.
416
+ const beforeContentDedup = deduped.length;
417
+ deduped = deduplicateByContent(deduped);
418
+ if (deduped.length < store.length) {
419
+ process.stderr.write(
420
+ `[INTELLIGENCE] Deduped store: ${store.length} -> ${deduped.length} entries ` +
421
+ `(by-id: ${store.length - beforeContentDedup} dropped, by-content: ${beforeContentDedup - deduped.length} dropped)\n`
422
+ );
423
+ writeJSON(STORE_PATH, deduped);
424
+ }
425
+
315
426
  // Skip rebuild if graph is fresh and store hasn't changed
316
- if (graphState && graphState.nodeCount === store.length) {
427
+ if (graphState && graphState.nodeCount === deduped.length) {
317
428
  const age = Date.now() - (graphState.updatedAt || 0);
318
429
  if (age < 60000) {
319
430
  return {
@@ -324,9 +435,9 @@ function init() {
324
435
  }
325
436
  }
326
437
 
327
- // Build nodes
438
+ // Build nodes from deduped entries
328
439
  const nodes = {};
329
- for (const entry of store) {
440
+ for (const entry of deduped) {
330
441
  const id = entry.id || entry.key || `entry-${Math.random().toString(36).slice(2, 8)}`;
331
442
  nodes[id] = {
332
443
  id,
@@ -340,10 +451,17 @@ function init() {
340
451
  }
341
452
 
342
453
  // Build edges
343
- const edges = buildEdges(store);
344
-
345
- // Compute PageRank
346
- const pageRanks = computePageRank(nodes, edges, 0.85, 30);
454
+ const edges = buildEdges(deduped);
455
+
456
+ // Compute PageRank (skip if graph too large — #1531)
457
+ const nodeCount = Object.keys(nodes).length;
458
+ let pageRanks = {};
459
+ if (nodeCount > MAX_GRAPH_NODES) {
460
+ process.stderr.write("[INTELLIGENCE] WARN: Graph has " + nodeCount + " nodes (>" + MAX_GRAPH_NODES + "), skipping PageRank\n");
461
+ for (const id of Object.keys(nodes)) pageRanks[id] = 1 / nodeCount;
462
+ } else {
463
+ pageRanks = computePageRank(nodes, edges, 0.85, 30);
464
+ }
347
465
 
348
466
  // Write graph state
349
467
  const graph = {
@@ -357,7 +475,7 @@ function init() {
357
475
  writeJSON(GRAPH_PATH, graph);
358
476
 
359
477
  // Build ranked context for fast lookup
360
- const rankedEntries = store.map(entry => {
478
+ const rankedEntries = deduped.map(entry => {
361
479
  const id = entry.id;
362
480
  const content = entry.content || entry.value || '';
363
481
  const summary = entry.summary || entry.key || '';
@@ -515,11 +633,15 @@ function boostConfidence(ids, amount) {
515
633
  function consolidate() {
516
634
  ensureDataDir();
517
635
 
518
- const store = readJSON(STORE_PATH);
636
+ let store = readJSON(STORE_PATH);
519
637
  if (!store || !Array.isArray(store)) {
520
638
  return { entries: 0, edges: 0, newEntries: 0, message: 'No store to consolidate' };
521
639
  }
522
640
 
641
+ // Deduplicate store entries by ID before processing (fixes #1518)
642
+ const preDedupCount = store.length;
643
+ store = deduplicateById(store);
644
+
523
645
  // 1. Process pending insights
524
646
  let newEntries = 0;
525
647
  if (fs.existsSync(PENDING_PATH)) {
@@ -595,8 +717,15 @@ function consolidate() {
595
717
  };
596
718
  }
597
719
 
598
- // 5. Recompute PageRank
599
- const pageRanks = computePageRank(nodes, edges, 0.85, 30);
720
+ // 5. Recompute PageRank (skip if graph too large — #1531)
721
+ const nodeCount = Object.keys(nodes).length;
722
+ let pageRanks = {};
723
+ if (nodeCount > MAX_GRAPH_NODES) {
724
+ process.stderr.write("[INTELLIGENCE] WARN: Graph has " + nodeCount + " nodes (>" + MAX_GRAPH_NODES + "), skipping PageRank in consolidate\n");
725
+ for (const id of Object.keys(nodes)) pageRanks[id] = 1 / nodeCount;
726
+ } else {
727
+ pageRanks = computePageRank(nodes, edges, 0.85, 30);
728
+ }
600
729
 
601
730
  // 6. Write updated graph
602
731
  writeJSON(GRAPH_PATH, {
@@ -636,8 +765,8 @@ function consolidate() {
636
765
  entries: rankedEntries,
637
766
  });
638
767
 
639
- // 8. Persist updated store (with new insight entries)
640
- if (newEntries > 0) writeJSON(STORE_PATH, store);
768
+ // 8. Persist updated store (deduped or with new insight entries)
769
+ if (newEntries > 0 || store.length < preDedupCount) writeJSON(STORE_PATH, store);
641
770
 
642
771
  // 9. Save snapshot for delta tracking
643
772
  const updatedGraph = readJSON(GRAPH_PATH);
@@ -8,7 +8,7 @@ COMMIT_MSG=$(git log -1 --pretty=%B)
8
8
  echo "📊 Recording commit metrics..."
9
9
 
10
10
  # Notify claude-flow of commit
11
- npx --no-install ruflo hooks notify \
11
+ npx @claude-flow/cli hooks notify \
12
12
  --message "Commit: $COMMIT_MSG" \
13
13
  --level info \
14
14
  --metadata '{"hash": "'$COMMIT_HASH'"}' 2>/dev/null || true
@@ -13,7 +13,7 @@ STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM)
13
13
  for FILE in $STAGED_FILES; do
14
14
  if [[ "$FILE" =~ \.(ts|js|tsx|jsx)$ ]]; then
15
15
  echo " Validating: $FILE"
16
- npx --no-install ruflo hooks pre-edit --file "$FILE" --validate-syntax 2>/dev/null || true
16
+ npx @claude-flow/cli hooks pre-edit --file "$FILE" --validate-syntax 2>/dev/null || true
17
17
  fi
18
18
  done
19
19
 
@@ -5,15 +5,15 @@ echo "🚀 Claude Flow Quick Start"
5
5
  echo "=========================="
6
6
  echo ""
7
7
  echo "1. Initialize a swarm:"
8
- echo " npx ruflo swarm init --topology hierarchical"
8
+ echo " npx claude-flow swarm init --topology hierarchical"
9
9
  echo ""
10
10
  echo "2. Spawn agents:"
11
- echo " npx ruflo agent spawn --type coder --name "API Developer""
11
+ echo " npx claude-flow agent spawn --type coder --name "API Developer""
12
12
  echo ""
13
13
  echo "3. Orchestrate tasks:"
14
- echo " npx ruflo task orchestrate --task "Build REST API""
14
+ echo " npx claude-flow task orchestrate --task "Build REST API""
15
15
  echo ""
16
16
  echo "4. Monitor progress:"
17
- echo " npx ruflo swarm monitor"
17
+ echo " npx claude-flow swarm monitor"
18
18
  echo ""
19
19
  echo "📚 For more examples, see .claude/commands/"
@@ -1,7 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
3
  * Claude Flow Agent Router
4
- * Routes tasks to optimal agents based on learned patterns
4
+ *
5
+ * Static keyword router that suggests an agent for a task description.
6
+ * NOTE: This is *not* a learned model. It is a heuristic table; "confidence"
7
+ * is reported as a heuristic prior, not a calibrated probability.
8
+ *
9
+ * #2257 fix: patterns are now word-boundary-anchored so short tokens like
10
+ * `cd`, `ci`, `ui`, `add`, `structure` no longer match inside unrelated
11
+ * words (`decision`, `infrastructure`, `address`, `addendum`). Default
12
+ * confidence dropped from 0.8 to 0.6 to better reflect that this is a
13
+ * static heuristic, not a learned classifier.
5
14
  */
6
15
 
7
16
  const AGENT_CAPABILITIES = {
@@ -15,52 +24,82 @@ const AGENT_CAPABILITIES = {
15
24
  devops: ['ci-cd', 'docker', 'deployment', 'infrastructure'],
16
25
  };
17
26
 
18
- const TASK_PATTERNS = {
27
+ // Each entry is an array of tokens. Tokens are alternation-friendly:
28
+ // - multi-word phrases ("unit test") match as phrases
29
+ // - single tokens are wrapped with \b … \b word boundaries at match time
30
+ const TASK_PATTERNS = [
19
31
  // Code patterns
20
- 'implement|create|build|add|write code': 'coder',
21
- 'test|spec|coverage|unit test|integration': 'tester',
22
- 'review|audit|check|validate|security': 'reviewer',
23
- 'research|find|search|documentation|explore': 'researcher',
24
- 'design|architect|structure|plan': 'architect',
32
+ { tokens: ['implement', 'create', 'build', 'add', 'write code', 'refactor', 'debug'], agent: 'coder' },
33
+ { tokens: ['test', 'tests', 'spec', 'coverage', 'unit test', 'integration test'], agent: 'tester' },
34
+ { tokens: ['review', 'audit', 'check', 'validate', 'security'], agent: 'reviewer' },
35
+ { tokens: ['research', 'find', 'search', 'documentation', 'explore'], agent: 'researcher' },
36
+ { tokens: ['design', 'architect', 'architecture', 'structure', 'plan'], agent: 'architect' },
25
37
 
26
38
  // Domain patterns
27
- 'api|endpoint|server|backend|database': 'backend-dev',
28
- 'ui|frontend|component|react|css|style': 'frontend-dev',
29
- 'deploy|docker|ci|cd|pipeline|infrastructure': 'devops',
30
- };
39
+ { tokens: ['api', 'endpoint', 'server', 'backend', 'database'], agent: 'backend-dev' },
40
+ { tokens: ['ui', 'frontend', 'component', 'react', 'css', 'style'], agent: 'frontend-dev' },
41
+ // 'cd' / 'ci' are kept but require word boundaries via \b — they will not
42
+ // match inside "decision" or "specific". 'cd' as a literal command in a
43
+ // task description ("set up cd pipeline") still matches.
44
+ { tokens: ['deploy', 'docker', 'ci', 'cd', 'ci/cd', 'pipeline', 'infrastructure', 'devops'], agent: 'devops' },
45
+ ];
46
+
47
+ function escapeRegex(s) {
48
+ return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
49
+ }
50
+
51
+ // Build an anchored alternation regex from a token list.
52
+ // - multi-word phrases (containing whitespace or '/') match literally
53
+ // - single tokens are wrapped with \b boundaries so 'cd' won't match "decide"
54
+ function buildPattern(tokens) {
55
+ const alternatives = tokens.map((tok) => {
56
+ const escaped = escapeRegex(tok.toLowerCase());
57
+ if (/\s|\//.test(tok)) {
58
+ // Phrase: whitespace/'/' on each side acts as a natural boundary
59
+ return escaped;
60
+ }
61
+ return `\\b${escaped}\\b`;
62
+ });
63
+ return new RegExp(`(?:${alternatives.join('|')})`, 'i');
64
+ }
65
+
66
+ const COMPILED_PATTERNS = TASK_PATTERNS.map((entry) => ({
67
+ agent: entry.agent,
68
+ tokens: entry.tokens,
69
+ regex: buildPattern(entry.tokens),
70
+ }));
31
71
 
32
72
  function routeTask(task) {
33
- const taskLower = task.toLowerCase();
73
+ const taskLower = String(task ?? '').toLowerCase();
34
74
 
35
- // Check patterns
36
- for (const [pattern, agent] of Object.entries(TASK_PATTERNS)) {
37
- const regex = new RegExp(pattern, 'i');
38
- if (regex.test(taskLower)) {
75
+ for (const entry of COMPILED_PATTERNS) {
76
+ if (entry.regex.test(taskLower)) {
39
77
  return {
40
- agent,
41
- confidence: 0.8,
42
- reason: `Matched pattern: ${pattern}`,
78
+ agent: entry.agent,
79
+ // Heuristic prior, not a learned probability — see file header.
80
+ confidence: 0.6,
81
+ reason: `Matched keyword(s) from: ${entry.tokens.join('|')}`,
43
82
  };
44
83
  }
45
84
  }
46
85
 
47
- // Default to coder for unknown tasks
48
86
  return {
49
87
  agent: 'coder',
50
- confidence: 0.5,
51
- reason: 'Default routing - no specific pattern matched',
88
+ confidence: 0.3,
89
+ reason: 'Default routing - no specific keyword matched',
52
90
  };
53
91
  }
54
92
 
55
93
  // CLI
56
- const task = process.argv.slice(2).join(' ');
57
-
58
- if (task) {
59
- const result = routeTask(task);
60
- console.log(JSON.stringify(result, null, 2));
61
- } else {
62
- console.log('Usage: router.js <task description>');
63
- console.log('\nAvailable agents:', Object.keys(AGENT_CAPABILITIES).join(', '));
94
+ if (require.main === module) {
95
+ const task = process.argv.slice(2).join(' ');
96
+ if (task) {
97
+ const result = routeTask(task);
98
+ console.log(JSON.stringify(result, null, 2));
99
+ } else {
100
+ console.log('Usage: router.js <task description>');
101
+ console.log('\nAvailable agents:', Object.keys(AGENT_CAPABILITIES).join(', '));
102
+ }
64
103
  }
65
104
 
66
- module.exports = { routeTask, AGENT_CAPABILITIES, TASK_PATTERNS };
105
+ module.exports = { routeTask, AGENT_CAPABILITIES, TASK_PATTERNS, buildPattern };