claude-flow 3.0.0-alpha.1 → 3.0.0-alpha.10

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 (243) hide show
  1. package/README.md +1151 -41
  2. package/bin/cli.js +8 -30
  3. package/dist/src/commands/agent.d.ts +8 -0
  4. package/dist/src/commands/agent.d.ts.map +1 -0
  5. package/dist/src/commands/agent.js +819 -0
  6. package/dist/src/commands/agent.js.map +1 -0
  7. package/dist/src/commands/config.d.ts +8 -0
  8. package/dist/src/commands/config.d.ts.map +1 -0
  9. package/dist/src/commands/config.js +406 -0
  10. package/dist/src/commands/config.js.map +1 -0
  11. package/dist/src/commands/daemon.d.ts +8 -0
  12. package/dist/src/commands/daemon.d.ts.map +1 -0
  13. package/dist/src/commands/daemon.js +545 -0
  14. package/dist/src/commands/daemon.js.map +1 -0
  15. package/dist/src/commands/hive-mind.d.ts +8 -0
  16. package/dist/src/commands/hive-mind.d.ts.map +1 -0
  17. package/dist/src/commands/hive-mind.js +844 -0
  18. package/dist/src/commands/hive-mind.js.map +1 -0
  19. package/dist/src/commands/hooks.d.ts +8 -0
  20. package/dist/src/commands/hooks.d.ts.map +1 -0
  21. package/dist/src/commands/hooks.js +2098 -0
  22. package/dist/src/commands/hooks.js.map +1 -0
  23. package/dist/src/commands/index.d.ts +52 -0
  24. package/dist/src/commands/index.d.ts.map +1 -0
  25. package/dist/src/commands/index.js +108 -0
  26. package/dist/src/commands/index.js.map +1 -0
  27. package/dist/src/commands/init.d.ts +8 -0
  28. package/dist/src/commands/init.d.ts.map +1 -0
  29. package/dist/src/commands/init.js +532 -0
  30. package/dist/src/commands/init.js.map +1 -0
  31. package/dist/src/commands/mcp.d.ts +11 -0
  32. package/dist/src/commands/mcp.d.ts.map +1 -0
  33. package/dist/src/commands/mcp.js +662 -0
  34. package/dist/src/commands/mcp.js.map +1 -0
  35. package/dist/src/commands/memory.d.ts +8 -0
  36. package/dist/src/commands/memory.d.ts.map +1 -0
  37. package/dist/src/commands/memory.js +977 -0
  38. package/dist/src/commands/memory.js.map +1 -0
  39. package/dist/src/commands/migrate.d.ts +8 -0
  40. package/dist/src/commands/migrate.d.ts.map +1 -0
  41. package/dist/src/commands/migrate.js +398 -0
  42. package/dist/src/commands/migrate.js.map +1 -0
  43. package/dist/src/commands/process.d.ts +10 -0
  44. package/dist/src/commands/process.d.ts.map +1 -0
  45. package/dist/src/commands/process.js +641 -0
  46. package/dist/src/commands/process.js.map +1 -0
  47. package/dist/src/commands/session.d.ts +8 -0
  48. package/dist/src/commands/session.d.ts.map +1 -0
  49. package/dist/src/commands/session.js +750 -0
  50. package/dist/src/commands/session.js.map +1 -0
  51. package/dist/src/commands/start.d.ts +8 -0
  52. package/dist/src/commands/start.d.ts.map +1 -0
  53. package/dist/src/commands/start.js +398 -0
  54. package/dist/src/commands/start.js.map +1 -0
  55. package/dist/src/commands/status.d.ts +8 -0
  56. package/dist/src/commands/status.d.ts.map +1 -0
  57. package/dist/src/commands/status.js +584 -0
  58. package/dist/src/commands/status.js.map +1 -0
  59. package/dist/src/commands/swarm.d.ts +8 -0
  60. package/dist/src/commands/swarm.d.ts.map +1 -0
  61. package/dist/src/commands/swarm.js +573 -0
  62. package/dist/src/commands/swarm.js.map +1 -0
  63. package/dist/src/commands/task.d.ts +8 -0
  64. package/dist/src/commands/task.d.ts.map +1 -0
  65. package/dist/src/commands/task.js +671 -0
  66. package/dist/src/commands/task.js.map +1 -0
  67. package/dist/src/commands/workflow.d.ts +8 -0
  68. package/dist/src/commands/workflow.d.ts.map +1 -0
  69. package/dist/src/commands/workflow.js +617 -0
  70. package/dist/src/commands/workflow.js.map +1 -0
  71. package/dist/src/config-adapter.d.ts +15 -0
  72. package/dist/src/config-adapter.d.ts.map +1 -0
  73. package/dist/src/config-adapter.js +185 -0
  74. package/dist/src/config-adapter.js.map +1 -0
  75. package/dist/src/index.d.ts +55 -0
  76. package/dist/src/index.d.ts.map +1 -0
  77. package/dist/src/index.js +353 -0
  78. package/dist/src/index.js.map +1 -0
  79. package/dist/src/infrastructure/in-memory-repositories.d.ts +68 -0
  80. package/dist/src/infrastructure/in-memory-repositories.d.ts.map +1 -0
  81. package/dist/src/infrastructure/in-memory-repositories.js +264 -0
  82. package/dist/src/infrastructure/in-memory-repositories.js.map +1 -0
  83. package/dist/src/init/claudemd-generator.d.ts +15 -0
  84. package/dist/src/init/claudemd-generator.d.ts.map +1 -0
  85. package/dist/src/init/claudemd-generator.js +626 -0
  86. package/dist/src/init/claudemd-generator.js.map +1 -0
  87. package/dist/src/init/executor.d.ts +11 -0
  88. package/dist/src/init/executor.d.ts.map +1 -0
  89. package/dist/src/init/executor.js +652 -0
  90. package/dist/src/init/executor.js.map +1 -0
  91. package/dist/src/init/helpers-generator.d.ts +42 -0
  92. package/dist/src/init/helpers-generator.d.ts.map +1 -0
  93. package/dist/src/init/helpers-generator.js +613 -0
  94. package/dist/src/init/helpers-generator.js.map +1 -0
  95. package/dist/src/init/index.d.ts +12 -0
  96. package/dist/src/init/index.d.ts.map +1 -0
  97. package/dist/src/init/index.js +15 -0
  98. package/dist/src/init/index.js.map +1 -0
  99. package/dist/src/init/mcp-generator.d.ts +18 -0
  100. package/dist/src/init/mcp-generator.d.ts.map +1 -0
  101. package/dist/src/init/mcp-generator.js +71 -0
  102. package/dist/src/init/mcp-generator.js.map +1 -0
  103. package/dist/src/init/settings-generator.d.ts +14 -0
  104. package/dist/src/init/settings-generator.d.ts.map +1 -0
  105. package/dist/src/init/settings-generator.js +267 -0
  106. package/dist/src/init/settings-generator.js.map +1 -0
  107. package/dist/src/init/statusline-generator.d.ts +14 -0
  108. package/dist/src/init/statusline-generator.d.ts.map +1 -0
  109. package/dist/src/init/statusline-generator.js +206 -0
  110. package/dist/src/init/statusline-generator.js.map +1 -0
  111. package/dist/src/init/types.d.ts +240 -0
  112. package/dist/src/init/types.d.ts.map +1 -0
  113. package/dist/src/init/types.js +210 -0
  114. package/dist/src/init/types.js.map +1 -0
  115. package/dist/src/mcp-client.d.ts +92 -0
  116. package/dist/src/mcp-client.d.ts.map +1 -0
  117. package/dist/src/mcp-client.js +203 -0
  118. package/dist/src/mcp-client.js.map +1 -0
  119. package/dist/src/mcp-server.d.ts +153 -0
  120. package/dist/src/mcp-server.d.ts.map +1 -0
  121. package/dist/src/mcp-server.js +453 -0
  122. package/dist/src/mcp-server.js.map +1 -0
  123. package/dist/src/mcp-tools/agent-tools.d.ts +8 -0
  124. package/dist/src/mcp-tools/agent-tools.d.ts.map +1 -0
  125. package/dist/src/mcp-tools/agent-tools.js +426 -0
  126. package/dist/src/mcp-tools/agent-tools.js.map +1 -0
  127. package/dist/src/mcp-tools/config-tools.d.ts +8 -0
  128. package/dist/src/mcp-tools/config-tools.d.ts.map +1 -0
  129. package/dist/src/mcp-tools/config-tools.js +333 -0
  130. package/dist/src/mcp-tools/config-tools.js.map +1 -0
  131. package/dist/src/mcp-tools/hive-mind-tools.d.ts +8 -0
  132. package/dist/src/mcp-tools/hive-mind-tools.d.ts.map +1 -0
  133. package/dist/src/mcp-tools/hive-mind-tools.js +447 -0
  134. package/dist/src/mcp-tools/hive-mind-tools.js.map +1 -0
  135. package/dist/src/mcp-tools/hooks-tools.d.ts +41 -0
  136. package/dist/src/mcp-tools/hooks-tools.d.ts.map +1 -0
  137. package/dist/src/mcp-tools/hooks-tools.js +1711 -0
  138. package/dist/src/mcp-tools/hooks-tools.js.map +1 -0
  139. package/dist/src/mcp-tools/index.d.ts +16 -0
  140. package/dist/src/mcp-tools/index.d.ts.map +1 -0
  141. package/dist/src/mcp-tools/index.js +15 -0
  142. package/dist/src/mcp-tools/index.js.map +1 -0
  143. package/dist/src/mcp-tools/memory-tools.d.ts +8 -0
  144. package/dist/src/mcp-tools/memory-tools.d.ts.map +1 -0
  145. package/dist/src/mcp-tools/memory-tools.js +235 -0
  146. package/dist/src/mcp-tools/memory-tools.js.map +1 -0
  147. package/dist/src/mcp-tools/session-tools.d.ts +8 -0
  148. package/dist/src/mcp-tools/session-tools.d.ts.map +1 -0
  149. package/dist/src/mcp-tools/session-tools.js +315 -0
  150. package/dist/src/mcp-tools/session-tools.js.map +1 -0
  151. package/dist/src/mcp-tools/swarm-tools.d.ts +8 -0
  152. package/dist/src/mcp-tools/swarm-tools.d.ts.map +1 -0
  153. package/dist/src/mcp-tools/swarm-tools.js +102 -0
  154. package/dist/src/mcp-tools/swarm-tools.js.map +1 -0
  155. package/dist/src/mcp-tools/task-tools.d.ts +8 -0
  156. package/dist/src/mcp-tools/task-tools.d.ts.map +1 -0
  157. package/dist/src/mcp-tools/task-tools.js +302 -0
  158. package/dist/src/mcp-tools/task-tools.js.map +1 -0
  159. package/dist/src/mcp-tools/types.d.ts +31 -0
  160. package/dist/src/mcp-tools/types.d.ts.map +1 -0
  161. package/dist/src/mcp-tools/types.js +7 -0
  162. package/dist/src/mcp-tools/types.js.map +1 -0
  163. package/dist/src/mcp-tools/workflow-tools.d.ts +8 -0
  164. package/dist/src/mcp-tools/workflow-tools.d.ts.map +1 -0
  165. package/dist/src/mcp-tools/workflow-tools.js +481 -0
  166. package/dist/src/mcp-tools/workflow-tools.js.map +1 -0
  167. package/dist/src/output.d.ts +133 -0
  168. package/dist/src/output.d.ts.map +1 -0
  169. package/dist/src/output.js +513 -0
  170. package/dist/src/output.js.map +1 -0
  171. package/dist/src/parser.d.ts +41 -0
  172. package/dist/src/parser.d.ts.map +1 -0
  173. package/dist/src/parser.js +353 -0
  174. package/dist/src/parser.js.map +1 -0
  175. package/dist/src/prompt.d.ts +44 -0
  176. package/dist/src/prompt.d.ts.map +1 -0
  177. package/dist/src/prompt.js +501 -0
  178. package/dist/src/prompt.js.map +1 -0
  179. package/dist/src/services/index.d.ts +7 -0
  180. package/dist/src/services/index.d.ts.map +1 -0
  181. package/dist/src/services/index.js +6 -0
  182. package/dist/src/services/index.js.map +1 -0
  183. package/dist/src/services/worker-daemon.d.ts +153 -0
  184. package/dist/src/services/worker-daemon.d.ts.map +1 -0
  185. package/dist/src/services/worker-daemon.js +567 -0
  186. package/dist/src/services/worker-daemon.js.map +1 -0
  187. package/dist/src/types.d.ts +198 -0
  188. package/dist/src/types.d.ts.map +1 -0
  189. package/dist/src/types.js +38 -0
  190. package/dist/src/types.js.map +1 -0
  191. package/dist/tsconfig.tsbuildinfo +1 -0
  192. package/package.json +12 -52
  193. package/src/commands/agent.ts +955 -0
  194. package/src/commands/config.ts +452 -0
  195. package/src/commands/daemon.ts +621 -0
  196. package/src/commands/hive-mind.ts +928 -0
  197. package/src/commands/hooks.ts +2603 -0
  198. package/src/commands/index.ts +118 -0
  199. package/src/commands/init.ts +597 -0
  200. package/src/commands/mcp.ts +753 -0
  201. package/src/commands/memory.ts +1161 -0
  202. package/src/commands/migrate.ts +447 -0
  203. package/src/commands/process.ts +695 -0
  204. package/src/commands/session.ts +891 -0
  205. package/src/commands/start.ts +457 -0
  206. package/src/commands/status.ts +736 -0
  207. package/src/commands/swarm.ts +648 -0
  208. package/src/commands/task.ts +792 -0
  209. package/src/commands/workflow.ts +742 -0
  210. package/src/config-adapter.ts +210 -0
  211. package/src/index.ts +427 -0
  212. package/src/infrastructure/in-memory-repositories.ts +310 -0
  213. package/src/init/claudemd-generator.ts +631 -0
  214. package/src/init/executor.ts +762 -0
  215. package/src/init/helpers-generator.ts +628 -0
  216. package/src/init/index.ts +60 -0
  217. package/src/init/mcp-generator.ts +83 -0
  218. package/src/init/settings-generator.ts +284 -0
  219. package/src/init/statusline-generator.ts +211 -0
  220. package/src/init/types.ts +447 -0
  221. package/src/mcp-client.ts +241 -0
  222. package/src/mcp-server.ts +577 -0
  223. package/src/mcp-tools/agent-tools.ts +466 -0
  224. package/src/mcp-tools/config-tools.ts +370 -0
  225. package/src/mcp-tools/hive-mind-tools.ts +521 -0
  226. package/src/mcp-tools/hooks-tools.ts +1888 -0
  227. package/src/mcp-tools/index.ts +16 -0
  228. package/src/mcp-tools/memory-tools.ts +270 -0
  229. package/src/mcp-tools/session-tools.ts +359 -0
  230. package/src/mcp-tools/swarm-tools.ts +105 -0
  231. package/src/mcp-tools/task-tools.ts +347 -0
  232. package/src/mcp-tools/types.ts +33 -0
  233. package/src/mcp-tools/workflow-tools.ts +573 -0
  234. package/src/output.ts +639 -0
  235. package/src/parser.ts +417 -0
  236. package/src/prompt.ts +619 -0
  237. package/src/services/index.ts +15 -0
  238. package/src/services/worker-daemon.ts +726 -0
  239. package/src/types.ts +287 -0
  240. package/dist/index.d.ts +0 -30
  241. package/dist/index.d.ts.map +0 -1
  242. package/dist/index.js +0 -30
  243. package/dist/index.js.map +0 -1
package/README.md CHANGED
@@ -1,75 +1,1185 @@
1
- # claude-flow
1
+ # @claude-flow/cli
2
2
 
3
- **Multi-agent AI orchestration for Claude Code**
3
+ [![npm version](https://img.shields.io/npm/v/@claude-flow/cli.svg)](https://www.npmjs.com/package/@claude-flow/cli)
4
+ [![npm downloads](https://img.shields.io/npm/dm/@claude-flow/cli.svg)](https://www.npmjs.com/package/@claude-flow/cli)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-blue.svg)](https://www.typescriptlang.org/)
7
+ [![Node.js](https://img.shields.io/badge/Node.js-20+-green.svg)](https://nodejs.org/)
8
+ [![Commands](https://img.shields.io/badge/Commands-14+-orange.svg)](https://github.com/ruvnet/claude-flow)
9
+ [![Subcommands](https://img.shields.io/badge/Subcommands-92+-purple.svg)](https://github.com/ruvnet/claude-flow)
4
10
 
5
- Deploy 54+ specialized agents in coordinated swarms with self-learning capabilities, fault-tolerant consensus, and enterprise-grade security.
11
+ > Modern CLI module for Claude Flow V3 - comprehensive command-line interface with 14 commands, 92+ subcommands, interactive prompts, self-learning hooks, background workers, hive-mind coordination, and beautiful output formatting.
6
12
 
7
- ## Installation
13
+ ## Features
14
+
15
+ ### Core Capabilities
16
+ - **14 Main Commands** - Complete CLI coverage for all Claude Flow operations
17
+ - **92+ Subcommands** - Fine-grained control over every aspect of the system
18
+ - **Advanced Argument Parsing** - Full support for flags, options, subcommands, and positional arguments
19
+ - **Interactive Prompts** - Rich interactive mode with confirmations, selections, and input validation
20
+ - **Beautiful Output** - Colored output, tables, progress bars, spinners, and multiple formats (text, JSON, table)
8
21
 
9
- Works with both **Node.js** and **Bun** runtimes.
22
+ ### V3-Specific Features
23
+ - **Self-Learning Hooks** - 17 hook subcommands + 12 background workers with pattern learning and neural integration
24
+ - **Hive-Mind Coordination** - Queen-led Byzantine fault-tolerant multi-agent consensus
25
+ - **15-Agent Swarm** - V3 hierarchical mesh coordination with domain specialization
26
+ - **AgentDB Integration** - 150x-12,500x faster vector search with HNSW indexing
27
+ - **SONA Learning** - Sub-0.05ms adaptation with Mixture of Experts routing
28
+
29
+ ### Developer Experience
30
+ - **Type-Safe** - Full TypeScript support with comprehensive type definitions
31
+ - **Global Options** - Built-in `--help`, `--version`, `--verbose`, `--quiet`, `--format`
32
+ - **Auto-Completion** - Shell completion support for commands and options
33
+ - **Migration Tools** - Built-in V2 to V3 migration with rollback support
34
+
35
+ ## Installation
10
36
 
11
37
  ```bash
12
- # With npm/npx (Node.js)
13
- npm install claude-flow@v3alpha
14
- npx claude-flow@v3alpha init
38
+ npm install @claude-flow/cli
39
+ ```
40
+
41
+ Or use globally:
15
42
 
16
- # With Bun (faster)
17
- bun add claude-flow@v3alpha
18
- bunx claude-flow@v3alpha init
43
+ ```bash
44
+ npm install -g @claude-flow/cli
45
+ claude-flow --version
19
46
  ```
20
47
 
21
48
  ## Quick Start
22
49
 
23
50
  ```bash
24
- # Initialize in your project
25
- npx claude-flow@v3alpha init
51
+ # Initialize a new project
52
+ claude-flow init --wizard
26
53
 
27
- # Start MCP server for Claude Code integration
28
- npx claude-flow@v3alpha mcp start
54
+ # Start MCP server
55
+ claude-flow mcp start
29
56
 
30
- # Run a task with agents
31
- npx claude-flow@v3alpha --agent coder --task "Implement user authentication"
57
+ # Spawn an agent
58
+ claude-flow agent spawn -t coder --name my-coder
32
59
 
33
60
  # Initialize a swarm
34
- npx claude-flow@v3alpha swarm init --topology hierarchical
61
+ claude-flow swarm init --v3-mode
35
62
 
36
- # Route tasks intelligently
37
- npx claude-flow@v3alpha hooks route "Optimize database queries"
63
+ # Search memory
64
+ claude-flow memory search -q "authentication patterns"
65
+
66
+ # Check system status
67
+ claude-flow status --watch
38
68
  ```
39
69
 
40
- ## Features
70
+ ## Complete Command Reference
71
+
72
+ ### Overview
73
+
74
+ | Command | Subcommands | Description |
75
+ |---------|-------------|-------------|
76
+ | `init` | 4 | Project initialization with wizard, presets, and configuration |
77
+ | `agent` | 8 | Agent lifecycle management (spawn, list, status, stop, metrics, pool, health, logs) |
78
+ | `swarm` | 6 | Multi-agent swarm coordination and orchestration |
79
+ | `memory` | 11 | AgentDB memory operations with vector search |
80
+ | `mcp` | 9 | MCP server management and tool execution |
81
+ | `task` | 6 | Task creation, assignment, and lifecycle management |
82
+ | `session` | 7 | Session state management and persistence |
83
+ | `config` | 7 | Configuration management and provider setup |
84
+ | `status` | 3 | System status monitoring with watch mode |
85
+ | `start` | 3 | Service startup and quick launch |
86
+ | `workflow` | 6 | Workflow execution and template management |
87
+ | `hooks` | 17 | Self-learning hooks with neural pattern recognition + 12 background workers |
88
+ | `hive-mind` | 6 | Queen-led consensus-based multi-agent coordination |
89
+ | `migrate` | 5 | V2 to V3 migration with rollback support |
90
+
91
+ ---
92
+
93
+ ### `init` - Project Initialization
94
+
95
+ Initialize Claude Flow V3 with interactive wizard or presets.
96
+
97
+ ```bash
98
+ claude-flow init [subcommand] [options]
99
+ ```
100
+
101
+ #### Subcommands
102
+
103
+ | Subcommand | Description |
104
+ |------------|-------------|
105
+ | `wizard` | Interactive setup wizard with step-by-step configuration |
106
+ | `check` | Validate current configuration and environment |
107
+ | `skills` | List and manage available skills |
108
+ | `hooks` | Configure and validate hooks integration |
109
+
110
+ #### Options
111
+
112
+ | Option | Short | Description | Default |
113
+ |--------|-------|-------------|---------|
114
+ | `--preset` | `-p` | Configuration preset (minimal, default, full, custom) | `default` |
115
+ | `--force` | `-f` | Overwrite existing configuration | `false` |
116
+ | `--skip-deps` | | Skip dependency installation | `false` |
117
+ | `--topology` | `-t` | Swarm topology (hierarchical, mesh, hybrid) | `hierarchical` |
118
+ | `--max-agents` | `-m` | Maximum concurrent agents | `15` |
119
+ | `--memory-backend` | | Memory backend (agentdb, sqlite, hybrid) | `hybrid` |
120
+ | `--enable-hnsw` | | Enable HNSW indexing (150x faster) | `true` |
121
+ | `--enable-neural` | | Enable SONA neural learning | `true` |
122
+
123
+ #### Examples
124
+
125
+ ```bash
126
+ # Interactive wizard
127
+ claude-flow init --wizard
128
+
129
+ # Quick setup with defaults
130
+ claude-flow init --preset default
131
+
132
+ # Full V3 setup with all features
133
+ claude-flow init --preset full --enable-hnsw --enable-neural
134
+
135
+ # Validate configuration
136
+ claude-flow init check
137
+ ```
138
+
139
+ ---
140
+
141
+ ### `agent` - Agent Management
142
+
143
+ Spawn, manage, and monitor AI agents with various specializations.
144
+
145
+ ```bash
146
+ claude-flow agent <subcommand> [options]
147
+ ```
148
+
149
+ #### Subcommands
150
+
151
+ | Subcommand | Aliases | Description |
152
+ |------------|---------|-------------|
153
+ | `spawn` | | Spawn a new agent with specified type and configuration |
154
+ | `list` | `ls` | List all active agents with filtering options |
155
+ | `status` | | Show detailed status and metrics for an agent |
156
+ | `stop` | `kill` | Stop a running agent (graceful or forced) |
157
+ | `metrics` | | Show agent performance metrics over time |
158
+ | `pool` | | Manage agent pool for auto-scaling |
159
+ | `health` | | Show agent health and resource metrics |
160
+ | `logs` | | View agent activity logs with filtering |
161
+
162
+ #### Agent Types
163
+
164
+ | Type | Description | Capabilities |
165
+ |------|-------------|--------------|
166
+ | `coder` | Code development with neural patterns | code-generation, refactoring, debugging, testing |
167
+ | `researcher` | Research with web access and data analysis | web-search, data-analysis, summarization, citation |
168
+ | `tester` | Comprehensive testing with automation | unit-testing, integration-testing, coverage-analysis |
169
+ | `reviewer` | Code review with security and quality checks | code-review, security-audit, quality-check |
170
+ | `architect` | System design with enterprise patterns | system-design, pattern-analysis, scalability |
171
+ | `coordinator` | Multi-agent orchestration and workflow | task-orchestration, agent-management, workflow-control |
172
+ | `security-architect` | Security architecture and threat modeling | threat-modeling, security-patterns, compliance |
173
+ | `security-auditor` | CVE remediation and security testing | vulnerability-scan, penetration-testing |
174
+ | `memory-specialist` | AgentDB unification (150x-12,500x faster) | vector-search, agentdb, caching, optimization |
175
+ | `performance-engineer` | 2.49x-7.47x optimization targets | benchmarking, profiling, optimization |
176
+
177
+ #### Spawn Options
178
+
179
+ | Option | Short | Description | Default |
180
+ |--------|-------|-------------|---------|
181
+ | `--type` | `-t` | Agent type to spawn | required |
182
+ | `--name` | `-n` | Agent name/identifier | auto-generated |
183
+ | `--provider` | `-p` | LLM provider (anthropic, openrouter, ollama) | `anthropic` |
184
+ | `--model` | `-m` | Model to use | provider default |
185
+ | `--task` | | Initial task for the agent | none |
186
+ | `--timeout` | | Agent timeout in seconds | `300` |
187
+ | `--auto-tools` | | Enable automatic tool usage | `true` |
188
+
189
+ #### Examples
190
+
191
+ ```bash
192
+ # Spawn a coder agent
193
+ claude-flow agent spawn -t coder --name my-coder
194
+
195
+ # Spawn researcher with initial task
196
+ claude-flow agent spawn -t researcher --task "Research React 19 features"
197
+
198
+ # List all active agents
199
+ claude-flow agent list
200
+
201
+ # List agents by type
202
+ claude-flow agent list -t coder
203
+
204
+ # Get detailed agent status
205
+ claude-flow agent status agent-001
206
+
207
+ # Show agent metrics for 24 hours
208
+ claude-flow agent metrics -p 24h
209
+
210
+ # View agent logs
211
+ claude-flow agent logs -i agent-001 -f
212
+
213
+ # Configure agent pool
214
+ claude-flow agent pool --size 5 --min 2 --max 15 --auto-scale
215
+
216
+ # Health check with detailed metrics
217
+ claude-flow agent health -d
218
+
219
+ # Stop agent gracefully
220
+ claude-flow agent stop agent-001
221
+
222
+ # Force stop
223
+ claude-flow agent stop agent-001 -f
224
+ ```
225
+
226
+ ---
227
+
228
+ ### `swarm` - Swarm Coordination
229
+
230
+ Multi-agent swarm initialization, coordination, and management.
231
+
232
+ ```bash
233
+ claude-flow swarm <subcommand> [options]
234
+ ```
235
+
236
+ #### Subcommands
237
+
238
+ | Subcommand | Description |
239
+ |------------|-------------|
240
+ | `init` | Initialize a new swarm with specified topology |
241
+ | `start` | Start swarm execution with objective and strategy |
242
+ | `status` | Show swarm status, progress, and metrics |
243
+ | `stop` | Stop swarm execution (with state save option) |
244
+ | `scale` | Scale swarm agent count up or down |
245
+ | `coordinate` | Execute V3 15-agent hierarchical mesh coordination |
246
+
247
+ #### Topologies
248
+
249
+ | Topology | Description | Best For |
250
+ |----------|-------------|----------|
251
+ | `hierarchical` | Queen-led coordination with worker agents | Structured tasks, clear authority |
252
+ | `mesh` | Fully connected peer-to-peer network | Collaborative work, redundancy |
253
+ | `ring` | Circular communication pattern | Sequential processing |
254
+ | `star` | Central coordinator with spoke agents | Centralized control |
255
+ | `hybrid` | Hierarchical mesh for maximum flexibility | Complex multi-domain tasks |
256
+
257
+ #### Strategies
258
+
259
+ | Strategy | Description | Agent Distribution |
260
+ |----------|-------------|-------------------|
261
+ | `research` | Distributed research and analysis | 1 coordinator, 4 researchers, 2 analysts |
262
+ | `development` | Collaborative code development | 1 coordinator, 1 architect, 3 coders, 2 testers, 1 reviewer |
263
+ | `testing` | Comprehensive test coverage | 1 test lead, 2 unit testers, 2 integration testers, 1 QA |
264
+ | `optimization` | Performance optimization | 1 performance lead, 2 profilers, 2 optimizers |
265
+ | `maintenance` | Codebase maintenance and refactoring | 1 coordinator, 2 refactorers, 1 documenter |
266
+ | `analysis` | Code analysis and documentation | 1 analyst lead, 2 code analysts, 1 security analyst |
267
+
268
+ #### Examples
269
+
270
+ ```bash
271
+ # Initialize V3 swarm (recommended)
272
+ claude-flow swarm init --v3-mode
273
+
274
+ # Initialize with specific topology
275
+ claude-flow swarm init -t mesh --max-agents 10
276
+
277
+ # Start development swarm
278
+ claude-flow swarm start -o "Build REST API with authentication" -s development
279
+
280
+ # Parallel analysis swarm
281
+ claude-flow swarm start -o "Analyze codebase for performance issues" --parallel
282
+
283
+ # Check swarm status
284
+ claude-flow swarm status swarm-123
285
+
286
+ # Scale swarm
287
+ claude-flow swarm scale swarm-123 --agents 20
288
+
289
+ # V3 15-agent coordination
290
+ claude-flow swarm coordinate --agents 15
291
+
292
+ # Stop with state save
293
+ claude-flow swarm stop swarm-123 --save-state
294
+ ```
295
+
296
+ ---
297
+
298
+ ### `memory` - Memory Management
299
+
300
+ AgentDB memory operations with vector search, caching, and optimization.
301
+
302
+ ```bash
303
+ claude-flow memory <subcommand> [options]
304
+ ```
305
+
306
+ #### Subcommands
307
+
308
+ | Subcommand | Aliases | Description |
309
+ |------------|---------|-------------|
310
+ | `store` | | Store data in memory with optional vector embedding |
311
+ | `retrieve` | `get` | Retrieve data from memory by key |
312
+ | `search` | | Semantic/vector search with HNSW indexing |
313
+ | `list` | `ls` | List memory entries with filtering |
314
+ | `delete` | `rm` | Delete memory entry |
315
+ | `stats` | | Show memory statistics and performance |
316
+ | `configure` | `config` | Configure memory backend and HNSW parameters |
317
+ | `cleanup` | | Clean up stale and expired entries |
318
+ | `compress` | | Compress and optimize memory storage |
319
+ | `export` | | Export memory to file (JSON, CSV, binary) |
320
+ | `import` | | Import memory from file |
321
+
322
+ #### Memory Backends
323
+
324
+ | Backend | Description | Performance |
325
+ |---------|-------------|-------------|
326
+ | `agentdb` | Vector database with HNSW indexing | 150x-12,500x faster search |
327
+ | `sqlite` | Lightweight local storage | Good for small datasets |
328
+ | `hybrid` | SQLite + AgentDB (recommended) | Best of both worlds |
329
+ | `memory` | In-memory (non-persistent) | Fastest, no persistence |
330
+
331
+ #### Search Options
41
332
 
42
- - **54+ Specialized Agents** - Coder, tester, reviewer, security, DevOps, and more
43
- - **Swarm Coordination** - Queen-led hierarchy with 5 consensus algorithms
44
- - **Self-Learning** - SONA neural architecture with <0.05ms adaptation
45
- - **HNSW Memory** - 150x-12,500x faster vector search
46
- - **Multi-Provider LLM** - Claude, GPT, Gemini, Cohere, Ollama with failover
47
- - **Background Workers** - 12 auto-triggered workers for continuous optimization
48
- - **Enterprise Security** - CVE-hardened with input validation and sandboxing
333
+ | Option | Short | Description | Default |
334
+ |--------|-------|-------------|---------|
335
+ | `--query` | `-q` | Search query | required |
336
+ | `--namespace` | `-n` | Memory namespace | all |
337
+ | `--limit` | `-l` | Maximum results | `10` |
338
+ | `--threshold` | | Similarity threshold (0-1) | `0.7` |
339
+ | `--type` | `-t` | Search type (semantic, keyword, hybrid) | `semantic` |
49
340
 
50
- ## Programmatic Usage
341
+ #### Examples
342
+
343
+ ```bash
344
+ # Store text data
345
+ claude-flow memory store -k "api/auth" -v "JWT implementation with refresh tokens"
346
+
347
+ # Store as vector embedding
348
+ claude-flow memory store -k "pattern/singleton" -v "Singleton pattern description" --vector
349
+
350
+ # Semantic search
351
+ claude-flow memory search -q "authentication patterns"
352
+
353
+ # Keyword search
354
+ claude-flow memory search -q "JWT" -t keyword
355
+
356
+ # Hybrid search with threshold
357
+ claude-flow memory search -q "security best practices" -t hybrid --threshold 0.8
358
+
359
+ # List entries by namespace
360
+ claude-flow memory list -n patterns
361
+
362
+ # Show memory statistics
363
+ claude-flow memory stats
364
+
365
+ # Configure HNSW parameters
366
+ claude-flow memory configure -b hybrid --hnsw-m 16 --hnsw-ef 200
367
+
368
+ # Cleanup old entries
369
+ claude-flow memory cleanup --older-than 30d
370
+
371
+ # Cleanup expired TTL entries
372
+ claude-flow memory cleanup --expired-only
373
+
374
+ # Compress with quantization (32x memory reduction)
375
+ claude-flow memory compress --quantize --bits 4
376
+
377
+ # Export memory
378
+ claude-flow memory export -o ./backup.json -f json
379
+
380
+ # Import memory
381
+ claude-flow memory import -i ./backup.json --merge
382
+ ```
383
+
384
+ ---
385
+
386
+ ### `mcp` - MCP Server Management
387
+
388
+ Model Context Protocol server control and tool execution.
389
+
390
+ ```bash
391
+ claude-flow mcp <subcommand> [options]
392
+ ```
393
+
394
+ #### Subcommands
395
+
396
+ | Subcommand | Description |
397
+ |------------|-------------|
398
+ | `start` | Start MCP server with specified transport |
399
+ | `stop` | Stop MCP server (graceful or forced) |
400
+ | `status` | Show MCP server status and metrics |
401
+ | `health` | Check MCP server health |
402
+ | `restart` | Restart MCP server |
403
+ | `tools` | List available MCP tools by category |
404
+ | `toggle` | Enable or disable specific tools |
405
+ | `exec` | Execute an MCP tool directly |
406
+ | `logs` | Show MCP server logs |
407
+
408
+ #### Transport Types
409
+
410
+ | Transport | Description | Use Case |
411
+ |-----------|-------------|----------|
412
+ | `stdio` | Standard I/O (default) | Claude Code integration |
413
+ | `http` | HTTP REST API | Web integrations, remote access |
414
+ | `websocket` | WebSocket connection | Real-time bidirectional |
415
+
416
+ #### Tool Categories
417
+
418
+ | Category | Description | Tool Count |
419
+ |----------|-------------|------------|
420
+ | `agent` | Agent lifecycle management | 4 |
421
+ | `swarm` | Swarm coordination | 3 |
422
+ | `memory` | Memory operations | 3 |
423
+ | `config` | Configuration | 3 |
424
+ | `hooks` | Hook execution | 9 |
425
+ | `system` | System operations | 3 |
426
+
427
+ #### Examples
428
+
429
+ ```bash
430
+ # Start with stdio (default)
431
+ claude-flow mcp start
432
+
433
+ # Start HTTP server on port 8080
434
+ claude-flow mcp start -t http -p 8080
435
+
436
+ # Start as background daemon
437
+ claude-flow mcp start -d
438
+
439
+ # Check server status
440
+ claude-flow mcp status
441
+
442
+ # Health check
443
+ claude-flow mcp health
444
+
445
+ # List all tools
446
+ claude-flow mcp tools
447
+
448
+ # List tools by category
449
+ claude-flow mcp tools -c memory
450
+
451
+ # Execute a tool
452
+ claude-flow mcp exec -t swarm/init -p '{"topology":"mesh"}'
453
+
454
+ # View logs
455
+ claude-flow mcp logs -n 50 -f
456
+
457
+ # Restart server
458
+ claude-flow mcp restart
459
+
460
+ # Stop server
461
+ claude-flow mcp stop
462
+ ```
463
+
464
+ ---
465
+
466
+ ### `task` - Task Management
467
+
468
+ Create, assign, and manage tasks across agents.
469
+
470
+ ```bash
471
+ claude-flow task <subcommand> [options]
472
+ ```
473
+
474
+ #### Subcommands
475
+
476
+ | Subcommand | Description |
477
+ |------------|-------------|
478
+ | `create` | Create a new task with priority and dependencies |
479
+ | `list` | List tasks with status filtering |
480
+ | `status` | Show detailed task status |
481
+ | `cancel` | Cancel a pending or running task |
482
+ | `assign` | Assign task to specific agent |
483
+ | `retry` | Retry a failed task |
484
+
485
+ #### Examples
486
+
487
+ ```bash
488
+ # Create a task
489
+ claude-flow task create "Implement user authentication" -p high
490
+
491
+ # Create task with dependencies
492
+ claude-flow task create "Write tests" --depends-on task-001
493
+
494
+ # List all tasks
495
+ claude-flow task list
496
+
497
+ # List pending tasks
498
+ claude-flow task list -s pending
499
+
500
+ # Get task status
501
+ claude-flow task status task-001
502
+
503
+ # Assign to agent
504
+ claude-flow task assign task-001 --agent coder-001
505
+
506
+ # Cancel task
507
+ claude-flow task cancel task-001
508
+
509
+ # Retry failed task
510
+ claude-flow task retry task-001
511
+ ```
512
+
513
+ ---
514
+
515
+ ### `session` - Session Management
516
+
517
+ Manage session state, persistence, and restoration.
518
+
519
+ ```bash
520
+ claude-flow session <subcommand> [options]
521
+ ```
522
+
523
+ #### Subcommands
524
+
525
+ | Subcommand | Description |
526
+ |------------|-------------|
527
+ | `list` | List all sessions |
528
+ | `save` | Save current session state |
529
+ | `restore` | Restore a previous session |
530
+ | `delete` | Delete a session |
531
+ | `export` | Export session to file |
532
+ | `import` | Import session from file |
533
+ | `current` | Show current session info |
534
+
535
+ #### Examples
536
+
537
+ ```bash
538
+ # List all sessions
539
+ claude-flow session list
540
+
541
+ # Save current session
542
+ claude-flow session save --name "feature-auth"
543
+
544
+ # Restore session
545
+ claude-flow session restore session-123
546
+
547
+ # Export session
548
+ claude-flow session export -o ./session-backup.json
549
+
550
+ # Import session
551
+ claude-flow session import -i ./session-backup.json
552
+
553
+ # Show current session
554
+ claude-flow session current
555
+
556
+ # Delete old session
557
+ claude-flow session delete session-123
558
+ ```
559
+
560
+ ---
561
+
562
+ ### `config` - Configuration Management
563
+
564
+ Manage configuration, providers, and settings.
565
+
566
+ ```bash
567
+ claude-flow config <subcommand> [options]
568
+ ```
569
+
570
+ #### Subcommands
571
+
572
+ | Subcommand | Description |
573
+ |------------|-------------|
574
+ | `init` | Initialize configuration file |
575
+ | `get` | Get configuration value |
576
+ | `set` | Set configuration value |
577
+ | `providers` | Manage LLM provider configurations |
578
+ | `reset` | Reset configuration to defaults |
579
+ | `export` | Export configuration |
580
+ | `import` | Import configuration |
581
+
582
+ #### Examples
583
+
584
+ ```bash
585
+ # Initialize config
586
+ claude-flow config init
587
+
588
+ # Get a value
589
+ claude-flow config get memory.backend
590
+
591
+ # Set a value
592
+ claude-flow config set swarm.topology mesh
593
+
594
+ # Configure providers
595
+ claude-flow config providers --add anthropic --api-key $ANTHROPIC_API_KEY
596
+
597
+ # Reset to defaults
598
+ claude-flow config reset --confirm
599
+
600
+ # Export config
601
+ claude-flow config export -o ./config-backup.json
602
+
603
+ # Import config
604
+ claude-flow config import -i ./config.json
605
+ ```
606
+
607
+ ---
608
+
609
+ ### `status` - System Status
610
+
611
+ Monitor system status with real-time updates.
612
+
613
+ ```bash
614
+ claude-flow status [subcommand] [options]
615
+ ```
616
+
617
+ #### Subcommands
618
+
619
+ | Subcommand | Description |
620
+ |------------|-------------|
621
+ | `agents` | Show status of all agents |
622
+ | `tasks` | Show status of all tasks |
623
+ | `memory` | Show memory system status |
624
+
625
+ #### Options
626
+
627
+ | Option | Short | Description | Default |
628
+ |--------|-------|-------------|---------|
629
+ | `--watch` | `-w` | Watch mode with auto-refresh | `false` |
630
+ | `--interval` | `-i` | Refresh interval in seconds | `5` |
631
+
632
+ #### Examples
633
+
634
+ ```bash
635
+ # Show all status
636
+ claude-flow status
637
+
638
+ # Watch mode with 2s refresh
639
+ claude-flow status --watch -i 2
640
+
641
+ # Agent status only
642
+ claude-flow status agents
643
+
644
+ # Task status
645
+ claude-flow status tasks
646
+
647
+ # Memory status
648
+ claude-flow status memory
649
+ ```
650
+
651
+ ---
652
+
653
+ ### `workflow` - Workflow Management
654
+
655
+ Execute and manage automated workflows.
656
+
657
+ ```bash
658
+ claude-flow workflow <subcommand> [options]
659
+ ```
660
+
661
+ #### Subcommands
662
+
663
+ | Subcommand | Description |
664
+ |------------|-------------|
665
+ | `run` | Execute a workflow |
666
+ | `validate` | Validate workflow definition |
667
+ | `list` | List available workflows |
668
+ | `status` | Show workflow execution status |
669
+ | `stop` | Stop running workflow |
670
+ | `template` | Manage workflow templates (list, show, create) |
671
+
672
+ #### Examples
673
+
674
+ ```bash
675
+ # Run a workflow
676
+ claude-flow workflow run ./workflows/deploy.yaml
677
+
678
+ # Validate workflow
679
+ claude-flow workflow validate ./workflows/deploy.yaml
680
+
681
+ # List workflows
682
+ claude-flow workflow list
683
+
684
+ # Check workflow status
685
+ claude-flow workflow status workflow-123
686
+
687
+ # Stop workflow
688
+ claude-flow workflow stop workflow-123
689
+
690
+ # List templates
691
+ claude-flow workflow template list
692
+
693
+ # Create from template
694
+ claude-flow workflow template create --from deploy-standard
695
+ ```
696
+
697
+ ---
698
+
699
+ ### `hooks` - Self-Learning Hooks
700
+
701
+ Advanced self-learning hooks with 17 subcommands for neural pattern recognition and background worker management.
702
+
703
+ ```bash
704
+ claude-flow hooks <subcommand> [options]
705
+ ```
706
+
707
+ #### Subcommands
708
+
709
+ | Subcommand | Description |
710
+ |------------|-------------|
711
+ | `pre-edit` | Execute before file edit (get context, agent suggestions) |
712
+ | `post-edit` | Execute after file edit (record outcome for learning) |
713
+ | `pre-command` | Execute before command (risk assessment) |
714
+ | `post-command` | Execute after command (record outcome) |
715
+ | `pre-task` | Execute before task (setup, validation) |
716
+ | `post-task` | Execute after task (cleanup, learning) |
717
+ | `session-end` | Execute on session end (save state) |
718
+ | `session-restore` | Execute on session restore (load state) |
719
+ | `route` | Route task to optimal agent using learned patterns |
720
+ | `explain` | Explain routing decision with transparency |
721
+ | `pretrain` | Bootstrap intelligence from repository |
722
+ | `build-agents` | Generate optimized agent configs from pretrain data |
723
+ | `metrics` | View learning metrics dashboard |
724
+ | `transfer` | Transfer patterns from another project |
725
+ | `list` | List all registered hooks |
726
+ | `intelligence` | RuVector intelligence (SONA, MoE, HNSW) |
727
+ | `worker` | Background worker management (12 workers) |
728
+
729
+ #### Learning Pipeline
730
+
731
+ The hooks system implements a 4-step learning pipeline:
732
+
733
+ 1. **RETRIEVE** - Top-k memory injection with MMR diversity
734
+ 2. **JUDGE** - LLM-as-judge trajectory evaluation
735
+ 3. **DISTILL** - Extract strategy memories from trajectories
736
+ 4. **CONSOLIDATE** - Dedup, detect contradictions, prune old patterns
737
+
738
+ #### Examples
739
+
740
+ ```bash
741
+ # Pre-edit hook (get context and suggestions)
742
+ claude-flow hooks pre-edit ./src/auth/login.ts
743
+
744
+ # Post-edit hook (record success for learning)
745
+ claude-flow hooks post-edit ./src/auth/login.ts --success true
746
+
747
+ # Pre-command risk assessment
748
+ claude-flow hooks pre-command "rm -rf ./node_modules"
749
+
750
+ # Route task to optimal agent
751
+ claude-flow hooks route "Implement OAuth2 authentication"
752
+
753
+ # Explain routing decision
754
+ claude-flow hooks explain "Implement OAuth2 authentication"
755
+
756
+ # Bootstrap from repository
757
+ claude-flow hooks pretrain
758
+
759
+ # Build optimized agent configs
760
+ claude-flow hooks build-agents --focus "security"
761
+
762
+ # View learning metrics
763
+ claude-flow hooks metrics
764
+
765
+ # Transfer patterns from another project
766
+ claude-flow hooks transfer ../other-project
767
+
768
+ # View intelligence status (SONA, MoE, HNSW)
769
+ claude-flow hooks intelligence
770
+ ```
771
+
772
+ #### Worker Subcommands
773
+
774
+ The `hooks worker` command manages 12 background workers for analysis and optimization tasks.
775
+
776
+ | Worker | Priority | Est. Time | Description |
777
+ |--------|----------|-----------|-------------|
778
+ | `ultralearn` | normal | 60s | Deep knowledge acquisition and learning |
779
+ | `optimize` | high | 30s | Performance optimization and tuning |
780
+ | `consolidate` | low | 20s | Memory consolidation and cleanup |
781
+ | `predict` | normal | 15s | Predictive preloading and anticipation |
782
+ | `audit` | critical | 45s | Security analysis and vulnerability scanning |
783
+ | `map` | normal | 30s | Codebase mapping and architecture analysis |
784
+ | `preload` | low | 10s | Resource preloading and cache warming |
785
+ | `deepdive` | normal | 60s | Deep code analysis and examination |
786
+ | `document` | normal | 45s | Auto-documentation generation |
787
+ | `refactor` | normal | 30s | Code refactoring suggestions |
788
+ | `benchmark` | normal | 60s | Performance benchmarking |
789
+ | `testgaps` | normal | 30s | Test coverage analysis |
790
+
791
+ ##### Worker Commands
792
+
793
+ ```bash
794
+ # List all available workers
795
+ claude-flow hooks worker list
796
+
797
+ # Detect triggers from prompt text
798
+ claude-flow hooks worker detect --prompt "optimize performance"
799
+
800
+ # Auto-dispatch workers when triggers match (min confidence 0.6)
801
+ claude-flow hooks worker detect --prompt "deep dive into auth" --auto-dispatch --min-confidence 0.6
802
+
803
+ # Manually dispatch a worker
804
+ claude-flow hooks worker dispatch --trigger refactor --context "auth module"
805
+
806
+ # Check worker status
807
+ claude-flow hooks worker status
808
+
809
+ # Cancel a running worker
810
+ claude-flow hooks worker cancel --id worker_refactor_1_abc123
811
+ ```
812
+
813
+ ##### Performance Targets
814
+
815
+ | Metric | Target |
816
+ |--------|--------|
817
+ | Trigger detection | <5ms |
818
+ | Worker spawn | <50ms |
819
+ | Max concurrent | 10 |
820
+
821
+ ##### UserPromptSubmit Integration
822
+
823
+ Workers are automatically triggered via the `UserPromptSubmit` hook when prompt patterns match worker triggers with confidence ≥0.6.
824
+
825
+ ---
826
+
827
+ ### `hive-mind` - Consensus Coordination
828
+
829
+ Queen-led Byzantine fault-tolerant multi-agent coordination.
830
+
831
+ ```bash
832
+ claude-flow hive-mind <subcommand> [options]
833
+ ```
834
+
835
+ #### Subcommands
836
+
837
+ | Subcommand | Description |
838
+ |------------|-------------|
839
+ | `init` | Initialize hive-mind with topology and consensus strategy |
840
+ | `spawn` | Spawn agents in the hive (queen, worker, specialist) |
841
+ | `status` | Show hive-mind status with consensus health |
842
+ | `task` | Submit task to hive-mind for collaborative execution |
843
+ | `optimize-memory` | Optimize collective memory (distill, compress) |
844
+ | `shutdown` | Gracefully shutdown hive-mind |
845
+
846
+ #### Topologies
847
+
848
+ | Topology | Description |
849
+ |----------|-------------|
850
+ | `hierarchical` | Queen controls workers directly |
851
+ | `mesh` | Fully connected peer network |
852
+ | `hierarchical-mesh` | Hybrid: Queen + mesh workers |
853
+ | `adaptive` | Dynamic topology based on load |
854
+
855
+ #### Consensus Strategies
856
+
857
+ | Strategy | Description | Fault Tolerance |
858
+ |----------|-------------|-----------------|
859
+ | `byzantine` | Byzantine fault-tolerant (BFT) | Tolerates f < n/3 faulty nodes |
860
+ | `raft` | Leader-based consensus | Tolerates f < n/2 failures |
861
+ | `gossip` | Epidemic protocol for eventual consistency | High partition tolerance |
862
+ | `crdt` | Conflict-free replicated data types | Strong eventual consistency |
863
+ | `quorum` | Configurable quorum-based | Flexible fault tolerance |
864
+
865
+ #### Examples
866
+
867
+ ```bash
868
+ # Initialize with defaults
869
+ claude-flow hive-mind init
870
+
871
+ # Initialize with Byzantine consensus
872
+ claude-flow hive-mind init -t hierarchical-mesh -c byzantine --agents 15
873
+
874
+ # Spawn queen
875
+ claude-flow hive-mind spawn --role queen --name hive-queen
876
+
877
+ # Spawn workers
878
+ claude-flow hive-mind spawn --role worker --count 5
879
+
880
+ # Spawn specialist
881
+ claude-flow hive-mind spawn --role specialist --specialty security
882
+
883
+ # Submit task for collaborative execution
884
+ claude-flow hive-mind task "Implement secure API endpoints" --consensus-required
885
+
886
+ # Check hive status
887
+ claude-flow hive-mind status --detailed
888
+
889
+ # Optimize collective memory
890
+ claude-flow hive-mind optimize-memory --distill --compress
891
+
892
+ # Graceful shutdown
893
+ claude-flow hive-mind shutdown --save-state
894
+ ```
895
+
896
+ ---
897
+
898
+ ### `migrate` - V2 to V3 Migration
899
+
900
+ Migration tools for transitioning from V2 to V3.
901
+
902
+ ```bash
903
+ claude-flow migrate <subcommand> [options]
904
+ ```
905
+
906
+ #### Subcommands
907
+
908
+ | Subcommand | Description |
909
+ |------------|-------------|
910
+ | `status` | Check migration status and pending items |
911
+ | `run` | Execute migration (with dry-run option) |
912
+ | `verify` | Verify migration integrity |
913
+ | `rollback` | Rollback to previous version |
914
+ | `breaking` | Show V3 breaking changes |
915
+
916
+ #### Migration Targets
917
+
918
+ | Target | Description |
919
+ |--------|-------------|
920
+ | `config` | Migrate configuration files |
921
+ | `memory` | Migrate memory/database content |
922
+ | `agents` | Migrate agent configurations |
923
+ | `hooks` | Migrate hook definitions |
924
+ | `workflows` | Migrate workflow definitions |
925
+ | `all` | Full migration |
926
+
927
+ #### Examples
928
+
929
+ ```bash
930
+ # Check migration status
931
+ claude-flow migrate status
932
+
933
+ # Preview migration (dry run)
934
+ claude-flow migrate run --dry-run
935
+
936
+ # Run full migration with backup
937
+ claude-flow migrate run -t all --backup
938
+
939
+ # Migrate specific component
940
+ claude-flow migrate run -t memory
941
+
942
+ # Verify migration
943
+ claude-flow migrate verify
944
+
945
+ # Auto-fix issues
946
+ claude-flow migrate verify --fix
947
+
948
+ # Show breaking changes
949
+ claude-flow migrate breaking
950
+
951
+ # Rollback
952
+ claude-flow migrate rollback --backup-id backup-1704369600
953
+ ```
954
+
955
+ ---
956
+
957
+ ## Global Options
958
+
959
+ All commands support these global options:
960
+
961
+ | Option | Short | Description | Default |
962
+ |--------|-------|-------------|---------|
963
+ | `--help` | `-h` | Show help information | |
964
+ | `--version` | `-V` | Show version number | |
965
+ | `--verbose` | `-v` | Enable verbose output | `false` |
966
+ | `--quiet` | `-q` | Suppress non-essential output | `false` |
967
+ | `--config` | `-c` | Path to configuration file | `./claude-flow.config.json` |
968
+ | `--format` | `-f` | Output format (text, json, table) | `text` |
969
+ | `--no-color` | | Disable colored output | `false` |
970
+ | `--interactive` | `-i` | Enable interactive mode | `true` (if TTY) |
971
+
972
+ ## Programmatic API
973
+
974
+ ### CommandParser
51
975
 
52
976
  ```typescript
53
- import { createUnifiedSwarmCoordinator } from 'claude-flow';
977
+ import { CommandParser, OutputFormatter } from '@claude-flow/cli';
54
978
 
55
- const coordinator = createUnifiedSwarmCoordinator({
56
- topology: { type: 'hierarchical', maxAgents: 15 },
57
- consensus: { algorithm: 'raft' },
979
+ // Create a parser instance
980
+ const parser = new CommandParser();
981
+
982
+ // Register a command
983
+ parser.registerCommand({
984
+ name: 'mycommand',
985
+ description: 'My custom command',
986
+ options: [
987
+ {
988
+ name: 'type',
989
+ short: 't',
990
+ description: 'Operation type',
991
+ type: 'string',
992
+ choices: ['a', 'b', 'c'],
993
+ default: 'a'
994
+ }
995
+ ],
996
+ subcommands: [
997
+ { name: 'sub1', description: 'First subcommand' },
998
+ { name: 'sub2', description: 'Second subcommand' }
999
+ ],
1000
+ action: async (ctx) => {
1001
+ // Command implementation
1002
+ return { success: true };
1003
+ }
1004
+ });
1005
+
1006
+ // Parse arguments
1007
+ const result = parser.parse(process.argv.slice(2));
1008
+
1009
+ // Validate flags
1010
+ const errors = parser.validateFlags(result.flags, result.command);
1011
+
1012
+ // Get all registered commands
1013
+ const commands = parser.getAllCommands();
1014
+ ```
1015
+
1016
+ ### Output Formatting
1017
+
1018
+ ```typescript
1019
+ import { OutputFormatter, output, Progress, Spinner } from '@claude-flow/cli';
1020
+
1021
+ // Use the singleton instance
1022
+ output.printSuccess('Operation completed');
1023
+ output.printError('Something went wrong');
1024
+ output.printWarning('Proceed with caution');
1025
+ output.printInfo('FYI: This is informational');
1026
+
1027
+ // Or create a custom formatter
1028
+ const formatter = new OutputFormatter({ color: true });
1029
+
1030
+ // Color methods
1031
+ formatter.success('Green text');
1032
+ formatter.error('Red text');
1033
+ formatter.warning('Yellow text');
1034
+ formatter.bold('Bold text');
1035
+ formatter.dim('Dimmed text');
1036
+ formatter.highlight('Highlighted text');
1037
+
1038
+ // Structured output
1039
+ output.printTable({
1040
+ columns: [
1041
+ { key: 'name', header: 'Name', width: 20 },
1042
+ { key: 'status', header: 'Status', width: 10, align: 'right' }
1043
+ ],
1044
+ data: [
1045
+ { name: 'Agent 1', status: 'active' },
1046
+ { name: 'Agent 2', status: 'idle' }
1047
+ ]
1048
+ });
1049
+
1050
+ output.printJson({ key: 'value' });
1051
+ output.printList(['Item 1', 'Item 2', 'Item 3']);
1052
+ output.printBox('Content here', 'Title');
1053
+ output.progressBar(50, 100, 40); // 50% of 100, width 40
1054
+
1055
+ // Progress indication
1056
+ const spinner = new Spinner('Loading...');
1057
+ spinner.start();
1058
+ // ... do work
1059
+ spinner.succeed('Completed');
1060
+
1061
+ const progress = new Progress({ total: 100 });
1062
+ progress.update(50); // 50%
1063
+ progress.finish();
1064
+ ```
1065
+
1066
+ ### Interactive Prompts
1067
+
1068
+ ```typescript
1069
+ import { text, select, confirm, input, multiSelect } from '@claude-flow/cli';
1070
+
1071
+ // Text input
1072
+ const name = await text('Enter your name:');
1073
+
1074
+ // Selection
1075
+ const choice = await select({
1076
+ message: 'Choose option:',
1077
+ options: [
1078
+ { label: 'Option A', value: 'A', hint: 'First option' },
1079
+ { label: 'Option B', value: 'B', hint: 'Second option' },
1080
+ ],
1081
+ default: 'A'
1082
+ });
1083
+
1084
+ // Confirmation
1085
+ const confirmed = await confirm({
1086
+ message: 'Continue?',
1087
+ default: false
58
1088
  });
59
1089
 
60
- await coordinator.initialize();
61
- await coordinator.spawnFullHierarchy();
1090
+ // Input with validation
1091
+ const email = await input({
1092
+ message: 'Enter email:',
1093
+ validate: (v) => v.includes('@') || 'Invalid email'
1094
+ });
62
1095
 
63
- const result = await coordinator.submitTask({
64
- type: 'coding',
65
- name: 'Implement feature',
66
- priority: 'high',
1096
+ // Multi-select
1097
+ const features = await multiSelect({
1098
+ message: 'Select features:',
1099
+ options: [
1100
+ { label: 'Feature A', value: 'a' },
1101
+ { label: 'Feature B', value: 'b' },
1102
+ { label: 'Feature C', value: 'c' },
1103
+ ]
67
1104
  });
68
1105
  ```
69
1106
 
70
- ## Documentation
1107
+ ## TypeScript Types
1108
+
1109
+ ```typescript
1110
+ import type {
1111
+ // Command types
1112
+ Command,
1113
+ CommandOption,
1114
+ CommandContext,
1115
+ CommandResult,
1116
+
1117
+ // Parser types
1118
+ ParseResult,
1119
+ ParsedFlags,
1120
+ ParserOptions,
1121
+
1122
+ // Config types
1123
+ V3Config,
1124
+ ProviderConfig,
1125
+ SwarmConfig,
1126
+ MemoryConfig,
1127
+
1128
+ // Output types
1129
+ TableColumn,
1130
+ TableOptions,
1131
+ SpinnerOptions,
1132
+ ProgressOptions,
1133
+
1134
+ // Prompt types
1135
+ SelectOption,
1136
+ InputOptions,
1137
+ ConfirmOptions,
1138
+ } from '@claude-flow/cli';
1139
+ ```
1140
+
1141
+ ## Environment Variables
1142
+
1143
+ ```bash
1144
+ # Configuration
1145
+ CLAUDE_FLOW_CONFIG=./claude-flow.config.json
1146
+ CLAUDE_FLOW_LOG_LEVEL=info
1147
+
1148
+ # Provider API Keys
1149
+ ANTHROPIC_API_KEY=sk-ant-...
1150
+ OPENAI_API_KEY=sk-...
1151
+ GOOGLE_API_KEY=...
1152
+
1153
+ # MCP Server
1154
+ CLAUDE_FLOW_MCP_PORT=3000
1155
+ CLAUDE_FLOW_MCP_HOST=localhost
1156
+ CLAUDE_FLOW_MCP_TRANSPORT=stdio
1157
+
1158
+ # Memory
1159
+ CLAUDE_FLOW_MEMORY_BACKEND=hybrid
1160
+ CLAUDE_FLOW_MEMORY_PATH=./data/memory
1161
+ ```
1162
+
1163
+ ## Performance Targets
1164
+
1165
+ The CLI is optimized for V3 performance targets:
1166
+
1167
+ | Metric | Target | Description |
1168
+ |--------|--------|-------------|
1169
+ | Startup | <500ms | CLI initialization time |
1170
+ | Command parsing | <5ms | Argument parsing time |
1171
+ | MCP tool execution | <100ms | Tool call overhead |
1172
+ | Memory search | 150x-12,500x faster | With HNSW indexing |
1173
+ | SONA adaptation | <0.05ms | Neural learning overhead |
1174
+
1175
+ ## Related Packages
71
1176
 
72
- See the [main repository](https://github.com/ruvnet/claude-flow) for full documentation.
1177
+ - [@claude-flow/shared](../shared) - Shared types and utilities
1178
+ - [@claude-flow/swarm](../swarm) - Swarm coordination module
1179
+ - [@claude-flow/memory](../memory) - AgentDB memory system
1180
+ - [@claude-flow/mcp](../mcp) - MCP server implementation
1181
+ - [@claude-flow/hooks](../hooks) - Self-learning hooks system
1182
+ - [@claude-flow/neural](../neural) - SONA neural learning
73
1183
 
74
1184
  ## License
75
1185