moflo 4.6.2 → 4.6.3
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/bin/cli.js +20 -1
- package/src/@claude-flow/cli/dist/src/commands/doctor.js +2 -2
- package/src/@claude-flow/cli/dist/src/init/executor.js +455 -453
- package/src/@claude-flow/cli/dist/src/init/mcp-generator.d.ts +5 -1
- package/src/@claude-flow/cli/dist/src/init/mcp-generator.js +3 -2
- package/src/@claude-flow/cli/dist/src/init/moflo-init.js +549 -549
- package/src/@claude-flow/cli/dist/src/mcp-server.js +23 -1
- package/src/@claude-flow/cli/package.json +1 -1
|
@@ -130,85 +130,85 @@ function generateConfig(root, force, answers) {
|
|
|
130
130
|
const detectedExts = extensions.size > 0
|
|
131
131
|
? [...extensions].sort()
|
|
132
132
|
: ['.ts', '.tsx', '.js', '.jsx'];
|
|
133
|
-
const yaml = `# MoFlo — Project Configuration
|
|
134
|
-
# Generated by: moflo init
|
|
135
|
-
# Docs: https://github.com/eric-cielo/moflo
|
|
136
|
-
|
|
137
|
-
project:
|
|
138
|
-
name: "${projectName}"
|
|
139
|
-
|
|
140
|
-
# Guidance/knowledge docs to index for semantic search
|
|
141
|
-
guidance:
|
|
142
|
-
directories:
|
|
143
|
-
${guidanceDirs.map(d => ` - ${d}`).join('\n')}
|
|
144
|
-
namespace: guidance
|
|
145
|
-
|
|
146
|
-
# Source directories for code navigation map
|
|
147
|
-
code_map:
|
|
148
|
-
directories:
|
|
149
|
-
${srcDirs.map(d => ` - ${d}`).join('\n')}
|
|
150
|
-
extensions: [${detectedExts.map(e => `"${e}"`).join(', ')}]
|
|
151
|
-
exclude: [node_modules, dist, .next, coverage, build, __pycache__, target, .git]
|
|
152
|
-
namespace: code-map
|
|
153
|
-
|
|
154
|
-
# Workflow gates (enforced via Claude Code hooks)
|
|
155
|
-
gates:
|
|
156
|
-
memory_first: ${gatesEnabled}
|
|
157
|
-
task_create_first: ${gatesEnabled}
|
|
158
|
-
context_tracking: ${gatesEnabled}
|
|
159
|
-
|
|
160
|
-
# Auto-index on session start
|
|
161
|
-
auto_index:
|
|
162
|
-
guidance: ${answers?.guidance ?? true}
|
|
163
|
-
code_map: ${answers?.codeMap ?? true}
|
|
164
|
-
|
|
165
|
-
# Memory backend
|
|
166
|
-
memory:
|
|
167
|
-
backend: sql.js
|
|
168
|
-
embedding_model: Xenova/all-MiniLM-L6-v2
|
|
169
|
-
namespace: default
|
|
170
|
-
|
|
171
|
-
# Hook toggles (all on by default — disable to slim down)
|
|
172
|
-
hooks:
|
|
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)
|
|
194
|
-
models:
|
|
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
|
|
133
|
+
const yaml = `# MoFlo — Project Configuration
|
|
134
|
+
# Generated by: moflo init
|
|
135
|
+
# Docs: https://github.com/eric-cielo/moflo
|
|
136
|
+
|
|
137
|
+
project:
|
|
138
|
+
name: "${projectName}"
|
|
139
|
+
|
|
140
|
+
# Guidance/knowledge docs to index for semantic search
|
|
141
|
+
guidance:
|
|
142
|
+
directories:
|
|
143
|
+
${guidanceDirs.map(d => ` - ${d}`).join('\n')}
|
|
144
|
+
namespace: guidance
|
|
145
|
+
|
|
146
|
+
# Source directories for code navigation map
|
|
147
|
+
code_map:
|
|
148
|
+
directories:
|
|
149
|
+
${srcDirs.map(d => ` - ${d}`).join('\n')}
|
|
150
|
+
extensions: [${detectedExts.map(e => `"${e}"`).join(', ')}]
|
|
151
|
+
exclude: [node_modules, dist, .next, coverage, build, __pycache__, target, .git]
|
|
152
|
+
namespace: code-map
|
|
153
|
+
|
|
154
|
+
# Workflow gates (enforced via Claude Code hooks)
|
|
155
|
+
gates:
|
|
156
|
+
memory_first: ${gatesEnabled}
|
|
157
|
+
task_create_first: ${gatesEnabled}
|
|
158
|
+
context_tracking: ${gatesEnabled}
|
|
159
|
+
|
|
160
|
+
# Auto-index on session start
|
|
161
|
+
auto_index:
|
|
162
|
+
guidance: ${answers?.guidance ?? true}
|
|
163
|
+
code_map: ${answers?.codeMap ?? true}
|
|
164
|
+
|
|
165
|
+
# Memory backend
|
|
166
|
+
memory:
|
|
167
|
+
backend: sql.js
|
|
168
|
+
embedding_model: Xenova/all-MiniLM-L6-v2
|
|
169
|
+
namespace: default
|
|
170
|
+
|
|
171
|
+
# Hook toggles (all on by default — disable to slim down)
|
|
172
|
+
hooks:
|
|
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)
|
|
194
|
+
models:
|
|
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
|
|
212
212
|
`;
|
|
213
213
|
fs.writeFileSync(configPath, yaml, 'utf-8');
|
|
214
214
|
return { name: 'moflo.yaml', status: 'created', detail: `Detected: ${srcDirs.join(', ')} | ${detectedExts.join(', ')}` };
|
|
@@ -401,418 +401,418 @@ function generateSkill(root, force) {
|
|
|
401
401
|
if (!fs.existsSync(skillDir)) {
|
|
402
402
|
fs.mkdirSync(skillDir, { recursive: true });
|
|
403
403
|
}
|
|
404
|
-
const skillContent = `---
|
|
405
|
-
name: flo
|
|
406
|
-
description: MoFlo ticket workflow - analyze and execute GitHub issues
|
|
407
|
-
arguments: "[options] <issue-number>"
|
|
408
|
-
---
|
|
409
|
-
|
|
410
|
-
# /flo - MoFlo Ticket Workflow
|
|
411
|
-
|
|
412
|
-
Research, enhance, and execute GitHub issues automatically.
|
|
413
|
-
|
|
414
|
-
**Arguments:** $ARGUMENTS
|
|
415
|
-
|
|
416
|
-
## Usage
|
|
417
|
-
|
|
418
|
-
\`\`\`
|
|
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>
|
|
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
|
|
655
|
-
|
|
656
|
-
### Detecting Epics
|
|
657
|
-
|
|
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
|
-
\`\`\`
|
|
694
|
-
|
|
695
|
-
## Parse Arguments
|
|
696
|
-
|
|
697
|
-
\`\`\`javascript
|
|
698
|
-
const args = "$ARGUMENTS".trim().split(/\\s+/);
|
|
699
|
-
let workflowMode = "full"; // full, enhance, research
|
|
700
|
-
let execMode = "swarm"; // swarm (default), hive, naked
|
|
701
|
-
let issueNumber = null;
|
|
702
|
-
|
|
703
|
-
for (let i = 0; i < args.length; i++) {
|
|
704
|
-
const arg = args[i];
|
|
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
|
-
}
|
|
726
|
-
}
|
|
727
|
-
|
|
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.");
|
|
739
|
-
\`\`\`
|
|
740
|
-
|
|
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 |
|
|
759
|
-
|
|
760
|
-
## Execution Mode Details
|
|
761
|
-
|
|
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
|
|
404
|
+
const skillContent = `---
|
|
405
|
+
name: flo
|
|
406
|
+
description: MoFlo ticket workflow - analyze and execute GitHub issues
|
|
407
|
+
arguments: "[options] <issue-number>"
|
|
408
|
+
---
|
|
409
|
+
|
|
410
|
+
# /flo - MoFlo Ticket Workflow
|
|
411
|
+
|
|
412
|
+
Research, enhance, and execute GitHub issues automatically.
|
|
413
|
+
|
|
414
|
+
**Arguments:** $ARGUMENTS
|
|
415
|
+
|
|
416
|
+
## Usage
|
|
417
|
+
|
|
418
|
+
\`\`\`
|
|
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>
|
|
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
|
|
655
|
+
|
|
656
|
+
### Detecting Epics
|
|
657
|
+
|
|
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
|
+
\`\`\`
|
|
694
|
+
|
|
695
|
+
## Parse Arguments
|
|
696
|
+
|
|
697
|
+
\`\`\`javascript
|
|
698
|
+
const args = "$ARGUMENTS".trim().split(/\\s+/);
|
|
699
|
+
let workflowMode = "full"; // full, enhance, research
|
|
700
|
+
let execMode = "swarm"; // swarm (default), hive, naked
|
|
701
|
+
let issueNumber = null;
|
|
702
|
+
|
|
703
|
+
for (let i = 0; i < args.length; i++) {
|
|
704
|
+
const arg = args[i];
|
|
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
|
+
}
|
|
726
|
+
}
|
|
727
|
+
|
|
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.");
|
|
739
|
+
\`\`\`
|
|
740
|
+
|
|
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 |
|
|
759
|
+
|
|
760
|
+
## Execution Mode Details
|
|
761
|
+
|
|
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
|
|
816
816
|
`;
|
|
817
817
|
fs.writeFileSync(skillFile, skillContent, 'utf-8');
|
|
818
818
|
// Create /fl alias (same content)
|
|
@@ -850,64 +850,64 @@ function generateClaudeMd(root, force) {
|
|
|
850
850
|
}
|
|
851
851
|
}
|
|
852
852
|
}
|
|
853
|
-
const mofloSection = `
|
|
854
|
-
${MOFLO_MARKER}
|
|
855
|
-
## MoFlo — AI Agent Orchestration
|
|
856
|
-
|
|
857
|
-
This project uses [MoFlo](https://github.com/eric-cielo/moflo) for AI-assisted development workflows.
|
|
858
|
-
|
|
859
|
-
### FIRST ACTION ON EVERY PROMPT: Search Memory
|
|
860
|
-
|
|
861
|
-
Your first tool call for every new user prompt MUST be a memory search. Do this BEFORE Glob, Grep, Read, or any file exploration.
|
|
862
|
-
|
|
863
|
-
\`\`\`
|
|
864
|
-
mcp__claude-flow__memory_search — query: "<task description>", namespace: "guidance" or "patterns" or "code-map"
|
|
865
|
-
\`\`\`
|
|
866
|
-
|
|
867
|
-
For codebase navigation, search the \`code-map\` namespace first. For patterns and domain knowledge, search \`patterns\` and \`guidance\`.
|
|
868
|
-
|
|
869
|
-
### Workflow Gates (enforced automatically)
|
|
870
|
-
|
|
871
|
-
These are enforced by hooks — you cannot bypass them:
|
|
872
|
-
- **Memory-first**: Must search memory before Glob/Grep/Read on guidance files
|
|
873
|
-
- **TaskCreate-first**: Must call TaskCreate before spawning Agent tool
|
|
874
|
-
- **Context tracking**: Session tracked as FRESH → MODERATE → DEPLETED → CRITICAL
|
|
875
|
-
|
|
876
|
-
### /flo Skill — Issue Execution
|
|
877
|
-
|
|
878
|
-
Use \`/flo <issue-number>\` (or \`/fl\`) to execute GitHub issues through the full workflow:
|
|
879
|
-
Research → Enhance → Implement → Test → Simplify → PR
|
|
880
|
-
|
|
881
|
-
### MCP Tools Reference
|
|
882
|
-
|
|
883
|
-
| Tool | Purpose |
|
|
884
|
-
|------|---------|
|
|
885
|
-
| \`mcp__claude-flow__memory_search\` | Semantic search across indexed knowledge |
|
|
886
|
-
| \`mcp__claude-flow__memory_store\` | Store patterns and decisions |
|
|
887
|
-
| \`mcp__claude-flow__hooks_route\` | Route task to optimal agent type |
|
|
888
|
-
| \`mcp__claude-flow__hooks_pre-task\` | Record task start |
|
|
889
|
-
| \`mcp__claude-flow__hooks_post-task\` | Record task completion for learning |
|
|
890
|
-
|
|
891
|
-
### Agent Icon Mapping
|
|
892
|
-
|
|
893
|
-
| Icon | Agent Type | Use For |
|
|
894
|
-
|------|------------|---------|
|
|
895
|
-
| 🔍 | Explore | Research, codebase exploration |
|
|
896
|
-
| 📐 | Plan | Architecture, design |
|
|
897
|
-
| ⚙️ | General | General coding tasks |
|
|
898
|
-
| 🧪 | Test | Writing tests |
|
|
899
|
-
| 🔬 | Analyzer | Code review, analysis |
|
|
900
|
-
| 🔧 | Backend | API implementation |
|
|
901
|
-
|
|
902
|
-
### Non-Trivial Task Workflow
|
|
903
|
-
|
|
904
|
-
For any task beyond a single-line fix:
|
|
905
|
-
1. Search memory first (mandatory gate)
|
|
906
|
-
2. Create tasks with TaskCreate (mandatory gate)
|
|
907
|
-
3. Spawn agents in waves (Explore first, then Implement + Test)
|
|
908
|
-
4. Update task status as you go
|
|
909
|
-
5. Store learnings after completion
|
|
910
|
-
${MOFLO_MARKER_END}
|
|
853
|
+
const mofloSection = `
|
|
854
|
+
${MOFLO_MARKER}
|
|
855
|
+
## MoFlo — AI Agent Orchestration
|
|
856
|
+
|
|
857
|
+
This project uses [MoFlo](https://github.com/eric-cielo/moflo) for AI-assisted development workflows.
|
|
858
|
+
|
|
859
|
+
### FIRST ACTION ON EVERY PROMPT: Search Memory
|
|
860
|
+
|
|
861
|
+
Your first tool call for every new user prompt MUST be a memory search. Do this BEFORE Glob, Grep, Read, or any file exploration.
|
|
862
|
+
|
|
863
|
+
\`\`\`
|
|
864
|
+
mcp__claude-flow__memory_search — query: "<task description>", namespace: "guidance" or "patterns" or "code-map"
|
|
865
|
+
\`\`\`
|
|
866
|
+
|
|
867
|
+
For codebase navigation, search the \`code-map\` namespace first. For patterns and domain knowledge, search \`patterns\` and \`guidance\`.
|
|
868
|
+
|
|
869
|
+
### Workflow Gates (enforced automatically)
|
|
870
|
+
|
|
871
|
+
These are enforced by hooks — you cannot bypass them:
|
|
872
|
+
- **Memory-first**: Must search memory before Glob/Grep/Read on guidance files
|
|
873
|
+
- **TaskCreate-first**: Must call TaskCreate before spawning Agent tool
|
|
874
|
+
- **Context tracking**: Session tracked as FRESH → MODERATE → DEPLETED → CRITICAL
|
|
875
|
+
|
|
876
|
+
### /flo Skill — Issue Execution
|
|
877
|
+
|
|
878
|
+
Use \`/flo <issue-number>\` (or \`/fl\`) to execute GitHub issues through the full workflow:
|
|
879
|
+
Research → Enhance → Implement → Test → Simplify → PR
|
|
880
|
+
|
|
881
|
+
### MCP Tools Reference
|
|
882
|
+
|
|
883
|
+
| Tool | Purpose |
|
|
884
|
+
|------|---------|
|
|
885
|
+
| \`mcp__claude-flow__memory_search\` | Semantic search across indexed knowledge |
|
|
886
|
+
| \`mcp__claude-flow__memory_store\` | Store patterns and decisions |
|
|
887
|
+
| \`mcp__claude-flow__hooks_route\` | Route task to optimal agent type |
|
|
888
|
+
| \`mcp__claude-flow__hooks_pre-task\` | Record task start |
|
|
889
|
+
| \`mcp__claude-flow__hooks_post-task\` | Record task completion for learning |
|
|
890
|
+
|
|
891
|
+
### Agent Icon Mapping
|
|
892
|
+
|
|
893
|
+
| Icon | Agent Type | Use For |
|
|
894
|
+
|------|------------|---------|
|
|
895
|
+
| 🔍 | Explore | Research, codebase exploration |
|
|
896
|
+
| 📐 | Plan | Architecture, design |
|
|
897
|
+
| ⚙️ | General | General coding tasks |
|
|
898
|
+
| 🧪 | Test | Writing tests |
|
|
899
|
+
| 🔬 | Analyzer | Code review, analysis |
|
|
900
|
+
| 🔧 | Backend | API implementation |
|
|
901
|
+
|
|
902
|
+
### Non-Trivial Task Workflow
|
|
903
|
+
|
|
904
|
+
For any task beyond a single-line fix:
|
|
905
|
+
1. Search memory first (mandatory gate)
|
|
906
|
+
2. Create tasks with TaskCreate (mandatory gate)
|
|
907
|
+
3. Spawn agents in waves (Explore first, then Implement + Test)
|
|
908
|
+
4. Update task status as you go
|
|
909
|
+
5. Store learnings after completion
|
|
910
|
+
${MOFLO_MARKER_END}
|
|
911
911
|
`;
|
|
912
912
|
const finalContent = existing.trimEnd() + '\n' + mofloSection;
|
|
913
913
|
fs.writeFileSync(claudeMdPath, finalContent, 'utf-8');
|