-
Notifications
You must be signed in to change notification settings - Fork 1.9k
API Reference
This comprehensive reference documents all Claude Flow commands, their parameters, return values, and usage examples.
Main entry point for all Claude Flow operations.
claude-flow [command] [options]Global Options:
-
--version, -v- Display version information -
--help, -h- Show help for command -
--config, -c <path>- Specify config file location -
--verbose- Enable verbose logging -
--json- Output in JSON format -
--no-color- Disable colored output
Initialize a new swarm with specified topology and configuration.
claude-flow swarm init [options]Parameters:
-
--topology, -t <type>- Required. Swarm topology:hierarchical,mesh,ring,star -
--max-agents, -m <number>- Maximum number of agents (default: 8) -
--strategy, -s <type>- Coordination strategy:auto,manual,adaptive(default: auto) -
--name, -n <name>- Swarm identifier name -
--memory-pool <size>- Shared memory pool size in MB
Returns:
{
"swarmId": "swarm-123456",
"topology": "hierarchical",
"maxAgents": 8,
"status": "initialized",
"createdAt": "2024-01-15T10:30:00Z"
}Example:
claude-flow swarm init \
--topology hierarchical \
--max-agents 12 \
--name "dev-team" \
--memory-pool 256Monitor swarm health and performance metrics.
claude-flow swarm status [swarmId] [options]Parameters:
-
swarmId- Optional swarm identifier (uses current if omitted) -
--detailed, -d- Show detailed agent information -
--metrics, -m- Include performance metrics -
--watch, -w- Continuous monitoring mode
Returns:
{
"swarmId": "swarm-123456",
"topology": "hierarchical",
"agents": {
"total": 8,
"active": 6,
"idle": 2
},
"health": "healthy",
"uptime": "2h 15m",
"tasksCompleted": 145,
"performance": {
"avgResponseTime": "1.2s",
"throughput": "12 tasks/min"
}
}Dynamically adjust swarm size.
claude-flow swarm scale <targetSize> [options]Parameters:
-
targetSize- Required. Target number of agents -
--swarm-id, -s <id>- Swarm to scale -
--strategy <type>- Scaling strategy:immediate,gradual,auto -
--min <number>- Minimum agents to maintain -
--max <number>- Maximum agents allowed
Example:
claude-flow swarm scale 15 \
--strategy gradual \
--min 5 \
--max 20Gracefully shutdown a swarm.
claude-flow swarm destroy <swarmId> [options]Parameters:
-
swarmId- Required. Swarm identifier to destroy -
--force, -f- Force immediate shutdown -
--save-state- Save swarm state before destruction -
--timeout <seconds>- Shutdown timeout (default: 30)
Create specialized AI agents for specific tasks.
claude-flow agent spawn <type> [options]Parameters:
-
type- Required. Agent type (see Agent Types) -
--task, -t <description>- Task description for agent -
--capabilities, -c <list>- Comma-separated capabilities -
--swarm-id, -s <id>- Target swarm for agent -
--priority <level>- Task priority:low,medium,high,critical -
--timeout <minutes>- Task timeout -
--memory-access <level>- Memory access:read,write,read-write
Returns:
{
"agentId": "agent-789012",
"type": "coder",
"status": "active",
"task": "Implement user authentication",
"swarmId": "swarm-123456",
"capabilities": ["typescript", "nodejs", "testing"]
}Example:
claude-flow agent spawn backend-dev \
--task "Create REST API for user management" \
--capabilities "nodejs,express,postgresql" \
--priority high \
--memory-access read-writeList active agents and their capabilities.
claude-flow agent list [options]Parameters:
-
--swarm-id, -s <id>- Filter by swarm -
--type, -t <type>- Filter by agent type -
--status <status>- Filter by status:active,idle,busy -
--detailed, -d- Show detailed information
Returns:
{
"agents": [
{
"id": "agent-001",
"type": "coder",
"status": "busy",
"currentTask": "Implementing auth service",
"uptime": "45m",
"tasksCompleted": 12
}
],
"total": 8,
"byType": {
"coder": 3,
"tester": 2,
"reviewer": 1,
"planner": 2
}
}Get performance metrics for specific agent.
claude-flow agent metrics <agentId> [options]Parameters:
-
agentId- Required. Agent identifier -
--period, -p <timeframe>- Time period:1h,24h,7d,30d -
--metrics, -m <list>- Specific metrics to include
Returns:
{
"agentId": "agent-789012",
"metrics": {
"tasksCompleted": 45,
"avgCompletionTime": "12.5 min",
"successRate": "95.5%",
"resourceUsage": {
"cpu": "25%",
"memory": "512MB"
}
}
}Orchestrate complex task workflows across agents.
claude-flow task orchestrate [options]Parameters:
-
--task, -t <description>- Required. Task description -
--strategy, -s <type>- Execution strategy:parallel,sequential,adaptive,balanced -
--dependencies, -d <list>- Task dependencies -
--priority, -p <level>- Priority level -
--checkpoint- Enable checkpointing -
--memory-sync- Synchronize memory across agents -
--max-concurrent <number>- Maximum concurrent operations
Example:
claude-flow task orchestrate \
--task "Refactor authentication system" \
--strategy parallel \
--checkpoint \
--memory-sync \
--max-concurrent 5Check task execution status.
claude-flow task status <taskId> [options]Parameters:
-
taskId- Required. Task identifier -
--detailed, -d- Show subtask details -
--watch, -w- Watch for updates
Returns:
{
"taskId": "task-345678",
"status": "in-progress",
"progress": 65,
"subtasks": {
"completed": 4,
"inProgress": 2,
"pending": 1
},
"estimatedCompletion": "15 min"
}Retrieve task completion results.
claude-flow task results <taskId> [options]Parameters:
-
taskId- Required. Task identifier -
--format, -f <type>- Output format:json,summary,detailed -
--artifacts- Include generated artifacts
Store, retrieve, and manage persistent memory.
claude-flow memory usage [options]Parameters:
-
--action, -a <action>- Required. Action:store,retrieve,list,delete,search -
--key, -k <key>- Memory key (required for store/retrieve/delete) -
--value, -v <value>- Value to store (required for store) -
--namespace, -n <namespace>- Memory namespace (default: "default") -
--ttl <seconds>- Time to live in seconds
Examples:
# Store memory
claude-flow memory usage \
--action store \
--key "project-config" \
--value '{"database": "postgresql", "cache": "redis"}' \
--namespace "architecture" \
--ttl 86400
# Retrieve memory
claude-flow memory usage \
--action retrieve \
--key "project-config" \
--namespace "architecture"
# List memories
claude-flow memory usage \
--action list \
--namespace "architecture"Search memory with patterns.
claude-flow memory search <pattern> [options]Parameters:
-
pattern- Required. Search pattern (supports wildcards) -
--namespace, -n <namespace>- Limit to namespace -
--limit, -l <number>- Maximum results (default: 10) -
--regex- Use regex pattern matching
Example:
claude-flow memory search "auth*" \
--namespace "decisions" \
--limit 20Create memory backups.
claude-flow memory backup [options]Parameters:
-
--path, -p <path>- Backup destination path -
--compress- Compress backup -
--encrypt- Encrypt backup -
--namespace <namespace>- Specific namespace to backup
Restore from memory backup.
claude-flow memory restore <backupPath> [options]Parameters:
-
backupPath- Required. Path to backup file -
--overwrite- Overwrite existing memories -
--namespace <namespace>- Restore to specific namespace
Train neural patterns with WASM SIMD acceleration.
claude-flow neural train [options]Parameters:
-
--pattern-type, -p <type>- Required. Pattern type:coordination,optimization,prediction -
--training-data, -d <data>- Required. Training data or file path -
--epochs, -e <number>- Training epochs (default: 50) -
--model-id, -m <id>- Model identifier -
--learning-rate <rate>- Learning rate (default: 0.001)
Example:
claude-flow neural train \
--pattern-type optimization \
--training-data "./data/performance-metrics.json" \
--epochs 100 \
--model-id "perf-optimizer-v2"Make predictions using trained models.
claude-flow neural predict [options]Parameters:
-
--model-id, -m <id>- Required. Model identifier -
--input, -i <data>- Required. Input data for prediction -
--confidence- Include confidence scores -
--explain- Include prediction explanation
Returns:
{
"prediction": "high-load",
"confidence": 0.92,
"explanation": {
"factors": [
{ "feature": "request_rate", "impact": 0.45 },
{ "feature": "time_of_day", "impact": 0.28 }
]
}
}Check neural network status.
claude-flow neural status [modelId] [options]Parameters:
-
modelId- Optional model identifier -
--detailed, -d- Show detailed metrics -
--performance- Include performance benchmarks
Comprehensive repository analysis.
claude-flow github repo analyze <repo> [options]Parameters:
-
repo- Required. Repository in formatowner/repo -
--analysis-type, -t <type>- Analysis type:code_quality,performance,security -
--branch, -b <branch>- Target branch (default: main) -
--depth <level>- Analysis depth:shallow,normal,deep
Example:
claude-flow github repo analyze myorg/myrepo \
--analysis-type security \
--depth deepPull request management operations.
claude-flow github pr manage [options]Parameters:
-
--repo, -r <repo>- Required. Repository -
--action, -a <action>- Required. Action:review,merge,close -
--pr-number, -p <number>- PR number -
--auto-merge- Enable auto-merge -
--squash- Squash commits on merge
Execute specific SPARC phase.
claude-flow sparc run <mode> <task> [options]Parameters:
-
mode- Required. SPARC mode:specification,pseudocode,architecture,refinement,completion -
task- Required. Task description -
--parallel- Enable parallel processing -
--memory-persist- Persist artifacts to memory -
--include <items>- Additional items to include
Example:
claude-flow sparc run architecture \
"Design microservices for e-commerce platform" \
--parallel \
--memory-persistRun complete TDD workflow using SPARC.
claude-flow sparc tdd <feature> [options]Parameters:
-
feature- Required. Feature description -
--test-first- Enforce test-first development -
--coverage <percent>- Minimum coverage requirement -
--style <style>- TDD style:london,chicago,hybrid
Example:
claude-flow sparc tdd \
"Shopping cart with discount calculation" \
--test-first \
--coverage 90 \
--style londonExecute full SPARC pipeline.
claude-flow sparc pipeline <task> [options]Parameters:
-
task- Required. Overall task description -
--checkpoints- Enable phase checkpoints -
--parallel-phases- Run independent phases in parallel -
--output <path>- Output directory for artifacts
Create custom workflow definitions.
claude-flow workflow create [options]Parameters:
-
--name, -n <name>- Required. Workflow name -
--steps, -s <steps>- Required. Workflow steps (JSON) -
--triggers, -t <triggers>- Event triggers -
--template <template>- Use predefined template
Example:
claude-flow workflow create \
--name "ci-cd-pipeline" \
--steps '[{"name":"test","agent":"tester"},{"name":"build","agent":"builder"}]' \
--triggers "push,pull_request"Execute workflow by ID or definition.
claude-flow workflow execute <workflowId> [options]Parameters:
-
workflowId- Required. Workflow identifier -
--params, -p <params>- Workflow parameters (JSON) -
--async- Execute asynchronously -
--dry-run- Simulate execution
Monitor running workflows.
claude-flow workflow monitor <workflowId> [options]Parameters:
-
workflowId- Required. Workflow to monitor -
--interval, -i <seconds>- Update interval -
--metrics- Include performance metrics
Generate comprehensive performance reports.
claude-flow performance report [options]Parameters:
-
--format, -f <format>- Output format:summary,detailed,json,html -
--timeframe, -t <period>- Analysis period:24h,7d,30d -
--components <list>- Specific components to analyze -
--export <path>- Export report to file
Example:
claude-flow performance report \
--format html \
--timeframe 7d \
--export "./reports/weekly-performance.html"Identify system bottlenecks.
claude-flow bottleneck analyze [options]Parameters:
-
--component, -c <component>- Component to analyze -
--metrics, -m <list>- Metrics to evaluate -
--threshold <percent>- Bottleneck threshold
Returns:
{
"bottlenecks": [
{
"component": "database",
"severity": "high",
"impact": "45% slowdown",
"recommendation": "Add connection pooling"
}
]
}Manage Claude Flow configuration.
claude-flow config <action> [key] [value] [options]Actions:
-
get <key>- Get configuration value -
set <key> <value>- Set configuration value -
list- List all configuration -
reset- Reset to defaults
Example:
claude-flow config set github.token "ghp_xxxxxxxxxxxx"
claude-flow config get github.token
claude-flow config listManage execution hooks.
claude-flow hooks <hook-type> [options]Hook Types:
-
pre-task- Before task execution -
post-task- After task completion -
pre-edit- Before file edits -
post-edit- After file edits
Parameters:
-
--description, -d <text>- Hook description -
--task-id <id>- Associated task ID -
--file <path>- Associated file path -
--memory-key <key>- Memory storage key
Example:
claude-flow hooks pre-task --description "Starting authentication refactor"
claude-flow hooks post-edit --file "./src/auth.js" --memory-key "refactor/auth"-
coder- General implementation -
reviewer- Code review -
tester- Test creation -
planner- Strategic planning -
researcher- Information gathering
-
backend-dev- Backend services -
mobile-dev- Mobile development -
ml-developer- Machine learning -
cicd-engineer- CI/CD pipelines -
api-docs- API documentation
-
system-architect- System design -
architect- Architecture planning -
base-template-generator- Boilerplate creation
-
tdd-london-swarm- London school TDD -
production-validator- Production validation
-
github-modes- GitHub operations -
pr-manager- PR management -
code-review-swarm- Review coordination -
issue-tracker- Issue management -
release-manager- Release coordination
-
hierarchical-coordinator- Hierarchical swarms -
mesh-coordinator- Mesh networks -
adaptive-coordinator- Dynamic topology -
collective-intelligence-coordinator- Hive mind
-
byzantine-coordinator- Byzantine fault tolerance -
raft-manager- Raft consensus -
gossip-coordinator- Gossip protocols -
consensus-builder- Consensus algorithms
-
E001- Invalid topology type -
E002- Agent spawn failure -
E003- Task orchestration error -
E004- Memory operation failed -
E005- Swarm initialization failed -
E006- Neural training error -
E007- GitHub API error -
E008- Workflow execution failed -
E009- Configuration error -
E010- Resource limit exceeded
{
"error": {
"code": "E003",
"message": "Task orchestration failed",
"details": "Maximum concurrent limit exceeded",
"timestamp": "2024-01-15T10:30:00Z",
"recovery": "Reduce concurrent operations or increase limit"
}
}- Agent spawning: 100/minute
- Task orchestration: 50/minute
- Memory operations: 1000/minute
- Neural operations: 10/minute
- GitHub operations: Subject to GitHub API limits
- Maximum agents per swarm: 50
- Maximum memory per namespace: 1GB
- Maximum task duration: 6 hours
- Maximum workflow complexity: 100 steps
- Review Development Patterns for best practices
- Check Troubleshooting for common issues
- Explore SPARC Methodology for structured development