moflo 4.8.48 → 4.8.50

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.
Files changed (66) hide show
  1. package/README.md +11 -0
  2. package/bin/gate.cjs +19 -4
  3. package/package.json +1 -2
  4. package/src/@claude-flow/cli/dist/src/init/executor.js +0 -4
  5. package/src/@claude-flow/cli/dist/src/version.js +1 -1
  6. package/src/@claude-flow/cli/package.json +106 -106
  7. package/.claude/agents/dual-mode/codex-coordinator.md +0 -224
  8. package/.claude/agents/dual-mode/codex-worker.md +0 -211
  9. package/.claude/agents/dual-mode/dual-orchestrator.md +0 -291
  10. package/.claude/agents/payments/agentic-payments.md +0 -126
  11. package/.claude/agents/sublinear/consensus-coordinator.md +0 -338
  12. package/.claude/agents/sublinear/matrix-optimizer.md +0 -185
  13. package/.claude/agents/sublinear/pagerank-analyzer.md +0 -299
  14. package/.claude/agents/sublinear/performance-optimizer.md +0 -368
  15. package/.claude/agents/sublinear/trading-predictor.md +0 -246
  16. package/.claude/agents/templates/automation-smart-agent.md +0 -205
  17. package/.claude/agents/templates/coordinator-swarm-init.md +0 -105
  18. package/.claude/agents/templates/github-pr-manager.md +0 -177
  19. package/.claude/agents/templates/implementer-sparc-coder.md +0 -259
  20. package/.claude/agents/templates/memory-coordinator.md +0 -187
  21. package/.claude/agents/templates/migration-plan.md +0 -746
  22. package/.claude/agents/templates/orchestrator-task.md +0 -139
  23. package/.claude/agents/templates/performance-analyzer.md +0 -199
  24. package/.claude/agents/templates/sparc-coordinator.md +0 -183
  25. package/.claude/commands/agents/README.md +0 -10
  26. package/.claude/commands/agents/agent-capabilities.md +0 -21
  27. package/.claude/commands/agents/agent-coordination.md +0 -28
  28. package/.claude/commands/agents/agent-spawning.md +0 -28
  29. package/.claude/commands/agents/agent-types.md +0 -26
  30. package/.claude/commands/analysis/COMMAND_COMPLIANCE_REPORT.md +0 -54
  31. package/.claude/commands/analysis/README.md +0 -9
  32. package/.claude/commands/analysis/bottleneck-detect.md +0 -162
  33. package/.claude/commands/analysis/performance-bottlenecks.md +0 -59
  34. package/.claude/commands/analysis/performance-report.md +0 -25
  35. package/.claude/commands/analysis/token-efficiency.md +0 -45
  36. package/.claude/commands/analysis/token-usage.md +0 -25
  37. package/.claude/commands/automation/README.md +0 -9
  38. package/.claude/commands/automation/auto-agent.md +0 -122
  39. package/.claude/commands/automation/self-healing.md +0 -106
  40. package/.claude/commands/automation/session-memory.md +0 -90
  41. package/.claude/commands/automation/smart-agents.md +0 -73
  42. package/.claude/commands/automation/smart-spawn.md +0 -25
  43. package/.claude/commands/automation/workflow-select.md +0 -25
  44. package/.claude/commands/monitoring/README.md +0 -9
  45. package/.claude/commands/monitoring/agent-metrics.md +0 -25
  46. package/.claude/commands/monitoring/agents.md +0 -44
  47. package/.claude/commands/monitoring/real-time-view.md +0 -25
  48. package/.claude/commands/monitoring/status.md +0 -46
  49. package/.claude/commands/monitoring/swarm-monitor.md +0 -25
  50. package/.claude/commands/optimization/README.md +0 -9
  51. package/.claude/commands/optimization/auto-topology.md +0 -62
  52. package/.claude/commands/optimization/cache-manage.md +0 -25
  53. package/.claude/commands/optimization/parallel-execute.md +0 -25
  54. package/.claude/commands/optimization/parallel-execution.md +0 -50
  55. package/.claude/commands/optimization/topology-optimize.md +0 -25
  56. package/.claude/scripts/build-embeddings.mjs +0 -549
  57. package/.claude/scripts/generate-code-map.mjs +0 -956
  58. package/.claude/scripts/hooks.mjs +0 -607
  59. package/.claude/scripts/index-all.mjs +0 -193
  60. package/.claude/scripts/index-guidance.mjs +0 -917
  61. package/.claude/scripts/index-tests.mjs +0 -729
  62. package/.claude/scripts/lib/moflo-resolve.mjs +0 -14
  63. package/.claude/scripts/lib/process-manager.mjs +0 -256
  64. package/.claude/scripts/lib/registry-cleanup.cjs +0 -41
  65. package/.claude/scripts/semantic-search.mjs +0 -473
  66. package/.claude/scripts/session-start-launcher.mjs +0 -272
package/README.md CHANGED
@@ -233,6 +233,17 @@ The memory-first gate doesn't blindly block every request. It classifies each pr
233
233
  - **Simple directives** (e.g., "commit", "yes", "continue", "looks good") — skip the gate entirely, no memory search required
234
234
  - **Task-oriented prompts** (e.g., "fix the auth bug", "add pagination to the API") — gate enforced, must search memory first
235
235
 
236
+ ### Escape hatch
237
+
238
+ Prefix any prompt with `@@` to bypass the memory-first gate for that turn. Useful for conversational questions, thinking out loud, or discussions that don't need prior context:
239
+
240
+ ```
241
+ @@ what do you think about this approach?
242
+ @@ question — is there a better way to handle auth tokens?
243
+ ```
244
+
245
+ The `@@` prefix is stripped before Claude sees the prompt, so it won't affect the response.
246
+
236
247
  ### Disabling gates
237
248
 
238
249
  All gates are configurable in `moflo.yaml`:
package/bin/gate.cjs CHANGED
@@ -41,7 +41,14 @@ var command = process.argv[2];
41
41
 
42
42
  var EXEMPT = ['.claude/', '.claude\\', 'CLAUDE.md', 'MEMORY.md', 'workflow-state', 'node_modules'];
43
43
  var DANGEROUS = ['rm -rf /', 'format c:', 'del /s /q c:\\', ':(){:|:&};:', 'mkfs.', '> /dev/sda'];
44
+ // Short replies starting with directive words ("ok", "yes", etc.) bypass the
45
+ // memory gate — but only if the prompt is under 20 chars. Longer prompts that
46
+ // start with a directive but contain a real question/task still get gated.
44
47
  var DIRECTIVE_RE = /^(yes|no|yeah|yep|nope|sure|ok|okay|correct|right|exactly|perfect)\b/i;
48
+ var DIRECTIVE_MAX_LEN = 20;
49
+ // @@ prefix = explicit escape hatch. User signals "this is conversational,
50
+ // skip the memory gate." Strips the prefix before Claude sees the prompt.
51
+ var ESCAPE_PREFIX = '@@';
45
52
  var TASK_RE = /\b(fix|bug|error|implement|add|create|build|write|refactor|debug|test|feature|issue|security|optimi)\b/i;
46
53
 
47
54
  switch (command) {
@@ -65,17 +72,22 @@ switch (command) {
65
72
  if (s.memorySearched || !s.memoryRequired) break;
66
73
  var target = (process.env.TOOL_INPUT_pattern || '') + ' ' + (process.env.TOOL_INPUT_path || '');
67
74
  if (EXEMPT.some(function(p) { return target.indexOf(p) >= 0; })) break;
68
- process.stderr.write('BLOCKED: Search memory before exploring files. Use mcp__moflo__memory_search.\n');
75
+ process.stderr.write('BLOCKED: Search memory before exploring files. Use mcp__moflo__memory_search with namespace "code-map", "patterns", "knowledge", or "guidance".\n');
69
76
  process.exit(2);
77
+ break; // unreachable but prevents fall-through lint warnings
70
78
  }
71
79
  case 'check-before-read': {
72
80
  if (!config.memory_first) break;
73
81
  var s = readState();
74
82
  if (s.memorySearched || !s.memoryRequired) break;
75
83
  var fp = process.env.TOOL_INPUT_file_path || '';
76
- if (fp.indexOf('.claude/guidance/') < 0 && fp.indexOf('.claude\\guidance\\') < 0) break;
77
- process.stderr.write('BLOCKED: Search memory before reading guidance files. Use mcp__moflo__memory_search.\n');
84
+ // Exempt: node_modules, CLAUDE.md, MEMORY.md, workflow-state
85
+ // NOT exempt: .claude/guidance/ (guidance files must require memory search)
86
+ var isGuidance = fp.indexOf('.claude/guidance/') >= 0 || fp.indexOf('.claude\\guidance\\') >= 0;
87
+ if (!isGuidance && EXEMPT.some(function(p) { return fp.indexOf(p) >= 0; })) break;
88
+ process.stderr.write('BLOCKED: Search memory before reading files. Use mcp__moflo__memory_search with namespace "code-map", "patterns", "knowledge", or "guidance".\n');
78
89
  process.exit(2);
90
+ break; // unreachable but prevents fall-through lint warnings
79
91
  }
80
92
  case 'record-task-created': {
81
93
  var s = readState();
@@ -113,7 +125,10 @@ switch (command) {
113
125
  var s = readState();
114
126
  s.memorySearched = false;
115
127
  var prompt = process.env.CLAUDE_USER_PROMPT || '';
116
- s.memoryRequired = prompt.length >= 4 && !DIRECTIVE_RE.test(prompt) && (TASK_RE.test(prompt) || prompt.length > 80);
128
+ var isEscaped = prompt.indexOf(ESCAPE_PREFIX) === 0;
129
+ if (isEscaped) prompt = prompt.slice(ESCAPE_PREFIX.length).trimStart();
130
+ var isShortDirective = DIRECTIVE_RE.test(prompt) && prompt.length < DIRECTIVE_MAX_LEN;
131
+ s.memoryRequired = !isEscaped && prompt.length >= 4 && !isShortDirective && (TASK_RE.test(prompt) || prompt.length > DIRECTIVE_MAX_LEN);
117
132
  s.interactionCount = (s.interactionCount || 0) + 1;
118
133
  writeState(s);
119
134
  if (!s.tasksCreated) console.log('REMINDER: Use TaskCreate before spawning agents. Task tool is blocked until then.');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "moflo",
3
- "version": "4.8.48",
3
+ "version": "4.8.50",
4
4
  "description": "MoFlo — AI agent orchestration for Claude Code. Forked from ruflo/claude-flow with patches applied to source, plus feature-level orchestration.",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -40,7 +40,6 @@
40
40
  ".claude/commands/**/*.md",
41
41
  ".claude/agents/**/*.md",
42
42
  ".claude/helpers/**",
43
- ".claude/scripts/**",
44
43
  ".claude/guidance/shipped/**",
45
44
  "!.claude/**/*.db",
46
45
  "!.claude/**/*.map",
@@ -69,12 +69,8 @@ const SKILLS_MAP = {
69
69
  */
70
70
  const COMMANDS_MAP = {
71
71
  core: ['claude-flow-help.md', 'claude-flow-swarm.md', 'claude-flow-memory.md'],
72
- analysis: ['analysis'],
73
- automation: ['automation'],
74
72
  github: ['github'],
75
73
  hooks: ['hooks'],
76
- monitoring: ['monitoring'],
77
- optimization: ['optimization'],
78
74
  sparc: ['sparc'],
79
75
  };
80
76
  /**
@@ -2,5 +2,5 @@
2
2
  * Auto-generated by build. Do not edit manually.
3
3
  * Source of truth: root package.json → scripts/sync-version.mjs
4
4
  */
5
- export const VERSION = '4.8.48';
5
+ export const VERSION = '4.8.50';
6
6
  //# sourceMappingURL=version.js.map
@@ -1,106 +1,106 @@
1
- {
2
- "name": "@moflo/cli",
3
- "version": "4.8.48",
4
- "type": "module",
5
- "description": "MoFlo CLI — AI agent orchestration with specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code",
6
- "main": "dist/src/index.js",
7
- "types": "dist/src/index.d.ts",
8
- "sideEffects": false,
9
- "bin": {
10
- "cli": "./bin/cli.js",
11
- "claude-flow": "./bin/cli.js",
12
- "claude-flow-mcp": "./bin/mcp-server.js"
13
- },
14
- "homepage": "https://github.com/eric-cielo/moflo#readme",
15
- "bugs": {
16
- "url": "https://github.com/eric-cielo/moflo/issues"
17
- },
18
- "repository": {
19
- "type": "git",
20
- "url": "https://github.com/eric-cielo/moflo.git",
21
- "directory": "v3/@claude-flow/cli"
22
- },
23
- "keywords": [
24
- "claude",
25
- "claude-code",
26
- "anthropic",
27
- "ai-agents",
28
- "multi-agent",
29
- "swarm",
30
- "mcp",
31
- "model-context-protocol",
32
- "llm",
33
- "cli",
34
- "orchestration",
35
- "automation",
36
- "developer-tools",
37
- "coding-assistant",
38
- "vector-database",
39
- "embeddings",
40
- "self-learning",
41
- "enterprise"
42
- ],
43
- "author": {
44
- "name": "Eric Cielo",
45
- "email": "eric@motailz.com",
46
- "url": "https://github.com/eric-cielo"
47
- },
48
- "license": "MIT",
49
- "exports": {
50
- ".": {
51
- "types": "./dist/src/index.d.ts",
52
- "import": "./dist/src/index.js"
53
- },
54
- "./ruvector": {
55
- "types": "./dist/src/ruvector/index.d.ts",
56
- "import": "./dist/src/ruvector/index.js"
57
- },
58
- "./ruvector/*": {
59
- "types": "./dist/src/ruvector/*.d.ts",
60
- "import": "./dist/src/ruvector/*.js"
61
- },
62
- "./mcp-tools": {
63
- "types": "./dist/src/mcp-tools/index.d.ts",
64
- "import": "./dist/src/mcp-tools/index.js"
65
- }
66
- },
67
- "files": [
68
- "dist",
69
- "bin",
70
- ".claude",
71
- "README.md"
72
- ],
73
- "scripts": {
74
- "build": "tsc",
75
- "test": "vitest run",
76
- "test:plugin-store": "npx tsx src/plugins/tests/standalone-test.ts",
77
- "test:pattern-store": "npx tsx src/transfer/store/tests/standalone-test.ts",
78
- "preinstall": "node bin/preinstall.cjs || true",
79
- "prepublishOnly": "cp ../../../README.md ./README.md",
80
- "release": "npm version prerelease --preid=alpha && npm run publish:all",
81
- "publish:all": "./scripts/publish.sh"
82
- },
83
- "devDependencies": {
84
- "typescript": "^5.3.0"
85
- },
86
- "dependencies": {
87
- "@noble/ed25519": "^2.1.0",
88
- "semver": "^7.6.0"
89
- },
90
- "optionalDependencies": {
91
- "@claude-flow/aidefence": "file:../aidefence",
92
- "@claude-flow/embeddings": "file:../embeddings",
93
- "@claude-flow/guidance": "file:../guidance",
94
- "@claude-flow/memory": "file:../memory",
95
- "@claude-flow/plugin-gastown-bridge": "^0.1.3",
96
- "agentic-flow": "^2.0.7",
97
- "@ruvector/attention": "^0.1.4",
98
- "@ruvector/learning-wasm": "^0.1.29",
99
- "@ruvector/router": "^0.1.27",
100
- "@ruvector/sona": "^0.1.5"
101
- },
102
- "publishConfig": {
103
- "access": "public",
104
- "tag": "latest"
105
- }
106
- }
1
+ {
2
+ "name": "@moflo/cli",
3
+ "version": "4.8.50",
4
+ "type": "module",
5
+ "description": "MoFlo CLI — AI agent orchestration with specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code",
6
+ "main": "dist/src/index.js",
7
+ "types": "dist/src/index.d.ts",
8
+ "sideEffects": false,
9
+ "bin": {
10
+ "cli": "./bin/cli.js",
11
+ "claude-flow": "./bin/cli.js",
12
+ "claude-flow-mcp": "./bin/mcp-server.js"
13
+ },
14
+ "homepage": "https://github.com/eric-cielo/moflo#readme",
15
+ "bugs": {
16
+ "url": "https://github.com/eric-cielo/moflo/issues"
17
+ },
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "https://github.com/eric-cielo/moflo.git",
21
+ "directory": "v3/@claude-flow/cli"
22
+ },
23
+ "keywords": [
24
+ "claude",
25
+ "claude-code",
26
+ "anthropic",
27
+ "ai-agents",
28
+ "multi-agent",
29
+ "swarm",
30
+ "mcp",
31
+ "model-context-protocol",
32
+ "llm",
33
+ "cli",
34
+ "orchestration",
35
+ "automation",
36
+ "developer-tools",
37
+ "coding-assistant",
38
+ "vector-database",
39
+ "embeddings",
40
+ "self-learning",
41
+ "enterprise"
42
+ ],
43
+ "author": {
44
+ "name": "Eric Cielo",
45
+ "email": "eric@motailz.com",
46
+ "url": "https://github.com/eric-cielo"
47
+ },
48
+ "license": "MIT",
49
+ "exports": {
50
+ ".": {
51
+ "types": "./dist/src/index.d.ts",
52
+ "import": "./dist/src/index.js"
53
+ },
54
+ "./ruvector": {
55
+ "types": "./dist/src/ruvector/index.d.ts",
56
+ "import": "./dist/src/ruvector/index.js"
57
+ },
58
+ "./ruvector/*": {
59
+ "types": "./dist/src/ruvector/*.d.ts",
60
+ "import": "./dist/src/ruvector/*.js"
61
+ },
62
+ "./mcp-tools": {
63
+ "types": "./dist/src/mcp-tools/index.d.ts",
64
+ "import": "./dist/src/mcp-tools/index.js"
65
+ }
66
+ },
67
+ "files": [
68
+ "dist",
69
+ "bin",
70
+ ".claude",
71
+ "README.md"
72
+ ],
73
+ "scripts": {
74
+ "build": "tsc",
75
+ "test": "vitest run",
76
+ "test:plugin-store": "npx tsx src/plugins/tests/standalone-test.ts",
77
+ "test:pattern-store": "npx tsx src/transfer/store/tests/standalone-test.ts",
78
+ "preinstall": "node bin/preinstall.cjs || true",
79
+ "prepublishOnly": "cp ../../../README.md ./README.md",
80
+ "release": "npm version prerelease --preid=alpha && npm run publish:all",
81
+ "publish:all": "./scripts/publish.sh"
82
+ },
83
+ "devDependencies": {
84
+ "typescript": "^5.3.0"
85
+ },
86
+ "dependencies": {
87
+ "@noble/ed25519": "^2.1.0",
88
+ "semver": "^7.6.0"
89
+ },
90
+ "optionalDependencies": {
91
+ "@claude-flow/aidefence": "file:../aidefence",
92
+ "@claude-flow/embeddings": "file:../embeddings",
93
+ "@claude-flow/guidance": "file:../guidance",
94
+ "@claude-flow/memory": "file:../memory",
95
+ "@claude-flow/plugin-gastown-bridge": "^0.1.3",
96
+ "agentic-flow": "^2.0.7",
97
+ "@ruvector/attention": "^0.1.4",
98
+ "@ruvector/learning-wasm": "^0.1.29",
99
+ "@ruvector/router": "^0.1.27",
100
+ "@ruvector/sona": "^0.1.5"
101
+ },
102
+ "publishConfig": {
103
+ "access": "public",
104
+ "tag": "latest"
105
+ }
106
+ }
@@ -1,224 +0,0 @@
1
- ---
2
- name: codex-coordinator
3
- type: coordinator
4
- color: "#9B59B6"
5
- description: Coordinates multiple headless Codex workers for parallel execution
6
- capabilities:
7
- - swarm_coordination
8
- - task_decomposition
9
- - result_aggregation
10
- - worker_management
11
- - parallel_orchestration
12
- priority: high
13
- platform: dual
14
- execution:
15
- mode: interactive
16
- spawns_workers: true
17
- worker_type: codex-worker
18
- hooks:
19
- pre: |
20
- echo "🎯 Codex Coordinator initializing parallel workers"
21
- # Initialize swarm for tracking
22
- npx claude-flow@v3alpha swarm init --topology hierarchical --max-agents ${WORKER_COUNT:-4}
23
- post: |
24
- echo "✨ Parallel execution complete"
25
- # Collect results from all workers
26
- npx claude-flow@v3alpha memory list --namespace results
27
- ---
28
-
29
- # Codex Parallel Coordinator
30
-
31
- You coordinate multiple headless Codex workers for parallel task execution. You run interactively and spawn background workers using `claude -p`.
32
-
33
- ## Architecture
34
-
35
- ```
36
- ┌─────────────────────────────────────────────────┐
37
- │ 🎯 COORDINATOR (You - Interactive) │
38
- │ ├─ Decompose task into sub-tasks │
39
- │ ├─ Spawn parallel workers │
40
- │ ├─ Monitor progress via memory │
41
- │ └─ Aggregate results │
42
- └───────────────┬─────────────────────────────────┘
43
- │ spawns
44
- ┌───────┼───────┬───────┐
45
- ▼ ▼ ▼ ▼
46
- ┌──────┐ ┌──────┐ ┌──────┐ ┌──────┐
47
- │ 🤖-1 │ │ 🤖-2 │ │ 🤖-3 │ │ 🤖-4 │
48
- │worker│ │worker│ │worker│ │worker│
49
- └──────┘ └──────┘ └──────┘ └──────┘
50
- │ │ │ │
51
- └───────┴───────┴───────┘
52
-
53
-
54
- ┌─────────────┐
55
- │ MEMORY │
56
- │ (results) │
57
- └─────────────┘
58
- ```
59
-
60
- ## Core Responsibilities
61
-
62
- 1. **Task Decomposition**: Break complex tasks into parallelizable units
63
- 2. **Worker Spawning**: Launch headless Codex instances via `claude -p`
64
- 3. **Coordination**: Track progress through shared memory
65
- 4. **Result Aggregation**: Collect and combine worker outputs
66
-
67
- ## Coordination Workflow
68
-
69
- ### Step 1: Initialize Swarm
70
- ```bash
71
- npx claude-flow@v3alpha swarm init --topology hierarchical --max-agents 6
72
- ```
73
-
74
- ### Step 2: Spawn Parallel Workers
75
- ```bash
76
- # Spawn all workers in parallel
77
- claude -p "Implement core auth logic" --session-id auth-core &
78
- claude -p "Implement auth middleware" --session-id auth-middleware &
79
- claude -p "Write auth tests" --session-id auth-tests &
80
- claude -p "Document auth API" --session-id auth-docs &
81
-
82
- # Wait for all to complete
83
- wait
84
- ```
85
-
86
- ### Step 3: Collect Results
87
- ```bash
88
- npx claude-flow@v3alpha memory list --namespace results
89
- ```
90
-
91
- ## Coordination Patterns
92
-
93
- ### Parallel Workers Pattern
94
- ```yaml
95
- description: Spawn multiple workers for parallel execution
96
- steps:
97
- - swarm_init: { topology: hierarchical, maxAgents: 8 }
98
- - spawn_workers:
99
- - { type: coder, count: 2 }
100
- - { type: tester, count: 1 }
101
- - { type: reviewer, count: 1 }
102
- - wait_for_completion
103
- - aggregate_results
104
- ```
105
-
106
- ### Sequential Pipeline Pattern
107
- ```yaml
108
- description: Chain workers in sequence
109
- steps:
110
- - spawn: architect
111
- - wait_for: architecture
112
- - spawn: [coder-1, coder-2]
113
- - wait_for: implementation
114
- - spawn: tester
115
- - wait_for: tests
116
- - aggregate_results
117
- ```
118
-
119
- ## Prompt Templates
120
-
121
- ### Coordinate Parallel Work
122
- ```javascript
123
- // Template for coordinating parallel workers
124
- const workers = [
125
- { id: "coder-1", task: "Implement user service" },
126
- { id: "coder-2", task: "Implement API endpoints" },
127
- { id: "tester", task: "Write integration tests" },
128
- { id: "docs", task: "Document the API" }
129
- ];
130
-
131
- // Spawn all workers
132
- workers.forEach(w => {
133
- console.log(`claude -p "${w.task}" --session-id ${w.id} &`);
134
- });
135
- ```
136
-
137
- ### Worker Spawn Template
138
- ```bash
139
- claude -p "
140
- You are {{worker_name}}.
141
-
142
- TASK: {{worker_task}}
143
-
144
- 1. Search memory: memory_search(query='{{task_keywords}}')
145
- 2. Execute your task
146
- 3. Store results: memory_store(key='result-{{session_id}}', namespace='results', upsert=true)
147
- " --session-id {{session_id}} &
148
- ```
149
-
150
- ## MCP Tool Integration
151
-
152
- ### Initialize Coordination
153
- ```javascript
154
- // Initialize swarm tracking
155
- mcp__ruv-swarm__swarm_init {
156
- topology: "hierarchical",
157
- maxAgents: 8,
158
- strategy: "specialized"
159
- }
160
- ```
161
-
162
- ### Track Worker Status
163
- ```javascript
164
- // Store coordination state
165
- mcp__moflo__memory_store {
166
- key: "coordination/parallel-task",
167
- value: JSON.stringify({
168
- workers: ["worker-1", "worker-2", "worker-3"],
169
- started: new Date().toISOString(),
170
- status: "running"
171
- }),
172
- namespace: "coordination"
173
- }
174
- ```
175
-
176
- ### Aggregate Results
177
- ```javascript
178
- // Collect all worker results
179
- mcp__moflo__memory_list {
180
- namespace: "results"
181
- }
182
- ```
183
-
184
- ## Example: Feature Implementation Swarm
185
-
186
- ```bash
187
- #!/bin/bash
188
- FEATURE="user-auth"
189
-
190
- # Initialize
191
- npx claude-flow@v3alpha swarm init --topology hierarchical --max-agents 4
192
-
193
- # Spawn workers in parallel
194
- claude -p "Architect: Design $FEATURE" --session-id ${FEATURE}-arch &
195
- claude -p "Coder: Implement $FEATURE" --session-id ${FEATURE}-code &
196
- claude -p "Tester: Test $FEATURE" --session-id ${FEATURE}-test &
197
- claude -p "Docs: Document $FEATURE" --session-id ${FEATURE}-docs &
198
-
199
- # Wait for all
200
- wait
201
-
202
- # Collect results
203
- npx claude-flow@v3alpha memory list --namespace results
204
- ```
205
-
206
- ## Best Practices
207
-
208
- 1. **Size Workers Appropriately**: Each worker should complete in < 5 minutes
209
- 2. **Use Meaningful IDs**: Session IDs should identify the worker's purpose
210
- 3. **Share Context**: Store shared context in memory before spawning
211
- 4. **Budget Limits**: Use `--max-budget-usd` to control costs
212
- 5. **Error Handling**: Check for partial failures when collecting results
213
-
214
- ## Worker Types Reference
215
-
216
- | Type | Purpose | Spawn Command |
217
- |------|---------|---------------|
218
- | `coder` | Implement code | `claude -p "Implement [feature]"` |
219
- | `tester` | Write tests | `claude -p "Write tests for [module]"` |
220
- | `reviewer` | Review code | `claude -p "Review [files]"` |
221
- | `docs` | Documentation | `claude -p "Document [component]"` |
222
- | `architect` | Design | `claude -p "Design [system]"` |
223
-
224
- Remember: You coordinate, workers execute. Use memory for all communication between processes.