@cloudpftc/opencode-orchestrator 3.5.15

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 (715) hide show
  1. package/.opencode/agents/architect.yaml +33 -0
  2. package/.opencode/agents/coder.yaml +45 -0
  3. package/.opencode/agents/coordinator.yaml +38 -0
  4. package/.opencode/agents/performance-engineer.yaml +33 -0
  5. package/.opencode/agents/researcher.yaml +32 -0
  6. package/.opencode/agents/reviewer.yaml +32 -0
  7. package/.opencode/agents/security-architect.yaml +32 -0
  8. package/.opencode/agents/tester.yaml +37 -0
  9. package/.opencode/skills/agent-adaptive-coordinator/SKILL.md +403 -0
  10. package/.opencode/skills/agent-agent/SKILL.md +823 -0
  11. package/.opencode/skills/agent-agentic-payments/SKILL.md +133 -0
  12. package/.opencode/skills/agent-analyze-code-quality/SKILL.md +186 -0
  13. package/.opencode/skills/agent-app-store/SKILL.md +95 -0
  14. package/.opencode/skills/agent-arch-system-design/SKILL.md +162 -0
  15. package/.opencode/skills/agent-architecture/SKILL.md +479 -0
  16. package/.opencode/skills/agent-authentication/SKILL.md +76 -0
  17. package/.opencode/skills/agent-automation-smart-agent/SKILL.md +212 -0
  18. package/.opencode/skills/agent-base-template-generator/SKILL.md +49 -0
  19. package/.opencode/skills/agent-benchmark-suite/SKILL.md +672 -0
  20. package/.opencode/skills/agent-byzantine-coordinator/SKILL.md +70 -0
  21. package/.opencode/skills/agent-challenges/SKILL.md +88 -0
  22. package/.opencode/skills/agent-code-analyzer/SKILL.md +217 -0
  23. package/.opencode/skills/agent-code-goal-planner/SKILL.md +453 -0
  24. package/.opencode/skills/agent-code-review-swarm/SKILL.md +545 -0
  25. package/.opencode/skills/agent-coder/SKILL.md +273 -0
  26. package/.opencode/skills/agent-collective-intelligence-coordinator/SKILL.md +137 -0
  27. package/.opencode/skills/agent-consensus-coordinator/SKILL.md +345 -0
  28. package/.opencode/skills/agent-coordination/SKILL.md +82 -0
  29. package/.opencode/skills/agent-coordinator-swarm-init/SKILL.md +112 -0
  30. package/.opencode/skills/agent-crdt-synchronizer/SKILL.md +1004 -0
  31. package/.opencode/skills/agent-data-ml-model/SKILL.md +200 -0
  32. package/.opencode/skills/agent-dev-backend-api/SKILL.md +352 -0
  33. package/.opencode/skills/agent-docs-api-openapi/SKILL.md +181 -0
  34. package/.opencode/skills/agent-github-modes/SKILL.md +180 -0
  35. package/.opencode/skills/agent-github-pr-manager/SKILL.md +184 -0
  36. package/.opencode/skills/agent-goal-planner/SKILL.md +80 -0
  37. package/.opencode/skills/agent-gossip-coordinator/SKILL.md +70 -0
  38. package/.opencode/skills/agent-hierarchical-coordinator/SKILL.md +334 -0
  39. package/.opencode/skills/agent-implementer-sparc-coder/SKILL.md +266 -0
  40. package/.opencode/skills/agent-issue-tracker/SKILL.md +326 -0
  41. package/.opencode/skills/agent-load-balancer/SKILL.md +438 -0
  42. package/.opencode/skills/agent-matrix-optimizer/SKILL.md +192 -0
  43. package/.opencode/skills/agent-memory-coordinator/SKILL.md +194 -0
  44. package/.opencode/skills/agent-mesh-coordinator/SKILL.md +399 -0
  45. package/.opencode/skills/agent-migration-plan/SKILL.md +753 -0
  46. package/.opencode/skills/agent-multi-repo-swarm/SKILL.md +560 -0
  47. package/.opencode/skills/agent-neural-network/SKILL.md +95 -0
  48. package/.opencode/skills/agent-ops-cicd-github/SKILL.md +171 -0
  49. package/.opencode/skills/agent-orchestrator-task/SKILL.md +146 -0
  50. package/.opencode/skills/agent-pagerank-analyzer/SKILL.md +306 -0
  51. package/.opencode/skills/agent-payments/SKILL.md +90 -0
  52. package/.opencode/skills/agent-performance-analyzer/SKILL.md +206 -0
  53. package/.opencode/skills/agent-performance-benchmarker/SKILL.md +858 -0
  54. package/.opencode/skills/agent-performance-monitor/SKILL.md +679 -0
  55. package/.opencode/skills/agent-performance-optimizer/SKILL.md +375 -0
  56. package/.opencode/skills/agent-planner/SKILL.md +175 -0
  57. package/.opencode/skills/agent-pr-manager/SKILL.md +198 -0
  58. package/.opencode/skills/agent-production-validator/SKILL.md +402 -0
  59. package/.opencode/skills/agent-project-board-sync/SKILL.md +516 -0
  60. package/.opencode/skills/agent-pseudocode/SKILL.md +325 -0
  61. package/.opencode/skills/agent-queen-coordinator/SKILL.md +210 -0
  62. package/.opencode/skills/agent-quorum-manager/SKILL.md +830 -0
  63. package/.opencode/skills/agent-raft-manager/SKILL.md +70 -0
  64. package/.opencode/skills/agent-refinement/SKILL.md +532 -0
  65. package/.opencode/skills/agent-release-manager/SKILL.md +374 -0
  66. package/.opencode/skills/agent-release-swarm/SKILL.md +590 -0
  67. package/.opencode/skills/agent-repo-architect/SKILL.md +405 -0
  68. package/.opencode/skills/agent-researcher/SKILL.md +197 -0
  69. package/.opencode/skills/agent-resource-allocator/SKILL.md +681 -0
  70. package/.opencode/skills/agent-reviewer/SKILL.md +333 -0
  71. package/.opencode/skills/agent-safla-neural/SKILL.md +81 -0
  72. package/.opencode/skills/agent-sandbox/SKILL.md +83 -0
  73. package/.opencode/skills/agent-scout-explorer/SKILL.md +249 -0
  74. package/.opencode/skills/agent-security-manager/SKILL.md +629 -0
  75. package/.opencode/skills/agent-sona-learning-optimizer/SKILL.md +81 -0
  76. package/.opencode/skills/agent-sparc-coordinator/SKILL.md +190 -0
  77. package/.opencode/skills/agent-spec-mobile-react-native/SKILL.md +232 -0
  78. package/.opencode/skills/agent-specification/SKILL.md +283 -0
  79. package/.opencode/skills/agent-swarm/SKILL.md +83 -0
  80. package/.opencode/skills/agent-swarm-issue/SKILL.md +580 -0
  81. package/.opencode/skills/agent-swarm-memory-manager/SKILL.md +200 -0
  82. package/.opencode/skills/agent-swarm-pr/SKILL.md +435 -0
  83. package/.opencode/skills/agent-sync-coordinator/SKILL.md +459 -0
  84. package/.opencode/skills/agent-tdd-london-swarm/SKILL.md +251 -0
  85. package/.opencode/skills/agent-test-long-runner/SKILL.md +51 -0
  86. package/.opencode/skills/agent-tester/SKILL.md +326 -0
  87. package/.opencode/skills/agent-topology-optimizer/SKILL.md +815 -0
  88. package/.opencode/skills/agent-trading-predictor/SKILL.md +253 -0
  89. package/.opencode/skills/agent-user-tools/SKILL.md +103 -0
  90. package/.opencode/skills/agent-v3-integration-architect/SKILL.md +353 -0
  91. package/.opencode/skills/agent-v3-memory-specialist/SKILL.md +325 -0
  92. package/.opencode/skills/agent-v3-performance-engineer/SKILL.md +404 -0
  93. package/.opencode/skills/agent-v3-queen-coordinator/SKILL.md +105 -0
  94. package/.opencode/skills/agent-v3-security-architect/SKILL.md +181 -0
  95. package/.opencode/skills/agent-worker-specialist/SKILL.md +224 -0
  96. package/.opencode/skills/agent-workflow/SKILL.md +91 -0
  97. package/.opencode/skills/agent-workflow-automation/SKILL.md +642 -0
  98. package/.opencode/skills/agentdb-advanced/SKILL.md +552 -0
  99. package/.opencode/skills/agentdb-learning/SKILL.md +547 -0
  100. package/.opencode/skills/agentdb-memory-patterns/SKILL.md +341 -0
  101. package/.opencode/skills/agentdb-optimization/SKILL.md +511 -0
  102. package/.opencode/skills/agentdb-vector-search/SKILL.md +341 -0
  103. package/.opencode/skills/agentic-jujutsu/SKILL.md +647 -0
  104. package/.opencode/skills/claims/SKILL.md +72 -0
  105. package/.opencode/skills/embeddings/SKILL.md +71 -0
  106. package/.opencode/skills/flow-nexus-neural/SKILL.md +740 -0
  107. package/.opencode/skills/flow-nexus-platform/SKILL.md +1159 -0
  108. package/.opencode/skills/flow-nexus-swarm/SKILL.md +612 -0
  109. package/.opencode/skills/github-automation/SKILL.md +65 -0
  110. package/.opencode/skills/github-code-review/SKILL.md +1142 -0
  111. package/.opencode/skills/github-multi-repo/SKILL.md +876 -0
  112. package/.opencode/skills/github-project-management/SKILL.md +1279 -0
  113. package/.opencode/skills/github-release-management/SKILL.md +1083 -0
  114. package/.opencode/skills/github-workflow-automation/SKILL.md +1067 -0
  115. package/.opencode/skills/hive-mind/SKILL.md +67 -0
  116. package/.opencode/skills/hive-mind-advanced/SKILL.md +714 -0
  117. package/.opencode/skills/hooks-automation/SKILL.md +1203 -0
  118. package/.opencode/skills/memory-management/SKILL.md +128 -0
  119. package/.opencode/skills/neural-training/SKILL.md +70 -0
  120. package/.opencode/skills/pair-programming/SKILL.md +1204 -0
  121. package/.opencode/skills/performance-analysis/SKILL.md +565 -0
  122. package/.opencode/skills/reasoningbank-agentdb/SKILL.md +448 -0
  123. package/.opencode/skills/reasoningbank-intelligence/SKILL.md +203 -0
  124. package/.opencode/skills/security-audit/SKILL.md +137 -0
  125. package/.opencode/skills/skill-builder/SKILL.md +912 -0
  126. package/.opencode/skills/sparc-methodology/SKILL.md +120 -0
  127. package/.opencode/skills/stream-chain/SKILL.md +565 -0
  128. package/.opencode/skills/swarm-advanced/SKILL.md +975 -0
  129. package/.opencode/skills/swarm-orchestration/SKILL.md +116 -0
  130. package/.opencode/skills/v3-cli-modernization/SKILL.md +874 -0
  131. package/.opencode/skills/v3-core-implementation/SKILL.md +799 -0
  132. package/.opencode/skills/v3-ddd-architecture/SKILL.md +444 -0
  133. package/.opencode/skills/v3-integration-deep/SKILL.md +243 -0
  134. package/.opencode/skills/v3-mcp-optimization/SKILL.md +779 -0
  135. package/.opencode/skills/v3-memory-unification/SKILL.md +176 -0
  136. package/.opencode/skills/v3-performance-optimization/SKILL.md +392 -0
  137. package/.opencode/skills/v3-security-overhaul/SKILL.md +84 -0
  138. package/.opencode/skills/v3-swarm-coordination/SKILL.md +342 -0
  139. package/.opencode/skills/verification-quality/SKILL.md +651 -0
  140. package/.opencode/skills/worker-benchmarks/SKILL.md +137 -0
  141. package/.opencode/skills/worker-integration/SKILL.md +156 -0
  142. package/.opencode/skills/workflow-automation/SKILL.md +80 -0
  143. package/LICENSE +21 -0
  144. package/README.md +7393 -0
  145. package/bin/cli.js +11 -0
  146. package/bin/npx-repair.js +7 -0
  147. package/bin/npx-safe-launch.js +9 -0
  148. package/opencode.json +84 -0
  149. package/package.json +131 -0
  150. package/v3/@claude-flow/cli/README.md +7536 -0
  151. package/v3/@claude-flow/cli/bin/cli.js +156 -0
  152. package/v3/@claude-flow/cli/bin/mcp-server.js +189 -0
  153. package/v3/@claude-flow/cli/bin/preinstall.cjs +2 -0
  154. package/v3/@claude-flow/cli/dist/src/appliance/gguf-engine.d.ts +91 -0
  155. package/v3/@claude-flow/cli/dist/src/appliance/gguf-engine.js +425 -0
  156. package/v3/@claude-flow/cli/dist/src/appliance/ruvllm-bridge.d.ts +102 -0
  157. package/v3/@claude-flow/cli/dist/src/appliance/ruvllm-bridge.js +292 -0
  158. package/v3/@claude-flow/cli/dist/src/appliance/rvfa-builder.d.ts +44 -0
  159. package/v3/@claude-flow/cli/dist/src/appliance/rvfa-builder.js +328 -0
  160. package/v3/@claude-flow/cli/dist/src/appliance/rvfa-distribution.d.ts +97 -0
  161. package/v3/@claude-flow/cli/dist/src/appliance/rvfa-distribution.js +370 -0
  162. package/v3/@claude-flow/cli/dist/src/appliance/rvfa-format.d.ts +111 -0
  163. package/v3/@claude-flow/cli/dist/src/appliance/rvfa-format.js +393 -0
  164. package/v3/@claude-flow/cli/dist/src/appliance/rvfa-runner.d.ts +69 -0
  165. package/v3/@claude-flow/cli/dist/src/appliance/rvfa-runner.js +237 -0
  166. package/v3/@claude-flow/cli/dist/src/appliance/rvfa-signing.d.ts +123 -0
  167. package/v3/@claude-flow/cli/dist/src/appliance/rvfa-signing.js +347 -0
  168. package/v3/@claude-flow/cli/dist/src/benchmarks/pretrain/index.d.ts +58 -0
  169. package/v3/@claude-flow/cli/dist/src/benchmarks/pretrain/index.js +404 -0
  170. package/v3/@claude-flow/cli/dist/src/commands/agent.d.ts +8 -0
  171. package/v3/@claude-flow/cli/dist/src/commands/agent.js +819 -0
  172. package/v3/@claude-flow/cli/dist/src/commands/analyze.d.ts +19 -0
  173. package/v3/@claude-flow/cli/dist/src/commands/analyze.js +1823 -0
  174. package/v3/@claude-flow/cli/dist/src/commands/appliance-advanced.d.ts +9 -0
  175. package/v3/@claude-flow/cli/dist/src/commands/appliance-advanced.js +215 -0
  176. package/v3/@claude-flow/cli/dist/src/commands/appliance.d.ts +8 -0
  177. package/v3/@claude-flow/cli/dist/src/commands/appliance.js +406 -0
  178. package/v3/@claude-flow/cli/dist/src/commands/benchmark.d.ts +10 -0
  179. package/v3/@claude-flow/cli/dist/src/commands/benchmark.js +459 -0
  180. package/v3/@claude-flow/cli/dist/src/commands/claims.d.ts +10 -0
  181. package/v3/@claude-flow/cli/dist/src/commands/claims.js +373 -0
  182. package/v3/@claude-flow/cli/dist/src/commands/completions.d.ts +10 -0
  183. package/v3/@claude-flow/cli/dist/src/commands/completions.js +539 -0
  184. package/v3/@claude-flow/cli/dist/src/commands/config.d.ts +8 -0
  185. package/v3/@claude-flow/cli/dist/src/commands/config.js +406 -0
  186. package/v3/@claude-flow/cli/dist/src/commands/daemon.d.ts +8 -0
  187. package/v3/@claude-flow/cli/dist/src/commands/daemon.js +609 -0
  188. package/v3/@claude-flow/cli/dist/src/commands/deployment.d.ts +10 -0
  189. package/v3/@claude-flow/cli/dist/src/commands/deployment.js +289 -0
  190. package/v3/@claude-flow/cli/dist/src/commands/doctor.d.ts +10 -0
  191. package/v3/@claude-flow/cli/dist/src/commands/doctor.js +548 -0
  192. package/v3/@claude-flow/cli/dist/src/commands/embeddings.d.ts +18 -0
  193. package/v3/@claude-flow/cli/dist/src/commands/embeddings.js +1576 -0
  194. package/v3/@claude-flow/cli/dist/src/commands/guidance.d.ts +8 -0
  195. package/v3/@claude-flow/cli/dist/src/commands/guidance.js +560 -0
  196. package/v3/@claude-flow/cli/dist/src/commands/hive-mind.d.ts +11 -0
  197. package/v3/@claude-flow/cli/dist/src/commands/hive-mind.js +1145 -0
  198. package/v3/@claude-flow/cli/dist/src/commands/hooks.d.ts +8 -0
  199. package/v3/@claude-flow/cli/dist/src/commands/hooks.js +3759 -0
  200. package/v3/@claude-flow/cli/dist/src/commands/index.d.ts +113 -0
  201. package/v3/@claude-flow/cli/dist/src/commands/index.js +368 -0
  202. package/v3/@claude-flow/cli/dist/src/commands/init.d.ts +8 -0
  203. package/v3/@claude-flow/cli/dist/src/commands/init.js +822 -0
  204. package/v3/@claude-flow/cli/dist/src/commands/issues.d.ts +21 -0
  205. package/v3/@claude-flow/cli/dist/src/commands/issues.js +567 -0
  206. package/v3/@claude-flow/cli/dist/src/commands/mcp.d.ts +11 -0
  207. package/v3/@claude-flow/cli/dist/src/commands/mcp.js +715 -0
  208. package/v3/@claude-flow/cli/dist/src/commands/memory.d.ts +8 -0
  209. package/v3/@claude-flow/cli/dist/src/commands/memory.js +1292 -0
  210. package/v3/@claude-flow/cli/dist/src/commands/migrate.d.ts +8 -0
  211. package/v3/@claude-flow/cli/dist/src/commands/migrate.js +410 -0
  212. package/v3/@claude-flow/cli/dist/src/commands/neural.d.ts +10 -0
  213. package/v3/@claude-flow/cli/dist/src/commands/neural.js +1448 -0
  214. package/v3/@claude-flow/cli/dist/src/commands/performance.d.ts +10 -0
  215. package/v3/@claude-flow/cli/dist/src/commands/performance.js +579 -0
  216. package/v3/@claude-flow/cli/dist/src/commands/plugins.d.ts +11 -0
  217. package/v3/@claude-flow/cli/dist/src/commands/plugins.js +820 -0
  218. package/v3/@claude-flow/cli/dist/src/commands/process.d.ts +10 -0
  219. package/v3/@claude-flow/cli/dist/src/commands/process.js +641 -0
  220. package/v3/@claude-flow/cli/dist/src/commands/progress.d.ts +11 -0
  221. package/v3/@claude-flow/cli/dist/src/commands/progress.js +259 -0
  222. package/v3/@claude-flow/cli/dist/src/commands/providers.d.ts +10 -0
  223. package/v3/@claude-flow/cli/dist/src/commands/providers.js +232 -0
  224. package/v3/@claude-flow/cli/dist/src/commands/route.d.ts +16 -0
  225. package/v3/@claude-flow/cli/dist/src/commands/route.js +813 -0
  226. package/v3/@claude-flow/cli/dist/src/commands/ruvector/backup.d.ts +11 -0
  227. package/v3/@claude-flow/cli/dist/src/commands/ruvector/backup.js +746 -0
  228. package/v3/@claude-flow/cli/dist/src/commands/ruvector/benchmark.d.ts +11 -0
  229. package/v3/@claude-flow/cli/dist/src/commands/ruvector/benchmark.js +480 -0
  230. package/v3/@claude-flow/cli/dist/src/commands/ruvector/import.d.ts +18 -0
  231. package/v3/@claude-flow/cli/dist/src/commands/ruvector/import.js +349 -0
  232. package/v3/@claude-flow/cli/dist/src/commands/ruvector/index.d.ts +29 -0
  233. package/v3/@claude-flow/cli/dist/src/commands/ruvector/index.js +129 -0
  234. package/v3/@claude-flow/cli/dist/src/commands/ruvector/init.d.ts +11 -0
  235. package/v3/@claude-flow/cli/dist/src/commands/ruvector/init.js +431 -0
  236. package/v3/@claude-flow/cli/dist/src/commands/ruvector/migrate.d.ts +11 -0
  237. package/v3/@claude-flow/cli/dist/src/commands/ruvector/migrate.js +481 -0
  238. package/v3/@claude-flow/cli/dist/src/commands/ruvector/optimize.d.ts +11 -0
  239. package/v3/@claude-flow/cli/dist/src/commands/ruvector/optimize.js +503 -0
  240. package/v3/@claude-flow/cli/dist/src/commands/ruvector/setup.d.ts +18 -0
  241. package/v3/@claude-flow/cli/dist/src/commands/ruvector/setup.js +765 -0
  242. package/v3/@claude-flow/cli/dist/src/commands/ruvector/status.d.ts +11 -0
  243. package/v3/@claude-flow/cli/dist/src/commands/ruvector/status.js +456 -0
  244. package/v3/@claude-flow/cli/dist/src/commands/security.d.ts +10 -0
  245. package/v3/@claude-flow/cli/dist/src/commands/security.js +575 -0
  246. package/v3/@claude-flow/cli/dist/src/commands/session.d.ts +8 -0
  247. package/v3/@claude-flow/cli/dist/src/commands/session.js +750 -0
  248. package/v3/@claude-flow/cli/dist/src/commands/start.d.ts +8 -0
  249. package/v3/@claude-flow/cli/dist/src/commands/start.js +418 -0
  250. package/v3/@claude-flow/cli/dist/src/commands/status.d.ts +8 -0
  251. package/v3/@claude-flow/cli/dist/src/commands/status.js +591 -0
  252. package/v3/@claude-flow/cli/dist/src/commands/swarm.d.ts +8 -0
  253. package/v3/@claude-flow/cli/dist/src/commands/swarm.js +748 -0
  254. package/v3/@claude-flow/cli/dist/src/commands/task.d.ts +8 -0
  255. package/v3/@claude-flow/cli/dist/src/commands/task.js +671 -0
  256. package/v3/@claude-flow/cli/dist/src/commands/transfer-store.d.ts +13 -0
  257. package/v3/@claude-flow/cli/dist/src/commands/transfer-store.js +428 -0
  258. package/v3/@claude-flow/cli/dist/src/commands/update.d.ts +8 -0
  259. package/v3/@claude-flow/cli/dist/src/commands/update.js +276 -0
  260. package/v3/@claude-flow/cli/dist/src/commands/workflow.d.ts +8 -0
  261. package/v3/@claude-flow/cli/dist/src/commands/workflow.js +617 -0
  262. package/v3/@claude-flow/cli/dist/src/config-adapter.d.ts +15 -0
  263. package/v3/@claude-flow/cli/dist/src/config-adapter.js +186 -0
  264. package/v3/@claude-flow/cli/dist/src/index.d.ts +76 -0
  265. package/v3/@claude-flow/cli/dist/src/index.js +470 -0
  266. package/v3/@claude-flow/cli/dist/src/infrastructure/in-memory-repositories.d.ts +68 -0
  267. package/v3/@claude-flow/cli/dist/src/infrastructure/in-memory-repositories.js +264 -0
  268. package/v3/@claude-flow/cli/dist/src/init/claudemd-generator.d.ts +25 -0
  269. package/v3/@claude-flow/cli/dist/src/init/claudemd-generator.js +486 -0
  270. package/v3/@claude-flow/cli/dist/src/init/executor.d.ts +41 -0
  271. package/v3/@claude-flow/cli/dist/src/init/executor.js +1734 -0
  272. package/v3/@claude-flow/cli/dist/src/init/helpers-generator.d.ts +60 -0
  273. package/v3/@claude-flow/cli/dist/src/init/helpers-generator.js +1166 -0
  274. package/v3/@claude-flow/cli/dist/src/init/index.d.ts +13 -0
  275. package/v3/@claude-flow/cli/dist/src/init/index.js +15 -0
  276. package/v3/@claude-flow/cli/dist/src/init/mcp-generator.d.ts +31 -0
  277. package/v3/@claude-flow/cli/dist/src/init/mcp-generator.js +147 -0
  278. package/v3/@claude-flow/cli/dist/src/init/settings-generator.d.ts +14 -0
  279. package/v3/@claude-flow/cli/dist/src/init/settings-generator.js +399 -0
  280. package/v3/@claude-flow/cli/dist/src/init/statusline-generator.d.ts +28 -0
  281. package/v3/@claude-flow/cli/dist/src/init/statusline-generator.js +817 -0
  282. package/v3/@claude-flow/cli/dist/src/init/types.d.ts +283 -0
  283. package/v3/@claude-flow/cli/dist/src/init/types.js +254 -0
  284. package/v3/@claude-flow/cli/dist/src/mcp-client.d.ts +92 -0
  285. package/v3/@claude-flow/cli/dist/src/mcp-client.js +237 -0
  286. package/v3/@claude-flow/cli/dist/src/mcp-server.d.ts +161 -0
  287. package/v3/@claude-flow/cli/dist/src/mcp-server.js +627 -0
  288. package/v3/@claude-flow/cli/dist/src/mcp-tools/agent-tools.d.ts +9 -0
  289. package/v3/@claude-flow/cli/dist/src/mcp-tools/agent-tools.js +549 -0
  290. package/v3/@claude-flow/cli/dist/src/mcp-tools/agentdb-tools.d.ts +30 -0
  291. package/v3/@claude-flow/cli/dist/src/mcp-tools/agentdb-tools.js +557 -0
  292. package/v3/@claude-flow/cli/dist/src/mcp-tools/analyze-tools.d.ts +38 -0
  293. package/v3/@claude-flow/cli/dist/src/mcp-tools/analyze-tools.js +317 -0
  294. package/v3/@claude-flow/cli/dist/src/mcp-tools/auto-install.d.ts +83 -0
  295. package/v3/@claude-flow/cli/dist/src/mcp-tools/auto-install.js +131 -0
  296. package/v3/@claude-flow/cli/dist/src/mcp-tools/browser-tools.d.ts +13 -0
  297. package/v3/@claude-flow/cli/dist/src/mcp-tools/browser-tools.js +550 -0
  298. package/v3/@claude-flow/cli/dist/src/mcp-tools/claims-tools.d.ts +12 -0
  299. package/v3/@claude-flow/cli/dist/src/mcp-tools/claims-tools.js +732 -0
  300. package/v3/@claude-flow/cli/dist/src/mcp-tools/config-tools.d.ts +8 -0
  301. package/v3/@claude-flow/cli/dist/src/mcp-tools/config-tools.js +343 -0
  302. package/v3/@claude-flow/cli/dist/src/mcp-tools/coordination-tools.d.ts +13 -0
  303. package/v3/@claude-flow/cli/dist/src/mcp-tools/coordination-tools.js +486 -0
  304. package/v3/@claude-flow/cli/dist/src/mcp-tools/daa-tools.d.ts +13 -0
  305. package/v3/@claude-flow/cli/dist/src/mcp-tools/daa-tools.js +426 -0
  306. package/v3/@claude-flow/cli/dist/src/mcp-tools/embeddings-tools.d.ts +9 -0
  307. package/v3/@claude-flow/cli/dist/src/mcp-tools/embeddings-tools.js +782 -0
  308. package/v3/@claude-flow/cli/dist/src/mcp-tools/github-tools.d.ts +13 -0
  309. package/v3/@claude-flow/cli/dist/src/mcp-tools/github-tools.js +373 -0
  310. package/v3/@claude-flow/cli/dist/src/mcp-tools/hive-mind-tools.d.ts +8 -0
  311. package/v3/@claude-flow/cli/dist/src/mcp-tools/hive-mind-tools.js +583 -0
  312. package/v3/@claude-flow/cli/dist/src/mcp-tools/hooks-tools.d.ts +44 -0
  313. package/v3/@claude-flow/cli/dist/src/mcp-tools/hooks-tools.js +2969 -0
  314. package/v3/@claude-flow/cli/dist/src/mcp-tools/index.d.ts +23 -0
  315. package/v3/@claude-flow/cli/dist/src/mcp-tools/index.js +22 -0
  316. package/v3/@claude-flow/cli/dist/src/mcp-tools/memory-tools.d.ts +14 -0
  317. package/v3/@claude-flow/cli/dist/src/mcp-tools/memory-tools.js +499 -0
  318. package/v3/@claude-flow/cli/dist/src/mcp-tools/neural-tools.d.ts +16 -0
  319. package/v3/@claude-flow/cli/dist/src/mcp-tools/neural-tools.js +461 -0
  320. package/v3/@claude-flow/cli/dist/src/mcp-tools/performance-tools.d.ts +16 -0
  321. package/v3/@claude-flow/cli/dist/src/mcp-tools/performance-tools.js +534 -0
  322. package/v3/@claude-flow/cli/dist/src/mcp-tools/progress-tools.d.ts +14 -0
  323. package/v3/@claude-flow/cli/dist/src/mcp-tools/progress-tools.js +348 -0
  324. package/v3/@claude-flow/cli/dist/src/mcp-tools/security-tools.d.ts +18 -0
  325. package/v3/@claude-flow/cli/dist/src/mcp-tools/security-tools.js +434 -0
  326. package/v3/@claude-flow/cli/dist/src/mcp-tools/session-tools.d.ts +8 -0
  327. package/v3/@claude-flow/cli/dist/src/mcp-tools/session-tools.js +315 -0
  328. package/v3/@claude-flow/cli/dist/src/mcp-tools/swarm-tools.d.ts +9 -0
  329. package/v3/@claude-flow/cli/dist/src/mcp-tools/swarm-tools.js +197 -0
  330. package/v3/@claude-flow/cli/dist/src/mcp-tools/system-tools.d.ts +13 -0
  331. package/v3/@claude-flow/cli/dist/src/mcp-tools/system-tools.js +417 -0
  332. package/v3/@claude-flow/cli/dist/src/mcp-tools/task-tools.d.ts +8 -0
  333. package/v3/@claude-flow/cli/dist/src/mcp-tools/task-tools.js +338 -0
  334. package/v3/@claude-flow/cli/dist/src/mcp-tools/terminal-tools.d.ts +13 -0
  335. package/v3/@claude-flow/cli/dist/src/mcp-tools/terminal-tools.js +246 -0
  336. package/v3/@claude-flow/cli/dist/src/mcp-tools/transfer-tools.d.ts +14 -0
  337. package/v3/@claude-flow/cli/dist/src/mcp-tools/transfer-tools.js +396 -0
  338. package/v3/@claude-flow/cli/dist/src/mcp-tools/types.d.ts +31 -0
  339. package/v3/@claude-flow/cli/dist/src/mcp-tools/types.js +7 -0
  340. package/v3/@claude-flow/cli/dist/src/mcp-tools/workflow-tools.d.ts +8 -0
  341. package/v3/@claude-flow/cli/dist/src/mcp-tools/workflow-tools.js +572 -0
  342. package/v3/@claude-flow/cli/dist/src/memory/ewc-consolidation.d.ts +271 -0
  343. package/v3/@claude-flow/cli/dist/src/memory/ewc-consolidation.js +542 -0
  344. package/v3/@claude-flow/cli/dist/src/memory/intelligence.d.ts +285 -0
  345. package/v3/@claude-flow/cli/dist/src/memory/intelligence.js +794 -0
  346. package/v3/@claude-flow/cli/dist/src/memory/memory-bridge.d.ts +407 -0
  347. package/v3/@claude-flow/cli/dist/src/memory/memory-bridge.js +1494 -0
  348. package/v3/@claude-flow/cli/dist/src/memory/memory-initializer.d.ts +405 -0
  349. package/v3/@claude-flow/cli/dist/src/memory/memory-initializer.js +2105 -0
  350. package/v3/@claude-flow/cli/dist/src/memory/sona-optimizer.d.ts +227 -0
  351. package/v3/@claude-flow/cli/dist/src/memory/sona-optimizer.js +633 -0
  352. package/v3/@claude-flow/cli/dist/src/output.d.ts +133 -0
  353. package/v3/@claude-flow/cli/dist/src/output.js +514 -0
  354. package/v3/@claude-flow/cli/dist/src/parser.d.ts +41 -0
  355. package/v3/@claude-flow/cli/dist/src/parser.js +377 -0
  356. package/v3/@claude-flow/cli/dist/src/plugins/manager.d.ts +133 -0
  357. package/v3/@claude-flow/cli/dist/src/plugins/manager.js +400 -0
  358. package/v3/@claude-flow/cli/dist/src/plugins/store/discovery.d.ts +88 -0
  359. package/v3/@claude-flow/cli/dist/src/plugins/store/discovery.js +1147 -0
  360. package/v3/@claude-flow/cli/dist/src/plugins/store/index.d.ts +76 -0
  361. package/v3/@claude-flow/cli/dist/src/plugins/store/index.js +141 -0
  362. package/v3/@claude-flow/cli/dist/src/plugins/store/search.d.ts +46 -0
  363. package/v3/@claude-flow/cli/dist/src/plugins/store/search.js +230 -0
  364. package/v3/@claude-flow/cli/dist/src/plugins/store/types.d.ts +274 -0
  365. package/v3/@claude-flow/cli/dist/src/plugins/store/types.js +7 -0
  366. package/v3/@claude-flow/cli/dist/src/plugins/tests/demo-plugin-store.d.ts +7 -0
  367. package/v3/@claude-flow/cli/dist/src/plugins/tests/demo-plugin-store.js +126 -0
  368. package/v3/@claude-flow/cli/dist/src/plugins/tests/standalone-test.d.ts +12 -0
  369. package/v3/@claude-flow/cli/dist/src/plugins/tests/standalone-test.js +188 -0
  370. package/v3/@claude-flow/cli/dist/src/plugins/tests/test-plugin-store.d.ts +7 -0
  371. package/v3/@claude-flow/cli/dist/src/plugins/tests/test-plugin-store.js +206 -0
  372. package/v3/@claude-flow/cli/dist/src/production/circuit-breaker.d.ts +101 -0
  373. package/v3/@claude-flow/cli/dist/src/production/circuit-breaker.js +241 -0
  374. package/v3/@claude-flow/cli/dist/src/production/error-handler.d.ts +92 -0
  375. package/v3/@claude-flow/cli/dist/src/production/error-handler.js +299 -0
  376. package/v3/@claude-flow/cli/dist/src/production/index.d.ts +23 -0
  377. package/v3/@claude-flow/cli/dist/src/production/index.js +18 -0
  378. package/v3/@claude-flow/cli/dist/src/production/monitoring.d.ts +161 -0
  379. package/v3/@claude-flow/cli/dist/src/production/monitoring.js +356 -0
  380. package/v3/@claude-flow/cli/dist/src/production/rate-limiter.d.ts +80 -0
  381. package/v3/@claude-flow/cli/dist/src/production/rate-limiter.js +201 -0
  382. package/v3/@claude-flow/cli/dist/src/production/retry.d.ts +48 -0
  383. package/v3/@claude-flow/cli/dist/src/production/retry.js +179 -0
  384. package/v3/@claude-flow/cli/dist/src/prompt.d.ts +44 -0
  385. package/v3/@claude-flow/cli/dist/src/prompt.js +501 -0
  386. package/v3/@claude-flow/cli/dist/src/runtime/headless.d.ts +60 -0
  387. package/v3/@claude-flow/cli/dist/src/runtime/headless.js +284 -0
  388. package/v3/@claude-flow/cli/dist/src/ruvector/ast-analyzer.d.ts +67 -0
  389. package/v3/@claude-flow/cli/dist/src/ruvector/ast-analyzer.js +277 -0
  390. package/v3/@claude-flow/cli/dist/src/ruvector/coverage-router.d.ts +160 -0
  391. package/v3/@claude-flow/cli/dist/src/ruvector/coverage-router.js +529 -0
  392. package/v3/@claude-flow/cli/dist/src/ruvector/coverage-tools.d.ts +33 -0
  393. package/v3/@claude-flow/cli/dist/src/ruvector/coverage-tools.js +157 -0
  394. package/v3/@claude-flow/cli/dist/src/ruvector/diff-classifier.d.ts +175 -0
  395. package/v3/@claude-flow/cli/dist/src/ruvector/diff-classifier.js +698 -0
  396. package/v3/@claude-flow/cli/dist/src/ruvector/enhanced-model-router.d.ts +146 -0
  397. package/v3/@claude-flow/cli/dist/src/ruvector/enhanced-model-router.js +529 -0
  398. package/v3/@claude-flow/cli/dist/src/ruvector/flash-attention.d.ts +195 -0
  399. package/v3/@claude-flow/cli/dist/src/ruvector/flash-attention.js +643 -0
  400. package/v3/@claude-flow/cli/dist/src/ruvector/graph-analyzer.d.ts +187 -0
  401. package/v3/@claude-flow/cli/dist/src/ruvector/graph-analyzer.js +929 -0
  402. package/v3/@claude-flow/cli/dist/src/ruvector/index.d.ts +34 -0
  403. package/v3/@claude-flow/cli/dist/src/ruvector/index.js +60 -0
  404. package/v3/@claude-flow/cli/dist/src/ruvector/lora-adapter.d.ts +218 -0
  405. package/v3/@claude-flow/cli/dist/src/ruvector/lora-adapter.js +455 -0
  406. package/v3/@claude-flow/cli/dist/src/ruvector/model-router.d.ts +220 -0
  407. package/v3/@claude-flow/cli/dist/src/ruvector/model-router.js +488 -0
  408. package/v3/@claude-flow/cli/dist/src/ruvector/moe-router.d.ts +206 -0
  409. package/v3/@claude-flow/cli/dist/src/ruvector/moe-router.js +626 -0
  410. package/v3/@claude-flow/cli/dist/src/ruvector/q-learning-router.d.ts +211 -0
  411. package/v3/@claude-flow/cli/dist/src/ruvector/q-learning-router.js +681 -0
  412. package/v3/@claude-flow/cli/dist/src/ruvector/semantic-router.d.ts +77 -0
  413. package/v3/@claude-flow/cli/dist/src/ruvector/semantic-router.js +178 -0
  414. package/v3/@claude-flow/cli/dist/src/ruvector/vector-db.d.ts +69 -0
  415. package/v3/@claude-flow/cli/dist/src/ruvector/vector-db.js +243 -0
  416. package/v3/@claude-flow/cli/dist/src/services/agentic-flow-bridge.d.ts +50 -0
  417. package/v3/@claude-flow/cli/dist/src/services/agentic-flow-bridge.js +95 -0
  418. package/v3/@claude-flow/cli/dist/src/services/claim-service.d.ts +204 -0
  419. package/v3/@claude-flow/cli/dist/src/services/claim-service.js +818 -0
  420. package/v3/@claude-flow/cli/dist/src/services/container-worker-pool.d.ts +197 -0
  421. package/v3/@claude-flow/cli/dist/src/services/container-worker-pool.js +583 -0
  422. package/v3/@claude-flow/cli/dist/src/services/headless-worker-executor.d.ts +302 -0
  423. package/v3/@claude-flow/cli/dist/src/services/headless-worker-executor.js +971 -0
  424. package/v3/@claude-flow/cli/dist/src/services/index.d.ts +13 -0
  425. package/v3/@claude-flow/cli/dist/src/services/index.js +11 -0
  426. package/v3/@claude-flow/cli/dist/src/services/registry-api.d.ts +58 -0
  427. package/v3/@claude-flow/cli/dist/src/services/registry-api.js +146 -0
  428. package/v3/@claude-flow/cli/dist/src/services/ruvector-training.d.ts +214 -0
  429. package/v3/@claude-flow/cli/dist/src/services/ruvector-training.js +497 -0
  430. package/v3/@claude-flow/cli/dist/src/services/worker-daemon.d.ts +203 -0
  431. package/v3/@claude-flow/cli/dist/src/services/worker-daemon.js +756 -0
  432. package/v3/@claude-flow/cli/dist/src/services/worker-queue.d.ts +194 -0
  433. package/v3/@claude-flow/cli/dist/src/services/worker-queue.js +513 -0
  434. package/v3/@claude-flow/cli/dist/src/suggest.d.ts +53 -0
  435. package/v3/@claude-flow/cli/dist/src/suggest.js +200 -0
  436. package/v3/@claude-flow/cli/dist/src/transfer/anonymization/index.d.ts +25 -0
  437. package/v3/@claude-flow/cli/dist/src/transfer/anonymization/index.js +175 -0
  438. package/v3/@claude-flow/cli/dist/src/transfer/deploy-seraphine.d.ts +13 -0
  439. package/v3/@claude-flow/cli/dist/src/transfer/deploy-seraphine.js +205 -0
  440. package/v3/@claude-flow/cli/dist/src/transfer/export.d.ts +25 -0
  441. package/v3/@claude-flow/cli/dist/src/transfer/export.js +113 -0
  442. package/v3/@claude-flow/cli/dist/src/transfer/index.d.ts +12 -0
  443. package/v3/@claude-flow/cli/dist/src/transfer/index.js +31 -0
  444. package/v3/@claude-flow/cli/dist/src/transfer/ipfs/client.d.ts +109 -0
  445. package/v3/@claude-flow/cli/dist/src/transfer/ipfs/client.js +307 -0
  446. package/v3/@claude-flow/cli/dist/src/transfer/ipfs/upload.d.ts +95 -0
  447. package/v3/@claude-flow/cli/dist/src/transfer/ipfs/upload.js +411 -0
  448. package/v3/@claude-flow/cli/dist/src/transfer/models/seraphine.d.ts +72 -0
  449. package/v3/@claude-flow/cli/dist/src/transfer/models/seraphine.js +373 -0
  450. package/v3/@claude-flow/cli/dist/src/transfer/serialization/cfp.d.ts +49 -0
  451. package/v3/@claude-flow/cli/dist/src/transfer/serialization/cfp.js +183 -0
  452. package/v3/@claude-flow/cli/dist/src/transfer/storage/gcs.d.ts +82 -0
  453. package/v3/@claude-flow/cli/dist/src/transfer/storage/gcs.js +256 -0
  454. package/v3/@claude-flow/cli/dist/src/transfer/storage/index.d.ts +6 -0
  455. package/v3/@claude-flow/cli/dist/src/transfer/storage/index.js +6 -0
  456. package/v3/@claude-flow/cli/dist/src/transfer/store/discovery.d.ts +84 -0
  457. package/v3/@claude-flow/cli/dist/src/transfer/store/discovery.js +382 -0
  458. package/v3/@claude-flow/cli/dist/src/transfer/store/download.d.ts +70 -0
  459. package/v3/@claude-flow/cli/dist/src/transfer/store/download.js +334 -0
  460. package/v3/@claude-flow/cli/dist/src/transfer/store/index.d.ts +84 -0
  461. package/v3/@claude-flow/cli/dist/src/transfer/store/index.js +153 -0
  462. package/v3/@claude-flow/cli/dist/src/transfer/store/publish.d.ts +76 -0
  463. package/v3/@claude-flow/cli/dist/src/transfer/store/publish.js +294 -0
  464. package/v3/@claude-flow/cli/dist/src/transfer/store/registry.d.ts +58 -0
  465. package/v3/@claude-flow/cli/dist/src/transfer/store/registry.js +285 -0
  466. package/v3/@claude-flow/cli/dist/src/transfer/store/search.d.ts +54 -0
  467. package/v3/@claude-flow/cli/dist/src/transfer/store/search.js +232 -0
  468. package/v3/@claude-flow/cli/dist/src/transfer/store/tests/standalone-test.d.ts +12 -0
  469. package/v3/@claude-flow/cli/dist/src/transfer/store/tests/standalone-test.js +190 -0
  470. package/v3/@claude-flow/cli/dist/src/transfer/store/types.d.ts +193 -0
  471. package/v3/@claude-flow/cli/dist/src/transfer/store/types.js +6 -0
  472. package/v3/@claude-flow/cli/dist/src/transfer/test-seraphine.d.ts +6 -0
  473. package/v3/@claude-flow/cli/dist/src/transfer/test-seraphine.js +105 -0
  474. package/v3/@claude-flow/cli/dist/src/transfer/tests/test-store.d.ts +7 -0
  475. package/v3/@claude-flow/cli/dist/src/transfer/tests/test-store.js +214 -0
  476. package/v3/@claude-flow/cli/dist/src/transfer/types.d.ts +245 -0
  477. package/v3/@claude-flow/cli/dist/src/transfer/types.js +6 -0
  478. package/v3/@claude-flow/cli/dist/src/types.d.ts +198 -0
  479. package/v3/@claude-flow/cli/dist/src/types.js +38 -0
  480. package/v3/@claude-flow/cli/dist/src/update/checker.d.ts +34 -0
  481. package/v3/@claude-flow/cli/dist/src/update/checker.js +190 -0
  482. package/v3/@claude-flow/cli/dist/src/update/executor.d.ts +32 -0
  483. package/v3/@claude-flow/cli/dist/src/update/executor.js +181 -0
  484. package/v3/@claude-flow/cli/dist/src/update/index.d.ts +33 -0
  485. package/v3/@claude-flow/cli/dist/src/update/index.js +64 -0
  486. package/v3/@claude-flow/cli/dist/src/update/rate-limiter.d.ts +20 -0
  487. package/v3/@claude-flow/cli/dist/src/update/rate-limiter.js +96 -0
  488. package/v3/@claude-flow/cli/dist/src/update/validator.d.ts +17 -0
  489. package/v3/@claude-flow/cli/dist/src/update/validator.js +123 -0
  490. package/v3/@claude-flow/cli/package.json +108 -0
  491. package/v3/@claude-flow/guidance/README.md +1195 -0
  492. package/v3/@claude-flow/guidance/dist/adversarial.d.ts +284 -0
  493. package/v3/@claude-flow/guidance/dist/adversarial.js +572 -0
  494. package/v3/@claude-flow/guidance/dist/analyzer.d.ts +530 -0
  495. package/v3/@claude-flow/guidance/dist/analyzer.js +2518 -0
  496. package/v3/@claude-flow/guidance/dist/artifacts.d.ts +283 -0
  497. package/v3/@claude-flow/guidance/dist/artifacts.js +356 -0
  498. package/v3/@claude-flow/guidance/dist/authority.d.ts +290 -0
  499. package/v3/@claude-flow/guidance/dist/authority.js +558 -0
  500. package/v3/@claude-flow/guidance/dist/capabilities.d.ts +209 -0
  501. package/v3/@claude-flow/guidance/dist/capabilities.js +485 -0
  502. package/v3/@claude-flow/guidance/dist/coherence.d.ts +233 -0
  503. package/v3/@claude-flow/guidance/dist/coherence.js +372 -0
  504. package/v3/@claude-flow/guidance/dist/compiler.d.ts +87 -0
  505. package/v3/@claude-flow/guidance/dist/compiler.js +419 -0
  506. package/v3/@claude-flow/guidance/dist/conformance-kit.d.ts +225 -0
  507. package/v3/@claude-flow/guidance/dist/conformance-kit.js +629 -0
  508. package/v3/@claude-flow/guidance/dist/continue-gate.d.ts +214 -0
  509. package/v3/@claude-flow/guidance/dist/continue-gate.js +353 -0
  510. package/v3/@claude-flow/guidance/dist/crypto-utils.d.ts +17 -0
  511. package/v3/@claude-flow/guidance/dist/crypto-utils.js +24 -0
  512. package/v3/@claude-flow/guidance/dist/evolution.d.ts +282 -0
  513. package/v3/@claude-flow/guidance/dist/evolution.js +500 -0
  514. package/v3/@claude-flow/guidance/dist/gates.d.ts +79 -0
  515. package/v3/@claude-flow/guidance/dist/gates.js +302 -0
  516. package/v3/@claude-flow/guidance/dist/gateway.d.ts +206 -0
  517. package/v3/@claude-flow/guidance/dist/gateway.js +452 -0
  518. package/v3/@claude-flow/guidance/dist/generators.d.ts +153 -0
  519. package/v3/@claude-flow/guidance/dist/generators.js +682 -0
  520. package/v3/@claude-flow/guidance/dist/headless.d.ts +177 -0
  521. package/v3/@claude-flow/guidance/dist/headless.js +342 -0
  522. package/v3/@claude-flow/guidance/dist/hooks.d.ts +109 -0
  523. package/v3/@claude-flow/guidance/dist/hooks.js +347 -0
  524. package/v3/@claude-flow/guidance/dist/index.d.ts +205 -0
  525. package/v3/@claude-flow/guidance/dist/index.js +321 -0
  526. package/v3/@claude-flow/guidance/dist/ledger.d.ts +162 -0
  527. package/v3/@claude-flow/guidance/dist/ledger.js +375 -0
  528. package/v3/@claude-flow/guidance/dist/manifest-validator.d.ts +289 -0
  529. package/v3/@claude-flow/guidance/dist/manifest-validator.js +838 -0
  530. package/v3/@claude-flow/guidance/dist/memory-gate.d.ts +222 -0
  531. package/v3/@claude-flow/guidance/dist/memory-gate.js +382 -0
  532. package/v3/@claude-flow/guidance/dist/meta-governance.d.ts +265 -0
  533. package/v3/@claude-flow/guidance/dist/meta-governance.js +348 -0
  534. package/v3/@claude-flow/guidance/dist/optimizer.d.ts +104 -0
  535. package/v3/@claude-flow/guidance/dist/optimizer.js +329 -0
  536. package/v3/@claude-flow/guidance/dist/persistence.d.ts +189 -0
  537. package/v3/@claude-flow/guidance/dist/persistence.js +464 -0
  538. package/v3/@claude-flow/guidance/dist/proof.d.ts +185 -0
  539. package/v3/@claude-flow/guidance/dist/proof.js +238 -0
  540. package/v3/@claude-flow/guidance/dist/retriever.d.ts +116 -0
  541. package/v3/@claude-flow/guidance/dist/retriever.js +394 -0
  542. package/v3/@claude-flow/guidance/dist/ruvbot-integration.d.ts +370 -0
  543. package/v3/@claude-flow/guidance/dist/ruvbot-integration.js +738 -0
  544. package/v3/@claude-flow/guidance/dist/temporal.d.ts +426 -0
  545. package/v3/@claude-flow/guidance/dist/temporal.js +658 -0
  546. package/v3/@claude-flow/guidance/dist/trust.d.ts +283 -0
  547. package/v3/@claude-flow/guidance/dist/trust.js +473 -0
  548. package/v3/@claude-flow/guidance/dist/truth-anchors.d.ts +276 -0
  549. package/v3/@claude-flow/guidance/dist/truth-anchors.js +488 -0
  550. package/v3/@claude-flow/guidance/dist/types.d.ts +378 -0
  551. package/v3/@claude-flow/guidance/dist/types.js +10 -0
  552. package/v3/@claude-flow/guidance/dist/uncertainty.d.ts +372 -0
  553. package/v3/@claude-flow/guidance/dist/uncertainty.js +619 -0
  554. package/v3/@claude-flow/guidance/dist/wasm-kernel.d.ts +48 -0
  555. package/v3/@claude-flow/guidance/dist/wasm-kernel.js +158 -0
  556. package/v3/@claude-flow/guidance/package.json +197 -0
  557. package/v3/@claude-flow/shared/README.md +323 -0
  558. package/v3/@claude-flow/shared/dist/core/config/defaults.d.ts +41 -0
  559. package/v3/@claude-flow/shared/dist/core/config/defaults.js +186 -0
  560. package/v3/@claude-flow/shared/dist/core/config/index.d.ts +8 -0
  561. package/v3/@claude-flow/shared/dist/core/config/index.js +12 -0
  562. package/v3/@claude-flow/shared/dist/core/config/loader.d.ts +45 -0
  563. package/v3/@claude-flow/shared/dist/core/config/loader.js +222 -0
  564. package/v3/@claude-flow/shared/dist/core/config/schema.d.ts +1134 -0
  565. package/v3/@claude-flow/shared/dist/core/config/schema.js +158 -0
  566. package/v3/@claude-flow/shared/dist/core/config/validator.d.ts +92 -0
  567. package/v3/@claude-flow/shared/dist/core/config/validator.js +147 -0
  568. package/v3/@claude-flow/shared/dist/core/event-bus.d.ts +31 -0
  569. package/v3/@claude-flow/shared/dist/core/event-bus.js +197 -0
  570. package/v3/@claude-flow/shared/dist/core/index.d.ts +15 -0
  571. package/v3/@claude-flow/shared/dist/core/index.js +19 -0
  572. package/v3/@claude-flow/shared/dist/core/interfaces/agent.interface.d.ts +200 -0
  573. package/v3/@claude-flow/shared/dist/core/interfaces/agent.interface.js +6 -0
  574. package/v3/@claude-flow/shared/dist/core/interfaces/coordinator.interface.d.ts +310 -0
  575. package/v3/@claude-flow/shared/dist/core/interfaces/coordinator.interface.js +7 -0
  576. package/v3/@claude-flow/shared/dist/core/interfaces/event.interface.d.ts +224 -0
  577. package/v3/@claude-flow/shared/dist/core/interfaces/event.interface.js +46 -0
  578. package/v3/@claude-flow/shared/dist/core/interfaces/index.d.ts +10 -0
  579. package/v3/@claude-flow/shared/dist/core/interfaces/index.js +15 -0
  580. package/v3/@claude-flow/shared/dist/core/interfaces/memory.interface.d.ts +298 -0
  581. package/v3/@claude-flow/shared/dist/core/interfaces/memory.interface.js +7 -0
  582. package/v3/@claude-flow/shared/dist/core/interfaces/task.interface.d.ts +185 -0
  583. package/v3/@claude-flow/shared/dist/core/interfaces/task.interface.js +6 -0
  584. package/v3/@claude-flow/shared/dist/core/orchestrator/event-coordinator.d.ts +35 -0
  585. package/v3/@claude-flow/shared/dist/core/orchestrator/event-coordinator.js +101 -0
  586. package/v3/@claude-flow/shared/dist/core/orchestrator/health-monitor.d.ts +60 -0
  587. package/v3/@claude-flow/shared/dist/core/orchestrator/health-monitor.js +166 -0
  588. package/v3/@claude-flow/shared/dist/core/orchestrator/index.d.ts +46 -0
  589. package/v3/@claude-flow/shared/dist/core/orchestrator/index.js +64 -0
  590. package/v3/@claude-flow/shared/dist/core/orchestrator/lifecycle-manager.d.ts +56 -0
  591. package/v3/@claude-flow/shared/dist/core/orchestrator/lifecycle-manager.js +195 -0
  592. package/v3/@claude-flow/shared/dist/core/orchestrator/session-manager.d.ts +83 -0
  593. package/v3/@claude-flow/shared/dist/core/orchestrator/session-manager.js +193 -0
  594. package/v3/@claude-flow/shared/dist/core/orchestrator/task-manager.d.ts +49 -0
  595. package/v3/@claude-flow/shared/dist/core/orchestrator/task-manager.js +253 -0
  596. package/v3/@claude-flow/shared/dist/events/domain-events.d.ts +282 -0
  597. package/v3/@claude-flow/shared/dist/events/domain-events.js +165 -0
  598. package/v3/@claude-flow/shared/dist/events/event-store.d.ts +126 -0
  599. package/v3/@claude-flow/shared/dist/events/event-store.js +416 -0
  600. package/v3/@claude-flow/shared/dist/events/event-store.test.d.ts +8 -0
  601. package/v3/@claude-flow/shared/dist/events/event-store.test.js +293 -0
  602. package/v3/@claude-flow/shared/dist/events/example-usage.d.ts +10 -0
  603. package/v3/@claude-flow/shared/dist/events/example-usage.js +193 -0
  604. package/v3/@claude-flow/shared/dist/events/index.d.ts +21 -0
  605. package/v3/@claude-flow/shared/dist/events/index.js +22 -0
  606. package/v3/@claude-flow/shared/dist/events/projections.d.ts +177 -0
  607. package/v3/@claude-flow/shared/dist/events/projections.js +421 -0
  608. package/v3/@claude-flow/shared/dist/events/rvf-event-log.d.ts +82 -0
  609. package/v3/@claude-flow/shared/dist/events/rvf-event-log.js +340 -0
  610. package/v3/@claude-flow/shared/dist/events/state-reconstructor.d.ts +101 -0
  611. package/v3/@claude-flow/shared/dist/events/state-reconstructor.js +263 -0
  612. package/v3/@claude-flow/shared/dist/events.d.ts +80 -0
  613. package/v3/@claude-flow/shared/dist/events.js +249 -0
  614. package/v3/@claude-flow/shared/dist/hooks/example-usage.d.ts +42 -0
  615. package/v3/@claude-flow/shared/dist/hooks/example-usage.js +351 -0
  616. package/v3/@claude-flow/shared/dist/hooks/executor.d.ts +100 -0
  617. package/v3/@claude-flow/shared/dist/hooks/executor.js +264 -0
  618. package/v3/@claude-flow/shared/dist/hooks/hooks.test.d.ts +9 -0
  619. package/v3/@claude-flow/shared/dist/hooks/hooks.test.js +322 -0
  620. package/v3/@claude-flow/shared/dist/hooks/index.d.ts +52 -0
  621. package/v3/@claude-flow/shared/dist/hooks/index.js +51 -0
  622. package/v3/@claude-flow/shared/dist/hooks/registry.d.ts +133 -0
  623. package/v3/@claude-flow/shared/dist/hooks/registry.js +277 -0
  624. package/v3/@claude-flow/shared/dist/hooks/safety/bash-safety.d.ts +105 -0
  625. package/v3/@claude-flow/shared/dist/hooks/safety/bash-safety.js +481 -0
  626. package/v3/@claude-flow/shared/dist/hooks/safety/file-organization.d.ts +144 -0
  627. package/v3/@claude-flow/shared/dist/hooks/safety/file-organization.js +328 -0
  628. package/v3/@claude-flow/shared/dist/hooks/safety/git-commit.d.ts +158 -0
  629. package/v3/@claude-flow/shared/dist/hooks/safety/git-commit.js +450 -0
  630. package/v3/@claude-flow/shared/dist/hooks/safety/index.d.ts +17 -0
  631. package/v3/@claude-flow/shared/dist/hooks/safety/index.js +17 -0
  632. package/v3/@claude-flow/shared/dist/hooks/session-hooks.d.ts +234 -0
  633. package/v3/@claude-flow/shared/dist/hooks/session-hooks.js +334 -0
  634. package/v3/@claude-flow/shared/dist/hooks/task-hooks.d.ts +163 -0
  635. package/v3/@claude-flow/shared/dist/hooks/task-hooks.js +326 -0
  636. package/v3/@claude-flow/shared/dist/hooks/types.d.ts +267 -0
  637. package/v3/@claude-flow/shared/dist/hooks/types.js +62 -0
  638. package/v3/@claude-flow/shared/dist/hooks/verify-exports.test.d.ts +9 -0
  639. package/v3/@claude-flow/shared/dist/hooks/verify-exports.test.js +93 -0
  640. package/v3/@claude-flow/shared/dist/index.d.ts +20 -0
  641. package/v3/@claude-flow/shared/dist/index.js +50 -0
  642. package/v3/@claude-flow/shared/dist/mcp/connection-pool.d.ts +98 -0
  643. package/v3/@claude-flow/shared/dist/mcp/connection-pool.js +364 -0
  644. package/v3/@claude-flow/shared/dist/mcp/index.d.ts +69 -0
  645. package/v3/@claude-flow/shared/dist/mcp/index.js +84 -0
  646. package/v3/@claude-flow/shared/dist/mcp/server.d.ts +166 -0
  647. package/v3/@claude-flow/shared/dist/mcp/server.js +593 -0
  648. package/v3/@claude-flow/shared/dist/mcp/session-manager.d.ts +136 -0
  649. package/v3/@claude-flow/shared/dist/mcp/session-manager.js +335 -0
  650. package/v3/@claude-flow/shared/dist/mcp/tool-registry.d.ts +178 -0
  651. package/v3/@claude-flow/shared/dist/mcp/tool-registry.js +439 -0
  652. package/v3/@claude-flow/shared/dist/mcp/transport/http.d.ts +104 -0
  653. package/v3/@claude-flow/shared/dist/mcp/transport/http.js +476 -0
  654. package/v3/@claude-flow/shared/dist/mcp/transport/index.d.ts +102 -0
  655. package/v3/@claude-flow/shared/dist/mcp/transport/index.js +238 -0
  656. package/v3/@claude-flow/shared/dist/mcp/transport/stdio.d.ts +104 -0
  657. package/v3/@claude-flow/shared/dist/mcp/transport/stdio.js +263 -0
  658. package/v3/@claude-flow/shared/dist/mcp/transport/websocket.d.ts +133 -0
  659. package/v3/@claude-flow/shared/dist/mcp/transport/websocket.js +396 -0
  660. package/v3/@claude-flow/shared/dist/mcp/types.d.ts +438 -0
  661. package/v3/@claude-flow/shared/dist/mcp/types.js +54 -0
  662. package/v3/@claude-flow/shared/dist/plugin-interface.d.ts +544 -0
  663. package/v3/@claude-flow/shared/dist/plugin-interface.js +23 -0
  664. package/v3/@claude-flow/shared/dist/plugin-loader.d.ts +139 -0
  665. package/v3/@claude-flow/shared/dist/plugin-loader.js +434 -0
  666. package/v3/@claude-flow/shared/dist/plugin-registry.d.ts +183 -0
  667. package/v3/@claude-flow/shared/dist/plugin-registry.js +457 -0
  668. package/v3/@claude-flow/shared/dist/plugins/index.d.ts +10 -0
  669. package/v3/@claude-flow/shared/dist/plugins/index.js +10 -0
  670. package/v3/@claude-flow/shared/dist/plugins/official/hive-mind-plugin.d.ts +106 -0
  671. package/v3/@claude-flow/shared/dist/plugins/official/hive-mind-plugin.js +241 -0
  672. package/v3/@claude-flow/shared/dist/plugins/official/index.d.ts +10 -0
  673. package/v3/@claude-flow/shared/dist/plugins/official/index.js +10 -0
  674. package/v3/@claude-flow/shared/dist/plugins/official/maestro-plugin.d.ts +121 -0
  675. package/v3/@claude-flow/shared/dist/plugins/official/maestro-plugin.js +355 -0
  676. package/v3/@claude-flow/shared/dist/plugins/types.d.ts +93 -0
  677. package/v3/@claude-flow/shared/dist/plugins/types.js +9 -0
  678. package/v3/@claude-flow/shared/dist/resilience/bulkhead.d.ts +105 -0
  679. package/v3/@claude-flow/shared/dist/resilience/bulkhead.js +206 -0
  680. package/v3/@claude-flow/shared/dist/resilience/circuit-breaker.d.ts +132 -0
  681. package/v3/@claude-flow/shared/dist/resilience/circuit-breaker.js +233 -0
  682. package/v3/@claude-flow/shared/dist/resilience/index.d.ts +19 -0
  683. package/v3/@claude-flow/shared/dist/resilience/index.js +19 -0
  684. package/v3/@claude-flow/shared/dist/resilience/rate-limiter.d.ts +168 -0
  685. package/v3/@claude-flow/shared/dist/resilience/rate-limiter.js +314 -0
  686. package/v3/@claude-flow/shared/dist/resilience/retry.d.ts +91 -0
  687. package/v3/@claude-flow/shared/dist/resilience/retry.js +159 -0
  688. package/v3/@claude-flow/shared/dist/security/index.d.ts +10 -0
  689. package/v3/@claude-flow/shared/dist/security/index.js +12 -0
  690. package/v3/@claude-flow/shared/dist/security/input-validation.d.ts +73 -0
  691. package/v3/@claude-flow/shared/dist/security/input-validation.js +201 -0
  692. package/v3/@claude-flow/shared/dist/security/secure-random.d.ts +92 -0
  693. package/v3/@claude-flow/shared/dist/security/secure-random.js +142 -0
  694. package/v3/@claude-flow/shared/dist/services/index.d.ts +7 -0
  695. package/v3/@claude-flow/shared/dist/services/index.js +7 -0
  696. package/v3/@claude-flow/shared/dist/services/v3-progress.service.d.ts +124 -0
  697. package/v3/@claude-flow/shared/dist/services/v3-progress.service.js +402 -0
  698. package/v3/@claude-flow/shared/dist/types/agent.types.d.ts +137 -0
  699. package/v3/@claude-flow/shared/dist/types/agent.types.js +6 -0
  700. package/v3/@claude-flow/shared/dist/types/index.d.ts +11 -0
  701. package/v3/@claude-flow/shared/dist/types/index.js +17 -0
  702. package/v3/@claude-flow/shared/dist/types/mcp.types.d.ts +266 -0
  703. package/v3/@claude-flow/shared/dist/types/mcp.types.js +7 -0
  704. package/v3/@claude-flow/shared/dist/types/memory.types.d.ts +236 -0
  705. package/v3/@claude-flow/shared/dist/types/memory.types.js +7 -0
  706. package/v3/@claude-flow/shared/dist/types/swarm.types.d.ts +186 -0
  707. package/v3/@claude-flow/shared/dist/types/swarm.types.js +65 -0
  708. package/v3/@claude-flow/shared/dist/types/task.types.d.ts +178 -0
  709. package/v3/@claude-flow/shared/dist/types/task.types.js +32 -0
  710. package/v3/@claude-flow/shared/dist/types.d.ts +197 -0
  711. package/v3/@claude-flow/shared/dist/types.js +21 -0
  712. package/v3/@claude-flow/shared/dist/utils/secure-logger.d.ts +69 -0
  713. package/v3/@claude-flow/shared/dist/utils/secure-logger.js +208 -0
  714. package/v3/@claude-flow/shared/package.json +42 -0
  715. package/v3/README.md +493 -0
@@ -0,0 +1,1145 @@
1
+ /**
2
+ * V3 CLI Hive Mind Command
3
+ * Queen-led consensus-based multi-agent coordination
4
+ *
5
+ * Updated to support --claude flag for launching interactive Claude Code sessions
6
+ * PR: Fix #955 - Implement --claude flag for hive-mind spawn command
7
+ */
8
+ import { output } from '../output.js';
9
+ import { select, confirm, input } from '../prompt.js';
10
+ import { callMCPTool, MCPClientError } from '../mcp-client.js';
11
+ import { mkdir, writeFile } from 'fs/promises';
12
+ import { join } from 'path';
13
+ // Hive topologies
14
+ const TOPOLOGIES = [
15
+ { value: 'hierarchical', label: 'Hierarchical', hint: 'Queen-led with worker agents' },
16
+ { value: 'mesh', label: 'Mesh', hint: 'Peer-to-peer coordination' },
17
+ { value: 'hierarchical-mesh', label: 'Hierarchical Mesh', hint: 'Queen + peer communication (recommended)' },
18
+ { value: 'adaptive', label: 'Adaptive', hint: 'Dynamic topology based on task' }
19
+ ];
20
+ // Consensus strategies
21
+ const CONSENSUS_STRATEGIES = [
22
+ { value: 'byzantine', label: 'Byzantine Fault Tolerant', hint: '2/3 majority, handles malicious actors' },
23
+ { value: 'raft', label: 'Raft', hint: 'Leader-based consensus' },
24
+ { value: 'gossip', label: 'Gossip', hint: 'Eventually consistent, scalable' },
25
+ { value: 'crdt', label: 'CRDT', hint: 'Conflict-free replicated data' },
26
+ { value: 'quorum', label: 'Quorum', hint: 'Simple majority voting' }
27
+ ];
28
+ /**
29
+ * Group workers by their type for prompt generation
30
+ */
31
+ function groupWorkersByType(workers) {
32
+ const groups = {};
33
+ for (const worker of workers) {
34
+ const type = worker.type || worker.role || 'worker';
35
+ if (!groups[type]) {
36
+ groups[type] = [];
37
+ }
38
+ groups[type].push(worker);
39
+ }
40
+ return groups;
41
+ }
42
+ /**
43
+ * Generate comprehensive Hive Mind prompt for Claude Code
44
+ * Ported from v2.7.47 with enhancements for v3
45
+ */
46
+ function generateHiveMindPrompt(swarmId, swarmName, objective, workers, workerGroups, flags) {
47
+ const currentTime = new Date().toISOString();
48
+ const workerTypes = Object.keys(workerGroups);
49
+ const queenType = flags.queenType || 'strategic';
50
+ const consensusAlgorithm = flags.consensus || 'byzantine';
51
+ const topology = flags.topology || 'hierarchical-mesh';
52
+ return `🧠 HIVE MIND COLLECTIVE INTELLIGENCE SYSTEM
53
+ ═══════════════════════════════════════════════
54
+
55
+ You are the Queen coordinator of a Hive Mind swarm with collective intelligence capabilities.
56
+
57
+ HIVE MIND CONFIGURATION:
58
+ 📌 Swarm ID: ${swarmId}
59
+ 📌 Swarm Name: ${swarmName}
60
+ 🎯 Objective: ${objective}
61
+ 👑 Queen Type: ${queenType}
62
+ 🐝 Worker Count: ${workers.length}
63
+ 🔗 Topology: ${topology}
64
+ 🤝 Consensus Algorithm: ${consensusAlgorithm}
65
+ ⏰ Initialized: ${currentTime}
66
+
67
+ WORKER DISTRIBUTION:
68
+ ${workerTypes.map(type => `• ${type}: ${workerGroups[type].length} agents`).join('\n')}
69
+
70
+ 🔧 AVAILABLE MCP TOOLS FOR HIVE MIND COORDINATION:
71
+
72
+ 1️⃣ **COLLECTIVE INTELLIGENCE**
73
+ mcp__claude-flow__hive-mind_consensus - Democratic decision making
74
+ mcp__claude-flow__hive-mind_memory - Share knowledge across the hive
75
+ mcp__claude-flow__hive-mind_broadcast - Broadcast to all workers
76
+ mcp__claude-flow__neural_patterns - Neural pattern recognition
77
+
78
+ 2️⃣ **QUEEN COORDINATION**
79
+ mcp__claude-flow__hive-mind_status - Monitor swarm health
80
+ mcp__claude-flow__task_create - Create and delegate tasks
81
+ mcp__claude-flow__task_orchestrate - Orchestrate task distribution
82
+ mcp__claude-flow__agent_spawn - Spawn additional workers
83
+
84
+ 3️⃣ **WORKER MANAGEMENT**
85
+ mcp__claude-flow__agent_list - List all active agents
86
+ mcp__claude-flow__agent_status - Check agent status
87
+ mcp__claude-flow__agent_metrics - Track worker performance
88
+ mcp__claude-flow__hive-mind_join - Add agent to hive
89
+ mcp__claude-flow__hive-mind_leave - Remove agent from hive
90
+
91
+ 4️⃣ **TASK ORCHESTRATION**
92
+ mcp__claude-flow__task_create - Create hierarchical tasks
93
+ mcp__claude-flow__task_status - Track task progress
94
+ mcp__claude-flow__task_complete - Mark tasks complete
95
+ mcp__claude-flow__workflow_create - Create workflows
96
+
97
+ 5️⃣ **MEMORY & LEARNING**
98
+ mcp__claude-flow__memory_store - Store collective knowledge
99
+ mcp__claude-flow__memory_retrieve - Access shared memory
100
+ mcp__claude-flow__memory_search - Search memory patterns
101
+ mcp__claude-flow__neural_train - Learn from experiences
102
+ mcp__claude-flow__hooks_intelligence_pattern-store - Store patterns
103
+
104
+ 📋 HIVE MIND EXECUTION PROTOCOL:
105
+
106
+ 1. **INITIALIZATION PHASE**
107
+ - Verify all workers are online and responsive
108
+ - Establish communication channels
109
+ - Load previous session state if available
110
+ - Initialize shared memory space
111
+
112
+ 2. **TASK DISTRIBUTION PHASE**
113
+ - Analyze the objective and decompose into subtasks
114
+ - Assign tasks based on worker specializations
115
+ - Set up task dependencies and ordering
116
+ - Monitor parallel execution
117
+
118
+ 3. **COORDINATION PHASE**
119
+ - Use consensus for critical decisions
120
+ - Aggregate results from workers
121
+ - Resolve conflicts using ${consensusAlgorithm} consensus
122
+ - Share learnings across the hive
123
+
124
+ 4. **COMPLETION PHASE**
125
+ - Verify all subtasks are complete
126
+ - Consolidate results
127
+ - Store learnings in collective memory
128
+ - Report final status
129
+
130
+ 🎯 YOUR OBJECTIVE:
131
+ ${objective}
132
+
133
+ 💡 COORDINATION TIPS:
134
+ • Use mcp__claude-flow__hive-mind_broadcast for swarm-wide announcements
135
+ • Check worker status regularly with mcp__claude-flow__hive-mind_status
136
+ • Store important decisions in shared memory for persistence
137
+ • Use consensus for any decisions affecting multiple workers
138
+ • Monitor task progress and reassign if workers are blocked
139
+
140
+ 🚀 BEGIN HIVE MIND COORDINATION NOW!
141
+ Start by checking the current hive status and then proceed with the objective.
142
+ `;
143
+ }
144
+ /**
145
+ * Spawn Claude Code with Hive Mind coordination instructions
146
+ * Ported from v2.7.47 spawnClaudeCodeInstances function
147
+ */
148
+ async function spawnClaudeCodeInstance(swarmId, swarmName, objective, workers, flags) {
149
+ output.writeln();
150
+ output.writeln(output.bold('🚀 Launching Claude Code with Hive Mind Coordination'));
151
+ output.writeln(output.dim('─'.repeat(60)));
152
+ const spinner = output.createSpinner({ text: 'Preparing Hive Mind coordination prompt...', spinner: 'dots' });
153
+ spinner.start();
154
+ try {
155
+ // Generate comprehensive Hive Mind prompt
156
+ const workerGroups = groupWorkersByType(workers);
157
+ const hiveMindPrompt = generateHiveMindPrompt(swarmId, swarmName, objective, workers, workerGroups, flags);
158
+ spinner.succeed('Hive Mind coordination prompt ready!');
159
+ // Display coordination summary
160
+ output.writeln();
161
+ output.writeln(output.bold('🧠 Hive Mind Configuration'));
162
+ output.writeln(output.dim('─'.repeat(60)));
163
+ output.printList([
164
+ `Swarm ID: ${output.highlight(swarmId)}`,
165
+ `Objective: ${output.highlight(objective)}`,
166
+ `Queen Type: ${output.highlight(flags.queenType || 'strategic')}`,
167
+ `Worker Count: ${output.highlight(String(workers.length))}`,
168
+ `Worker Types: ${output.highlight(Object.keys(workerGroups).join(', '))}`,
169
+ `Consensus: ${output.highlight(flags.consensus || 'byzantine')}`,
170
+ `MCP Tools: ${output.success('Full Claude-Flow integration enabled')}`
171
+ ]);
172
+ // Ensure sessions directory exists
173
+ const sessionsDir = join('.hive-mind', 'sessions');
174
+ await mkdir(sessionsDir, { recursive: true });
175
+ const promptFile = join(sessionsDir, `hive-mind-prompt-${swarmId}.txt`);
176
+ await writeFile(promptFile, hiveMindPrompt, 'utf8');
177
+ output.writeln();
178
+ output.printSuccess(`Hive Mind prompt saved to: ${promptFile}`);
179
+ // Hive Mind now coordinates via Claude Flow agents instead of Claude Code CLI
180
+ output.writeln();
181
+ output.writeln(output.bold('🧠 Hive Mind Ready'));
182
+ output.writeln(output.dim('─'.repeat(60)));
183
+ output.printList([
184
+ `Swarm ID: ${output.highlight(swarmId)}`,
185
+ `Prompt File: ${output.highlight(promptFile)}`,
186
+ `Workers: ${output.highlight(String(workers.length))}`
187
+ ]);
188
+ output.writeln();
189
+ output.printInfo('Use swarm commands to coordinate agents:');
190
+ output.writeln(output.dim(` npx claude-flow swarm init --prompt-file ${promptFile}`));
191
+ const dryRun = flags.dryRun || flags['dry-run'];
192
+ if (dryRun) {
193
+ output.writeln();
194
+ output.printInfo('Dry run - prompt generated:');
195
+ output.writeln(output.dim(`Prompt length: ${hiveMindPrompt.length} characters`));
196
+ output.writeln();
197
+ output.writeln(output.dim('First 500 characters:'));
198
+ output.writeln(output.highlight(hiveMindPrompt.substring(0, 500) + '...'));
199
+ }
200
+ return { success: true, promptFile };
201
+ }
202
+ catch (error) {
203
+ spinner.fail('Failed to prepare Hive Mind coordination');
204
+ const errorMessage = error instanceof Error ? error.message : String(error);
205
+ output.printError(`Error: ${errorMessage}`);
206
+ // Try to save prompt as fallback
207
+ try {
208
+ const promptFile = `hive-mind-prompt-${swarmId}-fallback.txt`;
209
+ const workerGroups = groupWorkersByType(workers);
210
+ const hiveMindPrompt = generateHiveMindPrompt(swarmId, swarmName, objective, workers, workerGroups, flags);
211
+ await writeFile(promptFile, hiveMindPrompt, 'utf8');
212
+ output.writeln();
213
+ output.printSuccess(`Prompt saved to: ${promptFile}`);
214
+ output.writeln(output.dim('You can run Claude Code manually with the saved prompt'));
215
+ return { success: false, promptFile, error: errorMessage };
216
+ }
217
+ catch {
218
+ return { success: false, error: errorMessage };
219
+ }
220
+ }
221
+ }
222
+ // Init subcommand
223
+ const initCommand = {
224
+ name: 'init',
225
+ description: 'Initialize a hive mind',
226
+ options: [
227
+ {
228
+ name: 'topology',
229
+ short: 't',
230
+ description: 'Hive topology',
231
+ type: 'string',
232
+ choices: TOPOLOGIES.map(t => t.value),
233
+ default: 'hierarchical-mesh'
234
+ },
235
+ {
236
+ name: 'consensus',
237
+ short: 'c',
238
+ description: 'Consensus strategy',
239
+ type: 'string',
240
+ choices: CONSENSUS_STRATEGIES.map(s => s.value),
241
+ default: 'byzantine'
242
+ },
243
+ {
244
+ name: 'max-agents',
245
+ short: 'm',
246
+ description: 'Maximum agents',
247
+ type: 'number',
248
+ default: 15
249
+ },
250
+ {
251
+ name: 'persist',
252
+ short: 'p',
253
+ description: 'Enable persistent state',
254
+ type: 'boolean',
255
+ default: true
256
+ },
257
+ {
258
+ name: 'memory-backend',
259
+ description: 'Memory backend (agentdb, sqlite, hybrid)',
260
+ type: 'string',
261
+ default: 'hybrid'
262
+ }
263
+ ],
264
+ examples: [
265
+ { command: 'claude-flow hive-mind init -t hierarchical-mesh', description: 'Init hierarchical mesh' },
266
+ { command: 'claude-flow hive-mind init -c byzantine -m 20', description: 'Init with Byzantine consensus' }
267
+ ],
268
+ action: async (ctx) => {
269
+ let topology = ctx.flags.topology;
270
+ let consensus = ctx.flags.consensus;
271
+ if (ctx.interactive && !ctx.flags.topology) {
272
+ topology = await select({
273
+ message: 'Select hive topology:',
274
+ options: TOPOLOGIES,
275
+ default: 'hierarchical-mesh'
276
+ });
277
+ }
278
+ if (ctx.interactive && !ctx.flags.consensus) {
279
+ consensus = await select({
280
+ message: 'Select consensus strategy:',
281
+ options: CONSENSUS_STRATEGIES,
282
+ default: 'byzantine'
283
+ });
284
+ }
285
+ const config = {
286
+ topology: topology || 'hierarchical-mesh',
287
+ consensus: consensus || 'byzantine',
288
+ maxAgents: ctx.flags.maxAgents || 15,
289
+ persist: ctx.flags.persist,
290
+ memoryBackend: ctx.flags.memoryBackend || 'hybrid'
291
+ };
292
+ output.writeln();
293
+ output.writeln(output.bold('Initializing Hive Mind'));
294
+ const spinner = output.createSpinner({ text: 'Setting up hive infrastructure...', spinner: 'dots' });
295
+ spinner.start();
296
+ try {
297
+ const result = await callMCPTool('hive-mind_init', config);
298
+ spinner.succeed('Hive Mind initialized');
299
+ if (ctx.flags.format === 'json') {
300
+ output.printJson(result);
301
+ return { success: true, data: result };
302
+ }
303
+ output.writeln();
304
+ output.printBox([
305
+ `Hive ID: ${result.hiveId ?? 'default'}`,
306
+ `Queen ID: ${result.queenId ?? 'N/A'}`,
307
+ `Topology: ${result.topology ?? config.topology}`,
308
+ `Consensus: ${result.consensus ?? config.consensus}`,
309
+ `Max Agents: ${config.maxAgents}`,
310
+ `Memory: ${config.memoryBackend}`,
311
+ `Status: ${output.success(result.status ?? 'initialized')}`
312
+ ].join('\n'), 'Hive Mind Configuration');
313
+ output.writeln();
314
+ output.printInfo('Queen agent is ready to coordinate worker agents');
315
+ output.writeln(output.dim(' Use "claude-flow hive-mind spawn" to add workers'));
316
+ output.writeln(output.dim(' Use "claude-flow hive-mind spawn --claude" to launch Claude Code'));
317
+ return { success: true, data: result };
318
+ }
319
+ catch (error) {
320
+ spinner.fail('Failed to initialize');
321
+ if (error instanceof MCPClientError) {
322
+ output.printError(`Init error: ${error.message}`);
323
+ }
324
+ else {
325
+ output.printError(`Unexpected error: ${String(error)}`);
326
+ }
327
+ return { success: false, exitCode: 1 };
328
+ }
329
+ }
330
+ };
331
+ // Spawn subcommand - UPDATED with --claude flag
332
+ const spawnCommand = {
333
+ name: 'spawn',
334
+ description: 'Spawn worker agents into the hive (use --claude to launch Claude Code)',
335
+ options: [
336
+ {
337
+ name: 'count',
338
+ short: 'n',
339
+ description: 'Number of workers to spawn',
340
+ type: 'number',
341
+ default: 1
342
+ },
343
+ {
344
+ name: 'role',
345
+ short: 'r',
346
+ description: 'Worker role (worker, specialist, scout)',
347
+ type: 'string',
348
+ choices: ['worker', 'specialist', 'scout'],
349
+ default: 'worker'
350
+ },
351
+ {
352
+ name: 'type',
353
+ short: 't',
354
+ description: 'Agent type',
355
+ type: 'string',
356
+ default: 'worker'
357
+ },
358
+ {
359
+ name: 'prefix',
360
+ short: 'p',
361
+ description: 'Prefix for worker IDs',
362
+ type: 'string',
363
+ default: 'hive-worker'
364
+ },
365
+ // NEW: --claude flag for launching Claude Code
366
+ {
367
+ name: 'claude',
368
+ description: 'Launch Claude Code with hive-mind coordination prompt',
369
+ type: 'boolean',
370
+ default: false
371
+ },
372
+ {
373
+ name: 'objective',
374
+ short: 'o',
375
+ description: 'Objective for the hive mind (used with --claude)',
376
+ type: 'string'
377
+ },
378
+ {
379
+ name: 'dangerously-skip-permissions',
380
+ description: 'Skip permission prompts in Claude Code (use with caution)',
381
+ type: 'boolean',
382
+ default: true
383
+ },
384
+ {
385
+ name: 'no-auto-permissions',
386
+ description: 'Disable automatic permission skipping',
387
+ type: 'boolean',
388
+ default: false
389
+ },
390
+ {
391
+ name: 'dry-run',
392
+ description: 'Show what would be done without launching Claude Code',
393
+ type: 'boolean',
394
+ default: false
395
+ },
396
+ {
397
+ name: 'non-interactive',
398
+ description: 'Run Claude Code in non-interactive mode',
399
+ type: 'boolean',
400
+ default: false
401
+ }
402
+ ],
403
+ examples: [
404
+ { command: 'claude-flow hive-mind spawn -n 5', description: 'Spawn 5 workers' },
405
+ { command: 'claude-flow hive-mind spawn -n 3 -r specialist', description: 'Spawn 3 specialists' },
406
+ { command: 'claude-flow hive-mind spawn -t coder -p my-coder', description: 'Spawn coder with custom prefix' },
407
+ { command: 'claude-flow hive-mind spawn --claude -o "Build a REST API"', description: 'Launch Claude Code with objective' },
408
+ { command: 'claude-flow hive-mind spawn -n 5 --claude -o "Research AI patterns"', description: 'Spawn workers and launch Claude Code' }
409
+ ],
410
+ action: async (ctx) => {
411
+ // Parse count with fallback to default
412
+ const count = ctx.flags.count || 1;
413
+ const role = ctx.flags.role || 'worker';
414
+ const agentType = ctx.flags.type || 'worker';
415
+ const prefix = ctx.flags.prefix || 'hive-worker';
416
+ const launchClaude = ctx.flags.claude;
417
+ let objective = ctx.flags.objective || ctx.args.join(' ');
418
+ output.printInfo(`Spawning ${count} ${role} agent(s)...`);
419
+ try {
420
+ const result = await callMCPTool('hive-mind_spawn', {
421
+ count,
422
+ role,
423
+ agentType,
424
+ prefix,
425
+ });
426
+ // Check for errors from MCP tool
427
+ if (!result.success) {
428
+ output.printError(result.error || 'Failed to spawn workers');
429
+ return { success: false, exitCode: 1 };
430
+ }
431
+ if (ctx.flags.format === 'json' && !launchClaude) {
432
+ output.printJson(result);
433
+ return { success: true, data: result };
434
+ }
435
+ output.writeln();
436
+ // Transform workers array to display format
437
+ const displayData = (result.workers || []).map(w => ({
438
+ id: w.agentId,
439
+ role: w.role,
440
+ status: 'idle',
441
+ joinedAt: new Date(w.joinedAt).toLocaleTimeString()
442
+ }));
443
+ output.printTable({
444
+ columns: [
445
+ { key: 'id', header: 'Agent ID', width: 30 },
446
+ { key: 'role', header: 'Role', width: 12 },
447
+ { key: 'status', header: 'Status', width: 10, format: formatAgentStatus },
448
+ { key: 'joinedAt', header: 'Joined', width: 12 }
449
+ ],
450
+ data: displayData
451
+ });
452
+ output.writeln();
453
+ output.printSuccess(`Spawned ${result.spawned} agent(s)`);
454
+ output.writeln(output.dim(` Total workers in hive: ${result.totalWorkers}`));
455
+ // NEW: Handle --claude flag
456
+ if (launchClaude) {
457
+ // Get objective if not provided
458
+ if (!objective && ctx.interactive) {
459
+ objective = await input({
460
+ message: 'Enter the objective for the hive mind:',
461
+ validate: (v) => v.length > 0 || 'Objective is required when using --claude'
462
+ });
463
+ }
464
+ if (!objective) {
465
+ output.writeln();
466
+ output.printWarning('No objective provided. Using default objective.');
467
+ objective = 'Coordinate the hive mind workers to complete tasks efficiently.';
468
+ }
469
+ // Get hive status for swarm info
470
+ let swarmId = result.hiveId || 'default';
471
+ let swarmName = 'Hive Mind Swarm';
472
+ try {
473
+ const statusResult = await callMCPTool('hive-mind_status', { includeWorkers: false });
474
+ swarmId = statusResult.hiveId || swarmId;
475
+ }
476
+ catch {
477
+ // Use defaults if status call fails
478
+ }
479
+ // Convert workers to expected format
480
+ const workers = (result.workers || []).map(w => ({
481
+ agentId: w.agentId,
482
+ role: w.role,
483
+ type: agentType,
484
+ joinedAt: w.joinedAt
485
+ }));
486
+ // Launch Claude Code with hive mind prompt
487
+ const claudeResult = await spawnClaudeCodeInstance(swarmId, swarmName, objective, workers, ctx.flags);
488
+ if (!claudeResult.success) {
489
+ return { success: false, exitCode: 1, data: { spawn: result, claude: claudeResult } };
490
+ }
491
+ return { success: true, data: { spawn: result, claude: claudeResult } };
492
+ }
493
+ return { success: true, data: result };
494
+ }
495
+ catch (error) {
496
+ if (error instanceof MCPClientError) {
497
+ output.printError(`Spawn error: ${error.message}`);
498
+ }
499
+ else {
500
+ output.printError(`Unexpected error: ${String(error)}`);
501
+ }
502
+ return { success: false, exitCode: 1 };
503
+ }
504
+ }
505
+ };
506
+ // Status subcommand
507
+ const statusCommand = {
508
+ name: 'status',
509
+ description: 'Show hive mind status',
510
+ options: [
511
+ {
512
+ name: 'detailed',
513
+ short: 'd',
514
+ description: 'Show detailed metrics',
515
+ type: 'boolean',
516
+ default: false
517
+ },
518
+ {
519
+ name: 'watch',
520
+ short: 'w',
521
+ description: 'Watch for changes',
522
+ type: 'boolean',
523
+ default: false
524
+ }
525
+ ],
526
+ action: async (ctx) => {
527
+ const detailed = ctx.flags.detailed;
528
+ try {
529
+ const result = await callMCPTool('hive-mind_status', {
530
+ includeMetrics: detailed,
531
+ includeWorkers: true,
532
+ });
533
+ if (ctx.flags.format === 'json') {
534
+ output.printJson(result);
535
+ return { success: true, data: result };
536
+ }
537
+ // Handle both simple and complex response formats - cast to flexible type
538
+ const flexResult = result;
539
+ const hiveId = result.hiveId ?? flexResult.id ?? 'default';
540
+ const status = result.status ?? (flexResult.initialized ? 'running' : 'stopped');
541
+ const queen = result.queen ?? { id: 'N/A', status: 'unknown', load: 0, tasksQueued: 0 };
542
+ const flexQueen = queen;
543
+ const queenId = typeof queen === 'object' ? (queen.id ?? flexQueen.agentId ?? 'N/A') : String(queen);
544
+ const queenLoad = typeof queen === 'object' ? (queen.load ?? 0) : 0;
545
+ const queenTasks = typeof queen === 'object' ? (queen.tasksQueued ?? 0) : 0;
546
+ const queenStatus = typeof queen === 'object' ? (queen.status ?? 'active') : 'active';
547
+ output.writeln();
548
+ output.printBox([
549
+ `Hive ID: ${hiveId}`,
550
+ `Status: ${formatHiveStatus(String(status))}`,
551
+ `Topology: ${result.topology ?? 'mesh'}`,
552
+ `Consensus: ${result.consensus ?? 'byzantine'}`,
553
+ '',
554
+ `Queen: ${queenId}`,
555
+ ` Status: ${formatAgentStatus(queenStatus)}`,
556
+ ` Load: ${(queenLoad * 100).toFixed(1)}%`,
557
+ ` Queued Tasks: ${queenTasks}`
558
+ ].join('\n'), 'Hive Mind Status');
559
+ // Handle workers array - could be worker objects or just IDs
560
+ const workers = result.workers ?? [];
561
+ const workerData = Array.isArray(workers) ? workers.map(w => {
562
+ if (typeof w === 'string') {
563
+ return { id: w, type: 'worker', status: 'idle', currentTask: '-', tasksCompleted: 0 };
564
+ }
565
+ const flexWorker = w;
566
+ return {
567
+ id: w.id ?? flexWorker.agentId ?? 'unknown',
568
+ type: w.type ?? flexWorker.agentType ?? 'worker',
569
+ status: w.status ?? 'idle',
570
+ currentTask: w.currentTask ?? '-',
571
+ tasksCompleted: w.tasksCompleted ?? 0
572
+ };
573
+ }) : [];
574
+ output.writeln();
575
+ output.writeln(output.bold('Worker Agents'));
576
+ if (workerData.length === 0) {
577
+ output.printInfo('No workers in hive. Use "claude-flow hive-mind spawn" to add workers.');
578
+ }
579
+ else {
580
+ output.printTable({
581
+ columns: [
582
+ { key: 'id', header: 'ID', width: 20 },
583
+ { key: 'type', header: 'Type', width: 12 },
584
+ { key: 'status', header: 'Status', width: 10, format: formatAgentStatus },
585
+ { key: 'currentTask', header: 'Current Task', width: 20, format: (v) => String(v || '-') },
586
+ { key: 'tasksCompleted', header: 'Completed', width: 10, align: 'right' }
587
+ ],
588
+ data: workerData
589
+ });
590
+ }
591
+ if (detailed) {
592
+ const metrics = result.metrics ?? { totalTasks: 0, completedTasks: 0, failedTasks: 0, avgTaskTime: 0, consensusRounds: 0, memoryUsage: '0 MB' };
593
+ output.writeln();
594
+ output.writeln(output.bold('Metrics'));
595
+ output.printTable({
596
+ columns: [
597
+ { key: 'metric', header: 'Metric', width: 20 },
598
+ { key: 'value', header: 'Value', width: 15, align: 'right' }
599
+ ],
600
+ data: [
601
+ { metric: 'Total Tasks', value: metrics.totalTasks ?? 0 },
602
+ { metric: 'Completed', value: metrics.completedTasks ?? 0 },
603
+ { metric: 'Failed', value: metrics.failedTasks ?? 0 },
604
+ { metric: 'Avg Task Time', value: `${(metrics.avgTaskTime ?? 0).toFixed(1)}ms` },
605
+ { metric: 'Consensus Rounds', value: metrics.consensusRounds ?? 0 },
606
+ { metric: 'Memory Usage', value: metrics.memoryUsage ?? '0 MB' }
607
+ ]
608
+ });
609
+ const health = result.health ?? { overall: 'healthy', queen: 'healthy', workers: 'healthy', consensus: 'healthy', memory: 'healthy' };
610
+ output.writeln();
611
+ output.writeln(output.bold('Health'));
612
+ output.printList([
613
+ `Overall: ${formatHealth(health.overall ?? 'healthy')}`,
614
+ `Queen: ${formatHealth(health.queen ?? 'healthy')}`,
615
+ `Workers: ${formatHealth(health.workers ?? 'healthy')}`,
616
+ `Consensus: ${formatHealth(health.consensus ?? 'healthy')}`,
617
+ `Memory: ${formatHealth(health.memory ?? 'healthy')}`
618
+ ]);
619
+ }
620
+ return { success: true, data: result };
621
+ }
622
+ catch (error) {
623
+ if (error instanceof MCPClientError) {
624
+ output.printError(`Status error: ${error.message}`);
625
+ }
626
+ else {
627
+ output.printError(`Unexpected error: ${String(error)}`);
628
+ }
629
+ return { success: false, exitCode: 1 };
630
+ }
631
+ }
632
+ };
633
+ // Task subcommand
634
+ const taskCommand = {
635
+ name: 'task',
636
+ description: 'Submit tasks to the hive',
637
+ options: [
638
+ {
639
+ name: 'description',
640
+ short: 'd',
641
+ description: 'Task description',
642
+ type: 'string'
643
+ },
644
+ {
645
+ name: 'priority',
646
+ short: 'p',
647
+ description: 'Task priority',
648
+ type: 'string',
649
+ choices: ['low', 'normal', 'high', 'critical'],
650
+ default: 'normal'
651
+ },
652
+ {
653
+ name: 'require-consensus',
654
+ short: 'c',
655
+ description: 'Require consensus for completion',
656
+ type: 'boolean',
657
+ default: false
658
+ },
659
+ {
660
+ name: 'timeout',
661
+ description: 'Task timeout in seconds',
662
+ type: 'number',
663
+ default: 300
664
+ }
665
+ ],
666
+ examples: [
667
+ { command: 'claude-flow hive-mind task -d "Implement auth module"', description: 'Submit task' },
668
+ { command: 'claude-flow hive-mind task -d "Security review" -p critical -c', description: 'Critical task with consensus' }
669
+ ],
670
+ action: async (ctx) => {
671
+ let description = ctx.flags.description || ctx.args.join(' ');
672
+ if (!description && ctx.interactive) {
673
+ description = await input({
674
+ message: 'Task description:',
675
+ validate: (v) => v.length > 0 || 'Description is required'
676
+ });
677
+ }
678
+ if (!description) {
679
+ output.printError('Task description is required');
680
+ return { success: false, exitCode: 1 };
681
+ }
682
+ const priority = ctx.flags.priority;
683
+ const requireConsensus = ctx.flags.requireConsensus;
684
+ const timeout = ctx.flags.timeout;
685
+ output.printInfo('Submitting task to hive...');
686
+ try {
687
+ const result = await callMCPTool('hive-mind_task', {
688
+ description,
689
+ priority,
690
+ requireConsensus,
691
+ timeout,
692
+ });
693
+ if (ctx.flags.format === 'json') {
694
+ output.printJson(result);
695
+ return { success: true, data: result };
696
+ }
697
+ output.writeln();
698
+ output.printBox([
699
+ `Task ID: ${result.taskId}`,
700
+ `Status: ${formatAgentStatus(result.status)}`,
701
+ `Priority: ${formatPriority(priority)}`,
702
+ `Assigned: ${result.assignedTo.join(', ')}`,
703
+ `Consensus: ${result.requiresConsensus ? 'Yes' : 'No'}`,
704
+ `Est. Time: ${result.estimatedTime}`
705
+ ].join('\n'), 'Task Submitted');
706
+ output.writeln();
707
+ output.printSuccess('Task submitted to hive');
708
+ output.writeln(output.dim(` Track with: claude-flow hive-mind task-status ${result.taskId}`));
709
+ return { success: true, data: result };
710
+ }
711
+ catch (error) {
712
+ if (error instanceof MCPClientError) {
713
+ output.printError(`Task submission error: ${error.message}`);
714
+ }
715
+ else {
716
+ output.printError(`Unexpected error: ${String(error)}`);
717
+ }
718
+ return { success: false, exitCode: 1 };
719
+ }
720
+ }
721
+ };
722
+ // Optimize memory subcommand
723
+ const optimizeMemoryCommand = {
724
+ name: 'optimize-memory',
725
+ description: 'Optimize hive memory and patterns',
726
+ options: [
727
+ {
728
+ name: 'aggressive',
729
+ short: 'a',
730
+ description: 'Aggressive optimization',
731
+ type: 'boolean',
732
+ default: false
733
+ },
734
+ {
735
+ name: 'threshold',
736
+ description: 'Quality threshold for pattern retention',
737
+ type: 'number',
738
+ default: 0.7
739
+ }
740
+ ],
741
+ action: async (ctx) => {
742
+ const aggressive = ctx.flags.aggressive;
743
+ const threshold = ctx.flags.threshold;
744
+ output.printInfo('Optimizing hive memory...');
745
+ const spinner = output.createSpinner({ text: 'Analyzing patterns...', spinner: 'dots' });
746
+ spinner.start();
747
+ try {
748
+ const result = await callMCPTool('hive-mind_optimize-memory', {
749
+ aggressive,
750
+ qualityThreshold: threshold,
751
+ });
752
+ spinner.succeed('Memory optimized');
753
+ if (ctx.flags.format === 'json') {
754
+ output.printJson(result);
755
+ return { success: true, data: result };
756
+ }
757
+ output.writeln();
758
+ output.printTable({
759
+ columns: [
760
+ { key: 'metric', header: 'Metric', width: 20 },
761
+ { key: 'before', header: 'Before', width: 15, align: 'right' },
762
+ { key: 'after', header: 'After', width: 15, align: 'right' }
763
+ ],
764
+ data: [
765
+ { metric: 'Patterns', before: result.before.patterns, after: result.after.patterns },
766
+ { metric: 'Memory', before: result.before.memory, after: result.after.memory }
767
+ ]
768
+ });
769
+ output.writeln();
770
+ output.printList([
771
+ `Patterns removed: ${result.removed}`,
772
+ `Patterns consolidated: ${result.consolidated}`,
773
+ `Optimization time: ${result.timeMs}ms`
774
+ ]);
775
+ return { success: true, data: result };
776
+ }
777
+ catch (error) {
778
+ spinner.fail('Optimization failed');
779
+ if (error instanceof MCPClientError) {
780
+ output.printError(`Optimization error: ${error.message}`);
781
+ }
782
+ else {
783
+ output.printError(`Unexpected error: ${String(error)}`);
784
+ }
785
+ return { success: false, exitCode: 1 };
786
+ }
787
+ }
788
+ };
789
+ // Join subcommand
790
+ const joinCommand = {
791
+ name: 'join',
792
+ description: 'Join an agent to the hive mind',
793
+ options: [
794
+ { name: 'agent-id', short: 'a', description: 'Agent ID to join', type: 'string' },
795
+ { name: 'role', short: 'r', description: 'Agent role (worker, specialist, scout)', type: 'string', default: 'worker' }
796
+ ],
797
+ action: async (ctx) => {
798
+ const agentId = ctx.args[0] || ctx.flags['agent-id'] || ctx.flags.agentId;
799
+ if (!agentId) {
800
+ output.printError('Agent ID is required. Use --agent-id or -a flag, or provide as argument.');
801
+ return { success: false, exitCode: 1 };
802
+ }
803
+ try {
804
+ const result = await callMCPTool('hive-mind_join', { agentId, role: ctx.flags.role });
805
+ if (!result.success) {
806
+ output.printError(result.error || 'Failed');
807
+ return { success: false, exitCode: 1 };
808
+ }
809
+ output.printSuccess(`Agent ${agentId} joined hive (${result.totalWorkers} workers)`);
810
+ return { success: true, data: result };
811
+ }
812
+ catch (error) {
813
+ output.printError(`Join error: ${error instanceof MCPClientError ? error.message : String(error)}`);
814
+ return { success: false, exitCode: 1 };
815
+ }
816
+ }
817
+ };
818
+ // Leave subcommand
819
+ const leaveCommand = {
820
+ name: 'leave',
821
+ description: 'Remove an agent from the hive mind',
822
+ options: [{ name: 'agent-id', short: 'a', description: 'Agent ID to remove', type: 'string' }],
823
+ action: async (ctx) => {
824
+ const agentId = ctx.args[0] || ctx.flags['agent-id'] || ctx.flags.agentId;
825
+ if (!agentId) {
826
+ output.printError('Agent ID required.');
827
+ return { success: false, exitCode: 1 };
828
+ }
829
+ try {
830
+ const result = await callMCPTool('hive-mind_leave', { agentId });
831
+ if (!result.success) {
832
+ output.printError(result.error || 'Failed');
833
+ return { success: false, exitCode: 1 };
834
+ }
835
+ output.printSuccess(`Agent ${agentId} left hive (${result.remainingWorkers} remaining)`);
836
+ return { success: true, data: result };
837
+ }
838
+ catch (error) {
839
+ output.printError(`Leave error: ${error instanceof MCPClientError ? error.message : String(error)}`);
840
+ return { success: false, exitCode: 1 };
841
+ }
842
+ }
843
+ };
844
+ // Consensus subcommand
845
+ const consensusCommand = {
846
+ name: 'consensus',
847
+ description: 'Manage consensus proposals and voting',
848
+ options: [
849
+ { name: 'action', short: 'a', description: 'Consensus action', type: 'string', choices: ['propose', 'vote', 'status', 'list'], default: 'list' },
850
+ { name: 'proposal-id', short: 'p', description: 'Proposal ID', type: 'string' },
851
+ { name: 'type', short: 't', description: 'Proposal type', type: 'string' },
852
+ { name: 'value', description: 'Proposal value', type: 'string' },
853
+ { name: 'vote', short: 'v', description: 'Vote (yes/no)', type: 'string' },
854
+ { name: 'voter-id', description: 'Voter agent ID', type: 'string' }
855
+ ],
856
+ action: async (ctx) => {
857
+ const action = ctx.flags.action || 'list';
858
+ try {
859
+ const result = await callMCPTool('hive-mind_consensus', { action, proposalId: ctx.flags.proposalId, type: ctx.flags.type, value: ctx.flags.value, vote: ctx.flags.vote === 'yes', voterId: ctx.flags.voterId });
860
+ if (ctx.flags.format === 'json') {
861
+ output.printJson(result);
862
+ return { success: true, data: result };
863
+ }
864
+ if (action === 'list') {
865
+ output.writeln(output.bold('\nPending Proposals'));
866
+ const pending = result.pending || [];
867
+ if (pending.length === 0)
868
+ output.printInfo('No pending proposals');
869
+ else
870
+ output.printTable({ columns: [{ key: 'proposalId', header: 'ID', width: 30 }, { key: 'type', header: 'Type', width: 12 }], data: pending });
871
+ }
872
+ else if (action === 'propose') {
873
+ output.printSuccess(`Proposal created: ${result.proposalId}`);
874
+ }
875
+ else if (action === 'vote') {
876
+ output.printSuccess(`Vote recorded (For: ${result.votesFor}, Against: ${result.votesAgainst})`);
877
+ }
878
+ return { success: true, data: result };
879
+ }
880
+ catch (error) {
881
+ output.printError(`Consensus error: ${error instanceof MCPClientError ? error.message : String(error)}`);
882
+ return { success: false, exitCode: 1 };
883
+ }
884
+ }
885
+ };
886
+ // Broadcast subcommand
887
+ const broadcastCommand = {
888
+ name: 'broadcast',
889
+ description: 'Broadcast a message to all workers in the hive',
890
+ options: [
891
+ { name: 'message', short: 'm', description: 'Message to broadcast', type: 'string', required: true },
892
+ { name: 'priority', short: 'p', description: 'Message priority', type: 'string', choices: ['low', 'normal', 'high', 'critical'], default: 'normal' },
893
+ { name: 'from', short: 'f', description: 'Sender agent ID', type: 'string' }
894
+ ],
895
+ action: async (ctx) => {
896
+ const message = ctx.args.join(' ') || ctx.flags.message;
897
+ if (!message) {
898
+ output.printError('Message required. Use --message or -m flag.');
899
+ return { success: false, exitCode: 1 };
900
+ }
901
+ try {
902
+ const result = await callMCPTool('hive-mind_broadcast', { message, priority: ctx.flags.priority, fromId: ctx.flags.from });
903
+ if (!result.success) {
904
+ output.printError(result.error || 'Failed');
905
+ return { success: false, exitCode: 1 };
906
+ }
907
+ output.printSuccess(`Message broadcast to ${result.recipients} workers (ID: ${result.messageId})`);
908
+ return { success: true, data: result };
909
+ }
910
+ catch (error) {
911
+ output.printError(`Broadcast error: ${error instanceof MCPClientError ? error.message : String(error)}`);
912
+ return { success: false, exitCode: 1 };
913
+ }
914
+ }
915
+ };
916
+ // Memory subcommand
917
+ const memorySubCommand = {
918
+ name: 'memory',
919
+ description: 'Access hive shared memory',
920
+ options: [
921
+ { name: 'action', short: 'a', description: 'Memory action', type: 'string', choices: ['get', 'set', 'delete', 'list'], default: 'list' },
922
+ { name: 'key', short: 'k', description: 'Memory key', type: 'string' },
923
+ { name: 'value', short: 'v', description: 'Value to store', type: 'string' }
924
+ ],
925
+ action: async (ctx) => {
926
+ const action = ctx.flags.action || 'list';
927
+ const key = ctx.flags.key;
928
+ const value = ctx.flags.value;
929
+ if ((action === 'get' || action === 'delete') && !key) {
930
+ output.printError('Key required for get/delete.');
931
+ return { success: false, exitCode: 1 };
932
+ }
933
+ if (action === 'set' && (!key || value === undefined)) {
934
+ output.printError('Key and value required for set.');
935
+ return { success: false, exitCode: 1 };
936
+ }
937
+ try {
938
+ const result = await callMCPTool('hive-mind_memory', { action, key, value });
939
+ if (ctx.flags.format === 'json') {
940
+ output.printJson(result);
941
+ return { success: true, data: result };
942
+ }
943
+ if (action === 'list') {
944
+ const keys = result.keys || [];
945
+ output.writeln(output.bold(`\nShared Memory (${result.count} keys)`));
946
+ if (keys.length === 0)
947
+ output.printInfo('No keys in shared memory');
948
+ else
949
+ output.printList(keys.map(k => output.highlight(k)));
950
+ }
951
+ else if (action === 'get') {
952
+ output.writeln(output.bold(`\nKey: ${key}`));
953
+ output.writeln(result.exists ? `Value: ${JSON.stringify(result.value, null, 2)}` : 'Key not found');
954
+ }
955
+ else if (action === 'set') {
956
+ output.printSuccess(`Set ${key} in shared memory`);
957
+ }
958
+ else if (action === 'delete') {
959
+ output.printSuccess(result.deleted ? `Deleted ${key}` : `Key ${key} did not exist`);
960
+ }
961
+ return { success: true, data: result };
962
+ }
963
+ catch (error) {
964
+ output.printError(`Memory error: ${error instanceof MCPClientError ? error.message : String(error)}`);
965
+ return { success: false, exitCode: 1 };
966
+ }
967
+ }
968
+ };
969
+ // Shutdown subcommand
970
+ const shutdownCommand = {
971
+ name: 'shutdown',
972
+ description: 'Shutdown the hive mind',
973
+ options: [
974
+ {
975
+ name: 'force',
976
+ short: 'f',
977
+ description: 'Force shutdown',
978
+ type: 'boolean',
979
+ default: false
980
+ },
981
+ {
982
+ name: 'save-state',
983
+ short: 's',
984
+ description: 'Save state before shutdown',
985
+ type: 'boolean',
986
+ default: true
987
+ }
988
+ ],
989
+ action: async (ctx) => {
990
+ const force = ctx.flags.force;
991
+ const saveState = ctx.flags.saveState;
992
+ if (!force && ctx.interactive) {
993
+ const confirmed = await confirm({
994
+ message: 'Shutdown the hive mind? All agents will be terminated.',
995
+ default: false
996
+ });
997
+ if (!confirmed) {
998
+ output.printInfo('Operation cancelled');
999
+ return { success: true };
1000
+ }
1001
+ }
1002
+ output.printInfo('Shutting down hive mind...');
1003
+ const spinner = output.createSpinner({ text: 'Graceful shutdown in progress...', spinner: 'dots' });
1004
+ spinner.start();
1005
+ try {
1006
+ const result = await callMCPTool('hive-mind_shutdown', {
1007
+ force,
1008
+ saveState,
1009
+ });
1010
+ spinner.succeed('Hive mind shutdown complete');
1011
+ output.writeln();
1012
+ output.printList([
1013
+ `Agents terminated: ${result.agentsTerminated}`,
1014
+ `State saved: ${result.stateSaved ? 'Yes' : 'No'}`,
1015
+ `Shutdown time: ${result.shutdownTime}`
1016
+ ]);
1017
+ return { success: true, data: result };
1018
+ }
1019
+ catch (error) {
1020
+ spinner.fail('Shutdown failed');
1021
+ if (error instanceof MCPClientError) {
1022
+ output.printError(`Shutdown error: ${error.message}`);
1023
+ }
1024
+ else {
1025
+ output.printError(`Unexpected error: ${String(error)}`);
1026
+ }
1027
+ return { success: false, exitCode: 1 };
1028
+ }
1029
+ }
1030
+ };
1031
+ // Main hive-mind command
1032
+ export const hiveMindCommand = {
1033
+ name: 'hive-mind',
1034
+ aliases: ['hive'],
1035
+ description: 'Queen-led consensus-based multi-agent coordination',
1036
+ subcommands: [initCommand, spawnCommand, statusCommand, taskCommand, joinCommand, leaveCommand, consensusCommand, broadcastCommand, memorySubCommand, optimizeMemoryCommand, shutdownCommand],
1037
+ options: [],
1038
+ examples: [
1039
+ { command: 'claude-flow hive-mind init -t hierarchical-mesh', description: 'Initialize hive' },
1040
+ { command: 'claude-flow hive-mind spawn -n 5', description: 'Spawn workers' },
1041
+ { command: 'claude-flow hive-mind spawn --claude -o "Build a feature"', description: 'Launch Claude Code with hive mind' },
1042
+ { command: 'claude-flow hive-mind task -d "Build feature"', description: 'Submit task' }
1043
+ ],
1044
+ action: async () => {
1045
+ output.writeln();
1046
+ output.writeln(output.bold('Hive Mind - Consensus-Based Multi-Agent Coordination'));
1047
+ output.writeln();
1048
+ output.writeln('Usage: claude-flow hive-mind <subcommand> [options]');
1049
+ output.writeln();
1050
+ output.writeln('Subcommands:');
1051
+ output.printList([
1052
+ `${output.highlight('init')} - Initialize hive mind`,
1053
+ `${output.highlight('spawn')} - Spawn worker agents (use --claude to launch Claude Code)`,
1054
+ `${output.highlight('status')} - Show hive status`,
1055
+ `${output.highlight('task')} - Submit task to hive`,
1056
+ `${output.highlight('join')} - Join an agent to the hive`,
1057
+ `${output.highlight('leave')} - Remove an agent from the hive`,
1058
+ `${output.highlight('consensus')} - Manage consensus proposals`,
1059
+ `${output.highlight('broadcast')} - Broadcast message to workers`,
1060
+ `${output.highlight('memory')} - Access shared memory`,
1061
+ `${output.highlight('optimize-memory')} - Optimize patterns and memory`,
1062
+ `${output.highlight('shutdown')} - Shutdown the hive`
1063
+ ]);
1064
+ output.writeln();
1065
+ output.writeln('Features:');
1066
+ output.printList([
1067
+ 'Queen-led hierarchical coordination',
1068
+ 'Byzantine fault tolerant consensus',
1069
+ 'HNSW-accelerated pattern matching',
1070
+ 'Cross-session memory persistence',
1071
+ 'Automatic load balancing',
1072
+ output.success('NEW: --claude flag to launch interactive Claude Code sessions')
1073
+ ]);
1074
+ output.writeln();
1075
+ output.writeln('Quick Start with Claude Code:');
1076
+ output.writeln(output.dim(' claude-flow hive-mind init'));
1077
+ output.writeln(output.dim(' claude-flow hive-mind spawn -n 5 --claude -o "Your objective here"'));
1078
+ return { success: true };
1079
+ }
1080
+ };
1081
+ // Helper functions
1082
+ function formatAgentStatus(status) {
1083
+ const statusStr = String(status);
1084
+ switch (statusStr) {
1085
+ case 'active':
1086
+ case 'ready':
1087
+ case 'running':
1088
+ return output.success(statusStr);
1089
+ case 'idle':
1090
+ case 'waiting':
1091
+ return output.dim(statusStr);
1092
+ case 'busy':
1093
+ return output.highlight(statusStr);
1094
+ case 'error':
1095
+ case 'failed':
1096
+ return output.error(statusStr);
1097
+ default:
1098
+ return statusStr;
1099
+ }
1100
+ }
1101
+ function formatHiveStatus(status) {
1102
+ switch (status) {
1103
+ case 'active':
1104
+ return output.success(status);
1105
+ case 'idle':
1106
+ return output.dim(status);
1107
+ case 'degraded':
1108
+ return output.warning(status);
1109
+ case 'offline':
1110
+ return output.error(status);
1111
+ default:
1112
+ return status;
1113
+ }
1114
+ }
1115
+ function formatHealth(health) {
1116
+ switch (health) {
1117
+ case 'healthy':
1118
+ case 'good':
1119
+ return output.success(health);
1120
+ case 'warning':
1121
+ case 'degraded':
1122
+ return output.warning(health);
1123
+ case 'critical':
1124
+ case 'unhealthy':
1125
+ return output.error(health);
1126
+ default:
1127
+ return health;
1128
+ }
1129
+ }
1130
+ function formatPriority(priority) {
1131
+ switch (priority) {
1132
+ case 'critical':
1133
+ return output.error(priority.toUpperCase());
1134
+ case 'high':
1135
+ return output.warning(priority);
1136
+ case 'normal':
1137
+ return priority;
1138
+ case 'low':
1139
+ return output.dim(priority);
1140
+ default:
1141
+ return priority;
1142
+ }
1143
+ }
1144
+ export default hiveMindCommand;
1145
+ //# sourceMappingURL=hive-mind.js.map