claude-flow-novice 1.3.0 → 1.3.2
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-flow-novice/preferences/generation.json +147 -0
- package/.claude-flow-novice/preferences/language-configs/javascript.json +51 -0
- package/.claude-flow-novice/preferences/language-configs/python.json +50 -0
- package/.claude-flow-novice/preferences/language-configs/rust.json +237 -0
- package/.claude-flow-novice/preferences/language-configs/typescript.json +54 -0
- package/.claude-flow-novice/preferences/project-local.json +91 -0
- package/.claude-flow-novice/preferences/resource-delegation.json +120 -0
- package/.claude-flow-novice/preferences/team-shared.json +195 -0
- package/.claude-flow-novice/preferences/user-global.json +247 -0
- package/.claude-flow-novice/templates/claude-md-templates/CLAUDE-JAVASCRIPT.md +769 -0
- package/.claude-flow-novice/templates/claude-md-templates/CLAUDE-PYTHON.md +1214 -0
- package/.claude-flow-novice/templates/claude-md-templates/CLAUDE-RUST.md +475 -0
- package/.claude-flow-novice/templates/claude-md-templates/CLAUDE-TYPESCRIPT.md +851 -0
- package/.claude-flow-novice/templates/claude-md-templates/README.md +263 -0
- package/CLAUDE.md +81 -0
- package/README-NPM.md +0 -0
- package/package.json +11 -7
- package/scripts/build/README.md +167 -0
- package/scripts/build/build-config.js +27 -0
- package/scripts/build/build-prompt-copier.sh +30 -0
- package/scripts/build/performance-monitor.js +869 -0
- package/scripts/build/prepare-publish.js +150 -0
- package/scripts/build/typescript-fixer.js +621 -0
- package/scripts/build/unified-builder.sh +428 -0
- package/scripts/build/update-bin-version.js +32 -0
- package/scripts/dev/README.md +264 -0
- package/scripts/dev/claude-flow-wrapper.sh +35 -0
- package/scripts/dev/claude-monitor.py +419 -0
- package/scripts/dev/claude-sparc.sh +562 -0
- package/scripts/dev/claude-wrapper.sh +17 -0
- package/scripts/dev/demo-phase3-compliance.js +172 -0
- package/scripts/dev/demo-task-system.ts +224 -0
- package/scripts/dev/deployment-validator.js +315 -0
- package/scripts/dev/spawn-claude-terminal.sh +32 -0
- package/scripts/dev/start-portal.sh +506 -0
- package/scripts/dev/start-web-ui.js +15 -0
- package/scripts/dev/stop-portal.sh +311 -0
- package/scripts/dev/validate-examples.ts +288 -0
- package/scripts/dev/validate-phase2.cjs +451 -0
- package/scripts/dev/validate-phase2.js +785 -0
- package/scripts/dev/validate-phase3.cjs +208 -0
- package/scripts/dev/validate-security-remediation.js +1 -0
- package/scripts/legacy/README.md +272 -0
- package/scripts/legacy/batch-fix-ts.sh +54 -0
- package/scripts/legacy/build-migration.sh +105 -0
- package/scripts/legacy/build-monitor.js +209 -0
- package/scripts/legacy/build-with-filter.sh +84 -0
- package/scripts/legacy/build-workaround.sh +71 -0
- package/scripts/legacy/fix-ts-advanced.js +358 -0
- package/scripts/legacy/fix-ts-final.sh +50 -0
- package/scripts/legacy/fix-ts-targeted.sh +49 -0
- package/scripts/legacy/fix-typescript-errors.js +305 -0
- package/scripts/legacy/force-build.sh +63 -0
- package/scripts/legacy/optimize-performance.js +400 -0
- package/scripts/legacy/performance-monitor.js +263 -0
- package/scripts/legacy/performance-monitoring.js +532 -0
- package/scripts/legacy/performance-test-runner.js +645 -0
- package/scripts/legacy/quick-fix-ts.js +281 -0
- package/scripts/legacy/safe-build.sh +63 -0
- package/scripts/migration/README.md +434 -0
- package/scripts/migration/install-arm64.js +78 -0
- package/scripts/migration/install.js +83 -0
- package/scripts/migration/migrate-hooks.js +173 -0
- package/scripts/migration/migration-examples.ts +318 -0
- package/scripts/optimization/build-optimizer.js +438 -0
- package/scripts/optimization/config-validator.js +761 -0
- package/scripts/optimization/test-optimization.js +432 -0
- package/scripts/optimization/unified-activation.js +839 -0
- package/scripts/performance/ACTIVATION_COMMANDS.md +292 -0
- package/scripts/performance/sqlite-enhanced-activation.sh +583 -0
- package/scripts/performance/test-enhanced-backend.sh +504 -0
- package/scripts/performance-test-runner.js +698 -0
- package/scripts/security/README.md +339 -0
- package/scripts/security/install-git-hooks.sh +132 -0
- package/scripts/security/ruv-swarm-safe.js +74 -0
- package/scripts/test/README.md +236 -0
- package/scripts/test/check-links.ts +274 -0
- package/scripts/test/check-performance-regression.ts +168 -0
- package/scripts/test/coverage-report.ts +692 -0
- package/scripts/test/generate-swarm-tests.js +633 -0
- package/scripts/test/integration-test-validation.cjs +253 -0
- package/scripts/test/load-test-swarm.js +576 -0
- package/scripts/test/run-phase3-compliance-tests.js +427 -0
- package/scripts/test/test-batch-tasks.ts +29 -0
- package/scripts/test/test-byzantine-resolution.js +246 -0
- package/scripts/test/test-claude-spawn-options.sh +63 -0
- package/scripts/test/test-cli-wizard.js +331 -0
- package/scripts/test/test-comprehensive.js +401 -0
- package/scripts/test/test-coordination-features.ts +238 -0
- package/scripts/test/test-fallback-systems.js +276 -0
- package/scripts/test/test-init-command.ts +302 -0
- package/scripts/test/test-mcp.ts +251 -0
- package/scripts/test/test-runner.ts +568 -0
- package/scripts/test/test-swarm-integration.sh +92 -0
- package/scripts/test/test-swarm.ts +142 -0
- package/scripts/test/validation-summary.ts +408 -0
- package/scripts/utils/README.md +261 -0
- package/scripts/utils/clean-build-artifacts.sh +94 -0
- package/scripts/utils/cleanup-root.sh +69 -0
- package/scripts/utils/fix-cliffy-imports.js +307 -0
- package/scripts/utils/fix-duplicate-imports.js +114 -0
- package/scripts/utils/fix-error-handling.cjs +70 -0
- package/scripts/utils/fix-import-paths.js +104 -0
- package/scripts/utils/fix-imports.js +116 -0
- package/scripts/utils/fix-shebang.js +78 -0
- package/scripts/utils/fix-test-modules.js +27 -0
- package/scripts/utils/fix-timezone-issue-246.js +200 -0
- package/scripts/utils/fix-ts-comprehensive.py +182 -0
- package/scripts/utils/fix-ts-targeted-batch.js +250 -0
- package/scripts/utils/remove-benchmark-conflicts.sh +140 -0
- package/scripts/utils/simple-test-fixer.js +190 -0
- package/scripts/utils/validate-metrics-structure.cjs +144 -0
- package/scripts/verify-mcp-server.js +86 -0
- package/src/cli/simple-commands/__tests__/agent.test.js +291 -0
- package/src/cli/simple-commands/__tests__/memory.test.js +8 -0
- package/src/cli/simple-commands/__tests__/swarm.test.js +371 -0
- package/src/cli/simple-commands/__tests__/task.test.js +8 -0
- package/src/cli/simple-commands/agent.js +216 -0
- package/src/cli/simple-commands/analysis.js +570 -0
- package/src/cli/simple-commands/automation-executor.js +1603 -0
- package/src/cli/simple-commands/automation.js +627 -0
- package/src/cli/simple-commands/batch-manager.js +338 -0
- package/src/cli/simple-commands/claude-telemetry.js +311 -0
- package/src/cli/simple-commands/claude-track.js +102 -0
- package/src/cli/simple-commands/concurrent-display.js +348 -0
- package/src/cli/simple-commands/config.js +319 -0
- package/src/cli/simple-commands/coordination.js +307 -0
- package/src/cli/simple-commands/enhanced-ui-views.js +654 -0
- package/src/cli/simple-commands/enhanced-webui-complete.js +1038 -0
- package/src/cli/simple-commands/fix-hook-variables.js +363 -0
- package/src/cli/simple-commands/github/gh-coordinator.js +605 -0
- package/src/cli/simple-commands/github/github-api.js +624 -0
- package/src/cli/simple-commands/github/init.js +543 -0
- package/src/cli/simple-commands/github.js +377 -0
- package/src/cli/simple-commands/goal.js +145 -0
- package/src/cli/simple-commands/hive-mind/auto-save-middleware.js +311 -0
- package/src/cli/simple-commands/hive-mind/communication.js +740 -0
- package/src/cli/simple-commands/hive-mind/core.js +1031 -0
- package/src/cli/simple-commands/hive-mind/db-optimizer.js +872 -0
- package/src/cli/simple-commands/hive-mind/mcp-wrapper.js +1364 -0
- package/src/cli/simple-commands/hive-mind/memory.js +1292 -0
- package/src/cli/simple-commands/hive-mind/performance-optimizer.js +618 -0
- package/src/cli/simple-commands/hive-mind/performance-test.js +373 -0
- package/src/cli/simple-commands/hive-mind/queen.js +809 -0
- package/src/cli/simple-commands/hive-mind/session-manager.js +1223 -0
- package/src/cli/simple-commands/hive-mind-optimize.js +361 -0
- package/src/cli/simple-commands/hive-mind-wizard.js +281 -0
- package/src/cli/simple-commands/hive-mind.js +3112 -0
- package/src/cli/simple-commands/hive.js +140 -0
- package/src/cli/simple-commands/hook-safety.js +671 -0
- package/src/cli/simple-commands/hooks.js +1268 -0
- package/src/cli/simple-commands/init/.claude/checkpoints/1756224542.json +7 -0
- package/src/cli/simple-commands/init/.claude/checkpoints/1756224544.json +8 -0
- package/src/cli/simple-commands/init/README.md +106 -0
- package/src/cli/simple-commands/init/VALIDATION_ROLLBACK.md +488 -0
- package/src/cli/simple-commands/init/agent-copier.js +347 -0
- package/src/cli/simple-commands/init/batch-init.js +663 -0
- package/src/cli/simple-commands/init/claude-commands/claude-flow-commands.js +438 -0
- package/src/cli/simple-commands/init/claude-commands/optimized-claude-flow-commands.js +876 -0
- package/src/cli/simple-commands/init/claude-commands/optimized-slash-commands.js +356 -0
- package/src/cli/simple-commands/init/claude-commands/optimized-sparc-commands.js +501 -0
- package/src/cli/simple-commands/init/claude-commands/slash-commands.js +57 -0
- package/src/cli/simple-commands/init/claude-commands/sparc-commands.js +296 -0
- package/src/cli/simple-commands/init/copy-revised-templates.js +175 -0
- package/src/cli/simple-commands/init/executable-wrapper.js +122 -0
- package/src/cli/simple-commands/init/gitignore-updater.js +137 -0
- package/src/cli/simple-commands/init/help.js +110 -0
- package/src/cli/simple-commands/init/hive-mind-init.js +749 -0
- package/src/cli/simple-commands/init/index.js +1953 -0
- package/src/cli/simple-commands/init/performance-monitor.js +344 -0
- package/src/cli/simple-commands/init/rollback/backup-manager.js +542 -0
- package/src/cli/simple-commands/init/rollback/index.js +399 -0
- package/src/cli/simple-commands/init/rollback/recovery-manager.js +778 -0
- package/src/cli/simple-commands/init/rollback/rollback-executor.js +521 -0
- package/src/cli/simple-commands/init/rollback/state-tracker.js +486 -0
- package/src/cli/simple-commands/init/sparc/roo-readme.js +61 -0
- package/src/cli/simple-commands/init/sparc/roomodes-config.js +102 -0
- package/src/cli/simple-commands/init/sparc/workflows.js +40 -0
- package/src/cli/simple-commands/init/sparc-structure.js +68 -0
- package/src/cli/simple-commands/init/template-copier.js +640 -0
- package/src/cli/simple-commands/init/templates/CLAUDE.md +1185 -0
- package/src/cli/simple-commands/init/templates/CLAUDE.md.optimized +265 -0
- package/src/cli/simple-commands/init/templates/claude-flow-universal +81 -0
- package/src/cli/simple-commands/init/templates/claude-flow.bat +18 -0
- package/src/cli/simple-commands/init/templates/claude-flow.ps1 +24 -0
- package/src/cli/simple-commands/init/templates/claude-md.js +1101 -0
- package/src/cli/simple-commands/init/templates/commands/analysis/bottleneck-detect.md +162 -0
- package/src/cli/simple-commands/init/templates/commands/automation/auto-agent.md +122 -0
- package/src/cli/simple-commands/init/templates/commands/coordination/swarm-init.md +85 -0
- package/src/cli/simple-commands/init/templates/commands/github/github-swarm.md +121 -0
- package/src/cli/simple-commands/init/templates/commands/helpers/standard-checkpoint-hooks.sh +179 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/notification.md +113 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/post-command.md +116 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/post-edit.md +117 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/post-task.md +112 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/pre-command.md +113 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/pre-edit.md +113 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/pre-search.md +112 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/pre-task.md +111 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/session-end.md +118 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/session-restore.md +118 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/session-start.md +117 -0
- package/src/cli/simple-commands/init/templates/coordination-md.js +340 -0
- package/src/cli/simple-commands/init/templates/coordination.md +16 -0
- package/src/cli/simple-commands/init/templates/enhanced-templates.js +2347 -0
- package/src/cli/simple-commands/init/templates/github-safe-enhanced.js +331 -0
- package/src/cli/simple-commands/init/templates/github-safe.js +106 -0
- package/src/cli/simple-commands/init/templates/memory-bank-md.js +259 -0
- package/src/cli/simple-commands/init/templates/memory-bank.md +16 -0
- package/src/cli/simple-commands/init/templates/readme-files.js +72 -0
- package/src/cli/simple-commands/init/templates/safe-hook-patterns.js +430 -0
- package/src/cli/simple-commands/init/templates/settings.json +109 -0
- package/src/cli/simple-commands/init/templates/settings.json.enhanced +35 -0
- package/src/cli/simple-commands/init/templates/sparc-modes.js +1401 -0
- package/src/cli/simple-commands/init/templates/verification-claude-md.js +432 -0
- package/src/cli/simple-commands/init/validation/config-validator.js +354 -0
- package/src/cli/simple-commands/init/validation/health-checker.js +599 -0
- package/src/cli/simple-commands/init/validation/index.js +388 -0
- package/src/cli/simple-commands/init/validation/mode-validator.js +387 -0
- package/src/cli/simple-commands/init/validation/post-init-validator.js +390 -0
- package/src/cli/simple-commands/init/validation/pre-init-validator.js +290 -0
- package/src/cli/simple-commands/init/validation/test-runner.js +488 -0
- package/src/cli/simple-commands/init.js +4 -0
- package/src/cli/simple-commands/mcp-health.js +163 -0
- package/src/cli/simple-commands/mcp-integration-layer.js +689 -0
- package/src/cli/simple-commands/mcp.js +420 -0
- package/src/cli/simple-commands/memory-consolidation.js +631 -0
- package/src/cli/simple-commands/memory.js +345 -0
- package/src/cli/simple-commands/migrate-hooks.js +63 -0
- package/src/cli/simple-commands/monitor.js +417 -0
- package/src/cli/simple-commands/neural.js +148 -0
- package/src/cli/simple-commands/pair-autofix-only.js +755 -0
- package/src/cli/simple-commands/pair-basic.js +751 -0
- package/src/cli/simple-commands/pair-old.js +623 -0
- package/src/cli/simple-commands/pair-working.js +849 -0
- package/src/cli/simple-commands/pair.js +849 -0
- package/src/cli/simple-commands/performance-hooks.js +149 -0
- package/src/cli/simple-commands/performance-metrics.js +601 -0
- package/src/cli/simple-commands/process-ui-enhanced.js +821 -0
- package/src/cli/simple-commands/process-ui.js +274 -0
- package/src/cli/simple-commands/realtime-update-system.js +659 -0
- package/src/cli/simple-commands/sparc/architecture.js +1750 -0
- package/src/cli/simple-commands/sparc/commands.js +575 -0
- package/src/cli/simple-commands/sparc/completion.js +1831 -0
- package/src/cli/simple-commands/sparc/coordinator.js +1045 -0
- package/src/cli/simple-commands/sparc/index.js +321 -0
- package/src/cli/simple-commands/sparc/phase-base.js +430 -0
- package/src/cli/simple-commands/sparc/pseudocode.js +984 -0
- package/src/cli/simple-commands/sparc/refinement.js +1856 -0
- package/src/cli/simple-commands/sparc/specification.js +736 -0
- package/src/cli/simple-commands/sparc-modes/architect.js +125 -0
- package/src/cli/simple-commands/sparc-modes/ask.js +126 -0
- package/src/cli/simple-commands/sparc-modes/code.js +148 -0
- package/src/cli/simple-commands/sparc-modes/debug.js +112 -0
- package/src/cli/simple-commands/sparc-modes/devops.js +137 -0
- package/src/cli/simple-commands/sparc-modes/docs-writer.js +38 -0
- package/src/cli/simple-commands/sparc-modes/generic.js +34 -0
- package/src/cli/simple-commands/sparc-modes/index.js +201 -0
- package/src/cli/simple-commands/sparc-modes/integration.js +55 -0
- package/src/cli/simple-commands/sparc-modes/mcp.js +38 -0
- package/src/cli/simple-commands/sparc-modes/monitoring.js +38 -0
- package/src/cli/simple-commands/sparc-modes/optimization.js +38 -0
- package/src/cli/simple-commands/sparc-modes/security-review.js +130 -0
- package/src/cli/simple-commands/sparc-modes/sparc-orchestrator.js +167 -0
- package/src/cli/simple-commands/sparc-modes/spec-pseudocode.js +38 -0
- package/src/cli/simple-commands/sparc-modes/supabase-admin.js +149 -0
- package/src/cli/simple-commands/sparc-modes/swarm.js +436 -0
- package/src/cli/simple-commands/sparc-modes/tdd.js +112 -0
- package/src/cli/simple-commands/sparc-modes/tutorial.js +277 -0
- package/src/cli/simple-commands/sparc.js +530 -0
- package/src/cli/simple-commands/start-ui.js +147 -0
- package/src/cli/simple-commands/start-wrapper.js +285 -0
- package/src/cli/simple-commands/start.js +2 -0
- package/src/cli/simple-commands/status.js +303 -0
- package/src/cli/simple-commands/stream-chain-clean.js +221 -0
- package/src/cli/simple-commands/stream-chain-fixed.js +89 -0
- package/src/cli/simple-commands/stream-chain-real.js +408 -0
- package/src/cli/simple-commands/stream-chain-working.js +323 -0
- package/src/cli/simple-commands/stream-chain.js +491 -0
- package/src/cli/simple-commands/stream-processor.js +340 -0
- package/src/cli/simple-commands/swarm-executor.js +253 -0
- package/src/cli/simple-commands/swarm-metrics-integration.js +371 -0
- package/src/cli/simple-commands/swarm-ui.js +741 -0
- package/src/cli/simple-commands/swarm-webui-integration.js +311 -0
- package/src/cli/simple-commands/swarm.js +2277 -0
- package/src/cli/simple-commands/task.js +228 -0
- package/src/cli/simple-commands/templates/mle-star-workflow.json +294 -0
- package/src/cli/simple-commands/timestamp-fix.js +104 -0
- package/src/cli/simple-commands/token-tracker.js +372 -0
- package/src/cli/simple-commands/tool-execution-framework.js +555 -0
- package/src/cli/simple-commands/train-and-stream.js +354 -0
- package/src/cli/simple-commands/training-pipeline.js +874 -0
- package/src/cli/simple-commands/training.js +288 -0
- package/src/cli/simple-commands/verification-hooks.js +336 -0
- package/src/cli/simple-commands/verification-integration.js +464 -0
- package/src/cli/simple-commands/verification-training-integration.js +646 -0
- package/src/cli/simple-commands/verification.js +551 -0
- package/src/cli/simple-commands/web-server.js +929 -0
- package/src/cli/simple-commands/webui-validator.js +136 -0
- package/src/language/README.md +503 -0
- package/src/language/claude-md-generator.js +618 -0
- package/src/language/cli.js +422 -0
- package/src/language/example.js +347 -0
- package/src/language/integration-system.js +619 -0
- package/src/language/language-detector.js +581 -0
|
@@ -0,0 +1,1185 @@
|
|
|
1
|
+
# Claude Code Configuration - SPARC Development Environment (Batchtools Optimized)
|
|
2
|
+
|
|
3
|
+
## 🚨 CRITICAL: CONCURRENT EXECUTION FOR ALL ACTIONS
|
|
4
|
+
|
|
5
|
+
**ABSOLUTE RULE**: ALL operations MUST be concurrent/parallel in a single message:
|
|
6
|
+
|
|
7
|
+
### 🔴 MANDATORY CONCURRENT PATTERNS:
|
|
8
|
+
1. **TodoWrite**: ALWAYS batch ALL todos in ONE call (5-10+ todos minimum)
|
|
9
|
+
2. **Task tool**: ALWAYS spawn ALL agents in ONE message with full instructions
|
|
10
|
+
3. **File operations**: ALWAYS batch ALL reads/writes/edits in ONE message
|
|
11
|
+
4. **Bash commands**: ALWAYS batch ALL terminal operations in ONE message
|
|
12
|
+
5. **Memory operations**: ALWAYS batch ALL memory store/retrieve in ONE message
|
|
13
|
+
|
|
14
|
+
### ⚡ GOLDEN RULE: "1 MESSAGE = ALL RELATED OPERATIONS"
|
|
15
|
+
|
|
16
|
+
**Examples of CORRECT concurrent execution:**
|
|
17
|
+
```javascript
|
|
18
|
+
// ✅ CORRECT: Everything in ONE message
|
|
19
|
+
[Single Message]:
|
|
20
|
+
- TodoWrite { todos: [10+ todos with all statuses/priorities] }
|
|
21
|
+
- Task("Agent 1 with full instructions and hooks")
|
|
22
|
+
- Task("Agent 2 with full instructions and hooks")
|
|
23
|
+
- Task("Agent 3 with full instructions and hooks")
|
|
24
|
+
- Read("file1.js")
|
|
25
|
+
- Read("file2.js")
|
|
26
|
+
- Write("output1.js", content)
|
|
27
|
+
- Write("output2.js", content)
|
|
28
|
+
- Bash("npm install")
|
|
29
|
+
- Bash("npm test")
|
|
30
|
+
- Bash("npm run build")
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**Examples of WRONG sequential execution:**
|
|
34
|
+
```javascript
|
|
35
|
+
// ❌ WRONG: Multiple messages (NEVER DO THIS)
|
|
36
|
+
Message 1: TodoWrite { todos: [single todo] }
|
|
37
|
+
Message 2: Task("Agent 1")
|
|
38
|
+
Message 3: Task("Agent 2")
|
|
39
|
+
Message 4: Read("file1.js")
|
|
40
|
+
Message 5: Write("output1.js")
|
|
41
|
+
Message 6: Bash("npm install")
|
|
42
|
+
// This is 6x slower and breaks coordination!
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### 🎯 CONCURRENT EXECUTION CHECKLIST:
|
|
46
|
+
|
|
47
|
+
Before sending ANY message, ask yourself:
|
|
48
|
+
- ✅ Are ALL related TodoWrite operations batched together?
|
|
49
|
+
- ✅ Are ALL Task spawning operations in ONE message?
|
|
50
|
+
- ✅ Are ALL file operations (Read/Write/Edit) batched together?
|
|
51
|
+
- ✅ Are ALL bash commands grouped in ONE message?
|
|
52
|
+
- ✅ Are ALL memory operations concurrent?
|
|
53
|
+
|
|
54
|
+
If ANY answer is "No", you MUST combine operations into a single message!
|
|
55
|
+
|
|
56
|
+
## Project Overview
|
|
57
|
+
This project uses the SPARC (Specification, Pseudocode, Architecture, Refinement, Completion) methodology for systematic Test-Driven Development with AI assistance through Claude-Flow orchestration.
|
|
58
|
+
|
|
59
|
+
**🚀 Batchtools Optimization Enabled**: This configuration includes optimized prompts and parallel processing capabilities for improved performance and efficiency.
|
|
60
|
+
|
|
61
|
+
## SPARC Development Commands
|
|
62
|
+
|
|
63
|
+
### Core SPARC Commands
|
|
64
|
+
- `npx claude-flow sparc modes`: List all available SPARC development modes
|
|
65
|
+
- `npx claude-flow sparc run <mode> "<task>"`: Execute specific SPARC mode for a task
|
|
66
|
+
- `npx claude-flow sparc tdd "<feature>"`: Run complete TDD workflow using SPARC methodology
|
|
67
|
+
- `npx claude-flow sparc info <mode>`: Get detailed information about a specific mode
|
|
68
|
+
|
|
69
|
+
### Batchtools Commands (Optimized)
|
|
70
|
+
- `npx claude-flow sparc batch <modes> "<task>"`: Execute multiple SPARC modes in parallel
|
|
71
|
+
- `npx claude-flow sparc pipeline "<task>"`: Execute full SPARC pipeline with parallel processing
|
|
72
|
+
- `npx claude-flow sparc concurrent <mode> "<tasks-file>"`: Process multiple tasks concurrently
|
|
73
|
+
|
|
74
|
+
### Standard Build Commands
|
|
75
|
+
- `npm run build`: Build the project
|
|
76
|
+
- `npm run test`: Run the test suite
|
|
77
|
+
- `npm run lint`: Run linter and format checks
|
|
78
|
+
- `npm run typecheck`: Run TypeScript type checking
|
|
79
|
+
|
|
80
|
+
## SPARC Methodology Workflow (Batchtools Enhanced)
|
|
81
|
+
|
|
82
|
+
### 1. Specification Phase (Parallel Analysis)
|
|
83
|
+
```bash
|
|
84
|
+
# Create detailed specifications with concurrent requirements analysis
|
|
85
|
+
npx claude-flow sparc run spec-pseudocode "Define user authentication requirements" --parallel
|
|
86
|
+
```
|
|
87
|
+
**Batchtools Optimization**: Simultaneously analyze multiple requirement sources, validate constraints in parallel, and generate comprehensive specifications.
|
|
88
|
+
|
|
89
|
+
### 2. Pseudocode Phase (Concurrent Logic Design)
|
|
90
|
+
```bash
|
|
91
|
+
# Develop algorithmic logic with parallel pattern analysis
|
|
92
|
+
npx claude-flow sparc run spec-pseudocode "Create authentication flow pseudocode" --batch-optimize
|
|
93
|
+
```
|
|
94
|
+
**Batchtools Optimization**: Process multiple algorithm patterns concurrently, validate logic flows in parallel, and optimize data structures simultaneously.
|
|
95
|
+
|
|
96
|
+
### 3. Architecture Phase (Parallel Component Design)
|
|
97
|
+
```bash
|
|
98
|
+
# Design system architecture with concurrent component analysis
|
|
99
|
+
npx claude-flow sparc run architect "Design authentication service architecture" --parallel
|
|
100
|
+
```
|
|
101
|
+
**Batchtools Optimization**: Generate multiple architectural alternatives simultaneously, validate integration points in parallel, and create comprehensive documentation concurrently.
|
|
102
|
+
|
|
103
|
+
### 4. Refinement Phase (Parallel TDD Implementation)
|
|
104
|
+
```bash
|
|
105
|
+
# Execute Test-Driven Development with parallel test generation
|
|
106
|
+
npx claude-flow sparc tdd "implement user authentication system" --batch-tdd
|
|
107
|
+
```
|
|
108
|
+
**Batchtools Optimization**: Generate multiple test scenarios simultaneously, implement and validate code in parallel, and optimize performance concurrently.
|
|
109
|
+
|
|
110
|
+
### 5. Completion Phase (Concurrent Integration)
|
|
111
|
+
```bash
|
|
112
|
+
# Integration with parallel validation and documentation
|
|
113
|
+
npx claude-flow sparc run integration "integrate authentication with user management" --parallel
|
|
114
|
+
```
|
|
115
|
+
**Batchtools Optimization**: Run integration tests in parallel, generate documentation concurrently, and validate requirements simultaneously.
|
|
116
|
+
|
|
117
|
+
## Batchtools Integration Features
|
|
118
|
+
|
|
119
|
+
### Parallel Processing Capabilities
|
|
120
|
+
- **Concurrent File Operations**: Read, analyze, and modify multiple files simultaneously
|
|
121
|
+
- **Parallel Code Analysis**: Analyze dependencies, patterns, and architecture concurrently
|
|
122
|
+
- **Batch Test Generation**: Create comprehensive test suites in parallel
|
|
123
|
+
- **Concurrent Documentation**: Generate multiple documentation formats simultaneously
|
|
124
|
+
|
|
125
|
+
### Performance Optimizations
|
|
126
|
+
- **Smart Batching**: Group related operations for optimal performance
|
|
127
|
+
- **Pipeline Processing**: Chain dependent operations with parallel stages
|
|
128
|
+
- **Resource Management**: Efficient utilization of system resources
|
|
129
|
+
- **Error Resilience**: Robust error handling with parallel recovery
|
|
130
|
+
|
|
131
|
+
## Performance Benchmarks
|
|
132
|
+
|
|
133
|
+
### Batchtools Performance Improvements
|
|
134
|
+
- **File Operations**: Up to 300% faster with parallel processing
|
|
135
|
+
- **Code Analysis**: 250% improvement with concurrent pattern recognition
|
|
136
|
+
- **Test Generation**: 400% faster with parallel test creation
|
|
137
|
+
- **Documentation**: 200% improvement with concurrent content generation
|
|
138
|
+
- **Memory Operations**: 180% faster with batched read/write operations
|
|
139
|
+
|
|
140
|
+
## Code Style and Best Practices (Batchtools Enhanced)
|
|
141
|
+
|
|
142
|
+
### SPARC Development Principles with Batchtools
|
|
143
|
+
- **Modular Design**: Keep files under 500 lines, optimize with parallel analysis
|
|
144
|
+
- **Environment Safety**: Never hardcode secrets, validate with concurrent checks
|
|
145
|
+
- **Test-First**: Always write tests before implementation using parallel generation
|
|
146
|
+
- **Clean Architecture**: Separate concerns with concurrent validation
|
|
147
|
+
- **Parallel Documentation**: Maintain clear, up-to-date documentation with concurrent updates
|
|
148
|
+
|
|
149
|
+
### Batchtools Best Practices
|
|
150
|
+
- **Parallel Operations**: Use batchtools for independent tasks
|
|
151
|
+
- **Concurrent Validation**: Validate multiple aspects simultaneously
|
|
152
|
+
- **Batch Processing**: Group similar operations for efficiency
|
|
153
|
+
- **Pipeline Optimization**: Chain operations with parallel stages
|
|
154
|
+
- **Resource Management**: Monitor and optimize resource usage
|
|
155
|
+
|
|
156
|
+
## Important Notes (Enhanced)
|
|
157
|
+
|
|
158
|
+
- Always run tests before committing with parallel execution (`npm run test --parallel`)
|
|
159
|
+
- Use SPARC memory system with concurrent operations to maintain context across sessions
|
|
160
|
+
- Follow the Red-Green-Refactor cycle with parallel test generation during TDD phases
|
|
161
|
+
- Document architectural decisions with concurrent validation in memory
|
|
162
|
+
- Regular security reviews with parallel analysis for authentication or data handling code
|
|
163
|
+
- Claude Code slash commands provide quick access to batchtools-optimized SPARC modes
|
|
164
|
+
- Monitor system resources during parallel operations for optimal performance
|
|
165
|
+
|
|
166
|
+
## Available Agents (54 Total)
|
|
167
|
+
|
|
168
|
+
### 🚀 Concurrent Agent Usage
|
|
169
|
+
|
|
170
|
+
**CRITICAL**: Always spawn multiple agents concurrently using the Task tool in a single message:
|
|
171
|
+
|
|
172
|
+
```javascript
|
|
173
|
+
// ✅ CORRECT: Concurrent agent deployment
|
|
174
|
+
[Single Message]:
|
|
175
|
+
- Task("Agent 1", "full instructions", "agent-type-1")
|
|
176
|
+
- Task("Agent 2", "full instructions", "agent-type-2")
|
|
177
|
+
- Task("Agent 3", "full instructions", "agent-type-3")
|
|
178
|
+
- Task("Agent 4", "full instructions", "agent-type-4")
|
|
179
|
+
- Task("Agent 5", "full instructions", "agent-type-5")
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### 📋 Agent Categories & Concurrent Patterns
|
|
183
|
+
|
|
184
|
+
#### **Core Development Agents**
|
|
185
|
+
- `coder` - Implementation specialist
|
|
186
|
+
- `reviewer` - Code quality assurance
|
|
187
|
+
- `tester` - Test creation and validation
|
|
188
|
+
- `planner` - Strategic planning
|
|
189
|
+
- `researcher` - Information gathering
|
|
190
|
+
|
|
191
|
+
**Concurrent Usage:**
|
|
192
|
+
```bash
|
|
193
|
+
# Deploy full development swarm
|
|
194
|
+
Task("Research requirements", "...", "researcher")
|
|
195
|
+
Task("Plan architecture", "...", "planner")
|
|
196
|
+
Task("Implement features", "...", "coder")
|
|
197
|
+
Task("Create tests", "...", "tester")
|
|
198
|
+
Task("Review code", "...", "reviewer")
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
#### **Swarm Coordination Agents**
|
|
202
|
+
- `hierarchical-coordinator` - Queen-led coordination
|
|
203
|
+
- `mesh-coordinator` - Peer-to-peer networks
|
|
204
|
+
- `adaptive-coordinator` - Dynamic topology
|
|
205
|
+
- `collective-intelligence-coordinator` - Hive-mind intelligence
|
|
206
|
+
- `swarm-memory-manager` - Distributed memory
|
|
207
|
+
|
|
208
|
+
**Concurrent Swarm Deployment:**
|
|
209
|
+
```bash
|
|
210
|
+
# Deploy multi-topology coordination
|
|
211
|
+
Task("Hierarchical coordination", "...", "hierarchical-coordinator")
|
|
212
|
+
Task("Mesh network backup", "...", "mesh-coordinator")
|
|
213
|
+
Task("Adaptive optimization", "...", "adaptive-coordinator")
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
#### **Consensus & Distributed Systems**
|
|
217
|
+
- `byzantine-coordinator` - Byzantine fault tolerance
|
|
218
|
+
- `raft-manager` - Leader election protocols
|
|
219
|
+
- `gossip-coordinator` - Epidemic dissemination
|
|
220
|
+
- `consensus-builder` - Decision-making algorithms
|
|
221
|
+
- `crdt-synchronizer` - Conflict-free replication
|
|
222
|
+
- `quorum-manager` - Dynamic quorum management
|
|
223
|
+
- `security-manager` - Cryptographic security
|
|
224
|
+
|
|
225
|
+
#### **Performance & Optimization**
|
|
226
|
+
- `perf-analyzer` - Bottleneck identification
|
|
227
|
+
- `performance-benchmarker` - Performance testing
|
|
228
|
+
- `task-orchestrator` - Workflow optimization
|
|
229
|
+
- `memory-coordinator` - Memory management
|
|
230
|
+
- `smart-agent` - Intelligent coordination
|
|
231
|
+
|
|
232
|
+
#### **GitHub & Repository Management**
|
|
233
|
+
- `github-modes` - Comprehensive GitHub integration
|
|
234
|
+
- `pr-manager` - Pull request management
|
|
235
|
+
- `code-review-swarm` - Multi-agent code review
|
|
236
|
+
- `issue-tracker` - Issue management
|
|
237
|
+
- `release-manager` - Release coordination
|
|
238
|
+
- `workflow-automation` - CI/CD automation
|
|
239
|
+
- `project-board-sync` - Project tracking
|
|
240
|
+
- `repo-architect` - Repository optimization
|
|
241
|
+
- `multi-repo-swarm` - Cross-repository coordination
|
|
242
|
+
|
|
243
|
+
#### **SPARC Methodology Agents**
|
|
244
|
+
- `sparc-coord` - SPARC orchestration
|
|
245
|
+
- `sparc-coder` - TDD implementation
|
|
246
|
+
- `specification` - Requirements analysis
|
|
247
|
+
- `pseudocode` - Algorithm design
|
|
248
|
+
- `architecture` - System design
|
|
249
|
+
- `refinement` - Iterative improvement
|
|
250
|
+
|
|
251
|
+
#### **Specialized Development**
|
|
252
|
+
- `backend-dev` - API development
|
|
253
|
+
- `mobile-dev` - React Native development
|
|
254
|
+
- `ml-developer` - Machine learning
|
|
255
|
+
- `cicd-engineer` - CI/CD pipelines
|
|
256
|
+
- `api-docs` - OpenAPI documentation
|
|
257
|
+
- `system-architect` - High-level design
|
|
258
|
+
- `code-analyzer` - Code quality analysis
|
|
259
|
+
- `base-template-generator` - Boilerplate creation
|
|
260
|
+
|
|
261
|
+
#### **Testing & Validation**
|
|
262
|
+
- `tdd-london-swarm` - Mock-driven TDD
|
|
263
|
+
- `production-validator` - Real implementation validation
|
|
264
|
+
|
|
265
|
+
#### **Migration & Planning**
|
|
266
|
+
- `migration-planner` - System migrations
|
|
267
|
+
- `swarm-init` - Topology initialization
|
|
268
|
+
|
|
269
|
+
### 🎯 Concurrent Agent Patterns
|
|
270
|
+
|
|
271
|
+
#### **Full-Stack Development Swarm (8 agents)**
|
|
272
|
+
```bash
|
|
273
|
+
Task("System architecture", "...", "system-architect")
|
|
274
|
+
Task("Backend APIs", "...", "backend-dev")
|
|
275
|
+
Task("Frontend mobile", "...", "mobile-dev")
|
|
276
|
+
Task("Database design", "...", "coder")
|
|
277
|
+
Task("API documentation", "...", "api-docs")
|
|
278
|
+
Task("CI/CD pipeline", "...", "cicd-engineer")
|
|
279
|
+
Task("Performance testing", "...", "performance-benchmarker")
|
|
280
|
+
Task("Production validation", "...", "production-validator")
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
#### **Distributed System Swarm (6 agents)**
|
|
284
|
+
```bash
|
|
285
|
+
Task("Byzantine consensus", "...", "byzantine-coordinator")
|
|
286
|
+
Task("Raft coordination", "...", "raft-manager")
|
|
287
|
+
Task("Gossip protocols", "...", "gossip-coordinator")
|
|
288
|
+
Task("CRDT synchronization", "...", "crdt-synchronizer")
|
|
289
|
+
Task("Security management", "...", "security-manager")
|
|
290
|
+
Task("Performance monitoring", "...", "perf-analyzer")
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
#### **GitHub Workflow Swarm (5 agents)**
|
|
294
|
+
```bash
|
|
295
|
+
Task("PR management", "...", "pr-manager")
|
|
296
|
+
Task("Code review", "...", "code-review-swarm")
|
|
297
|
+
Task("Issue tracking", "...", "issue-tracker")
|
|
298
|
+
Task("Release coordination", "...", "release-manager")
|
|
299
|
+
Task("Workflow automation", "...", "workflow-automation")
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
#### **SPARC TDD Swarm (7 agents)**
|
|
303
|
+
```bash
|
|
304
|
+
Task("Requirements spec", "...", "specification")
|
|
305
|
+
Task("Algorithm design", "...", "pseudocode")
|
|
306
|
+
Task("System architecture", "...", "architecture")
|
|
307
|
+
Task("TDD implementation", "...", "sparc-coder")
|
|
308
|
+
Task("London school tests", "...", "tdd-london-swarm")
|
|
309
|
+
Task("Iterative refinement", "...", "refinement")
|
|
310
|
+
Task("Production validation", "...", "production-validator")
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### ⚡ Performance Optimization
|
|
314
|
+
|
|
315
|
+
**Agent Selection Strategy:**
|
|
316
|
+
- **High Priority**: Use 3-5 agents max for critical path
|
|
317
|
+
- **Medium Priority**: Use 5-8 agents for complex features
|
|
318
|
+
- **Large Projects**: Use 8+ agents with proper coordination
|
|
319
|
+
|
|
320
|
+
**Memory Management:**
|
|
321
|
+
- Use `memory-coordinator` for cross-agent state
|
|
322
|
+
- Implement `swarm-memory-manager` for distributed coordination
|
|
323
|
+
- Apply `collective-intelligence-coordinator` for decision-making
|
|
324
|
+
|
|
325
|
+
For more information about SPARC methodology and batchtools optimization, see:
|
|
326
|
+
- SPARC Guide: https://github.com/ruvnet/claude-code-flow/docs/sparc.md
|
|
327
|
+
- Batchtools Documentation: https://github.com/ruvnet/claude-code-flow/docs/batchtools.md
|
|
328
|
+
|
|
329
|
+
# important-instruction-reminders
|
|
330
|
+
Message 3: Task("Agent 2")
|
|
331
|
+
Message 4: Read("file1.js")
|
|
332
|
+
Message 5: Write("output1.js")
|
|
333
|
+
Message 6: Bash("npm install")
|
|
334
|
+
// This is 6x slower and breaks coordination!
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
### 🎯 CONCURRENT EXECUTION CHECKLIST:
|
|
338
|
+
|
|
339
|
+
Before sending ANY message, ask yourself:
|
|
340
|
+
|
|
341
|
+
- ✅ Are ALL related TodoWrite operations batched together?
|
|
342
|
+
- ✅ Are ALL Task spawning operations in ONE message?
|
|
343
|
+
- ✅ Are ALL file operations (Read/Write/Edit) batched together?
|
|
344
|
+
- ✅ Are ALL bash commands grouped in ONE message?
|
|
345
|
+
- ✅ Are ALL memory operations concurrent?
|
|
346
|
+
|
|
347
|
+
If ANY answer is "No", you MUST combine operations into a single message!
|
|
348
|
+
|
|
349
|
+
## 🚀 CRITICAL: Claude Code Does ALL Real Work
|
|
350
|
+
|
|
351
|
+
### 🎯 CLAUDE CODE IS THE ONLY EXECUTOR
|
|
352
|
+
|
|
353
|
+
**ABSOLUTE RULE**: Claude Code performs ALL actual work:
|
|
354
|
+
|
|
355
|
+
### ✅ Claude Code ALWAYS Handles:
|
|
356
|
+
|
|
357
|
+
- 🔧 **ALL file operations** (Read, Write, Edit, MultiEdit, Glob, Grep)
|
|
358
|
+
- 💻 **ALL code generation** and programming tasks
|
|
359
|
+
- 🖥️ **ALL bash commands** and system operations
|
|
360
|
+
- 🏗️ **ALL actual implementation** work
|
|
361
|
+
- 🔍 **ALL project navigation** and code analysis
|
|
362
|
+
- 📝 **ALL TodoWrite** and task management
|
|
363
|
+
- 🔄 **ALL git operations** (commit, push, merge)
|
|
364
|
+
- 📦 **ALL package management** (npm, pip, etc.)
|
|
365
|
+
- 🧪 **ALL testing** and validation
|
|
366
|
+
- 🔧 **ALL debugging** and troubleshooting
|
|
367
|
+
|
|
368
|
+
### 🧠 Claude Flow MCP Tools ONLY Handle:
|
|
369
|
+
|
|
370
|
+
- 🎯 **Coordination only** - Planning Claude Code's actions
|
|
371
|
+
- 💾 **Memory management** - Storing decisions and context
|
|
372
|
+
- 🤖 **Neural features** - Learning from Claude Code's work
|
|
373
|
+
- 📊 **Performance tracking** - Monitoring Claude Code's efficiency
|
|
374
|
+
- 🐝 **Swarm orchestration** - Coordinating multiple Claude Code instances
|
|
375
|
+
- 🔗 **GitHub integration** - Advanced repository coordination
|
|
376
|
+
|
|
377
|
+
### 🚨 CRITICAL SEPARATION OF CONCERNS:
|
|
378
|
+
|
|
379
|
+
**❌ MCP Tools NEVER:**
|
|
380
|
+
|
|
381
|
+
- Write files or create content
|
|
382
|
+
- Execute bash commands
|
|
383
|
+
- Generate code
|
|
384
|
+
- Perform file operations
|
|
385
|
+
- Handle TodoWrite operations
|
|
386
|
+
- Execute system commands
|
|
387
|
+
- Do actual implementation work
|
|
388
|
+
|
|
389
|
+
**✅ MCP Tools ONLY:**
|
|
390
|
+
|
|
391
|
+
- Coordinate and plan
|
|
392
|
+
- Store memory and context
|
|
393
|
+
- Track performance
|
|
394
|
+
- Orchestrate workflows
|
|
395
|
+
- Provide intelligence insights
|
|
396
|
+
|
|
397
|
+
### ⚠️ Key Principle:
|
|
398
|
+
|
|
399
|
+
**MCP tools coordinate, Claude Code executes.** Think of MCP tools as the "brain" that plans and coordinates, while Claude Code is the "hands" that do all the actual work.
|
|
400
|
+
|
|
401
|
+
### 🔄 WORKFLOW EXECUTION PATTERN:
|
|
402
|
+
|
|
403
|
+
**✅ CORRECT Workflow:**
|
|
404
|
+
|
|
405
|
+
1. **MCP**: `mcp__claude-flow__swarm_init` (coordination setup)
|
|
406
|
+
2. **MCP**: `mcp__claude-flow__agent_spawn` (planning agents)
|
|
407
|
+
3. **MCP**: `mcp__claude-flow__task_orchestrate` (task coordination)
|
|
408
|
+
4. **Claude Code**: `Task` tool to spawn agents with coordination instructions
|
|
409
|
+
5. **Claude Code**: `TodoWrite` with ALL todos batched (5-10+ in ONE call)
|
|
410
|
+
6. **Claude Code**: `Read`, `Write`, `Edit`, `Bash` (actual work)
|
|
411
|
+
7. **MCP**: `mcp__claude-flow__memory_usage` (store results)
|
|
412
|
+
|
|
413
|
+
**❌ WRONG Workflow:**
|
|
414
|
+
|
|
415
|
+
1. **MCP**: `mcp__claude-flow__terminal_execute` (DON'T DO THIS)
|
|
416
|
+
2. **MCP**: File creation via MCP (DON'T DO THIS)
|
|
417
|
+
3. **MCP**: Code generation via MCP (DON'T DO THIS)
|
|
418
|
+
4. **Claude Code**: Sequential Task calls (DON'T DO THIS)
|
|
419
|
+
5. **Claude Code**: Individual TodoWrite calls (DON'T DO THIS)
|
|
420
|
+
|
|
421
|
+
### 🚨 REMEMBER:
|
|
422
|
+
|
|
423
|
+
- **MCP tools** = Coordination, planning, memory, intelligence
|
|
424
|
+
- **Claude Code** = All actual execution, coding, file operations
|
|
425
|
+
|
|
426
|
+
## 🚀 CRITICAL: Parallel Execution & Batch Operations
|
|
427
|
+
|
|
428
|
+
### 🚨 MANDATORY RULE #1: BATCH EVERYTHING
|
|
429
|
+
|
|
430
|
+
**When using swarms, you MUST use BatchTool for ALL operations:**
|
|
431
|
+
|
|
432
|
+
1. **NEVER** send multiple messages for related operations
|
|
433
|
+
2. **ALWAYS** combine multiple tool calls in ONE message
|
|
434
|
+
3. **PARALLEL** execution is MANDATORY, not optional
|
|
435
|
+
|
|
436
|
+
### ⚡ THE GOLDEN RULE OF SWARMS
|
|
437
|
+
|
|
438
|
+
```
|
|
439
|
+
If you need to do X operations, they should be in 1 message, not X messages
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
### 🚨 MANDATORY TODO AND TASK BATCHING
|
|
443
|
+
|
|
444
|
+
**CRITICAL RULE FOR TODOS AND TASKS:**
|
|
445
|
+
|
|
446
|
+
1. **TodoWrite** MUST ALWAYS include ALL todos in ONE call (5-10+ todos)
|
|
447
|
+
2. **Task** tool calls MUST be batched - spawn multiple agents in ONE message
|
|
448
|
+
3. **NEVER** update todos one by one - this breaks parallel coordination
|
|
449
|
+
4. **NEVER** spawn agents sequentially - ALL agents spawn together
|
|
450
|
+
|
|
451
|
+
### 📦 BATCH TOOL EXAMPLES
|
|
452
|
+
|
|
453
|
+
**✅ CORRECT - Everything in ONE Message:**
|
|
454
|
+
|
|
455
|
+
```javascript
|
|
456
|
+
[Single Message with BatchTool]:
|
|
457
|
+
// MCP coordination setup
|
|
458
|
+
mcp__claude-flow__swarm_init { topology: "mesh", maxAgents: 6 }
|
|
459
|
+
mcp__claude-flow__agent_spawn { type: "researcher" }
|
|
460
|
+
mcp__claude-flow__agent_spawn { type: "coder" }
|
|
461
|
+
mcp__claude-flow__agent_spawn { type: "code-analyzer" }
|
|
462
|
+
mcp__claude-flow__agent_spawn { type: "tester" }
|
|
463
|
+
mcp__claude-flow__agent_spawn { type: "task-orchestrator" }
|
|
464
|
+
|
|
465
|
+
// Claude Code execution - ALL in parallel
|
|
466
|
+
Task("You are researcher agent. MUST coordinate via hooks...")
|
|
467
|
+
Task("You are coder agent. MUST coordinate via hooks...")
|
|
468
|
+
Task("You are code-analyzer agent. MUST coordinate via hooks...")
|
|
469
|
+
Task("You are tester agent. MUST coordinate via hooks...")
|
|
470
|
+
TodoWrite { todos: [5-10 todos with all priorities and statuses] }
|
|
471
|
+
|
|
472
|
+
// File operations in parallel
|
|
473
|
+
Bash "mkdir -p app/{src,tests,docs}"
|
|
474
|
+
Write "app/package.json"
|
|
475
|
+
Write "app/README.md"
|
|
476
|
+
Write "app/src/index.js"
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
**❌ WRONG - Multiple Messages (NEVER DO THIS):**
|
|
480
|
+
|
|
481
|
+
```javascript
|
|
482
|
+
Message 1: mcp__claude-flow__swarm_init
|
|
483
|
+
Message 2: Task("researcher agent")
|
|
484
|
+
Message 3: Task("coder agent")
|
|
485
|
+
Message 4: TodoWrite({ todo: "single todo" })
|
|
486
|
+
Message 5: Bash "mkdir src"
|
|
487
|
+
Message 6: Write "package.json"
|
|
488
|
+
// This is 6x slower and breaks parallel coordination!
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
### 🎯 BATCH OPERATIONS BY TYPE
|
|
492
|
+
|
|
493
|
+
**Todo and Task Operations (Single Message):**
|
|
494
|
+
|
|
495
|
+
- **TodoWrite** → ALWAYS include 5-10+ todos in ONE call
|
|
496
|
+
- **Task agents** → Spawn ALL agents with full instructions in ONE message
|
|
497
|
+
- **Agent coordination** → ALL Task calls must include coordination hooks
|
|
498
|
+
- **Status updates** → Update ALL todo statuses together
|
|
499
|
+
- **NEVER** split todos or Task calls across messages!
|
|
500
|
+
|
|
501
|
+
**File Operations (Single Message):**
|
|
502
|
+
|
|
503
|
+
- Read 10 files? → One message with 10 Read calls
|
|
504
|
+
- Write 5 files? → One message with 5 Write calls
|
|
505
|
+
- Edit 1 file many times? → One MultiEdit call
|
|
506
|
+
|
|
507
|
+
**Swarm Operations (Single Message):**
|
|
508
|
+
|
|
509
|
+
- Need 8 agents? → One message with swarm_init + 8 agent_spawn calls
|
|
510
|
+
- Multiple memories? → One message with all memory_usage calls
|
|
511
|
+
- Task + monitoring? → One message with task_orchestrate + swarm_monitor
|
|
512
|
+
|
|
513
|
+
**Command Operations (Single Message):**
|
|
514
|
+
|
|
515
|
+
- Multiple directories? → One message with all mkdir commands
|
|
516
|
+
- Install + test + lint? → One message with all npm commands
|
|
517
|
+
- Git operations? → One message with all git commands
|
|
518
|
+
|
|
519
|
+
## 🚀 Quick Setup (Stdio MCP - Recommended)
|
|
520
|
+
|
|
521
|
+
### 1. Add MCP Server (Stdio - No Port Needed)
|
|
522
|
+
|
|
523
|
+
```bash
|
|
524
|
+
# Add Claude Flow MCP server to Claude Code using stdio
|
|
525
|
+
claude mcp add claude-flow npx claude-flow@alpha mcp start
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
### 2. Use MCP Tools for Coordination in Claude Code
|
|
529
|
+
|
|
530
|
+
Once configured, Claude Flow MCP tools enhance Claude Code's coordination:
|
|
531
|
+
|
|
532
|
+
**Initialize a swarm:**
|
|
533
|
+
|
|
534
|
+
- Use the `mcp__claude-flow__swarm_init` tool to set up coordination topology
|
|
535
|
+
- Choose: mesh, hierarchical, ring, or star
|
|
536
|
+
- This creates a coordination framework for Claude Code's work
|
|
537
|
+
|
|
538
|
+
**Spawn agents:**
|
|
539
|
+
|
|
540
|
+
- Use `mcp__claude-flow__agent_spawn` tool to create specialized coordinators
|
|
541
|
+
- Agent types represent different thinking patterns, not actual coders
|
|
542
|
+
- They help Claude Code approach problems from different angles
|
|
543
|
+
|
|
544
|
+
**Orchestrate tasks:**
|
|
545
|
+
|
|
546
|
+
- Use `mcp__claude-flow__task_orchestrate` tool to coordinate complex workflows
|
|
547
|
+
- This breaks down tasks for Claude Code to execute systematically
|
|
548
|
+
- The agents don't write code - they coordinate Claude Code's actions
|
|
549
|
+
|
|
550
|
+
## Available MCP Tools for Coordination
|
|
551
|
+
|
|
552
|
+
### Coordination Tools:
|
|
553
|
+
|
|
554
|
+
- `mcp__claude-flow__swarm_init` - Set up coordination topology for Claude Code
|
|
555
|
+
- `mcp__claude-flow__agent_spawn` - Create cognitive patterns to guide Claude Code
|
|
556
|
+
- `mcp__claude-flow__task_orchestrate` - Break down and coordinate complex tasks
|
|
557
|
+
|
|
558
|
+
### Monitoring Tools:
|
|
559
|
+
|
|
560
|
+
- `mcp__claude-flow__swarm_status` - Monitor coordination effectiveness
|
|
561
|
+
- `mcp__claude-flow__agent_list` - View active cognitive patterns
|
|
562
|
+
- `mcp__claude-flow__agent_metrics` - Track coordination performance
|
|
563
|
+
- `mcp__claude-flow__task_status` - Check workflow progress
|
|
564
|
+
- `mcp__claude-flow__task_results` - Review coordination outcomes
|
|
565
|
+
|
|
566
|
+
### Memory & Neural Tools:
|
|
567
|
+
|
|
568
|
+
- `mcp__claude-flow__memory_usage` - Persistent memory across sessions
|
|
569
|
+
- `mcp__claude-flow__neural_status` - Neural pattern effectiveness
|
|
570
|
+
- `mcp__claude-flow__neural_train` - Improve coordination patterns
|
|
571
|
+
- `mcp__claude-flow__neural_patterns` - Analyze thinking approaches
|
|
572
|
+
|
|
573
|
+
### GitHub Integration Tools (NEW!):
|
|
574
|
+
|
|
575
|
+
- `mcp__claude-flow__github_swarm` - Create specialized GitHub management swarms
|
|
576
|
+
- `mcp__claude-flow__repo_analyze` - Deep repository analysis with AI
|
|
577
|
+
- `mcp__claude-flow__pr_enhance` - AI-powered pull request improvements
|
|
578
|
+
- `mcp__claude-flow__issue_triage` - Intelligent issue classification
|
|
579
|
+
- `mcp__claude-flow__code_review` - Automated code review with swarms
|
|
580
|
+
|
|
581
|
+
### System Tools:
|
|
582
|
+
|
|
583
|
+
- `mcp__claude-flow__benchmark_run` - Measure coordination efficiency
|
|
584
|
+
- `mcp__claude-flow__features_detect` - Available capabilities
|
|
585
|
+
- `mcp__claude-flow__swarm_monitor` - Real-time coordination tracking
|
|
586
|
+
|
|
587
|
+
## Workflow Examples (Coordination-Focused)
|
|
588
|
+
|
|
589
|
+
### Research Coordination Example
|
|
590
|
+
|
|
591
|
+
**Context:** Claude Code needs to research a complex topic systematically
|
|
592
|
+
|
|
593
|
+
**Step 1:** Set up research coordination
|
|
594
|
+
|
|
595
|
+
- Tool: `mcp__claude-flow__swarm_init`
|
|
596
|
+
- Parameters: `{"topology": "mesh", "maxAgents": 5, "strategy": "balanced"}`
|
|
597
|
+
- Result: Creates a mesh topology for comprehensive exploration
|
|
598
|
+
|
|
599
|
+
**Step 2:** Define research perspectives
|
|
600
|
+
|
|
601
|
+
- Tool: `mcp__claude-flow__agent_spawn`
|
|
602
|
+
- Parameters: `{"type": "researcher", "name": "Literature Review"}`
|
|
603
|
+
- Tool: `mcp__claude-flow__agent_spawn`
|
|
604
|
+
- Parameters: `{"type": "code-analyzer", "name": "Data Analysis"}`
|
|
605
|
+
- Result: Different cognitive patterns for Claude Code to use
|
|
606
|
+
|
|
607
|
+
**Step 3:** Coordinate research execution
|
|
608
|
+
|
|
609
|
+
- Tool: `mcp__claude-flow__task_orchestrate`
|
|
610
|
+
- Parameters: `{"task": "Research neural architecture search papers", "strategy": "adaptive"}`
|
|
611
|
+
- Result: Claude Code systematically searches, reads, and analyzes papers
|
|
612
|
+
|
|
613
|
+
**What Actually Happens:**
|
|
614
|
+
|
|
615
|
+
1. The swarm sets up a coordination framework
|
|
616
|
+
2. Each agent MUST use Claude Flow hooks for coordination:
|
|
617
|
+
- `npx claude-flow@alpha hooks pre-task` before starting
|
|
618
|
+
- `npx claude-flow@alpha hooks post-edit` after each file operation
|
|
619
|
+
- `npx claude-flow@alpha hooks notify` to share decisions
|
|
620
|
+
3. Claude Code uses its native Read, WebSearch, and Task tools
|
|
621
|
+
4. The swarm coordinates through shared memory and hooks
|
|
622
|
+
5. Results are synthesized by Claude Code with full coordination history
|
|
623
|
+
|
|
624
|
+
### Development Coordination Example
|
|
625
|
+
|
|
626
|
+
**Context:** Claude Code needs to build a complex system with multiple components
|
|
627
|
+
|
|
628
|
+
**Step 1:** Set up development coordination
|
|
629
|
+
|
|
630
|
+
- Tool: `mcp__claude-flow__swarm_init`
|
|
631
|
+
- Parameters: `{"topology": "hierarchical", "maxAgents": 8, "strategy": "specialized"}`
|
|
632
|
+
- Result: Hierarchical structure for organized development
|
|
633
|
+
|
|
634
|
+
**Step 2:** Define development perspectives
|
|
635
|
+
|
|
636
|
+
- Tool: `mcp__claude-flow__agent_spawn`
|
|
637
|
+
- Parameters: `{"type": "system-architect", "name": "System Design"}`
|
|
638
|
+
- Result: Architectural thinking pattern for Claude Code
|
|
639
|
+
|
|
640
|
+
**Step 3:** Coordinate implementation
|
|
641
|
+
|
|
642
|
+
- Tool: `mcp__claude-flow__task_orchestrate`
|
|
643
|
+
- Parameters: `{"task": "Implement user authentication with JWT", "strategy": "parallel"}`
|
|
644
|
+
- Result: Claude Code implements features using its native tools
|
|
645
|
+
|
|
646
|
+
**What Actually Happens:**
|
|
647
|
+
|
|
648
|
+
1. The swarm creates a development coordination plan
|
|
649
|
+
2. Each agent coordinates using mandatory hooks:
|
|
650
|
+
- Pre-task hooks for context loading
|
|
651
|
+
- Post-edit hooks for progress tracking
|
|
652
|
+
- Memory storage for cross-agent coordination
|
|
653
|
+
3. Claude Code uses Write, Edit, Bash tools for implementation
|
|
654
|
+
4. Agents share progress through Claude Flow memory
|
|
655
|
+
5. All code is written by Claude Code with full coordination
|
|
656
|
+
|
|
657
|
+
### GitHub Repository Management Example (NEW!)
|
|
658
|
+
|
|
659
|
+
**Context:** Claude Code needs to manage a complex GitHub repository
|
|
660
|
+
|
|
661
|
+
**Step 1:** Initialize GitHub swarm
|
|
662
|
+
|
|
663
|
+
- Tool: `mcp__claude-flow__github_swarm`
|
|
664
|
+
- Parameters: `{"repository": "owner/repo", "agents": 5, "focus": "maintenance"}`
|
|
665
|
+
- Result: Specialized swarm for repository management
|
|
666
|
+
|
|
667
|
+
**Step 2:** Analyze repository health
|
|
668
|
+
|
|
669
|
+
- Tool: `mcp__claude-flow__repo_analyze`
|
|
670
|
+
- Parameters: `{"deep": true, "include": ["issues", "prs", "code"]}`
|
|
671
|
+
- Result: Comprehensive repository analysis
|
|
672
|
+
|
|
673
|
+
**Step 3:** Enhance pull requests
|
|
674
|
+
|
|
675
|
+
- Tool: `mcp__claude-flow__pr_enhance`
|
|
676
|
+
- Parameters: `{"pr_number": 123, "add_tests": true, "improve_docs": true}`
|
|
677
|
+
- Result: AI-powered PR improvements
|
|
678
|
+
|
|
679
|
+
## Best Practices for Coordination
|
|
680
|
+
|
|
681
|
+
### ✅ DO:
|
|
682
|
+
|
|
683
|
+
- Use MCP tools to coordinate Claude Code's approach to complex tasks
|
|
684
|
+
- Let the swarm break down problems into manageable pieces
|
|
685
|
+
- Use memory tools to maintain context across sessions
|
|
686
|
+
- Monitor coordination effectiveness with status tools
|
|
687
|
+
- Train neural patterns for better coordination over time
|
|
688
|
+
- Leverage GitHub tools for repository management
|
|
689
|
+
|
|
690
|
+
### ❌ DON'T:
|
|
691
|
+
|
|
692
|
+
- Expect agents to write code (Claude Code does all implementation)
|
|
693
|
+
- Use MCP tools for file operations (use Claude Code's native tools)
|
|
694
|
+
- Try to make agents execute bash commands (Claude Code handles this)
|
|
695
|
+
- Confuse coordination with execution (MCP coordinates, Claude executes)
|
|
696
|
+
|
|
697
|
+
## Memory and Persistence
|
|
698
|
+
|
|
699
|
+
The swarm provides persistent memory that helps Claude Code:
|
|
700
|
+
|
|
701
|
+
- Remember project context across sessions
|
|
702
|
+
- Track decisions and rationale
|
|
703
|
+
- Maintain consistency in large projects
|
|
704
|
+
- Learn from previous coordination patterns
|
|
705
|
+
- Store GitHub workflow preferences
|
|
706
|
+
|
|
707
|
+
## Performance Benefits
|
|
708
|
+
|
|
709
|
+
When using Claude Flow coordination with Claude Code:
|
|
710
|
+
|
|
711
|
+
- **84.8% SWE-Bench solve rate** - Better problem-solving through coordination
|
|
712
|
+
- **32.3% token reduction** - Efficient task breakdown reduces redundancy
|
|
713
|
+
- **2.8-4.4x speed improvement** - Parallel coordination strategies
|
|
714
|
+
- **27+ neural models** - Diverse cognitive approaches
|
|
715
|
+
- **GitHub automation** - Streamlined repository management
|
|
716
|
+
|
|
717
|
+
## Claude Code Hooks Integration
|
|
718
|
+
|
|
719
|
+
Claude Flow includes powerful hooks that automate coordination:
|
|
720
|
+
|
|
721
|
+
### Pre-Operation Hooks
|
|
722
|
+
|
|
723
|
+
- **Auto-assign agents** before file edits based on file type
|
|
724
|
+
- **Validate commands** before execution for safety
|
|
725
|
+
- **Prepare resources** automatically for complex operations
|
|
726
|
+
- **Optimize topology** based on task complexity analysis
|
|
727
|
+
- **Cache searches** for improved performance
|
|
728
|
+
- **GitHub context** loading for repository operations
|
|
729
|
+
|
|
730
|
+
### Post-Operation Hooks
|
|
731
|
+
|
|
732
|
+
- **Auto-format code** using language-specific formatters
|
|
733
|
+
- **Train neural patterns** from successful operations
|
|
734
|
+
- **Update memory** with operation context
|
|
735
|
+
- **Analyze performance** and identify bottlenecks
|
|
736
|
+
- **Track token usage** for efficiency metrics
|
|
737
|
+
- **Sync GitHub** state for consistency
|
|
738
|
+
|
|
739
|
+
### Session Management
|
|
740
|
+
|
|
741
|
+
- **Generate summaries** at session end
|
|
742
|
+
- **Persist state** across Claude Code sessions
|
|
743
|
+
- **Track metrics** for continuous improvement
|
|
744
|
+
- **Restore previous** session context automatically
|
|
745
|
+
- **Export workflows** for reuse
|
|
746
|
+
|
|
747
|
+
### Advanced Features (v2.0.0!)
|
|
748
|
+
|
|
749
|
+
- **🚀 Automatic Topology Selection** - Optimal swarm structure for each task
|
|
750
|
+
- **⚡ Parallel Execution** - 2.8-4.4x speed improvements
|
|
751
|
+
- **🧠 Neural Training** - Continuous learning from operations
|
|
752
|
+
- **📊 Bottleneck Analysis** - Real-time performance optimization
|
|
753
|
+
- **🤖 Smart Auto-Spawning** - Zero manual agent management
|
|
754
|
+
- **🛡️ Self-Healing Workflows** - Automatic error recovery
|
|
755
|
+
- **💾 Cross-Session Memory** - Persistent learning & context
|
|
756
|
+
- **🔗 GitHub Integration** - Repository-aware swarms
|
|
757
|
+
|
|
758
|
+
### Configuration
|
|
759
|
+
|
|
760
|
+
Hooks are pre-configured in `.claude/settings.json`. Key features:
|
|
761
|
+
|
|
762
|
+
- Automatic agent assignment for different file types
|
|
763
|
+
- Code formatting on save
|
|
764
|
+
- Neural pattern learning from edits
|
|
765
|
+
- Session state persistence
|
|
766
|
+
- Performance tracking and optimization
|
|
767
|
+
- Intelligent caching and token reduction
|
|
768
|
+
- GitHub workflow automation
|
|
769
|
+
|
|
770
|
+
See `.claude/commands/` for detailed documentation on all features.
|
|
771
|
+
|
|
772
|
+
## Integration Tips
|
|
773
|
+
|
|
774
|
+
1. **Start Simple**: Begin with basic swarm init and single agent
|
|
775
|
+
2. **Scale Gradually**: Add more agents as task complexity increases
|
|
776
|
+
3. **Use Memory**: Store important decisions and context
|
|
777
|
+
4. **Monitor Progress**: Regular status checks ensure effective coordination
|
|
778
|
+
5. **Train Patterns**: Let neural agents learn from successful coordinations
|
|
779
|
+
6. **Enable Hooks**: Use the pre-configured hooks for automation
|
|
780
|
+
7. **GitHub First**: Use GitHub tools for repository management
|
|
781
|
+
|
|
782
|
+
## 🧠 SWARM ORCHESTRATION PATTERN
|
|
783
|
+
|
|
784
|
+
### You are the SWARM ORCHESTRATOR. **IMMEDIATELY SPAWN AGENTS IN PARALLEL** to execute tasks
|
|
785
|
+
|
|
786
|
+
### 🚨 CRITICAL INSTRUCTION: You are the SWARM ORCHESTRATOR
|
|
787
|
+
|
|
788
|
+
**MANDATORY**: When using swarms, you MUST:
|
|
789
|
+
|
|
790
|
+
1. **SPAWN ALL AGENTS IN ONE BATCH** - Use multiple tool calls in a SINGLE message
|
|
791
|
+
2. **EXECUTE TASKS IN PARALLEL** - Never wait for one task before starting another
|
|
792
|
+
3. **USE BATCHTOOL FOR EVERYTHING** - Multiple operations = Single message with multiple tools
|
|
793
|
+
4. **ALL AGENTS MUST USE COORDINATION TOOLS** - Every spawned agent MUST use claude-flow hooks and memory
|
|
794
|
+
|
|
795
|
+
### 🎯 AGENT COUNT CONFIGURATION
|
|
796
|
+
|
|
797
|
+
**CRITICAL: Dynamic Agent Count Rules**
|
|
798
|
+
|
|
799
|
+
1. **Check CLI Arguments First**: If user runs `npx claude-flow@alpha --agents 5`, use 5 agents
|
|
800
|
+
2. **Auto-Decide if No Args**: Without CLI args, analyze task complexity:
|
|
801
|
+
- Simple tasks (1-3 components): 3-4 agents
|
|
802
|
+
- Medium tasks (4-6 components): 5-7 agents
|
|
803
|
+
- Complex tasks (7+ components): 8-12 agents
|
|
804
|
+
3. **Agent Type Distribution**: Balance agent types based on task:
|
|
805
|
+
- Always include 1 task-orchestrator
|
|
806
|
+
- For code-heavy tasks: more coders
|
|
807
|
+
- For design tasks: more system-architects/code-analyzers
|
|
808
|
+
- For quality tasks: more testers/reviewers
|
|
809
|
+
|
|
810
|
+
**Example Auto-Decision Logic:**
|
|
811
|
+
|
|
812
|
+
```javascript
|
|
813
|
+
// If CLI args provided: npx claude-flow@alpha --agents 6
|
|
814
|
+
maxAgents = CLI_ARGS.agents || determineAgentCount(task);
|
|
815
|
+
|
|
816
|
+
function determineAgentCount(task) {
|
|
817
|
+
// Analyze task complexity
|
|
818
|
+
if (task.includes(['API', 'database', 'auth', 'tests'])) return 8;
|
|
819
|
+
if (task.includes(['frontend', 'backend'])) return 6;
|
|
820
|
+
if (task.includes(['simple', 'script'])) return 3;
|
|
821
|
+
return 5; // default
|
|
822
|
+
}
|
|
823
|
+
```
|
|
824
|
+
|
|
825
|
+
## 📋 MANDATORY AGENT COORDINATION PROTOCOL
|
|
826
|
+
|
|
827
|
+
### 🔴 CRITICAL: Every Agent MUST Follow This Protocol
|
|
828
|
+
|
|
829
|
+
When you spawn an agent using the Task tool, that agent MUST:
|
|
830
|
+
|
|
831
|
+
**1️⃣ BEFORE Starting Work:**
|
|
832
|
+
|
|
833
|
+
```bash
|
|
834
|
+
# Check previous work and load context
|
|
835
|
+
npx claude-flow@alpha hooks pre-task --description "[agent task]" --auto-spawn-agents false
|
|
836
|
+
npx claude-flow@alpha hooks session-restore --session-id "swarm-[id]" --load-memory true
|
|
837
|
+
```
|
|
838
|
+
|
|
839
|
+
**2️⃣ DURING Work (After EVERY Major Step):**
|
|
840
|
+
|
|
841
|
+
```bash
|
|
842
|
+
# Store progress in memory after each file operation
|
|
843
|
+
npx claude-flow@alpha hooks post-edit --file "[filepath]" --memory-key "swarm/[agent]/[step]"
|
|
844
|
+
|
|
845
|
+
# Store decisions and findings
|
|
846
|
+
npx claude-flow@alpha hooks notify --message "[what was done]" --telemetry true
|
|
847
|
+
|
|
848
|
+
# Check coordination with other agents
|
|
849
|
+
npx claude-flow@alpha hooks pre-search --query "[what to check]" --cache-results true
|
|
850
|
+
```
|
|
851
|
+
|
|
852
|
+
**3️⃣ AFTER Completing Work:**
|
|
853
|
+
|
|
854
|
+
```bash
|
|
855
|
+
# Save all results and learnings
|
|
856
|
+
npx claude-flow@alpha hooks post-task --task-id "[task]" --analyze-performance true
|
|
857
|
+
npx claude-flow@alpha hooks session-end --export-metrics true --generate-summary true
|
|
858
|
+
```
|
|
859
|
+
|
|
860
|
+
### 🎯 AGENT PROMPT TEMPLATE
|
|
861
|
+
|
|
862
|
+
When spawning agents, ALWAYS include these coordination instructions:
|
|
863
|
+
|
|
864
|
+
```
|
|
865
|
+
You are the [Agent Type] agent in a coordinated swarm.
|
|
866
|
+
|
|
867
|
+
MANDATORY COORDINATION:
|
|
868
|
+
1. START: Run `npx claude-flow@alpha hooks pre-task --description "[your task]"`
|
|
869
|
+
2. DURING: After EVERY file operation, run `npx claude-flow@alpha hooks post-edit --file "[file]" --memory-key "agent/[step]"`
|
|
870
|
+
3. MEMORY: Store ALL decisions using `npx claude-flow@alpha hooks notify --message "[decision]"`
|
|
871
|
+
4. END: Run `npx claude-flow@alpha hooks post-task --task-id "[task]" --analyze-performance true`
|
|
872
|
+
|
|
873
|
+
Your specific task: [detailed task description]
|
|
874
|
+
|
|
875
|
+
REMEMBER: Coordinate with other agents by checking memory BEFORE making decisions!
|
|
876
|
+
```
|
|
877
|
+
|
|
878
|
+
### ⚡ PARALLEL EXECUTION IS MANDATORY
|
|
879
|
+
|
|
880
|
+
**THIS IS WRONG ❌ (Sequential - NEVER DO THIS):**
|
|
881
|
+
|
|
882
|
+
```
|
|
883
|
+
Message 1: Initialize swarm
|
|
884
|
+
Message 2: Spawn agent 1
|
|
885
|
+
Message 3: Spawn agent 2
|
|
886
|
+
Message 4: TodoWrite (single todo)
|
|
887
|
+
Message 5: Create file 1
|
|
888
|
+
Message 6: TodoWrite (another single todo)
|
|
889
|
+
```
|
|
890
|
+
|
|
891
|
+
**THIS IS CORRECT ✅ (Parallel - ALWAYS DO THIS):**
|
|
892
|
+
|
|
893
|
+
```
|
|
894
|
+
Message 1: [BatchTool]
|
|
895
|
+
// MCP coordination setup
|
|
896
|
+
- mcp__claude-flow__swarm_init
|
|
897
|
+
- mcp__claude-flow__agent_spawn (researcher)
|
|
898
|
+
- mcp__claude-flow__agent_spawn (coder)
|
|
899
|
+
- mcp__claude-flow__agent_spawn (code-analyzer)
|
|
900
|
+
- mcp__claude-flow__agent_spawn (tester)
|
|
901
|
+
- mcp__claude-flow__agent_spawn (task-orchestrator)
|
|
902
|
+
|
|
903
|
+
Message 2: [BatchTool - Claude Code execution]
|
|
904
|
+
// Task agents with full coordination instructions
|
|
905
|
+
- Task("You are researcher agent. MANDATORY: Run hooks pre-task, post-edit, post-task. Task: Research API patterns")
|
|
906
|
+
- Task("You are coder agent. MANDATORY: Run hooks pre-task, post-edit, post-task. Task: Implement REST endpoints")
|
|
907
|
+
- Task("You are code-analyzer agent. MANDATORY: Run hooks pre-task, post-edit, post-task. Task: Analyze performance")
|
|
908
|
+
- Task("You are tester agent. MANDATORY: Run hooks pre-task, post-edit, post-task. Task: Write comprehensive tests")
|
|
909
|
+
|
|
910
|
+
// TodoWrite with ALL todos batched
|
|
911
|
+
- TodoWrite { todos: [
|
|
912
|
+
{id: "research", content: "Research API patterns", status: "in_progress", priority: "high"},
|
|
913
|
+
{id: "design", content: "Design database schema", status: "pending", priority: "high"},
|
|
914
|
+
{id: "implement", content: "Build REST endpoints", status: "pending", priority: "high"},
|
|
915
|
+
{id: "test", content: "Write unit tests", status: "pending", priority: "medium"},
|
|
916
|
+
{id: "docs", content: "Create API documentation", status: "pending", priority: "low"},
|
|
917
|
+
{id: "deploy", content: "Setup deployment", status: "pending", priority: "medium"}
|
|
918
|
+
]}
|
|
919
|
+
|
|
920
|
+
// File operations in parallel
|
|
921
|
+
- Write "api/package.json"
|
|
922
|
+
- Write "api/server.js"
|
|
923
|
+
- Write "api/routes/users.js"
|
|
924
|
+
- Bash "mkdir -p api/{routes,models,tests}"
|
|
925
|
+
```
|
|
926
|
+
|
|
927
|
+
### 🎯 MANDATORY SWARM PATTERN
|
|
928
|
+
|
|
929
|
+
When given ANY complex task with swarms:
|
|
930
|
+
|
|
931
|
+
```
|
|
932
|
+
STEP 1: IMMEDIATE PARALLEL SPAWN (Single Message!)
|
|
933
|
+
[BatchTool]:
|
|
934
|
+
// IMPORTANT: Check CLI args for agent count, otherwise auto-decide based on task complexity
|
|
935
|
+
- mcp__claude-flow__swarm_init {
|
|
936
|
+
topology: "hierarchical",
|
|
937
|
+
maxAgents: CLI_ARGS.agents || AUTO_DECIDE(task_complexity), // Use CLI args or auto-decide
|
|
938
|
+
strategy: "parallel"
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
// Spawn agents based on maxAgents count and task requirements
|
|
942
|
+
// If CLI specifies 3 agents, spawn 3. If no args, auto-decide optimal count (3-12)
|
|
943
|
+
- mcp__claude-flow__agent_spawn { type: "system-architect", name: "System Designer" }
|
|
944
|
+
- mcp__claude-flow__agent_spawn { type: "coder", name: "API Developer" }
|
|
945
|
+
- mcp__claude-flow__agent_spawn { type: "coder", name: "Frontend Dev" }
|
|
946
|
+
- mcp__claude-flow__agent_spawn { type: "code-analyzer", name: "DB Designer" }
|
|
947
|
+
- mcp__claude-flow__agent_spawn { type: "tester", name: "QA Engineer" }
|
|
948
|
+
- mcp__claude-flow__agent_spawn { type: "researcher", name: "Tech Lead" }
|
|
949
|
+
- mcp__claude-flow__agent_spawn { type: "task-orchestrator", name: "PM" }
|
|
950
|
+
- TodoWrite { todos: [multiple todos at once] }
|
|
951
|
+
|
|
952
|
+
STEP 2: PARALLEL TASK EXECUTION (Single Message!)
|
|
953
|
+
[BatchTool]:
|
|
954
|
+
- mcp__claude-flow__task_orchestrate { task: "main task", strategy: "parallel" }
|
|
955
|
+
- mcp__claude-flow__memory_usage { action: "store", key: "init", value: {...} }
|
|
956
|
+
- Multiple Read operations
|
|
957
|
+
- Multiple Write operations
|
|
958
|
+
- Multiple Bash commands
|
|
959
|
+
|
|
960
|
+
STEP 3: CONTINUE PARALLEL WORK (Never Sequential!)
|
|
961
|
+
```
|
|
962
|
+
|
|
963
|
+
### 📊 VISUAL TASK TRACKING FORMAT
|
|
964
|
+
|
|
965
|
+
Use this format when displaying task progress:
|
|
966
|
+
|
|
967
|
+
```
|
|
968
|
+
📊 Progress Overview
|
|
969
|
+
├── Total Tasks: X
|
|
970
|
+
├── ✅ Completed: X (X%)
|
|
971
|
+
├── 🔄 In Progress: X (X%)
|
|
972
|
+
├── ⭕ Todo: X (X%)
|
|
973
|
+
└── ❌ Blocked: X (X%)
|
|
974
|
+
|
|
975
|
+
📋 Todo (X)
|
|
976
|
+
└── 🔴 001: [Task description] [PRIORITY] ▶
|
|
977
|
+
|
|
978
|
+
🔄 In progress (X)
|
|
979
|
+
├── 🟡 002: [Task description] ↳ X deps ▶
|
|
980
|
+
└── 🔴 003: [Task description] [PRIORITY] ▶
|
|
981
|
+
|
|
982
|
+
✅ Completed (X)
|
|
983
|
+
├── ✅ 004: [Task description]
|
|
984
|
+
└── ... (more completed tasks)
|
|
985
|
+
|
|
986
|
+
Priority indicators: 🔴 HIGH/CRITICAL, 🟡 MEDIUM, 🟢 LOW
|
|
987
|
+
Dependencies: ↳ X deps | Actionable: ▶
|
|
988
|
+
```
|
|
989
|
+
|
|
990
|
+
### 🎯 REAL EXAMPLE: Full-Stack App Development
|
|
991
|
+
|
|
992
|
+
**Task**: "Build a complete REST API with authentication, database, and tests"
|
|
993
|
+
|
|
994
|
+
**🚨 MANDATORY APPROACH - Everything in Parallel:**
|
|
995
|
+
|
|
996
|
+
```javascript
|
|
997
|
+
// ✅ CORRECT: SINGLE MESSAGE with ALL operations
|
|
998
|
+
[BatchTool - Message 1]:
|
|
999
|
+
// Initialize and spawn ALL agents at once
|
|
1000
|
+
mcp__claude-flow__swarm_init { topology: "hierarchical", maxAgents: 8, strategy: "parallel" }
|
|
1001
|
+
mcp__claude-flow__agent_spawn { type: "system-architect", name: "System Designer" }
|
|
1002
|
+
mcp__claude-flow__agent_spawn { type: "coder", name: "API Developer" }
|
|
1003
|
+
mcp__claude-flow__agent_spawn { type: "coder", name: "Auth Expert" }
|
|
1004
|
+
mcp__claude-flow__agent_spawn { type: "code-analyzer", name: "DB Designer" }
|
|
1005
|
+
mcp__claude-flow__agent_spawn { type: "tester", name: "Test Engineer" }
|
|
1006
|
+
mcp__claude-flow__agent_spawn { type: "task-orchestrator", name: "Lead" }
|
|
1007
|
+
|
|
1008
|
+
// Update ALL todos at once - NEVER split todos!
|
|
1009
|
+
TodoWrite { todos: [
|
|
1010
|
+
{ id: "design", content: "Design API architecture", status: "in_progress", priority: "high" },
|
|
1011
|
+
{ id: "auth", content: "Implement authentication", status: "pending", priority: "high" },
|
|
1012
|
+
{ id: "db", content: "Design database schema", status: "pending", priority: "high" },
|
|
1013
|
+
{ id: "api", content: "Build REST endpoints", status: "pending", priority: "high" },
|
|
1014
|
+
{ id: "tests", content: "Write comprehensive tests", status: "pending", priority: "medium" },
|
|
1015
|
+
{ id: "docs", content: "Document API endpoints", status: "pending", priority: "low" },
|
|
1016
|
+
{ id: "deploy", content: "Setup deployment pipeline", status: "pending", priority: "medium" },
|
|
1017
|
+
{ id: "monitor", content: "Add monitoring", status: "pending", priority: "medium" }
|
|
1018
|
+
]}
|
|
1019
|
+
|
|
1020
|
+
// Start orchestration
|
|
1021
|
+
mcp__claude-flow__task_orchestrate { task: "Build REST API", strategy: "parallel" }
|
|
1022
|
+
|
|
1023
|
+
// Store initial memory
|
|
1024
|
+
mcp__claude-flow__memory_usage { action: "store", key: "project/init", value: { started: Date.now() } }
|
|
1025
|
+
|
|
1026
|
+
[BatchTool - Message 2]:
|
|
1027
|
+
// Create ALL directories at once
|
|
1028
|
+
Bash("mkdir -p test-app/{src,tests,docs,config}")
|
|
1029
|
+
Bash("mkdir -p test-app/src/{models,routes,middleware,services}")
|
|
1030
|
+
Bash("mkdir -p test-app/tests/{unit,integration}")
|
|
1031
|
+
|
|
1032
|
+
// Write ALL base files at once
|
|
1033
|
+
Write("test-app/package.json", packageJsonContent)
|
|
1034
|
+
Write("test-app/.env.example", envContent)
|
|
1035
|
+
Write("test-app/README.md", readmeContent)
|
|
1036
|
+
Write("test-app/src/server.js", serverContent)
|
|
1037
|
+
Write("test-app/src/config/database.js", dbConfigContent)
|
|
1038
|
+
|
|
1039
|
+
[BatchTool - Message 3]:
|
|
1040
|
+
// Read multiple files for context
|
|
1041
|
+
Read("test-app/package.json")
|
|
1042
|
+
Read("test-app/src/server.js")
|
|
1043
|
+
Read("test-app/.env.example")
|
|
1044
|
+
|
|
1045
|
+
// Run multiple commands
|
|
1046
|
+
Bash("cd test-app && npm install")
|
|
1047
|
+
Bash("cd test-app && npm run lint")
|
|
1048
|
+
Bash("cd test-app && npm test")
|
|
1049
|
+
```
|
|
1050
|
+
|
|
1051
|
+
### 🚫 NEVER DO THIS (Sequential = WRONG):
|
|
1052
|
+
|
|
1053
|
+
```javascript
|
|
1054
|
+
// ❌ WRONG: Multiple messages, one operation each
|
|
1055
|
+
Message 1: mcp__claude-flow__swarm_init
|
|
1056
|
+
Message 2: mcp__claude-flow__agent_spawn (just one agent)
|
|
1057
|
+
Message 3: mcp__claude-flow__agent_spawn (another agent)
|
|
1058
|
+
Message 4: TodoWrite (single todo)
|
|
1059
|
+
Message 5: Write (single file)
|
|
1060
|
+
// This is 5x slower and wastes swarm coordination!
|
|
1061
|
+
```
|
|
1062
|
+
|
|
1063
|
+
### 🔄 MEMORY COORDINATION PATTERN
|
|
1064
|
+
|
|
1065
|
+
Every agent coordination step MUST use memory:
|
|
1066
|
+
|
|
1067
|
+
```
|
|
1068
|
+
// After each major decision or implementation
|
|
1069
|
+
mcp__claude-flow__memory_usage
|
|
1070
|
+
action: "store"
|
|
1071
|
+
key: "swarm-{id}/agent-{name}/{step}"
|
|
1072
|
+
value: {
|
|
1073
|
+
timestamp: Date.now(),
|
|
1074
|
+
decision: "what was decided",
|
|
1075
|
+
implementation: "what was built",
|
|
1076
|
+
nextSteps: ["step1", "step2"],
|
|
1077
|
+
dependencies: ["dep1", "dep2"]
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
// To retrieve coordination data
|
|
1081
|
+
mcp__claude-flow__memory_usage
|
|
1082
|
+
action: "retrieve"
|
|
1083
|
+
key: "swarm-{id}/agent-{name}/{step}"
|
|
1084
|
+
|
|
1085
|
+
// To check all swarm progress
|
|
1086
|
+
mcp__claude-flow__memory_usage
|
|
1087
|
+
action: "list"
|
|
1088
|
+
pattern: "swarm-{id}/*"
|
|
1089
|
+
```
|
|
1090
|
+
|
|
1091
|
+
### ⚡ PERFORMANCE TIPS
|
|
1092
|
+
|
|
1093
|
+
1. **Batch Everything**: Never operate on single files when multiple are needed
|
|
1094
|
+
2. **Parallel First**: Always think "what can run simultaneously?"
|
|
1095
|
+
3. **Memory is Key**: Use memory for ALL cross-agent coordination
|
|
1096
|
+
4. **Monitor Progress**: Use mcp**claude-flow**swarm_monitor for real-time tracking
|
|
1097
|
+
5. **Auto-Optimize**: Let hooks handle topology and agent selection
|
|
1098
|
+
|
|
1099
|
+
### 🎨 VISUAL SWARM STATUS
|
|
1100
|
+
|
|
1101
|
+
When showing swarm status, use this format:
|
|
1102
|
+
|
|
1103
|
+
```
|
|
1104
|
+
🐝 Swarm Status: ACTIVE
|
|
1105
|
+
├── 🏗️ Topology: hierarchical
|
|
1106
|
+
├── 👥 Agents: 6/8 active
|
|
1107
|
+
├── ⚡ Mode: parallel execution
|
|
1108
|
+
├── 📊 Tasks: 12 total (4 complete, 6 in-progress, 2 pending)
|
|
1109
|
+
└── 🧠 Memory: 15 coordination points stored
|
|
1110
|
+
|
|
1111
|
+
Agent Activity:
|
|
1112
|
+
├── 🟢 system-architect: Designing database schema...
|
|
1113
|
+
├── 🟢 coder-1: Implementing auth endpoints...
|
|
1114
|
+
├── 🟢 coder-2: Building user CRUD operations...
|
|
1115
|
+
├── 🟢 code-analyzer: Optimizing query performance...
|
|
1116
|
+
├── 🟡 tester: Waiting for auth completion...
|
|
1117
|
+
└── 🟢 task-orchestrator: Monitoring progress...
|
|
1118
|
+
```
|
|
1119
|
+
|
|
1120
|
+
## 📝 CRITICAL: TODOWRITE AND TASK TOOL BATCHING
|
|
1121
|
+
|
|
1122
|
+
### 🚨 MANDATORY BATCHING RULES FOR TODOS AND TASKS
|
|
1123
|
+
|
|
1124
|
+
**TodoWrite Tool Requirements:**
|
|
1125
|
+
|
|
1126
|
+
1. **ALWAYS** include 5-10+ todos in a SINGLE TodoWrite call
|
|
1127
|
+
2. **NEVER** call TodoWrite multiple times in sequence
|
|
1128
|
+
3. **BATCH** all todo updates together - status changes, new todos, completions
|
|
1129
|
+
4. **INCLUDE** all priority levels (high, medium, low) in one call
|
|
1130
|
+
|
|
1131
|
+
**Task Tool Requirements:**
|
|
1132
|
+
|
|
1133
|
+
1. **SPAWN** all agents using Task tool in ONE message
|
|
1134
|
+
2. **NEVER** spawn agents one by one across multiple messages
|
|
1135
|
+
3. **INCLUDE** full task descriptions and coordination instructions
|
|
1136
|
+
4. **BATCH** related Task calls together for parallel execution
|
|
1137
|
+
|
|
1138
|
+
**Example of CORRECT TodoWrite usage:**
|
|
1139
|
+
|
|
1140
|
+
```javascript
|
|
1141
|
+
// ✅ CORRECT - All todos in ONE call
|
|
1142
|
+
TodoWrite { todos: [
|
|
1143
|
+
{ id: "1", content: "Initialize system", status: "completed", priority: "high" },
|
|
1144
|
+
{ id: "2", content: "Analyze requirements", status: "in_progress", priority: "high" },
|
|
1145
|
+
{ id: "3", content: "Design architecture", status: "pending", priority: "high" },
|
|
1146
|
+
{ id: "4", content: "Implement core", status: "pending", priority: "high" },
|
|
1147
|
+
{ id: "5", content: "Build features", status: "pending", priority: "medium" },
|
|
1148
|
+
{ id: "6", content: "Write tests", status: "pending", priority: "medium" },
|
|
1149
|
+
{ id: "7", content: "Add monitoring", status: "pending", priority: "medium" },
|
|
1150
|
+
{ id: "8", content: "Documentation", status: "pending", priority: "low" },
|
|
1151
|
+
{ id: "9", content: "Performance tuning", status: "pending", priority: "low" },
|
|
1152
|
+
{ id: "10", content: "Deploy to production", status: "pending", priority: "high" }
|
|
1153
|
+
]}
|
|
1154
|
+
```
|
|
1155
|
+
|
|
1156
|
+
**Example of WRONG TodoWrite usage:**
|
|
1157
|
+
|
|
1158
|
+
```javascript
|
|
1159
|
+
// ❌ WRONG - Multiple TodoWrite calls
|
|
1160
|
+
Message 1: TodoWrite { todos: [{ id: "1", content: "Task 1", ... }] }
|
|
1161
|
+
Message 2: TodoWrite { todos: [{ id: "2", content: "Task 2", ... }] }
|
|
1162
|
+
Message 3: TodoWrite { todos: [{ id: "3", content: "Task 3", ... }] }
|
|
1163
|
+
// This breaks parallel coordination!
|
|
1164
|
+
```
|
|
1165
|
+
|
|
1166
|
+
## Claude Flow v2.0.0 Features
|
|
1167
|
+
|
|
1168
|
+
Claude Flow extends the base coordination with:
|
|
1169
|
+
|
|
1170
|
+
- **🔗 GitHub Integration** - Deep repository management
|
|
1171
|
+
- **🎯 Project Templates** - Quick-start for common projects
|
|
1172
|
+
- **📊 Advanced Analytics** - Detailed performance insights
|
|
1173
|
+
- **🤖 Custom Agent Types** - Domain-specific coordinators
|
|
1174
|
+
- **🔄 Workflow Automation** - Reusable task sequences
|
|
1175
|
+
- **🛡️ Enhanced Security** - Safer command execution
|
|
1176
|
+
|
|
1177
|
+
## Support
|
|
1178
|
+
|
|
1179
|
+
- Documentation: https://github.com/ruvnet/claude-flow
|
|
1180
|
+
- Issues: https://github.com/ruvnet/claude-flow/issues
|
|
1181
|
+
- Examples: https://github.com/ruvnet/claude-flow/tree/main/examples
|
|
1182
|
+
|
|
1183
|
+
---
|
|
1184
|
+
|
|
1185
|
+
Remember: **Claude Flow coordinates, Claude Code creates!** Start with `mcp__claude-flow__swarm_init` to enhance your development workflow.
|