@claude-flow/cli

Modern CLI module for Claude Flow V3 - comprehensive command-line interface with 26 commands, 140+ subcommands, interactive prompts, self-learning hooks, background workers, hive-mind coordination, smart error suggestions, and beautiful output formatting.
Features
Core Capabilities
- 26 Main Commands - Complete CLI coverage for all Claude Flow operations
- 140+ Subcommands - Fine-grained control over every aspect of the system
- Advanced Argument Parsing - Full support for flags, options, subcommands, and positional arguments
- Interactive Prompts - Rich interactive mode with confirmations, selections, and input validation
- Beautiful Output - Colored output, tables, progress bars, spinners, and multiple formats (text, JSON, table)
- Smart Error Suggestions - Levenshtein distance-based typo detection with helpful corrections
V3-Specific Features
- Self-Learning Hooks - 17 hook subcommands + 12 background workers with pattern learning and neural integration
- Hive-Mind Coordination - Queen-led Byzantine fault-tolerant multi-agent consensus
- 15-Agent Swarm - V3 hierarchical mesh coordination with domain specialization
- AgentDB Integration - 150x-12,500x faster vector search with HNSW indexing
- SONA Learning - Sub-0.05ms adaptation with Mixture of Experts routing
Developer Experience
- Type-Safe - Full TypeScript support with comprehensive type definitions
- Global Options - Built-in
--help, --version, --verbose, --quiet, --format
- Shell Completions - Full tab completion for bash, zsh, fish, and PowerShell
- Doctor Command - System diagnostics with health checks and suggested fixes
- Migration Tools - Built-in V2 to V3 migration with rollback support
Installation
Or use globally:
Quick Start
Complete Command Reference
Overview
| Command |
Subcommands |
Description |
init |
4 |
Project initialization with wizard, presets, and configuration |
agent |
8 |
Agent lifecycle management (spawn, list, status, stop, metrics, pool, health, logs) |
swarm |
6 |
Multi-agent swarm coordination and orchestration |
memory |
11 |
AgentDB memory operations with vector search |
mcp |
9 |
MCP server management and tool execution |
task |
6 |
Task creation, assignment, and lifecycle management |
session |
7 |
Session state management and persistence |
config |
7 |
Configuration management and provider setup |
status |
3 |
System status monitoring with watch mode |
start |
3 |
Service startup and quick launch |
workflow |
6 |
Workflow execution and template management |
hooks |
17 |
Self-learning hooks with neural pattern recognition + 12 background workers |
hive-mind |
6 |
Queen-led consensus-based multi-agent coordination |
migrate |
5 |
V2 to V3 migration with rollback support |
process |
4 |
Background process management and monitoring |
daemon |
5 |
Node.js worker daemon (start, stop, status, trigger, enable) |
neural |
5 |
Neural pattern training (train, status, patterns, predict, optimize) |
security |
6 |
Security scanning (scan, audit, cve, threats, validate, report) |
performance |
5 |
Performance profiling (benchmark, profile, metrics, optimize, report) |
providers |
5 |
AI providers (list, add, remove, test, configure) |
plugins |
5 |
Plugin management (list, install, uninstall, enable, disable) |
deployment |
5 |
Deployment management (deploy, rollback, status, environments, release) |
embeddings |
4 |
Vector embeddings (embed, batch, search, init) - 75x faster with agentic-flow |
claims |
4 |
Claims-based authorization (check, grant, revoke, list) |
doctor |
1 |
System diagnostics with health checks and suggested fixes |
completions |
4 |
Shell completions for bash, zsh, fish, and PowerShell |
init - Project Initialization
Initialize Claude Flow V3 with interactive wizard or presets.
Subcommands
| Subcommand |
Description |
wizard |
Interactive setup wizard with step-by-step configuration |
check |
Validate current configuration and environment |
skills |
List and manage available skills |
hooks |
Configure and validate hooks integration |
Options
| Option |
Short |
Description |
Default |
--preset |
-p |
Configuration preset (minimal, default, full, custom) |
default |
--force |
-f |
Overwrite existing configuration |
false |
--skip-deps |
|
Skip dependency installation |
false |
--topology |
-t |
Swarm topology (hierarchical, mesh, hybrid) |
hierarchical |
--max-agents |
-m |
Maximum concurrent agents |
15 |
--memory-backend |
|
Memory backend (agentdb, sqlite, hybrid) |
hybrid |
--enable-hnsw |
|
Enable HNSW indexing (150x faster) |
true |
--enable-neural |
|
Enable SONA neural learning |
true |
Examples
agent - Agent Management
Spawn, manage, and monitor AI agents with various specializations.
Subcommands
| Subcommand |
Aliases |
Description |
spawn |
|
Spawn a new agent with specified type and configuration |
list |
ls |
List all active agents with filtering options |
status |
|
Show detailed status and metrics for an agent |
stop |
kill |
Stop a running agent (graceful or forced) |
metrics |
|
Show agent performance metrics over time |
pool |
|
Manage agent pool for auto-scaling |
health |
|
Show agent health and resource metrics |
logs |
|
View agent activity logs with filtering |
Agent Types
| Type |
Description |
Capabilities |
coder |
Code development with neural patterns |
code-generation, refactoring, debugging, testing |
researcher |
Research with web access and data analysis |
web-search, data-analysis, summarization, citation |
tester |
Comprehensive testing with automation |
unit-testing, integration-testing, coverage-analysis |
reviewer |
Code review with security and quality checks |
code-review, security-audit, quality-check |
architect |
System design with enterprise patterns |
system-design, pattern-analysis, scalability |
coordinator |
Multi-agent orchestration and workflow |
task-orchestration, agent-management, workflow-control |
security-architect |
Security architecture and threat modeling |
threat-modeling, security-patterns, compliance |
security-auditor |
CVE remediation and security testing |
vulnerability-scan, penetration-testing |
memory-specialist |
AgentDB unification (150x-12,500x faster) |
vector-search, agentdb, caching, optimization |
performance-engineer |
2.49x-7.47x optimization targets |
benchmarking, profiling, optimization |
Spawn Options
| Option |
Short |
Description |
Default |
--type |
-t |
Agent type to spawn |
required |
--name |
-n |
Agent name/identifier |
auto-generated |
--provider |
-p |
LLM provider (anthropic, openrouter, ollama) |
anthropic |
--model |
-m |
Model to use |
provider default |
--task |
|
Initial task for the agent |
none |
--timeout |
|
Agent timeout in seconds |
300 |
--auto-tools |
|
Enable automatic tool usage |
true |
Examples
swarm - Swarm Coordination
Multi-agent swarm initialization, coordination, and management.
Subcommands
| Subcommand |
Description |
init |
Initialize a new swarm with specified topology |
start |
Start swarm execution with objective and strategy |
status |
Show swarm status, progress, and metrics |
stop |
Stop swarm execution (with state save option) |
scale |
Scale swarm agent count up or down |
coordinate |
Execute V3 15-agent hierarchical mesh coordination |
Topologies
| Topology |
Description |
Best For |
hierarchical |
Queen-led coordination with worker agents |
Structured tasks, clear authority |
mesh |
Fully connected peer-to-peer network |
Collaborative work, redundancy |
ring |
Circular communication pattern |
Sequential processing |
star |
Central coordinator with spoke agents |
Centralized control |
hybrid |
Hierarchical mesh for maximum flexibility |
Complex multi-domain tasks |
Strategies
| Strategy |
Description |
Agent Distribution |
research |
Distributed research and analysis |
1 coordinator, 4 researchers, 2 analysts |
development |
Collaborative code development |
1 coordinator, 1 architect, 3 coders, 2 testers, 1 reviewer |
testing |
Comprehensive test coverage |
1 test lead, 2 unit testers, 2 integration testers, 1 QA |
optimization |
Performance optimization |
1 performance lead, 2 profilers, 2 optimizers |
maintenance |
Codebase maintenance and refactoring |
1 coordinator, 2 refactorers, 1 documenter |
analysis |
Code analysis and documentation |
1 analyst lead, 2 code analysts, 1 security analyst |
Examples
memory - Memory Management
AgentDB memory operations with vector search, caching, and optimization.
Subcommands
| Subcommand |
Aliases |
Description |
store |
|
Store data in memory with optional vector embedding |
retrieve |
get |
Retrieve data from memory by key |
search |
|
Semantic/vector search with HNSW indexing |
list |
ls |
List memory entries with filtering |
delete |
rm |
Delete memory entry |
stats |
|
Show memory statistics and performance |
configure |
config |
Configure memory backend and HNSW parameters |
cleanup |
|
Clean up stale and expired entries |
compress |
|
Compress and optimize memory storage |
export |
|
Export memory to file (JSON, CSV, binary) |
import |
|
Import memory from file |
Memory Backends
| Backend |
Description |
Performance |
agentdb |
Vector database with HNSW indexing |
150x-12,500x faster search |
sqlite |
Lightweight local storage |
Good for small datasets |
hybrid |
SQLite + AgentDB (recommended) |
Best of both worlds |
memory |
In-memory (non-persistent) |
Fastest, no persistence |
Search Options
| Option |
Short |
Description |
Default |
--query |
-q |
Search query |
required |
--namespace |
-n |
Memory namespace |
all |
--limit |
-l |
Maximum results |
10 |
--threshold |
|
Similarity threshold (0-1) |
0.7 |
--type |
-t |
Search type (semantic, keyword, hybrid) |
semantic |
Examples
mcp - MCP Server Management
Model Context Protocol server control and tool execution.
Subcommands
| Subcommand |
Description |
start |
Start MCP server with specified transport |
stop |
Stop MCP server (graceful or forced) |
status |
Show MCP server status and metrics |
health |
Check MCP server health |
restart |
Restart MCP server |
tools |
List available MCP tools by category |
toggle |
Enable or disable specific tools |
exec |
Execute an MCP tool directly |
logs |
Show MCP server logs |
Transport Types
| Transport |
Description |
Use Case |
stdio |
Standard I/O (default) |
Claude Code integration |
http |
HTTP REST API |
Web integrations, remote access |
websocket |
WebSocket connection |
Real-time bidirectional |
Tool Categories
| Category |
Description |
Tool Count |
agent |
Agent lifecycle management |
4 |
swarm |
Swarm coordination |
3 |
memory |
Memory operations |
3 |
config |
Configuration |
3 |
hooks |
Hook execution |
9 |
system |
System operations |
3 |
Examples
task - Task Management
Create, assign, and manage tasks across agents.
Subcommands
| Subcommand |
Description |
create |
Create a new task with priority and dependencies |
list |
List tasks with status filtering |
status |
Show detailed task status |
cancel |
Cancel a pending or running task |
assign |
Assign task to specific agent |
retry |
Retry a failed task |
Examples
session - Session Management
Manage session state, persistence, and restoration.
Subcommands
| Subcommand |
Description |
list |
List all sessions |
save |
Save current session state |
restore |
Restore a previous session |
delete |
Delete a session |
export |
Export session to file |
import |
Import session from file |
current |
Show current session info |
Examples
config - Configuration Management
Manage configuration, providers, and settings.
Subcommands
| Subcommand |
Description |
init |
Initialize configuration file |
get |
Get configuration value |
set |
Set configuration value |
providers |
Manage LLM provider configurations |
reset |
Reset configuration to defaults |
export |
Export configuration |
import |
Import configuration |
Examples
status - System Status
Monitor system status with real-time updates.
Subcommands
| Subcommand |
Description |
agents |
Show status of all agents |
tasks |
Show status of all tasks |
memory |
Show memory system status |
Options
| Option |
Short |
Description |
Default |
--watch |
-w |
Watch mode with auto-refresh |
false |
--interval |
-i |
Refresh interval in seconds |
5 |
Examples
workflow - Workflow Management
Execute and manage automated workflows.
Subcommands
| Subcommand |
Description |
run |
Execute a workflow |
validate |
Validate workflow definition |
list |
List available workflows |
status |
Show workflow execution status |
stop |
Stop running workflow |
template |
Manage workflow templates (list, show, create) |
Examples
hooks - Self-Learning Hooks
Advanced self-learning hooks with 17 subcommands for neural pattern recognition and background worker management.
Subcommands
| Subcommand |
Description |
pre-edit |
Execute before file edit (get context, agent suggestions) |
post-edit |
Execute after file edit (record outcome for learning) |
pre-command |
Execute before command (risk assessment) |
post-command |
Execute after command (record outcome) |
pre-task |
Execute before task (setup, validation) |
post-task |
Execute after task (cleanup, learning) |
session-end |
Execute on session end (save state) |
session-restore |
Execute on session restore (load state) |
route |
Route task to optimal agent using learned patterns |
explain |
Explain routing decision with transparency |
pretrain |
Bootstrap intelligence from repository |
build-agents |
Generate optimized agent configs from pretrain data |
metrics |
View learning metrics dashboard |
transfer |
Transfer patterns from another project |
list |
List all registered hooks |
intelligence |
RuVector intelligence (SONA, MoE, HNSW) |
worker |
Background worker management (12 workers) |
Learning Pipeline
The hooks system implements a 4-step learning pipeline:
- RETRIEVE - Top-k memory injection with MMR diversity
- JUDGE - LLM-as-judge trajectory evaluation
- DISTILL - Extract strategy memories from trajectories
- CONSOLIDATE - Dedup, detect contradictions, prune old patterns
Examples
Worker Subcommands
The hooks worker command manages 12 background workers for analysis and optimization tasks.
| Worker |
Priority |
Est. Time |
Description |
ultralearn |
normal |
60s |
Deep knowledge acquisition and learning |
optimize |
high |
30s |
Performance optimization and tuning |
consolidate |
low |
20s |
Memory consolidation and cleanup |
predict |
normal |
15s |
Predictive preloading and anticipation |
audit |
critical |
45s |
Security analysis and vulnerability scanning |
map |
normal |
30s |
Codebase mapping and architecture analysis |
preload |
low |
10s |
Resource preloading and cache warming |
deepdive |
normal |
60s |
Deep code analysis and examination |
document |
normal |
45s |
Auto-documentation generation |
refactor |
normal |
30s |
Code refactoring suggestions |
benchmark |
normal |
60s |
Performance benchmarking |
testgaps |
normal |
30s |
Test coverage analysis |
Worker Commands
Performance Targets
| Metric |
Target |
| Trigger detection |
<5ms |
| Worker spawn |
<50ms |
| Max concurrent |
10 |
UserPromptSubmit Integration
Workers are automatically triggered via the UserPromptSubmit hook when prompt patterns match worker triggers with confidence ≥0.6.
hive-mind - Consensus Coordination
Queen-led Byzantine fault-tolerant multi-agent coordination.
Subcommands
| Subcommand |
Description |
init |
Initialize hive-mind with topology and consensus strategy |
spawn |
Spawn agents in the hive (queen, worker, specialist) |
status |
Show hive-mind status with consensus health |
task |
Submit task to hive-mind for collaborative execution |
optimize-memory |
Optimize collective memory (distill, compress) |
shutdown |
Gracefully shutdown hive-mind |
Topologies
| Topology |
Description |
hierarchical |
Queen controls workers directly |
mesh |
Fully connected peer network |
hierarchical-mesh |
Hybrid: Queen + mesh workers |
adaptive |
Dynamic topology based on load |
Consensus Strategies
| Strategy |
Description |
Fault Tolerance |
byzantine |
Byzantine fault-tolerant (BFT) |
Tolerates f < n/3 faulty nodes |
raft |
Leader-based consensus |
Tolerates f < n/2 failures |
gossip |
Epidemic protocol for eventual consistency |
High partition tolerance |
crdt |
Conflict-free replicated data types |
Strong eventual consistency |
quorum |
Configurable quorum-based |
Flexible fault tolerance |
Examples
migrate - V2 to V3 Migration
Migration tools for transitioning from V2 to V3.
Subcommands
| Subcommand |
Description |
status |
Check migration status and pending items |
run |
Execute migration (with dry-run option) |
verify |
Verify migration integrity |
rollback |
Rollback to previous version |
breaking |
Show V3 breaking changes |
Migration Targets
| Target |
Description |
config |
Migrate configuration files |
memory |
Migrate memory/database content |
agents |
Migrate agent configurations |
hooks |
Migrate hook definitions |
workflows |
Migrate workflow definitions |
all |
Full migration |
Examples
doctor - System Diagnostics
System health checks with automatic fix suggestions.
Health Checks
| Check |
Description |
Auto-Fix |
| Node.js Version |
Verify Node.js 20+ |
nvm install 20 |
| npm Version |
Verify npm 9+ |
npm install -g npm@latest |
| Git |
Check git installation |
Install git |
| Git Repository |
Check if in git repo |
git init |
| Config File |
Validate configuration |
claude-flow config init |
| Daemon Status |
Check daemon running |
claude-flow daemon start |
| Memory Database |
Check memory DB |
claude-flow memory configure |
| API Keys |
Check for API keys |
export ANTHROPIC_API_KEY=... |
| MCP Servers |
Check MCP configuration |
claude mcp add claude-flow ... |
| Disk Space |
Check available space |
Free up disk |
| TypeScript |
Check TypeScript install |
npm install -D typescript |
Options
| Option |
Short |
Description |
Default |
--fix |
-f |
Show fix commands for issues |
false |
--component |
-c |
Check specific component |
all |
--verbose |
-v |
Verbose output |
false |
Examples
Output Example
completions - Shell Completions
Generate shell completion scripts for tab completion of commands.
Supported Shells
| Shell |
Installation |
File Location |
bash |
claude-flow completions bash >> ~/.bashrc |
~/.bash_completion.d/claude-flow |
zsh |
claude-flow completions zsh > ~/.zfunc/_claude-flow |
~/.zfunc/_claude-flow |
fish |
claude-flow completions fish > ~/.config/fish/completions/claude-flow.fish |
~/.config/fish/completions/ |
powershell |
claude-flow completions powershell >> $PROFILE |
PowerShell profile |
Examples
Completion Features
- All 26 top-level commands
- Full subcommand completion for each command
- Flag and option completion
- Dynamic suggestions based on context
Smart Error Suggestions
When you mistype a command, the CLI provides helpful suggestions using Levenshtein distance matching.
The suggestion system:
- Uses Levenshtein distance to find similar commands
- Recognizes 40+ common typos (e.g.,
memroy → memory, swram → swarm)
- Suggests up to 3 alternatives sorted by similarity
- Boosts prefix matches for better suggestions
Global Options
All commands support these global options:
| Option |
Short |
Description |
Default |
--help |
-h |
Show help information |
|
--version |
-V |
Show version number |
|
--verbose |
-v |
Enable verbose output |
false |
--quiet |
-q |
Suppress non-essential output |
false |
--config |
-c |
Path to configuration file |
./claude-flow.config.json |
--format |
-f |
Output format (text, json, table) |
text |
--no-color |
|
Disable colored output |
false |
--interactive |
-i |
Enable interactive mode |
true (if TTY) |
Programmatic API
CommandParser
Output Formatting
Interactive Prompts
TypeScript Types
Environment Variables
Performance Targets
The CLI is optimized for V3 performance targets:
| Metric |
Target |
Description |
| Startup |
<500ms |
CLI initialization time |
| Command parsing |
<5ms |
Argument parsing time |
| MCP tool execution |
<100ms |
Tool call overhead |
| Memory search |
150x-12,500x faster |
With HNSW indexing |
| SONA adaptation |
<0.05ms |
Neural learning overhead |
Related Packages
License
MIT