agentic-qe 3.11.0 → 3.11.2

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 (470) hide show
  1. package/.claude/commands/agents/README.md +50 -0
  2. package/.claude/commands/agents/agent-capabilities.md +140 -0
  3. package/.claude/commands/agents/agent-coordination.md +28 -0
  4. package/.claude/commands/agents/agent-spawning.md +28 -0
  5. package/.claude/commands/agents/agent-types.md +216 -0
  6. package/.claude/commands/agents/health.md +139 -0
  7. package/.claude/commands/agents/list.md +100 -0
  8. package/.claude/commands/agents/logs.md +130 -0
  9. package/.claude/commands/agents/metrics.md +122 -0
  10. package/.claude/commands/agents/pool.md +127 -0
  11. package/.claude/commands/agents/spawn.md +140 -0
  12. package/.claude/commands/agents/status.md +115 -0
  13. package/.claude/commands/agents/stop.md +102 -0
  14. package/.claude/commands/claude-flow-help.md +1 -1
  15. package/.claude/commands/coordination/README.md +9 -0
  16. package/.claude/commands/coordination/agent-spawn.md +25 -0
  17. package/.claude/commands/coordination/init.md +44 -0
  18. package/.claude/commands/coordination/orchestrate.md +43 -0
  19. package/.claude/commands/coordination/spawn.md +45 -0
  20. package/.claude/commands/coordination/swarm-init.md +85 -0
  21. package/.claude/commands/coordination/task-orchestrate.md +25 -0
  22. package/.claude/commands/github/code-review-swarm.md +1 -1
  23. package/.claude/commands/github/issue-tracker.md +3 -3
  24. package/.claude/commands/github/release-manager.md +5 -3
  25. package/.claude/commands/github/release-swarm.md +1 -1
  26. package/.claude/commands/github/repo-architect.md +2 -2
  27. package/.claude/commands/github/swarm-issue.md +4 -1
  28. package/.claude/commands/github/swarm-pr.md +6 -3
  29. package/.claude/commands/github/sync-coordinator.md +3 -1
  30. package/.claude/commands/github/workflow-automation.md +2 -2
  31. package/.claude/commands/hive-mind/README.md +17 -0
  32. package/.claude/commands/hive-mind/hive-mind-consensus.md +8 -0
  33. package/.claude/commands/hive-mind/hive-mind-init.md +18 -0
  34. package/.claude/commands/hive-mind/hive-mind-memory.md +8 -0
  35. package/.claude/commands/hive-mind/hive-mind-metrics.md +8 -0
  36. package/.claude/commands/hive-mind/hive-mind-resume.md +8 -0
  37. package/.claude/commands/hive-mind/hive-mind-sessions.md +8 -0
  38. package/.claude/commands/hive-mind/hive-mind-spawn.md +21 -0
  39. package/.claude/commands/hive-mind/hive-mind-status.md +8 -0
  40. package/.claude/commands/hive-mind/hive-mind-stop.md +8 -0
  41. package/.claude/commands/hive-mind/hive-mind-wizard.md +8 -0
  42. package/.claude/commands/hive-mind/hive-mind.md +27 -0
  43. package/.claude/commands/memory/README.md +9 -0
  44. package/.claude/commands/memory/memory-persist.md +25 -0
  45. package/.claude/commands/memory/memory-search.md +25 -0
  46. package/.claude/commands/memory/memory-usage.md +25 -0
  47. package/.claude/commands/memory/neural.md +47 -0
  48. package/.claude/commands/swarm/README.md +15 -0
  49. package/.claude/commands/swarm/analysis.md +95 -0
  50. package/.claude/commands/swarm/development.md +96 -0
  51. package/.claude/commands/swarm/examples.md +168 -0
  52. package/.claude/commands/swarm/maintenance.md +102 -0
  53. package/.claude/commands/swarm/optimization.md +117 -0
  54. package/.claude/commands/swarm/research.md +136 -0
  55. package/.claude/commands/swarm/swarm-analysis.md +8 -0
  56. package/.claude/commands/swarm/swarm-background.md +8 -0
  57. package/.claude/commands/swarm/swarm-init.md +19 -0
  58. package/.claude/commands/swarm/swarm-modes.md +8 -0
  59. package/.claude/commands/swarm/swarm-monitor.md +8 -0
  60. package/.claude/commands/swarm/swarm-spawn.md +19 -0
  61. package/.claude/commands/swarm/swarm-status.md +8 -0
  62. package/.claude/commands/swarm/swarm-strategies.md +8 -0
  63. package/.claude/commands/swarm/swarm.md +87 -0
  64. package/.claude/commands/swarm/testing.md +131 -0
  65. package/.claude/commands/workflows/README.md +9 -0
  66. package/.claude/commands/workflows/development.md +78 -0
  67. package/.claude/commands/workflows/research.md +63 -0
  68. package/.claude/commands/workflows/workflow-create.md +25 -0
  69. package/.claude/commands/workflows/workflow-execute.md +25 -0
  70. package/.claude/commands/workflows/workflow-export.md +25 -0
  71. package/.claude/helpers/auto-commit.sh +1 -1
  72. package/.claude/helpers/auto-memory-hook.mjs +37 -4
  73. package/.claude/helpers/github-safe.js +90 -40
  74. package/.claude/helpers/github-setup.sh +30 -13
  75. package/.claude/helpers/hook-handler.cjs +68 -49
  76. package/.claude/helpers/intelligence.cjs +156 -27
  77. package/.claude/helpers/post-commit +1 -1
  78. package/.claude/helpers/pre-commit +1 -1
  79. package/.claude/helpers/quick-start.sh +4 -4
  80. package/.claude/helpers/router.js +70 -31
  81. package/.claude/helpers/ruflo-hook.cjs +59 -0
  82. package/.claude/helpers/session.js +28 -6
  83. package/.claude/helpers/setup-mcp.sh +3 -3
  84. package/.claude/helpers/statusline.cjs +584 -468
  85. package/.claude/helpers/statusline.js +47 -11
  86. package/.claude/skills/github-code-review/SKILL.md +2 -17
  87. package/.claude/skills/github-multi-repo/SKILL.md +4 -16
  88. package/.claude/skills/github-project-management/SKILL.md +18 -33
  89. package/.claude/skills/github-release-management/SKILL.md +4 -21
  90. package/.claude/skills/github-workflow-automation/SKILL.md +8 -26
  91. package/.claude/skills/pair-programming/SKILL.md +2 -2
  92. package/.claude/skills/qe-code-intelligence/SKILL.md +3 -0
  93. package/.claude/skills/reasoningbank-intelligence/SKILL.md +2 -2
  94. package/.claude/skills/skill-builder/SKILL.md +0 -103
  95. package/.claude/skills/skills-manifest.json +1 -1
  96. package/.claude/skills/sparc-methodology/SKILL.md +2 -11
  97. package/.claude/skills/stream-chain/SKILL.md +0 -3
  98. package/.claude/skills/swarm-advanced/SKILL.md +2 -5
  99. package/.claude/skills/swarm-orchestration/SKILL.md +1 -1
  100. package/.claude/skills/verification-quality/SKILL.md +121 -93
  101. package/CHANGELOG.md +84 -0
  102. package/README.md +1 -0
  103. package/assets/skills/pair-programming/SKILL.md +2 -2
  104. package/assets/skills/qe-code-intelligence/SKILL.md +3 -0
  105. package/assets/skills/verification-quality/SKILL.md +121 -93
  106. package/dist/audit/witness-chain.d.ts +1 -1
  107. package/dist/audit/witness-findings.d.ts +50 -0
  108. package/dist/audit/witness-findings.js +41 -0
  109. package/dist/cli/bundle.js +5 -5
  110. package/dist/cli/chunks/adapter-LDNYC4GH.js +2 -0
  111. package/dist/cli/chunks/{agent-booster-wasm-5CSKQB4O.js → agent-booster-wasm-FNCVODUJ.js} +2 -2
  112. package/dist/cli/chunks/{agent-handler-EBV3OKTE.js → agent-handler-JK7VK37B.js} +2 -2
  113. package/dist/cli/chunks/{agent-memory-branch-RZ53YM2U.js → agent-memory-branch-EPVVJNNA.js} +2 -2
  114. package/dist/cli/chunks/aqe-learning-engine-CA4CT5Q7.js +2 -0
  115. package/dist/cli/chunks/{arena-UCP74DRO.js → arena-EH2IMSRW.js} +4 -4
  116. package/dist/cli/chunks/{arena-QWYTIQ6I.js → arena-NTHVDZTJ.js} +2 -2
  117. package/dist/cli/chunks/{audit-M4FNIX47.js → audit-ODZV2T2B.js} +2 -2
  118. package/dist/cli/chunks/base-TSDAEMT4.js +2 -0
  119. package/dist/cli/chunks/{hnswlib-node-HMZC5TXM.js → better-sqlite3-5JTP47LA.js} +2 -2
  120. package/dist/cli/chunks/{brain-handler-OY6Q2GY5.js → brain-handler-NVB6OJ25.js} +3 -3
  121. package/dist/cli/chunks/{branch-enumerator-TQWN4NIX.js → branch-enumerator-BIXSELMY.js} +2 -2
  122. package/dist/cli/chunks/{browser-2EH3RXJ2.js → browser-S2Y2W33Z.js} +2 -2
  123. package/dist/cli/chunks/browser-workflow-3HCTJBLR.js +2 -0
  124. package/dist/cli/chunks/{chunk-V6WJVFRN.js → chunk-26ZMIYSK.js} +2 -2
  125. package/dist/cli/chunks/{chunk-I2HQLBWG.js → chunk-27KNLVOY.js} +2 -2
  126. package/dist/cli/chunks/{chunk-HNSZDIQU.js → chunk-2Q65LTJN.js} +2 -2
  127. package/dist/cli/chunks/{chunk-SKL225P5.js → chunk-3ATEYGVD.js} +2 -2
  128. package/dist/cli/chunks/{chunk-LTH6XARD.js → chunk-3J3QXLWP.js} +2 -2
  129. package/dist/cli/chunks/{chunk-NQD4CMXC.js → chunk-3KTOM7NN.js} +2 -2
  130. package/dist/cli/chunks/{chunk-QCJ7YOVN.js → chunk-3NCVUFAL.js} +2 -2
  131. package/dist/cli/chunks/{chunk-ZEUUVLS2.js → chunk-42DCMEUM.js} +1 -1
  132. package/dist/cli/chunks/{chunk-2QU6C3OS.js → chunk-4FTVTAMN.js} +2 -2
  133. package/dist/cli/chunks/{chunk-QYXTESM3.js → chunk-4PYJCIRO.js} +2 -2
  134. package/dist/cli/chunks/{chunk-LFT7WYHW.js → chunk-527U4AHC.js} +2 -2
  135. package/dist/cli/chunks/{chunk-VHON5NDM.js → chunk-5AFO7ZZG.js} +3 -3
  136. package/dist/cli/chunks/{chunk-F62ZQZQQ.js → chunk-5BDVFFYF.js} +2 -2
  137. package/dist/cli/chunks/{chunk-KBVXKFDI.js → chunk-5KMGG3QW.js} +4 -4
  138. package/dist/cli/chunks/{chunk-AVKGDS6F.js → chunk-6LQIVIZB.js} +2 -2
  139. package/dist/cli/chunks/{chunk-RKDNLPZM.js → chunk-6SOGYNJG.js} +2 -2
  140. package/dist/cli/chunks/{chunk-RPYYS6BX.js → chunk-6VAFRS5N.js} +2 -2
  141. package/dist/cli/chunks/chunk-72VVTMEL.js +2 -0
  142. package/dist/cli/chunks/{chunk-AURDGQNB.js → chunk-75C5GX7D.js} +2 -2
  143. package/dist/cli/chunks/{chunk-JN3IQB4L.js → chunk-76RO2RHG.js} +1 -1
  144. package/dist/cli/chunks/{chunk-7E5NYLJT.js → chunk-7HYO76F2.js} +2 -2
  145. package/dist/cli/chunks/{chunk-R3YO3Z7I.js → chunk-7KHZZVF2.js} +4 -4
  146. package/dist/cli/chunks/{chunk-G5VE3HQW.js → chunk-7MKF52GT.js} +2 -2
  147. package/dist/cli/chunks/{chunk-TGLEREP5.js → chunk-7VM4ZUHT.js} +2 -2
  148. package/dist/cli/chunks/{chunk-XW5OXBVV.js → chunk-7XIQR6VU.js} +2 -2
  149. package/dist/cli/chunks/{chunk-XKRG2U3V.js → chunk-A4ZDKF5F.js} +1 -1
  150. package/dist/cli/chunks/{chunk-XSG4XKGO.js → chunk-AAVUZVM6.js} +2 -2
  151. package/dist/cli/chunks/{chunk-XVQUVCFR.js → chunk-AINAWVGD.js} +2 -2
  152. package/dist/cli/chunks/{chunk-PUTRXS5I.js → chunk-AK5Q2WCJ.js} +2 -2
  153. package/dist/cli/chunks/{chunk-TYS77XHV.js → chunk-AKZK46TQ.js} +2 -2
  154. package/dist/cli/chunks/{chunk-JQM64WJ2.js → chunk-ARUXFZDY.js} +1 -1
  155. package/dist/cli/chunks/{chunk-YR44KQUK.js → chunk-AYXRT2ND.js} +1 -1
  156. package/dist/cli/chunks/{chunk-ZT4NPTML.js → chunk-AZQ6HDPM.js} +2 -2
  157. package/dist/cli/chunks/{chunk-DCJIXDO6.js → chunk-BGVEBYV4.js} +2 -2
  158. package/dist/cli/chunks/{chunk-IHNBZ5XG.js → chunk-C6UTRG66.js} +2 -2
  159. package/dist/cli/chunks/{chunk-R7FHQQAV.js → chunk-CAUTOCLZ.js} +2 -2
  160. package/dist/cli/chunks/{chunk-N52ZBTPM.js → chunk-CAVBEZV4.js} +2 -2
  161. package/dist/cli/chunks/{chunk-3LP5GPGU.js → chunk-CEMROADY.js} +1 -1
  162. package/dist/cli/chunks/{chunk-IQSPL2H4.js → chunk-CMVNYVKL.js} +2 -2
  163. package/dist/cli/chunks/{chunk-7BD7DZCB.js → chunk-CUDGKSFX.js} +2 -2
  164. package/dist/cli/chunks/{chunk-D3S4SRSA.js → chunk-CZYSCUJ4.js} +2 -2
  165. package/dist/cli/chunks/{chunk-4OTA6KYJ.js → chunk-DMUQV2YU.js} +2 -2
  166. package/dist/cli/chunks/{chunk-KZE5UR4T.js → chunk-DPFLJMEI.js} +3 -3
  167. package/dist/cli/chunks/{chunk-IOQYSR5S.js → chunk-DU4GQKTH.js} +2 -2
  168. package/dist/cli/chunks/{chunk-FMKALHT3.js → chunk-EDH4H55B.js} +2 -2
  169. package/dist/cli/chunks/{chunk-NI7O3GKZ.js → chunk-EIWZDVMT.js} +3 -3
  170. package/dist/cli/chunks/{chunk-5DG6H553.js → chunk-FPZLOVEF.js} +1 -1
  171. package/dist/cli/chunks/{chunk-DV7662EZ.js → chunk-FV53RMVB.js} +1 -1
  172. package/dist/cli/chunks/{chunk-BA4WZIAQ.js → chunk-FYY7OJ6Y.js} +2 -2
  173. package/dist/cli/chunks/{chunk-5ASPEVVF.js → chunk-G4CQBQBV.js} +1 -1
  174. package/dist/cli/chunks/{chunk-GBFAQ4DW.js → chunk-G6LIQFT2.js} +1 -1
  175. package/dist/cli/chunks/{chunk-2WVLFT2I.js → chunk-H3LGBH4Y.js} +1 -1
  176. package/dist/cli/chunks/{chunk-G25YZ7Z6.js → chunk-H4ZPPHOI.js} +2 -2
  177. package/dist/cli/chunks/{chunk-C33BMWYZ.js → chunk-H5TM4KIB.js} +5 -5
  178. package/dist/cli/chunks/{chunk-72QNONO6.js → chunk-H6MBRYA7.js} +2 -2
  179. package/dist/cli/chunks/{chunk-5OJXVVTI.js → chunk-HDBJORV7.js} +2 -2
  180. package/dist/cli/chunks/{chunk-HJFQVKPI.js → chunk-I3AD523O.js} +1 -1
  181. package/dist/cli/chunks/{chunk-2BBKA5J4.js → chunk-I7UWFV6N.js} +1 -1
  182. package/dist/cli/chunks/{chunk-IFTEM672.js → chunk-IMPSB5WW.js} +2 -2
  183. package/dist/cli/chunks/{chunk-YSTWLDVD.js → chunk-IO7ZUP2G.js} +3 -3
  184. package/dist/cli/chunks/{chunk-F6Y7DTHR.js → chunk-IQOCTGA2.js} +2 -2
  185. package/dist/cli/chunks/{chunk-RVQW6CBF.js → chunk-IXYF5BZY.js} +2 -2
  186. package/dist/cli/chunks/{chunk-3J6LYF6I.js → chunk-JC4Z2ADP.js} +2 -2
  187. package/dist/cli/chunks/{chunk-T6KT63NC.js → chunk-JCH2FHJ7.js} +2 -2
  188. package/dist/cli/chunks/{chunk-7PTA7AVW.js → chunk-JDFF2QMZ.js} +1 -1
  189. package/dist/cli/chunks/{chunk-UEH6C5JA.js → chunk-JELN5XTK.js} +1 -1
  190. package/dist/cli/chunks/{chunk-Z45QDDZQ.js → chunk-JSZNI3AO.js} +1 -1
  191. package/dist/cli/chunks/{chunk-ZFP3O5FM.js → chunk-K3YM2Z3E.js} +1 -1
  192. package/dist/cli/chunks/{chunk-X2TUDGFL.js → chunk-K426HTEQ.js} +44 -44
  193. package/dist/cli/chunks/{chunk-GGSXHGWD.js → chunk-K6IQBVD7.js} +2 -2
  194. package/dist/cli/chunks/{chunk-453UDYD2.js → chunk-KEJEZY2R.js} +163 -181
  195. package/dist/cli/chunks/{chunk-MTSMFEWK.js → chunk-KFE6LB4I.js} +2 -2
  196. package/dist/cli/chunks/{chunk-DDQWW22L.js → chunk-KO3WB4SU.js} +2 -2
  197. package/dist/cli/chunks/{chunk-ETGEGMYS.js → chunk-LAY35POY.js} +3 -3
  198. package/dist/cli/chunks/{chunk-P3NV6KN3.js → chunk-LFXXA325.js} +1 -1
  199. package/dist/cli/chunks/{chunk-ZK56THZT.js → chunk-LI3T5YNC.js} +3 -3
  200. package/dist/cli/chunks/{chunk-ACV2WVMX.js → chunk-LIEA5EON.js} +1 -1
  201. package/dist/cli/chunks/{chunk-KOOY72E3.js → chunk-LRJWKFGY.js} +2 -2
  202. package/dist/cli/chunks/{chunk-Y7TBCHW4.js → chunk-LY6PTRVL.js} +2 -2
  203. package/dist/cli/chunks/{chunk-WP6XUSVW.js → chunk-MAXOIEUG.js} +1 -1
  204. package/dist/cli/chunks/{chunk-X2L4POJE.js → chunk-MN6W7ZNL.js} +1 -1
  205. package/dist/cli/chunks/{chunk-CERSTEAJ.js → chunk-NGE5YNKC.js} +2 -2
  206. package/dist/cli/chunks/{chunk-J425SQFE.js → chunk-NIW4CLN2.js} +2 -2
  207. package/dist/cli/chunks/{chunk-PJ4HSXH3.js → chunk-NPT7BYGF.js} +1 -1
  208. package/dist/cli/chunks/{chunk-HHSEIPSQ.js → chunk-NZNXEEZR.js} +1 -1
  209. package/dist/cli/chunks/{chunk-FMULOSBL.js → chunk-O3IIAIXB.js} +1 -1
  210. package/dist/cli/chunks/{chunk-ITRUZ3WE.js → chunk-OC2W7KIW.js} +2 -2
  211. package/dist/cli/chunks/{chunk-QZQGYSDG.js → chunk-OFUF3APC.js} +2 -2
  212. package/dist/cli/chunks/{chunk-MKLLB4PM.js → chunk-OU52V67H.js} +4 -4
  213. package/dist/cli/chunks/{chunk-Y7UJC5OL.js → chunk-P2RR4SW5.js} +3 -3
  214. package/dist/cli/chunks/{chunk-7Q6CMSMD.js → chunk-P3VRXQ3H.js} +3 -3
  215. package/dist/cli/chunks/{chunk-YRP73HO4.js → chunk-P5SGBQLY.js} +1 -1
  216. package/dist/cli/chunks/{chunk-MDYI4IIW.js → chunk-P7MIOTVP.js} +1 -1
  217. package/dist/cli/chunks/{chunk-B4QA3YN6.js → chunk-PFDILSVO.js} +1 -1
  218. package/dist/cli/chunks/{chunk-2ZC7S4UG.js → chunk-PPD5ZLNA.js} +2 -2
  219. package/dist/cli/chunks/{chunk-VGYUVMSN.js → chunk-QFJDR4HC.js} +2 -2
  220. package/dist/cli/chunks/{chunk-3GWSHRDA.js → chunk-QZ2GQGJX.js} +2 -2
  221. package/dist/cli/chunks/{chunk-XMZ2DHUL.js → chunk-QZLTIGLB.js} +1 -1
  222. package/dist/cli/chunks/{chunk-BEOGI5FC.js → chunk-RHSUXQNF.js} +2 -2
  223. package/dist/cli/chunks/{chunk-ISVBO4XO.js → chunk-S6BWEZKK.js} +2 -2
  224. package/dist/cli/chunks/{chunk-AYOTODUV.js → chunk-SE4S23C7.js} +1 -1
  225. package/dist/cli/chunks/{chunk-SLWJNHCR.js → chunk-TOGZ37RL.js} +2 -2
  226. package/dist/cli/chunks/{chunk-73EWPVBJ.js → chunk-UCXW24HY.js} +2 -2
  227. package/dist/cli/chunks/{chunk-JQSA6EMI.js → chunk-UQ6WB4N2.js} +2 -2
  228. package/dist/cli/chunks/{chunk-SQPDGRYR.js → chunk-UQBGA4UA.js} +1 -1
  229. package/dist/cli/chunks/{chunk-N3R3JGUY.js → chunk-VNFL2TPU.js} +1 -1
  230. package/dist/cli/chunks/{chunk-QGBXENIP.js → chunk-WARFZ626.js} +1 -1
  231. package/dist/cli/chunks/{chunk-PVBJUANU.js → chunk-WEBHFIWS.js} +2 -2
  232. package/dist/cli/chunks/{chunk-YQIMO7VJ.js → chunk-WKIYYF3G.js} +2 -2
  233. package/dist/cli/chunks/{chunk-6VQKNPGY.js → chunk-WZC4HKGZ.js} +2 -2
  234. package/dist/cli/chunks/{chunk-O6FN53HB.js → chunk-X36TZXDK.js} +1 -1
  235. package/dist/cli/chunks/{chunk-IKNDGXZZ.js → chunk-XN4G3SRU.js} +2 -2
  236. package/dist/cli/chunks/{chunk-N7MKF4F4.js → chunk-XNREA3FG.js} +1 -1
  237. package/dist/cli/chunks/{chunk-PC3VIR2A.js → chunk-XRDPGJNW.js} +2 -2
  238. package/dist/cli/chunks/{chunk-ETZ62NFD.js → chunk-XXCSJMSR.js} +1 -1
  239. package/dist/cli/chunks/{chunk-LCDRRAES.js → chunk-XY2B2BEJ.js} +2 -2
  240. package/dist/cli/chunks/{chunk-HMSPPGUF.js → chunk-XY4JS3IZ.js} +2 -2
  241. package/dist/cli/chunks/{chunk-L7GQKJLV.js → chunk-Y4M2HMPR.js} +2 -2
  242. package/dist/cli/chunks/{chunk-2TUVBEWK.js → chunk-YDPBCN7H.js} +2 -2
  243. package/dist/cli/chunks/{chunk-NBTKI2TX.js → chunk-YGR54EAA.js} +2 -2
  244. package/dist/cli/chunks/{chunk-WBQEOACC.js → chunk-YGRY2TVI.js} +2 -2
  245. package/dist/cli/chunks/{chunk-VVJXQ4FR.js → chunk-YJUJCLXV.js} +2 -2
  246. package/dist/cli/chunks/{chunk-SHW43QQV.js → chunk-YWG4LHFU.js} +2 -2
  247. package/dist/cli/chunks/{chunk-FGOVDO3R.js → chunk-Z2QNTRUX.js} +2 -2
  248. package/dist/cli/chunks/{chunk-UFMW25MS.js → chunk-ZBJMVWQR.js} +2 -2
  249. package/dist/cli/chunks/{chunk-7MBF3S25.js → chunk-ZH6HYT7C.js} +1 -1
  250. package/dist/cli/chunks/{chunk-LYV7WJWA.js → chunk-ZP2GE6DM.js} +1 -1
  251. package/dist/cli/chunks/{chunk-JNX7IRSI.js → chunk-ZQYEBLTL.js} +2 -2
  252. package/dist/cli/chunks/{chunk-FTOICJQG.js → chunk-ZRU3OZEU.js} +2 -2
  253. package/dist/cli/chunks/{chunk-OZQIDDXB.js → chunk-ZU3V4CJ4.js} +2 -2
  254. package/dist/cli/chunks/{chunk-JZFA2PWY.js → chunk-ZWMXF6AX.js} +2 -2
  255. package/dist/cli/chunks/{ci-4JK2NFCD.js → ci-SM3EVLZ4.js} +2 -2
  256. package/dist/cli/chunks/{ci-output-LCGTJQWC.js → ci-output-YYXICZBC.js} +2 -2
  257. package/dist/cli/chunks/{circuit-breaker-EJF7D3L4.js → circuit-breaker-CV5UGKXT.js} +2 -2
  258. package/dist/cli/chunks/{claude-flow-setup-3RUC6OB4.js → claude-flow-setup-BSBUZ4B7.js} +2 -2
  259. package/dist/cli/chunks/client-WRDYZGM2.js +2 -0
  260. package/dist/cli/chunks/{cline-installer-6LY5C5QH.js → cline-installer-P2O6STIC.js} +2 -2
  261. package/dist/cli/chunks/code-M7DDLBGS.js +58 -0
  262. package/dist/cli/chunks/{code-index-extractor-OY5GQJBM.js → code-index-extractor-3QZIUYOG.js} +2 -2
  263. package/dist/cli/chunks/{codex-installer-BO7E2ZVA.js → codex-installer-5JVZCCTC.js} +2 -2
  264. package/dist/cli/chunks/{completions-VGL3KJ2R.js → completions-EM7IL2BJ.js} +8 -5
  265. package/dist/cli/chunks/{complexity-analyzer-5DPUK7IL.js → complexity-analyzer-VJXVB2CV.js} +2 -2
  266. package/dist/cli/chunks/{continuedev-installer-LFDG2D42.js → continuedev-installer-RCKJIAEC.js} +2 -2
  267. package/dist/cli/chunks/{copilot-installer-SEMMMIZH.js → copilot-installer-DZ7LTDOZ.js} +2 -2
  268. package/dist/cli/chunks/core-handlers-O6E5DNHT.js +2 -0
  269. package/dist/cli/chunks/{cost-tracker-OPBC6FQM.js → cost-tracker-QLOLXVAM.js} +2 -2
  270. package/dist/cli/chunks/{coverage-CFDUSRKU.js → coverage-LYHTLWRV.js} +3 -3
  271. package/dist/cli/chunks/cross-domain-router-EV7LQMDO.js +2 -0
  272. package/dist/cli/chunks/{cursor-installer-6TXUUVY4.js → cursor-installer-PSIZ3Y53.js} +2 -2
  273. package/dist/cli/chunks/{daemon-5KO46YQR.js → daemon-IYDTMA5M.js} +4 -4
  274. package/dist/cli/chunks/{daemon-7BDBPPAF.js → daemon-YLOAXM4X.js} +3 -3
  275. package/dist/cli/chunks/{dag-attention-scheduler-6DQKZOUW.js → dag-attention-scheduler-I2UIO3Z7.js} +2 -2
  276. package/dist/cli/chunks/{detect-R2QAYDPI.js → detect-ZXQ7X7GZ.js} +2 -2
  277. package/dist/cli/chunks/{dist-node-3POCIJ4N.js → dist-node-GK6OZX4H.js} +2 -2
  278. package/dist/cli/chunks/{domain-handler-KW63CHUH.js → domain-handler-NS3IBLRQ.js} +2 -2
  279. package/dist/cli/chunks/{domain-transfer-2QPOJCUD.js → domain-transfer-5G4RZEWF.js} +2 -2
  280. package/dist/cli/chunks/dream-E4C236UL.js +2 -0
  281. package/dist/cli/chunks/{embed-and-insert-pattern-OIDJZQEP.js → embed-and-insert-pattern-V4JJUFR6.js} +2 -2
  282. package/dist/cli/chunks/{eval-UGEKTTAQ.js → eval-7Q6PPYKR.js} +2 -2
  283. package/dist/cli/chunks/{experience-capture-middleware-3BIM2TT7.js → experience-capture-middleware-DUBKSYFM.js} +3 -3
  284. package/dist/cli/chunks/{fast-paths-HCJQXB7W.js → fast-paths-IDPPMBUW.js} +2 -2
  285. package/dist/cli/chunks/{feature-flags-W4JSFBMV.js → feature-flags-EPTMAAKA.js} +2 -2
  286. package/dist/cli/chunks/{feature-flags-GDGJKLN4.js → feature-flags-KXI6FDY7.js} +2 -2
  287. package/dist/cli/chunks/{file-discovery-JMUZ4MUH.js → file-discovery-EDX2OJO7.js} +2 -2
  288. package/dist/cli/chunks/{fleet-YNNK2CKW.js → fleet-67BO3LJ4.js} +3 -3
  289. package/dist/cli/chunks/{gnn-wrapper-R2ZY6CDD.js → gnn-wrapper-YARORYT7.js} +2 -2
  290. package/dist/cli/chunks/{heartbeat-handler-OZX2EJHQ.js → heartbeat-handler-K3JGPBYR.js} +4 -4
  291. package/dist/cli/chunks/heartbeat-scheduler-WMADLDKT.js +2 -0
  292. package/dist/cli/chunks/hnsw-adapter-STRDGJ65.js +2 -0
  293. package/dist/cli/chunks/hnsw-index-DBHX3TSC.js +2 -0
  294. package/dist/cli/chunks/{hnsw-legacy-bridge-3S6TYCG3.js → hnsw-legacy-bridge-CDDRSV5E.js} +2 -2
  295. package/dist/cli/chunks/{better-sqlite3-RIBLRHJL.js → hnswlib-node-2KL54YUA.js} +2 -2
  296. package/dist/cli/chunks/{hooks-KM7WR35T.js → hooks-6SCAE6LC.js} +10 -10
  297. package/dist/cli/chunks/hybrid-router-L2K55I4T.js +2 -0
  298. package/dist/cli/chunks/{hypergraph-engine-RX53A73M.js → hypergraph-engine-I3LUMO7I.js} +2 -2
  299. package/dist/cli/chunks/{hypergraph-handler-3QQB3H3Z.js → hypergraph-handler-YAKAIVCN.js} +3 -3
  300. package/dist/cli/chunks/impact-analyzer-WMO7ZGS7.js +2 -0
  301. package/dist/cli/chunks/{init-handler-Y62RH4ZI.js → init-handler-NBKCZD7Q.js} +6 -6
  302. package/dist/cli/chunks/init-wizard-ZAB7UZZS.js +2 -0
  303. package/dist/cli/chunks/kernel-4MUFDEQI.js +2 -0
  304. package/dist/cli/chunks/{kilocode-installer-26R253L2.js → kilocode-installer-YGPJCPU3.js} +2 -2
  305. package/dist/cli/chunks/{kiro-installer-PFA5QPZZ.js → kiro-installer-JV3ONVMN.js} +2 -2
  306. package/dist/cli/chunks/knowledge-graph-GZRFGXLX.js +2 -0
  307. package/dist/cli/chunks/{learning-CQLM5ANX.js → learning-2FEZJ5CX.js} +3 -3
  308. package/dist/cli/chunks/{llm-router-QZ5PG4PF.js → llm-router-SILI4KLU.js} +4 -4
  309. package/dist/cli/chunks/llm-router-service-5ODLU5U5.js +2 -0
  310. package/dist/cli/chunks/{load-UPA6LPHM.js → load-EGXLQVR3.js} +2 -2
  311. package/dist/cli/chunks/load-test-ZDQFS5XS.js +2 -0
  312. package/dist/cli/chunks/{mcp-LSWTLAJ4.js → mcp-OJH775TL.js} +2 -2
  313. package/dist/cli/chunks/{memory-VGEYYGCG.js → memory-FNEOK4FW.js} +5 -5
  314. package/dist/cli/chunks/memory-backend-UK7SQ6ZM.js +2 -0
  315. package/dist/cli/chunks/{memory-handlers-QBURG7NA.js → memory-handlers-6LDUH3JZ.js} +2 -2
  316. package/dist/cli/chunks/{multi-model-executor-VZVFBIKC.js → multi-model-executor-ORTFWLLE.js} +2 -2
  317. package/dist/cli/chunks/{opencode-installer-PBQAXNLV.js → opencode-installer-UAQLW6XX.js} +2 -2
  318. package/dist/cli/chunks/{orchestrator-YND7JB5O.js → orchestrator-VE5KJ2V4.js} +5 -5
  319. package/dist/cli/chunks/pattern-null-store-LO2QTIBU.js +2 -0
  320. package/dist/cli/chunks/{pipeline-GM5RRUES.js → pipeline-FNMDRWTU.js} +2 -2
  321. package/dist/cli/chunks/{platform-L7OGGRSL.js → platform-MGAKRUQN.js} +2 -2
  322. package/dist/cli/chunks/{plugin-N4YAE6H5.js → plugin-YX7THX3I.js} +2 -2
  323. package/dist/cli/chunks/{prime-radiant-advanced-wasm-7D67XV6Z.js → prime-radiant-advanced-wasm-XJV4RLMK.js} +2 -2
  324. package/dist/cli/chunks/protocol-executor-JWMYQEOI.js +2 -0
  325. package/dist/cli/chunks/{protocol-handler-V2WTFU7N.js → protocol-handler-QFET442Y.js} +2 -2
  326. package/dist/cli/chunks/{prove-33DS5Z3N.js → prove-QBAESCOC.js} +2 -2
  327. package/dist/cli/chunks/provider-manager-PEXOHGNB.js +2 -0
  328. package/dist/cli/chunks/qe-reasoning-bank-7B2G4UGQ.js +2 -0
  329. package/dist/cli/chunks/{quality-WCSEA5GH.js → quality-ZTNRL6EG.js} +2 -2
  330. package/dist/cli/chunks/queen-coordinator-6OF4HT3S.js +2 -0
  331. package/dist/cli/chunks/{real-embeddings-OQ5F37DG.js → real-embeddings-ZFFDV6HC.js} +2 -2
  332. package/dist/cli/chunks/{roocode-installer-II7LIR2X.js → roocode-installer-J4LFL4AE.js} +2 -2
  333. package/dist/cli/chunks/router-GMWRF6DU.js +2 -0
  334. package/dist/cli/chunks/routing-feedback-XKJSQK3I.js +2 -0
  335. package/dist/cli/chunks/{routing-handler-6OFHARIY.js → routing-handler-A5QG2TP2.js} +2 -2
  336. package/dist/cli/chunks/{ruvector-commands-GD5JTR4M.js → ruvector-commands-J5JL5WX5.js} +2 -2
  337. package/dist/cli/chunks/{rvf-dual-writer-HSK6BYZV.js → rvf-dual-writer-H7442GMO.js} +2 -2
  338. package/dist/cli/chunks/{rvf-migration-adapter-554SMF5S.js → rvf-migration-adapter-PTFQUYKC.js} +2 -2
  339. package/dist/cli/chunks/{rvf-migration-coordinator-OFDBCAYE.js → rvf-migration-coordinator-RSNROYRX.js} +2 -2
  340. package/dist/cli/chunks/rvf-native-adapter-YEA6TMXB.js +2 -0
  341. package/dist/cli/chunks/safe-db-5DOP2J3V.js +2 -0
  342. package/dist/cli/chunks/schedule-SUWTOBHP.js +2 -0
  343. package/dist/cli/chunks/scheduler-P4VTC5SQ.js +2 -0
  344. package/dist/cli/chunks/{security-GN4J6DSS.js → security-LHHLMCBA.js} +3 -3
  345. package/dist/cli/chunks/{shared-rvf-adapter-Q4PM3QCN.js → shared-rvf-adapter-NPSHVUTM.js} +2 -2
  346. package/dist/cli/chunks/{shared-rvf-dual-writer-R5WK5BXQ.js → shared-rvf-dual-writer-INQDY5WE.js} +2 -2
  347. package/dist/cli/chunks/sqlite-persistence-5Z2RAXH7.js +2 -0
  348. package/dist/cli/chunks/{status-handler-AHS5WVMG.js → status-handler-R2KIAMAE.js} +2 -2
  349. package/dist/cli/chunks/{structural-health-5KUKNLHZ.js → structural-health-2VPPIOZX.js} +2 -2
  350. package/dist/cli/chunks/{sync-PUMM3SR6.js → sync-ASZ3T5GT.js} +2 -2
  351. package/dist/cli/chunks/{sync-TQLGD5HX.js → sync-NLASP7AK.js} +2 -2
  352. package/dist/cli/chunks/{task-handler-D7VXV4AF.js → task-handler-UV5R6LJG.js} +2 -2
  353. package/dist/cli/chunks/{task-handlers-QMN4SWUG.js → task-handlers-I6YJXPYP.js} +3 -3
  354. package/dist/cli/chunks/{test-HEWZR6YQ.js → test-TE43TNTI.js} +4 -4
  355. package/dist/cli/chunks/{test-scheduling-VTMLBEPA.js → test-scheduling-WWWWF2TZ.js} +3 -3
  356. package/dist/cli/chunks/{token-bootstrap-IYBG7PQ6.js → token-bootstrap-HEWP7KKS.js} +2 -2
  357. package/dist/cli/chunks/{token-usage-C7H27BFZ.js → token-usage-3FVHUAW6.js} +2 -2
  358. package/dist/cli/chunks/{transformers-5ZJVC6NB.js → transformers-O5OFM4XM.js} +2 -2
  359. package/dist/cli/chunks/{tree-sitter-wasm-parser-EARBJG2H.js → tree-sitter-wasm-parser-YOYWFW63.js} +2 -2
  360. package/dist/cli/chunks/{types-3IHE42PZ.js → types-42GR6PLO.js} +2 -2
  361. package/dist/cli/chunks/unified-memory-HCKOPFAY.js +2 -0
  362. package/dist/cli/chunks/unified-memory-hnsw-6NQPYA5C.js +2 -0
  363. package/dist/cli/chunks/unified-persistence-NIMKNAFR.js +2 -0
  364. package/dist/cli/chunks/{upgrade-YP3VFSXO.js → upgrade-BU6DJ4LT.js} +2 -2
  365. package/dist/cli/chunks/{validate-VSBNKPN6.js → validate-MPTBARGN.js} +2 -2
  366. package/dist/cli/chunks/{validate-swarm-GOCJVWXE.js → validate-swarm-5LUQYHPP.js} +2 -2
  367. package/dist/cli/chunks/{vibium-U6YKCLDF.js → vibium-MJJDANDL.js} +2 -2
  368. package/dist/cli/chunks/visual-security-HFGHA57Z.js +2 -0
  369. package/dist/cli/chunks/{web-tree-sitter-TSNVGWSN.js → web-tree-sitter-5TF4UGB3.js} +2 -2
  370. package/dist/cli/chunks/{windsurf-installer-2VKMEFSD.js → windsurf-installer-NQAOSVCN.js} +2 -2
  371. package/dist/cli/chunks/{witness-chain-BWZCW52H.js → witness-chain-23UWK2JT.js} +2 -2
  372. package/dist/cli/chunks/witness-chain-VZGGJ7TJ.js +2 -0
  373. package/dist/cli/chunks/{workflow-J6SCYLU3.js → workflow-3QOLXRJC.js} +4 -4
  374. package/dist/cli/chunks/workflow-orchestrator-45L7D4SN.js +2 -0
  375. package/dist/cli/chunks/{wrappers-M5C7DONW.js → wrappers-S6EUZBCX.js} +2 -2
  376. package/dist/cli/commands/code.js +78 -2
  377. package/dist/cli/completions/index.js +4 -1
  378. package/dist/domains/code-intelligence/coordinator.js +8 -4
  379. package/dist/domains/code-intelligence/services/c4-model/from-detected.d.ts +41 -0
  380. package/dist/domains/code-intelligence/services/c4-model/from-detected.js +152 -0
  381. package/dist/domains/code-intelligence/services/c4-model/kg-relationships.d.ts +71 -0
  382. package/dist/domains/code-intelligence/services/c4-model/kg-relationships.js +87 -0
  383. package/dist/domains/code-intelligence/services/knowledge-graph.d.ts +6 -0
  384. package/dist/domains/code-intelligence/services/knowledge-graph.js +3 -3
  385. package/dist/domains/code-intelligence/services/product-factors-bridge.d.ts +26 -5
  386. package/dist/domains/code-intelligence/services/product-factors-bridge.js +72 -65
  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 +3 -1
  391. package/dist/domains/test-generation/coordinator.js +15 -33
  392. package/dist/integrations/darwin/types.d.ts +10 -3
  393. package/dist/integrations/darwin/types.js +10 -3
  394. package/dist/mcp/bundle.js +446 -464
  395. package/dist/mcp/tool-scoping.d.ts +8 -2
  396. package/dist/mcp/tool-scoping.js +13 -0
  397. package/dist/mcp/tools/code-intelligence/c4.d.ts +56 -0
  398. package/dist/mcp/tools/code-intelligence/c4.js +145 -0
  399. package/dist/mcp/tools/index.d.ts +1 -0
  400. package/dist/mcp/tools/index.js +1 -0
  401. package/dist/mcp/tools/registry.d.ts +1 -0
  402. package/dist/mcp/tools/registry.js +3 -0
  403. package/dist/routing/free-tier/coordinator-support.d.ts +90 -0
  404. package/dist/routing/free-tier/coordinator-support.js +78 -0
  405. package/dist/routing/free-tier/executor.d.ts +43 -1
  406. package/dist/routing/free-tier/executor.js +69 -26
  407. package/dist/routing/free-tier/index.d.ts +1 -0
  408. package/dist/routing/free-tier/index.js +1 -0
  409. package/dist/routing/value-score.d.ts +49 -0
  410. package/dist/routing/value-score.js +54 -0
  411. package/dist/shared/c4-model/confidence.d.ts +38 -0
  412. package/dist/shared/c4-model/confidence.js +69 -0
  413. package/dist/shared/c4-model/index.d.ts +4 -0
  414. package/dist/shared/c4-model/index.js +1 -0
  415. package/dist/shared/optional-module.d.ts +23 -0
  416. package/dist/shared/optional-module.js +46 -0
  417. package/dist/verification/adversarial-verify/calibrate.d.ts +32 -0
  418. package/dist/verification/adversarial-verify/calibrate.js +33 -0
  419. package/dist/verification/adversarial-verify/gate.d.ts +38 -0
  420. package/dist/verification/adversarial-verify/gate.js +32 -0
  421. package/dist/verification/adversarial-verify/index.d.ts +20 -0
  422. package/dist/verification/adversarial-verify/index.js +6 -0
  423. package/dist/verification/adversarial-verify/prompts.d.ts +14 -0
  424. package/dist/verification/adversarial-verify/prompts.js +17 -0
  425. package/dist/verification/adversarial-verify/synthesize.d.ts +18 -0
  426. package/dist/verification/adversarial-verify/synthesize.js +35 -0
  427. package/dist/verification/adversarial-verify/types.d.ts +59 -0
  428. package/dist/verification/adversarial-verify/types.js +10 -0
  429. package/dist/verification/adversarial-verify/verify.d.ts +20 -0
  430. package/dist/verification/adversarial-verify/verify.js +34 -0
  431. package/package.json +10 -1
  432. package/dist/cli/chunks/adapter-WLFT5VMV.js +0 -2
  433. package/dist/cli/chunks/aqe-learning-engine-JBH4GZUM.js +0 -2
  434. package/dist/cli/chunks/base-A7JGM473.js +0 -2
  435. package/dist/cli/chunks/browser-workflow-TIDJWULK.js +0 -2
  436. package/dist/cli/chunks/chunk-C4OYHUJV.js +0 -2
  437. package/dist/cli/chunks/client-ZLJ3JMBC.js +0 -2
  438. package/dist/cli/chunks/code-MPDG4UHS.js +0 -39
  439. package/dist/cli/chunks/core-handlers-EM7FUYTI.js +0 -2
  440. package/dist/cli/chunks/cross-domain-router-DYGHQ6P5.js +0 -2
  441. package/dist/cli/chunks/dream-DBE5D5BD.js +0 -2
  442. package/dist/cli/chunks/heartbeat-scheduler-NFHAANNL.js +0 -2
  443. package/dist/cli/chunks/hnsw-adapter-HMPCZFBY.js +0 -2
  444. package/dist/cli/chunks/hnsw-index-KRIWSXX4.js +0 -2
  445. package/dist/cli/chunks/hybrid-router-BAB32B2W.js +0 -2
  446. package/dist/cli/chunks/impact-analyzer-3D6XHWQE.js +0 -2
  447. package/dist/cli/chunks/init-wizard-LLU3WVGC.js +0 -2
  448. package/dist/cli/chunks/kernel-ZFHAYHHJ.js +0 -2
  449. package/dist/cli/chunks/knowledge-graph-ETZ65KOY.js +0 -2
  450. package/dist/cli/chunks/llm-router-service-R6CTGF5I.js +0 -2
  451. package/dist/cli/chunks/load-test-UOWIJUCH.js +0 -2
  452. package/dist/cli/chunks/memory-backend-E3ZQKW7A.js +0 -2
  453. package/dist/cli/chunks/pattern-null-store-OUOJO2RH.js +0 -2
  454. package/dist/cli/chunks/protocol-executor-KHAPG5CP.js +0 -2
  455. package/dist/cli/chunks/provider-manager-FGPPW7T4.js +0 -2
  456. package/dist/cli/chunks/qe-reasoning-bank-TS7XOJDA.js +0 -2
  457. package/dist/cli/chunks/queen-coordinator-J35FNFQ3.js +0 -2
  458. package/dist/cli/chunks/router-AFTKPDI5.js +0 -2
  459. package/dist/cli/chunks/routing-feedback-SABZUJTF.js +0 -2
  460. package/dist/cli/chunks/rvf-native-adapter-57MDDSFQ.js +0 -2
  461. package/dist/cli/chunks/safe-db-2HR6MVYM.js +0 -2
  462. package/dist/cli/chunks/schedule-KLVAN6XI.js +0 -2
  463. package/dist/cli/chunks/scheduler-WYZ6BC5Y.js +0 -2
  464. package/dist/cli/chunks/sqlite-persistence-2CGU5INO.js +0 -2
  465. package/dist/cli/chunks/unified-memory-PMYRQC5K.js +0 -2
  466. package/dist/cli/chunks/unified-memory-hnsw-7TRL2K5Q.js +0 -2
  467. package/dist/cli/chunks/unified-persistence-S4BNJK4S.js +0 -2
  468. package/dist/cli/chunks/visual-security-RPMZ3J7L.js +0 -2
  469. package/dist/cli/chunks/witness-chain-BTDZSQ6P.js +0 -2
  470. package/dist/cli/chunks/workflow-orchestrator-42B62D3V.js +0 -2
@@ -1,48 +1,299 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * Claude Flow V3 Statusline Generator
4
- * Displays real-time V3 implementation progress and system status
3
+ * RuFlo V3 Statusline — delegation build (#2195)
5
4
  *
6
- * Usage: node statusline.cjs [options]
5
+ * Fix for ruvnet/ruflo#2195: the previous version re-implemented all data
6
+ * readers locally using fragile file probes that missed AgentDB patterns,
7
+ * the v3/docs/adr/ ADR directory, and the real vector count.
7
8
  *
8
- * Options:
9
- * (default) Safe multi-line output with collision zone avoidance
10
- * --single Single-line output (completely avoids collision)
11
- * --unsafe Legacy multi-line without collision avoidance
12
- * --legacy Alias for --unsafe
13
- * --json JSON output with pretty printing
14
- * --compact JSON output without formatting
9
+ * This version delegates to 'npx @claude-flow/cli hooks statusline --json'
10
+ * as the single source of truth. That command queries AgentDB directly,
11
+ * counts ADRs in both directories, and reports the real intelligence pct.
15
12
  *
16
- * Collision Zone Fix (Issue #985):
17
- * Claude Code writes its internal status (e.g., "7s • 1p") at absolute
18
- * terminal coordinates (columns 15-25 on second-to-last line). The safe
19
- * mode pads the collision line with spaces to push content past column 25.
13
+ * ADR counting falls back to local file reads so the display still works
14
+ * without network access (counts both v3/docs/adr/ and v3/implementation/adrs/).
20
15
  *
21
- * IMPORTANT: This file uses .cjs extension to work in ES module projects.
22
- * The require() syntax is intentional for CommonJS compatibility.
16
+ * Cache: JSON result is cached in /tmp for 10s so rapid prompt triggers
17
+ * (every keystroke in some shells) don't hammer the CLI on every call.
18
+ *
19
+ * Usage: node statusline.cjs [--json] [--compact] [--dashboard]
23
20
  */
24
21
 
25
22
  /* eslint-disable @typescript-eslint/no-var-requires */
26
23
  const fs = require('fs');
27
24
  const path = require('path');
28
25
  const { execSync } = require('child_process');
26
+ const os = require('os');
29
27
 
30
28
  // Configuration
31
29
  const CONFIG = {
32
- enabled: true,
33
- showProgress: true,
34
- showSecurity: true,
35
- showSwarm: true,
36
- showHooks: true,
37
- showPerformance: true,
38
- refreshInterval: 5000,
39
30
  maxAgents: 15,
40
- topology: 'hierarchical-mesh',
31
+ // Session-cost display. Claude Code's cost.total_cost_usd is a client-side
32
+ // estimate that "may differ from your actual bill" and reads as misleading on
33
+ // subscription plans, where token usage is not billed per dollar. These let
34
+ // each user pick what the segment means to them without changing the default.
35
+ // RUFLO_STATUSLINE_COST_SYMBOL override the leading '$' (e.g. ⚡, €, 🌱);
36
+ // set to an empty string for the number alone.
37
+ // RUFLO_STATUSLINE_HIDE_COST 1/true/yes/on removes the segment entirely.
38
+ costSymbol: process.env.RUFLO_STATUSLINE_COST_SYMBOL ?? '$',
39
+ hideCost: /^(1|true|yes|on)$/i.test(process.env.RUFLO_STATUSLINE_HIDE_COST || ''),
41
40
  };
42
41
 
43
- // Cross-platform helpers
44
- const isWindows = process.platform === 'win32';
45
- const nullDevice = isWindows ? 'NUL' : '/dev/null';
42
+ const CWD = process.cwd();
43
+
44
+ // ─── Delegation cache ───────────────────────────────────────────
45
+ // Cache the CLI JSON result for 60s so rapid prompt re-renders
46
+ // (Claude Code refreshes the statusline several times a second while
47
+ // streaming) don't re-invoke the CLI each time. #2337: bumped 10s→60s
48
+ // because 10s was far too short for how often Claude Code re-renders.
49
+ const CACHE_FILE = path.join(os.tmpdir(), 'ruflo-statusline-cache-' + require('crypto').createHash('md5').update(CWD).digest('hex').slice(0, 8) + '.json');
50
+ const CACHE_TTL_MS = 60000;
51
+
52
+ // #2337: resolve an already-installed @claude-flow/cli (or ruflo) bin so we
53
+ // can invoke it directly via `node`. The previous version called
54
+ // `npx --yes @claude-flow/cli@latest` on every uncached render, which forces
55
+ // a registry resolution + cold-start of the entire CLI per render. With
56
+ // multiple concurrent Claude Code sessions this storms the host (reporter
57
+ // saw load average 40-65 on a 12-core box).
58
+ //
59
+ // Returns the absolute path to bin/cli.js or null. Mirrors getPkgVersion()'s
60
+ // path probing (project, monorepo, plugin marketplace, global node_modules
61
+ // including custom-prefix layouts like ~/.npm-global).
62
+ function resolveCliBin() {
63
+ try {
64
+ const home = os.homedir();
65
+ const candidates = [
66
+ path.join(home, '.claude', 'plugins', 'marketplaces', 'ruflo', 'bin', 'cli.js'),
67
+ path.join(CWD, 'node_modules', '@claude-flow', 'cli', 'bin', 'cli.js'),
68
+ path.join(CWD, 'node_modules', 'ruflo', 'bin', 'cli.js'),
69
+ path.join(CWD, 'v3', '@claude-flow', 'cli', 'bin', 'cli.js'),
70
+ ];
71
+ try {
72
+ const binDir = path.dirname(process.execPath);
73
+ const globalModuleDirs = [path.join(binDir, '..', 'lib', 'node_modules'), path.join(binDir, 'node_modules')];
74
+ for (const prefix of [process.env.npm_config_prefix, process.env.PREFIX, path.join(home, '.npm-global')]) {
75
+ if (prefix) globalModuleDirs.push(path.join(prefix, 'lib', 'node_modules'));
76
+ }
77
+ for (const gm of globalModuleDirs) {
78
+ candidates.push(
79
+ path.join(gm, 'ruflo', 'bin', 'cli.js'),
80
+ path.join(gm, '@claude-flow', 'cli', 'bin', 'cli.js'),
81
+ );
82
+ }
83
+ } catch { /* ignore */ }
84
+ for (const p of candidates) {
85
+ if (fs.existsSync(p)) return p;
86
+ }
87
+ } catch { /* ignore */ }
88
+ return null;
89
+ }
90
+
91
+ function readCache() {
92
+ try {
93
+ if (fs.existsSync(CACHE_FILE)) {
94
+ const raw = JSON.parse(fs.readFileSync(CACHE_FILE, 'utf-8'));
95
+ if (raw && raw._ts && (Date.now() - raw._ts) < CACHE_TTL_MS) {
96
+ return raw.data;
97
+ }
98
+ }
99
+ } catch { /* ignore */ }
100
+ return null;
101
+ }
102
+
103
+ function writeCache(data) {
104
+ try { fs.writeFileSync(CACHE_FILE, JSON.stringify({ _ts: Date.now(), data }), 'utf-8'); } catch { /* ignore */ }
105
+ }
106
+
107
+ /**
108
+ * Single source of truth: delegate to the CLI hooks statusline --json command.
109
+ * Falls back to a minimal static object on failure so the statusline still renders.
110
+ *
111
+ * Fix for ruflo#2195: the previous local readers returned 0 for AgentDB patterns
112
+ * (missed the .swarm/memory.db → AgentDB path), computed dddProgress wrong,
113
+ * and only counted ADRs in v3/implementation/adrs/ (missed v3/docs/adr/).
114
+ */
115
+ function getStatuslineData() {
116
+ const cached = readCache();
117
+ if (cached) return cached;
118
+
119
+ try {
120
+ // #2337: prefer an already-installed CLI bin via direct `node` invocation
121
+ // — no npx, no registry round-trip, no @latest re-resolve per render.
122
+ // Fall back to `npx --prefer-offline @claude-flow/cli` (no @latest) only
123
+ // when nothing is installed locally, so a cold environment still works.
124
+ const cliBin = resolveCliBin();
125
+ const cmd = cliBin
126
+ ? '"' + process.execPath + '" "' + cliBin + '" hooks statusline --json 2>/dev/null'
127
+ : 'npx --prefer-offline @claude-flow/cli hooks statusline --json 2>/dev/null';
128
+ const raw = execSync(
129
+ cmd,
130
+ { encoding: 'utf-8', timeout: 8000, stdio: ['pipe', 'pipe', 'pipe'], cwd: CWD }
131
+ ).trim();
132
+ // The CLI may emit preamble lines before the JSON — find the first '{'.
133
+ const jsonStart = raw.indexOf('{');
134
+ if (jsonStart === -1) throw new Error('no JSON in CLI output');
135
+ const data = JSON.parse(raw.slice(jsonStart));
136
+ // Overlay every block the CLI JSON omits (adrs/agentdb/tests/hooks/integration)
137
+ // with real local reads, so those segments reflect actual state instead of 0.
138
+ applyLocalOverlays(data);
139
+ writeCache(data);
140
+ return data;
141
+ } catch { /* CLI unavailable or timed out */ }
142
+
143
+ // Fallback: use local file probes only (will be less accurate, but non-zero
144
+ // when CLI is available and accurate when it's not).
145
+ return buildLocalFallback();
146
+ }
147
+
148
+ // Count ADRs from BOTH known directories (fix for ruflo#2195: old code missed
149
+ // v3/docs/adr/ which holds ADR-088..ADR-137, i.e. 41 of the 128 total ADRs).
150
+ function getLocalADRCount() {
151
+ const adrDirs = [
152
+ path.join(CWD, 'v3', 'implementation', 'adrs'),
153
+ path.join(CWD, 'v3', 'docs', 'adr'),
154
+ path.join(CWD, 'docs', 'adrs'),
155
+ path.join(CWD, '.claude-flow', 'adrs'),
156
+ ];
157
+ let total = 0;
158
+ for (const dir of adrDirs) {
159
+ try {
160
+ if (fs.existsSync(dir)) {
161
+ const files = fs.readdirSync(dir).filter(function(f) {
162
+ return f.endsWith('.md') && (f.startsWith('ADR-') || f.startsWith('adr-') || /^\d{4}-/.test(f));
163
+ });
164
+ total += files.length;
165
+ }
166
+ } catch { /* ignore */ }
167
+ }
168
+ return { count: total, implemented: total, compliance: 0 };
169
+ }
170
+
171
+ // ─── Local overlays for segments the CLI JSON omits ──────────────
172
+ // 'hooks statusline --json' only returns user/v3Progress/security/swarm/system.
173
+ // agentdb/tests/hooks/integration are never populated, so without these overlays
174
+ // they render as a permanent 0. Each reader is cheap and degrades to zeros.
175
+
176
+ // Real AgentDB stats from the local memory DB. Vectors live in .swarm/memory.db
177
+ // (sql.js + HNSW); ruvector.db is an opaque redb store counted only toward size.
178
+ // One read-only sqlite3 query (mode=ro never takes a write lock the daemon owns).
179
+ function getLocalAgentDB() {
180
+ const result = { vectorCount: 0, dbSizeKB: 0, hasHnsw: false };
181
+ try {
182
+ let bytes = 0;
183
+ for (const f of ['.swarm/memory.db', 'ruvector.db']) {
184
+ try { bytes += fs.statSync(path.join(CWD, f)).size; } catch { /* missing */ }
185
+ }
186
+ result.dbSizeKB = Math.round(bytes / 1024);
187
+
188
+ const memDb = path.join(CWD, '.swarm', 'memory.db');
189
+ if (fs.existsSync(memDb)) {
190
+ const Q = String.fromCharCode(34);
191
+ const sql = Q + 'SELECT (SELECT COUNT(*) FROM memory_entries WHERE embedding IS NOT NULL)||' + "'|'" + '||(SELECT COUNT(*) FROM vector_indexes);' + Q;
192
+ const out = safeExec("sqlite3 'file:" + memDb + "?mode=ro' " + sql, 1500);
193
+ if (out && out.indexOf('|') !== -1) {
194
+ const parts = out.split('|');
195
+ result.vectorCount = parseInt(parts[0], 10) || 0;
196
+ result.hasHnsw = (parseInt(parts[1], 10) || 0) > 0;
197
+ }
198
+ }
199
+ } catch { /* ignore */ }
200
+ return result;
201
+ }
202
+
203
+ // Count test files via a bounded directory walk (no file reads).
204
+ function getLocalTests() {
205
+ let testFiles = 0;
206
+ function countTests(dir, depth) {
207
+ if ((depth || 0) > 4) return;
208
+ try {
209
+ if (!fs.existsSync(dir)) return;
210
+ for (const e of fs.readdirSync(dir, { withFileTypes: true })) {
211
+ if (e.isDirectory() && !e.name.startsWith('.') && e.name !== 'node_modules') {
212
+ countTests(path.join(dir, e.name), (depth || 0) + 1);
213
+ } else if (e.isFile() && (e.name.includes('.test.') || e.name.includes('.spec.') || e.name.startsWith('test_') || e.name.startsWith('spec_'))) {
214
+ testFiles++;
215
+ }
216
+ }
217
+ } catch { /* ignore */ }
218
+ }
219
+ for (const d of ['tests', 'test', '__tests__', 'src', 'v3']) countTests(path.join(CWD, d));
220
+ return { testFiles, testCases: testFiles * 4 };
221
+ }
222
+
223
+ // Count configured hooks from project .claude/settings.json. Claude Code hooks
224
+ // have no enabled/disabled flag, so every configured hook counts as enabled.
225
+ function getLocalHooks() {
226
+ const result = { enabled: 0, total: 0 };
227
+ try {
228
+ const settings = readJSON(path.join(CWD, '.claude', 'settings.json'));
229
+ const hooks = settings && settings.hooks;
230
+ if (hooks && typeof hooks === 'object') {
231
+ let n = 0;
232
+ for (const ev of Object.keys(hooks)) {
233
+ const groups = hooks[ev];
234
+ if (Array.isArray(groups)) {
235
+ for (const g of groups) {
236
+ if (g && Array.isArray(g.hooks)) n += g.hooks.length;
237
+ }
238
+ }
239
+ }
240
+ result.total = n;
241
+ result.enabled = n;
242
+ }
243
+ } catch { /* ignore */ }
244
+ return result;
245
+ }
246
+
247
+ // Best-effort integration block: DB presence + locally-configured stdio MCP
248
+ // servers (project .mcp.json + global ~/.claude.json). Remote connectors are
249
+ // account-managed and not present in local config, so they are not counted.
250
+ function getLocalIntegration() {
251
+ const integration = { mcpServers: { enabled: 0, total: 0 }, hasDatabase: false };
252
+ try {
253
+ for (const f of ['.swarm/memory.db', 'ruvector.db']) {
254
+ if (fs.existsSync(path.join(CWD, f))) { integration.hasDatabase = true; break; }
255
+ }
256
+ const names = new Set();
257
+ const projMcp = readJSON(path.join(CWD, '.mcp.json'));
258
+ if (projMcp && projMcp.mcpServers) for (const k of Object.keys(projMcp.mcpServers)) names.add(k);
259
+ const claudeJson = readJSON(path.join(os.homedir(), '.claude.json'));
260
+ if (claudeJson) {
261
+ if (claudeJson.mcpServers) for (const k of Object.keys(claudeJson.mcpServers)) names.add(k);
262
+ const proj = claudeJson.projects && claudeJson.projects[CWD];
263
+ if (proj && proj.mcpServers && !Array.isArray(proj.mcpServers)) {
264
+ for (const k of Object.keys(proj.mcpServers)) names.add(k);
265
+ }
266
+ }
267
+ integration.mcpServers.total = names.size;
268
+ integration.mcpServers.enabled = names.size;
269
+ } catch { /* ignore */ }
270
+ return integration;
271
+ }
272
+
273
+ // Overlay every locally-derived block onto the CLI data (mutates in place).
274
+ function applyLocalOverlays(data) {
275
+ data.adrs = getLocalADRCount();
276
+ data.agentdb = getLocalAgentDB();
277
+ data.tests = getLocalTests();
278
+ data.hooks = getLocalHooks();
279
+ data.integration = getLocalIntegration();
280
+ return data;
281
+ }
282
+
283
+ // Minimal local fallback when the CLI is not installed or times out.
284
+ // Returns a structure that matches the CLI JSON schema so the renderer works.
285
+ function buildLocalFallback() {
286
+ const memMB = Math.floor(process.memoryUsage().heapUsed / 1024 / 1024);
287
+
288
+ return applyLocalOverlays({
289
+ user: { name: 'user', gitBranch: '', modelName: 'Claude Code' },
290
+ v3Progress: { domainsCompleted: 0, totalDomains: 5, dddProgress: 0, patternsLearned: 0, sessionsCompleted: 0 },
291
+ security: { status: 'NONE', cvesFixed: 0, totalCves: 0 },
292
+ swarm: { activeAgents: 0, maxAgents: CONFIG.maxAgents, coordinationActive: false },
293
+ system: { memoryMB: memMB, contextPct: 0, intelligencePct: 0, subAgents: 0 },
294
+ lastUpdated: new Date().toISOString(),
295
+ });
296
+ }
46
297
 
47
298
  // ANSI colors
48
299
  const c = {
@@ -64,514 +315,379 @@ const c = {
64
315
  brightWhite: '\x1b[1;37m',
65
316
  };
66
317
 
67
- // Get user info
68
- function getUserInfo() {
69
- let name = 'user';
70
- let gitBranch = '';
71
- let modelName = 'Unknown';
72
-
318
+ // Safe execSync with strict timeout (returns empty string on failure)
319
+ function safeExec(cmd, timeoutMs) {
73
320
  try {
74
- const gitUserCmd = isWindows
75
- ? 'git config user.name 2>NUL || echo user'
76
- : 'git config user.name 2>/dev/null || echo "user"';
77
- const gitBranchCmd = isWindows
78
- ? 'git branch --show-current 2>NUL || echo.'
79
- : 'git branch --show-current 2>/dev/null || echo ""';
80
- name = execSync(gitUserCmd, { encoding: 'utf-8' }).trim();
81
- gitBranch = execSync(gitBranchCmd, { encoding: 'utf-8' }).trim();
82
- if (gitBranch === '.') gitBranch = ''; // Windows echo. outputs a dot
83
- } catch (e) {
84
- // Ignore errors
321
+ return execSync(cmd, {
322
+ encoding: 'utf-8',
323
+ timeout: timeoutMs || 2000,
324
+ stdio: ['pipe', 'pipe', 'pipe'],
325
+ }).trim();
326
+ } catch {
327
+ return '';
85
328
  }
329
+ }
86
330
 
87
- // Auto-detect model from Claude Code's config
331
+ // Safe JSON file reader (returns null on failure)
332
+ function readJSON(filePath) {
88
333
  try {
89
- const homedir = require('os').homedir();
90
- const claudeConfigPath = path.join(homedir, '.claude.json');
91
- if (fs.existsSync(claudeConfigPath)) {
92
- const claudeConfig = JSON.parse(fs.readFileSync(claudeConfigPath, 'utf-8'));
93
- // Try to find lastModelUsage - check current dir and parent dirs
94
- let lastModelUsage = null;
95
- const cwd = process.cwd();
96
- if (claudeConfig.projects) {
97
- // Try exact match first, then check if cwd starts with any project path
98
- for (const [projectPath, projectConfig] of Object.entries(claudeConfig.projects)) {
99
- if (cwd === projectPath || cwd.startsWith(projectPath + '/')) {
100
- lastModelUsage = projectConfig.lastModelUsage;
101
- break;
102
- }
103
- }
104
- }
105
- if (lastModelUsage) {
106
- const modelIds = Object.keys(lastModelUsage);
107
- if (modelIds.length > 0) {
108
- // Take the last model (most recently added to the object)
109
- // Or find the one with most tokens (most actively used this session)
110
- let modelId = modelIds[modelIds.length - 1];
111
- if (modelIds.length > 1) {
112
- // If multiple models, pick the one with most total tokens
113
- let maxTokens = 0;
114
- for (const id of modelIds) {
115
- const usage = lastModelUsage[id];
116
- const total = (usage.inputTokens || 0) + (usage.outputTokens || 0);
117
- if (total > maxTokens) {
118
- maxTokens = total;
119
- modelId = id;
120
- }
121
- }
122
- }
123
- // Parse model ID to human-readable name
124
- if (modelId.includes('opus')) modelName = 'Opus 4.5';
125
- else if (modelId.includes('sonnet')) modelName = 'Sonnet 4';
126
- else if (modelId.includes('haiku')) modelName = 'Haiku 4.5';
127
- else modelName = modelId.split('-').slice(1, 3).join(' ');
128
- }
129
- }
334
+ if (fs.existsSync(filePath)) {
335
+ return JSON.parse(fs.readFileSync(filePath, 'utf-8'));
130
336
  }
131
- } catch (e) {
132
- // Fallback to Unknown if can't read config
133
- }
134
-
135
- return { name, gitBranch, modelName };
337
+ } catch { /* ignore */ }
338
+ return null;
136
339
  }
137
340
 
138
- // Get learning stats from intelligence loop data (ADR-050)
139
- function getLearningStats() {
140
- let patterns = 0;
141
- let sessions = 0;
142
- let trajectories = 0;
143
- let edges = 0;
144
- let confidenceMean = 0;
145
- let accessedCount = 0;
146
- let trend = 'STABLE';
147
-
148
- // PRIMARY: Read from intelligence loop data files
149
- const dataDir = path.join(process.cwd(), '.claude-flow', 'data');
150
-
151
- // 1. graph-state.json — authoritative node/edge counts
152
- const graphPath = path.join(dataDir, 'graph-state.json');
153
- if (fs.existsSync(graphPath)) {
154
- try {
155
- const graph = JSON.parse(fs.readFileSync(graphPath, 'utf-8'));
156
- patterns = graph.nodes ? Object.keys(graph.nodes).length : 0;
157
- edges = Array.isArray(graph.edges) ? graph.edges.length : 0;
158
- } catch (e) { /* ignore */ }
159
- }
341
+ // ─── Git info (pure-Node / single exec — needed for branch display) ──────────
160
342
 
161
- // 2. ranked-context.json — confidence and access data
162
- const rankedPath = path.join(dataDir, 'ranked-context.json');
163
- if (fs.existsSync(rankedPath)) {
164
- try {
165
- const ranked = JSON.parse(fs.readFileSync(rankedPath, 'utf-8'));
166
- if (ranked.entries && ranked.entries.length > 0) {
167
- patterns = Math.max(patterns, ranked.entries.length);
168
- let confSum = 0;
169
- let accCount = 0;
170
- for (let i = 0; i < ranked.entries.length; i++) {
171
- confSum += (ranked.entries[i].confidence || 0);
172
- if ((ranked.entries[i].accessCount || 0) > 0) accCount++;
173
- }
174
- confidenceMean = confSum / ranked.entries.length;
175
- accessedCount = accCount;
176
- }
177
- } catch (e) { /* ignore */ }
178
- }
343
+ function getGitInfo() {
344
+ const result = {
345
+ name: 'user', gitBranch: '', modified: 0, untracked: 0,
346
+ staged: 0, ahead: 0, behind: 0,
347
+ };
179
348
 
180
- // 3. intelligence-snapshot.json — trend history
181
- const snapshotPath = path.join(dataDir, 'intelligence-snapshot.json');
182
- if (fs.existsSync(snapshotPath)) {
183
- try {
184
- const snapshot = JSON.parse(fs.readFileSync(snapshotPath, 'utf-8'));
185
- if (snapshot.history && snapshot.history.length >= 2) {
186
- const first = snapshot.history[0];
187
- const last = snapshot.history[snapshot.history.length - 1];
188
- const confDrift = (last.confidenceMean || 0) - (first.confidenceMean || 0);
189
- trend = confDrift > 0.01 ? 'IMPROVING' : confDrift < -0.01 ? 'DECLINING' : 'STABLE';
190
- sessions = Math.max(sessions, snapshot.history.length);
349
+ const script = [
350
+ 'git config user.name 2>/dev/null || echo user',
351
+ 'echo "---SEP---"',
352
+ 'git branch --show-current 2>/dev/null',
353
+ 'echo "---SEP---"',
354
+ 'git status --porcelain 2>/dev/null',
355
+ 'echo "---SEP---"',
356
+ 'git rev-list --left-right --count HEAD...@{upstream} 2>/dev/null || echo "0 0"',
357
+ ].join('; ');
358
+
359
+ const raw = safeExec("sh -c '" + script + "'", 3000);
360
+ if (!raw) return result;
361
+
362
+ const parts = raw.split('---SEP---').map(function(s) { return s.trim(); });
363
+ if (parts.length >= 4) {
364
+ result.name = parts[0] || 'user';
365
+ result.gitBranch = parts[1] || '';
366
+
367
+ if (parts[2]) {
368
+ for (const line of parts[2].split('\n')) {
369
+ if (!line || line.length < 2) continue;
370
+ const x = line[0], y = line[1];
371
+ if (x === '?' && y === '?') { result.untracked++; continue; }
372
+ if (x !== ' ' && x !== '?') result.staged++;
373
+ if (y !== ' ' && y !== '?') result.modified++;
191
374
  }
192
- } catch (e) { /* ignore */ }
193
- }
194
-
195
- // 4. auto-memory-store.json — fallback entry count
196
- if (patterns === 0) {
197
- const autoMemPath = path.join(dataDir, 'auto-memory-store.json');
198
- if (fs.existsSync(autoMemPath)) {
199
- try {
200
- const data = JSON.parse(fs.readFileSync(autoMemPath, 'utf-8'));
201
- patterns = Array.isArray(data) ? data.length : (data.entries ? data.entries.length : 0);
202
- } catch (e) { /* ignore */ }
203
375
  }
376
+
377
+ const ab = (parts[3] || '0 0').split(/\s+/);
378
+ result.ahead = parseInt(ab[0]) || 0;
379
+ result.behind = parseInt(ab[1]) || 0;
204
380
  }
205
381
 
206
- // FALLBACK: Legacy memory.db file-size estimation
207
- if (patterns === 0) {
208
- const memoryPaths = [
209
- path.join(process.cwd(), '.swarm', 'memory.db'),
210
- path.join(process.cwd(), '.claude', 'memory.db'),
211
- path.join(process.cwd(), 'data', 'memory.db'),
212
- ];
213
- for (let j = 0; j < memoryPaths.length; j++) {
214
- if (fs.existsSync(memoryPaths[j])) {
215
- try {
216
- const dbStats = fs.statSync(memoryPaths[j]);
217
- patterns = Math.floor(dbStats.size / 1024 / 2);
382
+ return result;
383
+ }
384
+
385
+ // Detect model name from Claude config (pure file reads, no exec)
386
+ function getModelName() {
387
+ try {
388
+ const claudeConfig = readJSON(path.join(os.homedir(), '.claude.json'));
389
+ if (claudeConfig && claudeConfig.projects) {
390
+ for (const [projectPath, projectConfig] of Object.entries(claudeConfig.projects)) {
391
+ if (CWD === projectPath || CWD.startsWith(projectPath + '/')) {
392
+ const usage = projectConfig.lastModelUsage;
393
+ if (usage) {
394
+ const ids = Object.keys(usage);
395
+ if (ids.length > 0) {
396
+ let modelId = ids[ids.length - 1];
397
+ let latest = 0;
398
+ for (const id of ids) {
399
+ const ts = usage[id] && usage[id].lastUsedAt ? new Date(usage[id].lastUsedAt).getTime() : 0;
400
+ if (ts > latest) { latest = ts; modelId = id; }
401
+ }
402
+ if (modelId.includes('opus')) return 'Opus 4.8';
403
+ if (modelId.includes('sonnet')) return 'Sonnet 4.6';
404
+ if (modelId.includes('haiku')) return 'Haiku 4.5';
405
+ return modelId.split('-').slice(1, 3).join(' ');
406
+ }
407
+ }
218
408
  break;
219
- } catch (e) { /* ignore */ }
409
+ }
220
410
  }
221
411
  }
412
+ } catch { /* ignore */ }
413
+
414
+ // Fallback: settings.json model field
415
+ const settings = getSettings();
416
+ if (settings && settings.model) {
417
+ const m = settings.model;
418
+ if (m.includes('opus')) return 'Opus 4.8';
419
+ if (m.includes('sonnet')) return 'Sonnet 4.6';
420
+ if (m.includes('haiku')) return 'Haiku 4.5';
222
421
  }
422
+ return 'Claude Code';
423
+ }
223
424
 
224
- // Session count from session files
225
- const sessionsPath = path.join(process.cwd(), '.claude', 'sessions');
226
- if (fs.existsSync(sessionsPath)) {
425
+ // ─── Stdin reader (Claude Code pipes session JSON) ──────────────
426
+ // Claude Code sends session JSON via stdin. Read synchronously so the
427
+ // script works both when invoked by Claude Code (stdin has JSON) and
428
+ // when run manually from terminal (stdin is empty/tty).
429
+ let _stdinData = null;
430
+ function getStdinData() {
431
+ if (_stdinData !== undefined && _stdinData !== null) return _stdinData;
432
+ try {
433
+ if (process.stdin.isTTY) { _stdinData = null; return null; }
434
+ const chunks = [];
435
+ const buf = Buffer.alloc(4096);
436
+ let bytesRead;
227
437
  try {
228
- const sessionFiles = fs.readdirSync(sessionsPath).filter(f => f.endsWith('.json'));
229
- sessions = Math.max(sessions, sessionFiles.length);
230
- } catch (e) { /* ignore */ }
438
+ while ((bytesRead = fs.readSync(0, buf, 0, buf.length, null)) > 0) {
439
+ chunks.push(buf.slice(0, bytesRead));
440
+ }
441
+ } catch { /* EOF or read error */ }
442
+ const raw = Buffer.concat(chunks).toString('utf-8').trim();
443
+ _stdinData = (raw && raw.startsWith('{')) ? JSON.parse(raw) : null;
444
+ } catch {
445
+ _stdinData = null;
231
446
  }
232
-
233
- trajectories = Math.floor(patterns / 5);
234
-
235
- return { patterns, sessions, trajectories, edges, confidenceMean, accessedCount, trend };
447
+ return _stdinData;
236
448
  }
237
449
 
238
- // Get V3 progress from learning state (grows as system learns)
239
- function getV3Progress() {
240
- const learning = getLearningStats();
241
-
242
- // DDD progress based on actual learned patterns
243
- // New install: 0 patterns = 0/5 domains, 0% DDD
244
- // As patterns grow: 10+ patterns = 1 domain, 50+ = 2, 100+ = 3, 200+ = 4, 500+ = 5
245
- let domainsCompleted = 0;
246
- if (learning.patterns >= 500) domainsCompleted = 5;
247
- else if (learning.patterns >= 200) domainsCompleted = 4;
248
- else if (learning.patterns >= 100) domainsCompleted = 3;
249
- else if (learning.patterns >= 50) domainsCompleted = 2;
250
- else if (learning.patterns >= 10) domainsCompleted = 1;
251
-
252
- const totalDomains = 5;
253
- const dddProgress = Math.min(100, Math.floor((domainsCompleted / totalDomains) * 100));
254
-
255
- return {
256
- domainsCompleted,
257
- totalDomains,
258
- dddProgress,
259
- patternsLearned: learning.patterns,
260
- sessionsCompleted: learning.sessions
261
- };
450
+ function getModelFromStdin() {
451
+ const data = getStdinData();
452
+ return (data && data.model && data.model.display_name) ? data.model.display_name : null;
262
453
  }
263
454
 
264
- // Get security status based on actual scans
265
- function getSecurityStatus() {
266
- // Check for security scan results in memory
267
- const scanResultsPath = path.join(process.cwd(), '.claude', 'security-scans');
268
- let cvesFixed = 0;
269
- const totalCves = 3;
270
-
271
- if (fs.existsSync(scanResultsPath)) {
272
- try {
273
- const scans = fs.readdirSync(scanResultsPath).filter(f => f.endsWith('.json'));
274
- // Each successful scan file = 1 CVE addressed
275
- cvesFixed = Math.min(totalCves, scans.length);
276
- } catch (e) {
277
- // Ignore
278
- }
279
- }
280
-
281
- // Also check .swarm/security for audit results
282
- const auditPath = path.join(process.cwd(), '.swarm', 'security');
283
- if (fs.existsSync(auditPath)) {
284
- try {
285
- const audits = fs.readdirSync(auditPath).filter(f => f.includes('audit'));
286
- cvesFixed = Math.min(totalCves, Math.max(cvesFixed, audits.length));
287
- } catch (e) {
288
- // Ignore
289
- }
455
+ function getContextFromStdin() {
456
+ const data = getStdinData();
457
+ if (data && data.context_window) {
458
+ return { usedPct: Math.floor(data.context_window.used_percentage || 0) };
290
459
  }
291
-
292
- const status = cvesFixed >= totalCves ? 'CLEAN' : cvesFixed > 0 ? 'IN_PROGRESS' : 'PENDING';
293
-
294
- return {
295
- status,
296
- cvesFixed,
297
- totalCves,
298
- };
460
+ return null;
299
461
  }
300
462
 
301
- // Get swarm status
302
- function getSwarmStatus() {
303
- let activeAgents = 0;
304
- let coordinationActive = false;
305
-
306
- try {
307
- if (isWindows) {
308
- // Windows: use tasklist and findstr
309
- const ps = execSync('tasklist 2>NUL | findstr /I "agentic-flow" 2>NUL | find /C /V "" 2>NUL || echo 0', { encoding: 'utf-8' });
310
- activeAgents = Math.max(0, parseInt(ps.trim()) || 0);
311
- } else {
312
- const ps = execSync('ps aux 2>/dev/null | grep -c agentic-flow || echo "0"', { encoding: 'utf-8' });
313
- activeAgents = Math.max(0, parseInt(ps.trim()) - 1);
314
- }
315
- coordinationActive = activeAgents > 0;
316
- } catch (e) {
317
- // Ignore errors - default to 0 agents
463
+ function getCostFromStdin() {
464
+ const data = getStdinData();
465
+ if (data && data.cost) {
466
+ const durationMs = data.cost.total_duration_ms || 0;
467
+ const mins = Math.floor(durationMs / 60000);
468
+ const secs = Math.floor((durationMs % 60000) / 1000);
469
+ return {
470
+ costUsd: data.cost.total_cost_usd || 0,
471
+ duration: mins > 0 ? mins + 'm' + secs + 's' : secs + 's',
472
+ };
318
473
  }
319
-
320
- return {
321
- activeAgents,
322
- maxAgents: CONFIG.maxAgents,
323
- coordinationActive,
324
- };
474
+ return null;
325
475
  }
326
476
 
327
- // Get system metrics (dynamic based on actual state)
328
- function getSystemMetrics() {
329
- let memoryMB = 0;
330
- let subAgents = 0;
331
-
477
+ // Read package version from the first package.json we find.
478
+ function getPkgVersion() {
479
+ let ver = '3.6';
332
480
  try {
333
- if (isWindows) {
334
- // Windows: use tasklist for memory info, fallback to process.memoryUsage
335
- // tasklist memory column is complex to parse, use Node.js API instead
336
- memoryMB = Math.floor(process.memoryUsage().heapUsed / 1024 / 1024);
337
- } else {
338
- const mem = execSync('ps aux | grep -E "(node|agentic|claude)" | grep -v grep | awk \'{sum += $6} END {print int(sum/1024)}\'', { encoding: 'utf-8' });
339
- memoryMB = parseInt(mem.trim()) || 0;
340
- }
341
- } catch (e) {
342
- // Fallback
343
- memoryMB = Math.floor(process.memoryUsage().heapUsed / 1024 / 1024);
344
- }
345
-
346
- // Get learning stats for intelligence %
347
- const learning = getLearningStats();
348
-
349
- // Intelligence % from REAL intelligence loop data (ADR-050)
350
- // Composite: 40% confidence mean + 30% access ratio + 30% pattern density
351
- let intelligencePct = 0;
352
- if (learning.confidenceMean > 0 || (learning.patterns > 0 && learning.accessedCount > 0)) {
353
- const confScore = Math.min(100, Math.floor(learning.confidenceMean * 100));
354
- const accessRatio = learning.patterns > 0 ? (learning.accessedCount / learning.patterns) : 0;
355
- const accessScore = Math.min(100, Math.floor(accessRatio * 100));
356
- const densityScore = Math.min(100, Math.floor(learning.patterns / 5));
357
- intelligencePct = Math.floor(confScore * 0.4 + accessScore * 0.3 + densityScore * 0.3);
358
- }
359
- // Fallback: legacy pattern count
360
- if (intelligencePct === 0 && learning.patterns > 0) {
361
- intelligencePct = Math.min(100, Math.floor(learning.patterns / 10));
362
- }
363
-
364
- // Context % based on session history
365
- const contextPct = Math.min(100, Math.floor(learning.sessions * 5));
366
-
367
- // Count active sub-agents from process list
368
- try {
369
- if (isWindows) {
370
- // Windows: use tasklist and findstr for agent counting
371
- const agents = execSync('tasklist 2>NUL | findstr /I "claude-flow" 2>NUL | find /C /V "" 2>NUL || echo 0', { encoding: 'utf-8' });
372
- subAgents = Math.max(0, parseInt(agents.trim()) || 0);
373
- } else {
374
- const agents = execSync('ps aux 2>/dev/null | grep -c "claude-flow.*agent" || echo "0"', { encoding: 'utf-8' });
375
- subAgents = Math.max(0, parseInt(agents.trim()) - 1);
481
+ const home = os.homedir();
482
+ const pkgPaths = [
483
+ path.join(home, '.claude', 'plugins', 'marketplaces', 'ruflo', 'package.json'),
484
+ path.join(CWD, 'node_modules', '@claude-flow', 'cli', 'package.json'),
485
+ path.join(CWD, 'node_modules', 'ruflo', 'package.json'),
486
+ path.join(CWD, 'v3', '@claude-flow', 'cli', 'package.json'),
487
+ ];
488
+ // #2221: global installs (npm i -g ruflo) live outside CWD/node_modules, so the
489
+ // probes above all miss and the version falls back to the hard-coded default.
490
+ // Derive the global node_modules dir from the running node binary (no npm spawn —
491
+ // statusline renders often). Covers nvm/mise (bin/../lib/node_modules) and Windows
492
+ // (bin/node_modules) layouts.
493
+ try {
494
+ const binDir = path.dirname(process.execPath);
495
+ const globalModuleDirs = [path.join(binDir, '..', 'lib', 'node_modules'), path.join(binDir, 'node_modules')];
496
+ // #2221 follow-up: a custom npm prefix (e.g. ~/.npm-global) is decoupled from
497
+ // the node binary location, so the binDir-derived probes above all miss. Also
498
+ // probe the npm prefix from the environment and the common ~/.npm-global default.
499
+ for (const prefix of [process.env.npm_config_prefix, process.env.PREFIX, path.join(home, '.npm-global')]) {
500
+ if (prefix) globalModuleDirs.push(path.join(prefix, 'lib', 'node_modules'));
501
+ }
502
+ for (const gm of globalModuleDirs) {
503
+ pkgPaths.push(
504
+ path.join(gm, 'ruflo', 'package.json'),
505
+ path.join(gm, '@claude-flow', 'cli', 'package.json'),
506
+ );
507
+ }
508
+ } catch { /* ignore */ }
509
+ for (const p of pkgPaths) {
510
+ if (!fs.existsSync(p)) continue;
511
+ try {
512
+ const pkg = JSON.parse(fs.readFileSync(p, 'utf-8'));
513
+ if (pkg && typeof pkg.version === 'string' && pkg.version.length > 0) { ver = pkg.version; break; }
514
+ } catch { /* ignore */ }
376
515
  }
377
- } catch (e) {
378
- // Ignore - default to 0
379
- }
380
-
381
- return {
382
- memoryMB,
383
- contextPct,
384
- intelligencePct,
385
- subAgents,
386
- };
516
+ } catch { /* ignore */ }
517
+ return ver;
387
518
  }
388
519
 
389
- // Generate progress bar
520
+ // ─── Rendering ──────────────────────────────────────────────────
521
+
390
522
  function progressBar(current, total) {
391
523
  const width = 5;
392
524
  const filled = Math.round((current / total) * width);
393
- const empty = width - filled;
394
- return '[' + '\u25CF'.repeat(filled) + '\u25CB'.repeat(empty) + ']';
525
+ return '[' + '●'.repeat(filled) + '○'.repeat(width - filled) + ']';
395
526
  }
396
527
 
397
- // Generate full statusline
398
528
  function generateStatusline() {
399
- const user = getUserInfo();
400
- const progress = getV3Progress();
401
- const security = getSecurityStatus();
402
- const swarm = getSwarmStatus();
403
- const system = getSystemMetrics();
529
+ const d = getStatuslineData();
530
+ const git = getGitInfo();
531
+ const modelName = getModelFromStdin() || (d.user && d.user.modelName) || 'Claude Code';
532
+ const ctxInfo = getContextFromStdin();
533
+ const costInfo = getCostFromStdin();
534
+ const pkgVersion = getPkgVersion();
535
+
536
+ const progress = d.v3Progress || {};
537
+ const security = d.security || {};
538
+ const swarm = d.swarm || {};
539
+ const system = d.system || {};
540
+ const adrs = d.adrs || {};
541
+ const hooks = d.hooks || {};
542
+ const agentdb = d.agentdb || {};
543
+ const tests = d.tests || {};
544
+
545
+ const domainsCompleted = progress.domainsCompleted || 0;
546
+ const totalDomains = progress.totalDomains || 5;
547
+ const dddProgress = progress.dddProgress || 0;
548
+ const patternsLearned = progress.patternsLearned || 0;
549
+ const activeAgents = swarm.activeAgents || 0;
550
+ const maxAgents = swarm.maxAgents || CONFIG.maxAgents;
551
+ const coordinationActive = swarm.coordinationActive || false;
552
+ const intelligencePct = system.intelligencePct || 0;
553
+ const memoryMB = system.memoryMB || 0;
554
+ const subAgents = system.subAgents || 0;
555
+ const cvesFixed = security.cvesFixed || 0;
556
+ const totalCves = security.totalCves || 0;
557
+ const secStatus = security.status || 'NONE';
558
+ const adrCount = adrs.count || 0;
559
+ const adrImpl = adrs.implemented || 0;
560
+ const hooksEnabled = hooks.enabled || 0;
561
+ const hooksTotal = hooks.total || 0;
562
+ const vectorCount = agentdb.vectorCount || 0;
563
+ const hasHnsw = agentdb.hasHnsw || false;
564
+ const dbSizeKB = agentdb.dbSizeKB || 0;
565
+ const testFiles = tests.testFiles || 0;
566
+ const testCases = tests.testCases || testFiles * 4;
567
+
404
568
  const lines = [];
405
569
 
406
- // Header Line
407
- let header = `${c.bold}${c.brightPurple}Claude Flow V3 ${c.reset}`;
408
- header += `${swarm.coordinationActive ? c.brightCyan : c.dim}${c.brightCyan}${user.name}${c.reset}`;
409
- if (user.gitBranch) {
410
- header += ` ${c.dim}│${c.reset} ${c.brightBlue}⎇ ${user.gitBranch}${c.reset}`;
570
+ // Header
571
+ let header = c.bold + c.brightPurple + 'RuFlo V' + pkgVersion + ' ' + c.reset;
572
+ header += (coordinationActive ? c.brightCyan : c.dim) + '' + c.brightCyan + git.name + c.reset;
573
+ if (git.gitBranch) {
574
+ header += ' ' + c.dim + '│' + c.reset + ' ' + c.brightBlue + '⏇ ' + git.gitBranch + c.reset;
575
+ const changes = git.modified + git.staged + git.untracked;
576
+ if (changes > 0) {
577
+ let ind = '';
578
+ if (git.staged > 0) ind += c.brightGreen + '+' + git.staged + c.reset;
579
+ if (git.modified > 0) ind += c.brightYellow + '~' + git.modified + c.reset;
580
+ if (git.untracked > 0) ind += c.dim + '?' + git.untracked + c.reset;
581
+ header += ' ' + ind;
582
+ }
583
+ if (git.ahead > 0) header += ' ' + c.brightGreen + '↑' + git.ahead + c.reset;
584
+ if (git.behind > 0) header += ' ' + c.brightRed + '↓' + git.behind + c.reset;
585
+ }
586
+ header += ' ' + c.dim + '│' + c.reset + ' ' + c.purple + modelName + c.reset;
587
+ const duration = costInfo ? costInfo.duration : '';
588
+ if (duration) header += ' ' + c.dim + '│' + c.reset + ' ' + c.cyan + '⏱ ' + duration + c.reset;
589
+ if (ctxInfo && ctxInfo.usedPct > 0) {
590
+ const ctxColor = ctxInfo.usedPct >= 90 ? c.brightRed : ctxInfo.usedPct >= 70 ? c.brightYellow : c.brightGreen;
591
+ header += ' ' + c.dim + '│' + c.reset + ' ' + ctxColor + '● ' + ctxInfo.usedPct + '% ctx' + c.reset;
592
+ }
593
+ if (!CONFIG.hideCost && costInfo && costInfo.costUsd > 0) {
594
+ header += ' ' + c.dim + '│' + c.reset + ' ' + c.brightYellow + CONFIG.costSymbol + costInfo.costUsd.toFixed(2) + c.reset;
411
595
  }
412
- header += ` ${c.dim}│${c.reset} ${c.purple}${user.modelName}${c.reset}`;
413
596
  lines.push(header);
414
597
 
415
598
  // Separator
416
- lines.push(`${c.dim}─────────────────────────────────────────────────────${c.reset}`);
417
-
418
- // Line 1: DDD Domain Progress
419
- const domainsColor = progress.domainsCompleted >= 3 ? c.brightGreen : progress.domainsCompleted > 0 ? c.yellow : c.red;
599
+ lines.push(c.dim + '─'.repeat(53) + c.reset);
600
+
601
+ // Line 1: DDD Domains
602
+ const domainsColor = domainsCompleted >= 3 ? c.brightGreen : domainsCompleted > 0 ? c.yellow : c.red;
603
+ let perfIndicator;
604
+ if (hasHnsw && vectorCount > 0) {
605
+ const speedup = vectorCount > 10000 ? '12500x' : vectorCount > 1000 ? '150x' : '10x';
606
+ perfIndicator = c.brightGreen + '⚡ HNSW ' + speedup + c.reset;
607
+ } else if (patternsLearned > 0) {
608
+ const pk = patternsLearned >= 1000 ? (patternsLearned / 1000).toFixed(1) + 'k' : String(patternsLearned);
609
+ perfIndicator = c.brightYellow + '📚 ' + pk + ' patterns' + c.reset;
610
+ } else {
611
+ perfIndicator = c.dim + '⚡ target: 150x-12500x' + c.reset;
612
+ }
420
613
  lines.push(
421
- `${c.brightCyan}🏗️ DDD Domains${c.reset} ${progressBar(progress.domainsCompleted, progress.totalDomains)} ` +
422
- `${domainsColor}${progress.domainsCompleted}${c.reset}/${c.brightWhite}${progress.totalDomains}${c.reset} ` +
423
- `${c.brightYellow}⚡ 1.0x${c.reset} ${c.dim}→${c.reset} ${c.brightYellow}2.49x-7.47x${c.reset}`
614
+ c.brightCyan + '🏗️ DDD Domains' + c.reset + ' ' + progressBar(domainsCompleted, totalDomains) + ' ' +
615
+ domainsColor + domainsCompleted + c.reset + '/' + c.brightWhite + totalDomains + c.reset + ' ' + perfIndicator
424
616
  );
425
617
 
426
- // Line 2: Swarm + CVE + Memory + Context + Intelligence
427
- const swarmIndicator = swarm.coordinationActive ? `${c.brightGreen}◉${c.reset}` : `${c.dim}○${c.reset}`;
428
- const agentsColor = swarm.activeAgents > 0 ? c.brightGreen : c.red;
429
- let securityIcon = security.status === 'CLEAN' ? '🟢' : security.status === 'IN_PROGRESS' ? '🟡' : '🔴';
430
- let securityColor = security.status === 'CLEAN' ? c.brightGreen : security.status === 'IN_PROGRESS' ? c.brightYellow : c.brightRed;
618
+ // Line 2: Swarm + Hooks + CVE + Memory + Intelligence
619
+ const swarmInd = coordinationActive ? c.brightGreen + '◉' + c.reset : c.dim + '○' + c.reset;
620
+ const agentsColor = activeAgents > 0 ? c.brightGreen : c.red;
621
+ const secIcon = secStatus === 'CLEAN' ? '🟢' : (secStatus === 'IN_PROGRESS' || secStatus === 'STALE') ? '🟡' : (secStatus === 'NONE' ? '⚪' : '🔴');
622
+ const secColor = secStatus === 'CLEAN' ? c.brightGreen : (secStatus === 'IN_PROGRESS' || secStatus === 'STALE') ? c.brightYellow : (secStatus === 'NONE' ? c.dim : c.brightRed);
623
+ const hooksColor = hooksEnabled > 0 ? c.brightGreen : c.dim;
624
+ const intellColor = intelligencePct >= 80 ? c.brightGreen : intelligencePct >= 40 ? c.brightYellow : c.dim;
431
625
 
432
626
  lines.push(
433
- `${c.brightYellow}🤖 Swarm${c.reset} ${swarmIndicator} [${agentsColor}${String(swarm.activeAgents).padStart(2)}${c.reset}/${c.brightWhite}${swarm.maxAgents}${c.reset}] ` +
434
- `${c.brightPurple}👥 ${system.subAgents}${c.reset} ` +
435
- `${securityIcon} ${securityColor}CVE ${security.cvesFixed}${c.reset}/${c.brightWhite}${security.totalCves}${c.reset} ` +
436
- `${c.brightCyan}💾 ${system.memoryMB}MB${c.reset} ` +
437
- `${c.brightGreen}📂 ${String(system.contextPct).padStart(3)}%${c.reset} ` +
438
- `${c.dim}🧠 ${String(system.intelligencePct).padStart(3)}%${c.reset}`
627
+ c.brightYellow + '🤖 Swarm' + c.reset + ' ' + swarmInd + ' [' + agentsColor + String(activeAgents).padStart(2) + c.reset + '/' + c.brightWhite + maxAgents + c.reset + '] ' +
628
+ c.brightPurple + '👥 ' + subAgents + c.reset + ' ' +
629
+ c.brightBlue + '🪝 ' + hooksColor + hooksEnabled + c.reset + '/' + c.brightWhite + hooksTotal + c.reset + ' ' +
630
+ secIcon + ' ' + secColor + 'CVE ' + cvesFixed + c.reset + '/' + c.brightWhite + totalCves + c.reset + ' ' +
631
+ c.brightCyan + '💾 ' + memoryMB + 'MB' + c.reset + ' ' +
632
+ intellColor + '🧠 ' + String(intelligencePct).padStart(3) + '%' + c.reset
439
633
  );
440
634
 
441
- // Line 3: Architecture status
442
- const dddColor = progress.dddProgress >= 50 ? c.brightGreen : progress.dddProgress > 0 ? c.yellow : c.red;
443
- lines.push(
444
- `${c.brightPurple}🔧 Architecture${c.reset} ` +
445
- `${c.cyan}DDD${c.reset} ${dddColor}●${String(progress.dddProgress).padStart(3)}%${c.reset} ${c.dim}│${c.reset} ` +
446
- `${c.cyan}Security${c.reset} ${securityColor}●${security.status}${c.reset} ${c.dim}│${c.reset} ` +
447
- `${c.cyan}Memory${c.reset} ${c.brightGreen}●AgentDB${c.reset} ${c.dim}│${c.reset} ` +
448
- `${c.cyan}Integration${c.reset} ${swarm.coordinationActive ? c.brightCyan : c.dim}●${c.reset}`
449
- );
450
-
451
- return lines.join('\n');
452
- }
453
-
454
- // Generate JSON data
455
- function generateJSON() {
456
- return {
457
- user: getUserInfo(),
458
- v3Progress: getV3Progress(),
459
- security: getSecurityStatus(),
460
- swarm: getSwarmStatus(),
461
- system: getSystemMetrics(),
462
- performance: {
463
- flashAttentionTarget: '2.49x-7.47x',
464
- searchImprovement: '150x-12,500x',
465
- memoryReduction: '50-75%',
466
- },
467
- lastUpdated: new Date().toISOString(),
468
- };
469
- }
470
-
471
- /**
472
- * Generate single-line output for Claude Code compatibility
473
- * This avoids the collision zone issue entirely by using one line
474
- * @see https://github.com/ruvnet/claude-flow/issues/985
475
- */
476
- function generateSingleLine() {
477
- if (!CONFIG.enabled) return '';
478
-
479
- const user = getUserInfo();
480
- const progress = getV3Progress();
481
- const security = getSecurityStatus();
482
- const swarm = getSwarmStatus();
483
- const system = getSystemMetrics();
484
-
485
- const swarmIndicator = swarm.coordinationActive ? '●' : '○';
486
- const securityStatus = security.status === 'CLEAN' ? '✓' :
487
- security.cvesFixed > 0 ? '~' : '✗';
488
-
489
- return `${c.brightPurple}CF-V3${c.reset} ${c.dim}|${c.reset} ` +
490
- `${c.cyan}D:${progress.domainsCompleted}/${progress.totalDomains}${c.reset} ${c.dim}|${c.reset} ` +
491
- `${c.yellow}S:${swarmIndicator}${swarm.activeAgents}/${swarm.maxAgents}${c.reset} ${c.dim}|${c.reset} ` +
492
- `${security.status === 'CLEAN' ? c.green : c.red}CVE:${securityStatus}${security.cvesFixed}/${security.totalCves}${c.reset} ${c.dim}|${c.reset} ` +
493
- `${c.dim}🧠${system.intelligencePct}%${c.reset}`;
494
- }
495
-
496
- /**
497
- * Generate safe multi-line statusline that avoids Claude Code collision zone
498
- * The collision zone is columns 15-25 on the second-to-last line.
499
- * We pad that line with spaces to push content past column 25.
500
- * @see https://github.com/ruvnet/claude-flow/issues/985
501
- */
502
- function generateSafeStatusline() {
503
- if (!CONFIG.enabled) return '';
504
-
505
- const user = getUserInfo();
506
- const progress = getV3Progress();
507
- const security = getSecurityStatus();
508
- const swarm = getSwarmStatus();
509
- const system = getSystemMetrics();
510
- const lines = [];
511
-
512
- // Header Line
513
- let header = `${c.bold}${c.brightPurple}▊ Claude Flow V3 ${c.reset}`;
514
- header += `${swarm.coordinationActive ? c.brightCyan : c.dim}● ${c.brightCyan}${user.name}${c.reset}`;
515
- if (user.gitBranch) {
516
- header += ` ${c.dim}│${c.reset} ${c.brightBlue}⎇ ${user.gitBranch}${c.reset}`;
517
- }
518
- header += ` ${c.dim}│${c.reset} ${c.purple}${user.modelName}${c.reset}`;
519
- lines.push(header);
520
-
521
- // Separator
522
- lines.push(`${c.dim}─────────────────────────────────────────────────────${c.reset}`);
635
+ // Line 3: Architecture
636
+ const dddColor = dddProgress >= 50 ? c.brightGreen : dddProgress > 0 ? c.yellow : c.red;
637
+ const adrColor = adrCount > 0 ? (adrImpl === adrCount ? c.brightGreen : c.yellow) : c.dim;
638
+ const adrDisplay = adrColor + '●' + adrImpl + '/' + adrCount + c.reset;
523
639
 
524
- // Line 1: DDD Domain Progress
525
- const domainsColor = progress.domainsCompleted >= 3 ? c.brightGreen : progress.domainsCompleted > 0 ? c.yellow : c.red;
526
640
  lines.push(
527
- `${c.brightCyan}🏗️ DDD Domains${c.reset} ${progressBar(progress.domainsCompleted, progress.totalDomains)} ` +
528
- `${domainsColor}${progress.domainsCompleted}${c.reset}/${c.brightWhite}${progress.totalDomains}${c.reset} ` +
529
- `${c.brightYellow}⚡ 1.0x${c.reset} ${c.dim}→${c.reset} ${c.brightYellow}2.49x-7.47x${c.reset}`
641
+ c.brightPurple + '🔧 Architecture' + c.reset + ' ' +
642
+ c.cyan + 'ADRs' + c.reset + ' ' + adrDisplay + ' ' + c.dim + '│' + c.reset + ' ' +
643
+ c.cyan + 'DDD' + c.reset + ' ' + dddColor + '●' + String(dddProgress).padStart(3) + '%' + c.reset + ' ' + c.dim + '│' + c.reset + ' ' +
644
+ c.cyan + 'Security' + c.reset + ' ' + secColor + '●' + secStatus + c.reset
530
645
  );
531
646
 
532
- // Line 2 (COLLISION LINE): Swarm status with 24 spaces padding after emoji
533
- // The emoji (🤖) is 2 columns. 24 spaces pushes content to column 26, past the collision zone (15-25)
534
- const swarmIndicator = swarm.coordinationActive ? `${c.brightGreen}◉${c.reset}` : `${c.dim}○${c.reset}`;
535
- const agentsColor = swarm.activeAgents > 0 ? c.brightGreen : c.red;
536
- let securityIcon = security.status === 'CLEAN' ? '🟢' : security.status === 'IN_PROGRESS' ? '🟡' : '🔴';
537
- let securityColor = security.status === 'CLEAN' ? c.brightGreen : security.status === 'IN_PROGRESS' ? c.brightYellow : c.brightRed;
538
-
539
- // CRITICAL: 24 spaces after 🤖 (emoji is 2 cols, so 2+24=26, past collision zone cols 15-25)
540
- lines.push(
541
- `${c.brightYellow}🤖${c.reset} ` + // 24 spaces padding
542
- `${swarmIndicator} [${agentsColor}${String(swarm.activeAgents).padStart(2)}${c.reset}/${c.brightWhite}${swarm.maxAgents}${c.reset}] ` +
543
- `${c.brightPurple}👥 ${system.subAgents}${c.reset} ` +
544
- `${securityIcon} ${securityColor}CVE ${security.cvesFixed}${c.reset}/${c.brightWhite}${security.totalCves}${c.reset} ` +
545
- `${c.brightCyan}💾 ${system.memoryMB}MB${c.reset} ` +
546
- `${c.dim}🧠 ${system.intelligencePct}%${c.reset}`
547
- );
647
+ // Line 4: AgentDB, Tests, Integration
648
+ const hnswInd = hasHnsw ? c.brightGreen + '⚡' + c.reset : '';
649
+ const sizeDisp = dbSizeKB >= 1024 ? (dbSizeKB / 1024).toFixed(1) + 'MB' : dbSizeKB + 'KB';
650
+ const vectorColor = vectorCount > 0 ? c.brightGreen : c.dim;
651
+ const testColor = testFiles > 0 ? c.brightGreen : c.dim;
652
+
653
+ // MCP / DB integration from data
654
+ const integration = d.integration || {};
655
+ const mcpServers = (integration.mcpServers) || {};
656
+ let integStr = '';
657
+ if (mcpServers.total > 0) {
658
+ const mcpCol = mcpServers.enabled === mcpServers.total ? c.brightGreen : mcpServers.enabled > 0 ? c.brightYellow : c.red;
659
+ integStr += c.cyan + 'MCP' + c.reset + ' ' + mcpCol + '●' + mcpServers.enabled + '/' + mcpServers.total + c.reset;
660
+ }
661
+ if (integration.hasDatabase) integStr += (integStr ? ' ' : '') + c.brightGreen + '◆' + c.reset + 'DB';
662
+ if (!integStr) integStr = c.dim + '● none' + c.reset;
548
663
 
549
- // Line 3: Architecture status (this is the last line, not in collision zone)
550
- const dddColor = progress.dddProgress >= 50 ? c.brightGreen : progress.dddProgress > 0 ? c.yellow : c.red;
551
664
  lines.push(
552
- `${c.brightPurple}🔧 Architecture${c.reset} ` +
553
- `${c.cyan}DDD${c.reset} ${dddColor}●${String(progress.dddProgress).padStart(3)}%${c.reset} ${c.dim}│${c.reset} ` +
554
- `${c.cyan}Security${c.reset} ${securityColor}●${security.status}${c.reset} ${c.dim}│${c.reset} ` +
555
- `${c.cyan}Memory${c.reset} ${c.brightGreen}●AgentDB${c.reset} ${c.dim}│${c.reset} ` +
556
- `${c.cyan}Integration${c.reset} ${swarm.coordinationActive ? c.brightCyan : c.dim}●${c.reset}`
665
+ c.brightCyan + '📊 AgentDB' + c.reset + ' ' +
666
+ c.cyan + 'Vectors' + c.reset + ' ' + vectorColor + '●' + vectorCount + hnswInd + c.reset + ' ' + c.dim + '│' + c.reset + ' ' +
667
+ c.cyan + 'Size' + c.reset + ' ' + c.brightWhite + sizeDisp + c.reset + ' ' + c.dim + '│' + c.reset + ' ' +
668
+ c.cyan + 'Tests' + c.reset + ' ' + testColor + '●' + testFiles + c.reset + ' ' + c.dim + '(~' + testCases + ' cases)' + c.reset + ' ' + c.dim + '│' + c.reset + ' ' +
669
+ integStr
557
670
  );
558
671
 
559
672
  return lines.join('\n');
560
673
  }
561
674
 
562
- // Main
675
+ // JSON output — delegates to CLI for accuracy; caller can use --json flag
676
+ function generateJSON() {
677
+ const d = getStatuslineData();
678
+ const git = getGitInfo();
679
+ return Object.assign({}, d, {
680
+ user: Object.assign({ name: git.name, gitBranch: git.gitBranch }, d.user || {}),
681
+ git: { modified: git.modified, untracked: git.untracked, staged: git.staged, ahead: git.ahead, behind: git.behind },
682
+ lastUpdated: new Date().toISOString(),
683
+ });
684
+ }
685
+
686
+ // ─── Main ───────────────────────────────────────────────────────
563
687
  if (process.argv.includes('--json')) {
564
688
  console.log(JSON.stringify(generateJSON(), null, 2));
565
689
  } else if (process.argv.includes('--compact')) {
566
690
  console.log(JSON.stringify(generateJSON()));
567
- } else if (process.argv.includes('--single')) {
568
- // Single-line mode - completely avoids collision zone
569
- console.log(generateSingleLine());
570
- } else if (process.argv.includes('--unsafe') || process.argv.includes('--legacy')) {
571
- // Legacy mode - original multi-line without collision avoidance
572
- console.log(generateStatusline());
573
691
  } else {
574
- // Default: Safe multi-line mode with collision zone avoidance
575
- // Use --unsafe or --legacy to get the original behavior
576
- console.log(generateSafeStatusline());
692
+ console.log(generateStatusline());
577
693
  }