Ruflo

ruvnet/ruflo

An orchestration platform for deploying and coordinating multi-agent swarms. If I tried to go into detail it would probably crash my browser. An impressive feat of engineering that tries to cover everything and actually does a good job. Self-learning, autonomous multi-agent swarms, vector-based multi-layered memory, systematic planning, security guardrails, and so on. It's a growing project, and YMMV, but even just studying the patterns is immensely valuable, and it's clearly well-engineered.

CLAUDE.md

Claude Code Configuration - Ruflo v3.5

Ruflo v3.5 (2026-04-07) — Stable release with verified capabilities. 6,000+ commits, 314 MCP tools, 16 agent roles + custom types, 19 AgentDB controllers. Packages: @claude-flow/cli@3.5.65, claude-flow@3.5.65, ruflo@3.5.65

Behavioral Rules (Always Enforced)

  • Do what has been asked; nothing more, nothing less
  • NEVER create files unless they're absolutely necessary for achieving your goal
  • ALWAYS prefer editing an existing file to creating a new one
  • NEVER proactively create documentation files (*.md) or README files unless explicitly requested
  • NEVER save working files, text/mds, or tests to the root folder
  • Never continuously check status after spawning a swarm — wait for results
  • ALWAYS read a file before editing it
  • NEVER commit secrets, credentials, or .env files

File Organization

  • NEVER save to root folder — use the directories below
  • Use /src for source code files
  • Use /tests for test files
  • Use /docs for documentation and markdown files
  • Use /config for configuration files
  • Use /scripts for utility scripts
  • Use /examples for example code

Project Architecture

  • Follow Domain-Driven Design with bounded contexts
  • Keep files under 500 lines
  • Use typed interfaces for all public APIs
  • Prefer TDD London School (mock-first) for new code
  • Use event sourcing for state changes
  • Ensure input validation at system boundaries

Key Packages

Package Path Purpose
@claude-flow/cli v3/@claude-flow/cli/ CLI entry point (26 commands)
@claude-flow/codex v3/@claude-flow/codex/ Dual-mode Claude + Codex collaboration
@claude-flow/guidance v3/@claude-flow/guidance/ Governance control plane
@claude-flow/hooks v3/@claude-flow/hooks/ 17 hooks + 12 workers
@claude-flow/memory v3/@claude-flow/memory/ AgentDB + HNSW search
@claude-flow/security v3/@claude-flow/security/ Input validation, CVE remediation

Concurrency: 1 MESSAGE = ALL RELATED OPERATIONS

  • All operations MUST be concurrent/parallel in a single message
  • Use Claude Code's Task tool for spawning agents, not just MCP

Mandatory patterns:

  • ALWAYS batch ALL todos in ONE TodoWrite call (5-10+ minimum)
  • ALWAYS spawn ALL agents in ONE message with full instructions via Task tool
  • ALWAYS batch ALL file reads/writes/edits in ONE message
  • ALWAYS batch ALL terminal operations in ONE Bash message
  • ALWAYS batch ALL memory store/retrieve operations in ONE message

Swarm Orchestration

  • MUST initialize the swarm using MCP tools when starting complex tasks
  • MUST spawn concurrent agents using Claude Code's Task tool
  • Never use MCP tools alone for execution — Task tool agents do the actual work

MCP + Task Tool in SAME Message

  • MUST call MCP tools AND Task tool in ONE message for complex work
  • Always call MCP first, then IMMEDIATELY call Task tool to spawn agents

3-Tier Model Routing (ADR-026)

Tier Handler Latency Cost Use Cases
1 Agent Booster (WASM) <1ms $0 Simple transforms (var→const, add types, etc.) — Skip LLM entirely
2 Haiku ~500ms $0.0002 Simple tasks, low complexity (<30%)
3 Sonnet/Opus 2-5s $0.003-0.015 Complex reasoning, architecture, security (>30%)
  • Always check for [AGENT_BOOSTER_AVAILABLE] or [TASK_MODEL_RECOMMENDATION] before spawning agents
  • Use Edit tool directly when [AGENT_BOOSTER_AVAILABLE] — intent types: var-to-const, add-types, add-error-handling, async-await, add-logging, remove-console

Swarm Configuration & Anti-Drift

Anti-Drift Coding Swarm (PREFERRED DEFAULT)

  • ALWAYS use hierarchical topology for coding swarms
  • Keep maxAgents at 6-8 for tight coordination
  • Use specialized strategy for clear role boundaries
  • Use raft consensus for hive-mind (leader maintains authoritative state)
  • Run frequent checkpoints via post-task hooks
  • Keep shared memory namespace for all agents
  • Keep task cycles short with verification gates
mcp__ruv-swarm__swarm_init({
  topology: "hierarchical",
  maxAgents: 8,
  strategy: "specialized"
})

Dual-Mode Collaboration (Claude Code + Codex)

This repository uses dual-mode orchestration to run Claude Code (🔵) and OpenAI Codex (🟢) workers in parallel with shared memory coordination. Both platforms collaborate on development tasks with cross-learning.

Why Dual-Mode?

Single Platform Dual-Mode Collaboration
One model's perspective Two AI platforms cross-validating
Limited reasoning styles Complementary strengths
No external verification Built-in code review
Sequential workflows Parallel execution

Dual-Mode Swarm Protocol

For complex tasks, spawn both Claude and Codex workers in parallel:

// STEP 1: Initialize dual-mode swarm
mcp__ruv-swarm__swarm_init({
  topology: "hierarchical",
  maxAgents: 8,
  strategy: "specialized"
})

// STEP 2: Spawn BOTH platforms in parallel via Task tool
// 🔵 Claude Code workers (architecture, security, testing)
Task("Architect", "Design the implementation. Store design in memory namespace 'collaboration'.", "system-architect")
Task("Tester", "Write tests based on architect's design. Read from 'collaboration' namespace.", "tester")
Task("Reviewer", "Review code quality and security. Store findings in 'collaboration'.", "reviewer")

// 🟢 Codex workers (implementation, optimization)
// Spawn via CLI for Codex platform
Bash("npx claude-flow-codex dual run --worker 'codex:coder:Implement the solution based on architect design' --namespace collaboration")
Bash("npx claude-flow-codex dual run --worker 'codex:optimizer:Optimize performance based on implementation' --namespace collaboration")

// STEP 3: Coordinate via shared memory
Bash("npx claude-flow@v3alpha memory store --namespace collaboration --key 'task-context' --value '[task description]'")

Collaboration Templates (Pre-Built Pipelines)

Template Workers Pipeline
feature 🔵 Architect → 🟢 Coder → 🔵 Tester → 🟢 Reviewer Full feature development
security 🔵 Analyst → 🟢 Scanner → 🔵 Reporter Security audit workflow
refactor 🔵 Architect → 🟢 Refactorer → 🔵 Tester Code modernization
bugfix 🔵 Researcher → 🟢 Coder → 🔵 Tester Bug investigation & fix

Dual-Mode CLI Commands

# Run a collaboration template
npx claude-flow-codex dual run feature --task "Add user authentication with OAuth"
npx claude-flow-codex dual run security --target "./src"
npx claude-flow-codex dual run refactor --target "./src/legacy"

# Custom multi-platform swarm
npx claude-flow-codex dual run \
  --worker "claude:architect:Design the API structure" \
  --worker "codex:coder:Implement REST endpoints" \
  --worker "claude:tester:Write integration tests" \
  --worker "codex:reviewer:Review code quality" \
  --namespace "api-feature"

# Check collaboration status
npx claude-flow-codex dual status

# List available templates
npx claude-flow-codex dual templates

Shared Memory Coordination

All workers share state via the collaboration namespace:

# Store context for cross-platform sharing
npx claude-flow@v3alpha memory store --namespace collaboration --key "design-decisions" --value "..."

# Search for patterns across all workers
npx claude-flow@v3alpha memory search --namespace collaboration --query "authentication patterns"

# Retrieve specific findings
npx claude-flow@v3alpha memory retrieve --namespace collaboration --key "security-findings"

Cross-Platform Learning

Both platforms learn from each other's outputs:

# After successful collaboration, train patterns
npx claude-flow@v3alpha hooks post-task --task-id "dual-[id]" --success true --train-neural true

# Store successful collaboration patterns
npx claude-flow@v3alpha memory store --namespace patterns --key "dual-mode-[pattern]" --value "[what worked]"

# Transfer learnings to both platforms
npx claude-flow@v3alpha hooks transfer store --pattern "dual-collab-success"

Worker Dependency Levels

Workers execute in dependency order:

Level 0: [🔵 Architect]           # No dependencies - runs first
Level 1: [🟢 Coder, 🔵 Tester]    # Depends on Architect
Level 2: [🔵 Reviewer]            # Depends on Coder + Tester
Level 3: [🟢 Optimizer]           # Depends on Reviewer approval

Platform Strengths

Task Type Preferred Platform Reason
Architecture & Design 🔵 Claude Strong reasoning, system thinking
Implementation 🟢 Codex Fast code generation
Security Review 🔵 Claude Careful analysis, threat modeling
Performance Optimization 🟢 Codex Code-level optimizations
Testing Strategy 🔵 Claude Coverage analysis, edge cases
Refactoring 🟢 Codex Bulk code transformations

Programmatic API

import { DualModeOrchestrator, CollaborationTemplates } from '@claude-flow/codex';

const orchestrator = new DualModeOrchestrator({
  namespace: 'my-feature',
  memoryBackend: 'hybrid'
});

// Use pre-built template
const workers = CollaborationTemplates.featureDevelopment('Add OAuth login');

// Run collaboration
const results = await orchestrator.runCollaboration(workers, 'Implement OAuth feature');

// Access shared memory
const designDocs = await orchestrator.getMemory('design-decisions');

Swarm Protocols & Routing

Auto-Start Swarm Protocol

When the user requests a complex task (multi-file changes, feature implementation, refactoring), immediately execute this pattern in a SINGLE message:

// STEP 1: Initialize swarm coordination via MCP (in parallel with agent spawning)
mcp__ruv-swarm__swarm_init({
  topology: "hierarchical",
  maxAgents: 8,
  strategy: "specialized"
})

// STEP 2: Spawn agents concurrently using Claude Code's Task tool
// ALL Task calls MUST be in the SAME message for parallel execution
Task("Coordinator", "You are the swarm coordinator. Initialize session, coordinate other agents via memory. Run: npx claude-flow@v3alpha hooks session-start", "hierarchical-coordinator")
Task("Researcher", "Analyze requirements and existing code patterns. Store findings in memory via hooks.", "researcher")
Task("Architect", "Design implementation approach based on research. Document decisions in memory.", "system-architect")
Task("Coder", "Implement the solution following architect's design. Coordinate via hooks.", "coder")
Task("Tester", "Write tests for the implementation. Report coverage via hooks.", "tester")
Task("Reviewer", "Review code quality and security. Document findings.", "reviewer")

// STEP 3: Batch all todos
TodoWrite({ todos: [
  {content: "Initialize swarm coordination", status: "in_progress", activeForm: "Initializing swarm"},
  {content: "Research and analyze requirements", status: "in_progress", activeForm: "Researching requirements"},
  {content: "Design architecture", status: "pending", activeForm: "Designing architecture"},
  {content: "Implement solution", status: "pending", activeForm: "Implementing solution"},
  {content: "Write tests", status: "pending", activeForm: "Writing tests"},
  {content: "Review and finalize", status: "pending", activeForm: "Reviewing code"}
]})

// STEP 4: Store swarm state in memory
mcp__claude-flow__memory_usage({
  action: "store",
  namespace: "swarm",
  key: "current-session",
  value: JSON.stringify({task: "[user's task]", agents: 6, startedAt: new Date().toISOString()})
})

Agent Routing (Anti-Drift)

Code Task Agents
1 Bug Fix coordinator, researcher, coder, tester
3 Feature coordinator, architect, coder, tester, reviewer
5 Refactor coordinator, architect, coder, reviewer
7 Performance coordinator, perf-engineer, coder
9 Security coordinator, security-architect, auditor
11 Memory coordinator, memory-specialist, perf-engineer
13 Docs researcher, api-docs

Codes 1-11: hierarchical/specialized (anti-drift). Code 13: mesh/balanced

Task Complexity Detection

AUTO-INVOKE SWARM when task involves:

  • Multiple files (3+)
  • New feature implementation
  • Refactoring across modules
  • API changes with tests
  • Security-related changes
  • Performance optimization
  • Database schema changes

SKIP SWARM for:

  • Single file edits
  • Simple bug fixes (1-2 lines)
  • Documentation updates
  • Configuration changes
  • Quick questions/exploration

Project Configuration

This project is configured with Claude Flow V3 (Anti-Drift Defaults):

  • Topology: hierarchical (prevents drift via central coordination)
  • Max Agents: 8 (smaller team = less drift)
  • Strategy: specialized (clear roles, no overlap)
  • Consensus: raft (leader maintains authoritative state)
  • Memory Backend: hybrid (SQLite + AgentDB)
  • HNSW Indexing: Enabled (150x-12,500x faster)
  • Neural Learning: Enabled (SONA)

V3 CLI Commands (26 Commands, 140+ Subcommands)

Core Commands

Command Subcommands Description
init 4 Project initialization with wizard, presets, skills, hooks
agent 8 Agent lifecycle (spawn, list, status, stop, metrics, pool, health, logs)
swarm 6 Multi-agent swarm coordination and orchestration
memory 11 AgentDB memory with vector search (150x-12,500x faster)
mcp 9 MCP server management and tool execution
task 6 Task creation, assignment, and lifecycle
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 + 12 background workers
hive-mind 6 Queen-led Byzantine fault-tolerant consensus

Advanced Commands

Command Subcommands Description
daemon 5 Background 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)
migrate 5 V2 to V3 migration with rollback support
process 4 Background process management
doctor 1 System diagnostics with health checks
completions 4 Shell completions (bash, zsh, fish, powershell)

Quick CLI Examples

# Initialize project
npx claude-flow@v3alpha init --wizard

# Start daemon with background workers
npx claude-flow@v3alpha daemon start

# Spawn an agent
npx claude-flow@v3alpha agent spawn -t coder --name my-coder

# Initialize swarm
npx claude-flow@v3alpha swarm init --v3-mode

# Search memory (HNSW-indexed)
npx claude-flow@v3alpha memory search -q "authentication patterns"

# System diagnostics
npx claude-flow@v3alpha doctor --fix

# Security scan
npx claude-flow@v3alpha security scan --depth full

# Performance benchmark
npx claude-flow@v3alpha performance benchmark --suite all

Headless Background Instances (claude -p)

Use claude -p (print/pipe mode) to spawn headless Claude instances for parallel background work. These run non-interactively and return results to stdout.

Basic Usage

# Single headless task
claude -p "Analyze the authentication module for security issues"

# With model selection
claude -p --model haiku "Format this config file"
claude -p --model opus "Design the database schema for user management"

# With output format
claude -p --output-format json "List all TODO comments in src/"
claude -p --output-format stream-json "Refactor the error handling in api.ts"

# With budget limits
claude -p --max-budget-usd 0.50 "Run comprehensive security audit"

# With specific tools allowed
claude -p --allowedTools "Read,Grep,Glob" "Find all files that import the auth module"

# Skip permissions (sandboxed environments only)
claude -p --dangerously-skip-permissions "Fix all lint errors in src/"

Parallel Background Execution

# Spawn multiple headless instances in parallel
claude -p "Analyze src/auth/ for vulnerabilities" &
claude -p "Write tests for src/api/endpoints.ts" &
claude -p "Review src/models/ for performance issues" &
wait  # Wait for all to complete

# With results captured
SECURITY=$(claude -p "Security audit of auth module" &)
TESTS=$(claude -p "Generate test coverage report" &)
PERF=$(claude -p "Profile memory usage in workers" &)
wait
echo "$SECURITY" "$TESTS" "$PERF"

Session Continuation

# Start a task, resume later
claude -p --session-id "abc-123" "Start analyzing the codebase"
claude -p --resume "abc-123" "Continue with the test files"

# Fork a session for parallel exploration
claude -p --resume "abc-123" --fork-session "Try approach A: event sourcing"
claude -p --resume "abc-123" --fork-session "Try approach B: CQRS pattern"

Key Flags

Flag Purpose
-p, --print Non-interactive mode, print and exit
--model <model> Select model (haiku, sonnet, opus)
--output-format <fmt> Output: text, json, stream-json
--max-budget-usd <amt> Spending cap per invocation
--allowedTools <tools> Restrict available tools
--append-system-prompt Add custom instructions
--resume <id> Continue a previous session
--fork-session Branch from resumed session
--fallback-model <model> Auto-fallback if primary overloaded
--permission-mode <mode> acceptEdits, bypassPermissions, plan, etc.
--mcp-config <json> Load MCP servers from JSON

Available Agents (60+ Types)

Core Development

coder, reviewer, tester, planner, researcher

V3 Specialized Agents

security-architect, security-auditor, memory-specialist, performance-engineer

@claude-flow/security Module

CVE remediation, input validation, path security:

  • InputValidator — Zod-based validation at boundaries
  • PathValidator — Path traversal prevention
  • SafeExecutor — Command injection protection
  • PasswordHasher — bcrypt hashing
  • TokenGenerator — Secure token generation

Token Optimizer (Agent Booster)

Integrates agentic-flow optimizations for 30-50% token reduction:

import { getTokenOptimizer } from '@claude-flow/integration';
const optimizer = await getTokenOptimizer();

// Compact context (32% fewer tokens)
const ctx = await optimizer.getCompactContext("auth patterns");

// 352x faster edits = fewer retries
await optimizer.optimizedEdit(file, old, new, "typescript");

// Optimal config (100% success rate)
const config = optimizer.getOptimalConfig(agentCount);
Feature Token Savings
ReasoningBank retrieval -32%
Agent Booster edits -15%
Cache (95% hit rate) -10%
Optimal batch size -20%

Swarm Coordination

hierarchical-coordinator, mesh-coordinator, adaptive-coordinator, collective-intelligence-coordinator, swarm-memory-manager

Consensus & Distributed

byzantine-coordinator, raft-manager, gossip-coordinator, consensus-builder, crdt-synchronizer, quorum-manager, security-manager

Performance & Optimization

perf-analyzer, performance-benchmarker, task-orchestrator, memory-coordinator, smart-agent

GitHub & Repository

github-modes, pr-manager, code-review-swarm, issue-tracker, release-manager, workflow-automation, project-board-sync, repo-architect, multi-repo-swarm

SPARC Methodology

sparc-coord, sparc-coder, specification, pseudocode, architecture, refinement

Specialized Development

backend-dev, mobile-dev, ml-developer, cicd-engineer, api-docs, system-architect, code-analyzer, base-template-generator

Testing & Validation

tdd-london-swarm, production-validator

Agent Teams (Multi-Agent Coordination)

Claude Code's experimental Agent Teams feature is fully integrated with Claude Flow for advanced multi-agent coordination.

Enabling Agent Teams

Agent Teams is automatically enabled when you run npx claude-flow@v3alpha init. The following is added to .claude/settings.json:

{
  "env": {
    "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
  },
  "claudeFlow": {
    "agentTeams": {
      "enabled": true,
      "teammateMode": "auto",
      "taskListEnabled": true,
      "mailboxEnabled": true
    }
  }
}

Agent Teams Components

Component Tool Purpose
Team Lead You (main Claude) Coordinates teammates, assigns tasks, reviews results
Teammates Task tool Sub-agents spawned to work on specific tasks
Task List TaskCreate/TaskList/TaskUpdate Shared todo list visible to all team members
Mailbox SendMessage Inter-agent messaging for coordination

Creating and Managing Teams

// Create a team
TeamCreate({
  team_name: "feature-dev",
  description: "Building new feature",
  agent_type: "coordinator"
})

// Create shared tasks
TaskCreate({ subject: "Design API", description: "...", activeForm: "Designing" })
TaskCreate({ subject: "Implement endpoints", description: "...", activeForm: "Implementing" })
TaskCreate({ subject: "Write tests", description: "...", activeForm: "Testing" })

// Spawn teammates (run in background for parallel work)
Task({
  prompt: "Design the API according to task #1...",
  subagent_type: "system-architect",
  team_name: "feature-dev",
  name: "architect",
  run_in_background: true
})
Task({
  prompt: "Implement endpoints from task #2...",
  subagent_type: "coder",
  team_name: "feature-dev",
  name: "developer",
  run_in_background: true
})

Agent Teams Hooks

Hook Trigger Purpose
TeammateIdle Teammate finishes turn Auto-assign pending tasks to idle teammates
TaskCompleted Task marked complete Train patterns from successful work, notify lead

Hook Commands

# Handle idle teammate (auto-assigns available tasks)
npx claude-flow@v3alpha hooks teammate-idle --auto-assign true

# Handle task completion (trains patterns, notifies lead)
npx claude-flow@v3alpha hooks task-completed -i task-123 --train-patterns true

# Check on team progress
TaskList

# Send message to teammate
SendMessage({
  type: "message",
  recipient: "developer",
  content: "Please prioritize the auth endpoint",
  summary: "Prioritize auth"
})

# Shutdown teammate gracefully
SendMessage({
  type: "shutdown_request",
  recipient: "developer",
  content: "Work complete, shutting down"
})

Best Practices for Agent Teams

  1. Spawn teammates in background: Use run_in_background: true for parallel work
  2. Create tasks first: Use TaskCreate before spawning teammates so they have work
  3. Use descriptive names: Name teammates by role (architect, developer, tester)
  4. Don't poll status: Wait for teammates to message back or complete
  5. Graceful shutdown: Always send shutdown_request before TeamDelete
  6. Clean up: Use TeamDelete after all teammates have shut down

Teammate Display Modes

Mode Description
auto Automatically selects best mode for environment
in-process Teammates run in same process (default for CI/background)
tmux Split-pane display in terminal (requires tmux)

V3 Hooks System (17 Hooks + 12 Workers)

Hook Categories

Category Hooks Purpose
Core pre-edit, post-edit, pre-command, post-command, pre-task, post-task Tool lifecycle
Session session-start, session-end, session-restore, notify Context management
Intelligence route, explain, pretrain, build-agents, transfer Neural learning
Learning intelligence (trajectory-start/step/end, pattern-store/search, stats, attention) Reinforcement
Agent Teams teammate-idle, task-completed Multi-agent coordination

12 Background Workers

Worker Priority Description
ultralearn normal Deep knowledge acquisition
optimize high Performance optimization
consolidate low Memory consolidation
predict normal Predictive preloading
audit critical Security analysis
map normal Codebase mapping
preload low Resource preloading
deepdive normal Deep code analysis
document normal Auto-documentation
refactor normal Refactoring suggestions
benchmark normal Performance benchmarking
testgaps normal Test coverage analysis

Essential Hook Commands

# Core hooks
npx claude-flow@v3alpha hooks pre-task --description "[task]"
npx claude-flow@v3alpha hooks post-task --task-id "[id]" --success true
npx claude-flow@v3alpha hooks post-edit --file "[file]" --train-patterns

# Session management
npx claude-flow@v3alpha hooks session-start --session-id "[id]"
npx claude-flow@v3alpha hooks session-end --export-metrics true
npx claude-flow@v3alpha hooks session-restore --session-id "[id]"

# Intelligence routing
npx claude-flow@v3alpha hooks route --task "[task]"
npx claude-flow@v3alpha hooks explain --topic "[topic]"

# Neural learning
npx claude-flow@v3alpha hooks pretrain --model-type moe --epochs 10
npx claude-flow@v3alpha hooks build-agents --agent-types coder,tester

# Background workers
npx claude-flow@v3alpha hooks worker list
npx claude-flow@v3alpha hooks worker dispatch --trigger audit
npx claude-flow@v3alpha hooks worker status

Intelligence System (RuVector)

V3 includes the RuVector Intelligence System:

  • SONA: Self-Optimizing Neural Architecture (<0.05ms adaptation)
  • MoE: Mixture of Experts for specialized routing
  • HNSW: 150x-12,500x faster pattern search
  • EWC++: Elastic Weight Consolidation (prevents forgetting)
  • Flash Attention: 2.49x-7.47x speedup

The 4-step intelligence pipeline:

  1. RETRIEVE — Fetch relevant patterns via HNSW
  2. JUDGE — Evaluate with verdicts (success/failure)
  3. DISTILL — Extract key learnings via LoRA
  4. CONSOLIDATE — Prevent catastrophic forgetting via EWC++

Embeddings Package (v3.0.0-alpha.12)

Features:

  • sql.js: Cross-platform SQLite persistent cache (WASM, no native compilation)
  • Document chunking: Configurable overlap and size
  • Normalization: L2, L1, min-max, z-score
  • Hyperbolic embeddings: Poincare ball model for hierarchical data
  • 75x faster: With agentic-flow ONNX integration
  • Neural substrate: Integration with RuVector

Hive-Mind Consensus

Topologies

  • hierarchical — Queen controls workers directly
  • mesh — Fully connected peer network
  • hierarchical-mesh — Hybrid (recommended)
  • adaptive — Dynamic based on load

Consensus Strategies

  • byzantine — BFT (tolerates f < n/3 faulty)
  • raft — Leader-based (tolerates f < n/2)
  • gossip — Epidemic for eventual consistency
  • crdt — Conflict-free replicated data types
  • quorum — Configurable quorum-based

V3 Performance Targets

Metric Target Status
HNSW Search 150x-12,500x faster Implemented (persistent)
Memory Reduction 50-75% with quantization Implemented (3.92x Int8)
SONA Integration Pattern learning Implemented (ReasoningBank)
Flash Attention 2.49x-7.47x speedup In progress
MCP Response <100ms Achieved
CLI Startup <500ms Achieved
SONA Adaptation <0.05ms In progress

Environment Variables

# Configuration
CLAUDE_FLOW_CONFIG=./claude-flow.config.json
CLAUDE_FLOW_LOG_LEVEL=info

# Provider API Keys
ANTHROPIC_API_KEY=sk-ant-...
OPENAI_API_KEY=sk-...
GOOGLE_API_KEY=...

# MCP Server
CLAUDE_FLOW_MCP_PORT=3000
CLAUDE_FLOW_MCP_HOST=localhost
CLAUDE_FLOW_MCP_TRANSPORT=stdio

# Memory
CLAUDE_FLOW_MEMORY_BACKEND=hybrid
CLAUDE_FLOW_MEMORY_PATH=./data/memory

Doctor Health Checks

Run npx claude-flow@v3alpha doctor to check:

  • Node.js version (20+)
  • npm version (9+)
  • Git installation
  • Config file validity
  • Daemon status
  • Memory database
  • API keys
  • MCP servers
  • Disk space
  • TypeScript installation

Quick Setup

# Add MCP servers
claude mcp add claude-flow npx claude-flow@v3alpha mcp start
claude mcp add ruv-swarm npx ruv-swarm mcp start  # Optional
claude mcp add flow-nexus npx flow-nexus@latest mcp start  # Optional

# Start daemon
npx claude-flow@v3alpha daemon start

# Run doctor
npx claude-flow@v3alpha doctor --fix

Claude Code vs MCP Tools

Claude Code Handles ALL EXECUTION:

  • Task tool: Spawn and run agents concurrently
  • File operations (Read, Write, Edit, MultiEdit, Glob, Grep)
  • Code generation and programming
  • Bash commands and system operations
  • TodoWrite and task management
  • Git operations

MCP Tools ONLY COORDINATE:

  • Swarm initialization (topology setup)

  • Agent type definitions

  • Task orchestration

  • Memory management

  • Neural features

  • Performance tracking

  • Keep MCP for coordination strategy only — use Claude Code's Task tool for real execution

Claude Code ↔ AgentDB Memory Bridge

Claude Code's auto-memory (~/.claude/projects/*/memory/*.md) is bridged to AgentDB with ONNX vector embeddings for semantic search.

MCP Tools

Tool Description
memory_import_claude Import Claude Code memories into AgentDB with 384-dim ONNX embeddings. Use allProjects: true to import from ALL projects.
memory_bridge_status Show bridge health — Claude files, AgentDB entries, SONA state, connection status
memory_search_unified Semantic search across ALL namespaces (claude-memories, auto-memory, patterns, tasks, feedback)

Auto-Import on Session Start

The SessionStart hook automatically imports current project's memories into AgentDB. For manual import of all projects:

# Via MCP tool (from Claude Code)
memory_import_claude({ allProjects: true })

# Via helper hook (from terminal)
node .claude/helpers/auto-memory-hook.mjs import-all

Unified Search

Search across both Claude Code memories and AgentDB entries:

# Via MCP tool
memory_search_unified({ query: "authentication security", limit: 5 })

# Results include source attribution: claude-code, auto-memory, or agentdb

Intelligence Pipeline

Component Status Details
ONNX Embeddings Active all-MiniLM-L6-v2, 384 dimensions
SONA Learning Active Pattern matching + trajectory recording
ReasoningBank Active Pattern storage with file persistence
AgentDB sql.js Active SQLite with vector_indexes table

Publishing to npm

Publishing Rules

  • MUST publish ALL THREE packages when publishing CLI changes: @claude-flow/cli, claude-flow, AND ruflo
  • MUST update ALL dist-tags for ALL THREE packages after publishing
  • Publish order: @claude-flow/cli first, then claude-flow (umbrella), then ruflo (alias umbrella)
  • MUST run verification for ALL THREE before telling user publishing is complete
# STEP 1: Build and publish CLI
cd v3/@claude-flow/cli
npm version 3.0.0-alpha.XXX --no-git-tag-version
npm run build
npm publish --tag alpha
npm dist-tag add @claude-flow/cli@3.0.0-alpha.XXX latest

# STEP 2: Publish claude-flow umbrella
cd /workspaces/claude-flow
npm version 3.0.0-alpha.XXX --no-git-tag-version
npm publish --tag v3alpha

# STEP 3: Update ALL claude-flow umbrella tags (CRITICAL - DON'T SKIP!)
npm dist-tag add claude-flow@3.0.0-alpha.XXX latest
npm dist-tag add claude-flow@3.0.0-alpha.XXX alpha

# STEP 4: Publish ruflo umbrella (CRITICAL - DON'T FORGET!)
cd /workspaces/claude-flow/ruflo
npm version 3.0.0-alpha.XXX --no-git-tag-version
npm publish --tag alpha
npm dist-tag add ruflo@3.0.0-alpha.XXX latest

Verification (run before telling user):

npm view @claude-flow/cli dist-tags --json
npm view claude-flow dist-tags --json
npm view ruflo dist-tags --json
# ALL THREE packages need: alpha AND latest pointing to newest version

All Tags That Must Be Updated

Package Tag Command Users Run
@claude-flow/cli alpha npx @claude-flow/cli@alpha
@claude-flow/cli latest npx @claude-flow/cli@latest
@claude-flow/cli v3alpha npx @claude-flow/cli@v3alpha
claude-flow alpha npx claude-flow@alpha — EASY TO FORGET
claude-flow latest npx claude-flow@latest
claude-flow v3alpha npx claude-flow@v3alpha
ruflo alpha npx ruflo@alpha — EASY TO FORGET
ruflo latest npx ruflo@latest
  • Never forget the ruflo package — it's a thin wrapper users run via npx ruflo@alpha
  • Never forget the umbrella alpha tag — users run npx claude-flow@alpha
  • ruflo source is in /ruflo/ — it depends on @claude-flow/cli

Plugin Registry Maintenance (IPFS/Pinata)

The plugin registry is stored on IPFS via Pinata for decentralized, immutable distribution.

Registry Location

  • Current CID: Stored in v3/@claude-flow/cli/src/plugins/store/discovery.ts
  • Gateway: https://gateway.pinata.cloud/ipfs/{CID}
  • Format: JSON with plugin metadata, categories, featured/trending lists

Required Environment Variables

Add to .env (NEVER commit actual values):

PINATA_API_KEY=your-api-key
PINATA_API_SECRET=your-api-secret
PINATA_API_JWT=your-jwt-token

Plugin Registry Operations

Adding a New Plugin to Registry

  1. Fetch current registry:
curl -s "https://gateway.pinata.cloud/ipfs/$(grep LIVE_REGISTRY_CID v3/@claude-flow/cli/src/plugins/store/discovery.ts | cut -d"'" -f2)" > /tmp/registry.json
  1. Add plugin entry to the plugins array:
{
  "id": "@claude-flow/your-plugin",
  "name": "@claude-flow/your-plugin",
  "displayName": "Your Plugin",
  "description": "Plugin description",
  "version": "1.0.0-alpha.1",
  "size": 100000,
  "checksum": "sha256:abc123",
  "author": {"id": "claude-flow-team", "displayName": "Claude Flow Team", "verified": true},
  "license": "MIT",
  "categories": ["official"],
  "tags": ["your", "tags"],
  "downloads": 0,
  "rating": 5,
  "lastUpdated": "2026-01-25T00:00:00.000Z",
  "minClaudeFlowVersion": "3.0.0",
  "type": "integration",
  "hooks": [],
  "commands": [],
  "permissions": ["memory"],
  "exports": ["YourExport"],
  "verified": true,
  "trustLevel": "official"
}
  1. Update counts and arrays:

    • Increment totalPlugins
    • Add to official array
    • Add to featured/newest if applicable
    • Update category pluginCount
  2. Upload to Pinata (read credentials from .env):

# Source credentials from .env
PINATA_JWT=$(grep "^PINATA_API_JWT=" .env | cut -d'=' -f2-)

# Upload updated registry
curl -X POST "https://api.pinata.cloud/pinning/pinJSONToIPFS" \
  -H "Authorization: Bearer $PINATA_JWT" \
  -H "Content-Type: application/json" \
  -d @/tmp/registry.json
  1. Update discovery.ts with new CID:
export const LIVE_REGISTRY_CID = 'NEW_CID_FROM_PINATA';
  1. Also update demo registry in discovery.ts demoPluginRegistry for offline fallback

Security Rules

  • NEVER hardcode API keys in scripts or source files
  • NEVER commit .env (already in .gitignore)
  • Always source credentials from environment at runtime
  • Always delete temporary scripts after one-time uploads

Verification

# Verify new registry is accessible
curl -s "https://gateway.pinata.cloud/ipfs/{NEW_CID}" | jq '.totalPlugins'

Optional Plugins (20 Available)

Plugins are distributed via IPFS and can be installed with the CLI. Browse and install from the official registry:

# List all available plugins
npx claude-flow@v3alpha plugins list

# Install a plugin
npx claude-flow@v3alpha plugins install @claude-flow/plugin-name

# Enable/disable
npx claude-flow@v3alpha plugins enable @claude-flow/plugin-name
npx claude-flow@v3alpha plugins disable @claude-flow/plugin-name

Core Plugins

Plugin Version Description
@claude-flow/embeddings 3.0.0-alpha.1 Vector embeddings with sql.js, HNSW, hyperbolic support
@claude-flow/security 3.0.0-alpha.1 Input validation, path security, CVE remediation
@claude-flow/claims 3.0.0-alpha.8 Claims-based authorization (check, grant, revoke, list)
@claude-flow/neural 3.0.0-alpha.7 Neural pattern training (SONA, MoE, EWC++)
@claude-flow/plugins 3.0.0-alpha.1 Plugin system core (manager, discovery, store)
@claude-flow/performance 3.0.0-alpha.1 Performance profiling and benchmarking

Integration Plugins

Plugin Version Description
@claude-flow/plugin-agentic-qe 3.0.0-alpha.4 Agentic quality engineering integration
@claude-flow/plugin-prime-radiant 0.1.5 Prime Radiant intelligence integration
@claude-flow/plugin-gastown-bridge 3.0.0-alpha.1 Gastown bridge protocol integration
@claude-flow/teammate-plugin 1.0.0-alpha.1 Multi-agent teammate coordination
@claude-flow/plugin-code-intelligence 0.1.0 Advanced code analysis and intelligence
@claude-flow/plugin-test-intelligence 0.1.0 Intelligent test generation and gap analysis
@claude-flow/plugin-perf-optimizer 0.1.0 Performance optimization automation
@claude-flow/plugin-neural-coordinator 0.1.0 Neural network coordination across agents
@claude-flow/plugin-cognitive-kernel 0.1.0 Core cognitive processing kernel
@claude-flow/plugin-quantum-optimizer 0.1.0 Quantum-inspired optimization algorithms
@claude-flow/plugin-hyperbolic-reasoning 0.1.0 Hyperbolic space reasoning for hierarchical data

Domain-Specific Plugins

Plugin Version Description
@claude-flow/plugin-healthcare-clinical 0.1.0 Healthcare clinical workflow automation
@claude-flow/plugin-financial-risk 0.1.0 Financial risk assessment and modeling
@claude-flow/plugin-legal-contracts 0.1.0 Legal contract analysis and generation

Plugin Development

# Create a new plugin from template
npx claude-flow@v3alpha plugins create my-plugin

# Test locally
npx claude-flow@v3alpha plugins install ./path/to/my-plugin

# Publish to registry (requires Pinata credentials)
npx claude-flow@v3alpha plugins publish

Registry source: IPFS via Pinata (QmXbfEAaR7D2Ujm4GAkbwcGZQMHqAMpwDoje4583uNP834)

Support


Remember: Claude Flow coordinates, Claude Code creates!

README.md

🌊 RuFlo v3.5: Enterprise AI Orchestration Platform

Ruflo Banner

GitHub Project of the Day

Star on GitHub Monthly Downloads Total Downloads ruv.io Agentics Foundation Claude Code MIT License

Follow @ruv LinkedIn YouTube

Multi-agent AI orchestration for Claude Code

Deploy 16 specialized agent roles + custom types in coordinated swarms with self-learning capabilities, fault-tolerant consensus, and enterprise-grade security.

Why Ruflo? Claude Flow is now Ruflo — named by Ruv, who loves Rust, flow states, and building things that feel inevitable. The "Ru" is the Ruv. The "flo" is the flow. Underneath, WASM kernels written in Rust power the policy engine, embeddings, and proof system. 6,000+ commits later, this is v3.5.

Getting into the Flow

Ruflo is a comprehensive AI agent orchestration framework that transforms Claude Code into a powerful multi-agent development platform. It enables teams to deploy, coordinate, and optimize specialized AI agents working together on complex software engineering tasks.

Self-Learning/Self-Optimizing Agent Architecture

User → Ruflo (CLI/MCP) → Router → Swarm → Agents → Memory → LLM Providers
                       ↑                          ↓
                       └──── Learning Loop ←──────┘
flowchart TB
    subgraph USER["👤 User Layer"]
        U[User]
    end

    subgraph ENTRY["🚪 Entry Layer"]
        CLI[CLI / MCP Server]
        AID[AIDefence Security]
    end

    subgraph ROUTING["🧭 Routing Layer"]
        QL[Q-Learning Router]
        MOE[MoE - 8 Experts]
        SK[Skills - 130+]
        HK[Hooks - 27]
    end

    subgraph SWARM["🐝 Swarm Coordination"]
        TOPO[Topologies<br/>mesh/hier/ring/star]
        CONS[Consensus<br/>Raft/BFT/Gossip]
        CLM[Claims<br/>Human-Agent Coord]
    end

    subgraph AGENTS["🤖 100+ Agents"]
        AG1[coder]
        AG2[tester]
        AG3[reviewer]
        AG4[architect]
        AG5[security]
        AG6[...]
    end

    subgraph RESOURCES["📦 Resources"]
        MEM[(Memory<br/>AgentDB)]
        PROV[Providers<br/>Claude/GPT/Gemini/Ollama]
        WORK[Workers - 12<br/>ultralearn/audit/optimize]
    end

    subgraph RUVECTOR["🧠 RuVector Intelligence Layer"]
        direction TB
        subgraph ROW1[" "]
            SONA[SONA<br/>Self-Optimize<br/>&lt;0.05ms]
            EWC[EWC++<br/>No Forgetting]
            FLASH[Flash Attention<br/>2.49-7.47x]
        end
        subgraph ROW2[" "]
            HNSW[HNSW<br/>HNSW-indexed]
            RB[ReasoningBank<br/>Pattern Store]
            HYP[Hyperbolic<br/>Poincaré]
        end
        subgraph ROW3[" "]
            LORA[LoRA/Micro<br/>low-rank adaptation]
            QUANT[Int8 Quant<br/>3.92x memory]
            RL[9 RL Algos<br/>Q/SARSA/PPO/DQN]
        end
    end

    subgraph LEARNING["🔄 Learning Loop"]
        L1[RETRIEVE] --> L2[JUDGE] --> L3[DISTILL] --> L4[CONSOLIDATE] --> L5[ROUTE]
    end

    U --> CLI
    CLI --> AID
    AID --> QL & MOE & SK & HK
    QL & MOE & SK & HK --> TOPO & CONS & CLM
    TOPO & CONS & CLM --> AG1 & AG2 & AG3 & AG4 & AG5 & AG6
    AG1 & AG2 & AG3 & AG4 & AG5 & AG6 --> MEM & PROV & WORK
    MEM --> SONA & EWC & FLASH
    SONA & EWC & FLASH --> HNSW & RB & HYP
    HNSW & RB & HYP --> LORA & QUANT & RL
    LORA & QUANT & RL --> L1
    L5 -.->|loops back| QL

    style RUVECTOR fill:#1a1a2e,stroke:#e94560,stroke-width:2px
    style LEARNING fill:#0f3460,stroke:#e94560,stroke-width:2px
    style USER fill:#16213e,stroke:#0f3460
    style ENTRY fill:#1a1a2e,stroke:#0f3460
    style ROUTING fill:#1a1a2e,stroke:#0f3460
    style SWARM fill:#1a1a2e,stroke:#0f3460
    style AGENTS fill:#1a1a2e,stroke:#0f3460
    style RESOURCES fill:#1a1a2e,stroke:#0f3460

RuVector Components (included with Ruflo):

Component Purpose Performance
SONA Self-Optimizing Pattern Learning - learns optimal routing Fast adaptation
EWC++ Elastic Weight Consolidation - prevents catastrophic forgetting Preserves learned patterns
Flash Attention Optimized attention computation 2-7x speedup (benchmarked)
HNSW Hierarchical Navigable Small World vector search Sub-millisecond retrieval
ReasoningBank Pattern storage with trajectory learning RETRIEVE→JUDGE→DISTILL
Hyperbolic Poincare ball embeddings for hierarchical data Better code relationships
LoRA/MicroLoRA Low-Rank Adaptation for efficient fine-tuning Lightweight adaptation
Int8 Quantization Memory-efficient weight storage ~4x memory reduction
SemanticRouter Semantic task routing with cosine similarity Fast intent routing
9 RL Algorithms Q-Learning, SARSA, A2C, PPO, DQN, Decision Transformer, etc. Task-specific learning
# Use RuVector via Ruflo
npx ruflo@latest hooks intelligence --status

Get Started Fast

# One-line install (recommended)
curl -fsSL https://cdn.jsdelivr.net/gh/ruvnet/ruflo@main/scripts/install.sh | bash

# Or full setup with MCP + diagnostics
curl -fsSL https://cdn.jsdelivr.net/gh/ruvnet/ruflo@main/scripts/install.sh | bash -s -- --full

# Or via npx
npx ruflo@latest init --wizard

New to Ruflo? You don't need to learn 310+ MCP tools or 26 CLI commands. After running init, just use Claude Code normally — the hooks system automatically routes tasks to the right agents, learns from successful patterns, and coordinates multi-agent work in the background. The advanced tools exist for fine-grained control when you need it.


Key Capabilities

🤖 100+ Specialized Agents - Ready-to-use AI agents for coding, code review, testing, security audits, documentation, and DevOps. Each agent is optimized for its specific role.

🐝 Coordinated Agent Teams - Run unlimited agents simultaneously in organized swarms. Agents spawn sub-workers, communicate, share context, and divide work automatically using hierarchical (queen/workers) or mesh (peer-to-peer) patterns.

🧠 Learns From Your Workflow - The system remembers what works. Successful patterns are stored and reused, routing similar tasks to the best-performing agents. Gets smarter over time.

🔌 Works With Any LLM - Switch between Claude, GPT, Gemini, Cohere, or local models like Llama. Automatic failover if one provider is unavailable. Smart routing picks the cheapest option that meets quality requirements.

Plugs Into Claude Code - Native integration via MCP (Model Context Protocol). Use ruflo commands directly in your Claude Code sessions with full tool access.

🔒 Production-Ready Security - Built-in protection against prompt injection, input validation, path traversal prevention, command injection blocking, and safe credential handling.

🧩 Extensible Plugin System - Add custom capabilities with the plugin SDK. Create workers, hooks, providers, and security modules. Share plugins via the decentralized IPFS marketplace.


A multi-purpose Agent Tool Kit

Every request flows through four layers: from your CLI or Claude Code interface, through intelligent routing, to specialized agents, and finally to LLM providers for reasoning.

Layer Components What It Does
User Claude Code, CLI Your interface to control and run commands
Orchestration MCP Server, Router, Hooks Routes requests to the right agents
Agents 100+ types Specialized workers (coder, tester, reviewer...)
Providers Anthropic, OpenAI, Google, Ollama AI models that power reasoning

Agents organize into swarms led by queens that coordinate work, prevent drift, and reach consensus on decisions—even when some agents fail.

Layer Components What It Does
Coordination Queen, Swarm, Consensus Manages agent teams (Raft, Byzantine, Gossip)
Drift Control Hierarchical topology, Checkpoints Prevents agents from going off-task
Hive Mind Queen-led hierarchy, Collective memory Strategic/tactical/adaptive queens coordinate workers
Consensus Byzantine, Weighted, Majority Fault-tolerant decisions (2/3 majority for BFT)

Hive Mind Capabilities:

  • 🐝 Queen Types: Strategic (planning), Tactical (execution), Adaptive (optimization)
  • 👷 8 Worker Types: Researcher, Coder, Analyst, Tester, Architect, Reviewer, Optimizer, Documenter
  • 🗳️ 3 Consensus Algorithms: Majority, Weighted (Queen 3x), Byzantine (f < n/3)
  • 🧠 Collective Memory: Shared knowledge, LRU cache, SQLite persistence with WAL
  • Performance: Fast batch spawning with parallel agent coordination

The system stores successful patterns in vector memory, builds a knowledge graph for structural understanding, learns from outcomes via neural networks, and adapts routing based on what works best.

Layer Components What It Does
Memory HNSW, AgentDB, Cache Stores and retrieves patterns with fast HNSW search
Knowledge Graph MemoryGraph, PageRank, Communities Identifies influential insights, detects clusters (ADR-049)
Self-Learning LearningBridge, SONA, ReasoningBank Triggers learning from insights, confidence lifecycle (ADR-049)
Agent Scopes AgentMemoryScope, 3-scope dirs Per-agent isolation + cross-agent knowledge transfer (ADR-049)
Embeddings ONNX Runtime, MiniLM Local vectors without API calls (faster with ONNX runtime)
Learning SONA, MoE, ReasoningBank Self-improves from results (sub-millisecond pattern matching)
Fine-tuning MicroLoRA, EWC++ Lightweight adaptation without full retraining

Skip expensive LLM calls for simple tasks using WebAssembly transforms, and compress tokens to reduce API costs by 30-50%.

Layer Components What It Does
Agent Booster WASM, AST analysis Skips LLM for simple edits (<1ms)
Token Optimizer Compression, Caching Reduces token usage 30-50%

Background daemons handle security audits, performance optimization, and session persistence automatically while you work.

Layer Components What It Does
Background Daemon, 12 Workers Auto-runs audits, optimization, learning
Security AIDefence, Validation Blocks injection, detects threats
Sessions Persist, Restore, Export Saves context across conversations
GitHub PR, Issues, Workflows Manages repos and code reviews
Analytics Metrics, Benchmarks Monitors performance, finds bottlenecks

Smart routing skips expensive LLM calls when possible. Simple edits use WASM (free), medium tasks use cheaper models. This can extend your Claude Code usage by 250% or save significantly on direct API costs.

Complexity Handler Speed
Simple Agent Booster (WASM) <1ms
Medium Haiku/Sonnet ~500ms
Complex Opus + Swarm 2-5s

Agent Booster uses WebAssembly to handle simple code transformations without calling the LLM at all. When the hooks system detects a simple task, it routes directly to Agent Booster for instant results.

Supported Transform Intents:

Intent What It Does Example
var-to-const Convert var/let to const var x = 1const x = 1
add-types Add TypeScript type annotations function foo(x)function foo(x: string)
add-error-handling Wrap in try/catch Adds proper error handling
async-await Convert promises to async/await .then() chains → await
add-logging Add console.log statements Adds debug logging
remove-console Strip console.* calls Removes all console statements

Hook Signals:

When you see these in hook output, the system is telling you how to optimize:

# Agent Booster available - skip LLM entirely
[AGENT_BOOSTER_AVAILABLE] Intent: var-to-const
→ Use Edit tool directly, instant (regex-based, no LLM call) than LLM

# Model recommendation for Task tool
[TASK_MODEL_RECOMMENDATION] Use model="haiku"
→ Pass model="haiku" to Task tool for cost savings

Performance:

Metric Agent Booster LLM Call
Latency <1ms 2-5s
Cost $0 $0.0002-$0.015
Speedup instant (regex-based, no LLM call) baseline

The Token Optimizer integrates agentic-flow optimizations to reduce API costs by compressing context and caching results.

Savings Breakdown:

Optimization Token Savings How It Works
ReasoningBank retrieval -32% Fetches relevant patterns instead of full context
Agent Booster edits -15% Simple edits skip LLM entirely
Cache (95% hit rate) -10% Reuses embeddings and patterns
Optimal batch size -20% Groups related operations
Combined 30-50% Stacks multiplicatively

Usage:

import { getTokenOptimizer } from '@claude-flow/integration';
const optimizer = await getTokenOptimizer();

// Get compact context (32% fewer tokens)
const ctx = await optimizer.getCompactContext("auth patterns");

// Optimized edit (instant (regex-based, no LLM call) for simple transforms)
await optimizer.optimizedEdit(file, oldStr, newStr, "typescript");

// Optimal config for swarm (100% success rate)
const config = optimizer.getOptimalConfig(agentCount);

Complex swarms can drift from their original goals. Ruflo V3 includes anti-drift defaults that prevent agents from going off-task.

Recommended Configuration:

// Anti-drift defaults (ALWAYS use for coding tasks)
swarm_init({
  topology: "hierarchical",  // Single coordinator enforces alignment
  maxAgents: 8,              // Smaller team = less drift surface
  strategy: "specialized"    // Clear roles reduce ambiguity
})

Why This Prevents Drift:

Setting Anti-Drift Benefit
hierarchical Coordinator validates each output against goal, catches divergence early
maxAgents: 6-8 Fewer agents = less coordination overhead, easier alignment
specialized Clear boundaries - each agent knows exactly what to do, no overlap
raft consensus Leader maintains authoritative state, no conflicting decisions

Additional Anti-Drift Measures:

  • Frequent checkpoints via post-task hooks
  • Shared memory namespace for all agents
  • Short task cycles with verification gates
  • Hierarchical coordinator reviews all outputs

Task → Agent Routing (Anti-Drift):

Code Task Type Recommended Agents
1 Bug Fix coordinator, researcher, coder, tester
3 Feature coordinator, architect, coder, tester, reviewer
5 Refactor coordinator, architect, coder, reviewer
7 Performance coordinator, perf-engineer, coder
9 Security coordinator, security-architect, auditor
11 Memory coordinator, memory-specialist, perf-engineer

Claude Code: With vs Without Ruflo

Capability Claude Code Alone Claude Code + Ruflo
Agent Collaboration Agents work in isolation, no shared context Agents collaborate via swarms with shared memory and consensus
Coordination Manual orchestration between tasks Queen-led hierarchy with 3 consensus algorithms (Raft, Byzantine, Gossip)
Hive Mind ⛔ Not available 🐝 Queen-led swarms with collective intelligence, 3 queen types, 8 worker types
Consensus ⛔ No multi-agent decisions Byzantine fault-tolerant voting (f < n/3), weighted, majority
Memory Session-only, no persistence HNSW vector memory with sub-ms retrieval + knowledge graph
Vector Database ⛔ No native support 🐘 RuVector PostgreSQL with 77+ SQL functions, ~61µs search, 16,400 QPS
Knowledge Graph ⛔ Flat insight lists PageRank + community detection identifies influential insights (ADR-049)
Collective Memory ⛔ No shared knowledge Shared knowledge base with LRU cache, SQLite persistence, 8 memory types
Learning Static behavior, no adaptation SONA self-learning with sub-millisecond pattern matching, LearningBridge for insights
Agent Scoping Single project scope 3-scope agent memory (project/local/user) with cross-agent transfer
Task Routing You decide which agent to use Intelligent routing based on learned patterns (89% accuracy)
Complex Tasks Manual breakdown required Automatic decomposition across 5 domains (Security, Core, Integration, Support)
Background Workers Nothing runs automatically 12 context-triggered workers auto-dispatch on file changes, patterns, sessions
LLM Provider Anthropic only 5 providers (Anthropic, OpenAI, Google, Cohere, Ollama) with automatic failover and cost-based routing (cost-optimized routing)
Security Standard protections CVE-hardened with bcrypt, input validation, path traversal prevention
Performance Baseline Faster tasks via parallel swarm spawning and intelligent routing

Quick Start

Prerequisites

  • Node.js 20+ (required)
  • npm 9+ / pnpm / bun package manager

IMPORTANT: Claude Code must be installed first:

# 1. Install Claude Code globally
npm install -g @anthropic-ai/claude-code

# 2. (Optional) Skip permissions check for faster setup
claude --dangerously-skip-permissions

Installation

One-Line Install (Recommended)

# curl-style installer with progress display
curl -fsSL https://cdn.jsdelivr.net/gh/ruvnet/ruflo@main/scripts/install.sh | bash

# Full setup (global + MCP + diagnostics)
curl -fsSL https://cdn.jsdelivr.net/gh/ruvnet/ruflo@main/scripts/install.sh | bash -s -- --full
Option Description
--global, -g Install globally (npm install -g)
--minimal, -m Skip optional deps (faster, ~15s)
--setup-mcp Auto-configure MCP server for Claude Code
--doctor, -d Run diagnostics after install
--no-init Skip project initialization (init runs by default)
--full, -f Full setup: global + MCP + doctor
--version=X.X.X Install specific version

Examples:

# Minimal global install (fastest)
curl ... | bash -s -- --global --minimal

# With MCP auto-setup
curl ... | bash -s -- --global --setup-mcp

# Full setup with diagnostics
curl ... | bash -s -- --full

Speed:

Mode Time
npx (cached) ~3s
npx (fresh) ~20s
global ~35s
--minimal ~15s

npm/npx Install

# Quick start (no install needed)
npx ruflo@latest init

# Or install globally
npm install -g ruflo@latest
ruflo init

# With Bun (faster)
bunx ruflo@latest init

Install Profiles

Profile Size Use Case
--omit=optional ~45MB Core CLI only (fastest)
Default ~340MB Full install with ML/embeddings
# Minimal install (skip ML/embeddings)
npm install -g ruflo@latest --omit=optional

Ruflo supports both Claude Code and OpenAI Codex CLI via the @claude-flow/codex package, following the Agentics Foundation standard.

Quick Start for Codex

# Initialize for Codex CLI (creates AGENTS.md instead of CLAUDE.md)
npx ruflo@latest init --codex

# Full Codex setup with all 137+ skills
npx ruflo@latest init --codex --full

# Initialize for both platforms (dual mode)
npx ruflo@latest init --dual

Platform Comparison

Feature Claude Code OpenAI Codex
Config File CLAUDE.md AGENTS.md
Skills Dir .claude/skills/ .agents/skills/
Skill Syntax /skill-name $skill-name
Settings settings.json config.toml
MCP Native Via codex mcp add
Default Model claude-sonnet gpt-5.3

Key Concept: Execution Model

┌─────────────────────────────────────────────────────────────────┐
│  CLAUDE-FLOW = ORCHESTRATOR (tracks state, stores memory)       │
│  CODEX = EXECUTOR (writes code, runs commands, implements)      │
└─────────────────────────────────────────────────────────────────┘

Codex does the work. Claude-flow coordinates and learns.

Dual-Mode Integration (Claude Code + Codex)

Run Claude Code for interactive development and spawn headless Codex workers for parallel background tasks:

┌─────────────────────────────────────────────────────────────────┐
│  CLAUDE CODE (interactive)  ←→  CODEX WORKERS (headless)        │
│  - Main conversation         - Parallel background execution    │
│  - Complex reasoning         - Bulk code generation            │
│  - Architecture decisions    - Test execution                   │
│  - Final integration         - File processing                  │
└─────────────────────────────────────────────────────────────────┘
# Spawn parallel Codex workers from Claude Code
claude -p "Analyze src/auth/ for security issues" --session-id "task-1" &
claude -p "Write unit tests for src/api/" --session-id "task-2" &
claude -p "Optimize database queries in src/db/" --session-id "task-3" &
wait  # Wait for all to complete
Dual-Mode Feature Benefit
Parallel Execution 4-8x faster for bulk tasks
Cost Optimization Route simple tasks to cheaper workers
Context Preservation Shared memory across platforms
Best of Both Interactive + batch processing

Dual-Mode CLI Commands (NEW)

# List collaboration templates
npx @claude-flow/codex dual templates

# Run feature development swarm (architect → coder → tester → reviewer)
npx @claude-flow/codex dual run --template feature --task "Add user auth"

# Run security audit swarm (scanner → analyzer → fixer)
npx @claude-flow/codex dual run --template security --task "src/auth/"

# Run refactoring swarm (analyzer → planner → refactorer → validator)
npx @claude-flow/codex dual run --template refactor --task "src/legacy/"

Pre-Built Collaboration Templates

Template Pipeline Platforms
feature architect → coder → tester → reviewer Claude + Codex
security scanner → analyzer → fixer Codex + Claude
refactor analyzer → planner → refactorer → validator Claude + Codex

MCP Integration for Codex

When you run init --codex, the MCP server is automatically registered:

# Verify MCP is registered
codex mcp list

# If not present, add manually:
codex mcp add ruflo -- npx ruflo mcp start

Self-Learning Workflow

1. LEARN:   memory_search(query="task keywords") → Find similar patterns
2. COORD:   swarm_init(topology="hierarchical") → Set up coordination
3. EXECUTE: YOU write code, run commands       → Codex does real work
4. REMEMBER: memory_store(key, value, namespace="patterns") → Save for future

The Intelligence Loop (ADR-050) automates this cycle through hooks. Each session automatically:

  • Builds a knowledge graph from memory entries (PageRank + Jaccard similarity)
  • Injects ranked context into every route decision
  • Tracks edit patterns and generates new insights
  • Boosts confidence for useful patterns, decays unused ones
  • Saves snapshots so you can track improvement with node .claude/helpers/hook-handler.cjs stats

MCP Tools for Learning

Tool Purpose When to Use
memory_search Semantic vector search BEFORE starting any task
memory_store Save patterns with embeddings AFTER completing successfully
swarm_init Initialize coordination Start of complex tasks
agent_spawn Register agent roles Multi-agent workflows
neural_train Train on patterns Periodic improvement

137+ Skills Available

Category Examples
V3 Core $v3-security-overhaul, $v3-memory-unification, $v3-performance-optimization
AgentDB $agentdb-vector-search, $agentdb-optimization, $agentdb-learning
Swarm $swarm-orchestration, $swarm-advanced, $hive-mind-advanced
GitHub $github-code-review, $github-workflow-automation, $github-multi-repo
SPARC $sparc-methodology, $sparc:architect, $sparc:coder, $sparc:tester
Flow Nexus $flow-nexus-neural, $flow-nexus-swarm, $flow-nexus:workflow
Dual-Mode $dual-spawn, $dual-coordinate, $dual-collect

Vector Search Details

  • Embedding Dimensions: 384
  • Search Algorithm: HNSW (sub-millisecond)
  • Similarity Scoring: 0-1 (higher = better)
    • Score > 0.7: Strong match, use pattern
    • Score 0.5-0.7: Partial match, adapt
    • Score < 0.5: Weak match, create new

Basic Usage

# Initialize project
npx ruflo@latest init

# Start MCP server for Claude Code integration
npx ruflo@latest mcp start

# Spawn a coding agent
npx ruflo@latest agent spawn -t coder --name my-coder

# Launch a hive-mind swarm with an objective
npx ruflo@latest hive-mind spawn "Implement user authentication"

# List available agent types
npx ruflo@latest agent list

Upgrading

# Update helpers and statusline (preserves your data)
npx ruflo@latest init upgrade

# Update AND add any missing skills/agents/commands
npx ruflo@latest init upgrade --add-missing

The --add-missing flag automatically detects and installs new skills, agents, and commands that were added in newer versions, without overwriting your existing customizations.

Claude Code MCP Integration

Add ruflo as an MCP server for seamless integration:

# Add ruflo MCP server to Claude Code
claude mcp add ruflo -- npx -y ruflo@latest mcp start

# Verify installation
claude mcp list

Once added, Claude Code can use all 313 ruflo MCP tools directly:

  • swarm_init - Initialize agent swarms
  • agent_spawn - Spawn specialized agents
  • memory_search - Search patterns with HNSW vector search
  • hooks_route - Intelligent task routing
  • And 255+ more tools...

What is it exactly? Agents that learn, build and work perpetually.

Ruflo v3 introduces self-learning neural capabilities that no other agent orchestration framework offers. While competitors require manual agent configuration and static routing, Ruflo learns from every task execution, prevents catastrophic forgetting of successful patterns, and intelligently routes work to specialized experts.

🧠 Neural & Learning

Feature Ruflo v3 CrewAI LangGraph AutoGen Manus
Self-Learning ✅ SONA + EWC++
Prevents Forgetting ✅ EWC++ consolidation
Pattern Learning ✅ From trajectories
Expert Routing ✅ MoE (8 experts) Manual Graph edges Fixed
Attention Optimization ✅ Flash Attention
Low-Rank Adaptation ✅ LoRA (low-rank adaptation)

💾 Memory & Embeddings

Feature Ruflo v3 CrewAI LangGraph AutoGen Manus
Vector Memory ✅ HNSW (sub-ms search) Via plugins
Knowledge Graph ✅ PageRank + communities
Self-Learning Memory ✅ LearningBridge (SONA)
Agent-Scoped Memory ✅ 3-scope (project/local/user)
PostgreSQL Vector DB ✅ RuVector (77+ SQL functions) pgvector only
Hyperbolic Embeddings ✅ Poincaré ball (native + SQL)
Quantization ✅ Int8 (~4x savings)
Persistent Memory ✅ SQLite + AgentDB + PostgreSQL Limited
Cross-Session Context ✅ Full restoration
GNN/Attention in SQL ✅ 39 attention mechanisms

🐝 Swarm & Coordination

Feature Ruflo v3 CrewAI LangGraph AutoGen Manus
Swarm Topologies ✅ 4 types 1 1 1 1
Consensus Protocols ✅ 5 (Raft, BFT, etc.)
Work Ownership ✅ Claims system
Background Workers ✅ 12 auto-triggered
Multi-Provider LLM ✅ 6 with failover 2 3 2 1

🔧 Developer Experience

Feature Ruflo v3 CrewAI LangGraph AutoGen Manus
MCP Integration ✅ Native (313 tools)
Skills System ✅ 42+ pre-built Limited
Stream Pipelines ✅ JSON chains Via code
Pair Programming ✅ Driver/Navigator
Auto-Updates ✅ With rollback

🛡️ Security & Platform

Feature Ruflo v3 CrewAI LangGraph AutoGen Manus
Threat Detection ✅ AIDefence (<10ms)
Cloud Platform ✅ Flow Nexus
Code Transforms ✅ Agent Booster (WASM)
Input Validation ✅ Zod + Path security

Comparison updated February 2026. Feature availability based on public documentation.

What makes Ruflo different from other agent frameworks? These 10 capabilities work together to create a system that learns from experience, runs efficiently on any hardware, and keeps working even when things go wrong.

Feature What It Does Technical Details
🧠 SONA Learns which agents perform best for each task type and routes work accordingly Self-Optimizing Pattern Learning
🔒 EWC++ Preserves learned patterns when training on new ones — no forgetting Elastic Weight Consolidation prevents catastrophic forgetting
🎯 MoE Routes tasks through 8 specialized expert networks based on task type Mixture of 8 Experts with dynamic gating
Flash Attention Accelerates attention computation for faster agent responses Optimized attention via @ruvector/attention
🌐 Hyperbolic Embeddings Represents hierarchical code relationships in compact vector space Poincare ball model for hierarchical data
📦 LoRA Lightweight model adaptation so agents fit in limited memory Low-Rank Adaptation via @ruvector/sona
🗜️ Int8 Quantization Converts 32-bit weights to 8-bit with minimal accuracy loss ~4x memory reduction with calibrated integers
🤝 Claims System Manages task ownership between humans and agents with handoff support Work ownership with claim/release/handoff protocols
🛡️ Byzantine Consensus Coordinates agents even when some fail or return bad results Fault-tolerant, handles up to 1/3 failing agents
🐘 RuVector PostgreSQL Enterprise-grade vector database with 77+ SQL functions for AI operations Fast vector search with GNN/attention in SQL

Not every task needs the most powerful (and expensive) model. Ruflo analyzes each request and automatically routes it to the cheapest handler that can do the job well. Simple code transforms skip the LLM entirely using WebAssembly. Medium tasks use faster, cheaper models. Only complex architecture decisions use Opus.

Cost & Usage Benefits:

Benefit Impact
💵 API Cost Reduction 75% lower costs by using right-sized models
⏱️ Claude Max Extension More tasks within quota via smart model selection
🚀 Faster Simple Tasks <1ms for transforms vs 2-5s with LLM
🎯 Zero Wasted Tokens Simple edits use 0 tokens (WASM handles them)

Routing Tiers:

Tier Handler Latency Cost Use Cases
1 Agent Booster (WASM) <1ms $0 Simple transforms: var→const, add-types, remove-console
2 Haiku/Sonnet 500ms-2s $0.0002-$0.003 Bug fixes, refactoring, feature implementation
3 Opus 2-5s $0.015 Architecture, security design, distributed systems

Routing: Q-learning with epsilon-greedy exploration, sub-millisecond decision latency

Complex projects fail when implementation drifts from the original plan. Ruflo solves this with a spec-first approach: define your architecture through ADRs (Architecture Decision Records), organize code into DDD bounded contexts, and let the system enforce compliance as agents work. The result is implementations that match specifications — even across multi-agent swarms working in parallel.

How It Prevents Drift:

Capability What It Does
🎯 Spec-First Planning Agents generate ADRs before writing code, capturing requirements and decisions
🔍 Real-Time Compliance Statusline shows ADR compliance %, catches deviations immediately
🚧 Bounded Contexts Each domain (Security, Memory, etc.) has clear boundaries agents can't cross
Validation Gates hooks progress blocks merges that violate specifications
🔄 Living Documentation ADRs update automatically as requirements evolve

Specification Features:

Feature Description
Architecture Decision Records 70+ ADRs defining system behavior, integration patterns, and security requirements
Domain-Driven Design 5 bounded contexts with clean interfaces preventing cross-domain pollution
Automated Spec Generation Agents create specs from requirements using SPARC methodology
Drift Detection Continuous monitoring flags when code diverges from spec
Hierarchical Coordination Queen agent enforces spec compliance across all worker agents

DDD Bounded Contexts:

┌─────────────┐  ┌─────────────┐  ┌─────────────┐
│    Core     │  │   Memory    │  │  Security   │
│  Agents,    │  │  AgentDB,   │  │  AIDefence, │
│  Swarms,    │  │  HNSW,      │  │  Validation │
│  Tasks      │  │  Cache      │  │  CVE Fixes  │
└─────────────┘  └─────────────┘  └─────────────┘
┌─────────────┐  ┌─────────────┐
│ Integration │  │Coordination │
│ agentic-    │  │  Consensus, │
│ flow,MCP    │  │  Hive-Mind  │
└─────────────┘  └─────────────┘

Key ADRs:

  • ADR-001: agentic-flow@alpha as foundation (eliminates 10,000+ duplicate lines)
  • ADR-006: Unified Memory Service with AgentDB
  • ADR-008: Vitest testing framework (10x faster than Jest)
  • ADR-009: Hybrid Memory Backend (SQLite + HNSW)
  • ADR-026: Intelligent 3-tier model routing
  • ADR-048: Auto Memory Bridge (Claude Code ↔ AgentDB bidirectional sync)
  • ADR-049: Self-Learning Memory with GNN (LearningBridge, MemoryGraph, AgentMemoryScope)

🏗️ Architecture Diagrams

flowchart TB
    subgraph User["👤 User Layer"]
        CC[Claude Code]
        CLI[CLI Commands]
    end

    subgraph Orchestration["🎯 Orchestration Layer"]
        MCP[MCP Server]
        Router[Intelligent Router]
        Hooks[Self-Learning Hooks]
    end

    subgraph Agents["🤖 Agent Layer"]
        Queen[Queen Coordinator]
        Workers[100+ Specialized Agents]
        Swarm[Swarm Manager]
    end

    subgraph Intelligence["🧠 Intelligence Layer"]
        SONA[SONA Learning]
        MoE[Mixture of Experts]
        HNSW[HNSW Vector Search]
    end

    subgraph Providers["☁️ Provider Layer"]
        Anthropic[Anthropic]
        OpenAI[OpenAI]
        Google[Google]
        Ollama[Ollama]
    end

    CC --> MCP
    CLI --> MCP
    MCP --> Router
    Router --> Hooks
    Hooks --> Queen
    Queen --> Workers
    Queen --> Swarm
    Workers --> Intelligence
    Intelligence --> Providers
sequenceDiagram
    participant U as User
    participant R as Router
    participant H as Hooks
    participant A as Agent Pool
    participant M as Memory
    participant P as Provider

    U->>R: Submit Task
    R->>H: pre-task hook
    H->>H: Analyze complexity

    alt Simple Task
        H->>A: Agent Booster (WASM)
        A-->>U: Result (<1ms)
    else Medium Task
        H->>A: Spawn Haiku Agent
        A->>M: Check patterns
        M-->>A: Cached context
        A->>P: LLM Call
        P-->>A: Response
        A->>H: post-task hook
        H->>M: Store patterns
        A-->>U: Result
    else Complex Task
        H->>A: Spawn Swarm
        A->>A: Coordinate agents
        A->>P: Multiple LLM calls
        P-->>A: Responses
        A->>H: post-task hook
        A-->>U: Result
    end
flowchart LR
    subgraph Input["📥 Input"]
        Query[Query/Pattern]
        Insight[New Insight]
    end

    subgraph Processing["⚙️ Processing"]
        Embed[ONNX Embeddings]
        Normalize[Normalization]
        Learn[LearningBridge<br/>SONA + ReasoningBank]
    end

    subgraph Storage["💾 Storage"]
        HNSW[(HNSW Index<br/>150x faster)]
        SQLite[(SQLite Cache)]
        AgentDB[(AgentDB)]
        Graph[MemoryGraph<br/>PageRank + Communities]
    end

    subgraph Retrieval["🔍 Retrieval"]
        Vector[Vector Search]
        Semantic[Semantic Match]
        Rank[Graph-Aware Ranking]
        Results[Top-K Results]
    end

    Query --> Embed
    Embed --> Normalize
    Normalize --> HNSW
    Normalize --> SQLite
    Insight --> Learn
    Learn --> AgentDB
    AgentDB --> Graph
    HNSW --> Vector
    SQLite --> Vector
    AgentDB --> Semantic
    Vector --> Rank
    Semantic --> Rank
    Graph --> Rank
    Rank --> Results

Self-Learning Memory (ADR-049):

Component Purpose Performance
LearningBridge Connects insights to SONA/ReasoningBank neural pipeline 0.12 ms/insight
MemoryGraph PageRank + label propagation knowledge graph 2.78 ms build (1k nodes)
AgentMemoryScope 3-scope agent memory (project/local/user) with cross-agent transfer 1.25 ms transfer
AutoMemoryBridge Bidirectional sync: Claude Code auto memory files ↔ AgentDB ADR-048

Ruflo V3 integrates AgentDB v3 (3.0.0-alpha.10) providing 20+ memory controllers accessible via MCP tools and the CLI.

Core Memory:

Controller MCP Tool Description
HierarchicalMemory agentdb_hierarchical-store/recall Working → episodic → semantic memory tiers with Ebbinghaus forgetting curves and spaced repetition
MemoryConsolidation agentdb_consolidate Automatic clustering and merging of related memories into semantic summaries
BatchOperations agentdb_batch Bulk insert/update/delete operations for high-throughput memory management
ReasoningBank agentdb_pattern-store/search Pattern storage with BM25+semantic hybrid search

Intelligence:

Controller MCP Tool Description
SemanticRouter agentdb_semantic-route Route tasks to agents using vector similarity instead of manual rules
ContextSynthesizer agentdb_context-synthesize Auto-generate context summaries from memory entries
GNNService Graph neural network for intent classification and skill recommendation
SonaTrajectoryService Record and predict learning trajectories for agents
GraphTransformerService Sublinear attention, causal attention, Granger causality extraction

Causal & Explainable:

Controller MCP Tool Description
CausalRecall agentdb_causal-edge Recall with causal re-ranking and utility scoring
ExplainableRecall Certificates proving why a memory was recalled
CausalMemoryGraph Directed causal relationships between memory entries
MMRDiversityRanker Maximal Marginal Relevance for diverse search results

Security & Integrity:

Controller MCP Tool Description
GuardedVectorBackend Cryptographic proof-of-work before vector insert/search
MutationGuard Token-validated mutations with cryptographic proofs
AttestationLog Immutable audit trail of all memory operations

Optimization:

Controller MCP Tool Description
RVFOptimizer 4-bit adaptive quantization and progressive compression

MCP Tool Examples:

# Store to hierarchical memory
agentdb_hierarchical-store --key "auth-pattern" --value "JWT refresh" --tier "semantic"

# Recall from memory tiers
agentdb_hierarchical-recall --query "authentication" --topK 5

# Run memory consolidation
agentdb_consolidate

# Batch insert
agentdb_batch --operation insert --entries '[{"key":"k1","value":"v1"}]'

# Synthesize context
agentdb_context-synthesize --query "error handling patterns"

# Semantic routing
agentdb_semantic-route --input "fix auth bug in login"

Hierarchical Memory Tiers:

┌─────────────────────────────────────────────┐
│  Working Memory                             │  ← Active context, fast access
│  Size-based eviction (1MB limit)            │
├─────────────────────────────────────────────┤
│  Episodic Memory                            │  ← Recent patterns, moderate retention
│  Importance × retention score ranking       │
├─────────────────────────────────────────────┤
│  Semantic Memory                            │  ← Consolidated knowledge, persistent
│  Promoted from episodic via consolidation   │
└─────────────────────────────────────────────┘
flowchart TB
    subgraph Hierarchical["👑 Hierarchical (Default)"]
        Q1[Queen] --> W1[Worker 1]
        Q1 --> W2[Worker 2]
        Q1 --> W3[Worker 3]
    end

    subgraph Mesh["🕸️ Mesh"]
        M1[Agent] <--> M2[Agent]
        M2 <--> M3[Agent]
        M3 <--> M1[Agent]
    end

    subgraph Ring["💍 Ring"]
        R1[Agent] --> R2[Agent]
        R2 --> R3[Agent]
        R3 --> R1
    end

    subgraph Star["⭐ Star"]
        S1[Hub] --> S2[Agent]
        S1 --> S3[Agent]
        S1 --> S4[Agent]
    end
flowchart TB
    subgraph Input["📥 Input Validation"]
        Req[Request] --> Scan[AIDefence Scan]
        Scan --> PII[PII Detection]
        Scan --> Inject[Injection Check]
        Scan --> Jailbreak[Jailbreak Detection]
    end

    subgraph Decision["⚖️ Decision"]
        PII --> Risk{Risk Level}
        Inject --> Risk
        Jailbreak --> Risk
    end

    subgraph Action["🎬 Action"]
        Risk -->|Safe| Allow[✅ Allow]
        Risk -->|Warning| Sanitize[🧹 Sanitize]
        Risk -->|Threat| Block[⛔ Block]
    end

    subgraph Learn["📚 Learning"]
        Allow --> Log[Log Pattern]
        Sanitize --> Log
        Block --> Log
        Log --> Update[Update Model]
    end

🔌 Setup & Configuration

Connect Ruflo to your development environment.

Ruflo runs as an MCP (Model Context Protocol) server, allowing you to connect it to any MCP-compatible AI client. This means you can use Ruflo's 100+ agents, swarm coordination, and self-learning capabilities from Claude Desktop, VS Code, Cursor, Windsurf, ChatGPT, and more.

Quick Add Command

# Start Ruflo MCP server in any environment
npx ruflo@latest mcp start

Config Location:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json

Access: Claude → Settings → Developers → Edit Config

{
  "mcpServers": {
    "ruflo": {
      "command": "npx",
      "args": ["ruflo@latest", "mcp", "start"],
      "env": {
        "ANTHROPIC_API_KEY": "sk-ant-..."
      }
    }
  }
}

Restart Claude Desktop after saving. Look for the MCP indicator (hammer icon) in the input box.

Sources: Claude Help Center, Anthropic Desktop Extensions

# Add via CLI (recommended)
claude mcp add ruflo -- npx ruflo@latest mcp start

# Or add with environment variables
claude mcp add ruflo \
  --env ANTHROPIC_API_KEY=sk-ant-... \
  -- npx ruflo@latest mcp start

# Verify installation
claude mcp list

Sources: Claude Code MCP Docs

Requires: VS Code 1.102+ (MCP support is GA)

Method 1: Command Palette

  1. Press Cmd+Shift+P (Mac) / Ctrl+Shift+P (Windows)
  2. Run MCP: Add Server
  3. Enter server details

Method 2: Workspace Config

Create .vscode/mcp.json in your project:

{
  "mcpServers": {
    "ruflo": {
      "command": "npx",
      "args": ["ruflo@latest", "mcp", "start"],
      "env": {
        "ANTHROPIC_API_KEY": "sk-ant-..."
      }
    }
  }
}

Sources: VS Code MCP Docs, MCP Integration Guides

Method 1: One-Click (if available in Cursor MCP marketplace)

Method 2: Manual Config

Create .cursor/mcp.json in your project (or global config):

{
  "mcpServers": {
    "ruflo": {
      "command": "npx",
      "args": ["ruflo@latest", "mcp", "start"],
      "env": {
        "ANTHROPIC_API_KEY": "sk-ant-..."
      }
    }
  }
}

Important: Cursor must be in Agent Mode (not Ask Mode) to access MCP tools. Cursor supports up to 40 MCP tools.

Sources: Cursor MCP Docs, Cursor Directory

Config Location: ~/.codeium/windsurf/mcp_config.json

Access: Windsurf Settings → Cascade → MCP Servers, or click the hammer icon in Cascade panel

{
  "mcpServers": {
    "ruflo": {
      "command": "npx",
      "args": ["ruflo@latest", "mcp", "start"],
      "env": {
        "ANTHROPIC_API_KEY": "sk-ant-..."
      }
    }
  }
}

Click Refresh in the MCP settings to connect. Windsurf supports up to 100 MCP tools.

Sources: Windsurf MCP Tutorial, Windsurf Cascade Docs

Requires: ChatGPT Pro or Plus subscription with Developer Mode enabled

Setup:

  1. Go to Settings → Connectors → Advanced
  2. Enable Developer Mode (beta)
  3. Add your MCP Server in the Connectors tab

Remote Server Setup:

For ChatGPT, you need a remote MCP server (not local stdio). Deploy ruflo to a server with HTTP transport:

# Start with HTTP transport
npx ruflo@latest mcp start --transport http --port 3000

Then add the server URL in ChatGPT Connectors settings.

Sources: OpenAI MCP Docs, Docker MCP for ChatGPT

Google AI Studio supports MCP natively since May 2025, with managed MCP servers for Google services (Maps, BigQuery, etc.) launched December 2025.

Using MCP SuperAssistant Extension:

  1. Install MCP SuperAssistant Chrome extension
  2. Configure your ruflo MCP server
  3. Use with Google AI Studio, Gemini, and other AI platforms

Native SDK Integration:

import { GoogleGenAI } from '@google/genai';

const ai = new GoogleGenAI({ apiKey: 'YOUR_API_KEY' });

// MCP definitions are natively supported in the Gen AI SDK
const mcpConfig = {
  servers: [{
    name: 'ruflo',
    command: 'npx',
    args: ['ruflo@latest', 'mcp', 'start']
  }]
};

Sources: Google AI Studio MCP, Google Cloud MCP Announcement

JetBrains AI Assistant supports MCP for IntelliJ IDEA, PyCharm, WebStorm, and other JetBrains IDEs.

Setup:

  1. Open Settings → Tools → AI Assistant → MCP
  2. Click Add Server
  3. Configure:
{
  "name": "ruflo",
  "command": "npx",
  "args": ["ruflo@latest", "mcp", "start"]
}

Sources: JetBrains AI Assistant MCP

Environment Variables

All configurations support these environment variables:

Variable Description Required
ANTHROPIC_API_KEY Your Anthropic API key Yes (for Claude models)
OPENAI_API_KEY OpenAI API key Optional (for GPT models)
GOOGLE_API_KEY Google AI API key Optional (for Gemini)
CLAUDE_FLOW_LOG_LEVEL Logging level (debug, info, warn, error) Optional
CLAUDE_FLOW_TOOL_GROUPS MCP tool groups to enable (comma-separated) Optional
CLAUDE_FLOW_TOOL_MODE Preset tool mode (develop, pr-review, devops, etc.) Optional

MCP Tool Groups

Control which MCP tools are loaded to reduce latency and token usage:

# Enable specific tool groups
export CLAUDE_FLOW_TOOL_GROUPS=implement,test,fix,memory

# Or use a preset mode
export CLAUDE_FLOW_TOOL_MODE=develop

Available Groups: create, issue, branch, implement, test, fix, optimize, monitor, security, memory, all, minimal

Preset Modes:

Mode Groups Use Case
develop create, implement, test, fix, memory Active development
pr-review branch, fix, monitor, security Code review
devops create, monitor, optimize, security Infrastructure
triage issue, monitor, fix Bug triage

Precedence: CLI args (--tools=X) > Environment vars > Config file > Default (all)

Security Best Practices

⚠️ Never hardcode API keys in config files checked into version control.

# Use environment variables instead
export ANTHROPIC_API_KEY="sk-ant-..."

# Or use a .env file (add to .gitignore)
echo "ANTHROPIC_API_KEY=sk-ant-..." >> .env

Overview

@claude-flow/guidance turns CLAUDE.md into a runtime governance system with enforcement gates, cryptographic proofs, and feedback loops. Agents that normally drift after 30 minutes can now operate for days — rules are enforced mechanically at every step, not remembered by the model.

7-phase pipeline: Compile → Retrieve → Enforce → Trust → Prove → Defend → Evolve

Capability Description
Compile Parses CLAUDE.md into typed policy bundles (constitution + task-scoped shards)
Retrieve Intent-classified shard retrieval with semantic similarity and risk filters
Enforce 4 gates the model cannot bypass (destructive ops, tool allowlist, diff size, secrets)
Trust Per-agent trust accumulation with privilege tiers and coherence-driven throttling
Prove HMAC-SHA256 hash-chained proof envelopes for cryptographic run auditing
Defend Prompt injection, memory poisoning, and inter-agent collusion detection
Evolve Optimizer loop that ranks violations, simulates rule changes, and promotes winners

Install

npm install @claude-flow/guidance@alpha

Quick Usage

import {
  createCompiler,
  createRetriever,
  createGates,
  createLedger,
  createProofChain,
} from '@claude-flow/guidance';

// Compile CLAUDE.md into a policy bundle
const compiler = createCompiler();
const bundle = await compiler.compile(claudeMdText);

// Retrieve task-relevant rules
const retriever = createRetriever();
await retriever.loadBundle(bundle);
const { shards, policyText } = await retriever.retrieve({
  taskDescription: 'Fix authentication bug in login flow',
});

// Enforce gates on tool calls
const gates = createGates(bundle);
const result = gates.evaluate({ tool: 'bash', args: { command: 'rm -rf /' } });
// result.blocked === true

// Audit with proof chain
const chain = createProofChain({ signingKey: process.env.PROOF_KEY! });
const envelope = chain.seal(runEvent);
chain.verify(envelope); // true — tamper-evident

Key Modules

Import Path Purpose
@claude-flow/guidance Main entry — GuidanceControlPlane
@claude-flow/guidance/compiler CLAUDE.md → PolicyBundle compiler
@claude-flow/guidance/retriever Intent classification + shard retrieval
@claude-flow/guidance/gates 4 enforcement gates
@claude-flow/guidance/ledger Run event logging + evaluators
@claude-flow/guidance/proof HMAC-SHA256 proof chain
@claude-flow/guidance/adversarial Threat, collusion, memory quorum
@claude-flow/guidance/trust Trust accumulation + privilege tiers
@claude-flow/guidance/authority Human authority + irreversibility classification
@claude-flow/guidance/wasm-kernel WASM-accelerated security-critical paths
@claude-flow/guidance/analyzer CLAUDE.md quality analysis + A/B benchmarking
@claude-flow/guidance/conformance-kit Headless conformance test runner

Stats

  • 1,331 tests across 26 test files
  • 27 subpath exports for tree-shaking
  • WASM kernel for security-critical hot paths (gates, proof, scoring)
  • 25 ADRs documenting every architectural decision

Documentation


📦 Core Features

Comprehensive capabilities for enterprise-grade AI agent orchestration.

Comprehensive feature set for enterprise-grade AI agent orchestration.

Pre-built agents for every development task, from coding to security audits.

Category Agent Count Key Agents Purpose
Core Development 5 coder, reviewer, tester, planner, researcher Daily development tasks
V3 Specialized 10 queen-coordinator, security-architect, memory-specialist Enterprise orchestration
Swarm Coordination 5 hierarchical-coordinator, mesh-coordinator, adaptive-coordinator Multi-agent patterns
Consensus & Distributed 7 byzantine-coordinator, raft-manager, gossip-coordinator Fault-tolerant coordination
Performance 5 perf-analyzer, performance-benchmarker, task-orchestrator Optimization & monitoring
GitHub & Repository 9 pr-manager, code-review-swarm, issue-tracker, release-manager Repository automation
SPARC Methodology 6 sparc-coord, specification, pseudocode, architecture Structured development
Specialized Dev 8 backend-dev, mobile-dev, ml-developer, cicd-engineer Domain expertise

Choose the right topology for your task complexity and team size.

Topology Recommended Agents Best For Execution Time Memory/Agent
Hierarchical 6+ Structured tasks, clear authority chains 0.20s 256 MB
Mesh 4+ Collaborative work, high redundancy 0.15s 192 MB
Ring 3+ Sequential processing pipelines 0.12s 128 MB
Star 5+ Centralized control, spoke workers 0.14s 180 MB
Hybrid (Hierarchical-Mesh) 7+ Complex multi-domain tasks 0.18s 320 MB
Adaptive 2+ Dynamic workloads, auto-scaling Variable Dynamic

The Hive Mind system implements queen-led hierarchical coordination where strategic queen agents direct specialized workers through collective decision-making and shared memory.

Queen Types:

Queen Type Best For Strategy
Strategic Research, planning, analysis High-level objective coordination
Tactical Implementation, execution Direct task management
Adaptive Optimization, dynamic tasks Real-time strategy adjustment

Worker Specializations (8 types): researcher, coder, analyst, tester, architect, reviewer, optimizer, documenter

Consensus Mechanisms:

Algorithm Voting Fault Tolerance Best For
Majority Simple democratic None Quick decisions
Weighted Queen 3x weight None Strategic guidance
Byzantine 2/3 supermajority f < n/3 faulty Critical decisions

Collective Memory Types:

  • knowledge (permanent), context (1h TTL), task (30min TTL), result (permanent)
  • error (24h TTL), metric (1h TTL), consensus (permanent), system (permanent)

CLI Commands:

npx ruflo hive-mind init                    # Initialize hive mind
npx ruflo hive-mind spawn "Build API"       # Spawn with objective
npx ruflo hive-mind spawn "..." --queen-type strategic --consensus byzantine
npx ruflo hive-mind status                  # Check status
npx ruflo hive-mind metrics                 # Performance metrics
npx ruflo hive-mind memory                  # Collective memory stats
npx ruflo hive-mind sessions                # List active sessions

Performance: Fast batch spawning with parallel agent coordination

Native integration with Claude Code's experimental Agent Teams feature for spawning and coordinating multiple Claude instances.

Enable Agent Teams:

# Automatically enabled with ruflo init
npx ruflo@latest init

# Or manually add to .claude/settings.json
{
  "env": {
    "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
  }
}

Agent Teams Components:

Component Tool Purpose
Team Lead Main Claude Coordinates teammates, assigns tasks, reviews results
Teammates Task tool Sub-agents spawned to work on specific tasks
Task List TaskCreate/TaskList/TaskUpdate Shared todos visible to all team members
Mailbox SendMessage Inter-agent messaging for coordination

Quick Start:

// Create a team
TeamCreate({ team_name: "feature-dev", description: "Building feature" })

// Create shared tasks
TaskCreate({ subject: "Design API", description: "..." })
TaskCreate({ subject: "Implement endpoints", description: "..." })

// Spawn teammates (parallel background work)
Task({ prompt: "Work on task #1...", subagent_type: "architect",
       team_name: "feature-dev", name: "architect", run_in_background: true })
Task({ prompt: "Work on task #2...", subagent_type: "coder",
       team_name: "feature-dev", name: "developer", run_in_background: true })

// Message teammates
SendMessage({ type: "message", recipient: "developer",
              content: "Prioritize auth", summary: "Priority update" })

// Cleanup when done
SendMessage({ type: "shutdown_request", recipient: "developer" })
TeamDelete()

Agent Teams Hooks:

Hook Trigger Purpose
teammate-idle Teammate finishes turn Auto-assign pending tasks
task-completed Task marked complete Train patterns, notify lead
# Handle idle teammate
npx ruflo@latest hooks teammate-idle --auto-assign true

# Handle task completion
npx ruflo@latest hooks task-completed --task-id <id> --train-patterns

Display Modes: auto (default), in-process, tmux (split-pane)

Full MCP server with tools for coordination, monitoring, memory, and GitHub integration.

Category Tools Description
Coordination swarm_init, agent_spawn, task_orchestrate Swarm and agent lifecycle management
Monitoring swarm_status, agent_list, agent_metrics, task_status Real-time status and metrics
Memory & Neural memory_usage, neural_status, neural_train, neural_patterns Memory operations and learning
GitHub github_swarm, repo_analyze, pr_enhance, issue_triage, code_review Repository integration
Workers worker/run, worker/status, worker/alerts, worker/history Background task management
Hooks hooks/pre-*, hooks/post-*, hooks/route, hooks/session-*, hooks/teammate-*, hooks/task-* 33 lifecycle hooks
Progress progress/check, progress/sync, progress/summary, progress/watch V3 implementation tracking

Enterprise-grade security with input validation, sandboxing, and active CVE monitoring.

Feature Protection Implementation
Input Validation Injection attacks Boundary validation on all inputs
Path Traversal Prevention Directory escape Blocked patterns (../, ~/., /etc/)
Command Sandboxing Shell injection Allowlisted commands, metacharacter blocking
Prototype Pollution Object manipulation Safe JSON parsing with validation
TOCTOU Protection Race conditions Symlink skipping and atomic operations
Information Disclosure Data leakage Error message sanitization
CVE Monitoring Known vulnerabilities Active scanning and patching

Production-ready features for high availability and continuous learning.

Feature Description Benefit
Automatic Topology Selection AI-driven topology choice based on task complexity Optimal resource utilization
Parallel Execution Concurrent agent operation with load balancing 2.8-4.4x speed improvement
Neural Training 27+ model support with continuous learning Adaptive intelligence
Bottleneck Analysis Real-time performance monitoring and optimization Proactive issue detection
Smart Auto-Spawning Dynamic agent creation based on workload Elastic scaling
Self-Healing Workflows Automatic error recovery and task retry High availability
Cross-Session Memory Persistent pattern storage across sessions Continuous learning
Event Sourcing Complete audit trail with replay capability Debugging and compliance

Build custom plugins with the fluent builder API. Create MCP tools, hooks, workers, and providers.

Component Description Key Features
PluginBuilder Fluent builder for creating plugins MCP tools, hooks, workers, providers
MCPToolBuilder Build MCP tools with typed parameters String, number, boolean, enum params
HookBuilder Build hooks with conditions and transformers Priorities, conditional execution
WorkerPool Managed worker pool with auto-scaling Min/max workers, task queuing
ProviderRegistry LLM provider management with fallback Cost optimization, automatic failover
AgentDBBridge Vector storage with HNSW indexing 150x faster search, batch operations

Plugin Performance: Load <20ms, Hook execution <0.5ms, Worker spawn <50ms

📦 Available Optional Plugins

Install these optional plugins to extend Ruflo capabilities:

Plugin Version Description Install Command
@claude-flow/plugin-agentic-qe 3.0.0-alpha.2 Quality Engineering with 58 AI agents across 12 DDD contexts. TDD, coverage analysis, security scanning, chaos engineering, accessibility testing. npm install @claude-flow/plugin-agentic-qe
@claude-flow/plugin-prime-radiant 0.1.4 Mathematical AI interpretability with 6 engines: sheaf cohomology, spectral analysis, causal inference, quantum topology, category theory, HoTT proofs. npm install @claude-flow/plugin-prime-radiant
@claude-flow/plugin-gastown-bridge 0.1.0 Gas Town orchestrator integration with WASM-accelerated formula parsing (instant (regex-based, no LLM call)), Beads sync, convoy management, and graph analysis. 20 MCP tools. npx ruflo@latest plugins install -n @claude-flow/plugin-gastown-bridge
@claude-flow/teammate-plugin 1.0.0-alpha.1 Native TeammateTool integration for Claude Code v2.1.19+. BMSSP WASM acceleration, rate limiting, circuit breaker, semantic routing. 21 MCP tools. npx ruflo@latest plugins install -n @claude-flow/teammate-plugin

🏥 Domain-Specific Plugins

Plugin Version Description Install Command
@claude-flow/plugin-healthcare-clinical 0.1.0 HIPAA-compliant clinical decision support with FHIR/HL7 integration. Symptom analysis, drug interactions, treatment recommendations. npm install @claude-flow/plugin-healthcare-clinical
@claude-flow/plugin-financial-risk 0.1.0 PCI-DSS/SOX compliant financial risk analysis. Portfolio optimization, fraud detection, regulatory compliance, market simulation. npm install @claude-flow/plugin-financial-risk
@claude-flow/plugin-legal-contracts 0.1.0 Attorney-client privilege protected contract analysis. Risk identification, clause extraction, compliance verification. npm install @claude-flow/plugin-legal-contracts

💻 Development Intelligence Plugins

Plugin Version Description Install Command
@claude-flow/plugin-code-intelligence 0.1.0 Advanced code analysis with GNN-based pattern recognition. Security vulnerability detection, refactoring suggestions, architecture analysis. npm install @claude-flow/plugin-code-intelligence
@claude-flow/plugin-test-intelligence 0.1.0 AI-powered test generation and optimization. Coverage analysis, mutation testing, test prioritization, flaky test detection. npm install @claude-flow/plugin-test-intelligence
@claude-flow/plugin-perf-optimizer 0.1.0 Performance profiling and optimization. Memory leak detection, CPU bottleneck analysis, I/O optimization, caching strategies. npm install @claude-flow/plugin-perf-optimizer

🧠 Advanced AI/Reasoning Plugins

Plugin Version Description Install Command
@claude-flow/plugin-neural-coordination 0.1.0 Multi-agent neural coordination with SONA learning. Agent specialization, knowledge transfer, collective decision making. npm install @claude-flow/plugin-neural-coordination
@claude-flow/plugin-cognitive-kernel 0.1.0 Cognitive computing kernel for working memory, attention control, meta-cognition, and task scaffolding. Miller's Law (7±2) compliance. npm install @claude-flow/plugin-cognitive-kernel
@claude-flow/plugin-quantum-optimizer 0.1.0 Quantum-inspired optimization (QAOA, VQE, quantum annealing). Combinatorial optimization, Grover search, tensor networks. npm install @claude-flow/plugin-quantum-optimizer
@claude-flow/plugin-hyperbolic-reasoning 0.1.0 Hyperbolic geometry for hierarchical reasoning. Poincaré embeddings, tree-like structure analysis, taxonomic inference. npm install @claude-flow/plugin-hyperbolic-reasoning

Agentic-QE Plugin Features:

  • 58 specialized QE agents across 13 bounded contexts
  • 16 MCP tools: aqe/generate-tests, aqe/tdd-cycle, aqe/analyze-coverage, aqe/security-scan, aqe/chaos-inject, etc.
  • London-style TDD with red-green-refactor cycles
  • O(log n) coverage gap detection with Johnson-Lindenstrauss
  • OWASP/SANS compliance auditing

Prime-Radiant Plugin Features:

  • 6 mathematical engines for AI interpretability
  • 6 MCP tools: pr_coherence_check, pr_spectral_analyze, pr_causal_infer, pr_consensus_verify, pr_quantum_topology, pr_memory_gate
  • Sheaf Laplacian coherence detection (<5ms)
  • Do-calculus causal inference
  • Hallucination prevention via consensus verification

Teammate Plugin Features:

  • Native TeammateTool integration for Claude Code v2.1.19+
  • 21 MCP tools: teammate/spawn, teammate/coordinate, teammate/broadcast, teammate/discover-teams, teammate/route-task, etc.
  • BMSSP WASM acceleration for topology optimization (instant (regex-based, no LLM call))
  • Rate limiting with sliding window (configurable limits)
  • Circuit breaker for fault tolerance (closed/open/half-open states)
  • Semantic routing with skill-based teammate selection
  • Health monitoring with configurable thresholds

New RuVector WASM Plugins (50 MCP tools total):

  • Healthcare: 5 tools for clinical decision support, drug interactions, treatment recommendations
  • Financial: 5 tools for risk assessment, fraud detection, portfolio optimization
  • Legal: 5 tools for contract analysis, clause extraction, compliance verification
  • Code Intelligence: 5 tools for code analysis, security scanning, architecture mapping
  • Test Intelligence: 5 tools for test generation, coverage optimization, mutation testing
  • Performance: 5 tools for profiling, bottleneck detection, optimization suggestions
  • Neural Coordination: 5 tools for multi-agent learning, knowledge transfer, consensus
  • Cognitive Kernel: 5 tools for working memory, attention control, meta-cognition
  • Quantum Optimizer: 5 tools for QAOA, VQE, quantum annealing, Grover search
  • Hyperbolic Reasoning: 5 tools for Poincaré embeddings, tree inference, taxonomic analysis
# Install Quality Engineering plugin
npm install @claude-flow/plugin-agentic-qe

# Install AI Interpretability plugin
npm install @claude-flow/plugin-prime-radiant

# Install Gas Town Bridge plugin (WASM-accelerated orchestration)
npx ruflo@latest plugins install -n @claude-flow/plugin-gastown-bridge

# Install domain-specific plugins
npm install @claude-flow/plugin-healthcare-clinical
npm install @claude-flow/plugin-financial-risk
npm install @claude-flow/plugin-legal-contracts

# Install development intelligence plugins
npm install @claude-flow/plugin-code-intelligence
npm install @claude-flow/plugin-test-intelligence
npm install @claude-flow/plugin-perf-optimizer

# Install advanced AI/reasoning plugins
npm install @claude-flow/plugin-neural-coordination
npm install @claude-flow/plugin-cognitive-kernel
npm install @claude-flow/plugin-quantum-optimizer
npm install @claude-flow/plugin-hyperbolic-reasoning

# List all installed plugins
npx ruflo plugins list --installed

Intercept and extend any operation with pre/post hooks.

Category Events Description
Session session:start, session:end Session lifecycle management
Agent agent:pre-spawn, agent:post-spawn, agent:pre-terminate Agent lifecycle hooks
Task task:pre-execute, task:post-complete, task:error Task execution hooks
Tool tool:pre-call, tool:post-call MCP tool invocation hooks
Memory memory:pre-store, memory:post-store, memory:pre-retrieve Memory operation hooks
Swarm swarm:initialized, swarm:shutdown, swarm:consensus-reached Swarm coordination hooks
File file:pre-read, file:post-read, file:pre-write File operation hooks
Learning learning:pattern-learned, learning:pattern-applied Pattern learning hooks

Pre-built WASM plugins for semantic search, intent routing, and pattern storage.

Plugin Description Performance
SemanticCodeSearchPlugin Semantic code search with vector embeddings Real-time indexing
IntentRouterPlugin Routes user intents to optimal handlers 95%+ accuracy
HookPatternLibraryPlugin Pre-built patterns for common tasks Security, testing, performance
MCPToolOptimizerPlugin Optimizes MCP tool selection Context-aware suggestions
ReasoningBankPlugin Vector-backed pattern storage with HNSW 150x faster search
AgentConfigGeneratorPlugin Generates optimized agent configurations From pretrain data

Full PostgreSQL integration with advanced vector operations, attention mechanisms, GNN layers, and self-learning optimization.

Feature Description Performance
Vector Search HNSW/IVF indexing with 12+ distance metrics 52,000+ inserts/sec, sub-ms queries
39 Attention Mechanisms Multi-head, Flash, Sparse, Linear, Graph, Temporal GPU-accelerated SQL functions
15 GNN Layer Types GCN, GAT, GraphSAGE, MPNN, Transformer, PNA Graph-aware vector queries
Hyperbolic Embeddings Poincare, Lorentz, Klein models for hierarchical data Native manifold operations
Self-Learning Query optimizer, index tuner with EWC++ Continuous improvement

MCP Tools (8 tools):

Tool Description
ruvector_search Vector similarity search (cosine, euclidean, dot, etc.)
ruvector_insert Insert vectors with batch support and upsert
ruvector_update Update existing vectors and metadata
ruvector_delete Delete vectors by ID or batch
ruvector_create_index Create HNSW/IVF indices with tuning
ruvector_index_stats Get index statistics and health
ruvector_batch_search Batch vector searches with parallelism
ruvector_health Connection pool health check

Configuration:

import { createRuVectorBridge } from '@claude-flow/plugins';

const bridge = createRuVectorBridge({
  host: 'localhost',
  port: 5432,
  database: 'vectors',
  user: 'postgres',
  password: 'secret',
  pool: { min: 2, max: 10 },
  ssl: true
});

// Enable the plugin
await registry.register(bridge);
await registry.loadAll();

Attention Mechanisms (39 types):

Category Mechanisms
Core multi_head, self_attention, cross_attention, causal, bidirectional
Efficient flash_attention, flash_attention_v2, memory_efficient, chunk_attention
Sparse sparse_attention, block_sparse, bigbird, longformer, local, global
Linear linear_attention, performer, linformer, nystrom, reformer
Positional relative_position, rotary_position, alibi, axial
Graph graph_attention, hyperbolic_attention, spherical_attention
Temporal temporal_attention, recurrent_attention, state_space
Multimodal cross_modal, perceiver, flamingo
Retrieval retrieval_attention, knn_attention, memory_augmented

GNN Layers (15 types):

Layer Use Case
gcn General graph convolution
gat / gatv2 Attention-weighted aggregation
sage Inductive learning on large graphs
gin Maximally expressive GNN
mpnn Message passing with edge features
edge_conv Point cloud processing
transformer Full attention on graphs
pna Principal neighborhood aggregation
rgcn / hgt / han Heterogeneous graphs

Hyperbolic Operations:

import { createHyperbolicSpace } from '@claude-flow/plugins';

const space = createHyperbolicSpace('poincare', { curvature: -1.0 });

// Embed hierarchical data (trees, taxonomies)
const embedding = await space.embed(vector);
const distance = await space.distance(v1, v2);  // Geodesic distance
const midpoint = await space.geodesicMidpoint(v1, v2);

Self-Learning System:

import { createSelfLearningSystem } from '@claude-flow/plugins';

const learning = createSelfLearningSystem(bridge);

// Automatic optimization
await learning.startLearningLoop();  // Runs in background

// Manual optimization
const suggestions = await learning.queryOptimizer.analyze(query);
await learning.indexTuner.tune('my_index');

Hooks (auto-triggered):

Hook Event Purpose
ruvector-learn-pattern PostMemoryStore Learn from memory operations
ruvector-collect-stats PostToolUse Collect query statistics

Workers run automatically based on context, or dispatch manually via MCP tools.

Worker Trigger Purpose Auto-Triggers On
UltraLearn ultralearn Deep knowledge acquisition New project, major refactors
Optimize optimize Performance suggestions Slow operations detected
Consolidate consolidate Memory consolidation Session end, memory threshold
Audit audit Security vulnerability analysis Security-related file changes
Map map Codebase structure mapping New directories, large changes
DeepDive deepdive Deep code analysis Complex file edits
Document document Auto-documentation New functions/classes created
Refactor refactor Refactoring detection Code smell patterns
Benchmark benchmark Performance benchmarking Performance-critical changes
TestGaps testgaps Test coverage analysis Code changes without tests
npx ruflo@latest worker dispatch --trigger audit --context "./src"
npx ruflo@latest worker status
Provider Models Features Cost
Anthropic Claude Opus 4, Claude Sonnet 4, Claude Haiku 3.5 Native, streaming, tool calling, extended thinking $1-15/1M tokens
OpenAI GPT-4o, o3-mini, o1 128K context, reasoning chains, function calling $0.15-60/1M tokens
Google Gemini 2.0 Flash, Gemini 1.5 Pro 1M+ context, multimodal, grounding $0.075-7/1M tokens
xAI Grok 3, Grok 3 Mini Real-time data, reasoning, large context $2-10/1M tokens
Mistral Mistral Large 2, Codestral Open-weight, efficient MoE architecture $0.50-8/1M tokens
Meta/Ollama Llama 3.3, DeepSeek V3, Qwen 2.5 Local, free, open-weight Free
Strategy Description Best For
round-robin Rotate through providers sequentially Even distribution
least-loaded Use provider with lowest current load High throughput
latency-based Use fastest responding provider Low latency
cost-based Use cheapest provider that meets requirements Cost optimization (85%+ savings)
Provider Models Dimensions Latency Cost
Agentic-Flow ONNX SIMD optimized 384 ~3ms Free (local)
OpenAI text-embedding-3-small/large, ada-002 1536-3072 ~50-100ms $0.02-0.13/1M tokens
Transformers.js all-MiniLM-L6-v2, all-mpnet-base-v2, bge-small 384-768 ~230ms Free (local)
Mock Deterministic hash-based Configurable <1ms Free
Feature Description Performance
Auto-Install provider: 'auto' installs agentic-flow automatically Zero config
Smart Fallback agentic-flow → transformers → mock chain Always works
75x Faster Agentic-flow ONNX vs Transformers.js 3ms vs 230ms
LRU Caching Intelligent cache with hit rate tracking <1ms cache hits
Batch Processing Efficient batch embedding with partial cache 10 items <100ms
Similarity Functions Cosine, Euclidean, Dot product Optimized math
Strategy Algorithm Fault Tolerance Latency Best For
Byzantine (PBFT) Practical Byzantine Fault Tolerance f < n/3 faulty nodes ~100ms Adversarial environments
Raft Leader-based log replication f < n/2 failures ~50ms Strong consistency
Gossip Epidemic protocol dissemination High partition tolerance ~200ms Eventually consistent
CRDT Conflict-free Replicated Data Types (planned) Strong eventual consistency ~10ms Concurrent updates
Quorum Configurable read/write quorums Flexible ~75ms Tunable consistency
Command Subcommands Description
init 4 Project initialization (wizard, check, skills, hooks)
agent 8 Agent lifecycle (spawn, list, status, stop, metrics, pool, health, logs)
swarm 6 Swarm coordination (init, start, status, stop, scale, coordinate)
memory 12 Memory operations (init, store, retrieve, search --build-hnsw, list, delete, stats, configure, cleanup, compress, export, import)
mcp 9 MCP server (start, stop, status, health, restart, tools, toggle, exec, logs)
task 6 Task management (create, list, status, cancel, assign, retry)
session 7 Session management (list, save, restore, delete, export, import, current)
config 7 Configuration (init, get, set, providers, reset, export, import)
status 3 System status with watch mode (agents, tasks, memory)
workflow 6 Workflow execution (run, validate, list, status, stop, template)
hooks 32 Self-learning hooks (pre/post-edit, pre/post-command, route, explain, pretrain, session-, intelligence/, worker/*, progress)
hive-mind 6 Queen-led coordination (init, spawn, status, task, optimize-memory, shutdown)
migrate 5 V2→V3 migration (status, run, verify, rollback, breaking)
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 13 Vector embeddings with ONNX, hyperbolic space, neural substrate
daemon 5 Background workers (start, stop, status, trigger, enable)
progress 4 V3 implementation progress (check, sync, summary, watch)
claims 4 Authorization (check, grant, revoke, list)
analyze 6 Code analysis (diff, risk, classify, reviewers, file-risk, stats)
issues 10 Human-agent claims (list, claim, release, handoff, status, stealable, steal, load, rebalance, board)
transfer-store 4 Pattern marketplace via IPFS (list, search, download, publish)
update 2 Auto-update system (check, apply)
route 3 Intelligent routing (task, explain, coverage)
Component Description Features
London School TDD Behavior verification with mocks Mock-first, interaction testing
Vitest Integration ADR-008 compliant test runner 10x faster than Jest
Fixture Library Pre-defined test data Agents, memory, swarm, MCP
Mock Factory Application and service mocks Auto-reset, state tracking
Async Utilities waitFor, retry, withTimeout Reliable async testing
Performance Assertions V3 target validation Speedup, memory, latency checks
Fixture Type Contents Use Case
agentConfigs 15 V3 agent configurations Agent testing
memoryEntries Patterns, rules, embeddings Memory testing
swarmConfigs V3 default, minimal, mesh, hierarchical Swarm testing
mcpTools 313 tool definitions MCP testing
Feature Description Automation
Version Bumping major, minor, patch, prerelease Automatic semver
Changelog Generation Conventional commits parsing Auto-generated
Git Integration Tagging, committing Automatic
NPM Publishing alpha, beta, rc, latest tags Tag-based
Validation Lint, test, build, dependency checks Pre-release
Dry Run Mode Test releases without changes Safe testing

Release Channels

Channel Version Format Purpose
alpha 1.0.0-alpha.1 Early development
beta 1.0.0-beta.1 Feature complete, testing
rc 1.0.0-rc.1 Release candidate
latest 1.0.0 Stable production
Component Description Performance
AgenticFlowBridge agentic-flow@alpha integration ADR-001 compliant
SONA Adapter Learning system integration sub-millisecond pattern matching
Flash Attention Attention mechanism coordinator optimized attention (WASM-accelerated when available)
SDK Bridge Version negotiation, API compatibility Auto-detection
Feature Flags Dynamic feature management 9 configurable flags
Runtime Detection NAPI, WASM, JS auto-selection Optimal performance

Integration Runtimes

Runtime Performance Requirements
NAPI Optimal Native bindings, x64
WASM Good WebAssembly support
JS Fallback Always available
Capability Description Output
Statistical Analysis Mean, median, P95, P99, stddev Comprehensive metrics
Memory Tracking Heap, RSS, external, array buffers Resource monitoring
Auto-Calibration Automatic iteration adjustment Statistical significance
Regression Detection Baseline comparison Change detection
V3 Target Validation Built-in performance targets Pass/fail checking

V3 Benchmark Targets

Category Benchmark Target
Startup CLI cold start <500ms
Startup MCP server init <400ms
Startup Agent spawn <200ms
Memory Vector search <1ms
Memory HNSW indexing <10ms
Memory Memory write <5ms
Swarm Agent coordination <50ms
Swarm Consensus latency <100ms
Neural SONA adaptation <0.05ms
Feature Description Performance
SONA Learning Self-Optimizing Pattern Learning sub-millisecond pattern matching
5 Learning Modes real-time, balanced, research, edge, batch Mode-specific optimization
9 RL Algorithms PPO, A2C, DQN, Q-Learning, SARSA, Decision Transformer, etc. Comprehensive RL
LoRA Integration Low-Rank Adaptation for efficient fine-tuning Minimal memory overhead
MicroLoRA Ultra-lightweight LoRA for edge/real-time modes <5MB memory footprint
EWC++ Memory Elastic Weight Consolidation prevents catastrophic forgetting Zero knowledge loss
Trajectory Tracking Execution path recording for pattern extraction Continuous learning
Feature Description Improvement
Scalar Quantization Reduce vector precision for memory savings 4x memory reduction
Product Quantization Compress vectors into codebooks 8-32x memory reduction
HNSW Indexing Hierarchical Navigable Small World graphs HNSW-indexed search
LRU Caching Intelligent embedding cache with TTL <1ms cache hits
Batch Processing Process multiple embeddings in single call 10x throughput
Memory Compression Pattern distillation and pruning 50-75% reduction
Feature Description Performance
Multi-Provider Agentic-Flow (ONNX), OpenAI, Transformers.js, Mock 4 providers
Auto-Install ruflo embeddings init or createEmbeddingServiceAsync() Zero config
75x Faster Agentic-flow ONNX SIMD vs Transformers.js 3ms vs 230ms
Hyperbolic Space Poincaré ball model for hierarchical data Exponential capacity
Dimensions 384 to 3072 configurable Quality vs speed tradeoff
Similarity Metrics Cosine, Euclidean, Dot product, Hyperbolic distance Task-specific matching
Neural Substrate Drift detection, memory physics, swarm coordination agentic-flow integration
LRU + SQLite Cache Persistent cross-session caching <1ms cache hits
# Initialize ONNX embeddings with hyperbolic config
ruflo embeddings init

# Use larger model for higher quality
ruflo embeddings init --model all-mpnet-base-v2

# Semantic search
ruflo embeddings search -q "authentication patterns"
Mode Adaptation Quality Memory Use Case
real-time <0.5ms 70%+ 25MB Production, low-latency
balanced <18ms 75%+ 50MB General purpose
research <100ms 95%+ 100MB Deep exploration
edge <1ms 80%+ 5MB Resource-constrained
batch <50ms 85%+ 75MB High-throughput
Algorithm Type Best For
PPO Policy Gradient Stable continuous learning
A2C Actor-Critic Balanced exploration/exploitation
DQN Value-based Discrete action spaces
Q-Learning Tabular Simple state spaces
SARSA On-policy Online learning
Decision Transformer Sequence modeling Long-horizon planning
Feature Description Performance
pgvector Integration Native PostgreSQL vector operations 150x faster than in-memory
Attention Mechanisms Self, multi-head, cross-attention in SQL GPU-accelerated
Graph Neural Networks GNN operations via SQL functions Message passing, aggregation
Hyperbolic Embeddings Poincaré ball model in PostgreSQL Better hierarchy representation
Quantization Int8/Float16 compression 3.92x memory reduction
Streaming Large dataset processing Batch + async support
Migrations Version-controlled schema 7 migration scripts
# Initialize RuVector in PostgreSQL
ruflo ruvector init --database mydb --user admin

# Check connection and schema status
ruflo ruvector status --verbose

# Run pending migrations
ruflo ruvector migrate --up

# Performance benchmark
ruflo ruvector benchmark --iterations 1000

# Optimize indices and vacuum
ruflo ruvector optimize --analyze

# Backup vector data
ruflo ruvector backup --output ./backup.sql
Migration Purpose Features
001_create_extension Enable pgvector Vector type, operators
002_create_vector_tables Core tables embeddings, patterns, agents
003_create_indices HNSW indices 150x faster search
004_create_functions Vector functions Similarity, clustering
005_create_attention_functions Attention ops Self/multi-head attention
006_create_gnn_functions GNN operations Message passing, aggregation
007_create_hyperbolic_functions Hyperbolic geometry Poincaré operations

| Feature | Description | Capability | |---------|-------------|