@claude-flow/cli 3.0.0-alpha.2 → 3.0.0-alpha.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +172 -6
- package/bin/cli.js +0 -0
- package/dist/src/commands/agent.d.ts.map +1 -1
- package/dist/src/commands/agent.js +43 -27
- package/dist/src/commands/agent.js.map +1 -1
- package/dist/src/commands/analyze.d.ts +19 -0
- package/dist/src/commands/analyze.d.ts.map +1 -0
- package/dist/src/commands/analyze.js +1823 -0
- package/dist/src/commands/analyze.js.map +1 -0
- package/dist/src/commands/claims.d.ts +10 -0
- package/dist/src/commands/claims.d.ts.map +1 -0
- package/dist/src/commands/claims.js +288 -0
- package/dist/src/commands/claims.js.map +1 -0
- package/dist/src/commands/completions.d.ts +10 -0
- package/dist/src/commands/completions.d.ts.map +1 -0
- package/dist/src/commands/completions.js +539 -0
- package/dist/src/commands/completions.js.map +1 -0
- package/dist/src/commands/config.js +2 -2
- package/dist/src/commands/config.js.map +1 -1
- package/dist/src/commands/daemon.d.ts +8 -0
- package/dist/src/commands/daemon.d.ts.map +1 -0
- package/dist/src/commands/daemon.js +545 -0
- package/dist/src/commands/daemon.js.map +1 -0
- package/dist/src/commands/deployment.d.ts +10 -0
- package/dist/src/commands/deployment.d.ts.map +1 -0
- package/dist/src/commands/deployment.js +289 -0
- package/dist/src/commands/deployment.js.map +1 -0
- package/dist/src/commands/doctor.d.ts +10 -0
- package/dist/src/commands/doctor.d.ts.map +1 -0
- package/dist/src/commands/doctor.js +429 -0
- package/dist/src/commands/doctor.js.map +1 -0
- package/dist/src/commands/embeddings.d.ts +18 -0
- package/dist/src/commands/embeddings.d.ts.map +1 -0
- package/dist/src/commands/embeddings.js +616 -0
- package/dist/src/commands/embeddings.js.map +1 -0
- package/dist/src/commands/hive-mind.d.ts.map +1 -1
- package/dist/src/commands/hive-mind.js +252 -35
- package/dist/src/commands/hive-mind.js.map +1 -1
- package/dist/src/commands/hooks.d.ts.map +1 -1
- package/dist/src/commands/hooks.js +326 -2
- package/dist/src/commands/hooks.js.map +1 -1
- package/dist/src/commands/index.d.ts +13 -0
- package/dist/src/commands/index.d.ts.map +1 -1
- package/dist/src/commands/index.js +52 -1
- package/dist/src/commands/index.js.map +1 -1
- package/dist/src/commands/mcp.js +4 -4
- package/dist/src/commands/mcp.js.map +1 -1
- package/dist/src/commands/memory.d.ts.map +1 -1
- package/dist/src/commands/memory.js +236 -170
- package/dist/src/commands/memory.js.map +1 -1
- package/dist/src/commands/migrate.js +1 -1
- package/dist/src/commands/migrate.js.map +1 -1
- package/dist/src/commands/neural.d.ts +10 -0
- package/dist/src/commands/neural.d.ts.map +1 -0
- package/dist/src/commands/neural.js +224 -0
- package/dist/src/commands/neural.js.map +1 -0
- package/dist/src/commands/performance.d.ts +10 -0
- package/dist/src/commands/performance.d.ts.map +1 -0
- package/dist/src/commands/performance.js +262 -0
- package/dist/src/commands/performance.js.map +1 -0
- package/dist/src/commands/plugins.d.ts +10 -0
- package/dist/src/commands/plugins.d.ts.map +1 -0
- package/dist/src/commands/plugins.js +280 -0
- package/dist/src/commands/plugins.js.map +1 -0
- package/dist/src/commands/process.d.ts.map +1 -1
- package/dist/src/commands/process.js +95 -20
- package/dist/src/commands/process.js.map +1 -1
- package/dist/src/commands/providers.d.ts +10 -0
- package/dist/src/commands/providers.d.ts.map +1 -0
- package/dist/src/commands/providers.js +232 -0
- package/dist/src/commands/providers.js.map +1 -0
- package/dist/src/commands/route.d.ts +16 -0
- package/dist/src/commands/route.d.ts.map +1 -0
- package/dist/src/commands/route.js +603 -0
- package/dist/src/commands/route.js.map +1 -0
- package/dist/src/commands/security.d.ts +10 -0
- package/dist/src/commands/security.d.ts.map +1 -0
- package/dist/src/commands/security.js +261 -0
- package/dist/src/commands/security.js.map +1 -0
- package/dist/src/commands/start.js +2 -2
- package/dist/src/commands/start.js.map +1 -1
- package/dist/src/commands/status.d.ts.map +1 -1
- package/dist/src/commands/status.js +26 -2
- package/dist/src/commands/status.js.map +1 -1
- package/dist/src/commands/swarm.js +6 -6
- package/dist/src/commands/swarm.js.map +1 -1
- package/dist/src/index.d.ts +4 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +63 -5
- package/dist/src/index.js.map +1 -1
- package/dist/src/init/claudemd-generator.d.ts.map +1 -1
- package/dist/src/init/claudemd-generator.js +218 -362
- package/dist/src/init/claudemd-generator.js.map +1 -1
- package/dist/src/init/executor.d.ts.map +1 -1
- package/dist/src/init/executor.js +5 -0
- package/dist/src/init/executor.js.map +1 -1
- package/dist/src/init/settings-generator.d.ts.map +1 -1
- package/dist/src/init/settings-generator.js +22 -12
- package/dist/src/init/settings-generator.js.map +1 -1
- package/dist/src/mcp-client.d.ts.map +1 -1
- package/dist/src/mcp-client.js +17 -1
- package/dist/src/mcp-client.js.map +1 -1
- package/dist/src/mcp-server.d.ts.map +1 -1
- package/dist/src/mcp-server.js +5 -0
- package/dist/src/mcp-server.js.map +1 -1
- package/dist/src/mcp-tools/agent-tools.d.ts +1 -1
- package/dist/src/mcp-tools/agent-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/agent-tools.js +350 -14
- package/dist/src/mcp-tools/agent-tools.js.map +1 -1
- package/dist/src/mcp-tools/analyze-tools.d.ts +38 -0
- package/dist/src/mcp-tools/analyze-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/analyze-tools.js +317 -0
- package/dist/src/mcp-tools/analyze-tools.js.map +1 -0
- package/dist/src/mcp-tools/config-tools.d.ts +1 -1
- package/dist/src/mcp-tools/config-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/config-tools.js +262 -15
- package/dist/src/mcp-tools/config-tools.js.map +1 -1
- package/dist/src/mcp-tools/hive-mind-tools.d.ts +8 -0
- package/dist/src/mcp-tools/hive-mind-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/hive-mind-tools.js +447 -0
- package/dist/src/mcp-tools/hive-mind-tools.js.map +1 -0
- package/dist/src/mcp-tools/hooks-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/hooks-tools.js +80 -15
- package/dist/src/mcp-tools/hooks-tools.js.map +1 -1
- package/dist/src/mcp-tools/index.d.ts +6 -0
- package/dist/src/mcp-tools/index.d.ts.map +1 -1
- package/dist/src/mcp-tools/index.js +6 -0
- package/dist/src/mcp-tools/index.js.map +1 -1
- package/dist/src/mcp-tools/memory-tools.d.ts +1 -1
- package/dist/src/mcp-tools/memory-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/memory-tools.js +157 -9
- package/dist/src/mcp-tools/memory-tools.js.map +1 -1
- package/dist/src/mcp-tools/session-tools.d.ts +8 -0
- package/dist/src/mcp-tools/session-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/session-tools.js +315 -0
- package/dist/src/mcp-tools/session-tools.js.map +1 -0
- package/dist/src/mcp-tools/swarm-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/swarm-tools.js +37 -2
- package/dist/src/mcp-tools/swarm-tools.js.map +1 -1
- package/dist/src/mcp-tools/task-tools.d.ts +8 -0
- package/dist/src/mcp-tools/task-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/task-tools.js +302 -0
- package/dist/src/mcp-tools/task-tools.js.map +1 -0
- package/dist/src/mcp-tools/workflow-tools.d.ts +8 -0
- package/dist/src/mcp-tools/workflow-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/workflow-tools.js +481 -0
- package/dist/src/mcp-tools/workflow-tools.js.map +1 -0
- package/dist/src/output.d.ts +16 -0
- package/dist/src/output.d.ts.map +1 -1
- package/dist/src/output.js +42 -0
- package/dist/src/output.js.map +1 -1
- package/dist/src/ruvector/ast-analyzer.d.ts +67 -0
- package/dist/src/ruvector/ast-analyzer.d.ts.map +1 -0
- package/dist/src/ruvector/ast-analyzer.js +277 -0
- package/dist/src/ruvector/ast-analyzer.js.map +1 -0
- package/dist/src/ruvector/coverage-router.d.ts +145 -0
- package/dist/src/ruvector/coverage-router.d.ts.map +1 -0
- package/dist/src/ruvector/coverage-router.js +451 -0
- package/dist/src/ruvector/coverage-router.js.map +1 -0
- package/dist/src/ruvector/coverage-tools.d.ts +33 -0
- package/dist/src/ruvector/coverage-tools.d.ts.map +1 -0
- package/dist/src/ruvector/coverage-tools.js +157 -0
- package/dist/src/ruvector/coverage-tools.js.map +1 -0
- package/dist/src/ruvector/diff-classifier.d.ts +154 -0
- package/dist/src/ruvector/diff-classifier.d.ts.map +1 -0
- package/dist/src/ruvector/diff-classifier.js +508 -0
- package/dist/src/ruvector/diff-classifier.js.map +1 -0
- package/dist/src/ruvector/graph-analyzer.d.ts +174 -0
- package/dist/src/ruvector/graph-analyzer.d.ts.map +1 -0
- package/dist/src/ruvector/graph-analyzer.js +878 -0
- package/dist/src/ruvector/graph-analyzer.js.map +1 -0
- package/dist/src/ruvector/index.d.ts +27 -0
- package/dist/src/ruvector/index.d.ts.map +1 -0
- package/dist/src/ruvector/index.js +47 -0
- package/dist/src/ruvector/index.js.map +1 -0
- package/dist/src/ruvector/q-learning-router.d.ts +211 -0
- package/dist/src/ruvector/q-learning-router.d.ts.map +1 -0
- package/dist/src/ruvector/q-learning-router.js +681 -0
- package/dist/src/ruvector/q-learning-router.js.map +1 -0
- package/dist/src/ruvector/vector-db.d.ts +69 -0
- package/dist/src/ruvector/vector-db.d.ts.map +1 -0
- package/dist/src/ruvector/vector-db.js +243 -0
- package/dist/src/ruvector/vector-db.js.map +1 -0
- package/dist/src/services/index.d.ts +7 -0
- package/dist/src/services/index.d.ts.map +1 -0
- package/dist/src/services/index.js +6 -0
- package/dist/src/services/index.js.map +1 -0
- package/dist/src/services/worker-daemon.d.ts +153 -0
- package/dist/src/services/worker-daemon.d.ts.map +1 -0
- package/dist/src/services/worker-daemon.js +567 -0
- package/dist/src/services/worker-daemon.js.map +1 -0
- package/dist/src/suggest.d.ts +53 -0
- package/dist/src/suggest.d.ts.map +1 -0
- package/dist/src/suggest.js +200 -0
- package/dist/src/suggest.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +28 -6
- package/.agentic-flow/intelligence.json +0 -16
- package/.claude-flow/metrics/agent-metrics.json +0 -1
- package/.claude-flow/metrics/performance.json +0 -87
- package/.claude-flow/metrics/task-metrics.json +0 -10
- package/__tests__/README.md +0 -140
- package/__tests__/TEST_SUMMARY.md +0 -144
- package/__tests__/cli.test.ts +0 -558
- package/__tests__/commands.test.ts +0 -726
- package/__tests__/config-adapter.test.ts +0 -362
- package/__tests__/config-loading.test.ts +0 -106
- package/__tests__/coverage/.tmp/coverage-0.json +0 -1
- package/__tests__/coverage/.tmp/coverage-1.json +0 -1
- package/__tests__/coverage/.tmp/coverage-2.json +0 -1
- package/__tests__/coverage/.tmp/coverage-3.json +0 -1
- package/__tests__/coverage/.tmp/coverage-4.json +0 -1
- package/__tests__/coverage/.tmp/coverage-5.json +0 -1
- package/__tests__/mcp-client.test.ts +0 -480
- package/__tests__/p1-commands.test.ts +0 -1064
- package/docs/CONFIG_LOADING.md +0 -236
- package/docs/IMPLEMENTATION_COMPLETE.md +0 -421
- package/docs/MCP_CLIENT_GUIDE.md +0 -620
- package/docs/REFACTORING_SUMMARY.md +0 -247
- package/src/commands/agent.ts +0 -941
- package/src/commands/config.ts +0 -452
- package/src/commands/hive-mind.ts +0 -762
- package/src/commands/hooks.ts +0 -2603
- package/src/commands/index.ts +0 -115
- package/src/commands/init.ts +0 -597
- package/src/commands/mcp.ts +0 -753
- package/src/commands/memory.ts +0 -1063
- package/src/commands/migrate.ts +0 -447
- package/src/commands/process.ts +0 -617
- package/src/commands/session.ts +0 -891
- package/src/commands/start.ts +0 -457
- package/src/commands/status.ts +0 -705
- package/src/commands/swarm.ts +0 -648
- package/src/commands/task.ts +0 -792
- package/src/commands/workflow.ts +0 -742
- package/src/config-adapter.ts +0 -210
- package/src/index.ts +0 -383
- package/src/infrastructure/in-memory-repositories.ts +0 -310
- package/src/init/claudemd-generator.ts +0 -631
- package/src/init/executor.ts +0 -756
- package/src/init/helpers-generator.ts +0 -628
- package/src/init/index.ts +0 -60
- package/src/init/mcp-generator.ts +0 -83
- package/src/init/settings-generator.ts +0 -274
- package/src/init/statusline-generator.ts +0 -211
- package/src/init/types.ts +0 -447
- package/src/mcp-client.ts +0 -227
- package/src/mcp-server.ts +0 -571
- package/src/mcp-tools/agent-tools.ts +0 -92
- package/src/mcp-tools/config-tools.ts +0 -88
- package/src/mcp-tools/hooks-tools.ts +0 -1819
- package/src/mcp-tools/index.ts +0 -12
- package/src/mcp-tools/memory-tools.ts +0 -89
- package/src/mcp-tools/swarm-tools.ts +0 -69
- package/src/mcp-tools/types.ts +0 -33
- package/src/output.ts +0 -593
- package/src/parser.ts +0 -417
- package/src/prompt.ts +0 -619
- package/src/types.ts +0 -287
- package/tmp.json +0 -0
- package/tsconfig.json +0 -16
- package/tsconfig.tsbuildinfo +0 -1
- package/vitest.config.ts +0 -13
|
@@ -1,631 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CLAUDE.md Generator
|
|
3
|
-
* Generates project-specific Claude Code configuration with V3 swarm guidance
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import type { InitOptions } from './types.js';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Generate CLAUDE.md content based on init options
|
|
10
|
-
*/
|
|
11
|
-
export function generateClaudeMd(options: InitOptions): string {
|
|
12
|
-
const topology = options.runtime.topology;
|
|
13
|
-
const maxAgents = options.runtime.maxAgents;
|
|
14
|
-
const memoryBackend = options.runtime.memoryBackend;
|
|
15
|
-
|
|
16
|
-
return `# Claude Code Configuration - SPARC Development Environment
|
|
17
|
-
|
|
18
|
-
## 🚨 AUTOMATIC SWARM ORCHESTRATION
|
|
19
|
-
|
|
20
|
-
**When starting work on complex tasks, Claude Code MUST automatically:**
|
|
21
|
-
|
|
22
|
-
1. **Initialize the swarm** using MCP tools
|
|
23
|
-
2. **Spawn concurrent agents** using Claude Code's Task tool
|
|
24
|
-
3. **Coordinate via hooks** and memory
|
|
25
|
-
|
|
26
|
-
### 🚨 CRITICAL: MCP + Task Tool in SAME Message
|
|
27
|
-
|
|
28
|
-
**When user says "spawn swarm" or requests complex work, Claude Code MUST in ONE message:**
|
|
29
|
-
1. Call MCP tools to initialize coordination
|
|
30
|
-
2. **IMMEDIATELY** call Task tool to spawn REAL working agents
|
|
31
|
-
3. Both MCP and Task calls must be in the SAME response
|
|
32
|
-
|
|
33
|
-
**MCP alone does NOT execute work - Task tool agents do the actual work!**
|
|
34
|
-
|
|
35
|
-
### 🔄 Auto-Start Swarm Protocol
|
|
36
|
-
|
|
37
|
-
When the user requests a complex task (multi-file changes, feature implementation, refactoring), **immediately execute this pattern in a SINGLE message:**
|
|
38
|
-
|
|
39
|
-
\`\`\`javascript
|
|
40
|
-
// STEP 1: Initialize swarm coordination via MCP (in parallel with agent spawning)
|
|
41
|
-
mcp__claude-flow__swarm_init({
|
|
42
|
-
topology: "${topology}",
|
|
43
|
-
maxAgents: ${maxAgents},
|
|
44
|
-
strategy: "adaptive"
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
// STEP 2: Spawn agents concurrently using Claude Code's Task tool
|
|
48
|
-
// ALL Task calls MUST be in the SAME message for parallel execution
|
|
49
|
-
Task("Coordinator", "You are the swarm coordinator. Initialize session, coordinate other agents via memory. Run: npx claude-flow@v3alpha hooks session-start", "hierarchical-coordinator")
|
|
50
|
-
Task("Researcher", "Analyze requirements and existing code patterns. Store findings in memory via hooks.", "researcher")
|
|
51
|
-
Task("Architect", "Design implementation approach based on research. Document decisions in memory.", "system-architect")
|
|
52
|
-
Task("Coder", "Implement the solution following architect's design. Coordinate via hooks.", "coder")
|
|
53
|
-
Task("Tester", "Write tests for the implementation. Report coverage via hooks.", "tester")
|
|
54
|
-
Task("Reviewer", "Review code quality and security. Document findings.", "reviewer")
|
|
55
|
-
|
|
56
|
-
// STEP 3: Batch all todos
|
|
57
|
-
TodoWrite({ todos: [
|
|
58
|
-
{content: "Initialize swarm coordination", status: "in_progress", activeForm: "Initializing swarm"},
|
|
59
|
-
{content: "Research and analyze requirements", status: "in_progress", activeForm: "Researching requirements"},
|
|
60
|
-
{content: "Design architecture", status: "pending", activeForm: "Designing architecture"},
|
|
61
|
-
{content: "Implement solution", status: "pending", activeForm: "Implementing solution"},
|
|
62
|
-
{content: "Write tests", status: "pending", activeForm: "Writing tests"},
|
|
63
|
-
{content: "Review and finalize", status: "pending", activeForm: "Reviewing code"}
|
|
64
|
-
]})
|
|
65
|
-
|
|
66
|
-
// STEP 4: Store swarm state in memory
|
|
67
|
-
mcp__claude-flow__memory_usage({
|
|
68
|
-
action: "store",
|
|
69
|
-
namespace: "swarm",
|
|
70
|
-
key: "current-session",
|
|
71
|
-
value: JSON.stringify({task: "[user's task]", agents: 6, startedAt: new Date().toISOString()})
|
|
72
|
-
})
|
|
73
|
-
\`\`\`
|
|
74
|
-
|
|
75
|
-
### 📋 Agent Routing by Task Type
|
|
76
|
-
|
|
77
|
-
**Automatically select agents based on task:**
|
|
78
|
-
|
|
79
|
-
| Task Type | Required Agents | Topology |
|
|
80
|
-
|-----------|-----------------|----------|
|
|
81
|
-
| Bug Fix | researcher, coder, tester | mesh |
|
|
82
|
-
| New Feature | coordinator, architect, coder, tester, reviewer | hierarchical |
|
|
83
|
-
| Refactoring | architect, coder, reviewer | mesh |
|
|
84
|
-
| Performance | researcher, coder, perf-analyzer | hierarchical |
|
|
85
|
-
| Security Audit | security-manager, reviewer, tester | hierarchical |
|
|
86
|
-
| Documentation | researcher, api-docs | mesh |
|
|
87
|
-
|
|
88
|
-
### 🎯 Task Complexity Detection
|
|
89
|
-
|
|
90
|
-
**AUTO-INVOKE SWARM when task involves:**
|
|
91
|
-
- Multiple files (3+)
|
|
92
|
-
- New feature implementation
|
|
93
|
-
- Refactoring across modules
|
|
94
|
-
- API changes with tests
|
|
95
|
-
- Security-related changes
|
|
96
|
-
- Performance optimization
|
|
97
|
-
- Database schema changes
|
|
98
|
-
|
|
99
|
-
**SKIP SWARM for:**
|
|
100
|
-
- Single file edits
|
|
101
|
-
- Simple bug fixes (1-2 lines)
|
|
102
|
-
- Documentation updates
|
|
103
|
-
- Configuration changes
|
|
104
|
-
- Quick questions/exploration
|
|
105
|
-
|
|
106
|
-
### 🔧 Settings Configuration
|
|
107
|
-
|
|
108
|
-
The following settings are auto-configured in \`.claude/settings.json\`:
|
|
109
|
-
|
|
110
|
-
\`\`\`json
|
|
111
|
-
{
|
|
112
|
-
"hooks": {
|
|
113
|
-
"PreToolUse": [{
|
|
114
|
-
"matcher": "Task",
|
|
115
|
-
"commands": ["npx claude-flow@v3alpha hooks pre-task --tool Task"]
|
|
116
|
-
}],
|
|
117
|
-
"PostToolUse": [{
|
|
118
|
-
"matcher": "Task",
|
|
119
|
-
"commands": ["npx claude-flow@v3alpha hooks post-task --tool Task"]
|
|
120
|
-
}],
|
|
121
|
-
"UserPromptSubmit": [{
|
|
122
|
-
"matcher": ".*",
|
|
123
|
-
"commands": ["npx claude-flow@v3alpha hooks route-task"]
|
|
124
|
-
}]
|
|
125
|
-
},
|
|
126
|
-
"permissions": {
|
|
127
|
-
"allow": [
|
|
128
|
-
"Bash(npx claude-flow:*)",
|
|
129
|
-
"mcp__claude-flow__*",
|
|
130
|
-
"mcp__ruv-swarm__*"
|
|
131
|
-
]
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
\`\`\`
|
|
135
|
-
|
|
136
|
-
## 🚨 CRITICAL: CONCURRENT EXECUTION & FILE MANAGEMENT
|
|
137
|
-
|
|
138
|
-
**ABSOLUTE RULES**:
|
|
139
|
-
1. ALL operations MUST be concurrent/parallel in a single message
|
|
140
|
-
2. **NEVER save working files, text/mds and tests to the root folder**
|
|
141
|
-
3. ALWAYS organize files in appropriate subdirectories
|
|
142
|
-
4. **USE CLAUDE CODE'S TASK TOOL** for spawning agents concurrently, not just MCP
|
|
143
|
-
|
|
144
|
-
### ⚡ GOLDEN RULE: "1 MESSAGE = ALL RELATED OPERATIONS"
|
|
145
|
-
|
|
146
|
-
**MANDATORY PATTERNS:**
|
|
147
|
-
- **TodoWrite**: ALWAYS batch ALL todos in ONE call (5-10+ todos minimum)
|
|
148
|
-
- **Task tool (Claude Code)**: ALWAYS spawn ALL agents in ONE message with full instructions
|
|
149
|
-
- **File operations**: ALWAYS batch ALL reads/writes/edits in ONE message
|
|
150
|
-
- **Bash commands**: ALWAYS batch ALL terminal operations in ONE message
|
|
151
|
-
- **Memory operations**: ALWAYS batch ALL memory store/retrieve in ONE message
|
|
152
|
-
|
|
153
|
-
### 🎯 CRITICAL: Claude Code Task Tool for Agent Execution
|
|
154
|
-
|
|
155
|
-
**Claude Code's Task tool is the PRIMARY way to spawn agents:**
|
|
156
|
-
\`\`\`javascript
|
|
157
|
-
// ✅ CORRECT: Use Claude Code's Task tool for parallel agent execution
|
|
158
|
-
[Single Message]:
|
|
159
|
-
Task("Research agent", "Analyze requirements and patterns...", "researcher")
|
|
160
|
-
Task("Coder agent", "Implement core features...", "coder")
|
|
161
|
-
Task("Tester agent", "Create comprehensive tests...", "tester")
|
|
162
|
-
Task("Reviewer agent", "Review code quality...", "reviewer")
|
|
163
|
-
Task("Architect agent", "Design system architecture...", "system-architect")
|
|
164
|
-
\`\`\`
|
|
165
|
-
|
|
166
|
-
**MCP tools are ONLY for coordination setup:**
|
|
167
|
-
- \`mcp__claude-flow__swarm_init\` - Initialize coordination topology
|
|
168
|
-
- \`mcp__claude-flow__agent_spawn\` - Define agent types for coordination
|
|
169
|
-
- \`mcp__claude-flow__task_orchestrate\` - Orchestrate high-level workflows
|
|
170
|
-
|
|
171
|
-
### 📁 File Organization Rules
|
|
172
|
-
|
|
173
|
-
**NEVER save to root folder. Use these directories:**
|
|
174
|
-
- \`/src\` - Source code files
|
|
175
|
-
- \`/tests\` - Test files
|
|
176
|
-
- \`/docs\` - Documentation and markdown files
|
|
177
|
-
- \`/config\` - Configuration files
|
|
178
|
-
- \`/scripts\` - Utility scripts
|
|
179
|
-
- \`/examples\` - Example code
|
|
180
|
-
|
|
181
|
-
## Project Configuration
|
|
182
|
-
|
|
183
|
-
This project is configured with Claude Flow V3:
|
|
184
|
-
- **Topology**: ${topology}
|
|
185
|
-
- **Max Agents**: ${maxAgents}
|
|
186
|
-
- **Memory Backend**: ${memoryBackend}
|
|
187
|
-
- **HNSW Indexing**: ${options.runtime.enableHNSW ? 'Enabled' : 'Disabled'}
|
|
188
|
-
- **Neural Learning**: ${options.runtime.enableNeural ? 'Enabled' : 'Disabled'}
|
|
189
|
-
|
|
190
|
-
## SPARC Workflow Phases
|
|
191
|
-
|
|
192
|
-
1. **Specification** - Requirements analysis (\`sparc run spec-pseudocode\`)
|
|
193
|
-
2. **Pseudocode** - Algorithm design (\`sparc run spec-pseudocode\`)
|
|
194
|
-
3. **Architecture** - System design (\`sparc run architect\`)
|
|
195
|
-
4. **Refinement** - TDD implementation (\`sparc tdd\`)
|
|
196
|
-
5. **Completion** - Integration (\`sparc run integration\`)
|
|
197
|
-
|
|
198
|
-
## Code Style & Best Practices
|
|
199
|
-
|
|
200
|
-
- **Modular Design**: Files under 500 lines
|
|
201
|
-
- **Environment Safety**: Never hardcode secrets
|
|
202
|
-
- **Test-First**: Write tests before implementation
|
|
203
|
-
- **Clean Architecture**: Separate concerns
|
|
204
|
-
- **Documentation**: Keep updated
|
|
205
|
-
|
|
206
|
-
## 🚀 Available Agents
|
|
207
|
-
|
|
208
|
-
### Core Development
|
|
209
|
-
\`coder\`, \`reviewer\`, \`tester\`, \`planner\`, \`researcher\`
|
|
210
|
-
|
|
211
|
-
### Swarm Coordination
|
|
212
|
-
\`hierarchical-coordinator\`, \`mesh-coordinator\`, \`adaptive-coordinator\`, \`collective-intelligence-coordinator\`, \`swarm-memory-manager\`
|
|
213
|
-
|
|
214
|
-
### Consensus & Distributed
|
|
215
|
-
\`byzantine-coordinator\`, \`raft-manager\`, \`gossip-coordinator\`, \`consensus-builder\`, \`crdt-synchronizer\`, \`quorum-manager\`, \`security-manager\`
|
|
216
|
-
|
|
217
|
-
### Performance & Optimization
|
|
218
|
-
\`perf-analyzer\`, \`performance-benchmarker\`, \`task-orchestrator\`, \`memory-coordinator\`, \`smart-agent\`
|
|
219
|
-
|
|
220
|
-
### GitHub & Repository
|
|
221
|
-
\`github-modes\`, \`pr-manager\`, \`code-review-swarm\`, \`issue-tracker\`, \`release-manager\`, \`workflow-automation\`, \`project-board-sync\`, \`repo-architect\`, \`multi-repo-swarm\`
|
|
222
|
-
|
|
223
|
-
### SPARC Methodology
|
|
224
|
-
\`sparc-coord\`, \`sparc-coder\`, \`specification\`, \`pseudocode\`, \`architecture\`, \`refinement\`
|
|
225
|
-
|
|
226
|
-
### Specialized Development
|
|
227
|
-
\`backend-dev\`, \`mobile-dev\`, \`ml-developer\`, \`cicd-engineer\`, \`api-docs\`, \`system-architect\`, \`code-analyzer\`, \`base-template-generator\`
|
|
228
|
-
|
|
229
|
-
### Testing & Validation
|
|
230
|
-
\`tdd-london-swarm\`, \`production-validator\`
|
|
231
|
-
|
|
232
|
-
## 🎯 Claude Code vs MCP Tools
|
|
233
|
-
|
|
234
|
-
### Claude Code Handles ALL EXECUTION:
|
|
235
|
-
- **Task tool**: Spawn and run agents concurrently for actual work
|
|
236
|
-
- File operations (Read, Write, Edit, MultiEdit, Glob, Grep)
|
|
237
|
-
- Code generation and programming
|
|
238
|
-
- Bash commands and system operations
|
|
239
|
-
- Implementation work
|
|
240
|
-
- Project navigation and analysis
|
|
241
|
-
- TodoWrite and task management
|
|
242
|
-
- Git operations
|
|
243
|
-
- Package management
|
|
244
|
-
- Testing and debugging
|
|
245
|
-
|
|
246
|
-
### MCP Tools ONLY COORDINATE:
|
|
247
|
-
- Swarm initialization (topology setup)
|
|
248
|
-
- Agent type definitions (coordination patterns)
|
|
249
|
-
- Task orchestration (high-level planning)
|
|
250
|
-
- Memory management
|
|
251
|
-
- Neural features
|
|
252
|
-
- Performance tracking
|
|
253
|
-
- GitHub integration
|
|
254
|
-
|
|
255
|
-
**KEY**: MCP coordinates the strategy, Claude Code's Task tool executes with real agents.
|
|
256
|
-
|
|
257
|
-
## 🚀 Quick Setup
|
|
258
|
-
|
|
259
|
-
\`\`\`bash
|
|
260
|
-
# Add MCP servers (Claude Flow required, others optional)
|
|
261
|
-
claude mcp add claude-flow npx claude-flow@v3alpha mcp start
|
|
262
|
-
claude mcp add ruv-swarm npx ruv-swarm mcp start # Optional: Enhanced coordination
|
|
263
|
-
claude mcp add flow-nexus npx flow-nexus@latest mcp start # Optional: Cloud features
|
|
264
|
-
\`\`\`
|
|
265
|
-
|
|
266
|
-
## MCP Tool Categories
|
|
267
|
-
|
|
268
|
-
### Coordination
|
|
269
|
-
\`swarm_init\`, \`agent_spawn\`, \`task_orchestrate\`
|
|
270
|
-
|
|
271
|
-
### Monitoring
|
|
272
|
-
\`swarm_status\`, \`agent_list\`, \`agent_metrics\`, \`task_status\`, \`task_results\`
|
|
273
|
-
|
|
274
|
-
### Memory & Neural
|
|
275
|
-
\`memory_usage\`, \`neural_status\`, \`neural_train\`, \`neural_patterns\`
|
|
276
|
-
|
|
277
|
-
### GitHub Integration
|
|
278
|
-
\`github_swarm\`, \`repo_analyze\`, \`pr_enhance\`, \`issue_triage\`, \`code_review\`
|
|
279
|
-
|
|
280
|
-
### System
|
|
281
|
-
\`benchmark_run\`, \`features_detect\`, \`swarm_monitor\`
|
|
282
|
-
|
|
283
|
-
## 🚀 Agent Execution Flow with Claude Code
|
|
284
|
-
|
|
285
|
-
### The Correct Pattern:
|
|
286
|
-
|
|
287
|
-
1. **Optional**: Use MCP tools to set up coordination topology
|
|
288
|
-
2. **REQUIRED**: Use Claude Code's Task tool to spawn agents that do actual work
|
|
289
|
-
3. **REQUIRED**: Each agent runs hooks for coordination
|
|
290
|
-
4. **REQUIRED**: Batch all operations in single messages
|
|
291
|
-
|
|
292
|
-
### Example Full-Stack Development:
|
|
293
|
-
|
|
294
|
-
\`\`\`javascript
|
|
295
|
-
// Single message with all agent spawning via Claude Code's Task tool
|
|
296
|
-
[Parallel Agent Execution]:
|
|
297
|
-
Task("Backend Developer", "Build REST API with Express. Use hooks for coordination.", "backend-dev")
|
|
298
|
-
Task("Frontend Developer", "Create React UI. Coordinate with backend via memory.", "coder")
|
|
299
|
-
Task("Database Architect", "Design PostgreSQL schema. Store schema in memory.", "code-analyzer")
|
|
300
|
-
Task("Test Engineer", "Write Jest tests. Check memory for API contracts.", "tester")
|
|
301
|
-
Task("DevOps Engineer", "Setup Docker and CI/CD. Document in memory.", "cicd-engineer")
|
|
302
|
-
Task("Security Auditor", "Review authentication. Report findings via hooks.", "reviewer")
|
|
303
|
-
|
|
304
|
-
// All todos batched together
|
|
305
|
-
TodoWrite { todos: [...8-10 todos...] }
|
|
306
|
-
|
|
307
|
-
// All file operations together
|
|
308
|
-
Write "backend/server.js"
|
|
309
|
-
Write "frontend/App.jsx"
|
|
310
|
-
Write "database/schema.sql"
|
|
311
|
-
\`\`\`
|
|
312
|
-
|
|
313
|
-
## 📋 Agent Coordination Protocol
|
|
314
|
-
|
|
315
|
-
### Every Agent Spawned via Task Tool MUST:
|
|
316
|
-
|
|
317
|
-
**1️⃣ BEFORE Work:**
|
|
318
|
-
\`\`\`bash
|
|
319
|
-
npx claude-flow@v3alpha hooks pre-task --description "[task]"
|
|
320
|
-
npx claude-flow@v3alpha hooks session-restore --session-id "swarm-[id]"
|
|
321
|
-
\`\`\`
|
|
322
|
-
|
|
323
|
-
**2️⃣ DURING Work:**
|
|
324
|
-
\`\`\`bash
|
|
325
|
-
npx claude-flow@v3alpha hooks post-edit --file "[file]" --memory-key "swarm/[agent]/[step]"
|
|
326
|
-
npx claude-flow@v3alpha hooks notify --message "[what was done]"
|
|
327
|
-
\`\`\`
|
|
328
|
-
|
|
329
|
-
**3️⃣ AFTER Work:**
|
|
330
|
-
\`\`\`bash
|
|
331
|
-
npx claude-flow@v3alpha hooks post-task --task-id "[task]"
|
|
332
|
-
npx claude-flow@v3alpha hooks session-end --export-metrics true
|
|
333
|
-
\`\`\`
|
|
334
|
-
|
|
335
|
-
## 🚀 Swarm Lifecycle Management
|
|
336
|
-
|
|
337
|
-
### Session Start (AUTOMATIC)
|
|
338
|
-
When beginning ANY development task, Claude Code should:
|
|
339
|
-
|
|
340
|
-
\`\`\`javascript
|
|
341
|
-
// 1. Check for existing swarm session
|
|
342
|
-
mcp__claude-flow__swarm_status({})
|
|
343
|
-
|
|
344
|
-
// 2. If no active swarm, initialize one
|
|
345
|
-
mcp__claude-flow__swarm_init({ topology: "${topology}", maxAgents: ${maxAgents} })
|
|
346
|
-
|
|
347
|
-
// 3. Restore previous context if available
|
|
348
|
-
mcp__claude-flow__memory_usage({ action: "retrieve", namespace: "swarm", key: "last-session" })
|
|
349
|
-
\`\`\`
|
|
350
|
-
|
|
351
|
-
### Task Execution (AUTOMATIC)
|
|
352
|
-
For each significant task:
|
|
353
|
-
|
|
354
|
-
\`\`\`javascript
|
|
355
|
-
// 1. Create task orchestration
|
|
356
|
-
mcp__claude-flow__task_orchestrate({
|
|
357
|
-
task: "[task description]",
|
|
358
|
-
priority: "high",
|
|
359
|
-
strategy: "adaptive"
|
|
360
|
-
})
|
|
361
|
-
|
|
362
|
-
// 2. Spawn appropriate agents via Task tool (PARALLEL)
|
|
363
|
-
Task("Agent1", "...", "agent-type")
|
|
364
|
-
Task("Agent2", "...", "agent-type")
|
|
365
|
-
Task("Agent3", "...", "agent-type")
|
|
366
|
-
|
|
367
|
-
// 3. Monitor progress via MCP
|
|
368
|
-
mcp__claude-flow__swarm_status({ includeAgents: true, includeMetrics: true })
|
|
369
|
-
\`\`\`
|
|
370
|
-
|
|
371
|
-
### Session End (AUTOMATIC)
|
|
372
|
-
When task completes or user ends session:
|
|
373
|
-
|
|
374
|
-
\`\`\`javascript
|
|
375
|
-
// 1. Save session state
|
|
376
|
-
mcp__claude-flow__memory_usage({
|
|
377
|
-
action: "store",
|
|
378
|
-
namespace: "swarm",
|
|
379
|
-
key: "last-session",
|
|
380
|
-
value: JSON.stringify({ completedAt: new Date().toISOString(), summary: "..." })
|
|
381
|
-
})
|
|
382
|
-
|
|
383
|
-
// 2. Export metrics if enabled
|
|
384
|
-
mcp__claude-flow__agent_metrics({})
|
|
385
|
-
|
|
386
|
-
// 3. Graceful shutdown (only if explicitly requested)
|
|
387
|
-
// mcp__claude-flow__swarm_destroy({ swarmId: "..." })
|
|
388
|
-
\`\`\`
|
|
389
|
-
|
|
390
|
-
## 🎯 Concurrent Execution Examples
|
|
391
|
-
|
|
392
|
-
### ✅ CORRECT WORKFLOW: MCP Coordinates, Claude Code Executes
|
|
393
|
-
|
|
394
|
-
\`\`\`javascript
|
|
395
|
-
// Step 1: MCP tools set up coordination (optional, for complex tasks)
|
|
396
|
-
[Single Message - Coordination Setup]:
|
|
397
|
-
mcp__claude-flow__swarm_init { topology: "${topology}", maxAgents: ${maxAgents} }
|
|
398
|
-
mcp__claude-flow__agent_spawn { type: "researcher" }
|
|
399
|
-
mcp__claude-flow__agent_spawn { type: "coder" }
|
|
400
|
-
mcp__claude-flow__agent_spawn { type: "tester" }
|
|
401
|
-
|
|
402
|
-
// Step 2: Claude Code Task tool spawns ACTUAL agents that do the work
|
|
403
|
-
[Single Message - Parallel Agent Execution]:
|
|
404
|
-
// Claude Code's Task tool spawns real agents concurrently
|
|
405
|
-
Task("Research agent", "Analyze API requirements and best practices. Check memory for prior decisions.", "researcher")
|
|
406
|
-
Task("Coder agent", "Implement REST endpoints with authentication. Coordinate via hooks.", "coder")
|
|
407
|
-
Task("Database agent", "Design and implement database schema. Store decisions in memory.", "code-analyzer")
|
|
408
|
-
Task("Tester agent", "Create comprehensive test suite with 90% coverage.", "tester")
|
|
409
|
-
Task("Reviewer agent", "Review code quality and security. Document findings.", "reviewer")
|
|
410
|
-
|
|
411
|
-
// Batch ALL todos in ONE call
|
|
412
|
-
TodoWrite { todos: [
|
|
413
|
-
{id: "1", content: "Research API patterns", status: "in_progress", priority: "high"},
|
|
414
|
-
{id: "2", content: "Design database schema", status: "in_progress", priority: "high"},
|
|
415
|
-
{id: "3", content: "Implement authentication", status: "pending", priority: "high"},
|
|
416
|
-
{id: "4", content: "Build REST endpoints", status: "pending", priority: "high"},
|
|
417
|
-
{id: "5", content: "Write unit tests", status: "pending", priority: "medium"},
|
|
418
|
-
{id: "6", content: "Integration tests", status: "pending", priority: "medium"},
|
|
419
|
-
{id: "7", content: "API documentation", status: "pending", priority: "low"},
|
|
420
|
-
{id: "8", content: "Performance optimization", status: "pending", priority: "low"}
|
|
421
|
-
]}
|
|
422
|
-
|
|
423
|
-
// Parallel file operations
|
|
424
|
-
Bash "mkdir -p app/{src,tests,docs,config}"
|
|
425
|
-
Write "app/package.json"
|
|
426
|
-
Write "app/src/server.js"
|
|
427
|
-
Write "app/tests/server.test.js"
|
|
428
|
-
Write "app/docs/API.md"
|
|
429
|
-
\`\`\`
|
|
430
|
-
|
|
431
|
-
### ❌ WRONG (Multiple Messages):
|
|
432
|
-
\`\`\`javascript
|
|
433
|
-
Message 1: mcp__claude-flow__swarm_init
|
|
434
|
-
Message 2: Task("agent 1")
|
|
435
|
-
Message 3: TodoWrite { todos: [single todo] }
|
|
436
|
-
Message 4: Write "file.js"
|
|
437
|
-
// This breaks parallel coordination!
|
|
438
|
-
\`\`\`
|
|
439
|
-
|
|
440
|
-
## V3 Performance Targets
|
|
441
|
-
|
|
442
|
-
- **2.49x-7.47x** Flash Attention speedup
|
|
443
|
-
- **150x-12,500x** search improvements with HNSW
|
|
444
|
-
- **50-75%** memory reduction with quantization
|
|
445
|
-
- **Sub-100ms** MCP response times
|
|
446
|
-
|
|
447
|
-
## 🪝 V3 Hooks System (26 Hooks)
|
|
448
|
-
|
|
449
|
-
Claude Flow V3 provides 26 hooks for comprehensive agent coordination and self-learning.
|
|
450
|
-
|
|
451
|
-
### Hook Categories
|
|
452
|
-
|
|
453
|
-
| Category | Hooks | Purpose |
|
|
454
|
-
|----------|-------|---------|
|
|
455
|
-
| **Core** | \`pre-edit\`, \`post-edit\`, \`pre-command\`, \`post-command\`, \`pre-task\`, \`post-task\` | Tool lifecycle |
|
|
456
|
-
| **Routing** | \`route\`, \`metrics\`, \`list\` | Task analysis |
|
|
457
|
-
| **Intelligence** | \`explain\`, \`pretrain\`, \`build-agents\`, \`transfer\`, \`init\` | Neural learning |
|
|
458
|
-
| **Session** | \`session-start\`, \`session-end\`, \`session-restore\`, \`notify\` | Context management |
|
|
459
|
-
| **Learning** | \`trajectory-start\`, \`trajectory-step\`, \`trajectory-end\` | Reinforcement learning |
|
|
460
|
-
| **Patterns** | \`pattern-store\`, \`pattern-search\`, \`stats\`, \`learn\`, \`attention\` | Memory & search |
|
|
461
|
-
|
|
462
|
-
### Essential Hook Commands
|
|
463
|
-
|
|
464
|
-
\`\`\`bash
|
|
465
|
-
# Core hooks for tool coordination
|
|
466
|
-
npx claude-flow@v3alpha hooks pre-task --description "[task]"
|
|
467
|
-
npx claude-flow@v3alpha hooks post-task --task-id "[id]" --success true
|
|
468
|
-
npx claude-flow@v3alpha hooks post-edit --file "[file]" --train-patterns
|
|
469
|
-
|
|
470
|
-
# Session management
|
|
471
|
-
npx claude-flow@v3alpha hooks session-start --session-id "[id]"
|
|
472
|
-
npx claude-flow@v3alpha hooks session-end --export-metrics true --persist-patterns
|
|
473
|
-
npx claude-flow@v3alpha hooks session-restore --session-id "[id]"
|
|
474
|
-
|
|
475
|
-
# Intelligence routing
|
|
476
|
-
npx claude-flow@v3alpha hooks route --task "[task]" --include-explanation
|
|
477
|
-
npx claude-flow@v3alpha hooks explain --topic "[topic]" --depth comprehensive
|
|
478
|
-
|
|
479
|
-
# Neural learning
|
|
480
|
-
npx claude-flow@v3alpha hooks pretrain --model-type moe --epochs 10
|
|
481
|
-
npx claude-flow@v3alpha hooks build-agents --agent-types coder,tester --config-format yaml
|
|
482
|
-
|
|
483
|
-
# Trajectory learning (reinforcement)
|
|
484
|
-
npx claude-flow@v3alpha hooks intelligence trajectory-start --session "[session]"
|
|
485
|
-
npx claude-flow@v3alpha hooks intelligence trajectory-step --action "[action]" --reward "[reward]"
|
|
486
|
-
npx claude-flow@v3alpha hooks intelligence trajectory-end --verdict success
|
|
487
|
-
|
|
488
|
-
# Pattern storage (HNSW-indexed)
|
|
489
|
-
npx claude-flow@v3alpha hooks intelligence pattern-store --pattern "[pattern]" --embedding "[json]"
|
|
490
|
-
npx claude-flow@v3alpha hooks intelligence pattern-search --query "[query]" --limit 10
|
|
491
|
-
|
|
492
|
-
# Learning stats & attention
|
|
493
|
-
npx claude-flow@v3alpha hooks intelligence stats
|
|
494
|
-
npx claude-flow@v3alpha hooks intelligence attention --focus "[task]"
|
|
495
|
-
\`\`\`
|
|
496
|
-
|
|
497
|
-
### Intelligence System (RuVector)
|
|
498
|
-
|
|
499
|
-
V3 includes the RuVector Intelligence System with:
|
|
500
|
-
- **SONA**: Self-Optimizing Neural Architecture
|
|
501
|
-
- **MoE**: Mixture of Experts for specialized routing
|
|
502
|
-
- **HNSW**: 150x faster pattern search
|
|
503
|
-
- **EWC++**: Elastic Weight Consolidation (prevents forgetting)
|
|
504
|
-
- **Flash Attention**: 2.49x-7.47x speedup
|
|
505
|
-
|
|
506
|
-
The 4-step intelligence pipeline:
|
|
507
|
-
1. **RETRIEVE** - Fetch relevant patterns via HNSW
|
|
508
|
-
2. **JUDGE** - Evaluate with verdicts (success/failure)
|
|
509
|
-
3. **DISTILL** - Extract key learnings via LoRA
|
|
510
|
-
4. **CONSOLIDATE** - Prevent catastrophic forgetting via EWC++
|
|
511
|
-
|
|
512
|
-
### Auto-Configured Hooks
|
|
513
|
-
|
|
514
|
-
The init system configures these hooks in \`.claude/settings.json\`:
|
|
515
|
-
|
|
516
|
-
\`\`\`json
|
|
517
|
-
{
|
|
518
|
-
"hooks": {
|
|
519
|
-
"PreToolUse": [
|
|
520
|
-
{ "matcher": "Task", "commands": ["npx claude-flow@v3alpha hooks pre-task --tool Task"] }
|
|
521
|
-
],
|
|
522
|
-
"PostToolUse": [
|
|
523
|
-
{ "matcher": "Task", "commands": ["npx claude-flow@v3alpha hooks post-task --tool Task --train-patterns"] }
|
|
524
|
-
],
|
|
525
|
-
"UserPromptSubmit": [
|
|
526
|
-
{ "matcher": ".*", "commands": ["npx claude-flow@v3alpha hooks route-task --analyze-complexity"] }
|
|
527
|
-
],
|
|
528
|
-
"SessionStart": [
|
|
529
|
-
{ "commands": ["npx claude-flow@v3alpha hooks session-start --load-context"] }
|
|
530
|
-
]
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
\`\`\`
|
|
534
|
-
|
|
535
|
-
### Agent Coordination via Hooks
|
|
536
|
-
|
|
537
|
-
Every spawned agent should use hooks for coordination:
|
|
538
|
-
|
|
539
|
-
\`\`\`javascript
|
|
540
|
-
// In agent prompt instructions
|
|
541
|
-
Task("Coder", \`
|
|
542
|
-
BEFORE starting: npx claude-flow@v3alpha hooks pre-task --description "Implement feature X"
|
|
543
|
-
|
|
544
|
-
DURING work:
|
|
545
|
-
- After each file edit: npx claude-flow@v3alpha hooks post-edit --file "[file]"
|
|
546
|
-
- To notify others: npx claude-flow@v3alpha hooks notify --message "[update]"
|
|
547
|
-
|
|
548
|
-
AFTER completing: npx claude-flow@v3alpha hooks post-task --success true
|
|
549
|
-
\`, "coder")
|
|
550
|
-
\`\`\`
|
|
551
|
-
|
|
552
|
-
## Advanced Features (V3)
|
|
553
|
-
|
|
554
|
-
- 🚀 Automatic Topology Selection
|
|
555
|
-
- ⚡ Parallel Execution (2.8-4.4x speed)
|
|
556
|
-
- 🧠 Neural Training with ReasoningBank
|
|
557
|
-
- 📊 Bottleneck Analysis
|
|
558
|
-
- 🤖 Smart Auto-Spawning
|
|
559
|
-
- 🛡️ Self-Healing Workflows
|
|
560
|
-
- 💾 Cross-Session Memory with AgentDB
|
|
561
|
-
- 🔗 GitHub Integration
|
|
562
|
-
- 🔐 Security-Hardened Architecture
|
|
563
|
-
|
|
564
|
-
## Integration Tips
|
|
565
|
-
|
|
566
|
-
1. Start with basic swarm init
|
|
567
|
-
2. Scale agents gradually
|
|
568
|
-
3. Use memory for context
|
|
569
|
-
4. Monitor progress regularly
|
|
570
|
-
5. Train patterns from success
|
|
571
|
-
6. Enable hooks automation
|
|
572
|
-
7. Use GitHub tools first
|
|
573
|
-
|
|
574
|
-
## Support
|
|
575
|
-
|
|
576
|
-
- Documentation: https://github.com/ruvnet/claude-flow
|
|
577
|
-
- Issues: https://github.com/ruvnet/claude-flow/issues
|
|
578
|
-
|
|
579
|
-
---
|
|
580
|
-
|
|
581
|
-
Remember: **Claude Flow coordinates, Claude Code creates!**
|
|
582
|
-
|
|
583
|
-
# important-instruction-reminders
|
|
584
|
-
Do what has been asked; nothing more, nothing less.
|
|
585
|
-
NEVER create files unless they're absolutely necessary for achieving your goal.
|
|
586
|
-
ALWAYS prefer editing an existing file to creating a new one.
|
|
587
|
-
NEVER proactively create documentation files (*.md) or README files. Only create documentation files if explicitly requested by the User.
|
|
588
|
-
Never save working files, text/mds and tests to the root folder.
|
|
589
|
-
`;
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
/**
|
|
593
|
-
* Generate minimal CLAUDE.md content
|
|
594
|
-
*/
|
|
595
|
-
export function generateMinimalClaudeMd(options: InitOptions): string {
|
|
596
|
-
return `# Claude Code Configuration
|
|
597
|
-
|
|
598
|
-
## Quick Reference
|
|
599
|
-
|
|
600
|
-
- **Topology**: ${options.runtime.topology}
|
|
601
|
-
- **Max Agents**: ${options.runtime.maxAgents}
|
|
602
|
-
- **Memory**: ${options.runtime.memoryBackend}
|
|
603
|
-
|
|
604
|
-
## Key Rules
|
|
605
|
-
|
|
606
|
-
1. **Batch Operations**: All related operations in ONE message
|
|
607
|
-
2. **Task Tool**: Use Claude Code's Task tool for agent execution
|
|
608
|
-
3. **MCP Tools**: Only for coordination, not execution
|
|
609
|
-
4. **File Organization**: Never save to root folder
|
|
610
|
-
|
|
611
|
-
## Agent Execution Pattern
|
|
612
|
-
|
|
613
|
-
\`\`\`javascript
|
|
614
|
-
// Single message with parallel agents
|
|
615
|
-
Task("Researcher", "Analyze requirements...", "researcher")
|
|
616
|
-
Task("Coder", "Implement features...", "coder")
|
|
617
|
-
Task("Tester", "Write tests...", "tester")
|
|
618
|
-
\`\`\`
|
|
619
|
-
|
|
620
|
-
## MCP Setup
|
|
621
|
-
|
|
622
|
-
\`\`\`bash
|
|
623
|
-
claude mcp add claude-flow npx claude-flow@v3alpha mcp start
|
|
624
|
-
\`\`\`
|
|
625
|
-
|
|
626
|
-
---
|
|
627
|
-
Remember: **Claude Flow coordinates, Claude Code creates!**
|
|
628
|
-
`;
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
export default generateClaudeMd;
|