@claude-flow/mcp 3.0.0-alpha.8 โ 3.0.0-alpha.9
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/.claude/agents/analysis/analyze-code-quality.md +179 -0
- package/.claude/agents/analysis/code-analyzer.md +210 -0
- package/.claude/agents/analysis/code-review/analyze-code-quality.md +179 -0
- package/.claude/agents/architecture/arch-system-design.md +157 -0
- package/.claude/agents/architecture/system-design/arch-system-design.md +155 -0
- package/.claude/agents/consensus/byzantine-coordinator.md +63 -0
- package/.claude/agents/consensus/crdt-synchronizer.md +997 -0
- package/.claude/agents/consensus/gossip-coordinator.md +63 -0
- package/.claude/agents/consensus/performance-benchmarker.md +851 -0
- package/.claude/agents/consensus/quorum-manager.md +823 -0
- package/.claude/agents/consensus/raft-manager.md +63 -0
- package/.claude/agents/consensus/security-manager.md +622 -0
- package/.claude/agents/core/coder.md +453 -0
- package/.claude/agents/core/planner.md +375 -0
- package/.claude/agents/core/researcher.md +369 -0
- package/.claude/agents/core/reviewer.md +520 -0
- package/.claude/agents/core/tester.md +512 -0
- package/.claude/agents/custom/test-long-runner.md +44 -0
- package/.claude/agents/data/data-ml-model.md +445 -0
- package/.claude/agents/data/ml/data-ml-model.md +193 -0
- package/.claude/agents/development/backend/dev-backend-api.md +142 -0
- package/.claude/agents/development/dev-backend-api.md +345 -0
- package/.claude/agents/devops/ci-cd/ops-cicd-github.md +164 -0
- package/.claude/agents/devops/ops-cicd-github.md +165 -0
- package/.claude/agents/documentation/api-docs/docs-api-openapi.md +174 -0
- package/.claude/agents/documentation/docs-api-openapi.md +355 -0
- package/.claude/agents/flow-nexus/app-store.md +88 -0
- package/.claude/agents/flow-nexus/authentication.md +69 -0
- package/.claude/agents/flow-nexus/challenges.md +81 -0
- package/.claude/agents/flow-nexus/neural-network.md +88 -0
- package/.claude/agents/flow-nexus/payments.md +83 -0
- package/.claude/agents/flow-nexus/sandbox.md +76 -0
- package/.claude/agents/flow-nexus/swarm.md +76 -0
- package/.claude/agents/flow-nexus/user-tools.md +96 -0
- package/.claude/agents/flow-nexus/workflow.md +84 -0
- package/.claude/agents/github/code-review-swarm.md +377 -0
- package/.claude/agents/github/github-modes.md +173 -0
- package/.claude/agents/github/issue-tracker.md +576 -0
- package/.claude/agents/github/multi-repo-swarm.md +553 -0
- package/.claude/agents/github/pr-manager.md +438 -0
- package/.claude/agents/github/project-board-sync.md +509 -0
- package/.claude/agents/github/release-manager.md +605 -0
- package/.claude/agents/github/release-swarm.md +583 -0
- package/.claude/agents/github/repo-architect.md +398 -0
- package/.claude/agents/github/swarm-issue.md +573 -0
- package/.claude/agents/github/swarm-pr.md +428 -0
- package/.claude/agents/github/sync-coordinator.md +452 -0
- package/.claude/agents/github/workflow-automation.md +903 -0
- package/.claude/agents/goal/agent.md +816 -0
- package/.claude/agents/goal/goal-planner.md +73 -0
- package/.claude/agents/optimization/benchmark-suite.md +665 -0
- package/.claude/agents/optimization/load-balancer.md +431 -0
- package/.claude/agents/optimization/performance-monitor.md +672 -0
- package/.claude/agents/optimization/resource-allocator.md +674 -0
- package/.claude/agents/optimization/topology-optimizer.md +808 -0
- package/.claude/agents/payments/agentic-payments.md +126 -0
- package/.claude/agents/sona/sona-learning-optimizer.md +74 -0
- package/.claude/agents/sparc/architecture.md +699 -0
- package/.claude/agents/sparc/pseudocode.md +520 -0
- package/.claude/agents/sparc/refinement.md +802 -0
- package/.claude/agents/sparc/specification.md +478 -0
- package/.claude/agents/specialized/mobile/spec-mobile-react-native.md +225 -0
- package/.claude/agents/specialized/spec-mobile-react-native.md +227 -0
- package/.claude/agents/sublinear/consensus-coordinator.md +338 -0
- package/.claude/agents/sublinear/matrix-optimizer.md +185 -0
- package/.claude/agents/sublinear/pagerank-analyzer.md +299 -0
- package/.claude/agents/sublinear/performance-optimizer.md +368 -0
- package/.claude/agents/sublinear/trading-predictor.md +246 -0
- package/.claude/agents/swarm/adaptive-coordinator.md +1127 -0
- package/.claude/agents/swarm/hierarchical-coordinator.md +710 -0
- package/.claude/agents/swarm/mesh-coordinator.md +963 -0
- package/.claude/agents/templates/automation-smart-agent.md +205 -0
- package/.claude/agents/templates/base-template-generator.md +268 -0
- package/.claude/agents/templates/coordinator-swarm-init.md +90 -0
- package/.claude/agents/templates/github-pr-manager.md +177 -0
- package/.claude/agents/templates/implementer-sparc-coder.md +259 -0
- package/.claude/agents/templates/memory-coordinator.md +187 -0
- package/.claude/agents/templates/orchestrator-task.md +139 -0
- package/.claude/agents/templates/performance-analyzer.md +199 -0
- package/.claude/agents/templates/sparc-coordinator.md +514 -0
- package/.claude/agents/testing/production-validator.md +395 -0
- package/.claude/agents/testing/tdd-london-swarm.md +244 -0
- package/.claude/agents/v3/adr-architect.md +184 -0
- package/.claude/agents/v3/aidefence-guardian.md +282 -0
- package/.claude/agents/v3/claims-authorizer.md +208 -0
- package/.claude/agents/v3/collective-intelligence-coordinator.md +993 -0
- package/.claude/agents/v3/ddd-domain-expert.md +220 -0
- package/.claude/agents/v3/injection-analyst.md +236 -0
- package/.claude/agents/v3/memory-specialist.md +995 -0
- package/.claude/agents/v3/performance-engineer.md +1233 -0
- package/.claude/agents/v3/pii-detector.md +151 -0
- package/.claude/agents/v3/reasoningbank-learner.md +213 -0
- package/.claude/agents/v3/security-architect-aidefence.md +410 -0
- package/.claude/agents/v3/security-architect.md +867 -0
- package/.claude/agents/v3/security-auditor.md +771 -0
- package/.claude/agents/v3/sparc-orchestrator.md +182 -0
- package/.claude/agents/v3/swarm-memory-manager.md +157 -0
- package/.claude/agents/v3/v3-integration-architect.md +205 -0
- package/.claude/commands/analysis/COMMAND_COMPLIANCE_REPORT.md +54 -0
- package/.claude/commands/analysis/README.md +9 -0
- package/.claude/commands/analysis/bottleneck-detect.md +162 -0
- package/.claude/commands/analysis/performance-bottlenecks.md +59 -0
- package/.claude/commands/analysis/performance-report.md +25 -0
- package/.claude/commands/analysis/token-efficiency.md +45 -0
- package/.claude/commands/analysis/token-usage.md +25 -0
- package/.claude/commands/automation/README.md +9 -0
- package/.claude/commands/automation/auto-agent.md +122 -0
- package/.claude/commands/automation/self-healing.md +106 -0
- package/.claude/commands/automation/session-memory.md +90 -0
- package/.claude/commands/automation/smart-agents.md +73 -0
- package/.claude/commands/automation/smart-spawn.md +25 -0
- package/.claude/commands/automation/workflow-select.md +25 -0
- package/.claude/commands/claude-flow-help.md +103 -0
- package/.claude/commands/claude-flow-memory.md +107 -0
- package/.claude/commands/claude-flow-swarm.md +205 -0
- package/.claude/commands/github/README.md +11 -0
- package/.claude/commands/github/code-review-swarm.md +514 -0
- package/.claude/commands/github/code-review.md +25 -0
- package/.claude/commands/github/github-modes.md +147 -0
- package/.claude/commands/github/github-swarm.md +121 -0
- package/.claude/commands/github/issue-tracker.md +292 -0
- package/.claude/commands/github/issue-triage.md +25 -0
- package/.claude/commands/github/multi-repo-swarm.md +519 -0
- package/.claude/commands/github/pr-enhance.md +26 -0
- package/.claude/commands/github/pr-manager.md +170 -0
- package/.claude/commands/github/project-board-sync.md +471 -0
- package/.claude/commands/github/release-manager.md +338 -0
- package/.claude/commands/github/release-swarm.md +544 -0
- package/.claude/commands/github/repo-analyze.md +25 -0
- package/.claude/commands/github/repo-architect.md +367 -0
- package/.claude/commands/github/swarm-issue.md +482 -0
- package/.claude/commands/github/swarm-pr.md +285 -0
- package/.claude/commands/github/sync-coordinator.md +301 -0
- package/.claude/commands/github/workflow-automation.md +442 -0
- package/.claude/commands/hooks/README.md +11 -0
- package/.claude/commands/hooks/overview.md +58 -0
- package/.claude/commands/hooks/post-edit.md +117 -0
- package/.claude/commands/hooks/post-task.md +112 -0
- package/.claude/commands/hooks/pre-edit.md +113 -0
- package/.claude/commands/hooks/pre-task.md +111 -0
- package/.claude/commands/hooks/session-end.md +118 -0
- package/.claude/commands/hooks/setup.md +103 -0
- package/.claude/commands/monitoring/README.md +9 -0
- package/.claude/commands/monitoring/agent-metrics.md +25 -0
- package/.claude/commands/monitoring/agents.md +44 -0
- package/.claude/commands/monitoring/real-time-view.md +25 -0
- package/.claude/commands/monitoring/status.md +46 -0
- package/.claude/commands/monitoring/swarm-monitor.md +25 -0
- package/.claude/commands/optimization/README.md +9 -0
- package/.claude/commands/optimization/auto-topology.md +62 -0
- package/.claude/commands/optimization/cache-manage.md +25 -0
- package/.claude/commands/optimization/parallel-execute.md +25 -0
- package/.claude/commands/optimization/parallel-execution.md +50 -0
- package/.claude/commands/optimization/topology-optimize.md +25 -0
- package/.claude/commands/sparc/analyzer.md +52 -0
- package/.claude/commands/sparc/architect.md +53 -0
- package/.claude/commands/sparc/ask.md +97 -0
- package/.claude/commands/sparc/batch-executor.md +54 -0
- package/.claude/commands/sparc/code.md +89 -0
- package/.claude/commands/sparc/coder.md +54 -0
- package/.claude/commands/sparc/debug.md +83 -0
- package/.claude/commands/sparc/debugger.md +54 -0
- package/.claude/commands/sparc/designer.md +53 -0
- package/.claude/commands/sparc/devops.md +109 -0
- package/.claude/commands/sparc/docs-writer.md +80 -0
- package/.claude/commands/sparc/documenter.md +54 -0
- package/.claude/commands/sparc/innovator.md +54 -0
- package/.claude/commands/sparc/integration.md +83 -0
- package/.claude/commands/sparc/mcp.md +117 -0
- package/.claude/commands/sparc/memory-manager.md +54 -0
- package/.claude/commands/sparc/optimizer.md +54 -0
- package/.claude/commands/sparc/orchestrator.md +132 -0
- package/.claude/commands/sparc/post-deployment-monitoring-mode.md +83 -0
- package/.claude/commands/sparc/refinement-optimization-mode.md +83 -0
- package/.claude/commands/sparc/researcher.md +54 -0
- package/.claude/commands/sparc/reviewer.md +54 -0
- package/.claude/commands/sparc/security-review.md +80 -0
- package/.claude/commands/sparc/sparc-modes.md +174 -0
- package/.claude/commands/sparc/sparc.md +111 -0
- package/.claude/commands/sparc/spec-pseudocode.md +80 -0
- package/.claude/commands/sparc/supabase-admin.md +348 -0
- package/.claude/commands/sparc/swarm-coordinator.md +54 -0
- package/.claude/commands/sparc/tdd.md +54 -0
- package/.claude/commands/sparc/tester.md +54 -0
- package/.claude/commands/sparc/tutorial.md +79 -0
- package/.claude/commands/sparc/workflow-manager.md +54 -0
- package/.claude/helpers/README.md +97 -0
- package/.claude/helpers/adr-compliance.sh +186 -0
- package/.claude/helpers/auto-commit.sh +178 -0
- package/.claude/helpers/checkpoint-manager.sh +251 -0
- package/.claude/helpers/daemon-manager.sh +252 -0
- package/.claude/helpers/ddd-tracker.sh +144 -0
- package/.claude/helpers/github-safe.js +106 -0
- package/.claude/helpers/github-setup.sh +28 -0
- package/.claude/helpers/guidance-hook.sh +13 -0
- package/.claude/helpers/guidance-hooks.sh +102 -0
- package/.claude/helpers/health-monitor.sh +108 -0
- package/.claude/helpers/learning-hooks.sh +329 -0
- package/.claude/helpers/learning-optimizer.sh +127 -0
- package/.claude/helpers/learning-service.mjs +1144 -0
- package/.claude/helpers/memory.js +83 -0
- package/.claude/helpers/metrics-db.mjs +488 -0
- package/.claude/helpers/pattern-consolidator.sh +86 -0
- package/.claude/helpers/perf-worker.sh +160 -0
- package/.claude/helpers/post-commit +16 -0
- package/.claude/helpers/pre-commit +26 -0
- package/.claude/helpers/quick-start.sh +19 -0
- package/.claude/helpers/router.js +66 -0
- package/.claude/helpers/security-scanner.sh +127 -0
- package/.claude/helpers/session.js +127 -0
- package/.claude/helpers/setup-mcp.sh +18 -0
- package/.claude/helpers/standard-checkpoint-hooks.sh +189 -0
- package/.claude/helpers/statusline-hook.sh +21 -0
- package/.claude/helpers/statusline.cjs +509 -0
- package/.claude/helpers/statusline.js +316 -0
- package/.claude/helpers/swarm-comms.sh +353 -0
- package/.claude/helpers/swarm-hooks.sh +761 -0
- package/.claude/helpers/swarm-monitor.sh +211 -0
- package/.claude/helpers/sync-v3-metrics.sh +245 -0
- package/.claude/helpers/update-v3-progress.sh +166 -0
- package/.claude/helpers/v3-quick-status.sh +58 -0
- package/.claude/helpers/v3.sh +111 -0
- package/.claude/helpers/validate-v3-config.sh +216 -0
- package/.claude/helpers/worker-manager.sh +170 -0
- package/.claude/settings.json +237 -0
- package/CLAUDE.md +711 -0
- package/README.md +1 -1
- package/__tests__/mcp.test.ts +4 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +3 -6
- package/dist/server.js.map +1 -1
- package/dist/types.d.ts +10 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/src/server.ts +3 -6
- package/src/types.ts +10 -5
- package/.agentic-flow/intelligence.json +0 -16
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,711 @@
|
|
|
1
|
+
# Claude Code Configuration - Claude Flow V3
|
|
2
|
+
|
|
3
|
+
## ๐จ AUTOMATIC SWARM ORCHESTRATION
|
|
4
|
+
|
|
5
|
+
**When starting work on complex tasks, Claude Code MUST automatically:**
|
|
6
|
+
|
|
7
|
+
1. **Initialize the swarm** using CLI tools via Bash
|
|
8
|
+
2. **Spawn concurrent agents** using Claude Code's Task tool
|
|
9
|
+
3. **Coordinate via hooks** and memory
|
|
10
|
+
|
|
11
|
+
### ๐จ CRITICAL: CLI + Task Tool in SAME Message
|
|
12
|
+
|
|
13
|
+
**When user says "spawn swarm" or requests complex work, Claude Code MUST in ONE message:**
|
|
14
|
+
1. Call CLI tools via Bash to initialize coordination
|
|
15
|
+
2. **IMMEDIATELY** call Task tool to spawn REAL working agents
|
|
16
|
+
3. Both CLI and Task calls must be in the SAME response
|
|
17
|
+
|
|
18
|
+
**CLI coordinates, Task tool agents do the actual work!**
|
|
19
|
+
|
|
20
|
+
### ๐ค INTELLIGENT 3-TIER MODEL ROUTING (ADR-026)
|
|
21
|
+
|
|
22
|
+
**The routing system has 3 tiers for optimal cost/performance:**
|
|
23
|
+
|
|
24
|
+
| Tier | Handler | Latency | Cost | Use Cases |
|
|
25
|
+
|------|---------|---------|------|-----------|
|
|
26
|
+
| **1** | Agent Booster | <1ms | $0 | Simple transforms (varโconst, add-types, remove-console) |
|
|
27
|
+
| **2** | Haiku | ~500ms | $0.0002 | Simple tasks, bug fixes, low complexity |
|
|
28
|
+
| **3** | Sonnet/Opus | 2-5s | $0.003-$0.015 | Architecture, security, complex reasoning |
|
|
29
|
+
|
|
30
|
+
**Before spawning agents, get routing recommendation:**
|
|
31
|
+
```bash
|
|
32
|
+
npx @claude-flow/cli@latest hooks pre-task --description "[task description]"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**When you see these recommendations:**
|
|
36
|
+
|
|
37
|
+
1. `[AGENT_BOOSTER_AVAILABLE]` โ Skip LLM entirely, use Edit tool directly
|
|
38
|
+
- Intent types: `var-to-const`, `add-types`, `add-error-handling`, `async-await`, `add-logging`, `remove-console`
|
|
39
|
+
|
|
40
|
+
2. `[TASK_MODEL_RECOMMENDATION] Use model="X"` โ Use that model in Task tool:
|
|
41
|
+
```javascript
|
|
42
|
+
Task({
|
|
43
|
+
prompt: "...",
|
|
44
|
+
subagent_type: "coder",
|
|
45
|
+
model: "haiku" // โ USE THE RECOMMENDED MODEL (haiku/sonnet/opus)
|
|
46
|
+
})
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**Benefits:** 75% cost reduction, 352x faster for Tier 1 tasks
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
### ๐ก๏ธ Anti-Drift Config (PREFERRED)
|
|
54
|
+
|
|
55
|
+
**Use this to prevent agent drift:**
|
|
56
|
+
```bash
|
|
57
|
+
# Small teams (6-8 agents) - use hierarchical for tight control
|
|
58
|
+
npx @claude-flow/cli@latest swarm init --topology hierarchical --max-agents 8 --strategy specialized
|
|
59
|
+
|
|
60
|
+
# Large teams (10-15 agents) - use hierarchical-mesh for V3 queen + peer communication
|
|
61
|
+
npx @claude-flow/cli@latest swarm init --topology hierarchical-mesh --max-agents 15 --strategy specialized
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Valid Topologies:**
|
|
65
|
+
- `hierarchical` - Queen controls workers directly (anti-drift for small teams)
|
|
66
|
+
- `hierarchical-mesh` - V3 queen + peer communication (recommended for 10+ agents)
|
|
67
|
+
- `mesh` - Fully connected peer network
|
|
68
|
+
- `ring` - Circular communication pattern
|
|
69
|
+
- `star` - Central coordinator with spokes
|
|
70
|
+
- `hybrid` - Dynamic topology switching
|
|
71
|
+
|
|
72
|
+
**Anti-Drift Guidelines:**
|
|
73
|
+
- **hierarchical**: Coordinator catches divergence
|
|
74
|
+
- **max-agents 6-8**: Smaller team = less drift
|
|
75
|
+
- **specialized**: Clear roles, no overlap
|
|
76
|
+
- **consensus**: raft (leader maintains state)
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
### ๐ Auto-Start Swarm Protocol (Background Execution)
|
|
81
|
+
|
|
82
|
+
When the user requests a complex task, **spawn agents in background and WAIT for completion:**
|
|
83
|
+
|
|
84
|
+
```javascript
|
|
85
|
+
// STEP 1: Initialize swarm coordination (anti-drift config)
|
|
86
|
+
Bash("npx @claude-flow/cli@latest swarm init --topology hierarchical --max-agents 8 --strategy specialized")
|
|
87
|
+
|
|
88
|
+
// STEP 2: Spawn ALL agents IN BACKGROUND in a SINGLE message
|
|
89
|
+
// Use run_in_background: true so agents work concurrently
|
|
90
|
+
Task({
|
|
91
|
+
prompt: "Research requirements, analyze codebase patterns, store findings in memory",
|
|
92
|
+
subagent_type: "researcher",
|
|
93
|
+
description: "Research phase",
|
|
94
|
+
run_in_background: true // โ CRITICAL: Run in background
|
|
95
|
+
})
|
|
96
|
+
Task({
|
|
97
|
+
prompt: "Design architecture based on research. Document decisions.",
|
|
98
|
+
subagent_type: "system-architect",
|
|
99
|
+
description: "Architecture phase",
|
|
100
|
+
run_in_background: true
|
|
101
|
+
})
|
|
102
|
+
Task({
|
|
103
|
+
prompt: "Implement the solution following the design. Write clean code.",
|
|
104
|
+
subagent_type: "coder",
|
|
105
|
+
description: "Implementation phase",
|
|
106
|
+
run_in_background: true
|
|
107
|
+
})
|
|
108
|
+
Task({
|
|
109
|
+
prompt: "Write comprehensive tests for the implementation.",
|
|
110
|
+
subagent_type: "tester",
|
|
111
|
+
description: "Testing phase",
|
|
112
|
+
run_in_background: true
|
|
113
|
+
})
|
|
114
|
+
Task({
|
|
115
|
+
prompt: "Review code quality, security, and best practices.",
|
|
116
|
+
subagent_type: "reviewer",
|
|
117
|
+
description: "Review phase",
|
|
118
|
+
run_in_background: true
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
// STEP 3: WAIT - Tell user agents are working, then STOP
|
|
122
|
+
// Say: "I've spawned 5 agents to work on this in parallel. They'll report back when done."
|
|
123
|
+
// DO NOT check status repeatedly. Just wait for user or agent responses.
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### โธ๏ธ CRITICAL: Spawn and Wait Pattern
|
|
127
|
+
|
|
128
|
+
**After spawning background agents:**
|
|
129
|
+
|
|
130
|
+
1. **TELL USER** - "I've spawned X agents working in parallel on: [list tasks]"
|
|
131
|
+
2. **STOP** - Do not continue with more tool calls
|
|
132
|
+
3. **WAIT** - Let the background agents complete their work
|
|
133
|
+
4. **RESPOND** - When agents return results, review and synthesize
|
|
134
|
+
|
|
135
|
+
**Example response after spawning:**
|
|
136
|
+
```
|
|
137
|
+
I've launched 5 concurrent agents to work on this:
|
|
138
|
+
- ๐ Researcher: Analyzing requirements and codebase
|
|
139
|
+
- ๐๏ธ Architect: Designing the implementation approach
|
|
140
|
+
- ๐ป Coder: Implementing the solution
|
|
141
|
+
- ๐งช Tester: Writing tests
|
|
142
|
+
- ๐ Reviewer: Code review and security check
|
|
143
|
+
|
|
144
|
+
They're working in parallel. I'll synthesize their results when they complete.
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### ๐ซ DO NOT:
|
|
148
|
+
- Continuously check swarm status
|
|
149
|
+
- Poll TaskOutput repeatedly
|
|
150
|
+
- Add more tool calls after spawning
|
|
151
|
+
- Ask "should I check on the agents?"
|
|
152
|
+
|
|
153
|
+
### โ
DO:
|
|
154
|
+
- Spawn all agents in ONE message
|
|
155
|
+
- Tell user what's happening
|
|
156
|
+
- Wait for agent results to arrive
|
|
157
|
+
- Synthesize results when they return
|
|
158
|
+
|
|
159
|
+
## ๐ง AUTO-LEARNING PROTOCOL
|
|
160
|
+
|
|
161
|
+
### Before Starting Any Task
|
|
162
|
+
```bash
|
|
163
|
+
# 1. Search memory for relevant patterns from past successes
|
|
164
|
+
Bash("npx @claude-flow/cli@latest memory search --query '[task keywords]' --namespace patterns")
|
|
165
|
+
|
|
166
|
+
# 2. Check if similar task was done before
|
|
167
|
+
Bash("npx @claude-flow/cli@latest memory search --query '[task type]' --namespace tasks")
|
|
168
|
+
|
|
169
|
+
# 3. Load learned optimizations
|
|
170
|
+
Bash("npx @claude-flow/cli@latest hooks route --task '[task description]'")
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### After Completing Any Task Successfully
|
|
174
|
+
```bash
|
|
175
|
+
# 1. Store successful pattern for future reference
|
|
176
|
+
Bash("npx @claude-flow/cli@latest memory store --namespace patterns --key '[pattern-name]' --value '[what worked]'")
|
|
177
|
+
|
|
178
|
+
# 2. Train neural patterns on the successful approach
|
|
179
|
+
Bash("npx @claude-flow/cli@latest hooks post-edit --file '[main-file]' --train-neural true")
|
|
180
|
+
|
|
181
|
+
# 3. Record task completion with metrics
|
|
182
|
+
Bash("npx @claude-flow/cli@latest hooks post-task --task-id '[id]' --success true --store-results true")
|
|
183
|
+
|
|
184
|
+
# 4. Trigger optimization worker if performance-related
|
|
185
|
+
Bash("npx @claude-flow/cli@latest hooks worker dispatch --trigger optimize")
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Continuous Improvement Triggers
|
|
189
|
+
|
|
190
|
+
| Trigger | Worker | When to Use |
|
|
191
|
+
|---------|--------|-------------|
|
|
192
|
+
| After major refactor | `optimize` | Performance optimization |
|
|
193
|
+
| After adding features | `testgaps` | Find missing test coverage |
|
|
194
|
+
| After security changes | `audit` | Security analysis |
|
|
195
|
+
| After API changes | `document` | Update documentation |
|
|
196
|
+
| Every 5+ file changes | `map` | Update codebase map |
|
|
197
|
+
| Complex debugging | `deepdive` | Deep code analysis |
|
|
198
|
+
|
|
199
|
+
### Memory-Enhanced Development
|
|
200
|
+
|
|
201
|
+
**ALWAYS check memory before:**
|
|
202
|
+
- Starting a new feature (search for similar implementations)
|
|
203
|
+
- Debugging an issue (search for past solutions)
|
|
204
|
+
- Refactoring code (search for learned patterns)
|
|
205
|
+
- Performance work (search for optimization strategies)
|
|
206
|
+
|
|
207
|
+
**ALWAYS store in memory after:**
|
|
208
|
+
- Solving a tricky bug (store the solution pattern)
|
|
209
|
+
- Completing a feature (store the approach)
|
|
210
|
+
- Finding a performance fix (store the optimization)
|
|
211
|
+
- Discovering a security issue (store the vulnerability pattern)
|
|
212
|
+
|
|
213
|
+
### ๐ Agent Routing (Anti-Drift)
|
|
214
|
+
|
|
215
|
+
| Code | Task | Agents |
|
|
216
|
+
|------|------|--------|
|
|
217
|
+
| 1 | Bug Fix | coordinator, researcher, coder, tester |
|
|
218
|
+
| 3 | Feature | coordinator, architect, coder, tester, reviewer |
|
|
219
|
+
| 5 | Refactor | coordinator, architect, coder, reviewer |
|
|
220
|
+
| 7 | Performance | coordinator, perf-engineer, coder |
|
|
221
|
+
| 9 | Security | coordinator, security-architect, auditor |
|
|
222
|
+
| 11 | Docs | researcher, api-docs |
|
|
223
|
+
|
|
224
|
+
**Codes 1-9: hierarchical/specialized (anti-drift). Code 11: mesh/balanced**
|
|
225
|
+
|
|
226
|
+
### ๐ฏ Task Complexity Detection
|
|
227
|
+
|
|
228
|
+
**AUTO-INVOKE SWARM when task involves:**
|
|
229
|
+
- Multiple files (3+)
|
|
230
|
+
- New feature implementation
|
|
231
|
+
- Refactoring across modules
|
|
232
|
+
- API changes with tests
|
|
233
|
+
- Security-related changes
|
|
234
|
+
- Performance optimization
|
|
235
|
+
- Database schema changes
|
|
236
|
+
|
|
237
|
+
**SKIP SWARM for:**
|
|
238
|
+
- Single file edits
|
|
239
|
+
- Simple bug fixes (1-2 lines)
|
|
240
|
+
- Documentation updates
|
|
241
|
+
- Configuration changes
|
|
242
|
+
- Quick questions/exploration
|
|
243
|
+
|
|
244
|
+
## ๐จ CRITICAL: CONCURRENT EXECUTION & FILE MANAGEMENT
|
|
245
|
+
|
|
246
|
+
**ABSOLUTE RULES**:
|
|
247
|
+
1. ALL operations MUST be concurrent/parallel in a single message
|
|
248
|
+
2. **NEVER save working files, text/mds and tests to the root folder**
|
|
249
|
+
3. ALWAYS organize files in appropriate subdirectories
|
|
250
|
+
4. **USE CLAUDE CODE'S TASK TOOL** for spawning agents concurrently, not just MCP
|
|
251
|
+
|
|
252
|
+
### โก GOLDEN RULE: "1 MESSAGE = ALL RELATED OPERATIONS"
|
|
253
|
+
|
|
254
|
+
**MANDATORY PATTERNS:**
|
|
255
|
+
- **TodoWrite**: ALWAYS batch ALL todos in ONE call (5-10+ todos minimum)
|
|
256
|
+
- **Task tool (Claude Code)**: ALWAYS spawn ALL agents in ONE message with full instructions
|
|
257
|
+
- **File operations**: ALWAYS batch ALL reads/writes/edits in ONE message
|
|
258
|
+
- **Bash commands**: ALWAYS batch ALL terminal operations in ONE message
|
|
259
|
+
- **Memory operations**: ALWAYS batch ALL memory store/retrieve in ONE message
|
|
260
|
+
|
|
261
|
+
### ๐ File Organization Rules
|
|
262
|
+
|
|
263
|
+
**NEVER save to root folder. Use these directories:**
|
|
264
|
+
- `/src` - Source code files
|
|
265
|
+
- `/tests` - Test files
|
|
266
|
+
- `/docs` - Documentation and markdown files
|
|
267
|
+
- `/config` - Configuration files
|
|
268
|
+
- `/scripts` - Utility scripts
|
|
269
|
+
- `/examples` - Example code
|
|
270
|
+
|
|
271
|
+
## Project Config (Anti-Drift Defaults)
|
|
272
|
+
|
|
273
|
+
- **Topology**: hierarchical (prevents drift)
|
|
274
|
+
- **Max Agents**: 8 (smaller = less drift)
|
|
275
|
+
- **Strategy**: specialized (clear roles)
|
|
276
|
+
- **Consensus**: raft
|
|
277
|
+
- **Memory**: hybrid
|
|
278
|
+
- **HNSW**: Enabled
|
|
279
|
+
- **Neural**: Enabled
|
|
280
|
+
|
|
281
|
+
## ๐ V3 CLI Commands (26 Commands, 140+ Subcommands)
|
|
282
|
+
|
|
283
|
+
### Core Commands
|
|
284
|
+
|
|
285
|
+
| Command | Subcommands | Description |
|
|
286
|
+
|---------|-------------|-------------|
|
|
287
|
+
| `init` | 4 | Project initialization with wizard, presets, skills, hooks |
|
|
288
|
+
| `agent` | 8 | Agent lifecycle (spawn, list, status, stop, metrics, pool, health, logs) |
|
|
289
|
+
| `swarm` | 6 | Multi-agent swarm coordination and orchestration |
|
|
290
|
+
| `memory` | 11 | AgentDB memory with vector search (150x-12,500x faster) |
|
|
291
|
+
| `mcp` | 9 | MCP server management and tool execution |
|
|
292
|
+
| `task` | 6 | Task creation, assignment, and lifecycle |
|
|
293
|
+
| `session` | 7 | Session state management and persistence |
|
|
294
|
+
| `config` | 7 | Configuration management and provider setup |
|
|
295
|
+
| `status` | 3 | System status monitoring with watch mode |
|
|
296
|
+
| `workflow` | 6 | Workflow execution and template management |
|
|
297
|
+
| `hooks` | 17 | Self-learning hooks + 12 background workers |
|
|
298
|
+
| `hive-mind` | 6 | Queen-led Byzantine fault-tolerant consensus |
|
|
299
|
+
|
|
300
|
+
### Advanced Commands
|
|
301
|
+
|
|
302
|
+
| Command | Subcommands | Description |
|
|
303
|
+
|---------|-------------|-------------|
|
|
304
|
+
| `daemon` | 5 | Background worker daemon (start, stop, status, trigger, enable) |
|
|
305
|
+
| `neural` | 5 | Neural pattern training (train, status, patterns, predict, optimize) |
|
|
306
|
+
| `security` | 6 | Security scanning (scan, audit, cve, threats, validate, report) |
|
|
307
|
+
| `performance` | 5 | Performance profiling (benchmark, profile, metrics, optimize, report) |
|
|
308
|
+
| `providers` | 5 | AI providers (list, add, remove, test, configure) |
|
|
309
|
+
| `plugins` | 5 | Plugin management (list, install, uninstall, enable, disable) |
|
|
310
|
+
| `deployment` | 5 | Deployment management (deploy, rollback, status, environments, release) |
|
|
311
|
+
| `embeddings` | 4 | Vector embeddings (embed, batch, search, init) - 75x faster with agentic-flow |
|
|
312
|
+
| `claims` | 4 | Claims-based authorization (check, grant, revoke, list) |
|
|
313
|
+
| `migrate` | 5 | V2 to V3 migration with rollback support |
|
|
314
|
+
| `doctor` | 1 | System diagnostics with health checks |
|
|
315
|
+
| `completions` | 4 | Shell completions (bash, zsh, fish, powershell) |
|
|
316
|
+
|
|
317
|
+
### Quick CLI Examples
|
|
318
|
+
|
|
319
|
+
```bash
|
|
320
|
+
# Initialize project
|
|
321
|
+
npx @claude-flow/cli@latest init --wizard
|
|
322
|
+
|
|
323
|
+
# Start daemon with background workers
|
|
324
|
+
npx @claude-flow/cli@latest daemon start
|
|
325
|
+
|
|
326
|
+
# Spawn an agent
|
|
327
|
+
npx @claude-flow/cli@latest agent spawn -t coder --name my-coder
|
|
328
|
+
|
|
329
|
+
# Initialize swarm
|
|
330
|
+
npx @claude-flow/cli@latest swarm init --v3-mode
|
|
331
|
+
|
|
332
|
+
# Search memory (HNSW-indexed)
|
|
333
|
+
npx @claude-flow/cli@latest memory search --query "authentication patterns"
|
|
334
|
+
|
|
335
|
+
# System diagnostics
|
|
336
|
+
npx @claude-flow/cli@latest doctor --fix
|
|
337
|
+
|
|
338
|
+
# Security scan
|
|
339
|
+
npx @claude-flow/cli@latest security scan --depth full
|
|
340
|
+
|
|
341
|
+
# Performance benchmark
|
|
342
|
+
npx @claude-flow/cli@latest performance benchmark --suite all
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
## ๐ Available Agents (60+ Types)
|
|
346
|
+
|
|
347
|
+
### Core Development
|
|
348
|
+
`coder`, `reviewer`, `tester`, `planner`, `researcher`
|
|
349
|
+
|
|
350
|
+
### V3 Specialized Agents
|
|
351
|
+
`security-architect`, `security-auditor`, `memory-specialist`, `performance-engineer`
|
|
352
|
+
|
|
353
|
+
### ๐ @claude-flow/security
|
|
354
|
+
CVE remediation, input validation, path security:
|
|
355
|
+
- `InputValidator` - Zod validation
|
|
356
|
+
- `PathValidator` - Traversal prevention
|
|
357
|
+
- `SafeExecutor` - Injection protection
|
|
358
|
+
|
|
359
|
+
### Swarm Coordination
|
|
360
|
+
`hierarchical-coordinator`, `mesh-coordinator`, `adaptive-coordinator`, `collective-intelligence-coordinator`, `swarm-memory-manager`
|
|
361
|
+
|
|
362
|
+
### Consensus & Distributed
|
|
363
|
+
`byzantine-coordinator`, `raft-manager`, `gossip-coordinator`, `consensus-builder`, `crdt-synchronizer`, `quorum-manager`, `security-manager`
|
|
364
|
+
|
|
365
|
+
### Performance & Optimization
|
|
366
|
+
`perf-analyzer`, `performance-benchmarker`, `task-orchestrator`, `memory-coordinator`, `smart-agent`
|
|
367
|
+
|
|
368
|
+
### GitHub & Repository
|
|
369
|
+
`github-modes`, `pr-manager`, `code-review-swarm`, `issue-tracker`, `release-manager`, `workflow-automation`, `project-board-sync`, `repo-architect`, `multi-repo-swarm`
|
|
370
|
+
|
|
371
|
+
### SPARC Methodology
|
|
372
|
+
`sparc-coord`, `sparc-coder`, `specification`, `pseudocode`, `architecture`, `refinement`
|
|
373
|
+
|
|
374
|
+
### Specialized Development
|
|
375
|
+
`backend-dev`, `mobile-dev`, `ml-developer`, `cicd-engineer`, `api-docs`, `system-architect`, `code-analyzer`, `base-template-generator`
|
|
376
|
+
|
|
377
|
+
### Testing & Validation
|
|
378
|
+
`tdd-london-swarm`, `production-validator`
|
|
379
|
+
|
|
380
|
+
## ๐ช V3 Hooks System (27 Hooks + 12 Workers)
|
|
381
|
+
|
|
382
|
+
### All Available Hooks
|
|
383
|
+
|
|
384
|
+
| Hook | Description | Key Options |
|
|
385
|
+
|------|-------------|-------------|
|
|
386
|
+
| `pre-edit` | Get context before editing files | `--file`, `--operation` |
|
|
387
|
+
| `post-edit` | Record editing outcome for learning | `--file`, `--success`, `--train-neural` |
|
|
388
|
+
| `pre-command` | Assess risk before commands | `--command`, `--validate-safety` |
|
|
389
|
+
| `post-command` | Record command execution outcome | `--command`, `--track-metrics` |
|
|
390
|
+
| `pre-task` | Record task start, get agent suggestions | `--description`, `--coordinate-swarm` |
|
|
391
|
+
| `post-task` | Record task completion for learning | `--task-id`, `--success`, `--store-results` |
|
|
392
|
+
| `session-start` | Start/restore session (v2 compat) | `--session-id`, `--auto-configure` |
|
|
393
|
+
| `session-end` | End session and persist state | `--generate-summary`, `--export-metrics` |
|
|
394
|
+
| `session-restore` | Restore a previous session | `--session-id`, `--latest` |
|
|
395
|
+
| `route` | Route task to optimal agent | `--task`, `--context`, `--top-k` |
|
|
396
|
+
| `route-task` | (v2 compat) Alias for route | `--task`, `--auto-swarm` |
|
|
397
|
+
| `explain` | Explain routing decision | `--topic`, `--detailed` |
|
|
398
|
+
| `pretrain` | Bootstrap intelligence from repo | `--model-type`, `--epochs` |
|
|
399
|
+
| `build-agents` | Generate optimized agent configs | `--agent-types`, `--focus` |
|
|
400
|
+
| `metrics` | View learning metrics dashboard | `--v3-dashboard`, `--format` |
|
|
401
|
+
| `transfer` | Transfer patterns via IPFS registry | `store`, `from-project` |
|
|
402
|
+
| `list` | List all registered hooks | `--format` |
|
|
403
|
+
| `intelligence` | RuVector intelligence system | `trajectory-*`, `pattern-*`, `stats` |
|
|
404
|
+
| `worker` | Background worker management | `list`, `dispatch`, `status`, `detect` |
|
|
405
|
+
| `progress` | Check V3 implementation progress | `--detailed`, `--format` |
|
|
406
|
+
| `statusline` | Generate dynamic statusline | `--json`, `--compact`, `--no-color` |
|
|
407
|
+
| `coverage-route` | Route based on test coverage gaps | `--task`, `--path` |
|
|
408
|
+
| `coverage-suggest` | Suggest coverage improvements | `--path` |
|
|
409
|
+
| `coverage-gaps` | List coverage gaps with priorities | `--format`, `--limit` |
|
|
410
|
+
| `pre-bash` | (v2 compat) Alias for pre-command | Same as pre-command |
|
|
411
|
+
| `post-bash` | (v2 compat) Alias for post-command | Same as post-command |
|
|
412
|
+
|
|
413
|
+
### 12 Background Workers
|
|
414
|
+
|
|
415
|
+
| Worker | Priority | Description |
|
|
416
|
+
|--------|----------|-------------|
|
|
417
|
+
| `ultralearn` | normal | Deep knowledge acquisition |
|
|
418
|
+
| `optimize` | high | Performance optimization |
|
|
419
|
+
| `consolidate` | low | Memory consolidation |
|
|
420
|
+
| `predict` | normal | Predictive preloading |
|
|
421
|
+
| `audit` | critical | Security analysis |
|
|
422
|
+
| `map` | normal | Codebase mapping |
|
|
423
|
+
| `preload` | low | Resource preloading |
|
|
424
|
+
| `deepdive` | normal | Deep code analysis |
|
|
425
|
+
| `document` | normal | Auto-documentation |
|
|
426
|
+
| `refactor` | normal | Refactoring suggestions |
|
|
427
|
+
| `benchmark` | normal | Performance benchmarking |
|
|
428
|
+
| `testgaps` | normal | Test coverage analysis |
|
|
429
|
+
|
|
430
|
+
### Essential Hook Commands
|
|
431
|
+
|
|
432
|
+
```bash
|
|
433
|
+
# Core hooks
|
|
434
|
+
npx @claude-flow/cli@latest hooks pre-task --description "[task]"
|
|
435
|
+
npx @claude-flow/cli@latest hooks post-task --task-id "[id]" --success true
|
|
436
|
+
npx @claude-flow/cli@latest hooks post-edit --file "[file]" --train-neural true
|
|
437
|
+
|
|
438
|
+
# Session management
|
|
439
|
+
npx @claude-flow/cli@latest hooks session-start --session-id "[id]"
|
|
440
|
+
npx @claude-flow/cli@latest hooks session-end --export-metrics true
|
|
441
|
+
npx @claude-flow/cli@latest hooks session-restore --session-id "[id]"
|
|
442
|
+
|
|
443
|
+
# Intelligence routing
|
|
444
|
+
npx @claude-flow/cli@latest hooks route --task "[task]"
|
|
445
|
+
npx @claude-flow/cli@latest hooks explain --topic "[topic]"
|
|
446
|
+
|
|
447
|
+
# Neural learning
|
|
448
|
+
npx @claude-flow/cli@latest hooks pretrain --model-type moe --epochs 10
|
|
449
|
+
npx @claude-flow/cli@latest hooks build-agents --agent-types coder,tester
|
|
450
|
+
|
|
451
|
+
# Background workers
|
|
452
|
+
npx @claude-flow/cli@latest hooks worker list
|
|
453
|
+
npx @claude-flow/cli@latest hooks worker dispatch --trigger audit
|
|
454
|
+
npx @claude-flow/cli@latest hooks worker status
|
|
455
|
+
|
|
456
|
+
# Coverage-aware routing
|
|
457
|
+
npx @claude-flow/cli@latest hooks coverage-gaps --format table
|
|
458
|
+
npx @claude-flow/cli@latest hooks coverage-route --task "[task]"
|
|
459
|
+
|
|
460
|
+
# Statusline (for Claude Code integration)
|
|
461
|
+
npx @claude-flow/cli@latest hooks statusline
|
|
462
|
+
npx @claude-flow/cli@latest hooks statusline --json
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
## ๐ Migration (V2 to V3)
|
|
466
|
+
|
|
467
|
+
```bash
|
|
468
|
+
# Check migration status
|
|
469
|
+
npx @claude-flow/cli@latest migrate status
|
|
470
|
+
|
|
471
|
+
# Run migration with backup
|
|
472
|
+
npx @claude-flow/cli@latest migrate run --backup
|
|
473
|
+
|
|
474
|
+
# Rollback if needed
|
|
475
|
+
npx @claude-flow/cli@latest migrate rollback
|
|
476
|
+
|
|
477
|
+
# Validate migration
|
|
478
|
+
npx @claude-flow/cli@latest migrate validate
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
## ๐ง Intelligence System (RuVector)
|
|
482
|
+
|
|
483
|
+
V3 includes the RuVector Intelligence System:
|
|
484
|
+
- **SONA**: Self-Optimizing Neural Architecture (<0.05ms adaptation)
|
|
485
|
+
- **MoE**: Mixture of Experts for specialized routing
|
|
486
|
+
- **HNSW**: 150x-12,500x faster pattern search
|
|
487
|
+
- **EWC++**: Elastic Weight Consolidation (prevents forgetting)
|
|
488
|
+
- **Flash Attention**: 2.49x-7.47x speedup
|
|
489
|
+
|
|
490
|
+
The 4-step intelligence pipeline:
|
|
491
|
+
1. **RETRIEVE** - Fetch relevant patterns via HNSW
|
|
492
|
+
2. **JUDGE** - Evaluate with verdicts (success/failure)
|
|
493
|
+
3. **DISTILL** - Extract key learnings via LoRA
|
|
494
|
+
4. **CONSOLIDATE** - Prevent catastrophic forgetting via EWC++
|
|
495
|
+
|
|
496
|
+
## ๐ฆ Embeddings Package (v3.0.0-alpha.12)
|
|
497
|
+
|
|
498
|
+
Features:
|
|
499
|
+
- **sql.js**: Cross-platform SQLite persistent cache (WASM, no native compilation)
|
|
500
|
+
- **Document chunking**: Configurable overlap and size
|
|
501
|
+
- **Normalization**: L2, L1, min-max, z-score
|
|
502
|
+
- **Hyperbolic embeddings**: Poincarรฉ ball model for hierarchical data
|
|
503
|
+
- **75x faster**: With agentic-flow ONNX integration
|
|
504
|
+
- **Neural substrate**: Integration with RuVector
|
|
505
|
+
|
|
506
|
+
## ๐ Hive-Mind Consensus
|
|
507
|
+
|
|
508
|
+
### Topologies
|
|
509
|
+
- `hierarchical` - Queen controls workers directly
|
|
510
|
+
- `mesh` - Fully connected peer network
|
|
511
|
+
- `hierarchical-mesh` - Hybrid (recommended)
|
|
512
|
+
- `adaptive` - Dynamic based on load
|
|
513
|
+
|
|
514
|
+
### Consensus Strategies
|
|
515
|
+
- `byzantine` - BFT (tolerates f < n/3 faulty)
|
|
516
|
+
- `raft` - Leader-based (tolerates f < n/2)
|
|
517
|
+
- `gossip` - Epidemic for eventual consistency
|
|
518
|
+
- `crdt` - Conflict-free replicated data types
|
|
519
|
+
- `quorum` - Configurable quorum-based
|
|
520
|
+
|
|
521
|
+
## V3 Performance Targets
|
|
522
|
+
|
|
523
|
+
| Metric | Target |
|
|
524
|
+
|--------|--------|
|
|
525
|
+
| Flash Attention | 2.49x-7.47x speedup |
|
|
526
|
+
| HNSW Search | 150x-12,500x faster |
|
|
527
|
+
| Memory Reduction | 50-75% with quantization |
|
|
528
|
+
| MCP Response | <100ms |
|
|
529
|
+
| CLI Startup | <500ms |
|
|
530
|
+
| SONA Adaptation | <0.05ms |
|
|
531
|
+
|
|
532
|
+
## ๐ Performance Optimization Protocol
|
|
533
|
+
|
|
534
|
+
### Automatic Performance Tracking
|
|
535
|
+
```bash
|
|
536
|
+
# After any significant operation, track metrics
|
|
537
|
+
Bash("npx @claude-flow/cli@latest hooks post-command --command '[operation]' --track-metrics true")
|
|
538
|
+
|
|
539
|
+
# Periodically run benchmarks (every major feature)
|
|
540
|
+
Bash("npx @claude-flow/cli@latest performance benchmark --suite all")
|
|
541
|
+
|
|
542
|
+
# Analyze bottlenecks when performance degrades
|
|
543
|
+
Bash("npx @claude-flow/cli@latest performance profile --target '[component]'")
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
### Session Persistence (Cross-Conversation Learning)
|
|
547
|
+
```bash
|
|
548
|
+
# At session start - restore previous context
|
|
549
|
+
Bash("npx @claude-flow/cli@latest session restore --latest")
|
|
550
|
+
|
|
551
|
+
# At session end - persist learned patterns
|
|
552
|
+
Bash("npx @claude-flow/cli@latest hooks session-end --generate-summary true --persist-state true --export-metrics true")
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
### Neural Pattern Training
|
|
556
|
+
```bash
|
|
557
|
+
# Train on successful code patterns
|
|
558
|
+
Bash("npx @claude-flow/cli@latest neural train --pattern-type coordination --epochs 10")
|
|
559
|
+
|
|
560
|
+
# Predict optimal approach for new tasks
|
|
561
|
+
Bash("npx @claude-flow/cli@latest neural predict --input '[task description]'")
|
|
562
|
+
|
|
563
|
+
# View learned patterns
|
|
564
|
+
Bash("npx @claude-flow/cli@latest neural patterns --list")
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
## ๐ง Environment Variables
|
|
568
|
+
|
|
569
|
+
```bash
|
|
570
|
+
# Configuration
|
|
571
|
+
CLAUDE_FLOW_CONFIG=./claude-flow.config.json
|
|
572
|
+
CLAUDE_FLOW_LOG_LEVEL=info
|
|
573
|
+
|
|
574
|
+
# Provider API Keys
|
|
575
|
+
ANTHROPIC_API_KEY=sk-ant-...
|
|
576
|
+
OPENAI_API_KEY=sk-...
|
|
577
|
+
GOOGLE_API_KEY=...
|
|
578
|
+
|
|
579
|
+
# MCP Server
|
|
580
|
+
CLAUDE_FLOW_MCP_PORT=3000
|
|
581
|
+
CLAUDE_FLOW_MCP_HOST=localhost
|
|
582
|
+
CLAUDE_FLOW_MCP_TRANSPORT=stdio
|
|
583
|
+
|
|
584
|
+
# Memory
|
|
585
|
+
CLAUDE_FLOW_MEMORY_BACKEND=hybrid
|
|
586
|
+
CLAUDE_FLOW_MEMORY_PATH=./data/memory
|
|
587
|
+
```
|
|
588
|
+
|
|
589
|
+
## ๐ Doctor Health Checks
|
|
590
|
+
|
|
591
|
+
Run `npx @claude-flow/cli@latest doctor` to check:
|
|
592
|
+
- Node.js version (20+)
|
|
593
|
+
- npm version (9+)
|
|
594
|
+
- Git installation
|
|
595
|
+
- Config file validity
|
|
596
|
+
- Daemon status
|
|
597
|
+
- Memory database
|
|
598
|
+
- API keys
|
|
599
|
+
- MCP servers
|
|
600
|
+
- Disk space
|
|
601
|
+
- TypeScript installation
|
|
602
|
+
|
|
603
|
+
## ๐ Quick Setup
|
|
604
|
+
|
|
605
|
+
```bash
|
|
606
|
+
# Add MCP servers (auto-detects MCP mode when stdin is piped)
|
|
607
|
+
claude mcp add claude-flow -- npx -y @claude-flow/cli@latest
|
|
608
|
+
claude mcp add ruv-swarm -- npx -y ruv-swarm mcp start # Optional
|
|
609
|
+
claude mcp add flow-nexus -- npx -y flow-nexus@latest mcp start # Optional
|
|
610
|
+
|
|
611
|
+
# Start daemon
|
|
612
|
+
npx @claude-flow/cli@latest daemon start
|
|
613
|
+
|
|
614
|
+
# Run doctor
|
|
615
|
+
npx @claude-flow/cli@latest doctor --fix
|
|
616
|
+
```
|
|
617
|
+
|
|
618
|
+
## ๐ฏ Claude Code vs CLI Tools
|
|
619
|
+
|
|
620
|
+
### Claude Code Handles ALL EXECUTION:
|
|
621
|
+
- **Task tool**: Spawn and run agents concurrently
|
|
622
|
+
- File operations (Read, Write, Edit, MultiEdit, Glob, Grep)
|
|
623
|
+
- Code generation and programming
|
|
624
|
+
- Bash commands and system operations
|
|
625
|
+
- TodoWrite and task management
|
|
626
|
+
- Git operations
|
|
627
|
+
|
|
628
|
+
### CLI Tools Handle Coordination (via Bash):
|
|
629
|
+
- **Swarm init**: `npx @claude-flow/cli@latest swarm init --topology <type>`
|
|
630
|
+
- **Swarm status**: `npx @claude-flow/cli@latest swarm status`
|
|
631
|
+
- **Agent spawn**: `npx @claude-flow/cli@latest agent spawn -t <type> --name <name>`
|
|
632
|
+
- **Memory store**: `npx @claude-flow/cli@latest memory store --key "mykey" --value "myvalue" --namespace patterns`
|
|
633
|
+
- **Memory search**: `npx @claude-flow/cli@latest memory search --query "search terms"`
|
|
634
|
+
- **Memory list**: `npx @claude-flow/cli@latest memory list --namespace patterns`
|
|
635
|
+
- **Memory retrieve**: `npx @claude-flow/cli@latest memory retrieve --key "mykey" --namespace patterns`
|
|
636
|
+
- **Hooks**: `npx @claude-flow/cli@latest hooks <hook-name> [options]`
|
|
637
|
+
|
|
638
|
+
## ๐ Memory Commands Reference (IMPORTANT)
|
|
639
|
+
|
|
640
|
+
### Store Data (ALL options shown)
|
|
641
|
+
```bash
|
|
642
|
+
# REQUIRED: --key and --value
|
|
643
|
+
# OPTIONAL: --namespace (default: "default"), --ttl, --tags
|
|
644
|
+
npx @claude-flow/cli@latest memory store --key "pattern-auth" --value "JWT with refresh tokens" --namespace patterns
|
|
645
|
+
npx @claude-flow/cli@latest memory store --key "bug-fix-123" --value "Fixed null check" --namespace solutions --tags "bugfix,auth"
|
|
646
|
+
```
|
|
647
|
+
|
|
648
|
+
### Search Data (semantic vector search)
|
|
649
|
+
```bash
|
|
650
|
+
# REQUIRED: --query (full flag, not -q)
|
|
651
|
+
# OPTIONAL: --namespace, --limit, --threshold
|
|
652
|
+
npx @claude-flow/cli@latest memory search --query "authentication patterns"
|
|
653
|
+
npx @claude-flow/cli@latest memory search --query "error handling" --namespace patterns --limit 5
|
|
654
|
+
```
|
|
655
|
+
|
|
656
|
+
### List Entries
|
|
657
|
+
```bash
|
|
658
|
+
# OPTIONAL: --namespace, --limit
|
|
659
|
+
npx @claude-flow/cli@latest memory list
|
|
660
|
+
npx @claude-flow/cli@latest memory list --namespace patterns --limit 10
|
|
661
|
+
```
|
|
662
|
+
|
|
663
|
+
### Retrieve Specific Entry
|
|
664
|
+
```bash
|
|
665
|
+
# REQUIRED: --key
|
|
666
|
+
# OPTIONAL: --namespace (default: "default")
|
|
667
|
+
npx @claude-flow/cli@latest memory retrieve --key "pattern-auth"
|
|
668
|
+
npx @claude-flow/cli@latest memory retrieve --key "pattern-auth" --namespace patterns
|
|
669
|
+
```
|
|
670
|
+
|
|
671
|
+
### Initialize Memory Database
|
|
672
|
+
```bash
|
|
673
|
+
npx @claude-flow/cli@latest memory init --force --verbose
|
|
674
|
+
```
|
|
675
|
+
|
|
676
|
+
**KEY**: CLI coordinates the strategy via Bash, Claude Code's Task tool executes with real agents.
|
|
677
|
+
|
|
678
|
+
## Support
|
|
679
|
+
|
|
680
|
+
- Documentation: https://github.com/ruvnet/claude-flow
|
|
681
|
+
- Issues: https://github.com/ruvnet/claude-flow/issues
|
|
682
|
+
|
|
683
|
+
---
|
|
684
|
+
|
|
685
|
+
Remember: **Claude Flow CLI coordinates, Claude Code Task tool creates!**
|
|
686
|
+
|
|
687
|
+
# important-instruction-reminders
|
|
688
|
+
Do what has been asked; nothing more, nothing less.
|
|
689
|
+
NEVER create files unless they're absolutely necessary for achieving your goal.
|
|
690
|
+
ALWAYS prefer editing an existing file to creating a new one.
|
|
691
|
+
NEVER proactively create documentation files (*.md) or README files. Only create documentation files if explicitly requested by the User.
|
|
692
|
+
Never save working files, text/mds and tests to the root folder.
|
|
693
|
+
|
|
694
|
+
## ๐จ SWARM EXECUTION RULES (CRITICAL)
|
|
695
|
+
1. **SPAWN IN BACKGROUND**: Use `run_in_background: true` for all agent Task calls
|
|
696
|
+
2. **SPAWN ALL AT ONCE**: Put ALL agent Task calls in ONE message for parallel execution
|
|
697
|
+
3. **TELL USER**: After spawning, list what each agent is doing (use emojis for clarity)
|
|
698
|
+
4. **STOP AND WAIT**: After spawning, STOP - do NOT add more tool calls or check status
|
|
699
|
+
5. **NO POLLING**: Never poll TaskOutput or check swarm status - trust agents to return
|
|
700
|
+
6. **SYNTHESIZE**: When agent results arrive, review ALL results before proceeding
|
|
701
|
+
7. **NO CONFIRMATION**: Don't ask "should I check?" - just wait for results
|
|
702
|
+
|
|
703
|
+
Example spawn message:
|
|
704
|
+
```
|
|
705
|
+
"I've launched 4 agents in background:
|
|
706
|
+
- ๐ Researcher: [task]
|
|
707
|
+
- ๐ป Coder: [task]
|
|
708
|
+
- ๐งช Tester: [task]
|
|
709
|
+
- ๐ Reviewer: [task]
|
|
710
|
+
Working in parallel - I'll synthesize when they complete."
|
|
711
|
+
```
|