-
Notifications
You must be signed in to change notification settings - Fork 4.5k
CLAUDE optimized
rUv edited this page Aug 5, 2025
·
1 revision
ABSOLUTE RULE: ALL operations MUST be concurrent/parallel in ONE message:
- TodoWrite: ALWAYS batch 5-10+ todos in ONE call
- Task tool: ALWAYS spawn ALL agents in ONE message
- File operations: ALWAYS batch ALL reads/writes/edits
- Bash commands: ALWAYS batch ALL terminal operations
- Memory operations: ALWAYS batch ALL store/retrieve
✅ CORRECT: Everything in ONE message
[Single Message]:
- TodoWrite { todos: [10+ todos with all statuses/priorities] }
- Task("Agent 1"), Task("Agent 2"), Task("Agent 3")
- Read("file1.js"), Read("file2.js"), Read("file3.js")
- Write("output1.js"), Write("output2.js")
- Bash("npm install"), Bash("npm test"), Bash("npm build")❌ WRONG: Multiple messages (6x slower!)
| Claude Code (Executor) | MCP Tools (Coordinator) |
|---|---|
| ALL file operations | Coordination & planning |
| Code generation | Memory management |
| Bash commands | Performance tracking |
| TodoWrite & tasks | Swarm orchestration |
| Git operations | GitHub integration |
| Implementation work | Intelligence insights |
Key Principle: MCP coordinates, Claude Code executes!
| Command | Purpose |
|---|---|
npx claude-flow sparc modes |
List development modes |
npx claude-flow sparc run <mode> "<task>" |
Execute mode |
npx claude-flow automation mle-star --dataset data.csv --target price --claude |
ML workflow |
npm run build/test/lint/typecheck |
Standard builds |
- Development (5): coder, reviewer, tester, planner, researcher
- Coordination (8): hierarchical/mesh/adaptive coordinators, memory managers
- GitHub (13): PR management, code review, release automation
- Performance (6): monitoring, load balancing, optimization
- Consensus (7): Byzantine, Raft, Gossip protocols
- Specialized (25): ML, mobile, backend, security, etc.
claude mcp add claude-flow npx claude-flow@alpha mcp start| Tool | Purpose |
|---|---|
mcp__claude-flow__swarm_init |
Setup coordination |
mcp__claude-flow__agent_spawn |
Create agents |
mcp__claude-flow__task_orchestrate |
Coordinate tasks |
mcp__claude-flow__memory_usage |
Persistent memory |
mcp__claude-flow__github_* |
Repository management |
-
Check CLI args first:
--agents 5= use 5 agents - Auto-decide: Simple (3-4), Medium (5-7), Complex (8-12)
Before Starting:
npx claude-flow@alpha hooks pre-task --description "[task]"
npx claude-flow@alpha hooks session-restore --session-id "swarm-[id]"During Work:
npx claude-flow@alpha hooks post-edit --file "[file]" --memory-key "agent/[step]"
npx claude-flow@alpha hooks notify --message "[decision]"After Completion:
npx claude-flow@alpha hooks post-task --task-id "[task]" --analyze-performance true
npx claude-flow@alpha hooks session-end --export-metrics true// SINGLE MESSAGE with ALL operations
[BatchTool - Message 1]:
// MCP coordination setup
mcp__claude-flow__swarm_init { topology: "mesh", maxAgents: 6 }
mcp__claude-flow__agent_spawn { type: "researcher" }
mcp__claude-flow__agent_spawn { type: "coder" }
mcp__claude-flow__agent_spawn { type: "tester" }
// Claude Code execution
Task("Researcher: Research API patterns. MUST use hooks.")
Task("Coder: Implement endpoints. MUST use hooks.")
Task("Tester: Write tests. MUST use hooks.")
TodoWrite { todos: [
{id: "research", content: "Research patterns", status: "in_progress", priority: "high"},
{id: "implement", content: "Build endpoints", status: "pending", priority: "high"},
{id: "test", content: "Write tests", status: "pending", priority: "medium"},
{id: "docs", content: "Documentation", status: "pending", priority: "low"}
]}
// File operations
Write("api/package.json", content)
Write("api/server.js", content)
Bash("mkdir -p api/{routes,tests}")
Bash("npm install")// Multiple messages - 6x slower!
Message 1: mcp__claude-flow__swarm_init
Message 2: Task("researcher")
Message 3: TodoWrite (single todo)
Message 4: Write (single file)CRITICAL: Always include 5-10+ todos in ONE call:
TodoWrite { todos: [
{ id: "1", content: "Task 1", status: "completed", priority: "high" },
{ id: "2", content: "Task 2", status: "in_progress", priority: "high" },
{ id: "3", content: "Task 3", status: "pending", priority: "high" },
{ id: "4", content: "Task 4", status: "pending", priority: "medium" },
{ id: "5", content: "Task 5", status: "pending", priority: "medium" },
{ id: "6", content: "Task 6", status: "pending", priority: "low" },
// ... continue to 10+ todos
]}# Auto-spawn optimal agents
claude-flow automation auto-agent --task-complexity enterprise
# ML engineering workflow
claude-flow automation mle-star --dataset data.csv --target price --claude
# Stream chaining (agent-to-agent piping)
claude-flow automation mle-star --dataset data.csv --target price --claude --output-format stream-json- Real-time processing: 40-60% faster than file-based
- Context preservation: Full conversation history flows
- Memory efficient: No intermediate storage
📊 Progress Overview
├── Total: X | ✅ Complete: X | 🔄 Active: X | ⭕ Todo: X
└── Priority: 🔴 HIGH | 🟡 MEDIUM | 🟢 LOW
- ✅ Batch ALL operations in single messages
- ✅ Use MCP for coordination, Claude Code for execution
- ✅ Include 5-10+ todos in every TodoWrite
- ✅ Use hooks for agent coordination
- ✅ Enable stream chaining for complex workflows
- ❌ Split related operations across messages
- ❌ Use MCP tools for file operations
- ❌ Make single-todo TodoWrite calls
- ❌ Skip agent coordination hooks
- ❌ Use sequential execution when parallel is possible
- Agent Count: CLI args first, then auto-decide (3-12 range)
- Batch Operations: Multiple ops = single message
- Memory Coordination: Store ALL decisions for cross-agent sync
- Hook Integration: Use pre/post hooks for automation
- Stream Chaining: Enable for 40-60% speed improvement
Remember: Claude Flow coordinates, Claude Code creates! Start with mcp__claude-flow__swarm_init for optimal development workflows.