ruflo

šŸ”„ Migration Guide (V2 → V3)

/docs/help--resources/migration-guide-v2--v3

Why Migrate to V3?

ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│                    V2 → V3 IMPROVEMENTS                     │
ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤
│ Memory Search         │ 150x - 12,500x faster (HNSW)        │
│ Pattern Matching      │ Self-learning (ReasoningBank)       │
│ Security              │ CVE remediation + strict validation │
│ Modular Architecture  │ 18 @claude-flow/* packages          │
│ Agent Coordination    │ 16 specialized agent roles + custom types              │
│ Token Efficiency      │ 32% reduction with optimization     │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

Breaking Changes

ChangeV2V3Impact
Package Structureruflo@claude-flow/* (scoped)Update imports
Memory BackendJSON filesAgentDB + HNSWFaster search
Hooks SystemBasic patternsReasoningBank + SONASelf-learning
SecurityManual validationAutomatic strict modeMore secure
CLI CommandsFlat structureNested subcommandsNew syntax
Config Format.ruflo/config.jsonclaude-flow.config.jsonUpdate path

Step-by-Step Migration

bash
# STEP 1: Backup existing data (CRITICAL)
cp -r ./data ./data-backup-v2
cp -r ./.ruflo ./.ruflo-backup-v2

# STEP 2: Check migration status
npx ruflo@latest migrate status

# STEP 3: Run migration with dry-run first
npx ruflo@latest migrate run --dry-run

# STEP 4: Execute migration
npx ruflo@latest migrate run --from v2

# STEP 5: Verify migration
npx ruflo@latest migrate verify

# STEP 6: Initialize V3 learning
npx ruflo@latest hooks pretrain
npx ruflo@latest doctor --fix

Command Changes Reference

V2 CommandV3 CommandNotes
ruflo startruflo mcp startMCP is explicit
ruflo initruflo init wizardInteractive setup (subcommand, not a flag)
ruflo spawn <type>ruflo agent spawn -t <type>Nested under agent
ruflo swarm createruflo swarm init --topology meshExplicit topology
--pattern-store path--memory-backend agentdbBackend selection
hooks recordhooks post-edit --success trueExplicit success flag
memory get <key>memory retrieve --key <key>Explicit flag
memory set <key> <value>memory store --key <key> --value <value>Explicit flags
neural learnhooks intelligence --mode learnUnder hooks
config set key valueconfig set --key key --value valueExplicit flags

Configuration Migration

V2 Config (.ruflo/config.json):

json
{
  "mode": "basic",
  "patternStore": "./patterns",
  "maxAgents": 10
}

V3 Config (claude-flow.config.json):

json
{
  "version": "3.0.0",
  "memory": {
    "type": "hybrid",
    "path": "./data",
    "hnsw": { "m": 16, "ef": 200 }
  },
  "swarm": {
    "topology": "hierarchical",
    "maxAgents": 15,
    "strategy": "specialized"
  },
  "security": { "mode": "strict" },
  "neural": { "enabled": true, "sona": true }
}

Import Changes

typescript
// V2 (deprecated)
import { ClaudeFlow, Agent, Memory } from 'ruflo';

// V3 (new)
import { ClaudeFlowClient } from '@claude-flow/cli';
import { AgentDB } from '@claude-flow/memory';
import { ThreatDetector } from '@claude-flow/security';
import { HNSWIndex } from '@claude-flow/embeddings';

Rollback Procedure

If migration fails, you can rollback:

bash
# Check rollback options
npx ruflo@latest migrate rollback --list

# Rollback to V2
npx ruflo@latest migrate rollback --to v2

# Restore backup manually if needed
rm -rf ./data
cp -r ./data-backup-v2 ./data

Post-Migration Checklist

  • Verify all agents spawn correctly: npx ruflo@latest agent list
  • Check memory search works: npx ruflo@latest memory search -q "test"
  • Confirm MCP server starts: npx ruflo@latest mcp start
  • Run doctor diagnostics: npx ruflo@latest doctor
  • Test a simple swarm: npx ruflo@latest swarm init --topology mesh
  • Bootstrap learning: npx ruflo@latest hooks pretrain

Common Migration Issues

IssueCauseSolution
MODULE_NOT_FOUNDOld package referencesUpdate imports to @claude-flow/*
Config not foundPath changeRename to claude-flow.config.json
Memory backend errorSchema changeRun migrate run to convert
Hooks not workingNew hook namesUse new hook commands
Agent spawn failsType name changesCheck agent list for new types