moflo 4.12.4-rc.2 → 4.12.4-rc.4

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 (33) hide show
  1. package/.claude/agents/core/coder.md +17 -24
  2. package/.claude/agents/core/planner.md +51 -29
  3. package/.claude/agents/core/researcher.md +17 -24
  4. package/.claude/agents/core/reviewer.md +19 -26
  5. package/.claude/agents/core/tester.md +17 -22
  6. package/.claude/guidance/shipped/moflo-claude-swarm-cohesion.md +2 -0
  7. package/.claude/guidance/shipped/moflo-memory-strategy.md +1 -0
  8. package/.claude/guidance/shipped/moflo-sdd.md +1 -1
  9. package/.claude/helpers/gate.cjs +437 -18
  10. package/.claude/helpers/statusline.cjs +59 -5
  11. package/.claude/skills/fl/execution-modes.md +9 -0
  12. package/.claude/skills/fl/sdd.md +1 -1
  13. package/.claude/skills/flo-simplify/SKILL.md +3 -1
  14. package/.claude/skills/verify/SKILL.md +7 -3
  15. package/README.md +0 -1
  16. package/bin/gate.cjs +437 -18
  17. package/bin/session-start-launcher.mjs +75 -25
  18. package/dist/src/cli/commands/doctor-checks-deep.js +3 -0
  19. package/dist/src/cli/commands/doctor-checks-swarm.js +13 -2
  20. package/dist/src/cli/commands/doctor-fixes.js +86 -0
  21. package/dist/src/cli/commands/start.js +4 -7
  22. package/dist/src/cli/commands/status.js +3 -8
  23. package/dist/src/cli/init/helpers-generator.js +92 -7
  24. package/dist/src/cli/init/settings-generator.js +17 -4
  25. package/dist/src/cli/memory/bridge-embedder.js +28 -0
  26. package/dist/src/cli/services/cherry-pick-learnings.js +10 -1
  27. package/dist/src/cli/services/ephemeral-namespace-purge.js +97 -34
  28. package/dist/src/cli/services/hook-block-hash.js +8 -2
  29. package/dist/src/cli/services/hook-wiring.js +11 -2
  30. package/dist/src/cli/shared/utils/project-initialized.js +52 -0
  31. package/dist/src/cli/swarm/unified-coordinator.js +28 -0
  32. package/dist/src/cli/version.js +1 -1
  33. package/package.json +2 -2
@@ -195,36 +195,29 @@ src/
195
195
  ## MCP Tool Integration
196
196
 
197
197
  ### Memory Coordination
198
- ```javascript
199
- // Report implementation status
200
- mcp__moflo__memory_store {
201
- key: "swarm/coder/status",
202
- namespace: "coordination",
203
- value: JSON.stringify({
204
- agent: "coder",
205
- status: "implementing",
206
- feature: "user authentication",
207
- files: ["auth.service.ts", "auth.controller.ts"],
208
- timestamp: Date.now()
209
- })
210
- }
211
198
 
199
+ Store decisions that outlive this run, in the namespaces named in your operating
200
+ context above. Prose in `value` — it is what gets embedded, so a JSON blob
201
+ retrieves badly; structure goes in `metadata`, stored verbatim.
202
+
203
+ ```javascript
212
204
  // Share code decisions
213
205
  mcp__moflo__memory_store {
214
- key: "swarm/shared/implementation",
215
- namespace: "coordination",
216
- value: JSON.stringify({
217
- type: "code",
206
+ namespace: "patterns",
207
+ key: "auth-service-shape",
208
+ value: "Auth is a singleton service behind a factory so the jwt signer can be swapped in tests; endpoints are /auth/login and /auth/logout on the express router.",
209
+ metadata: {
218
210
  patterns: ["singleton", "factory"],
219
211
  dependencies: ["express", "jwt"],
220
- api_endpoints: ["/auth/login", "/auth/logout"]
221
- })
212
+ apiEndpoints: ["/auth/login", "/auth/logout"]
213
+ }
222
214
  }
223
215
 
224
- // Check dependencies
225
- mcp__moflo__memory_retrieve {
226
- key: "swarm/shared/dependencies",
227
- namespace: "coordination"
216
+ // Look up what an earlier agent established. Semantic search first — reach for
217
+ // memory_retrieve only when you already know the exact key.
218
+ mcp__moflo__memory_search {
219
+ query: "auth service dependencies",
220
+ namespace: "patterns"
228
221
  }
229
222
  ```
230
223
 
@@ -232,7 +225,7 @@ mcp__moflo__memory_retrieve {
232
225
  ```javascript
233
226
  // Track implementation metrics
234
227
  mcp__moflo__performance_benchmark {
235
- type: "code",
228
+ suite: "memory",
236
229
  iterations: 10
237
230
  }
238
231
 
@@ -114,45 +114,67 @@ plan:
114
114
  ## MCP Tool Integration
115
115
 
116
116
  ### Task Orchestration
117
- ```javascript
118
- // Orchestrate complex tasks
119
117
 
120
- // Share task breakdown
121
- mcp__moflo__memory_store {
122
- key: "swarm/planner/task-breakdown",
123
- namespace: "coordination",
124
- value: JSON.stringify({
125
- main_task: "authentication",
126
- subtasks: [
127
- {id: "1", task: "Research auth libraries", assignee: "researcher"},
128
- {id: "2", task: "Design auth flow", assignee: "architect"},
129
- {id: "3", task: "Implement auth service", assignee: "coder"},
130
- {id: "4", task: "Write auth tests", assignee: "tester"}
131
- ],
132
- dependencies: {"3": ["1", "2"], "4": ["3"]}
133
- })
118
+ Submit the breakdown to the coordinator. A task ID only exists once the
119
+ coordinator has issued it — storing a breakdown in memory dispatches nothing,
120
+ and polling an ID you invented yourself always comes back empty.
121
+
122
+ ```javascript
123
+ // Submit the whole breakdown in one call. Tasks are load-balanced across
124
+ // available agents; `type` must be one of research | analysis | coding |
125
+ // testing | review | documentation | coordination | consensus | custom.
126
+ mcp__moflo__task_orchestrate {
127
+ tasks: [
128
+ { type: "research", description: "Research auth libraries", priority: "high" },
129
+ { type: "analysis", description: "Design auth flow", priority: "high" },
130
+ { type: "coding", description: "Implement auth service", priority: "normal" },
131
+ { type: "testing", description: "Write auth tests", priority: "normal" }
132
+ ]
134
133
  }
134
+ // → { success: true, submitted: 4, assigned: 3, queued: 1,
135
+ // tasks: [ { taskId: "task_...", status: "assigned", ... }, ... ] }
135
136
 
136
- // Monitor task progress
137
+ // Poll an ID the coordinator returned — never one you named yourself.
137
138
  mcp__moflo__task_status {
138
- taskId: "auth-implementation"
139
+ taskId: "<taskId from the response above>"
139
140
  }
141
+
142
+ // Or survey everything in flight instead of polling one at a time.
143
+ mcp__moflo__task_list { status: "running,queued" }
140
144
  ```
141
145
 
146
+ Use `mcp__moflo__task_create` for a single task; it takes the same fields and
147
+ returns the same projection, including the `taskId`.
148
+
149
+ **Ordering lives on the native Task layer, not here.** `task_create` and
150
+ `task_orchestrate` accept no dependency field — the coordinator load-balances
151
+ what you submit. Express prerequisites with `TaskUpdate({ addBlockedBy: [...] })`
152
+ on the native tasks, per *What → Native Tasks; How → MoFlo orchestration* in
153
+ `.claude/guidance/moflo-claude-swarm-cohesion.md`.
154
+
142
155
  ### Memory Coordination
156
+
157
+ Live task state belongs to the coordinator — read it with `task_status` /
158
+ `task_list` rather than mirroring it into memory. Store what stays useful after
159
+ this run: a decision and its rationale that a future agent would otherwise have
160
+ to rediscover.
161
+
143
162
  ```javascript
144
- // Report planning status
163
+ // Prose in `value` — it is what gets embedded, so a JSON blob retrieves badly.
164
+ // Structure goes in `metadata`, which is stored verbatim and not embedded.
145
165
  mcp__moflo__memory_store {
146
- key: "swarm/planner/status",
147
- namespace: "coordination",
148
- value: JSON.stringify({
149
- agent: "planner",
150
- status: "planning",
151
- tasks_planned: 12,
152
- estimated_hours: 24,
153
- timestamp: Date.now()
154
- })
166
+ namespace: "patterns",
167
+ key: "auth-rollout-sequencing",
168
+ value: "Auth work is sequenced research → design → implement → test because the library choice determines the flow design; parallelising design against research produced rework twice.",
169
+ metadata: {
170
+ plannedTasks: 12,
171
+ blockedOn: ["library selection"]
172
+ }
155
173
  }
156
174
  ```
157
175
 
158
- Remember: A good plan executed now is better than a perfect plan executed never. Focus on creating actionable, practical plans that drive progress. Always coordinate through memory.
176
+ Use the namespaces named in this agent's operating context above — `patterns`
177
+ for reusable approaches, `learnings` for decisions and gotchas. The `swarm-*`
178
+ namespaces are the coordinator's own persistence; do not write to them.
179
+
180
+ Remember: A good plan executed now is better than a perfect plan executed never. Focus on creating actionable, practical plans that drive progress. Dispatch through the coordinator; use memory for what outlives the run.
@@ -119,36 +119,29 @@ read specific-file.ts
119
119
  ## MCP Tool Integration
120
120
 
121
121
  ### Memory Coordination
122
- ```javascript
123
- // Report research status
124
- mcp__moflo__memory_store {
125
- key: "swarm/researcher/status",
126
- namespace: "coordination",
127
- value: JSON.stringify({
128
- agent: "researcher",
129
- status: "analyzing",
130
- focus: "authentication system",
131
- files_reviewed: 25,
132
- timestamp: Date.now()
133
- })
134
- }
135
122
 
123
+ Store findings that stay useful after this run, in the namespaces named in your
124
+ operating context above. Prose in `value` — it is what gets embedded, so a JSON
125
+ blob retrieves badly; structure goes in `metadata`, stored verbatim.
126
+
127
+ ```javascript
136
128
  // Share research findings
137
129
  mcp__moflo__memory_store {
138
- key: "swarm/shared/research-findings",
139
- namespace: "coordination",
140
- value: JSON.stringify({
141
- patterns_found: ["MVC", "Repository", "Factory"],
130
+ namespace: "patterns",
131
+ key: "auth-stack-survey",
132
+ value: "Auth here is passport + jwt behind an MVC/repository split; the passport version is two majors behind and there is no rate limiting on the login route.",
133
+ metadata: {
134
+ patternsFound: ["MVC", "Repository", "Factory"],
142
135
  dependencies: ["express", "passport", "jwt"],
143
- potential_issues: ["outdated auth library", "missing rate limiting"],
144
136
  recommendations: ["upgrade passport", "add rate limiter"]
145
- })
137
+ }
146
138
  }
147
139
 
148
- // Check prior research
140
+ // Check prior research. memory_search is semantic — it takes a `query`, not a
141
+ // key glob. Pivot the query on the bare symbol or topic.
149
142
  mcp__moflo__memory_search {
150
- pattern: "swarm/shared/research-*",
151
- namespace: "coordination",
143
+ query: "authentication stack",
144
+ namespace: "patterns",
152
145
  limit: 10
153
146
  }
154
147
  ```
@@ -171,14 +164,14 @@ mcp__moflo__agent_status {
171
164
  - Share findings with planner for task decomposition via memory
172
165
  - Provide context to coder for implementation through shared memory
173
166
  - Supply tester with edge cases and scenarios in memory
174
- - Document all findings in coordination memory
167
+ - Document findings in the `patterns` namespace so later agents retrieve them
175
168
 
176
169
  ## Best Practices
177
170
 
178
171
  1. **Be Thorough**: Check multiple sources and validate findings
179
172
  2. **Stay Organized**: Structure research logically and maintain clear notes
180
173
  3. **Think Critically**: Question assumptions and verify claims
181
- 4. **Document Everything**: Store all findings in coordination memory
174
+ 4. **Document Everything**: Store findings in `patterns` (or `learnings` for decisions and gotchas)
182
175
  5. **Iterate**: Refine research based on new discoveries
183
176
  6. **Share Early**: Update memory frequently for real-time coordination
184
177
 
@@ -269,36 +269,29 @@ npm run complexity-check
269
269
  ## MCP Tool Integration
270
270
 
271
271
  ### Memory Coordination
272
- ```javascript
273
- // Report review status
274
- mcp__moflo__memory_store {
275
- key: "swarm/reviewer/status",
276
- namespace: "coordination",
277
- value: JSON.stringify({
278
- agent: "reviewer",
279
- status: "reviewing",
280
- files_reviewed: 12,
281
- issues_found: {critical: 2, major: 5, minor: 8},
282
- timestamp: Date.now()
283
- })
284
- }
285
272
 
273
+ Store findings that outlive this run, in the namespaces named in your operating
274
+ context above. Prose in `value` — it is what gets embedded, so a JSON blob
275
+ retrieves badly; structure goes in `metadata`, stored verbatim.
276
+
277
+ ```javascript
286
278
  // Share review findings
287
279
  mcp__moflo__memory_store {
288
- key: "swarm/shared/review-findings",
289
- namespace: "coordination",
290
- value: JSON.stringify({
291
- security_issues: ["SQL injection in auth.js:45"],
292
- performance_issues: ["N+1 queries in user.service.ts"],
293
- code_quality: {score: 7.8, coverage: "78%"},
294
- action_items: ["Fix SQL injection", "Optimize queries", "Add tests"]
295
- })
280
+ namespace: "patterns",
281
+ key: "auth-review-findings",
282
+ value: "Login builds its SQL by string concatenation (auth.js:45) and the user service loads roles per-row inside a loop, so both the injection risk and the N+1 come from the same request path.",
283
+ metadata: {
284
+ securityIssues: ["SQL injection in auth.js:45"],
285
+ performanceIssues: ["N+1 queries in user.service.ts"],
286
+ actionItems: ["Fix SQL injection", "Batch the role lookup", "Add tests"]
287
+ }
296
288
  }
297
289
 
298
- // Check implementation details
299
- mcp__moflo__memory_retrieve {
300
- key: "swarm/coder/status",
301
- namespace: "coordination"
290
+ // Look up what the implementer established. Semantic search first — reach for
291
+ // memory_retrieve only when you already know the exact key.
292
+ mcp__moflo__memory_search {
293
+ query: "auth service shape",
294
+ namespace: "patterns"
302
295
  }
303
296
  ```
304
297
 
@@ -311,7 +304,7 @@ mcp__moflo__analyze_diff {
311
304
 
312
305
  // Scan the diff for prompt-injection and unsafe content
313
306
  mcp__moflo__aidefence_scan {
314
- content: "<the diff or file under review>"
307
+ input: "<the diff or file under review>"
315
308
  }
316
309
  ```
317
310
 
@@ -251,35 +251,30 @@ describe('Security', () => {
251
251
  ## MCP Tool Integration
252
252
 
253
253
  ### Memory Coordination
254
- ```javascript
255
- // Report test status
256
- mcp__moflo__memory_store {
257
- key: "swarm/tester/status",
258
- namespace: "coordination",
259
- value: JSON.stringify({
260
- agent: "tester",
261
- status: "running tests",
262
- test_suites: ["unit", "integration", "e2e"],
263
- timestamp: Date.now()
264
- })
265
- }
266
254
 
267
- // Share test results
255
+ Store what stays useful after this run, in the namespaces named in your
256
+ operating context above. Prose in `value` — it is what gets embedded, so a JSON
257
+ blob retrieves badly; structure goes in `metadata`, stored verbatim.
258
+
259
+ ```javascript
260
+ // Share what the run revealed, not the raw tally
268
261
  mcp__moflo__memory_store {
269
- key: "swarm/shared/test-results",
270
- namespace: "coordination",
271
- value: JSON.stringify({
262
+ namespace: "patterns",
263
+ key: "auth-suite-flakiness",
264
+ value: "The two failing auth tests both assert on token expiry against a real clock, so they fail whenever the suite runs slowly under load — freeze the clock rather than widening the tolerance.",
265
+ metadata: {
272
266
  passed: 145,
273
267
  failed: 2,
274
268
  coverage: "87%",
275
269
  failures: ["auth.test.ts:45", "api.test.ts:123"]
276
- })
270
+ }
277
271
  }
278
272
 
279
- // Check implementation status
280
- mcp__moflo__memory_retrieve {
281
- key: "swarm/coder/status",
282
- namespace: "coordination"
273
+ // Look up what the implementer established. Semantic search first — reach for
274
+ // memory_retrieve only when you already know the exact key.
275
+ mcp__moflo__memory_search {
276
+ query: "auth service shape",
277
+ namespace: "patterns"
283
278
  }
284
279
  ```
285
280
 
@@ -287,7 +282,7 @@ mcp__moflo__memory_retrieve {
287
282
  ```javascript
288
283
  // Run performance benchmarks
289
284
  mcp__moflo__performance_benchmark {
290
- type: "test",
285
+ suite: "all",
291
286
  iterations: 100
292
287
  }
293
288
 
@@ -94,6 +94,8 @@ npx flo hive-mind init --topology hierarchical-mesh --consensus byzantine
94
94
 
95
95
  Include task IDs in agent prompts. The `SubagentStart` hook automatically injects the subagent protocol directive — don't repeat it.
96
96
 
97
+ Asking for a swarm is asking for agents: an ambient "don't call the Agent tool unless the user requested it" is satisfied by that request. Registering agents via MCP without dispatching them leaves a swarm that passes every gate and does no parallel work.
98
+
97
99
  ```javascript
98
100
  TaskUpdate({ taskId: "1", status: "in_progress" })
99
101
  Task({
@@ -35,6 +35,7 @@ Source files (`.claude/guidance/*.md`, `docs/**/*.md`, code, tests) flow through
35
35
  | `patterns` | Per-file code patterns (services, routes, exports) | `index-patterns.mjs` |
36
36
  | `tests` | Test structure and patterns | `index-tests.mjs` |
37
37
  | `learnings` | User-stored patterns from work sessions | `mcp__moflo__memory_store` |
38
+ | `verify` | Per-run `/verify` verdict records, keyed `verify:<slug>` | `/verify` skill Step 5 |
38
39
 
39
40
  Namespaces are independent indexes. Search defaults to `all`; pass `namespace: "guidance"` to target one.
40
41
 
@@ -64,7 +64,7 @@ The two review checkpoints are the point: **a spec must be reviewed before its p
64
64
  When enforced, `gh pr create` is blocked until the change has been verified end-to-end since the last code edit.
65
65
 
66
66
  - **On by default (#1294).** Enforced for every `/flo` run; disable per-project with `gates.verify_before_done: false` or per-run with `--no-verify`. On upgrade, consumers with no `verify_before_done` key start enforcing; an explicit value is preserved. Docs-only diffs are exempt, so a pure-docs PR is never blocked.
67
- - **Satisfy it by running the `/verify` skill** — `/flo` delegates to it. It exercises the change against the plan's (or ticket's) acceptance criteria and records its own outcome to memory (`namespace: learnings, key: verify:<slug>`). It reuses the Tests-phase run rather than repeating it (no double verify).
67
+ - **Satisfy it by running the `/verify` skill** — `/flo` delegates to it. It exercises the change against the plan's (or ticket's) acceptance criteria and records its own outcome to memory (`namespace: verify, key: verify:<slug>`). It reuses the Tests-phase run rather than repeating it (no double verify).
68
68
  - **A source edit invalidates a prior verification** — re-run `/verify` after editing. `/ward` and `/quicken` are targeted audits, not the completion gate.
69
69
 
70
70
  ---