mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-23 21:59:14 +09:00
Checkpoint: File edits
Automatic checkpoint created by Claude Code - Branch: v3 - Timestamp: 2026-01-07T05:30:57Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6de5570e28
commit
1d74697ca3
1 file changed
+216
-360
@@ -13,7 +13,7 @@ export function generateClaudeMd(options: InitOptions): string {
|
||||
const maxAgents = options.runtime.maxAgents;
|
||||
const memoryBackend = options.runtime.memoryBackend;
|
||||
|
||||
return `# Claude Code Configuration - SPARC Development Environment
|
||||
return `# Claude Code Configuration - Claude Flow V3
|
||||
|
||||
## 🚨 AUTOMATIC SWARM ORCHESTRATION
|
||||
|
||||
@@ -74,15 +74,14 @@ mcp__claude-flow__memory_usage({
|
||||
|
||||
### 📋 Agent Routing by Task Type
|
||||
|
||||
**Automatically select agents based on task:**
|
||||
|
||||
| Task Type | Required Agents | Topology |
|
||||
|-----------|-----------------|----------|
|
||||
| Bug Fix | researcher, coder, tester | mesh |
|
||||
| New Feature | coordinator, architect, coder, tester, reviewer | hierarchical |
|
||||
| Refactoring | architect, coder, reviewer | mesh |
|
||||
| Performance | researcher, coder, perf-analyzer | hierarchical |
|
||||
| Security Audit | security-manager, reviewer, tester | hierarchical |
|
||||
| Performance | researcher, performance-engineer, coder | hierarchical |
|
||||
| Security Audit | security-architect, security-auditor, reviewer | hierarchical |
|
||||
| Memory Optimization | memory-specialist, performance-engineer | mesh |
|
||||
| Documentation | researcher, api-docs | mesh |
|
||||
|
||||
### 🎯 Task Complexity Detection
|
||||
@@ -103,36 +102,6 @@ mcp__claude-flow__memory_usage({
|
||||
- Configuration changes
|
||||
- Quick questions/exploration
|
||||
|
||||
### 🔧 Settings Configuration
|
||||
|
||||
The following settings are auto-configured in \`.claude/settings.json\`:
|
||||
|
||||
\`\`\`json
|
||||
{
|
||||
"hooks": {
|
||||
"PreToolUse": [{
|
||||
"matcher": "Task",
|
||||
"commands": ["npx claude-flow@v3alpha hooks pre-task --tool Task"]
|
||||
}],
|
||||
"PostToolUse": [{
|
||||
"matcher": "Task",
|
||||
"commands": ["npx claude-flow@v3alpha hooks post-task --tool Task"]
|
||||
}],
|
||||
"UserPromptSubmit": [{
|
||||
"matcher": ".*",
|
||||
"commands": ["npx claude-flow@v3alpha hooks route-task"]
|
||||
}]
|
||||
},
|
||||
"permissions": {
|
||||
"allow": [
|
||||
"Bash(npx claude-flow:*)",
|
||||
"mcp__claude-flow__*",
|
||||
"mcp__ruv-swarm__*"
|
||||
]
|
||||
}
|
||||
}
|
||||
\`\`\`
|
||||
|
||||
## 🚨 CRITICAL: CONCURRENT EXECUTION & FILE MANAGEMENT
|
||||
|
||||
**ABSOLUTE RULES**:
|
||||
@@ -150,24 +119,6 @@ The following settings are auto-configured in \`.claude/settings.json\`:
|
||||
- **Bash commands**: ALWAYS batch ALL terminal operations in ONE message
|
||||
- **Memory operations**: ALWAYS batch ALL memory store/retrieve in ONE message
|
||||
|
||||
### 🎯 CRITICAL: Claude Code Task Tool for Agent Execution
|
||||
|
||||
**Claude Code's Task tool is the PRIMARY way to spawn agents:**
|
||||
\`\`\`javascript
|
||||
// ✅ CORRECT: Use Claude Code's Task tool for parallel agent execution
|
||||
[Single Message]:
|
||||
Task("Research agent", "Analyze requirements and patterns...", "researcher")
|
||||
Task("Coder agent", "Implement core features...", "coder")
|
||||
Task("Tester agent", "Create comprehensive tests...", "tester")
|
||||
Task("Reviewer agent", "Review code quality...", "reviewer")
|
||||
Task("Architect agent", "Design system architecture...", "system-architect")
|
||||
\`\`\`
|
||||
|
||||
**MCP tools are ONLY for coordination setup:**
|
||||
- \`mcp__claude-flow__swarm_init\` - Initialize coordination topology
|
||||
- \`mcp__claude-flow__agent_spawn\` - Define agent types for coordination
|
||||
- \`mcp__claude-flow__task_orchestrate\` - Orchestrate high-level workflows
|
||||
|
||||
### 📁 File Organization Rules
|
||||
|
||||
**NEVER save to root folder. Use these directories:**
|
||||
@@ -184,30 +135,81 @@ This project is configured with Claude Flow V3:
|
||||
- **Topology**: ${topology}
|
||||
- **Max Agents**: ${maxAgents}
|
||||
- **Memory Backend**: ${memoryBackend}
|
||||
- **HNSW Indexing**: ${options.runtime.enableHNSW ? 'Enabled' : 'Disabled'}
|
||||
- **Neural Learning**: ${options.runtime.enableNeural ? 'Enabled' : 'Disabled'}
|
||||
- **HNSW Indexing**: ${options.runtime.enableHNSW ? 'Enabled (150x-12,500x faster)' : 'Disabled'}
|
||||
- **Neural Learning**: ${options.runtime.enableNeural ? 'Enabled (SONA)' : 'Disabled'}
|
||||
|
||||
## SPARC Workflow Phases
|
||||
## 🚀 V3 CLI Commands (26 Commands, 140+ Subcommands)
|
||||
|
||||
1. **Specification** - Requirements analysis (\`sparc run spec-pseudocode\`)
|
||||
2. **Pseudocode** - Algorithm design (\`sparc run spec-pseudocode\`)
|
||||
3. **Architecture** - System design (\`sparc run architect\`)
|
||||
4. **Refinement** - TDD implementation (\`sparc tdd\`)
|
||||
5. **Completion** - Integration (\`sparc run integration\`)
|
||||
### Core Commands
|
||||
|
||||
## Code Style & Best Practices
|
||||
| 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 |
|
||||
| \`workflow\` | 6 | Workflow execution and template management |
|
||||
| \`hooks\` | 17 | Self-learning hooks + 12 background workers |
|
||||
| \`hive-mind\` | 6 | Queen-led Byzantine fault-tolerant consensus |
|
||||
|
||||
- **Modular Design**: Files under 500 lines
|
||||
- **Environment Safety**: Never hardcode secrets
|
||||
- **Test-First**: Write tests before implementation
|
||||
- **Clean Architecture**: Separate concerns
|
||||
- **Documentation**: Keep updated
|
||||
### Advanced Commands
|
||||
|
||||
## 🚀 Available Agents
|
||||
| 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 |
|
||||
| \`doctor\` | 1 | System diagnostics with health checks |
|
||||
| \`completions\` | 4 | Shell completions (bash, zsh, fish, powershell) |
|
||||
|
||||
### Quick CLI Examples
|
||||
|
||||
\`\`\`bash
|
||||
# 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
|
||||
\`\`\`
|
||||
|
||||
## 🚀 Available Agents (60+ Types)
|
||||
|
||||
### Core Development
|
||||
\`coder\`, \`reviewer\`, \`tester\`, \`planner\`, \`researcher\`
|
||||
|
||||
### V3 Specialized Agents
|
||||
\`security-architect\`, \`security-auditor\`, \`memory-specialist\`, \`performance-engineer\`
|
||||
|
||||
### Swarm Coordination
|
||||
\`hierarchical-coordinator\`, \`mesh-coordinator\`, \`adaptive-coordinator\`, \`collective-intelligence-coordinator\`, \`swarm-memory-manager\`
|
||||
|
||||
@@ -229,277 +231,67 @@ This project is configured with Claude Flow V3:
|
||||
### Testing & Validation
|
||||
\`tdd-london-swarm\`, \`production-validator\`
|
||||
|
||||
## 🎯 Claude Code vs MCP Tools
|
||||
|
||||
### Claude Code Handles ALL EXECUTION:
|
||||
- **Task tool**: Spawn and run agents concurrently for actual work
|
||||
- File operations (Read, Write, Edit, MultiEdit, Glob, Grep)
|
||||
- Code generation and programming
|
||||
- Bash commands and system operations
|
||||
- Implementation work
|
||||
- Project navigation and analysis
|
||||
- TodoWrite and task management
|
||||
- Git operations
|
||||
- Package management
|
||||
- Testing and debugging
|
||||
|
||||
### MCP Tools ONLY COORDINATE:
|
||||
- Swarm initialization (topology setup)
|
||||
- Agent type definitions (coordination patterns)
|
||||
- Task orchestration (high-level planning)
|
||||
- Memory management
|
||||
- Neural features
|
||||
- Performance tracking
|
||||
- GitHub integration
|
||||
|
||||
**KEY**: MCP coordinates the strategy, Claude Code's Task tool executes with real agents.
|
||||
|
||||
## 🚀 Quick Setup
|
||||
|
||||
\`\`\`bash
|
||||
# Add MCP servers (Claude Flow required, others optional)
|
||||
claude mcp add claude-flow npx claude-flow@v3alpha mcp start
|
||||
claude mcp add ruv-swarm npx ruv-swarm mcp start # Optional: Enhanced coordination
|
||||
claude mcp add flow-nexus npx flow-nexus@latest mcp start # Optional: Cloud features
|
||||
\`\`\`
|
||||
|
||||
## MCP Tool Categories
|
||||
|
||||
### Coordination
|
||||
\`swarm_init\`, \`agent_spawn\`, \`task_orchestrate\`
|
||||
|
||||
### Monitoring
|
||||
\`swarm_status\`, \`agent_list\`, \`agent_metrics\`, \`task_status\`, \`task_results\`
|
||||
|
||||
### Memory & Neural
|
||||
\`memory_usage\`, \`neural_status\`, \`neural_train\`, \`neural_patterns\`
|
||||
|
||||
### GitHub Integration
|
||||
\`github_swarm\`, \`repo_analyze\`, \`pr_enhance\`, \`issue_triage\`, \`code_review\`
|
||||
|
||||
### System
|
||||
\`benchmark_run\`, \`features_detect\`, \`swarm_monitor\`
|
||||
|
||||
## 🚀 Agent Execution Flow with Claude Code
|
||||
|
||||
### The Correct Pattern:
|
||||
|
||||
1. **Optional**: Use MCP tools to set up coordination topology
|
||||
2. **REQUIRED**: Use Claude Code's Task tool to spawn agents that do actual work
|
||||
3. **REQUIRED**: Each agent runs hooks for coordination
|
||||
4. **REQUIRED**: Batch all operations in single messages
|
||||
|
||||
### Example Full-Stack Development:
|
||||
|
||||
\`\`\`javascript
|
||||
// Single message with all agent spawning via Claude Code's Task tool
|
||||
[Parallel Agent Execution]:
|
||||
Task("Backend Developer", "Build REST API with Express. Use hooks for coordination.", "backend-dev")
|
||||
Task("Frontend Developer", "Create React UI. Coordinate with backend via memory.", "coder")
|
||||
Task("Database Architect", "Design PostgreSQL schema. Store schema in memory.", "code-analyzer")
|
||||
Task("Test Engineer", "Write Jest tests. Check memory for API contracts.", "tester")
|
||||
Task("DevOps Engineer", "Setup Docker and CI/CD. Document in memory.", "cicd-engineer")
|
||||
Task("Security Auditor", "Review authentication. Report findings via hooks.", "reviewer")
|
||||
|
||||
// All todos batched together
|
||||
TodoWrite { todos: [...8-10 todos...] }
|
||||
|
||||
// All file operations together
|
||||
Write "backend/server.js"
|
||||
Write "frontend/App.jsx"
|
||||
Write "database/schema.sql"
|
||||
\`\`\`
|
||||
|
||||
## 📋 Agent Coordination Protocol
|
||||
|
||||
### Every Agent Spawned via Task Tool MUST:
|
||||
|
||||
**1️⃣ BEFORE Work:**
|
||||
\`\`\`bash
|
||||
npx claude-flow@v3alpha hooks pre-task --description "[task]"
|
||||
npx claude-flow@v3alpha hooks session-restore --session-id "swarm-[id]"
|
||||
\`\`\`
|
||||
|
||||
**2️⃣ DURING Work:**
|
||||
\`\`\`bash
|
||||
npx claude-flow@v3alpha hooks post-edit --file "[file]" --memory-key "swarm/[agent]/[step]"
|
||||
npx claude-flow@v3alpha hooks notify --message "[what was done]"
|
||||
\`\`\`
|
||||
|
||||
**3️⃣ AFTER Work:**
|
||||
\`\`\`bash
|
||||
npx claude-flow@v3alpha hooks post-task --task-id "[task]"
|
||||
npx claude-flow@v3alpha hooks session-end --export-metrics true
|
||||
\`\`\`
|
||||
|
||||
## 🚀 Swarm Lifecycle Management
|
||||
|
||||
### Session Start (AUTOMATIC)
|
||||
When beginning ANY development task, Claude Code should:
|
||||
|
||||
\`\`\`javascript
|
||||
// 1. Check for existing swarm session
|
||||
mcp__claude-flow__swarm_status({})
|
||||
|
||||
// 2. If no active swarm, initialize one
|
||||
mcp__claude-flow__swarm_init({ topology: "${topology}", maxAgents: ${maxAgents} })
|
||||
|
||||
// 3. Restore previous context if available
|
||||
mcp__claude-flow__memory_usage({ action: "retrieve", namespace: "swarm", key: "last-session" })
|
||||
\`\`\`
|
||||
|
||||
### Task Execution (AUTOMATIC)
|
||||
For each significant task:
|
||||
|
||||
\`\`\`javascript
|
||||
// 1. Create task orchestration
|
||||
mcp__claude-flow__task_orchestrate({
|
||||
task: "[task description]",
|
||||
priority: "high",
|
||||
strategy: "adaptive"
|
||||
})
|
||||
|
||||
// 2. Spawn appropriate agents via Task tool (PARALLEL)
|
||||
Task("Agent1", "...", "agent-type")
|
||||
Task("Agent2", "...", "agent-type")
|
||||
Task("Agent3", "...", "agent-type")
|
||||
|
||||
// 3. Monitor progress via MCP
|
||||
mcp__claude-flow__swarm_status({ includeAgents: true, includeMetrics: true })
|
||||
\`\`\`
|
||||
|
||||
### Session End (AUTOMATIC)
|
||||
When task completes or user ends session:
|
||||
|
||||
\`\`\`javascript
|
||||
// 1. Save session state
|
||||
mcp__claude-flow__memory_usage({
|
||||
action: "store",
|
||||
namespace: "swarm",
|
||||
key: "last-session",
|
||||
value: JSON.stringify({ completedAt: new Date().toISOString(), summary: "..." })
|
||||
})
|
||||
|
||||
// 2. Export metrics if enabled
|
||||
mcp__claude-flow__agent_metrics({})
|
||||
|
||||
// 3. Graceful shutdown (only if explicitly requested)
|
||||
// mcp__claude-flow__swarm_destroy({ swarmId: "..." })
|
||||
\`\`\`
|
||||
|
||||
## 🎯 Concurrent Execution Examples
|
||||
|
||||
### ✅ CORRECT WORKFLOW: MCP Coordinates, Claude Code Executes
|
||||
|
||||
\`\`\`javascript
|
||||
// Step 1: MCP tools set up coordination (optional, for complex tasks)
|
||||
[Single Message - Coordination Setup]:
|
||||
mcp__claude-flow__swarm_init { topology: "${topology}", maxAgents: ${maxAgents} }
|
||||
mcp__claude-flow__agent_spawn { type: "researcher" }
|
||||
mcp__claude-flow__agent_spawn { type: "coder" }
|
||||
mcp__claude-flow__agent_spawn { type: "tester" }
|
||||
|
||||
// Step 2: Claude Code Task tool spawns ACTUAL agents that do the work
|
||||
[Single Message - Parallel Agent Execution]:
|
||||
// Claude Code's Task tool spawns real agents concurrently
|
||||
Task("Research agent", "Analyze API requirements and best practices. Check memory for prior decisions.", "researcher")
|
||||
Task("Coder agent", "Implement REST endpoints with authentication. Coordinate via hooks.", "coder")
|
||||
Task("Database agent", "Design and implement database schema. Store decisions in memory.", "code-analyzer")
|
||||
Task("Tester agent", "Create comprehensive test suite with 90% coverage.", "tester")
|
||||
Task("Reviewer agent", "Review code quality and security. Document findings.", "reviewer")
|
||||
|
||||
// Batch ALL todos in ONE call
|
||||
TodoWrite { todos: [
|
||||
{id: "1", content: "Research API patterns", status: "in_progress", priority: "high"},
|
||||
{id: "2", content: "Design database schema", status: "in_progress", priority: "high"},
|
||||
{id: "3", content: "Implement authentication", status: "pending", priority: "high"},
|
||||
{id: "4", content: "Build REST endpoints", status: "pending", priority: "high"},
|
||||
{id: "5", content: "Write unit tests", status: "pending", priority: "medium"},
|
||||
{id: "6", content: "Integration tests", status: "pending", priority: "medium"},
|
||||
{id: "7", content: "API documentation", status: "pending", priority: "low"},
|
||||
{id: "8", content: "Performance optimization", status: "pending", priority: "low"}
|
||||
]}
|
||||
|
||||
// Parallel file operations
|
||||
Bash "mkdir -p app/{src,tests,docs,config}"
|
||||
Write "app/package.json"
|
||||
Write "app/src/server.js"
|
||||
Write "app/tests/server.test.js"
|
||||
Write "app/docs/API.md"
|
||||
\`\`\`
|
||||
|
||||
### ❌ WRONG (Multiple Messages):
|
||||
\`\`\`javascript
|
||||
Message 1: mcp__claude-flow__swarm_init
|
||||
Message 2: Task("agent 1")
|
||||
Message 3: TodoWrite { todos: [single todo] }
|
||||
Message 4: Write "file.js"
|
||||
// This breaks parallel coordination!
|
||||
\`\`\`
|
||||
|
||||
## V3 Performance Targets
|
||||
|
||||
- **2.49x-7.47x** Flash Attention speedup
|
||||
- **150x-12,500x** search improvements with HNSW
|
||||
- **50-75%** memory reduction with quantization
|
||||
- **Sub-100ms** MCP response times
|
||||
|
||||
## 🪝 V3 Hooks System (26 Hooks)
|
||||
|
||||
Claude Flow V3 provides 26 hooks for comprehensive agent coordination and self-learning.
|
||||
## 🪝 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 |
|
||||
| **Routing** | \`route\`, \`metrics\`, \`list\` | Task analysis |
|
||||
| **Intelligence** | \`explain\`, \`pretrain\`, \`build-agents\`, \`transfer\`, \`init\` | Neural learning |
|
||||
| **Session** | \`session-start\`, \`session-end\`, \`session-restore\`, \`notify\` | Context management |
|
||||
| **Learning** | \`trajectory-start\`, \`trajectory-step\`, \`trajectory-end\` | Reinforcement learning |
|
||||
| **Patterns** | \`pattern-store\`, \`pattern-search\`, \`stats\`, \`learn\`, \`attention\` | Memory & search |
|
||||
| **Intelligence** | \`route\`, \`explain\`, \`pretrain\`, \`build-agents\`, \`transfer\` | Neural learning |
|
||||
| **Learning** | \`intelligence\` (trajectory-start/step/end, pattern-store/search, stats, attention) | Reinforcement |
|
||||
|
||||
### 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
|
||||
|
||||
\`\`\`bash
|
||||
# Core hooks for tool coordination
|
||||
# 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 --persist-patterns
|
||||
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]" --include-explanation
|
||||
npx claude-flow@v3alpha hooks explain --topic "[topic]" --depth comprehensive
|
||||
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 --config-format yaml
|
||||
npx claude-flow@v3alpha hooks build-agents --agent-types coder,tester
|
||||
|
||||
# Trajectory learning (reinforcement)
|
||||
npx claude-flow@v3alpha hooks intelligence trajectory-start --session "[session]"
|
||||
npx claude-flow@v3alpha hooks intelligence trajectory-step --action "[action]" --reward "[reward]"
|
||||
npx claude-flow@v3alpha hooks intelligence trajectory-end --verdict success
|
||||
|
||||
# Pattern storage (HNSW-indexed)
|
||||
npx claude-flow@v3alpha hooks intelligence pattern-store --pattern "[pattern]" --embedding "[json]"
|
||||
npx claude-flow@v3alpha hooks intelligence pattern-search --query "[query]" --limit 10
|
||||
|
||||
# Learning stats & attention
|
||||
npx claude-flow@v3alpha hooks intelligence stats
|
||||
npx claude-flow@v3alpha hooks intelligence attention --focus "[task]"
|
||||
# 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)
|
||||
## 🧠 Intelligence System (RuVector)
|
||||
|
||||
V3 includes the RuVector Intelligence System with:
|
||||
- **SONA**: Self-Optimizing Neural Architecture
|
||||
V3 includes the RuVector Intelligence System:
|
||||
- **SONA**: Self-Optimizing Neural Architecture (<0.05ms adaptation)
|
||||
- **MoE**: Mixture of Experts for specialized routing
|
||||
- **HNSW**: 150x faster pattern search
|
||||
- **HNSW**: 150x-12,500x faster pattern search
|
||||
- **EWC++**: Elastic Weight Consolidation (prevents forgetting)
|
||||
- **Flash Attention**: 2.49x-7.47x speedup
|
||||
|
||||
@@ -509,67 +301,112 @@ The 4-step intelligence pipeline:
|
||||
3. **DISTILL** - Extract key learnings via LoRA
|
||||
4. **CONSOLIDATE** - Prevent catastrophic forgetting via EWC++
|
||||
|
||||
### Auto-Configured Hooks
|
||||
## 📦 Embeddings Package (v3.0.0-alpha.12)
|
||||
|
||||
The init system configures these hooks in \`.claude/settings.json\`:
|
||||
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**: Poincaré ball model for hierarchical data
|
||||
- **75x faster**: With agentic-flow ONNX integration
|
||||
- **Neural substrate**: Integration with RuVector
|
||||
|
||||
\`\`\`json
|
||||
{
|
||||
"hooks": {
|
||||
"PreToolUse": [
|
||||
{ "matcher": "Task", "commands": ["npx claude-flow@v3alpha hooks pre-task --tool Task"] }
|
||||
],
|
||||
"PostToolUse": [
|
||||
{ "matcher": "Task", "commands": ["npx claude-flow@v3alpha hooks post-task --tool Task --train-patterns"] }
|
||||
],
|
||||
"UserPromptSubmit": [
|
||||
{ "matcher": ".*", "commands": ["npx claude-flow@v3alpha hooks route-task --analyze-complexity"] }
|
||||
],
|
||||
"SessionStart": [
|
||||
{ "commands": ["npx claude-flow@v3alpha hooks session-start --load-context"] }
|
||||
]
|
||||
}
|
||||
}
|
||||
## 🐝 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 |
|
||||
|--------|--------|
|
||||
| Flash Attention | 2.49x-7.47x speedup |
|
||||
| HNSW Search | 150x-12,500x faster |
|
||||
| Memory Reduction | 50-75% with quantization |
|
||||
| MCP Response | <100ms |
|
||||
| CLI Startup | <500ms |
|
||||
| SONA Adaptation | <0.05ms |
|
||||
|
||||
## 🔧 Environment Variables
|
||||
|
||||
\`\`\`bash
|
||||
# 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
|
||||
\`\`\`
|
||||
|
||||
### Agent Coordination via Hooks
|
||||
## 🔍 Doctor Health Checks
|
||||
|
||||
Every spawned agent should use hooks for coordination:
|
||||
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
|
||||
|
||||
\`\`\`javascript
|
||||
// In agent prompt instructions
|
||||
Task("Coder", \`
|
||||
BEFORE starting: npx claude-flow@v3alpha hooks pre-task --description "Implement feature X"
|
||||
## 🚀 Quick Setup
|
||||
|
||||
DURING work:
|
||||
- After each file edit: npx claude-flow@v3alpha hooks post-edit --file "[file]"
|
||||
- To notify others: npx claude-flow@v3alpha hooks notify --message "[update]"
|
||||
\`\`\`bash
|
||||
# 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
|
||||
|
||||
AFTER completing: npx claude-flow@v3alpha hooks post-task --success true
|
||||
\`, "coder")
|
||||
# Start daemon
|
||||
npx claude-flow@v3alpha daemon start
|
||||
|
||||
# Run doctor
|
||||
npx claude-flow@v3alpha doctor --fix
|
||||
\`\`\`
|
||||
|
||||
## Advanced Features (V3)
|
||||
## 🎯 Claude Code vs MCP Tools
|
||||
|
||||
- 🚀 Automatic Topology Selection
|
||||
- ⚡ Parallel Execution (2.8-4.4x speed)
|
||||
- 🧠 Neural Training with ReasoningBank
|
||||
- 📊 Bottleneck Analysis
|
||||
- 🤖 Smart Auto-Spawning
|
||||
- 🛡️ Self-Healing Workflows
|
||||
- 💾 Cross-Session Memory with AgentDB
|
||||
- 🔗 GitHub Integration
|
||||
- 🔐 Security-Hardened Architecture
|
||||
### 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
|
||||
|
||||
## Integration Tips
|
||||
### MCP Tools ONLY COORDINATE:
|
||||
- Swarm initialization (topology setup)
|
||||
- Agent type definitions
|
||||
- Task orchestration
|
||||
- Memory management
|
||||
- Neural features
|
||||
- Performance tracking
|
||||
|
||||
1. Start with basic swarm init
|
||||
2. Scale agents gradually
|
||||
3. Use memory for context
|
||||
4. Monitor progress regularly
|
||||
5. Train patterns from success
|
||||
6. Enable hooks automation
|
||||
7. Use GitHub tools first
|
||||
**KEY**: MCP coordinates the strategy, Claude Code's Task tool executes with real agents.
|
||||
|
||||
## Support
|
||||
|
||||
@@ -586,6 +423,7 @@ 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. Only create documentation files if explicitly requested by the User.
|
||||
Never save working files, text/mds and tests to the root folder.
|
||||
After spawning a swarm, wait, don't continuously check status.
|
||||
`;
|
||||
}
|
||||
|
||||
@@ -593,13 +431,15 @@ Never save working files, text/mds and tests to the root folder.
|
||||
* Generate minimal CLAUDE.md content
|
||||
*/
|
||||
export function generateMinimalClaudeMd(options: InitOptions): string {
|
||||
return `# Claude Code Configuration
|
||||
return `# Claude Code Configuration - Claude Flow V3
|
||||
|
||||
## Quick Reference
|
||||
|
||||
- **Topology**: ${options.runtime.topology}
|
||||
- **Max Agents**: ${options.runtime.maxAgents}
|
||||
- **Memory**: ${options.runtime.memoryBackend}
|
||||
- **HNSW**: ${options.runtime.enableHNSW ? 'Enabled' : 'Disabled'}
|
||||
- **Neural**: ${options.runtime.enableNeural ? 'Enabled' : 'Disabled'}
|
||||
|
||||
## Key Rules
|
||||
|
||||
@@ -617,6 +457,22 @@ Task("Coder", "Implement features...", "coder")
|
||||
Task("Tester", "Write tests...", "tester")
|
||||
\`\`\`
|
||||
|
||||
## 26 CLI Commands
|
||||
|
||||
\`\`\`bash
|
||||
# Core
|
||||
npx claude-flow@v3alpha init --wizard
|
||||
npx claude-flow@v3alpha agent spawn -t coder
|
||||
npx claude-flow@v3alpha swarm init --v3-mode
|
||||
npx claude-flow@v3alpha memory search -q "query"
|
||||
|
||||
# Advanced
|
||||
npx claude-flow@v3alpha daemon start
|
||||
npx claude-flow@v3alpha doctor --fix
|
||||
npx claude-flow@v3alpha security scan
|
||||
npx claude-flow@v3alpha performance benchmark
|
||||
\`\`\`
|
||||
|
||||
## MCP Setup
|
||||
|
||||
\`\`\`bash
|
||||
|
||||
Reference in new issue
Block a user