Files
wehub-resource-sync 23f7624596
ADR-166 MCP Bridge Security Lock / Static-source security lock (push) Failing after 0s
ADR-166 MCP Bridge Security Lock / Compose default binds loopback + Mongo has auth (push) Failing after 2s
CodeQL Advanced / Analyze (rust) (push) Failing after 0s
ADR-166 MCP Bridge Security Lock / plugin-agent-federation bindHost default (push) Failing after 1s
ADR-166 MCP Bridge Security Lock / Runtime behavior — 401 + terminal gate + fail-closed (push) Failing after 4s
business-pods-smoke / smoke (push) Failing after 1s
all-plugins-smoke / smoke-all (push) Failing after 2s
CI/CD Pipeline / Security & Code Quality (push) Failing after 1s
CI/CD Pipeline / Test Suite (ubuntu-latest) (push) Failing after 1s
CI/CD Pipeline / Build & Package (macos-latest) (push) Has been skipped
CI/CD Pipeline / Build & Package (ubuntu-latest) (push) Has been skipped
CI/CD Pipeline / Build & Package (windows-latest) (push) Has been skipped
CI/CD Pipeline / Documentation & Examples (push) Failing after 1s
Clone Tracker (14-day rolling) / Snapshot clones for ruflo ecosystem (push) Failing after 1s
CodeQL Advanced / Analyze (actions) (push) Failing after 1s
CodeQL Advanced / Analyze (javascript-typescript) (push) Failing after 1s
federation-peer-rust / stable-noop (push) Failing after 1s
metaharness-ci / score (push) Failing after 1s
metaharness-ci / router-compat (push) Failing after 0s
metaharness-ci / similarity-tests (push) Failing after 0s
no-agentbbs-smoke / smoke-without-agentbbs (push) Failing after 1s
V3 CI/CD Pipeline / Build V3 (windows-latest) (push) Has been skipped
codex-integration-audit / Codex integration audit (push) Failing after 1s
helpers-manifest-guard / guard (push) Failing after 1s
🔗 Cross-Agent Integration Tests / 🤝 Agent Coordination Tests (push) Has been skipped
🔗 Cross-Agent Integration Tests / 🧠 Memory Sharing Integration (push) Has been skipped
🔗 Cross-Agent Integration Tests / 🛡️ Fault Tolerance Tests (push) Has been skipped
🔗 Cross-Agent Integration Tests / ⚡ Performance Integration Tests (push) Has been skipped
metaharness-ci / mcp-scan (push) Failing after 1s
metaharness-ci / eject-dryrun (push) Failing after 1s
metaharness-ci / metaharness-real-data (push) Failing after 0s
no-cli-optdep-bloat-2561 / guard (push) Failing after 1s
no-metaharness-smoke / smoke-without-metaharness (push) Failing after 1s
no-phantom-agentic-flow-subpath / guard (push) Failing after 1s
🔄 Automated Rollback Manager / 🚨 Failure Detection (push) Failing after 1s
V3 CI/CD Pipeline / Plugin hooks smoke / ubuntu-latest / Node 22 (push) Failing after 1s
V3 CI/CD Pipeline / ruflo-graph-intelligence build + test smoke (#2044, ADR-123) (push) Failing after 1s
CVE Audit Gate / Audit root (critical-blocking) (push) Failing after 2s
cost-tracker-smoke / smoke (push) Failing after 3s
oia-audit-weekly / audit (push) Failing after 2s
ruflo-agent-smoke / ruflo-agent structural smoke (push) Failing after 1s
📊 Status Badges Update / 📊 Update Status Badges (push) Failing after 1s
V3 CI/CD Pipeline / Static regression guards (#2267 YAML + (push) Failing after 1s
V3 CI/CD Pipeline / Test V3 Packages (push) Failing after 0s
V3 CI/CD Pipeline / agent_execute provider routing smoke (#2042) (push) Failing after 0s
CVE Audit Gate / Audit v3 (critical-blocking) (push) Failing after 1s
federation-peer-rust / stable-native (push) Failing after 2s
🔗 Cross-Agent Integration Tests / 🚀 Integration Test Setup (push) Failing after 2s
neural-trader-smoke / runtime-smoke (push) Failing after 1s
V3 CI/CD Pipeline / Build V3 (macos-latest) (push) Has been skipped
V3 CI/CD Pipeline / Build V3 (ubuntu-latest) (push) Has been skipped
V3 CI/CD Pipeline / Type Check V3 (push) Failing after 1s
V3 CI/CD Pipeline / Smoke (no better-sqlite3) / ubuntu-latest / Node 24 (push) Failing after 1s
V3 CI/CD Pipeline / Smoke (no better-sqlite3) / ubuntu-latest / Node 22 (push) Failing after 2s
V3 CI/CD Pipeline / browser rvf create flag smoke (#2015) (push) Failing after 0s
V3 CI/CD Pipeline / Dependency review (#2046) (push) Has been skipped
V3 CI/CD Pipeline / Supply-chain audit (#2046) (push) Failing after 0s
V3 CI/CD Pipeline / witness marker drift smoke (#2021) (push) Failing after 1s
V3 CI/CD Pipeline / neural-trader portfolio CG smoke (#2068, ADR-126 Phase 3) (push) Failing after 1s
V3 CI/CD Pipeline / neural-trader backtest signing smoke (#2068, ADR-126 Phase 4) (push) Failing after 1s
V3 CI/CD Pipeline / kg-extract type-import classification smoke (#2049) (push) Failing after 0s
V3 CI/CD Pipeline / witness verify precondition smoke (#1880) (push) Failing after 2s
V3 CI/CD Pipeline / neural-trader pipeline risk-gate smoke (#2068, ADR-126 Phase 5) (push) Failing after 0s
V3 CI/CD Pipeline / neural-trader feature attribution smoke (#2068, ADR-126 Phase 6) (push) Failing after 0s
V3 CI/CD Pipeline / plugin-registry signature verification smoke (#1922, CWE-347) (push) Failing after 4s
V3 CI/CD Pipeline / memory stats legacy-DB smoke (#2120) (push) Failing after 4s
V3 CI/CD Pipeline / github deprecated actions smoke (#2089, ADR-127 Phase 3) (push) Failing after 1s
V3 CI/CD Pipeline / graph query + pathfinder smoke (ADR-130 P2+P5) (push) Has been skipped
V3 CI/CD Pipeline / graph trajectory hooks smoke (ADR-130 P3) (push) Has been skipped
V3 CI/CD Pipeline / graph plugin adapter smoke (ADR-130 P4) (push) Has been skipped
V3 CI/CD Pipeline / graph benchmark (ADR-130 P6) (push) Has been skipped
V3 CI/CD Pipeline / statusline generator delegation smoke (#2195) (push) Failing after 1s
V3 CI/CD Pipeline / wizard init regression guard (#2206 (push) Failing after 1s
V3 CI/CD Pipeline / memory no-stray-db smoke (ADR-125 P7) (push) Failing after 1s
V3 CI/CD Pipeline / github-safe injection smoke (#2089, ADR-127 Phase 1) (push) Failing after 1s
V3 CI/CD Pipeline / github actions pin smoke (#2089, ADR-127 Phase 1) (push) Failing after 1s
V3 CI/CD Pipeline / github attribution opt-in smoke (#2089, ADR-127 Phase 4) (push) Failing after 1s
V3 CI/CD Pipeline / pre-bash hook safety smoke (#2017) (push) Failing after 1s
V3 CI/CD Pipeline / Memory import smoke / ubuntu-latest (push) Failing after 0s
V3 CI/CD Pipeline / MCP protocol smoke / ubuntu-latest (push) Failing after 2s
V3 CI/CD Pipeline / ruvllm WASM auto-init smoke (#2086) (push) Failing after 4s
V3 CI/CD Pipeline / MCP paired-tool round-trip smoke (#1889) (push) Failing after 1s
V3 CI/CD Pipeline / Plugin package install-safety (#1902/#1903/#1904) (push) Failing after 1s
V3 CI/CD Pipeline / Tool description discoverability (ADR-112) (push) Failing after 3s
V3 CI/CD Pipeline / CLI npx-install smoke (#1147 / (22) (push) Failing after 1s
V3 CI/CD Pipeline / CLI npx-install smoke (#1147 / (24) (push) Failing after 1s
V3 CI/CD Pipeline / Windows hook shim smoke (#2132) / ubuntu-latest (push) Failing after 2s
V3 CI/CD Pipeline / Windows hook execution smoke (#2132) / ubuntu-latest (push) Failing after 1s
V3 CI/CD Pipeline / Windows init hooks smoke (#2132) / ubuntu-latest (push) Failing after 1s
V3 CI/CD Pipeline / Vector-index dimension audit (#1947) (push) Failing after 0s
V3 CI/CD Pipeline / Hook-command install safety (#1921) (push) Failing after 1s
V3 CI/CD Pipeline / ToolOutputGuardrail smoke (ADR-131, (push) Failing after 1s
V3 CI/CD Pipeline / init-bundle invariants smoke (#2095, ADR-128 Phase 5) (push) Failing after 1s
V3 CI/CD Pipeline / wasm provider bridge smoke (ADR-129 P1) (push) Failing after 2s
V3 CI/CD Pipeline / wasm gallery CRUD smoke (ADR-129 P3) (push) Failing after 1s
V3 CI/CD Pipeline / wasm plugin bridge smoke (ADR-129 P4) (push) Failing after 0s
V3 CI/CD Pipeline / wasm compose smoke (ADR-129 P2) (push) Failing after 4s
V3 CI/CD Pipeline / graph schema smoke (ADR-130 P1) (push) Failing after 0s
Validate Marketplace / validate (push) Failing after 1s
🔍 Verification Pipeline / 🚀 Setup Verification (push) Failing after 1s
🔍 Verification Pipeline / 🛡️ Security Verification (push) Has been skipped
🔍 Verification Pipeline / 📝 Code Quality (push) Has been skipped
🔍 Verification Pipeline / 🧪 Test Verification (${{ matrix.os }}, Node ${{ matrix.node }}) (push) Has been skipped
🔍 Verification Pipeline / 🏗️ Build Verification (push) Has been skipped
🔍 Verification Pipeline / 📚 Documentation Verification (push) Has been skipped
CVE Audit Gate / High-severity report (warn only) (push) Has been cancelled
🔄 Automated Rollback Manager / 🔄 Execute Rollback (push) Has been cancelled
🔄 Automated Rollback Manager / ✅ Post-Rollback Verification (push) Has been cancelled
🔄 Automated Rollback Manager / 📊 Rollback Monitoring (push) Has been cancelled
V3 CI/CD Pipeline / Windows init hooks smoke (#2132) / windows-latest (push) Has been cancelled
V3 CI/CD Pipeline / Windows hook execution smoke (#2132) / macos-latest (push) Has been cancelled
V3 CI/CD Pipeline / Windows hook execution smoke (#2132) / windows-latest (push) Has been cancelled
🔄 Automated Rollback Manager / ⏳ Manual Rollback Approval (push) Has been cancelled
V3 CI/CD Pipeline / MCP protocol smoke / macos-latest (push) Has been cancelled
V3 CI/CD Pipeline / Memory import smoke / macos-latest (push) Has been cancelled
V3 CI/CD Pipeline / Windows hook shim smoke (#2132) / macos-latest (push) Has been cancelled
V3 CI/CD Pipeline / Windows hook shim smoke (#2132) / windows-latest (push) Has been cancelled
V3 CI/CD Pipeline / Windows init hooks smoke (#2132) / macos-latest (push) Has been cancelled
V3 CI/CD Pipeline / Witness verify (signed manifest) / macos-latest (push) Has been cancelled
V3 CI/CD Pipeline / Witness verify (signed manifest) / ubuntu-latest (push) Has been cancelled
V3 CI/CD Pipeline / Witness verify (signed manifest) / windows-latest (push) Has been cancelled
V3 CI/CD Pipeline / Publish to npm (alpha) (push) Has been cancelled
V3 CI/CD Pipeline / Smoke (no better-sqlite3) / macos-latest / Node 22 (push) Has been cancelled
V3 CI/CD Pipeline / Plugin hooks smoke / macos-latest / Node 22 (push) Has been cancelled
CI/CD Pipeline / Deploy & Release (push) Has been cancelled
CI/CD Pipeline / CI Status (push) Has been cancelled
🔗 Cross-Agent Integration Tests / 📊 Integration Test Report (push) Has been cancelled
🔄 Automated Rollback Manager / 🔍 Pre-Rollback Validation (push) Has been cancelled
🔍 Verification Pipeline / ⚡ Performance Verification (push) Has been cancelled
🔍 Verification Pipeline / 📊 Verification Report (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:02:19 +08:00

30 KiB

Claude-Flow V3 Complete CLI Reference

Overview

Complete command reference for the claude-flow V3 CLI including hooks, workflow execution, hive-mind coordination, process management, and all subcommands with SONA/MoE/HNSW integration.

Table of Contents


Hooks (Self-Learning)

The V3 hooks CLI provides command-line access to the hooks system for shell scripts, automation, and direct user interaction.

Installation

# Hooks are available through the main claude-flow CLI
npm install -g @claude-flow/cli

# Or via npx
npx claude-flow hooks --help

Commands

File Edit Hooks

pre-edit

Get context and suggestions before editing a file.

npx claude-flow hooks pre-edit <filePath> [options]

Options:
  --operation, -o    Edit operation type (create|modify|delete) [default: modify]
  --no-context       Skip context retrieval
  --no-suggestions   Skip agent suggestions
  --format           Output format (json|text) [default: text]

Examples:
  npx claude-flow hooks pre-edit src/auth.ts
  npx claude-flow hooks pre-edit src/new-file.ts --operation create
  npx claude-flow hooks pre-edit src/legacy.ts --no-suggestions --format json

post-edit

Record edit outcome for learning.

npx claude-flow hooks post-edit <filePath> [options]

Options:
  --success, -s      Whether edit was successful [required]
  --operation, -o    Edit operation type [default: modify]
  --outcome          Description of outcome
  --file, -f         Alias for filePath (V2 compatibility)
  --memory-key       Memory storage key (V2 compatibility)

Examples:
  npx claude-flow hooks post-edit src/auth.ts --success true
  npx claude-flow hooks post-edit src/auth.ts --success false --outcome "Type error on line 42"

  # V2 compatibility
  npx claude-flow hooks post-edit --file src/auth.ts --success true --memory-key "swarm/coder/edit1"

Command Hooks

pre-command

Assess risk before executing a command.

npx claude-flow hooks pre-command "<command>" [options]

Options:
  --working-dir, -d  Working directory for command
  --no-risk          Skip risk assessment
  --no-suggestions   Skip safety suggestions
  --format           Output format (json|text) [default: text]

Examples:
  npx claude-flow hooks pre-command "npm test"
  npx claude-flow hooks pre-command "rm -rf ./dist" --working-dir /project
  npx claude-flow hooks pre-command "docker compose up" --format json

post-command

Record command execution outcome.

npx claude-flow hooks post-command "<command>" [options]

Options:
  --success, -s      Whether command was successful [required]
  --exit-code, -e    Command exit code [default: 0]
  --output           Command output (truncated)
  --error            Error message if failed
  --time             Execution time in milliseconds

Examples:
  npx claude-flow hooks post-command "npm test" --success true --time 5230
  npx claude-flow hooks post-command "npm build" --success false --exit-code 1 --error "Module not found"

Task Lifecycle Hooks

pre-task

Record task start for coordination.

npx claude-flow hooks pre-task [options]

Options:
  --description, -d  Task description [required]
  --task-id          Task identifier
  --agent            Assigned agent type

Examples:
  npx claude-flow hooks pre-task --description "Implement OAuth2 flow"
  npx claude-flow hooks pre-task -d "Fix login bug" --agent debugger --task-id task-123

post-task

Record task completion.

npx claude-flow hooks post-task [options]

Options:
  --task-id          Task identifier [required]
  --success, -s      Whether task completed successfully
  --result           Task result summary
  --metrics          Include task metrics

Examples:
  npx claude-flow hooks post-task --task-id task-123 --success true
  npx claude-flow hooks post-task --task-id task-123 --success false --result "Blocked by dependency"

Session Hooks

session-restore

Restore previous session context.

npx claude-flow hooks session-restore [options]

Options:
  --session-id       Session identifier to restore [required]
  --include-memory   Restore memory state [default: true]
  --include-agents   Restore agent states [default: true]

Examples:
  npx claude-flow hooks session-restore --session-id swarm-abc123
  npx claude-flow hooks session-restore --session-id previous --include-memory false

session-end

End session and persist state.

npx claude-flow hooks session-end [options]

Options:
  --export-metrics   Export session metrics [default: true]
  --persist-memory   Persist memory to storage [default: true]
  --summary          Generate session summary

Examples:
  npx claude-flow hooks session-end
  npx claude-flow hooks session-end --export-metrics true --summary

Task Routing

route

Route a task to the optimal agent.

npx claude-flow hooks route "<task>" [options]

Options:
  --context, -c      Additional context
  --prefer           Preferred agents (comma-separated)
  --no-explanation   Skip explanation
  --format           Output format (json|text) [default: text]

Examples:
  npx claude-flow hooks route "Implement user authentication"
  npx claude-flow hooks route "Fix CSS bug" --prefer "coder,reviewer"
  npx claude-flow hooks route "Research API options" --context "REST vs GraphQL" --format json

explain

Explain routing decision with transparency.

npx claude-flow hooks explain "<task>" [options]

Options:
  --context, -c      Additional context
  --verbose, -v      Include detailed reasoning
  --format           Output format (json|text) [default: text]

Examples:
  npx claude-flow hooks explain "Implement OAuth2 authentication"
  npx claude-flow hooks explain "Security audit" --verbose

Intelligence & Learning

pretrain

Bootstrap intelligence from repository analysis.

npx claude-flow hooks pretrain [options]

Options:
  --path, -p         Repository path [default: current directory]
  --include-git      Include git history analysis [default: true]
  --include-deps     Include dependency analysis [default: true]
  --max-patterns     Maximum patterns to extract [default: 1000]
  --force            Force retraining even if data exists

Examples:
  npx claude-flow hooks pretrain
  npx claude-flow hooks pretrain --path /project --max-patterns 5000
  npx claude-flow hooks pretrain --force --no-include-git

build-agents

Generate optimized agent configurations from pretrain data.

npx claude-flow hooks build-agents [options]

Options:
  --focus            Focus area (all|security|performance|testing) [default: all]
  --output, -o       Output configuration file
  --v3-mode          Use V3 agent definitions

Examples:
  npx claude-flow hooks build-agents --focus security
  npx claude-flow hooks build-agents --output agents.json
  npx claude-flow hooks build-agents --v3-mode --focus performance

transfer

Transfer learned patterns from another project.

npx claude-flow hooks transfer <sourceProject> [options]

Options:
  --filter           Pattern filter (glob pattern)
  --merge            Merge with existing patterns [default: true]
  --dry-run          Show what would be transferred

Examples:
  npx claude-flow hooks transfer /other-project
  npx claude-flow hooks transfer ../shared-project --filter "security/*"
  npx claude-flow hooks transfer /template --dry-run

Metrics & Management

metrics

View learning metrics dashboard.

npx claude-flow hooks metrics [options]

Options:
  --category, -c     Category (all|routing|edits|commands|patterns) [default: all]
  --time-range, -t   Time range (hour|day|week|month|all) [default: all]
  --detailed         Include detailed statistics
  --format           Output format (json|text|table) [default: table]
  --v3-dashboard     Use V3 metrics dashboard

Examples:
  npx claude-flow hooks metrics
  npx claude-flow hooks metrics --category routing --time-range week
  npx claude-flow hooks metrics --detailed --format json
  npx claude-flow hooks metrics --v3-dashboard

list

List registered hooks.

npx claude-flow hooks list [options]

Options:
  --category, -c     Filter by category
  --include-disabled Show disabled hooks
  --no-metadata      Hide hook metadata
  --format           Output format (json|text|table) [default: table]

Examples:
  npx claude-flow hooks list
  npx claude-flow hooks list --category routing
  npx claude-flow hooks list --include-disabled --format json

Notifications

notify

Send notification message (V2 compatibility).

npx claude-flow hooks notify [options]

Options:
  --message, -m      Notification message [required]
  --level            Severity level (info|warn|error) [default: info]
  --channel          Notification channel

Examples:
  npx claude-flow hooks notify --message "Task completed successfully"
  npx claude-flow hooks notify -m "Build failed" --level error

Environment Variables

# Hook execution timeout (milliseconds)
CLAUDE_FLOW_HOOK_TIMEOUT=5000

# Enable/disable ReasoningBank integration
CLAUDE_FLOW_REASONINGBANK_ENABLED=true

# Learning namespace
CLAUDE_FLOW_HOOKS_NAMESPACE=hooks-learning

# Logging level
CLAUDE_FLOW_HOOKS_LOG_LEVEL=info

V2 Compatibility

All V2 hook commands are supported for backward compatibility:

# V2 syntax (still works)
npx claude-flow hooks pre-task --description "[task]"
npx claude-flow hooks session-restore --session-id "swarm-[id]"
npx claude-flow hooks post-edit --file "[file]" --memory-key "swarm/[agent]/[step]"
npx claude-flow hooks notify --message "[what was done]"
npx claude-flow hooks post-task --task-id "[task]"
npx claude-flow hooks session-end --export-metrics true

Exit Codes

Code Meaning
0 Success
1 General error
2 Invalid arguments
3 Hook execution failed
4 Timeout exceeded
5 Risk assessment blocked

Output Examples

Text Format (Default)

$ npx claude-flow hooks route "Implement authentication"

Task Routing Result
==================
Task: Implement authentication
Recommended Agent: security-auditor
Confidence: 92%

Explanation:
Based on task analysis and 15 similar historical tasks,
'security-auditor' is recommended with 92% confidence.

Alternative Agents:
  - coder (78%)
  - backend-dev (75%)

JSON Format

$ npx claude-flow hooks route "Implement authentication" --format json
{
  "task": "Implement authentication",
  "recommendedAgent": "security-auditor",
  "confidence": 0.92,
  "alternativeAgents": [
    { "agent": "coder", "confidence": 0.78 },
    { "agent": "backend-dev", "confidence": 0.75 }
  ],
  "explanation": "Based on task analysis..."
}

Table Format

$ npx claude-flow hooks metrics --format table

Hooks Learning Metrics
======================
Category    Total    Success Rate    Patterns
─────────────────────────────────────────────
routing      423        84%           156
edits        756        93%            89
commands     368        82%            34
─────────────────────────────────────────────
Total       1547        89%           279

Intelligence Command

The hooks intelligence command provides RuVector intelligence with SONA, MoE, and HNSW integration.

npx claude-flow hooks intelligence [options]

Options:

Option Type Default Description
--mode string balanced Operation mode
--enable-sona boolean true Enable SONA sub-0.05ms learning
--enable-moe boolean true Enable Mixture of Experts routing
--enable-hnsw boolean true Enable HNSW 150x faster search
--embedding-provider string transformers Embedding provider
--train boolean false Train from current context
--reset boolean false Reset to defaults
--status boolean false Show detailed status

Modes:

  • real-time - Prioritize speed (<0.05ms learning)
  • batch - Optimized for bulk processing
  • edge - Minimal memory footprint
  • research - Maximum accuracy
  • balanced - Balance speed/accuracy (default)

Intelligence Components:

SONA (Sub-0.05ms Learning)

  • Learning Time: <0.05ms per pattern
  • Adaptation Time: <0.1ms
  • Memory Efficiency: 50-75% reduction via quantization
  • Pattern Persistence: Cross-session learning

MoE (Mixture of Experts)

  • 8 Expert Models: Specialized for different task types
  • Dynamic Routing: 92%+ routing accuracy
  • Load Balancing: Automatic expert distribution
  • Gating Network: Context-aware expert selection
  • Search Speedup: 150x-12,500x improvement
  • Index Efficiency: Logarithmic complexity
  • Memory Optimized: Quantized vectors (4/8/16-bit)
  • Batch Support: Efficient bulk operations

Embedding Providers:

Provider Model Dimension Speed
Transformers.js all-MiniLM-L6-v2 384 Fast
OpenAI text-embedding-3-small 1536 Medium
Mock - 384 Instant

Example Output:

🧠 RuVector Intelligence System

Mode: balanced
Components:
  SONA:  ✅ enabled (learning: 0.03ms, adaptation: 0.08ms)
  MoE:   ✅ enabled (8 experts, 94% routing accuracy)
  HNSW:  ✅ enabled (index: 1.2M vectors, 287x speedup)

Embedding Provider: transformers
  Model: Xenova/all-MiniLM-L6-v2
  Dimension: 384
  Cache Hit Rate: 87%

Workflow Execution

Workflow templates and execution management.

workflow run

Execute a workflow by name or file.

npx claude-flow workflow run <name|file> [options]

Options:

Option Type Default Description
--input string - Input data (JSON string or file path)
--parallel number 4 Maximum parallel steps
--dry-run boolean false Show execution plan without running
--timeout number 3600000 Workflow timeout in ms
--on-error string stop Error handling (stop, continue, retry)

Example:

npx claude-flow workflow run development --input '{"feature": "auth"}' --parallel 6

workflow validate

Validate a workflow definition.

npx claude-flow workflow validate <file> [options]

Options:

Option Type Default Description
--strict boolean false Enable strict validation
--fix boolean false Auto-fix common issues

workflow list

List available workflows.

npx claude-flow workflow list [options]

Options:

Option Type Default Description
--format string table Output format (table, json, yaml)
--category string - Filter by category

workflow status

Show status of running workflows.

npx claude-flow workflow status [options]

Options:

Option Type Default Description
--id string - Workflow ID
--watch boolean false Watch mode with live updates

workflow stop

Stop a running workflow.

npx claude-flow workflow stop [options]

Options:

Option Type Default Description
--id string - Workflow ID to stop
--all boolean false Stop all running workflows
--force boolean false Force immediate termination

workflow template

Manage workflow templates.

# List templates
npx claude-flow workflow template list

# Show template details
npx claude-flow workflow template show <name>

# Create new template
npx claude-flow workflow template create --name <name> --output <file>

Built-in Templates:

Template Description Steps
development Full development cycle 4
research Research and analysis 3
testing Comprehensive testing 3
security-audit Security scanning 4
code-review Code review workflow 3
refactoring Refactoring workflow 4
sparc SPARC methodology 5

Hive Mind Consensus

Queen-led consensus-based multi-agent coordination.

hive-mind init

Initialize a new hive-mind swarm.

npx claude-flow hive-mind init [options]

Options:

Option Type Default Description
--topology string hierarchical Swarm topology
--consensus string byzantine Consensus strategy
--queen-model string opus Queen agent model
--workers number 5 Initial worker count
--memory-backend string agentdb Memory backend

Topologies:

  • hierarchical - Queen controls all workers
  • mesh - Peer-to-peer coordination
  • hierarchical-mesh - Queen + peer groups
  • adaptive - Dynamic topology

Consensus Strategies:

  • byzantine - BFT (3f+1 fault tolerance)
  • raft - Leader election
  • gossip - Epidemic protocol
  • crdt - Conflict-free replicated data
  • quorum - Majority voting

Example:

npx claude-flow hive-mind init --topology hierarchical-mesh --consensus byzantine --workers 15

hive-mind spawn

Spawn new worker agents.

npx claude-flow hive-mind spawn [options]

Options:

Option Type Default Description
--type string worker Agent type (queen, worker, specialist, drone)
--role string - Specialized role
--count number 1 Number to spawn
--model string sonnet Model for agent

Roles: coder, researcher, reviewer, tester, architect, security

hive-mind status

Show hive status and metrics.

npx claude-flow hive-mind status [options]

Options:

Option Type Default Description
--detailed boolean false Show detailed metrics
--watch boolean false Watch mode

hive-mind task

Submit tasks to the hive.

npx claude-flow hive-mind task [options]

Options:

Option Type Default Description
--description string - Task description (required)
--priority string normal Priority (low, normal, high, critical)
--type string general Task type
--deadline string - Deadline
--consensus-required boolean false Require consensus

hive-mind optimize-memory

Optimize hive collective memory.

npx claude-flow hive-mind optimize-memory [options]

Options:

Option Type Default Description
--strategy string balanced Optimization strategy
--target string all Target (queen, workers, shared, all)

hive-mind shutdown

Gracefully shutdown the hive.

npx claude-flow hive-mind shutdown [options]

Options:

Option Type Default Description
--force boolean false Force immediate shutdown
--save-state boolean true Save hive state
--timeout number 30000 Shutdown timeout in ms

Agent Management

agent spawn

Spawn a new agent.

npx claude-flow agent spawn [options]

Options:

Option Type Default Description
--type string coder Agent type
--name string - Agent name
--model string sonnet Model (opus, sonnet, haiku)
--task string - Initial task
--tools string - Allowed tools (comma-separated)
--timeout number 300000 Task timeout in ms

agent list

List active agents.

npx claude-flow agent list [options]

agent pool

Manage agent pool.

npx claude-flow agent pool [options]

Options:

Option Type Default Description
--size number - Set pool size
--min number 1 Minimum agents
--max number 10 Maximum agents
--auto-scale boolean true Enable auto-scaling

Example Output:

🏊 Agent Pool Management

Current Pool Configuration:
  Size:       5 / 10
  Min:        1
  Max:        10
  Auto-scale: enabled

Pool Statistics:
  Active:     3
  Idle:       2
  Busy Rate:  60%

Agent Distribution:
  coder:      2 (40%)
  researcher: 1 (20%)
  reviewer:   1 (20%)
  tester:     1 (20%)

agent health

Monitor agent health.

npx claude-flow agent health [options]

Options:

Option Type Default Description
--id string - Specific agent ID
--detailed boolean false Show detailed metrics
--watch boolean false Watch mode

agent logs

View agent activity logs.

npx claude-flow agent logs [options]

Options:

Option Type Default Description
--id string - Agent ID (required)
--tail number 50 Number of lines
--level string info Log level filter
--follow boolean false Follow logs
--since string - Show logs since time

Memory Management

memory store

Store data in memory.

npx claude-flow memory store --key <key> --value <value> [options]

memory retrieve

Retrieve data from memory.

npx claude-flow memory retrieve --key <key> [options]

Semantic vector search.

npx claude-flow memory search --query "<query>" [options]

Options:

Option Type Default Description
--limit number 10 Maximum results
--threshold number 0.7 Similarity threshold
--namespace string - Namespace filter

memory stats

Show memory statistics.

npx claude-flow memory stats [options]

memory cleanup

Clean up stale/expired entries.

npx claude-flow memory cleanup [options]

Options:

Option Type Default Description
--dry-run boolean false Preview without deleting
--older-than string 30d Age threshold
--expired-only boolean false Only remove expired entries
--low-quality number - Remove below quality score

memory compress

Compress and optimize storage.

npx claude-flow memory compress [options]

Options:

Option Type Default Description
--level string balanced Compression level (fast, balanced, max)
--quantize boolean false Enable vector quantization
--bits number 8 Quantization bits (4, 8, 16)

Example Output:

🗜️ Memory Compression

Compression Settings:
  Level:     balanced
  Quantize:  enabled (8-bit)

Before:
  Total entries: 12,456
  Storage size:  156 MB
  Vector memory: 128 MB

After:
  Storage size:  89 MB (43% reduction)
  Vector memory: 32 MB (75% reduction)

Compression complete in 2.3s

memory export / memory import

Backup and restore memory.

# Export memory
npx claude-flow memory export --output <file> [options]

# Import memory
npx claude-flow memory import --input <file> [options]

Process Management

process daemon

Manage background daemon.

npx claude-flow process daemon --action <action> [options]

Actions: start, stop, restart, status

Options:

Option Type Default Description
--port number 3847 Daemon HTTP API port
--pid-file string .claude-flow/daemon.pid PID file location
--log-file string .claude-flow/daemon.log Log file location
--detach boolean true Run detached

process monitor

Real-time process monitoring.

npx claude-flow process monitor [options]

Options:

Option Type Default Description
--interval number 2 Refresh interval (seconds)
--format string dashboard Format (dashboard, compact, json)
--components string all Components to monitor
--watch boolean false Continuous monitoring
--alerts boolean true Enable threshold alerts

Dashboard Example:

╔══════════════════════════════════════════════════════════════╗
║            🖥️  CLAUDE-FLOW PROCESS MONITOR                    ║
╠══════════════════════════════════════════════════════════════╣
║  SYSTEM                                                      ║
║  CPU:    [████████░░░░░░░░░░░░] 38.5%                        ║
║  Memory: [██████████████░░░░░░] 512MB/2048MB                 ║
╠══════════════════════════════════════════════════════════════╣
║  AGENTS                                                      ║
║  Active: 3   Idle: 2   Pool: 10                              ║
╠══════════════════════════════════════════════════════════════╣
║  TASKS                                                       ║
║  Running: 2   Queued: 5   Completed: 147   Failed: 3         ║
╠══════════════════════════════════════════════════════════════╣
║  MEMORY SERVICE                                              ║
║  Vectors: 12456   Index: 24MB                                ║
║  Cache Hit: 87.3%  Avg Search: 2.34ms                        ║
╚══════════════════════════════════════════════════════════════╝

process workers

Manage background workers.

npx claude-flow process workers --action <action> [options]

Actions: list, spawn, kill, scale

Options:

Option Type Default Description
--type string - Worker type (task, memory, coordinator, neural)
--count number 1 Number of workers
--id string - Worker ID (for kill)

process signals

Send signals to processes.

npx claude-flow process signals --target <target> --signal <signal> [options]

Signals: graceful-shutdown, force-kill, pause, resume, reload-config

process logs

View process logs.

npx claude-flow process logs [options]

Options:

Option Type Default Description
--source string all Log source (daemon, workers, tasks, all)
--tail number 50 Lines to show
--follow boolean false Follow output
--level string info Log level filter
--grep string - Filter pattern

Swarm Coordination

swarm init

Initialize a swarm.

npx claude-flow swarm init [options]

Options:

Option Type Default Description
--topology string hierarchical Swarm topology
--size number 5 Initial size

swarm spawn

Spawn agents into swarm.

npx claude-flow swarm spawn [options]

swarm status

Show swarm status.

npx claude-flow swarm status [options]

swarm task

Submit task to swarm.

npx claude-flow swarm task --description "<task>" [options]

Environment Variables

Variable Description Default
CLAUDE_FLOW_CONFIG Config file path .claude-flow/config.json
CLAUDE_FLOW_LOG_LEVEL Log level info
CLAUDE_FLOW_MEMORY_BACKEND Memory backend agentdb
CLAUDE_FLOW_EMBEDDING_PROVIDER Embedding provider transformers
CLAUDE_FLOW_HOOK_TIMEOUT Hook timeout (ms) 5000
CLAUDE_FLOW_REASONINGBANK_ENABLED ReasoningBank integration true
ANTHROPIC_API_KEY Anthropic API key -
OPENAI_API_KEY OpenAI API key -

Performance Targets

Component Target Description
SONA Learning <0.05ms Sub-millisecond adaptation
HNSW Search 150x-12,500x Faster than brute-force
Memory Reduction 50-75% Via quantization
Flash Attention 2.49x-7.47x Speedup
MoE Routing 92%+ Accuracy

See Also