moflo 4.9.20 → 4.9.21
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/commands/{simplify.md → flo-simplify.md} +4 -4
- package/.claude/guidance/shipped/moflo-agent-rules.md +172 -0
- package/.claude/guidance/shipped/moflo-claude-swarm-cohesion.md +73 -265
- package/.claude/guidance/shipped/moflo-cli-reference.md +6 -6
- package/.claude/guidance/shipped/moflo-core-guidance.md +66 -184
- package/.claude/guidance/shipped/moflo-cross-platform.md +1 -1
- package/.claude/guidance/shipped/moflo-error-handling.md +3 -3
- package/.claude/guidance/shipped/moflo-guidance-rules.md +17 -7
- package/.claude/guidance/shipped/moflo-memory-strategy.md +76 -182
- package/.claude/guidance/shipped/moflo-memorydb-maintenance.md +6 -8
- package/.claude/guidance/shipped/moflo-settings-injection.md +7 -9
- package/.claude/guidance/shipped/moflo-source-hygiene.md +5 -5
- package/.claude/guidance/shipped/moflo-spell-connectors.md +3 -4
- package/.claude/guidance/shipped/moflo-spell-custom-steps.md +3 -4
- package/.claude/guidance/shipped/moflo-spell-engine.md +40 -162
- package/.claude/guidance/shipped/moflo-spell-runner.md +134 -0
- package/.claude/guidance/shipped/moflo-spell-sandboxing.md +10 -57
- package/.claude/guidance/shipped/moflo-spell-troubleshooting.md +149 -0
- package/.claude/guidance/shipped/moflo-subagents.md +43 -114
- package/.claude/guidance/shipped/moflo-task-icons.md +4 -4
- package/.claude/guidance/shipped/moflo-user-facing-language.md +3 -3
- package/.claude/guidance/shipped/moflo-verbose-command-filtering.md +3 -3
- package/.claude/guidance/shipped/moflo-yaml-reference.md +4 -5
- package/.claude/helpers/gate.cjs +124 -14
- package/.claude/helpers/prompt-hook.mjs +4 -38
- package/.claude/helpers/simplify-classify.cjs +32 -11
- package/.claude/helpers/subagent-bootstrap.json +1 -1
- package/.claude/helpers/subagent-start.cjs +1 -1
- package/.claude/skills/connector-builder/SKILL.md +42 -429
- package/.claude/skills/connector-builder/templates/connector.md +189 -0
- package/.claude/skills/connector-builder/templates/step-command.md +176 -0
- package/.claude/skills/eldar/SKILL.md +7 -7
- package/.claude/skills/fl/SKILL.md +3 -3
- package/.claude/skills/fl/execution-modes.md +3 -3
- package/.claude/skills/fl/phases.md +3 -3
- package/.claude/skills/{simplify → flo-simplify}/SKILL.md +11 -11
- package/.claude/skills/guidance/SKILL.md +17 -9
- package/.claude/skills/memory-patterns/SKILL.md +1 -1
- package/.claude/skills/publish/SKILL.md +121 -36
- package/.claude/skills/reset-epic/SKILL.md +2 -2
- package/.claude/skills/spell-builder/SKILL.md +39 -226
- package/.claude/skills/spell-builder/architecture.md +1 -1
- package/.claude/skills/spell-builder/permissions.md +107 -0
- package/.claude/skills/spell-builder/preflight.md +101 -0
- package/.claude/skills/spell-schedule/SKILL.md +2 -3
- package/bin/gate.cjs +124 -14
- package/bin/prompt-hook.mjs +4 -38
- package/bin/session-start-launcher.mjs +19 -1
- package/bin/setup-project.mjs +63 -69
- package/bin/simplify-classify.cjs +32 -11
- package/dist/src/cli/commands/doctor-checks-deep.js +4 -0
- package/dist/src/cli/init/claudemd-generator.js +30 -33
- package/dist/src/cli/init/executor.js +28 -16
- package/dist/src/cli/init/helpers-generator.js +101 -51
- package/dist/src/cli/init/moflo-init.js +41 -114
- package/dist/src/cli/init/settings-generator.js +32 -14
- package/dist/src/cli/services/hook-block-hash.js +7 -2
- package/dist/src/cli/services/hook-wiring.js +86 -3
- package/dist/src/cli/services/subagent-bootstrap.js +1 -1
- package/dist/src/cli/version.js +1 -1
- package/package.json +2 -2
- package/scripts/post-install-bootstrap.mjs +19 -0
- package/.claude/guidance/shipped/moflo-session-start.md +0 -154
- package/.claude/guidance/shipped/moflo-spell-engine-architecture.md +0 -145
- package/.claude/skills/browser/SKILL.md +0 -204
- package/.claude/skills/github-code-review/SKILL.md +0 -1140
- package/.claude/skills/github-multi-repo/SKILL.md +0 -866
- package/.claude/skills/github-project-management/SKILL.md +0 -1272
- package/.claude/skills/github-release-management/SKILL.md +0 -1074
- package/.claude/skills/github-workflow-automation/SKILL.md +0 -1060
- package/.claude/skills/hive-mind-advanced/SKILL.md +0 -712
- package/.claude/skills/hooks-automation/SKILL.md +0 -1193
- package/.claude/skills/pair-programming/SKILL.md +0 -1202
- package/.claude/skills/performance-analysis/SKILL.md +0 -563
- package/.claude/skills/skill-builder/SKILL.md +0 -910
- package/.claude/skills/sparc-methodology/SKILL.md +0 -904
- package/.claude/skills/stream-chain/SKILL.md +0 -563
- package/.claude/skills/swarm-advanced/SKILL.md +0 -811
- package/.claude/skills/swarm-orchestration/SKILL.md +0 -179
- package/.claude/skills/verification-quality/SKILL.md +0 -649
- package/.claude/skills/worker-benchmarks/skill.md +0 -135
- package/.claude/skills/worker-integration/skill.md +0 -154
|
@@ -1,35 +1,23 @@
|
|
|
1
1
|
# MoFlo–Claude Swarm Cohesion
|
|
2
2
|
|
|
3
|
-
**Purpose:** Integrate native Claude Code tasks with MoFlo swarm coordination
|
|
3
|
+
**Purpose:** Integrate native Claude Code tasks with MoFlo swarm coordination so that agent work is visible to the user, dependency-tracked, and routed through MoFlo's coordinator. Reference whenever you spawn an agent (with or without swarm).
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
## Architecture Overview
|
|
8
8
|
|
|
9
|
-
```
|
|
10
|
-
+-----------------------------------------------------------------+
|
|
11
|
-
| NATIVE TASKS (User-Visible Layer) |
|
|
12
|
-
| TaskCreate -> TaskList -> TaskUpdate -> TaskGet |
|
|
13
|
-
| Shows: what needs doing, status, dependencies, progress |
|
|
14
|
-
+-------------------------------+---------------------------------+
|
|
15
|
-
| coordinates
|
|
16
|
-
+-------------------------------v---------------------------------+
|
|
17
|
-
| MOFLO (Orchestration Layer) |
|
|
18
|
-
| Swarm/Hive-Mind spawns agents, routes tasks, coordinates |
|
|
19
|
-
| Memory stores patterns for cross-session learning |
|
|
20
|
-
+-----------------------------------------------------------------+
|
|
21
|
-
```
|
|
22
|
-
|
|
23
9
|
| Layer | System | Purpose |
|
|
24
10
|
|-------|--------|---------|
|
|
25
|
-
| **What** | Native Tasks | Track work items, dependencies, status
|
|
26
|
-
| **How**
|
|
11
|
+
| **What** (user-visible) | Native Tasks (`TaskCreate`/`TaskList`/`TaskUpdate`/`TaskGet`) | Track work items, dependencies, status |
|
|
12
|
+
| **How** (orchestration) | MoFlo (swarm/hive-mind, memory, consensus, routing) | Spawn agents, coordinate, persist learnings |
|
|
13
|
+
|
|
14
|
+
Tasks let the user *see* what's happening; MoFlo is what coordinates. The two layers are independent — you can use TaskCreate without a swarm and a swarm without TaskCreate, but both together is the productive pattern.
|
|
27
15
|
|
|
28
16
|
---
|
|
29
17
|
|
|
30
18
|
## Agent Role Icons
|
|
31
19
|
|
|
32
|
-
Use these icons in `subject` and `activeForm` when creating tasks so the user can visually identify which agent is doing what.
|
|
20
|
+
Use these icons in `subject` and `activeForm` when creating tasks so the user can visually identify which agent is doing what. Required for all `TaskCreate` calls tied to agent work.
|
|
33
21
|
|
|
34
22
|
| Icon | Agent Role | activeForm Example |
|
|
35
23
|
|------|------------|-------------------|
|
|
@@ -45,228 +33,100 @@ Use these icons in `subject` and `activeForm` when creating tasks so the user ca
|
|
|
45
33
|
| 🤝 | consensus (hive-mind) | 🤝 Evaluating tradeoffs |
|
|
46
34
|
| 🔬 | analyzer | 🔬 Analyzing code |
|
|
47
35
|
|
|
36
|
+
See `.claude/guidance/moflo-task-icons.md` for the full ICON + [Role] format and how it applies to the `Agent` tool's `description` field.
|
|
37
|
+
|
|
48
38
|
---
|
|
49
39
|
|
|
50
40
|
## Integration Protocol
|
|
51
41
|
|
|
52
|
-
### Step 0: Pre-Swarm Validation
|
|
42
|
+
### Step 0: Pre-Swarm Validation
|
|
53
43
|
|
|
54
|
-
|
|
44
|
+
Before initializing swarm or hive-mind, verify tasks exist for the current work:
|
|
55
45
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
| TaskList Result | Action |
|
|
61
|
-
|-----------------|--------|
|
|
46
|
+
| `TaskList` Result | Action |
|
|
47
|
+
|-------------------|--------|
|
|
62
48
|
| Empty | Create task list (Step 1) before proceeding |
|
|
63
49
|
| Has unrelated/stale tasks | Create new tasks for current work |
|
|
64
|
-
| Has relevant tasks
|
|
50
|
+
| Has relevant tasks | Proceed to swarm init (Step 3) |
|
|
65
51
|
|
|
66
|
-
This is a
|
|
67
|
-
|
|
68
|
-
---
|
|
52
|
+
This is a soft reminder, not a hard blocker — the goal is user visibility into swarm progress.
|
|
69
53
|
|
|
70
54
|
### Step 1: Create Task List BEFORE Spawning Agents
|
|
71
55
|
|
|
72
|
-
|
|
56
|
+
Create a coordinator task plus one subtask per agent role, with role icons. Send all `TaskCreate` calls in a single message for parallel creation.
|
|
73
57
|
|
|
74
58
|
```javascript
|
|
75
|
-
|
|
76
|
-
TaskCreate({
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
// 2. Create subtasks for each agent role (in same message for parallel creation)
|
|
83
|
-
// Use role icons so the user can visually track agent progress at a glance.
|
|
84
|
-
TaskCreate({
|
|
85
|
-
subject: "🔍 Research requirements and codebase patterns",
|
|
86
|
-
description: "Researcher agent: Analyze requirements, find relevant code, document patterns.",
|
|
87
|
-
activeForm: "🔍 Researching codebase"
|
|
88
|
-
})
|
|
89
|
-
TaskCreate({
|
|
90
|
-
subject: "🏗️ Design implementation approach",
|
|
91
|
-
description: "Architect agent: Design solution, document decisions.",
|
|
92
|
-
activeForm: "🏗️ Designing architecture"
|
|
93
|
-
})
|
|
94
|
-
TaskCreate({
|
|
95
|
-
subject: "💻 Implement the solution",
|
|
96
|
-
description: "Coder agent: Write code following patterns and standards.",
|
|
97
|
-
activeForm: "💻 Writing code"
|
|
98
|
-
})
|
|
99
|
-
TaskCreate({
|
|
100
|
-
subject: "🧪 Write unit tests",
|
|
101
|
-
description: "Tester agent: Create tests that verify the implementation.",
|
|
102
|
-
activeForm: "🧪 Writing tests"
|
|
103
|
-
})
|
|
104
|
-
TaskCreate({
|
|
105
|
-
subject: "👀 Review code quality and security",
|
|
106
|
-
description: "Reviewer agent: Check for issues, security, best practices.",
|
|
107
|
-
activeForm: "👀 Reviewing code"
|
|
108
|
-
})
|
|
59
|
+
TaskCreate({ subject: "Implement [feature]", activeForm: "Coordinating implementation" })
|
|
60
|
+
TaskCreate({ subject: "🔍 Research requirements", activeForm: "🔍 Researching codebase" })
|
|
61
|
+
TaskCreate({ subject: "🏗️ Design implementation", activeForm: "🏗️ Designing architecture" })
|
|
62
|
+
TaskCreate({ subject: "💻 Implement solution", activeForm: "💻 Writing code" })
|
|
63
|
+
TaskCreate({ subject: "🧪 Write tests", activeForm: "🧪 Writing tests" })
|
|
64
|
+
TaskCreate({ subject: "👀 Review code", activeForm: "👀 Reviewing code" })
|
|
109
65
|
```
|
|
110
66
|
|
|
111
67
|
### Step 2: Set Up Dependencies
|
|
112
68
|
|
|
113
|
-
After
|
|
69
|
+
After `TaskCreate`, establish execution order with `TaskUpdate(addBlockedBy: [...])`:
|
|
114
70
|
|
|
115
71
|
```javascript
|
|
116
|
-
// Get task IDs from TaskList
|
|
117
|
-
TaskList()
|
|
118
|
-
|
|
119
|
-
// Set dependencies (research blocks architecture, architecture blocks coding, etc.)
|
|
120
72
|
TaskUpdate({ taskId: "2", addBlockedBy: ["1"] }) // Architect blocked by Researcher
|
|
121
73
|
TaskUpdate({ taskId: "3", addBlockedBy: ["2"] }) // Coder blocked by Architect
|
|
122
74
|
TaskUpdate({ taskId: "4", addBlockedBy: ["3"] }) // Tester blocked by Coder
|
|
123
75
|
TaskUpdate({ taskId: "5", addBlockedBy: ["3"] }) // Reviewer blocked by Coder
|
|
124
|
-
TaskUpdate({ taskId: "0", addBlockedBy: ["4", "5"] }) // Coordinator blocked by Tester
|
|
76
|
+
TaskUpdate({ taskId: "0", addBlockedBy: ["4", "5"] }) // Coordinator blocked by Tester + Reviewer
|
|
125
77
|
```
|
|
126
78
|
|
|
127
|
-
### Step 3: Initialize
|
|
79
|
+
### Step 3: Initialize Coordination
|
|
128
80
|
|
|
129
|
-
**MCP (
|
|
130
|
-
- Swarm: `mcp__moflo__swarm_init`
|
|
131
|
-
- Hive-mind: `mcp__moflo__hive-mind_init`
|
|
81
|
+
**MCP (preferred):**
|
|
82
|
+
- Swarm: `mcp__moflo__swarm_init` — `topology: "hierarchical"`, `maxAgents: 8`, `strategy: "specialized"`
|
|
83
|
+
- Hive-mind: `mcp__moflo__hive-mind_init` — `topology: "hierarchical-mesh"`, `consensus: "byzantine"`
|
|
132
84
|
|
|
133
|
-
**CLI
|
|
85
|
+
**CLI fallback:**
|
|
134
86
|
```bash
|
|
135
87
|
npx flo swarm init --topology hierarchical --max-agents 8 --strategy specialized
|
|
136
88
|
npx flo hive-mind init --topology hierarchical-mesh --consensus byzantine
|
|
137
89
|
```
|
|
138
90
|
|
|
139
|
-
### Step 4: Spawn Agents
|
|
91
|
+
### Step 4: Spawn Agents With Task References
|
|
140
92
|
|
|
141
|
-
Include task IDs in agent prompts
|
|
142
|
-
TaskCreate was already called in Step 1 — tasks are visible before agents spawn.
|
|
143
|
-
The `SubagentStart` hook automatically injects the subagent protocol directive — no need to include it in prompts.
|
|
93
|
+
Include task IDs in agent prompts. The `SubagentStart` hook automatically injects the subagent protocol directive — don't repeat it.
|
|
144
94
|
|
|
145
95
|
```javascript
|
|
146
|
-
|
|
96
|
+
TaskUpdate({ taskId: "1", status: "in_progress" })
|
|
147
97
|
Task({
|
|
148
98
|
prompt: `YOUR TASK (ID: 1): Research requirements and codebase patterns
|
|
149
99
|
- Analyze feature requirements
|
|
150
100
|
- Search codebase for relevant patterns
|
|
151
101
|
- Document findings in memory
|
|
152
102
|
|
|
153
|
-
WHEN STARTING: The coordinator has marked your task in_progress.
|
|
154
103
|
WHEN COMPLETE: Report findings. Coordinator will mark task completed.`,
|
|
155
104
|
subagent_type: "researcher",
|
|
156
|
-
description: "🔍 Research phase",
|
|
105
|
+
description: "🔍 [Researcher] Research phase",
|
|
157
106
|
run_in_background: true
|
|
158
107
|
})
|
|
159
108
|
```
|
|
160
109
|
|
|
161
110
|
### Step 5: Update Tasks as Agents Progress
|
|
162
111
|
|
|
163
|
-
The coordinator (Claude Code) updates task status based on agent activity:
|
|
164
|
-
|
|
165
112
|
```javascript
|
|
166
|
-
// When spawning an agent, mark its task in_progress
|
|
167
|
-
TaskUpdate({ taskId: "1", status: "in_progress" })
|
|
168
|
-
|
|
169
|
-
// When agent returns results, mark completed
|
|
170
113
|
TaskUpdate({ taskId: "1", status: "completed" })
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
TaskList() // Shows task 2 is now unblocked
|
|
114
|
+
TaskList() // Shows what's now unblocked
|
|
115
|
+
TaskUpdate({ taskId: "2", status: "in_progress" }) // Next agent starts
|
|
174
116
|
```
|
|
175
117
|
|
|
176
118
|
---
|
|
177
119
|
|
|
178
|
-
## Task Templates by Work Type
|
|
179
|
-
|
|
180
|
-
### Bug Fix (4-5 tasks)
|
|
181
|
-
|
|
182
|
-
| Task | Agent | Dependencies |
|
|
183
|
-
|------|-------|--------------|
|
|
184
|
-
| 🔍 Investigate bug and root cause | researcher | - |
|
|
185
|
-
| 💻 Implement fix | coder | researcher |
|
|
186
|
-
| 🧪 Write regression tests | tester | coder |
|
|
187
|
-
| 👀 Review fix | reviewer | coder |
|
|
188
|
-
|
|
189
|
-
### Feature Implementation (5-6 tasks)
|
|
190
|
-
|
|
191
|
-
| Task | Agent | Dependencies |
|
|
192
|
-
|------|-------|--------------|
|
|
193
|
-
| 🔍 Research requirements | researcher | - |
|
|
194
|
-
| 🏗️ Design implementation | system-architect | researcher |
|
|
195
|
-
| 💻 Implement feature | coder | architect |
|
|
196
|
-
| 🧪 Write unit tests | tester | coder |
|
|
197
|
-
| 👀 Review code | reviewer | coder |
|
|
198
|
-
| 🧪 Integration testing | tester | reviewer |
|
|
199
|
-
|
|
200
|
-
### Architectural Decision (Hive-Mind) (3-4 tasks)
|
|
201
|
-
|
|
202
|
-
| Task | Agent | Dependencies |
|
|
203
|
-
|------|-------|--------------|
|
|
204
|
-
| 🔍 Analyze options | researcher | - |
|
|
205
|
-
| 🤝 Evaluate tradeoffs | multiple (consensus) | researcher |
|
|
206
|
-
| 📚 Document decision | api-docs | consensus |
|
|
207
|
-
| 📋 Create implementation plan | planner | decision |
|
|
208
|
-
|
|
209
|
-
---
|
|
210
|
-
|
|
211
120
|
## Coordinator Responsibilities
|
|
212
121
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
1
|
|
216
|
-
2
|
|
217
|
-
3
|
|
218
|
-
4
|
|
219
|
-
5
|
|
220
|
-
6
|
|
221
|
-
|
|
222
|
-
---
|
|
223
|
-
|
|
224
|
-
## Example: Full Integration Flow
|
|
225
|
-
|
|
226
|
-
```javascript
|
|
227
|
-
// USER: Work on feature X with swarm
|
|
228
|
-
|
|
229
|
-
// STEP 1: Create task structure (role icons for visual tracking)
|
|
230
|
-
TaskCreate({ subject: "Implement feature X", description: "...", activeForm: "Coordinating" })
|
|
231
|
-
TaskCreate({ subject: "🔍 Research patterns", description: "...", activeForm: "🔍 Researching" })
|
|
232
|
-
TaskCreate({ subject: "💻 Implement solution", description: "...", activeForm: "💻 Implementing" })
|
|
233
|
-
TaskCreate({ subject: "🧪 Write unit tests", description: "...", activeForm: "🧪 Writing tests" })
|
|
234
|
-
TaskCreate({ subject: "👀 Review changes", description: "...", activeForm: "👀 Reviewing" })
|
|
235
|
-
|
|
236
|
-
// STEP 2: Set dependencies
|
|
237
|
-
TaskUpdate({ taskId: "2", addBlockedBy: ["1"] })
|
|
238
|
-
TaskUpdate({ taskId: "3", addBlockedBy: ["2"] })
|
|
239
|
-
TaskUpdate({ taskId: "4", addBlockedBy: ["2"] })
|
|
240
|
-
TaskUpdate({ taskId: "0", addBlockedBy: ["3", "4"] })
|
|
241
|
-
|
|
242
|
-
// STEP 3: Initialize swarm (MCP preferred, CLI fallback)
|
|
243
|
-
// MCP: mcp__moflo__swarm_init (topology: "hierarchical", maxAgents: 8, strategy: "specialized")
|
|
244
|
-
Bash("npx flo swarm init --topology hierarchical --max-agents 8 --strategy specialized")
|
|
245
|
-
|
|
246
|
-
// STEP 4: Spawn agents (mark tasks in_progress as spawned)
|
|
247
|
-
TaskUpdate({ taskId: "1", status: "in_progress" })
|
|
248
|
-
Task({ prompt: "...", subagent_type: "researcher", run_in_background: true })
|
|
249
|
-
|
|
250
|
-
// ... agents work ...
|
|
251
|
-
|
|
252
|
-
// STEP 5: As agents return, update tasks
|
|
253
|
-
TaskUpdate({ taskId: "1", status: "completed" })
|
|
254
|
-
TaskUpdate({ taskId: "2", status: "in_progress" })
|
|
255
|
-
// ... continue workflow
|
|
256
|
-
```
|
|
257
|
-
|
|
258
|
-
---
|
|
259
|
-
|
|
260
|
-
## Benefits
|
|
261
|
-
|
|
262
|
-
| Benefit | Description |
|
|
263
|
-
|---------|-------------|
|
|
264
|
-
| **Visibility** | User sees clear task breakdown and progress |
|
|
265
|
-
| **Dependencies** | Blocked tasks show what's waiting |
|
|
266
|
-
| **Traceability** | Each task maps to an agent's work |
|
|
267
|
-
| **Persistence** | Task state survives conversation turns |
|
|
268
|
-
| **Coordination** | Moflo handles agent orchestration |
|
|
269
|
-
| **Learning** | Memory stores patterns for future tasks |
|
|
122
|
+
| # | Responsibility |
|
|
123
|
+
|---|----------------|
|
|
124
|
+
| 1 | Create tasks before spawning agents (visible work breakdown) |
|
|
125
|
+
| 2 | Mark `in_progress` when spawning |
|
|
126
|
+
| 3 | Mark `completed` when results return |
|
|
127
|
+
| 4 | Use `TaskList` to monitor what's unblocked |
|
|
128
|
+
| 5 | Synthesize all agent outputs before proceeding |
|
|
129
|
+
| 6 | Store learnings in memory after completion |
|
|
270
130
|
|
|
271
131
|
---
|
|
272
132
|
|
|
@@ -281,7 +141,7 @@ Before spawning any agent via `Task`, run through this checklist:
|
|
|
281
141
|
| 1 | Is this a swarm / hive-mind? | **TaskCreate required** — full integration protocol (Steps 1-5 above) |
|
|
282
142
|
| 2 | Are you spawning 2+ background agents? | **TaskCreate required** — one per agent, with role icons |
|
|
283
143
|
| 3 | Is this a single background agent (`run_in_background: true`)? | **TaskCreate required** — user needs visibility while it runs |
|
|
284
|
-
| 4 | Will the agent touch 3+ files or take multiple steps? | **TaskCreate required** — even
|
|
144
|
+
| 4 | Will the agent touch 3+ files or take multiple steps? | **TaskCreate required** — even foreground, the user benefits from status tracking |
|
|
285
145
|
| 5 | Is this a single foreground agent for a focused task? | **TaskCreate optional** — user is already waiting inline for the result |
|
|
286
146
|
| 6 | Is this a quick research/exploration agent? | **Skip TaskCreate** — result returns fast, no tracking needed |
|
|
287
147
|
|
|
@@ -295,7 +155,6 @@ Before spawning any agent via `Task`, run through this checklist:
|
|
|
295
155
|
### Non-Swarm Example (2 background agents, no swarm init)
|
|
296
156
|
|
|
297
157
|
```javascript
|
|
298
|
-
// Create visible tasks FIRST
|
|
299
158
|
TaskCreate({
|
|
300
159
|
subject: "🔍 Investigate failing tests",
|
|
301
160
|
description: "Research agent: find root cause of test failures",
|
|
@@ -307,17 +166,16 @@ TaskCreate({
|
|
|
307
166
|
activeForm: "💻 Fixing auth endpoint"
|
|
308
167
|
})
|
|
309
168
|
|
|
310
|
-
// Then spawn agents
|
|
311
169
|
Task({
|
|
312
170
|
prompt: "Investigate why booking-public-routes tests are failing...",
|
|
313
171
|
subagent_type: "researcher",
|
|
314
|
-
description: "🔍 Investigate test failures",
|
|
172
|
+
description: "🔍 [Researcher] Investigate test failures",
|
|
315
173
|
run_in_background: true
|
|
316
174
|
})
|
|
317
175
|
Task({
|
|
318
176
|
prompt: "Fix the authentication endpoint based on research findings...",
|
|
319
177
|
subagent_type: "coder",
|
|
320
|
-
description: "💻 Fix auth endpoint",
|
|
178
|
+
description: "💻 [Coder] Fix auth endpoint",
|
|
321
179
|
run_in_background: true
|
|
322
180
|
})
|
|
323
181
|
```
|
|
@@ -334,7 +192,7 @@ TaskCreate({
|
|
|
334
192
|
Task({
|
|
335
193
|
prompt: "Write comprehensive tests for booking-public-routes...",
|
|
336
194
|
subagent_type: "tester",
|
|
337
|
-
description: "🧪 Write booking tests",
|
|
195
|
+
description: "🧪 [Tester] Write booking tests",
|
|
338
196
|
run_in_background: true
|
|
339
197
|
})
|
|
340
198
|
```
|
|
@@ -342,11 +200,10 @@ Task({
|
|
|
342
200
|
### Foreground Agent (TaskCreate optional — skip for simple tasks)
|
|
343
201
|
|
|
344
202
|
```javascript
|
|
345
|
-
// Simple lookup — no TaskCreate needed
|
|
346
203
|
Task({
|
|
347
204
|
prompt: "Find all files that import the AuthService",
|
|
348
205
|
subagent_type: "Explore",
|
|
349
|
-
description: "🔍 Find AuthService imports"
|
|
206
|
+
description: "🔍 [Explorer] Find AuthService imports"
|
|
350
207
|
})
|
|
351
208
|
```
|
|
352
209
|
|
|
@@ -354,95 +211,46 @@ Task({
|
|
|
354
211
|
|
|
355
212
|
## Anti-Drift Configuration
|
|
356
213
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
**MCP (Preferred):** `mcp__moflo__swarm_init`
|
|
360
|
-
- Small teams: `topology: "hierarchical", maxAgents: 8, strategy: "specialized"`
|
|
361
|
-
- Large teams: `topology: "hierarchical-mesh", maxAgents: 15, strategy: "specialized"`
|
|
362
|
-
|
|
363
|
-
**CLI Fallback:**
|
|
364
|
-
```bash
|
|
365
|
-
npx flo swarm init --topology hierarchical --max-agents 8 --strategy specialized
|
|
366
|
-
npx flo swarm init --topology hierarchical-mesh --max-agents 15 --strategy specialized
|
|
367
|
-
```
|
|
368
|
-
|
|
369
|
-
**Valid Topologies:**
|
|
370
|
-
- `hierarchical` - Queen controls workers directly (anti-drift for small teams)
|
|
371
|
-
- `hierarchical-mesh` - Queen + peer communication (recommended for 10+ agents)
|
|
372
|
-
- `mesh` - Fully connected peer network
|
|
373
|
-
- `ring` - Circular communication pattern
|
|
374
|
-
- `star` - Central coordinator with spokes
|
|
375
|
-
- `hybrid` - Dynamic topology switching
|
|
214
|
+
Use these `swarm_init` settings to prevent agent drift:
|
|
376
215
|
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
-
|
|
381
|
-
- **consensus**: raft (leader maintains state)
|
|
216
|
+
| Team Size | Topology | maxAgents | Strategy |
|
|
217
|
+
|-----------|----------|-----------|----------|
|
|
218
|
+
| Small | `hierarchical` (queen → workers) | 6–8 | `specialized` |
|
|
219
|
+
| Large (10+) | `hierarchical-mesh` (queen + peer comms) | 15 | `specialized` |
|
|
382
220
|
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
## Subagent Context Rules
|
|
386
|
-
|
|
387
|
-
**Subagents automatically receive guidance via the `SubagentStart` hook.** When any subagent spawns, the hook injects a directive telling it to read `.claude/guidance/shipped/moflo-subagents.md` before doing any work. This is centralized — no per-agent configuration needed.
|
|
388
|
-
|
|
389
|
-
**What subagents receive automatically:**
|
|
390
|
-
- `SubagentStart` hook directive to read subagent protocol guidance
|
|
391
|
-
- CLAUDE.md context (inherited from project)
|
|
392
|
-
- MCP tool access (`mcp__moflo__*`) when configured
|
|
393
|
-
- Project `.claude/guidance/*.md` files
|
|
394
|
-
|
|
395
|
-
**Memory-first enforcement for subagents:**
|
|
396
|
-
- Agent spawning is never blocked — the `SubagentStart` hook is advisory
|
|
397
|
-
- When a subagent tries to use Glob, Grep, or Read, the scan/read gates enforce memory-first at the work layer
|
|
398
|
-
- This prevents cascading failures from nested agent spawns
|
|
399
|
-
|
|
400
|
-
**Best practices for subagent prompts:**
|
|
401
|
-
- Include relevant context (file paths, error messages, specific requirements)
|
|
402
|
-
- Provide specific paths if known, don't let agents guess with broad globs
|
|
403
|
-
- Don't repeat the subagent protocol — the `SubagentStart` hook handles it
|
|
404
|
-
|
|
405
|
-
**MCP Tools Available to Subagents:**
|
|
406
|
-
- `mcp__moflo__memory_search` - Semantic search
|
|
407
|
-
- `mcp__moflo__memory_store` - Pattern storage
|
|
408
|
-
- `mcp__moflo__hooks_route` - Task routing
|
|
221
|
+
Other valid topologies: `mesh` (fully connected peers), `ring`, `star`, `hybrid` (dynamic switching). For most work, prefer `hierarchical` — the coordinator catches divergence early. See `.claude/guidance/moflo-cli-reference.md` for the full topology catalog.
|
|
409
222
|
|
|
410
223
|
---
|
|
411
224
|
|
|
412
225
|
## Critical Execution Rules
|
|
413
226
|
|
|
414
|
-
### CLI + Task Tool in
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
2. **IMMEDIATELY** call Task tool to spawn agents
|
|
418
|
-
3. Both CLI and Task calls must be in the SAME response
|
|
227
|
+
### CLI + Task Tool in the Same Message
|
|
228
|
+
|
|
229
|
+
When spawning a swarm:
|
|
419
230
|
|
|
420
|
-
|
|
231
|
+
1. Call MCP/CLI to initialize coordination
|
|
232
|
+
2. **Immediately** in the same response, call the `Task` tool to spawn agents
|
|
233
|
+
3. Both calls go in **one** assistant message
|
|
421
234
|
|
|
422
|
-
|
|
235
|
+
CLI/MCP coordinates; the `Task` tool runs the agents that do the actual work.
|
|
423
236
|
|
|
424
|
-
|
|
425
|
-
1. **TELL USER** - "I've spawned X agents working in parallel on: [list tasks]"
|
|
426
|
-
2. **STOP** - Do not continue with more tool calls
|
|
427
|
-
3. **WAIT** - Let the background agents complete their work
|
|
428
|
-
4. **RESPOND** - When agents return results, review and synthesize
|
|
237
|
+
### Spawn-and-Wait Pattern
|
|
429
238
|
|
|
430
|
-
|
|
431
|
-
- Continuously check swarm status
|
|
432
|
-
- Poll TaskOutput repeatedly
|
|
433
|
-
- Add more tool calls after spawning
|
|
434
|
-
- Ask "should I check on the agents?"
|
|
239
|
+
After spawning background agents:
|
|
435
240
|
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
241
|
+
| Do | Don't |
|
|
242
|
+
|----|-------|
|
|
243
|
+
| Tell the user "I've spawned X agents working in parallel on: [list]" | Continuously poll swarm status |
|
|
244
|
+
| Stop further tool calls and let agents run | Repeatedly call `TaskOutput` |
|
|
245
|
+
| Wait for agent results to arrive (you'll be notified) | Add more tool calls after spawning |
|
|
246
|
+
| Synthesize results when they return | Ask "should I check on the agents?" |
|
|
441
247
|
|
|
442
248
|
---
|
|
443
249
|
|
|
444
250
|
## See Also
|
|
445
251
|
|
|
446
|
-
- `.claude/guidance/moflo-
|
|
447
|
-
- `.claude/guidance/moflo-
|
|
448
|
-
- `.claude/guidance/moflo-
|
|
252
|
+
- `.claude/guidance/moflo-task-icons.md` — Full ICON + [Role] convention for `TaskCreate` and the `Agent` tool's `description` field
|
|
253
|
+
- `.claude/guidance/moflo-subagents.md` — Subagent memory-first protocol (auto-injected via the `SubagentStart` hook)
|
|
254
|
+
- `.claude/guidance/moflo-memory-strategy.md` — Memory architecture, namespaces, search patterns
|
|
255
|
+
- `.claude/guidance/moflo-core-guidance.md` — CLI/MCP reference and Auto-Learning protocol
|
|
256
|
+
- `.claude/guidance/moflo-cli-reference.md` — Topology catalog, consensus types, hive-mind details
|
|
@@ -193,9 +193,9 @@ npx flo daemon start
|
|
|
193
193
|
|
|
194
194
|
## See Also
|
|
195
195
|
|
|
196
|
-
- `.claude/guidance/
|
|
197
|
-
- `.claude/guidance/
|
|
198
|
-
- `.claude/guidance/
|
|
199
|
-
- `.claude/guidance/
|
|
200
|
-
- `.claude/guidance/
|
|
201
|
-
- `.claude/guidance/
|
|
196
|
+
- `.claude/guidance/moflo-core-guidance.md` — Hub: getting started, MCP setup, troubleshooting, comparison table
|
|
197
|
+
- `.claude/guidance/moflo-yaml-reference.md` — `moflo.yaml` schema and runtime env-var overrides for the surfaces listed here
|
|
198
|
+
- `.claude/guidance/moflo-claude-swarm-cohesion.md` — How TaskCreate + swarm coordinators cooperate (uses the agent codes above)
|
|
199
|
+
- `.claude/guidance/moflo-subagents.md` — Subagent memory-first protocol and store-back rules
|
|
200
|
+
- `.claude/guidance/moflo-memory-strategy.md` — Memory namespaces, RAG linking, and search query patterns
|
|
201
|
+
- `.claude/guidance/moflo-memorydb-maintenance.md` — How the namespaces above are populated and refreshed
|