moflo 4.5.0 → 4.6.1
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/package.json +1 -1
- package/src/@claude-flow/cli/dist/src/commands/appliance.js +12 -12
- package/src/@claude-flow/cli/dist/src/commands/benchmark.js +2 -2
- package/src/@claude-flow/cli/dist/src/commands/claims.js +1 -1
- package/src/@claude-flow/cli/dist/src/commands/config.js +1 -1
- package/src/@claude-flow/cli/dist/src/commands/daemon.js +25 -3
- package/src/@claude-flow/cli/dist/src/commands/deployment.js +1 -1
- package/src/@claude-flow/cli/dist/src/commands/doctor.js +23 -6
- package/src/@claude-flow/cli/dist/src/commands/embeddings.js +1 -1
- package/src/@claude-flow/cli/dist/src/commands/hooks.js +1 -1
- package/src/@claude-flow/cli/dist/src/commands/init.js +14 -12
- package/src/@claude-flow/cli/dist/src/commands/neural.js +1 -1
- package/src/@claude-flow/cli/dist/src/commands/orc.d.ts +2 -2
- package/src/@claude-flow/cli/dist/src/commands/orc.js +12 -12
- package/src/@claude-flow/cli/dist/src/commands/performance.js +1 -1
- package/src/@claude-flow/cli/dist/src/commands/plugins.js +1 -1
- package/src/@claude-flow/cli/dist/src/commands/providers.js +1 -1
- package/src/@claude-flow/cli/dist/src/commands/security.js +1 -1
- package/src/@claude-flow/cli/dist/src/commands/start.js +11 -11
- package/src/@claude-flow/cli/dist/src/commands/status.js +3 -3
- package/src/@claude-flow/cli/dist/src/commands/transfer-store.js +1 -1
- package/src/@claude-flow/cli/dist/src/config/moflo-config.d.ts +30 -0
- package/src/@claude-flow/cli/dist/src/config/moflo-config.js +103 -7
- package/src/@claude-flow/cli/dist/src/index.d.ts +1 -1
- package/src/@claude-flow/cli/dist/src/index.js +3 -3
- package/src/@claude-flow/cli/dist/src/init/claudemd-generator.js +1 -1
- package/src/@claude-flow/cli/dist/src/init/executor.js +485 -472
- package/src/@claude-flow/cli/dist/src/init/helpers-generator.js +640 -640
- package/src/@claude-flow/cli/dist/src/init/moflo-init.js +530 -66
- package/src/@claude-flow/cli/dist/src/init/settings-generator.js +7 -12
- package/src/@claude-flow/cli/dist/src/init/statusline-generator.d.ts +1 -1
- package/src/@claude-flow/cli/dist/src/init/statusline-generator.js +784 -784
- package/src/@claude-flow/cli/dist/src/mcp-tools/agentdb-tools.js +12 -12
- package/src/@claude-flow/cli/dist/src/mcp-tools/hooks-tools.js +122 -66
- package/src/@claude-flow/cli/dist/src/memory/intelligence.js +5 -1
- package/src/@claude-flow/cli/dist/src/memory/memory-initializer.d.ts +1 -1
- package/src/@claude-flow/cli/dist/src/memory/memory-initializer.js +371 -371
- package/src/@claude-flow/cli/dist/src/parser.d.ts +10 -0
- package/src/@claude-flow/cli/dist/src/parser.js +49 -3
- package/src/@claude-flow/cli/dist/src/plugins/store/discovery.js +1 -1
- package/src/@claude-flow/cli/dist/src/runtime/headless.js +30 -30
- package/src/@claude-flow/cli/dist/src/services/claim-service.js +1 -1
- package/src/@claude-flow/cli/dist/src/services/ruvector-training.js +11 -5
- package/src/@claude-flow/cli/dist/src/services/workflow-gate.d.ts +13 -3
- package/src/@claude-flow/cli/dist/src/services/workflow-gate.js +73 -5
- package/src/@claude-flow/cli/dist/src/types.d.ts +1 -1
- package/src/@claude-flow/cli/dist/src/types.js +1 -1
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* One-stop setup that makes MoFlo work out of the box:
|
|
5
5
|
* 1. Generate moflo.yaml (project config)
|
|
6
6
|
* 2. Set up .claude/settings.json hooks
|
|
7
|
-
* 3. Create .claude/skills/
|
|
7
|
+
* 3. Create .claude/skills/flo/ skill (with /fl alias)
|
|
8
8
|
* 4. Append MoFlo section to CLAUDE.md
|
|
9
9
|
* 5. Initialize memory DB
|
|
10
10
|
* 6. Auto-index guidance + code map
|
|
@@ -96,7 +96,7 @@ export async function initMoflo(options) {
|
|
|
96
96
|
steps.push(generateConfig(projectRoot, force, answers));
|
|
97
97
|
// Step 2: .claude/settings.json hooks
|
|
98
98
|
steps.push(generateHooks(projectRoot, force, answers));
|
|
99
|
-
// Step 3: .claude/skills/
|
|
99
|
+
// Step 3: .claude/skills/flo/ (with /fl alias)
|
|
100
100
|
steps.push(generateSkill(projectRoot, force));
|
|
101
101
|
// Step 4: CLAUDE.md MoFlo section
|
|
102
102
|
steps.push(generateClaudeMd(projectRoot, force));
|
|
@@ -168,17 +168,47 @@ memory:
|
|
|
168
168
|
embedding_model: Xenova/all-MiniLM-L6-v2
|
|
169
169
|
namespace: default
|
|
170
170
|
|
|
171
|
-
# Hook toggles
|
|
171
|
+
# Hook toggles (all on by default — disable to slim down)
|
|
172
172
|
hooks:
|
|
173
|
-
pre_edit: true
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
#
|
|
173
|
+
pre_edit: true # Track file edits for learning
|
|
174
|
+
post_edit: true # Record edit outcomes, train neural patterns
|
|
175
|
+
pre_task: true # Get agent routing before task spawn
|
|
176
|
+
post_task: true # Record task results for learning
|
|
177
|
+
gate: ${gatesEnabled} # Workflow gate enforcement (memory-first, task-create-first)
|
|
178
|
+
route: true # Intelligent task routing on each prompt
|
|
179
|
+
stop_hook: ${answers?.stopHook ?? true} # Session-end persistence and metric export
|
|
180
|
+
session_restore: true # Restore session state on start
|
|
181
|
+
notification: true # Hook into Claude Code notifications
|
|
182
|
+
|
|
183
|
+
# Status line display (shown at bottom of Claude Code)
|
|
184
|
+
# mode: "single-line" (concise, default) or "dashboard" (full multi-line)
|
|
185
|
+
status_line:
|
|
186
|
+
enabled: true
|
|
187
|
+
mode: single-line
|
|
188
|
+
branding: "MoFlo V4"
|
|
189
|
+
show_git: true
|
|
190
|
+
show_model: true
|
|
191
|
+
show_session: true
|
|
192
|
+
|
|
193
|
+
# Model preferences (haiku, sonnet, opus)
|
|
179
194
|
models:
|
|
180
|
-
default: opus
|
|
181
|
-
|
|
195
|
+
default: opus # Model for general tasks
|
|
196
|
+
research: sonnet # Model for research/exploration agents
|
|
197
|
+
review: opus # Model for code review agents
|
|
198
|
+
test: sonnet # Model for test-writing agents
|
|
199
|
+
|
|
200
|
+
# Intelligent model routing (auto-selects haiku/sonnet/opus per task)
|
|
201
|
+
# When enabled, overrides the static model preferences above
|
|
202
|
+
# by analyzing task complexity and routing to the cheapest capable model.
|
|
203
|
+
model_routing:
|
|
204
|
+
enabled: false # Set to true to enable dynamic routing
|
|
205
|
+
confidence_threshold: 0.85 # Min confidence before escalating to a more capable model
|
|
206
|
+
cost_optimization: true # Prefer cheaper models when confidence is high
|
|
207
|
+
circuit_breaker: true # Penalize models that fail repeatedly
|
|
208
|
+
# Per-agent overrides (set to "inherit" to use routing, or a specific model to pin)
|
|
209
|
+
# agent_overrides:
|
|
210
|
+
# security-architect: opus # Always use opus for security
|
|
211
|
+
# researcher: sonnet # Pin research to sonnet
|
|
182
212
|
`;
|
|
183
213
|
fs.writeFileSync(configPath, yaml, 'utf-8');
|
|
184
214
|
return { name: 'moflo.yaml', status: 'created', detail: `Detected: ${srcDirs.join(', ')} | ${detectedExts.join(', ')}` };
|
|
@@ -221,59 +251,133 @@ function generateHooks(root, force, answers) {
|
|
|
221
251
|
return { name: '.claude/settings.json', status: 'skipped', detail: 'MoFlo hooks already configured' };
|
|
222
252
|
}
|
|
223
253
|
}
|
|
224
|
-
// Build hooks config
|
|
254
|
+
// Build hooks config — all on by default (opinionated pit-of-success)
|
|
225
255
|
const hooks = {
|
|
226
256
|
"PreToolUse": [
|
|
227
257
|
{
|
|
228
|
-
"matcher": "
|
|
258
|
+
"matcher": "^(Write|Edit|MultiEdit)$",
|
|
229
259
|
"hooks": [{
|
|
230
260
|
"type": "command",
|
|
231
|
-
"command": "npx flo
|
|
261
|
+
"command": "npx flo hooks pre-edit",
|
|
262
|
+
"timeout": 5000
|
|
232
263
|
}]
|
|
233
264
|
},
|
|
234
265
|
{
|
|
235
|
-
"matcher": "
|
|
266
|
+
"matcher": "^(Glob|Grep)$",
|
|
236
267
|
"hooks": [{
|
|
237
268
|
"type": "command",
|
|
238
|
-
"command": "npx flo gate check-before-
|
|
269
|
+
"command": "npx flo gate check-before-scan",
|
|
270
|
+
"timeout": 3000
|
|
239
271
|
}]
|
|
240
272
|
},
|
|
241
273
|
{
|
|
242
|
-
"matcher": "
|
|
274
|
+
"matcher": "^Read$",
|
|
243
275
|
"hooks": [{
|
|
244
276
|
"type": "command",
|
|
245
|
-
"command": "npx flo gate check-before-
|
|
277
|
+
"command": "npx flo gate check-before-read",
|
|
278
|
+
"timeout": 3000
|
|
246
279
|
}]
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
"matcher": "^Task$",
|
|
283
|
+
"hooks": [
|
|
284
|
+
{
|
|
285
|
+
"type": "command",
|
|
286
|
+
"command": "npx flo gate check-before-agent",
|
|
287
|
+
"timeout": 3000
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
"type": "command",
|
|
291
|
+
"command": "npx flo hooks pre-task",
|
|
292
|
+
"timeout": 5000
|
|
293
|
+
}
|
|
294
|
+
]
|
|
247
295
|
}
|
|
248
296
|
],
|
|
249
297
|
"PostToolUse": [
|
|
250
298
|
{
|
|
251
|
-
"matcher": "
|
|
299
|
+
"matcher": "^(Write|Edit|MultiEdit)$",
|
|
300
|
+
"hooks": [{
|
|
301
|
+
"type": "command",
|
|
302
|
+
"command": "npx flo hooks post-edit",
|
|
303
|
+
"timeout": 5000
|
|
304
|
+
}]
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
"matcher": "^Task$",
|
|
252
308
|
"hooks": [{
|
|
253
309
|
"type": "command",
|
|
254
|
-
"command": "npx flo
|
|
310
|
+
"command": "npx flo hooks post-task",
|
|
311
|
+
"timeout": 5000
|
|
255
312
|
}]
|
|
256
313
|
},
|
|
257
314
|
{
|
|
258
|
-
"matcher": "
|
|
315
|
+
"matcher": "^TaskCreate$",
|
|
259
316
|
"hooks": [{
|
|
260
317
|
"type": "command",
|
|
261
|
-
"command": "npx flo gate
|
|
318
|
+
"command": "npx flo gate record-task-created",
|
|
319
|
+
"timeout": 2000
|
|
262
320
|
}]
|
|
263
321
|
},
|
|
264
322
|
{
|
|
265
|
-
"matcher": "
|
|
323
|
+
"matcher": "^Bash$",
|
|
266
324
|
"hooks": [{
|
|
267
325
|
"type": "command",
|
|
268
|
-
"command": "npx flo gate
|
|
326
|
+
"command": "npx flo gate check-bash-memory",
|
|
327
|
+
"timeout": 2000
|
|
328
|
+
}]
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
"matcher": "^mcp__claude-flow__memory_(search|retrieve)$",
|
|
332
|
+
"hooks": [{
|
|
333
|
+
"type": "command",
|
|
334
|
+
"command": "npx flo gate record-memory-searched",
|
|
335
|
+
"timeout": 2000
|
|
269
336
|
}]
|
|
270
337
|
}
|
|
271
338
|
],
|
|
272
339
|
"UserPromptSubmit": [
|
|
340
|
+
{
|
|
341
|
+
"hooks": [
|
|
342
|
+
{
|
|
343
|
+
"type": "command",
|
|
344
|
+
"command": "npx flo gate prompt-reminder",
|
|
345
|
+
"timeout": 2000
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
"type": "command",
|
|
349
|
+
"command": "npx flo hooks route",
|
|
350
|
+
"timeout": 5000
|
|
351
|
+
}
|
|
352
|
+
]
|
|
353
|
+
}
|
|
354
|
+
],
|
|
355
|
+
"SessionStart": [
|
|
356
|
+
{
|
|
357
|
+
"hooks": [
|
|
358
|
+
{
|
|
359
|
+
"type": "command",
|
|
360
|
+
"command": "node \"$CLAUDE_PROJECT_DIR/.claude/scripts/session-start-launcher.mjs\"",
|
|
361
|
+
"timeout": 3000
|
|
362
|
+
}
|
|
363
|
+
]
|
|
364
|
+
}
|
|
365
|
+
],
|
|
366
|
+
"Stop": [
|
|
273
367
|
{
|
|
274
368
|
"hooks": [{
|
|
275
369
|
"type": "command",
|
|
276
|
-
"command": "npx flo
|
|
370
|
+
"command": "npx flo hooks session-end",
|
|
371
|
+
"timeout": 5000
|
|
372
|
+
}]
|
|
373
|
+
}
|
|
374
|
+
],
|
|
375
|
+
"Notification": [
|
|
376
|
+
{
|
|
377
|
+
"hooks": [{
|
|
378
|
+
"type": "command",
|
|
379
|
+
"command": "npx flo hooks notification",
|
|
380
|
+
"timeout": 3000
|
|
277
381
|
}]
|
|
278
382
|
}
|
|
279
383
|
]
|
|
@@ -281,87 +385,447 @@ function generateHooks(root, force, answers) {
|
|
|
281
385
|
// Merge: preserve existing non-MoFlo hooks, add MoFlo hooks
|
|
282
386
|
existing.hooks = hooks;
|
|
283
387
|
fs.writeFileSync(settingsPath, JSON.stringify(existing, null, 2), 'utf-8');
|
|
284
|
-
return { name: '.claude/settings.json', status: existing.hooks ? 'updated' : 'created', detail: '
|
|
388
|
+
return { name: '.claude/settings.json', status: existing.hooks ? 'updated' : 'created', detail: '14 hooks configured (gates, lifecycle, routing, session)' };
|
|
285
389
|
}
|
|
286
390
|
// ============================================================================
|
|
287
|
-
// Step 3: .claude/skills/
|
|
391
|
+
// Step 3: .claude/skills/flo/ skill (with /fl alias)
|
|
288
392
|
// ============================================================================
|
|
289
393
|
function generateSkill(root, force) {
|
|
290
|
-
const skillDir = path.join(root, '.claude', 'skills', '
|
|
394
|
+
const skillDir = path.join(root, '.claude', 'skills', 'flo');
|
|
291
395
|
const skillFile = path.join(skillDir, 'SKILL.md');
|
|
396
|
+
const aliasDir = path.join(root, '.claude', 'skills', 'fl');
|
|
397
|
+
const aliasFile = path.join(aliasDir, 'SKILL.md');
|
|
292
398
|
if (fs.existsSync(skillFile) && !force) {
|
|
293
|
-
return { name: '.claude/skills/
|
|
399
|
+
return { name: '.claude/skills/flo/', status: 'skipped', detail: 'Already exists' };
|
|
294
400
|
}
|
|
295
401
|
if (!fs.existsSync(skillDir)) {
|
|
296
402
|
fs.mkdirSync(skillDir, { recursive: true });
|
|
297
403
|
}
|
|
298
404
|
const skillContent = `---
|
|
299
|
-
name:
|
|
405
|
+
name: flo
|
|
300
406
|
description: MoFlo ticket workflow - analyze and execute GitHub issues
|
|
301
407
|
arguments: "[options] <issue-number>"
|
|
302
408
|
---
|
|
303
409
|
|
|
304
|
-
# /
|
|
410
|
+
# /flo - MoFlo Ticket Workflow
|
|
305
411
|
|
|
306
|
-
|
|
412
|
+
Research, enhance, and execute GitHub issues automatically.
|
|
307
413
|
|
|
308
414
|
**Arguments:** $ARGUMENTS
|
|
309
415
|
|
|
310
416
|
## Usage
|
|
311
417
|
|
|
312
418
|
\`\`\`
|
|
313
|
-
/
|
|
314
|
-
/
|
|
315
|
-
/
|
|
316
|
-
/
|
|
317
|
-
/
|
|
419
|
+
/flo <issue-number> # Full workflow with SWARM (default)
|
|
420
|
+
/flo -e <issue-number> # Enhance only: research and update ticket, then STOP
|
|
421
|
+
/flo --enhance <issue-number> # Same as -e
|
|
422
|
+
/flo -r <issue-number> # Research only: analyze issue, output findings
|
|
423
|
+
/flo --research <issue-number> # Same as -r
|
|
424
|
+
\`\`\`
|
|
425
|
+
|
|
426
|
+
Also available as \`/fl\` (shorthand alias).
|
|
427
|
+
|
|
428
|
+
### Execution Mode (how work is done)
|
|
429
|
+
|
|
430
|
+
\`\`\`
|
|
431
|
+
/flo 123 # SWARM mode (default) - multi-agent coordination
|
|
432
|
+
/flo -sw 123 # SWARM mode (explicit)
|
|
433
|
+
/flo --swarm 123 # Same as -sw
|
|
434
|
+
/flo -hv 123 # HIVE-MIND mode - consensus-based coordination
|
|
435
|
+
/flo --hive 123 # Same as -hv
|
|
436
|
+
/flo -n 123 # NAKED mode - single Claude, no agents
|
|
437
|
+
/flo --naked 123 # Same as -n
|
|
438
|
+
\`\`\`
|
|
439
|
+
|
|
440
|
+
### Epic Handling
|
|
441
|
+
|
|
442
|
+
\`\`\`
|
|
443
|
+
/flo 42 # If #42 is an epic, processes all stories sequentially
|
|
444
|
+
\`\`\`
|
|
445
|
+
|
|
446
|
+
**Epic Detection:** Issues with \`epic\` label or containing \`## Stories\` / \`## Tasks\` sections are automatically detected as epics.
|
|
447
|
+
|
|
448
|
+
**Sequential Processing:** When an epic is selected:
|
|
449
|
+
1. List all child stories/tasks (from checklist or linked issues)
|
|
450
|
+
2. Process each story **one at a time** in order
|
|
451
|
+
3. Each story goes through the full workflow (research -> enhance -> implement -> test -> PR)
|
|
452
|
+
4. After each story's PR is created, move to the next story
|
|
453
|
+
5. Continue until all stories are complete
|
|
454
|
+
|
|
455
|
+
### Combined Examples
|
|
456
|
+
|
|
457
|
+
\`\`\`
|
|
458
|
+
/flo 123 # Swarm + full workflow (default) - includes ALL tests
|
|
459
|
+
/flo 42 # If #42 is epic, processes stories sequentially
|
|
460
|
+
/flo -e 123 # Swarm + enhance only (no implementation)
|
|
461
|
+
/flo -hv -e 123 # Hive-mind + enhance only
|
|
462
|
+
/flo -n -r 123 # Naked + research only
|
|
463
|
+
/flo --swarm --enhance 123 # Explicit swarm + enhance only
|
|
464
|
+
/flo -n 123 # Naked + full workflow (still runs all tests)
|
|
465
|
+
\`\`\`
|
|
466
|
+
|
|
467
|
+
## SWARM IS MANDATORY BY DEFAULT
|
|
468
|
+
|
|
469
|
+
Even if a task "looks simple", you MUST use swarm coordination unless
|
|
470
|
+
the user explicitly passes -n/--naked. "Simple" is a trap. Tasks have
|
|
471
|
+
hidden complexity. Swarm catches it.
|
|
472
|
+
|
|
473
|
+
THE ONLY WAY TO SKIP SWARM: User passes -n or --naked explicitly.
|
|
474
|
+
|
|
475
|
+
## COMPREHENSIVE TESTING REQUIREMENT
|
|
476
|
+
|
|
477
|
+
ALL tests MUST pass BEFORE PR creation - NO EXCEPTIONS.
|
|
478
|
+
- Unit Tests: MANDATORY for all new/modified code
|
|
479
|
+
- Integration Tests: MANDATORY for API endpoints and services
|
|
480
|
+
- E2E Tests: MANDATORY for user-facing features
|
|
481
|
+
PR CANNOT BE CREATED until all relevant tests pass.
|
|
482
|
+
|
|
483
|
+
## Workflow Overview
|
|
484
|
+
|
|
485
|
+
\`\`\`
|
|
486
|
+
Research -> Enhance -> Execute -> Testing -> Simplify -> PR+Done
|
|
487
|
+
|
|
488
|
+
Research: Fetch issue, search memory, read guidance, find files
|
|
489
|
+
Enhance: Update GitHub issue with tech analysis, affected files, impl plan
|
|
490
|
+
Execute: Assign self, create branch, implement changes
|
|
491
|
+
Testing: Unit + Integration + E2E tests (ALL MUST PASS - gate)
|
|
492
|
+
Simplify: Run /simplify on changed code (gate - must run before PR)
|
|
493
|
+
PR+Done: Create PR, update issue status, store learnings
|
|
494
|
+
\`\`\`
|
|
495
|
+
|
|
496
|
+
### Workflow Gates
|
|
497
|
+
|
|
498
|
+
| Gate | Requirement | Blocked Action |
|
|
499
|
+
|------|-------------|----------------|
|
|
500
|
+
| **Testing Gate** | Unit + Integration + E2E must pass | PR creation |
|
|
501
|
+
| **Simplification Gate** | /simplify must run on changed files | PR creation |
|
|
502
|
+
|
|
503
|
+
### Execution Mode (applies to all phases)
|
|
504
|
+
|
|
505
|
+
| Mode | Description |
|
|
506
|
+
|------|-------------|
|
|
507
|
+
| **SWARM** (default) | Multi-agent via Task tool: researcher, coder, tester, reviewer |
|
|
508
|
+
| **HIVE-MIND** (-hv) | Consensus-based coordination for architecture decisions |
|
|
509
|
+
| **NAKED** (-n) | Single Claude, no agent spawning. Only when user explicitly requests. |
|
|
510
|
+
|
|
511
|
+
## Phase 1: Research (-r or default first step)
|
|
512
|
+
|
|
513
|
+
### 1.1 Fetch Issue Details
|
|
514
|
+
\`\`\`bash
|
|
515
|
+
gh issue view <issue-number> --json number,title,body,labels,state,assignees,comments,milestone
|
|
516
|
+
\`\`\`
|
|
517
|
+
|
|
518
|
+
### 1.2 Check Enhancement Status
|
|
519
|
+
Look for \`## Implementation Plan\` marker in issue body.
|
|
520
|
+
- **If present**: Issue already enhanced, skip to execute or confirm
|
|
521
|
+
- **If absent**: Proceed with research and enhancement
|
|
522
|
+
|
|
523
|
+
### 1.3 Search Memory FIRST
|
|
524
|
+
ALWAYS search memory BEFORE reading guidance or docs files.
|
|
525
|
+
Memory has file paths, context, and patterns - often all you need.
|
|
526
|
+
Only read guidance files if memory search returns zero relevant results.
|
|
527
|
+
|
|
528
|
+
\`\`\`bash
|
|
529
|
+
npx flo memory search --query "<issue title keywords>" --namespace patterns
|
|
530
|
+
npx flo memory search --query "<domain keywords>" --namespace guidance
|
|
531
|
+
\`\`\`
|
|
532
|
+
|
|
533
|
+
Or via MCP: \`mcp__claude-flow__memory_search\`
|
|
534
|
+
|
|
535
|
+
### 1.4 Read Guidance Docs (ONLY if memory insufficient)
|
|
536
|
+
**Only if memory search returned < 3 relevant results**, read guidance files:
|
|
537
|
+
- Bug -> testing patterns, error handling
|
|
538
|
+
- Feature -> domain model, architecture
|
|
539
|
+
- UI -> frontend patterns, components
|
|
540
|
+
|
|
541
|
+
### 1.5 Research Codebase
|
|
542
|
+
Use Task tool with Explore agent to find:
|
|
543
|
+
- Affected files and their current state
|
|
544
|
+
- Related code and dependencies
|
|
545
|
+
- Existing patterns to follow
|
|
546
|
+
- Test coverage gaps
|
|
547
|
+
|
|
548
|
+
## Phase 2: Enhance (-e includes research + enhancement)
|
|
549
|
+
|
|
550
|
+
### 2.1 Build Enhancement
|
|
551
|
+
Compile research into structured enhancement:
|
|
552
|
+
|
|
553
|
+
**Technical Analysis** - Root cause (bugs) or approach (features), impact, risk factors
|
|
554
|
+
|
|
555
|
+
**Affected Files** - Files to modify (with line numbers), new files, deletions
|
|
556
|
+
|
|
557
|
+
**Implementation Plan** - Numbered steps with clear actions, dependencies, decision points
|
|
558
|
+
|
|
559
|
+
**Test Plan** - Unit tests to add/update, integration tests needed, manual testing checklist
|
|
560
|
+
|
|
561
|
+
**Estimates** - Complexity (Low/Medium/High), scope (# files, # new tests)
|
|
562
|
+
|
|
563
|
+
### 2.2 Update GitHub Issue
|
|
564
|
+
\`\`\`bash
|
|
565
|
+
gh issue edit <issue-number> --body "<original body + Technical Analysis + Affected Files + Implementation Plan + Test Plan + Estimates>"
|
|
566
|
+
\`\`\`
|
|
567
|
+
|
|
568
|
+
### 2.3 Add Enhancement Comment
|
|
569
|
+
\`\`\`bash
|
|
570
|
+
gh issue comment <issue-number> --body "Issue enhanced with implementation plan. Ready for execution."
|
|
571
|
+
\`\`\`
|
|
572
|
+
|
|
573
|
+
## Phase 3: Execute (default, runs automatically after enhance)
|
|
574
|
+
|
|
575
|
+
### 3.1 Assign Issue and Update Status
|
|
576
|
+
\`\`\`bash
|
|
577
|
+
gh issue edit <issue-number> --add-assignee @me
|
|
578
|
+
gh issue edit <issue-number> --add-label "in-progress"
|
|
579
|
+
\`\`\`
|
|
580
|
+
|
|
581
|
+
### 3.2 Create Branch
|
|
582
|
+
\`\`\`bash
|
|
583
|
+
git checkout main && git pull origin main
|
|
584
|
+
git checkout -b <type>/<issue-number>-<short-desc>
|
|
318
585
|
\`\`\`
|
|
586
|
+
Types: \`feature/\`, \`fix/\`, \`refactor/\`, \`docs/\`
|
|
587
|
+
|
|
588
|
+
### 3.3 Implement
|
|
589
|
+
Follow the implementation plan from the enhanced issue. No prompts - execute all steps.
|
|
590
|
+
|
|
591
|
+
## Phase 4: Testing (MANDATORY GATE)
|
|
592
|
+
|
|
593
|
+
This is NOT optional. ALL applicable test types must pass for the change type.
|
|
594
|
+
WORKFLOW STOPS HERE until tests pass. No shortcuts. No exceptions.
|
|
595
|
+
|
|
596
|
+
### 4.1 Write and Run Tests
|
|
597
|
+
Write unit, integration, and E2E tests as appropriate for the change type.
|
|
598
|
+
Use the project's existing test runner and patterns.
|
|
599
|
+
|
|
600
|
+
### 4.2 Test Auto-Fix Loop
|
|
601
|
+
If any tests fail, enter the auto-fix loop (max 3 retries OR 10 minutes):
|
|
602
|
+
1. Run all tests
|
|
603
|
+
2. If ALL pass -> proceed to simplification
|
|
604
|
+
3. If ANY fail: analyze failure, fix test or implementation code, retry
|
|
605
|
+
4. If retries exhausted -> STOP and report to user
|
|
606
|
+
|
|
607
|
+
## Phase 4.5: Code Simplification (MANDATORY)
|
|
608
|
+
|
|
609
|
+
The built-in /simplify command reviews ALL changed code for:
|
|
610
|
+
- Reuse opportunities and code quality
|
|
611
|
+
- Efficiency improvements
|
|
612
|
+
- Consistency with existing codebase patterns
|
|
613
|
+
- Preserves ALL functionality - no behavior changes
|
|
614
|
+
|
|
615
|
+
If /simplify makes changes -> re-run tests to confirm nothing broke.
|
|
616
|
+
If re-tests fail -> revert changes, proceed with original code.
|
|
617
|
+
|
|
618
|
+
## Phase 5: Commit and PR (only after tests pass)
|
|
619
|
+
|
|
620
|
+
### 5.1 Commit
|
|
621
|
+
\`\`\`bash
|
|
622
|
+
git add <specific files>
|
|
623
|
+
git commit -m "type(scope): description
|
|
624
|
+
|
|
625
|
+
Closes #<issue-number>
|
|
626
|
+
|
|
627
|
+
Co-Authored-By: Claude <noreply@anthropic.com>"
|
|
628
|
+
\`\`\`
|
|
629
|
+
|
|
630
|
+
### 5.2 Create PR
|
|
631
|
+
\`\`\`bash
|
|
632
|
+
git push -u origin <branch-name>
|
|
633
|
+
gh pr create --title "type(scope): description" --body "## Summary
|
|
634
|
+
<brief description>
|
|
635
|
+
|
|
636
|
+
## Changes
|
|
637
|
+
<bullet list>
|
|
638
|
+
|
|
639
|
+
## Testing
|
|
640
|
+
- [x] Unit tests pass
|
|
641
|
+
- [x] Integration tests pass
|
|
642
|
+
- [x] E2E tests pass
|
|
643
|
+
- [ ] Manual testing done
|
|
644
|
+
|
|
645
|
+
Closes #<issue-number>"
|
|
646
|
+
\`\`\`
|
|
647
|
+
|
|
648
|
+
### 5.3 Update Issue Status
|
|
649
|
+
\`\`\`bash
|
|
650
|
+
gh issue edit <issue-number> --remove-label "in-progress" --add-label "ready-for-review"
|
|
651
|
+
gh issue comment <issue-number> --body "PR created: <pr-url>"
|
|
652
|
+
\`\`\`
|
|
653
|
+
|
|
654
|
+
## Epic Handling
|
|
319
655
|
|
|
320
|
-
|
|
656
|
+
### Detecting Epics
|
|
321
657
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
658
|
+
An issue is an **epic** if:
|
|
659
|
+
1. It has the \`epic\` label, OR
|
|
660
|
+
2. Its body contains \`## Stories\` or \`## Tasks\` sections, OR
|
|
661
|
+
3. It has linked child issues (via \`- [ ] #123\` checklist format)
|
|
662
|
+
|
|
663
|
+
### Epic Processing Flow
|
|
664
|
+
|
|
665
|
+
1. DETECT EPIC - Check labels, parse body for ## Stories / ## Tasks, extract issue references
|
|
666
|
+
2. LIST ALL STORIES - Extract from checklist, order top-to-bottom as listed
|
|
667
|
+
3. SEQUENTIAL PROCESSING - For each story: run full /flo workflow, wait for PR, update checklist
|
|
668
|
+
4. COMPLETION - All stories have PRs, epic marked as ready-for-review
|
|
669
|
+
|
|
670
|
+
ONE STORY AT A TIME - NO PARALLEL STORY EXECUTION.
|
|
671
|
+
Each story must complete (PR created) before starting next.
|
|
672
|
+
|
|
673
|
+
### Epic Detection Code
|
|
674
|
+
|
|
675
|
+
\`\`\`javascript
|
|
676
|
+
function isEpic(issue) {
|
|
677
|
+
if (issue.labels?.some(l => l.name === 'epic')) return true;
|
|
678
|
+
if (issue.body?.includes('## Stories') || issue.body?.includes('## Tasks')) return true;
|
|
679
|
+
const linkedIssuePattern = /- \\[[ x]\\] #\\d+/;
|
|
680
|
+
if (linkedIssuePattern.test(issue.body)) return true;
|
|
681
|
+
return false;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
function extractStories(epicBody) {
|
|
685
|
+
const stories = [];
|
|
686
|
+
const pattern = /- \\[[ ]\\] #(\\d+)/g;
|
|
687
|
+
let match;
|
|
688
|
+
while ((match = pattern.exec(epicBody)) !== null) {
|
|
689
|
+
stories.push(parseInt(match[1]));
|
|
690
|
+
}
|
|
691
|
+
return stories;
|
|
692
|
+
}
|
|
693
|
+
\`\`\`
|
|
328
694
|
|
|
329
695
|
## Parse Arguments
|
|
330
696
|
|
|
331
697
|
\`\`\`javascript
|
|
332
698
|
const args = "$ARGUMENTS".trim().split(/\\s+/);
|
|
333
|
-
let workflowMode = "full";
|
|
334
|
-
let execMode = "swarm";
|
|
699
|
+
let workflowMode = "full"; // full, enhance, research
|
|
700
|
+
let execMode = "swarm"; // swarm (default), hive, naked
|
|
335
701
|
let issueNumber = null;
|
|
336
702
|
|
|
337
703
|
for (let i = 0; i < args.length; i++) {
|
|
338
704
|
const arg = args[i];
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
else if (
|
|
705
|
+
|
|
706
|
+
// Workflow mode (what to do)
|
|
707
|
+
if (arg === "-e" || arg === "--enhance") {
|
|
708
|
+
workflowMode = "enhance";
|
|
709
|
+
} else if (arg === "-r" || arg === "--research") {
|
|
710
|
+
workflowMode = "research";
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
// Execution mode (how to do it)
|
|
714
|
+
else if (arg === "-sw" || arg === "--swarm") {
|
|
715
|
+
execMode = "swarm";
|
|
716
|
+
} else if (arg === "-hv" || arg === "--hive") {
|
|
717
|
+
execMode = "hive";
|
|
718
|
+
} else if (arg === "-n" || arg === "--naked") {
|
|
719
|
+
execMode = "naked";
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
// Issue number
|
|
723
|
+
else if (/^\\d+$/.test(arg)) {
|
|
724
|
+
issueNumber = arg;
|
|
725
|
+
}
|
|
344
726
|
}
|
|
345
727
|
|
|
346
|
-
if (!issueNumber)
|
|
728
|
+
if (!issueNumber) {
|
|
729
|
+
throw new Error("Issue number required. Usage: /flo <issue-number>");
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
// Log execution mode to prevent silent skipping
|
|
733
|
+
console.log("Execution mode: " + execMode.toUpperCase());
|
|
734
|
+
if (execMode === "swarm") {
|
|
735
|
+
console.log("SWARM MODE: Will spawn agents via Task tool. Do NOT skip this.");
|
|
736
|
+
}
|
|
737
|
+
console.log("TESTING: Unit + Integration + E2E tests REQUIRED before PR.");
|
|
738
|
+
console.log("SIMPLIFY: /simplify command runs on changed code before PR.");
|
|
347
739
|
\`\`\`
|
|
348
740
|
|
|
349
|
-
## Execution
|
|
741
|
+
## Execution Flow
|
|
742
|
+
|
|
743
|
+
### Workflow Modes (what to do)
|
|
744
|
+
|
|
745
|
+
| Mode | Command | Steps | Stops After |
|
|
746
|
+
|------|---------|-------|-------------|
|
|
747
|
+
| **Full** (default) | \`/flo 123\` | Research -> Enhance -> Implement -> Test -> Simplify -> PR | PR created |
|
|
748
|
+
| **Epic** | \`/flo 42\` (epic) | For each story: Full workflow sequentially | All story PRs created |
|
|
749
|
+
| **Enhance** | \`/flo -e 123\` | Research -> Enhance | Issue updated |
|
|
750
|
+
| **Research** | \`/flo -r 123\` | Research | Findings output |
|
|
751
|
+
|
|
752
|
+
### Execution Modes (how to do it)
|
|
753
|
+
|
|
754
|
+
| Mode | Flag | Description | When to Use |
|
|
755
|
+
|------|------|-------------|-------------|
|
|
756
|
+
| **Swarm** (DEFAULT) | \`-sw\`, \`--swarm\` | Multi-agent via Task tool | Always, unless explicitly overridden |
|
|
757
|
+
| **Hive-Mind** | \`-hv\`, \`--hive\` | Consensus-based coordination | Architecture decisions, tradeoffs |
|
|
758
|
+
| **Naked** | \`-n\`, \`--naked\` | Single Claude, no agents | User explicitly wants simple mode |
|
|
350
759
|
|
|
351
|
-
|
|
352
|
-
1. Fetch issue via \`gh issue view\`
|
|
353
|
-
2. Search memory for relevant patterns
|
|
354
|
-
3. Research codebase with Explore agents
|
|
355
|
-
4. Enhance issue with implementation plan
|
|
356
|
-
5. Create branch, assign issue, implement
|
|
357
|
-
6. Run tests (unit + integration + E2E)
|
|
358
|
-
7. Run /simplify on changed code
|
|
359
|
-
8. Create PR, update issue, store learnings
|
|
760
|
+
## Execution Mode Details
|
|
360
761
|
|
|
361
|
-
|
|
762
|
+
### SWARM Mode (Default) - ALWAYS USE UNLESS TOLD OTHERWISE
|
|
763
|
+
|
|
764
|
+
You MUST use the Task tool to spawn agents. No exceptions.
|
|
765
|
+
|
|
766
|
+
**Swarm spawns these agents via Task tool:**
|
|
767
|
+
- \`researcher\` - Analyzes issue, searches memory, finds patterns
|
|
768
|
+
- \`coder\` - Implements changes following plan
|
|
769
|
+
- \`tester\` - Writes and runs tests
|
|
770
|
+
- \`/simplify\` - Built-in command that reviews changed code before PR
|
|
771
|
+
- \`reviewer\` - Reviews code before PR
|
|
772
|
+
|
|
773
|
+
**Swarm execution pattern:**
|
|
774
|
+
\`\`\`javascript
|
|
775
|
+
// 1. Create task list FIRST
|
|
776
|
+
TaskCreate({ subject: "Research issue #123", ... })
|
|
777
|
+
TaskCreate({ subject: "Implement changes", ... })
|
|
778
|
+
TaskCreate({ subject: "Test implementation", ... })
|
|
779
|
+
TaskCreate({ subject: "Run /simplify on changed files", ... })
|
|
780
|
+
TaskCreate({ subject: "Review and PR", ... })
|
|
781
|
+
|
|
782
|
+
// 2. Init swarm
|
|
783
|
+
Bash("npx flo swarm init --topology hierarchical --max-agents 8 --strategy specialized")
|
|
784
|
+
|
|
785
|
+
// 3. Spawn agents with Task tool (run_in_background: true)
|
|
786
|
+
Task({ prompt: "...", subagent_type: "researcher", run_in_background: true })
|
|
787
|
+
Task({ prompt: "...", subagent_type: "coder", run_in_background: true })
|
|
788
|
+
|
|
789
|
+
// 4. Wait for results, synthesize, continue
|
|
790
|
+
\`\`\`
|
|
791
|
+
|
|
792
|
+
### HIVE-MIND Mode (-hv, --hive)
|
|
793
|
+
|
|
794
|
+
Use for consensus-based decisions:
|
|
795
|
+
- Architecture choices
|
|
796
|
+
- Approach tradeoffs
|
|
797
|
+
- Design decisions with multiple valid options
|
|
798
|
+
|
|
799
|
+
### NAKED Mode (-n, --naked)
|
|
800
|
+
|
|
801
|
+
**Only when user explicitly requests.** Single Claude execution without agents.
|
|
802
|
+
- Still uses Task tool for tracking
|
|
803
|
+
- Still creates tasks for visibility
|
|
804
|
+
- Just doesn't spawn multiple agents
|
|
805
|
+
|
|
806
|
+
---
|
|
807
|
+
|
|
808
|
+
**Full mode executes without prompts.** It will:
|
|
809
|
+
1. Research the issue and codebase
|
|
810
|
+
2. Enhance the GitHub issue with implementation plan
|
|
811
|
+
3. Assign issue to self, add "in-progress" label
|
|
812
|
+
4. Create branch, implement, test
|
|
813
|
+
5. Run /simplify on changed code, re-test if changes made
|
|
814
|
+
6. Commit, create PR, update issue status
|
|
815
|
+
7. Store learnings
|
|
362
816
|
`;
|
|
363
817
|
fs.writeFileSync(skillFile, skillContent, 'utf-8');
|
|
364
|
-
|
|
818
|
+
// Create /fl alias (same content)
|
|
819
|
+
if (!fs.existsSync(aliasDir)) {
|
|
820
|
+
fs.mkdirSync(aliasDir, { recursive: true });
|
|
821
|
+
}
|
|
822
|
+
fs.writeFileSync(aliasFile, skillContent.replace('name: flo', 'name: fl'), 'utf-8');
|
|
823
|
+
// Clean up old /mf skill directory if it exists
|
|
824
|
+
const oldSkillDir = path.join(root, '.claude', 'skills', 'mf');
|
|
825
|
+
if (fs.existsSync(oldSkillDir)) {
|
|
826
|
+
fs.rmSync(oldSkillDir, { recursive: true });
|
|
827
|
+
}
|
|
828
|
+
return { name: '.claude/skills/flo/', status: 'created', detail: '/flo skill ready (alias: /fl)' };
|
|
365
829
|
}
|
|
366
830
|
// ============================================================================
|
|
367
831
|
// Step 4: CLAUDE.md MoFlo section
|
|
@@ -409,9 +873,9 @@ These are enforced by hooks — you cannot bypass them:
|
|
|
409
873
|
- **TaskCreate-first**: Must call TaskCreate before spawning Agent tool
|
|
410
874
|
- **Context tracking**: Session tracked as FRESH → MODERATE → DEPLETED → CRITICAL
|
|
411
875
|
|
|
412
|
-
### /
|
|
876
|
+
### /flo Skill — Issue Execution
|
|
413
877
|
|
|
414
|
-
Use \`/
|
|
878
|
+
Use \`/flo <issue-number>\` (or \`/fl\`) to execute GitHub issues through the full workflow:
|
|
415
879
|
Research → Enhance → Implement → Test → Simplify → PR
|
|
416
880
|
|
|
417
881
|
### MCP Tools Reference
|