moflo 4.8.21 → 4.8.23

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 (178) hide show
  1. package/.claude/agents/browser/browser-agent.yaml +182 -182
  2. package/.claude/agents/core/coder.md +265 -265
  3. package/.claude/agents/core/planner.md +167 -167
  4. package/.claude/agents/core/researcher.md +189 -189
  5. package/.claude/agents/core/reviewer.md +325 -325
  6. package/.claude/agents/core/tester.md +318 -318
  7. package/.claude/agents/database-specialist.yaml +21 -21
  8. package/.claude/agents/dual-mode/codex-coordinator.md +224 -224
  9. package/.claude/agents/dual-mode/codex-worker.md +211 -211
  10. package/.claude/agents/dual-mode/dual-orchestrator.md +291 -291
  11. package/.claude/agents/github/code-review-swarm.md +537 -537
  12. package/.claude/agents/github/github-modes.md +172 -172
  13. package/.claude/agents/github/issue-tracker.md +318 -318
  14. package/.claude/agents/github/multi-repo-swarm.md +552 -552
  15. package/.claude/agents/github/pr-manager.md +190 -190
  16. package/.claude/agents/github/project-board-sync.md +508 -508
  17. package/.claude/agents/github/release-manager.md +366 -366
  18. package/.claude/agents/github/release-swarm.md +582 -582
  19. package/.claude/agents/github/repo-architect.md +397 -397
  20. package/.claude/agents/github/swarm-issue.md +572 -572
  21. package/.claude/agents/github/swarm-pr.md +427 -427
  22. package/.claude/agents/github/sync-coordinator.md +451 -451
  23. package/.claude/agents/github/workflow-automation.md +634 -634
  24. package/.claude/agents/goal/code-goal-planner.md +445 -445
  25. package/.claude/agents/hive-mind/collective-intelligence-coordinator.md +129 -129
  26. package/.claude/agents/hive-mind/queen-coordinator.md +202 -202
  27. package/.claude/agents/hive-mind/scout-explorer.md +241 -241
  28. package/.claude/agents/hive-mind/swarm-memory-manager.md +192 -192
  29. package/.claude/agents/hive-mind/worker-specialist.md +216 -216
  30. package/.claude/agents/index.yaml +17 -17
  31. package/.claude/agents/neural/safla-neural.md +73 -73
  32. package/.claude/agents/project-coordinator.yaml +15 -15
  33. package/.claude/agents/python-specialist.yaml +21 -21
  34. package/.claude/agents/reasoning/goal-planner.md +72 -72
  35. package/.claude/agents/security-auditor.yaml +20 -20
  36. package/.claude/agents/swarm/adaptive-coordinator.md +395 -395
  37. package/.claude/agents/swarm/hierarchical-coordinator.md +326 -326
  38. package/.claude/agents/swarm/mesh-coordinator.md +391 -391
  39. package/.claude/agents/templates/migration-plan.md +745 -745
  40. package/.claude/agents/typescript-specialist.yaml +21 -21
  41. package/.claude/checkpoints/1767754460.json +8 -8
  42. package/.claude/commands/agents/agent-spawning.md +28 -28
  43. package/.claude/commands/github/github-modes.md +146 -146
  44. package/.claude/commands/github/github-swarm.md +121 -121
  45. package/.claude/commands/github/issue-tracker.md +291 -291
  46. package/.claude/commands/github/pr-manager.md +169 -169
  47. package/.claude/commands/github/release-manager.md +337 -337
  48. package/.claude/commands/github/repo-architect.md +366 -366
  49. package/.claude/commands/github/sync-coordinator.md +300 -300
  50. package/.claude/commands/memory/neural.md +47 -47
  51. package/.claude/commands/sparc/analyzer.md +51 -51
  52. package/.claude/commands/sparc/architect.md +53 -53
  53. package/.claude/commands/sparc/ask.md +97 -97
  54. package/.claude/commands/sparc/batch-executor.md +54 -54
  55. package/.claude/commands/sparc/code.md +89 -89
  56. package/.claude/commands/sparc/coder.md +54 -54
  57. package/.claude/commands/sparc/debug.md +83 -83
  58. package/.claude/commands/sparc/debugger.md +54 -54
  59. package/.claude/commands/sparc/designer.md +53 -53
  60. package/.claude/commands/sparc/devops.md +109 -109
  61. package/.claude/commands/sparc/docs-writer.md +80 -80
  62. package/.claude/commands/sparc/documenter.md +54 -54
  63. package/.claude/commands/sparc/innovator.md +54 -54
  64. package/.claude/commands/sparc/integration.md +83 -83
  65. package/.claude/commands/sparc/mcp.md +117 -117
  66. package/.claude/commands/sparc/memory-manager.md +54 -54
  67. package/.claude/commands/sparc/optimizer.md +54 -54
  68. package/.claude/commands/sparc/orchestrator.md +131 -131
  69. package/.claude/commands/sparc/post-deployment-monitoring-mode.md +83 -83
  70. package/.claude/commands/sparc/refinement-optimization-mode.md +83 -83
  71. package/.claude/commands/sparc/researcher.md +54 -54
  72. package/.claude/commands/sparc/reviewer.md +54 -54
  73. package/.claude/commands/sparc/security-review.md +80 -80
  74. package/.claude/commands/sparc/sparc-modes.md +174 -174
  75. package/.claude/commands/sparc/sparc.md +111 -111
  76. package/.claude/commands/sparc/spec-pseudocode.md +80 -80
  77. package/.claude/commands/sparc/supabase-admin.md +348 -348
  78. package/.claude/commands/sparc/swarm-coordinator.md +54 -54
  79. package/.claude/commands/sparc/tdd.md +54 -54
  80. package/.claude/commands/sparc/tester.md +54 -54
  81. package/.claude/commands/sparc/tutorial.md +79 -79
  82. package/.claude/commands/sparc/workflow-manager.md +54 -54
  83. package/.claude/commands/sparc.md +166 -166
  84. package/.claude/commands/swarm/analysis.md +95 -95
  85. package/.claude/commands/swarm/development.md +96 -96
  86. package/.claude/commands/swarm/examples.md +168 -168
  87. package/.claude/commands/swarm/maintenance.md +102 -102
  88. package/.claude/commands/swarm/optimization.md +117 -117
  89. package/.claude/commands/swarm/research.md +136 -136
  90. package/.claude/commands/swarm/testing.md +131 -131
  91. package/.claude/commands/workflows/development.md +77 -77
  92. package/.claude/commands/workflows/research.md +62 -62
  93. package/.claude/guidance/moflo-bootstrap.md +126 -126
  94. package/.claude/guidance/shipped/agent-bootstrap.md +126 -126
  95. package/.claude/guidance/shipped/guidance-memory-strategy.md +262 -262
  96. package/.claude/guidance/shipped/memory-strategy.md +204 -204
  97. package/.claude/guidance/shipped/moflo.md +668 -653
  98. package/.claude/guidance/shipped/task-swarm-integration.md +441 -441
  99. package/.claude/helpers/intelligence.cjs +207 -207
  100. package/.claude/helpers/statusline.cjs +851 -851
  101. package/.claude/settings.local.json +18 -0
  102. package/.claude/skills/fl/SKILL.md +583 -583
  103. package/.claude/skills/flo/SKILL.md +583 -583
  104. package/.claude/skills/github-code-review/SKILL.md +1140 -1140
  105. package/.claude/skills/github-multi-repo/SKILL.md +874 -874
  106. package/.claude/skills/github-project-management/SKILL.md +1277 -1277
  107. package/.claude/skills/github-release-management/SKILL.md +1081 -1081
  108. package/.claude/skills/github-workflow-automation/SKILL.md +1065 -1065
  109. package/.claude/skills/hive-mind-advanced/SKILL.md +712 -712
  110. package/.claude/skills/hooks-automation/SKILL.md +1201 -1201
  111. package/.claude/skills/performance-analysis/SKILL.md +563 -563
  112. package/.claude/skills/sparc-methodology/SKILL.md +1115 -1115
  113. package/.claude/skills/swarm-advanced/SKILL.md +973 -973
  114. package/.claude/workflow-state.json +4 -4
  115. package/LICENSE +21 -21
  116. package/README.md +698 -685
  117. package/bin/cli.js +0 -0
  118. package/bin/gate-hook.mjs +50 -50
  119. package/bin/gate.cjs +138 -138
  120. package/bin/generate-code-map.mjs +775 -775
  121. package/bin/hook-handler.cjs +83 -83
  122. package/bin/hooks.mjs +656 -656
  123. package/bin/index-guidance.mjs +892 -892
  124. package/bin/index-tests.mjs +709 -709
  125. package/bin/lib/process-manager.mjs +243 -243
  126. package/bin/lib/registry-cleanup.cjs +41 -41
  127. package/bin/prompt-hook.mjs +72 -72
  128. package/bin/semantic-search.mjs +472 -472
  129. package/bin/session-start-launcher.mjs +238 -238
  130. package/bin/setup-project.mjs +250 -250
  131. package/package.json +123 -123
  132. package/src/@claude-flow/cli/README.md +452 -452
  133. package/src/@claude-flow/cli/bin/cli.js +180 -180
  134. package/src/@claude-flow/cli/bin/preinstall.cjs +2 -2
  135. package/src/@claude-flow/cli/dist/src/commands/completions.js +409 -409
  136. package/src/@claude-flow/cli/dist/src/commands/doctor.js +18 -2
  137. package/src/@claude-flow/cli/dist/src/commands/embeddings.js +25 -25
  138. package/src/@claude-flow/cli/dist/src/commands/github.js +61 -61
  139. package/src/@claude-flow/cli/dist/src/commands/hive-mind.js +90 -90
  140. package/src/@claude-flow/cli/dist/src/commands/hooks.js +9 -9
  141. package/src/@claude-flow/cli/dist/src/commands/init.js +3 -8
  142. package/src/@claude-flow/cli/dist/src/commands/ruvector/import.js +14 -14
  143. package/src/@claude-flow/cli/dist/src/commands/ruvector/setup.js +624 -624
  144. package/src/@claude-flow/cli/dist/src/config/moflo-config.d.ts +3 -0
  145. package/src/@claude-flow/cli/dist/src/config/moflo-config.js +101 -91
  146. package/src/@claude-flow/cli/dist/src/index.d.ts +5 -0
  147. package/src/@claude-flow/cli/dist/src/index.js +44 -0
  148. package/src/@claude-flow/cli/dist/src/init/claudemd-generator.d.ts +29 -29
  149. package/src/@claude-flow/cli/dist/src/init/claudemd-generator.js +43 -43
  150. package/src/@claude-flow/cli/dist/src/init/executor.js +453 -453
  151. package/src/@claude-flow/cli/dist/src/init/helpers-generator.js +482 -482
  152. package/src/@claude-flow/cli/dist/src/init/moflo-init.d.ts +30 -30
  153. package/src/@claude-flow/cli/dist/src/init/moflo-init.js +140 -140
  154. package/src/@claude-flow/cli/dist/src/init/statusline-generator.js +876 -876
  155. package/src/@claude-flow/cli/dist/src/memory/memory-initializer.js +371 -371
  156. package/src/@claude-flow/cli/dist/src/runtime/headless.js +28 -28
  157. package/src/@claude-flow/cli/dist/src/services/container-worker-pool.d.ts +197 -0
  158. package/src/@claude-flow/cli/dist/src/services/container-worker-pool.js +584 -0
  159. package/src/@claude-flow/cli/dist/src/services/daemon-lock.d.ts +14 -0
  160. package/src/@claude-flow/cli/dist/src/services/daemon-lock.js +1 -1
  161. package/src/@claude-flow/cli/dist/src/services/headless-worker-executor.js +84 -84
  162. package/src/@claude-flow/cli/package.json +1 -1
  163. package/src/@claude-flow/guidance/README.md +1195 -1195
  164. package/src/@claude-flow/guidance/package.json +198 -198
  165. package/src/@claude-flow/memory/README.md +587 -587
  166. package/src/@claude-flow/memory/dist/agentdb-backend.js +26 -26
  167. package/src/@claude-flow/memory/dist/auto-memory-bridge.test.js +27 -27
  168. package/src/@claude-flow/memory/dist/hybrid-backend.d.ts +245 -0
  169. package/src/@claude-flow/memory/dist/hybrid-backend.js +569 -0
  170. package/src/@claude-flow/memory/dist/hybrid-backend.test.d.ts +8 -0
  171. package/src/@claude-flow/memory/dist/hybrid-backend.test.js +320 -0
  172. package/src/@claude-flow/memory/dist/sqlite-backend.d.ts +121 -0
  173. package/src/@claude-flow/memory/dist/sqlite-backend.js +572 -0
  174. package/src/@claude-flow/memory/dist/sqljs-backend.js +26 -26
  175. package/src/@claude-flow/memory/package.json +44 -44
  176. package/src/@claude-flow/shared/README.md +323 -323
  177. package/src/@claude-flow/shared/dist/events/event-store.js +31 -31
  178. package/src/README.md +493 -493
@@ -1,583 +1,583 @@
1
- ---
2
- name: flo
3
- description: MoFlo ticket workflow - analyze and execute GitHub issues
4
- arguments: "[options] <issue-number | title>"
5
- ---
6
-
7
- # /flo - MoFlo Ticket Workflow
8
-
9
- Research, create tickets for, and execute GitHub issues automatically.
10
-
11
- **Arguments:** $ARGUMENTS
12
-
13
- ## Usage
14
-
15
- ```
16
- /flo <issue-number> # Full workflow in NORMAL mode (default)
17
- /flo -t <issue-number> # Ticket only: research and update ticket, then STOP
18
- /flo -t <title> # Create a NEW ticket with description, acceptance criteria, test cases
19
- /flo --ticket <issue-number|title> # Same as -t
20
- /flo -r <issue-number> # Research only: analyze issue, output findings
21
- /flo --research <issue-number> # Same as -r
22
- ```
23
-
24
- Also available as `/fl` (shorthand alias).
25
-
26
- ### Execution Mode (how work is done)
27
-
28
- ```
29
- /flo 123 # NORMAL mode (default) - single-agent execution
30
- /flo -s 123 # SWARM mode - multi-agent coordination
31
- /flo --swarm 123 # Same as -s
32
- /flo -h 123 # HIVE-MIND mode - consensus-based coordination
33
- /flo --hive 123 # Same as -h
34
- /flo -n 123 # NORMAL mode - single Claude, no agents
35
- /flo --normal 123 # Same as -n
36
- ```
37
-
38
- ### Epic Handling
39
-
40
- ```
41
- /flo 42 # If #42 is an epic, processes all stories sequentially
42
- ```
43
-
44
- **Epic Detection:** An issue is automatically detected as an epic if ANY of these are true:
45
- - Has a label matching: `epic`, `tracking`, `parent`, or `umbrella` (case-insensitive)
46
- - Body contains `## Stories` or `## Tasks` sections
47
- - Body has checklist-linked issues: `- [ ] #123`
48
- - Body has numbered issue references: `1. #123`
49
- - The issue has GitHub sub-issues (via `subIssues` API field)
50
-
51
- **Sequential Processing:** When an epic is selected:
52
- 1. List all child stories/tasks (from checklist or linked issues)
53
- 2. Process each story **one at a time** in order
54
- 3. Each story goes through the full workflow (research -> ticket -> implement -> test -> PR)
55
- 4. After each story's PR is created, move to the next story
56
- 5. Continue until all stories are complete
57
-
58
- ### Combined Examples
59
-
60
- ```
61
- /flo 123 # Normal + full workflow (default) - includes ALL tests
62
- /flo 42 # If #42 is epic, processes stories sequentially
63
- /flo -s 123 # Swarm + full workflow (multi-agent coordination)
64
- /flo -t 123 # Normal + ticket only (no implementation)
65
- /flo -h -t 123 # Hive-mind + ticket only
66
- /flo -s -r 123 # Swarm + research only
67
- /flo --swarm --ticket 123 # Explicit swarm + ticket only
68
- /flo -n 123 # Normal (explicit, same as default)
69
- ```
70
-
71
- ## NORMAL MODE IS THE DEFAULT
72
-
73
- By default, /flo runs in NORMAL mode — single-agent execution without
74
- spawning sub-agents. This is efficient for most tasks.
75
-
76
- Use `-s`/`--swarm` for multi-agent coordination when the task warrants it.
77
- Use `-h`/`--hive` for consensus-based coordination on architecture decisions.
78
-
79
- POST-TASK NEURAL LEARNING ALWAYS RUNS regardless of execution mode.
80
- The hooks system collects learnings after every task completion — normal,
81
- swarm, or hive-mind.
82
-
83
- ## COMPREHENSIVE TESTING REQUIREMENT
84
-
85
- ALL tests MUST pass BEFORE PR creation - NO EXCEPTIONS.
86
- - Unit Tests: MANDATORY for all new/modified code
87
- - Integration Tests: MANDATORY for API endpoints and services
88
- - E2E Tests: MANDATORY for user-facing features
89
- PR CANNOT BE CREATED until all relevant tests pass.
90
-
91
- ## Workflow Overview
92
-
93
- ```
94
- Research -> Ticket -> Execute -> Testing -> Simplify -> PR+Done
95
-
96
- Research: Fetch issue, search memory, read guidance, find files
97
- Ticket: Create or update GitHub issue with description, acceptance criteria, test cases
98
- Execute: Assign self, create branch, implement changes
99
- Testing: Unit + Integration + E2E tests (ALL MUST PASS - gate)
100
- Simplify: Run /simplify on changed code (gate - must run before PR)
101
- PR+Done: Create PR, update issue status, store learnings
102
- ```
103
-
104
- ### Workflow Gates
105
-
106
- | Gate | Requirement | Blocked Action |
107
- |------|-------------|----------------|
108
- | **Testing Gate** | Unit + Integration + E2E must pass | PR creation |
109
- | **Simplification Gate** | /simplify must run on changed files | PR creation |
110
-
111
- ### Execution Mode (applies to all phases)
112
-
113
- | Mode | Description |
114
- |------|-------------|
115
- | **NORMAL** (default) | Single Claude execution. Efficient for most tasks. |
116
- | **SWARM** (-s) | Multi-agent via Task tool: researcher, coder, tester, reviewer |
117
- | **HIVE-MIND** (-h) | Consensus-based coordination for architecture decisions |
118
-
119
- ## Phase 1: Research (-r or default first step)
120
-
121
- ### 1.1 Fetch Issue Details
122
- ```bash
123
- gh issue view <issue-number> --json number,title,body,labels,state,assignees,comments,milestone
124
- ```
125
-
126
- ### 1.2 Check Ticket Status
127
- Look for `## Acceptance Criteria` marker in issue body.
128
- - **If present**: Ticket already enhanced, skip to execute or confirm
129
- - **If absent**: Proceed with research and ticket update
130
-
131
- ### 1.3 Search Memory FIRST
132
- ALWAYS search memory BEFORE reading guidance or docs files.
133
- Memory has file paths, context, and patterns - often all you need.
134
- Only read guidance files if memory search returns zero relevant results.
135
-
136
- ```bash
137
- npx flo memory search --query "<issue title keywords>" --namespace patterns
138
- npx flo memory search --query "<domain keywords>" --namespace guidance
139
- ```
140
-
141
- Or via MCP: `mcp__moflo__memory_search`
142
-
143
- ### 1.4 Read Guidance Docs (ONLY if memory insufficient)
144
- **Only if memory search returned < 3 relevant results**, read guidance files:
145
- - Bug -> testing patterns, error handling
146
- - Feature -> domain model, architecture
147
- - UI -> frontend patterns, components
148
-
149
- ### 1.5 Research Codebase
150
- Use Task tool with Explore agent to find:
151
- - Affected files and their current state
152
- - Related code and dependencies
153
- - Existing patterns to follow
154
- - Test coverage gaps
155
-
156
- ## Phase 2: Ticket (-t creates or updates a ticket)
157
-
158
- When given an issue number, `-t` enhances the existing ticket. When given a title (non-numeric argument), `-t` creates a new GitHub issue. Either way, the ticket MUST include all three of the following sections.
159
-
160
- ### 2.0 Complexity Assessment (MANDATORY before building ticket)
161
-
162
- After research, assess the complexity of the work. This determines whether the issue stays as a single ticket or gets promoted to an epic with sub-issues.
163
-
164
- **Complexity Signals — count how many apply:**
165
-
166
- | Signal | Weight | Example |
167
- |--------|--------|---------|
168
- | Multiple files changed (5+) | +2 | Touches models, API, tests, docs, config |
169
- | New module or package | +2 | Requires new directory structure |
170
- | Cross-cutting concern | +2 | Auth, logging, error handling across layers |
171
- | Database/schema changes | +2 | Migrations, new tables, index changes |
172
- | Multiple independent work streams | +3 | Frontend + backend + infra changes |
173
- | External API integration | +1 | Third-party service, webhook, OAuth |
174
- | Breaking change / migration | +2 | Requires deprecation, data migration |
175
- | Significant test surface | +1 | Needs 10+ new test cases across categories |
176
- | Security implications | +1 | Authentication, authorization, input validation |
177
- | UI + backend changes together | +2 | Full-stack feature spanning layers |
178
-
179
- **Complexity Thresholds:**
180
-
181
- | Score | Classification | Action |
182
- |-------|---------------|--------|
183
- | 0–3 | **Simple** | Single ticket — proceed normally |
184
- | 4–6 | **Moderate** | Single ticket — flag in description that it may benefit from splitting |
185
- | 7+ | **Complex** | **PROMOTE TO EPIC** — decompose into sub-issues |
186
-
187
- **When promoting to epic:**
188
-
189
- 1. Decompose the work into 2–6 independent, shippable stories
190
- 2. Each story should be completable in a single PR
191
- 3. Stories should have clear boundaries (one concern per story)
192
- 4. Order stories by dependency (independent ones first)
193
- 5. Create each story as a GitHub issue with its own Description, Acceptance Criteria, and Test Cases
194
- 6. Create or convert the parent issue into an epic with a `## Stories` checklist
195
-
196
- ```javascript
197
- // Complexity assessment pseudocode
198
- function assessComplexity(research) {
199
- let score = 0;
200
- if (research.affectedFiles.length >= 5) score += 2;
201
- if (research.requiresNewModule) score += 2;
202
- if (research.crossCutting) score += 2;
203
- if (research.schemaChanges) score += 2;
204
- if (research.independentWorkStreams >= 2) score += 3;
205
- if (research.externalAPIs) score += 1;
206
- if (research.breakingChanges) score += 2;
207
- if (research.estimatedTestCases >= 10) score += 1;
208
- if (research.securityImplications) score += 1;
209
- if (research.fullStack) score += 2;
210
- return score;
211
- }
212
- ```
213
-
214
- ### 2.0.1 Epic Decomposition (when score >= 7)
215
-
216
- When complexity warrants an epic, decompose into stories:
217
-
218
- ```bash
219
- # Step 1: Create each sub-issue
220
- gh issue create --title "Story: <story-title>" --body "<## Description + ## Acceptance Criteria + ## Suggested Test Cases>" --label "story"
221
- # Capture the new issue number from output
222
-
223
- # Step 2: Repeat for all stories (2-6 stories typically)
224
-
225
- # Step 3: Build the epic body with checklist referencing ALL story issue numbers
226
- # Step 4: If updating an existing issue, convert it to epic:
227
- gh issue edit <parent-number> --add-label "epic" --body "<epic body with ## Stories checklist>"
228
-
229
- # Step 5: If creating new, create the epic:
230
- gh issue create --title "Epic: <title>" --label "epic" --body "<epic body>"
231
- ```
232
-
233
- **Epic body format (MANDATORY — this is how tracking works):**
234
-
235
- ```markdown
236
- ## Overview
237
- <High-level description of the epic goal>
238
-
239
- ## Stories
240
-
241
- - [ ] #<story-1-number> <story-1-title>
242
- - [ ] #<story-2-number> <story-2-title>
243
- - [ ] #<story-3-number> <story-3-title>
244
-
245
- ## Complexity Assessment
246
- Score: <N>/20 — <Simple|Moderate|Complex>
247
- Signals: <list of signals that triggered>
248
- ```
249
-
250
- The `## Stories` checklist with `- [ ] #<number>` format is **mandatory** — this is what enables:
251
- - Epic detection by the `/flo` skill
252
- - Story extraction for sequential processing
253
- - Progress tracking via checked/unchecked items
254
-
255
- ### 2.1 Build Ticket Content
256
- Compile research into a well-structured ticket. The issue MUST include all three of the following sections:
257
-
258
- **Detailed Description** — Clear, thorough explanation of what needs to be done and why. Include:
259
- - Root cause analysis (bugs) or approach rationale (features)
260
- - Impact and risk factors
261
- - Affected files (with line numbers), new files, deletions
262
- - Implementation plan: numbered steps with clear actions, dependencies, decision points
263
-
264
- **Acceptance Criteria** — Specific, testable conditions that must be true for this issue to be considered complete. Write as a checklist:
265
- - [ ] Criterion 1 (e.g., "API returns 200 with valid token")
266
- - [ ] Criterion 2 (e.g., "Error message shown when input exceeds 255 chars")
267
- - [ ] ...each criterion must be independently verifiable
268
-
269
- **Suggested Test Cases** — Concrete test scenarios covering happy path, edge cases, and error conditions:
270
- - Test case 1: description, input, expected output
271
- - Test case 2: description, input, expected output
272
- - Include unit, integration, and E2E test suggestions as appropriate
273
-
274
- ### 2.2 Create or Update GitHub Issue
275
-
276
- **If issue number was given** (update existing):
277
- ```bash
278
- gh issue edit <issue-number> --body "<original body + ## Description + ## Acceptance Criteria + ## Suggested Test Cases>"
279
- gh issue comment <issue-number> --body "Ticket enhanced with description, acceptance criteria, and test cases. Ready for execution."
280
- ```
281
-
282
- **If title was given** (create new):
283
- ```bash
284
- gh issue create --title "<title>" --body "<## Description + ## Acceptance Criteria + ## Suggested Test Cases>"
285
- ```
286
- Print the new issue URL so the user can see it.
287
-
288
- ## Phase 3: Execute (default, runs automatically after ticket)
289
-
290
- ### 3.1 Assign Issue and Update Status
291
- ```bash
292
- gh issue edit <issue-number> --add-assignee @me
293
- gh issue edit <issue-number> --add-label "in-progress"
294
- ```
295
-
296
- ### 3.2 Create Branch
297
- ```bash
298
- git checkout main && git pull origin main
299
- git checkout -b <type>/<issue-number>-<short-desc>
300
- ```
301
- Types: `feature/`, `fix/`, `refactor/`, `docs/`
302
-
303
- ### 3.3 Implement
304
- Follow the implementation plan from the ticket. No prompts - execute all steps.
305
-
306
- ## Phase 4: Testing (MANDATORY GATE)
307
-
308
- This is NOT optional. ALL applicable test types must pass for the change type.
309
- WORKFLOW STOPS HERE until tests pass. No shortcuts. No exceptions.
310
-
311
- ### 4.1 Write and Run Tests
312
- Write unit, integration, and E2E tests as appropriate for the change type.
313
- Follow the project's established test style, runner, and patterns. If no existing tests or test guidance is present, choose the best options for the project's language and stack, taking compatibility with existing dependencies into account.
314
-
315
- ### 4.2 Test Auto-Fix Loop
316
- If any tests fail, enter the auto-fix loop (max 3 retries OR 10 minutes):
317
- 1. Run all tests
318
- 2. If ALL pass -> proceed to simplification
319
- 3. If ANY fail: analyze failure, fix test or implementation code, retry
320
- 4. If retries exhausted -> STOP and report to user
321
-
322
- ## Phase 4.5: Code Simplification (MANDATORY)
323
-
324
- The built-in /simplify command reviews ALL changed code for:
325
- - Reuse opportunities and code quality
326
- - Efficiency improvements
327
- - Consistency with existing codebase patterns
328
- - Preserves ALL functionality - no behavior changes
329
-
330
- If /simplify makes changes -> re-run tests to confirm nothing broke.
331
- If re-tests fail -> revert changes, proceed with original code.
332
-
333
- ## Phase 5: Commit and PR (only after tests pass)
334
-
335
- ### 5.1 Commit
336
- ```bash
337
- git add <specific files>
338
- git commit -m "type(scope): description
339
-
340
- Closes #<issue-number>
341
-
342
- Co-Authored-By: Claude <noreply@anthropic.com>"
343
- ```
344
-
345
- ### 5.2 Create PR
346
- ```bash
347
- git push -u origin <branch-name>
348
- gh pr create --title "type(scope): description" --body "## Summary
349
- <brief description>
350
-
351
- ## Changes
352
- <bullet list>
353
-
354
- ## Testing
355
- - [x] Unit tests pass
356
- - [x] Integration tests pass
357
- - [x] E2E tests pass
358
- - [ ] Manual testing done
359
-
360
- Closes #<issue-number>"
361
- ```
362
-
363
- ### 5.3 Update Issue Status
364
- ```bash
365
- gh issue edit <issue-number> --remove-label "in-progress" --add-label "ready-for-review"
366
- gh issue comment <issue-number> --body "PR created: <pr-url>"
367
- ```
368
-
369
- ## Epic Handling
370
-
371
- ### Detecting Epics
372
-
373
- An issue is an **epic** if:
374
- 1. It has the `epic` label, OR
375
- 2. Its body contains `## Stories` or `## Tasks` sections, OR
376
- 3. It has linked child issues (via `- [ ] #123` checklist format)
377
-
378
- ### Epic Processing Flow
379
-
380
- 1. DETECT EPIC - Check labels, parse body for ## Stories / ## Tasks, extract issue references
381
- 2. LIST ALL STORIES - Extract from checklist, order top-to-bottom as listed
382
- 3. SEQUENTIAL PROCESSING - For each story:
383
- a. Run full /flo workflow (research -> ticket -> implement -> test -> PR)
384
- b. After PR is created, **check off the story** in the epic body
385
- c. Move to the next unchecked story
386
- 4. COMPLETION - All stories checked off, epic marked as ready-for-review
387
-
388
- ONE STORY AT A TIME - NO PARALLEL STORY EXECUTION.
389
- Each story must complete (PR created) before starting next.
390
-
391
- ### Epic Checklist Tracking (MANDATORY)
392
-
393
- After each story's PR is created, update the epic body to check off that story:
394
-
395
- ```bash
396
- # 1. Fetch current epic body
397
- EPIC_BODY=$(gh issue view <epic-number> --json body -q '.body')
398
-
399
- # 2. Replace "- [ ] #<story-number>" with "- [x] #<story-number>"
400
- UPDATED_BODY=$(echo "$EPIC_BODY" | sed 's/- \[ \] #<story-number>/- [x] #<story-number>/')
401
-
402
- # 3. Update the epic
403
- gh issue edit <epic-number> --body "$UPDATED_BODY"
404
-
405
- # 4. Comment on the epic with progress
406
- gh issue comment <epic-number> --body "✅ Story #<story-number> completed — PR: <pr-url>"
407
- ```
408
-
409
- This applies to ALL epics, regardless of how they were created:
410
- - Epics created by `/flo -t` complexity promotion
411
- - Epics created manually by users
412
- - Epics detected from existing issues
413
-
414
- The checklist state (`[ ]` vs `[x]`) is the **single source of truth** for epic progress.
415
-
416
- ### Epic Detection Code
417
-
418
- ```javascript
419
- function isEpic(issue) {
420
- // Label-based detection (case-insensitive)
421
- const epicLabels = ['epic', 'tracking', 'parent', 'umbrella'];
422
- if (issue.labels?.some(l => epicLabels.includes(l.name.toLowerCase()))) return true;
423
- // Section-based detection
424
- if (issue.body?.includes('## Stories') || issue.body?.includes('## Tasks')) return true;
425
- // Checklist-linked issues: - [ ] #123 or - [x] #123
426
- if (/- \[[ x]\] #\d+/.test(issue.body)) return true;
427
- // Numbered issue references: 1. #123
428
- if (/\d+\.\s+#\d+/.test(issue.body)) return true;
429
- // GitHub sub-issues API
430
- if (issue.subIssues?.length > 0) return true;
431
- return false;
432
- }
433
-
434
- function extractStories(epicBody) {
435
- const stories = [];
436
- // Checklist format: - [ ] #123
437
- const checklistPattern = /- \[[ ]\] #(\d+)/g;
438
- let match;
439
- while ((match = checklistPattern.exec(epicBody)) !== null) {
440
- stories.push(parseInt(match[1]));
441
- }
442
- // Numbered format: 1. #123
443
- if (stories.length === 0) {
444
- const numberedPattern = /\d+\.\s+#(\d+)/g;
445
- while ((match = numberedPattern.exec(epicBody)) !== null) {
446
- stories.push(parseInt(match[1]));
447
- }
448
- }
449
- return stories;
450
- }
451
- ```
452
-
453
- ## Parse Arguments
454
-
455
- ```javascript
456
- const args = "$ARGUMENTS".trim().split(/\s+/);
457
- let workflowMode = "full"; // full, ticket, research
458
- let execMode = "normal"; // normal (default), swarm, hive
459
- let issueNumber = null;
460
- let titleWords = [];
461
-
462
- for (let i = 0; i < args.length; i++) {
463
- const arg = args[i];
464
-
465
- // Workflow mode (what to do)
466
- if (arg === "-t" || arg === "--ticket") {
467
- workflowMode = "ticket";
468
- } else if (arg === "-r" || arg === "--research") {
469
- workflowMode = "research";
470
- }
471
-
472
- // Execution mode (how to do it)
473
- else if (arg === "-s" || arg === "--swarm") {
474
- execMode = "swarm";
475
- } else if (arg === "-h" || arg === "--hive") {
476
- execMode = "hive";
477
- } else if (arg === "-n" || arg === "--normal") {
478
- execMode = "normal";
479
- }
480
-
481
- // Issue number or title text
482
- else if (/^\d+$/.test(arg)) {
483
- issueNumber = arg;
484
- } else {
485
- // Non-flag, non-numeric argument — collect as title words
486
- titleWords.push(arg);
487
- }
488
- }
489
-
490
- // In ticket mode, a title can be given instead of an issue number
491
- let ticketTitle = titleWords.join(" ");
492
- if (!issueNumber && !ticketTitle) {
493
- throw new Error("Issue number or title required. Usage: /flo <issue-number | title>");
494
- }
495
- if (!issueNumber && workflowMode !== "ticket") {
496
- throw new Error("Issue number required for full/research mode. Use -t for new tickets.");
497
- }
498
-
499
- // Log execution mode to prevent silent skipping
500
- console.log("Execution mode: " + execMode.toUpperCase());
501
- if (execMode === "swarm") {
502
- console.log("SWARM MODE: Will spawn agents via Task tool. Do NOT skip this.");
503
- }
504
- console.log("TESTING: Unit + Integration + E2E tests REQUIRED before PR.");
505
- console.log("SIMPLIFY: /simplify command runs on changed code before PR.");
506
- ```
507
-
508
- ## Execution Flow
509
-
510
- ### Workflow Modes (what to do)
511
-
512
- | Mode | Command | Steps | Stops After |
513
- |------|---------|-------|-------------|
514
- | **Full** (default) | `/flo 123` | Research -> Ticket -> Implement -> Test -> Simplify -> PR | PR created |
515
- | **Epic** | `/flo 42` (epic) | For each story: Full workflow sequentially | All story PRs created |
516
- | **Ticket** | `/flo -t 123` | Research -> Ticket | Issue updated |
517
- | **Research** | `/flo -r 123` | Research | Findings output |
518
-
519
- ### Execution Modes (how to do it)
520
-
521
- | Mode | Flag | Description | When to Use |
522
- |------|------|-------------|-------------|
523
- | **Normal** (DEFAULT) | `-n`, `--normal` | Single Claude, no agents | Default for most tasks |
524
- | **Swarm** | `-s`, `--swarm` | Multi-agent via Task tool | Complex multi-file changes |
525
- | **Hive-Mind** | `-h`, `--hive` | Consensus-based coordination | Architecture decisions, tradeoffs |
526
-
527
- ## Execution Mode Details
528
-
529
- ### SWARM Mode (-s, --swarm)
530
-
531
- When swarm is requested, you MUST use the Task tool to spawn agents. No exceptions.
532
-
533
- **Swarm spawns these agents via Task tool:**
534
- - `researcher` - Analyzes issue, searches memory, finds patterns
535
- - `coder` - Implements changes following plan
536
- - `tester` - Writes and runs tests
537
- - `/simplify` - Built-in command that reviews changed code before PR
538
- - `reviewer` - Reviews code before PR
539
-
540
- **Swarm execution pattern:**
541
- ```javascript
542
- // 1. Create task list FIRST
543
- TaskCreate({ subject: "Research issue #123", ... })
544
- TaskCreate({ subject: "Implement changes", ... })
545
- TaskCreate({ subject: "Test implementation", ... })
546
- TaskCreate({ subject: "Run /simplify on changed files", ... })
547
- TaskCreate({ subject: "Review and PR", ... })
548
-
549
- // 2. Init swarm
550
- Bash("npx flo swarm init --topology hierarchical --max-agents 8 --strategy specialized")
551
-
552
- // 3. Spawn agents with Task tool (run_in_background: true)
553
- Task({ prompt: "...", subagent_type: "researcher", run_in_background: true })
554
- Task({ prompt: "...", subagent_type: "coder", run_in_background: true })
555
-
556
- // 4. Wait for results, synthesize, continue
557
- ```
558
-
559
- ### HIVE-MIND Mode (-h, --hive)
560
-
561
- Use for consensus-based decisions:
562
- - Architecture choices
563
- - Approach tradeoffs
564
- - Design decisions with multiple valid options
565
-
566
- ### NORMAL Mode (Default)
567
-
568
- Single Claude execution without spawning sub-agents.
569
- - Still uses Task tool for tracking
570
- - Still creates tasks for visibility
571
- - Post-task neural learning hooks still fire
572
- - Just doesn't spawn multiple agents
573
-
574
- ---
575
-
576
- **Full mode executes without prompts.** It will:
577
- 1. Research the issue and codebase
578
- 2. Enhance the GitHub issue with implementation plan
579
- 3. Assign issue to self, add "in-progress" label
580
- 4. Create branch, implement, test
581
- 5. Run /simplify on changed code, re-test if changes made
582
- 6. Commit, create PR, update issue status
583
- 7. Store learnings
1
+ ---
2
+ name: flo
3
+ description: MoFlo ticket workflow - analyze and execute GitHub issues
4
+ arguments: "[options] <issue-number | title>"
5
+ ---
6
+
7
+ # /flo - MoFlo Ticket Workflow
8
+
9
+ Research, create tickets for, and execute GitHub issues automatically.
10
+
11
+ **Arguments:** $ARGUMENTS
12
+
13
+ ## Usage
14
+
15
+ ```
16
+ /flo <issue-number> # Full workflow in NORMAL mode (default)
17
+ /flo -t <issue-number> # Ticket only: research and update ticket, then STOP
18
+ /flo -t <title> # Create a NEW ticket with description, acceptance criteria, test cases
19
+ /flo --ticket <issue-number|title> # Same as -t
20
+ /flo -r <issue-number> # Research only: analyze issue, output findings
21
+ /flo --research <issue-number> # Same as -r
22
+ ```
23
+
24
+ Also available as `/fl` (shorthand alias).
25
+
26
+ ### Execution Mode (how work is done)
27
+
28
+ ```
29
+ /flo 123 # NORMAL mode (default) - single-agent execution
30
+ /flo -s 123 # SWARM mode - multi-agent coordination
31
+ /flo --swarm 123 # Same as -s
32
+ /flo -h 123 # HIVE-MIND mode - consensus-based coordination
33
+ /flo --hive 123 # Same as -h
34
+ /flo -n 123 # NORMAL mode - single Claude, no agents
35
+ /flo --normal 123 # Same as -n
36
+ ```
37
+
38
+ ### Epic Handling
39
+
40
+ ```
41
+ /flo 42 # If #42 is an epic, processes all stories sequentially
42
+ ```
43
+
44
+ **Epic Detection:** An issue is automatically detected as an epic if ANY of these are true:
45
+ - Has a label matching: `epic`, `tracking`, `parent`, or `umbrella` (case-insensitive)
46
+ - Body contains `## Stories` or `## Tasks` sections
47
+ - Body has checklist-linked issues: `- [ ] #123`
48
+ - Body has numbered issue references: `1. #123`
49
+ - The issue has GitHub sub-issues (via `subIssues` API field)
50
+
51
+ **Sequential Processing:** When an epic is selected:
52
+ 1. List all child stories/tasks (from checklist or linked issues)
53
+ 2. Process each story **one at a time** in order
54
+ 3. Each story goes through the full workflow (research -> ticket -> implement -> test -> PR)
55
+ 4. After each story's PR is created, move to the next story
56
+ 5. Continue until all stories are complete
57
+
58
+ ### Combined Examples
59
+
60
+ ```
61
+ /flo 123 # Normal + full workflow (default) - includes ALL tests
62
+ /flo 42 # If #42 is epic, processes stories sequentially
63
+ /flo -s 123 # Swarm + full workflow (multi-agent coordination)
64
+ /flo -t 123 # Normal + ticket only (no implementation)
65
+ /flo -h -t 123 # Hive-mind + ticket only
66
+ /flo -s -r 123 # Swarm + research only
67
+ /flo --swarm --ticket 123 # Explicit swarm + ticket only
68
+ /flo -n 123 # Normal (explicit, same as default)
69
+ ```
70
+
71
+ ## NORMAL MODE IS THE DEFAULT
72
+
73
+ By default, /flo runs in NORMAL mode — single-agent execution without
74
+ spawning sub-agents. This is efficient for most tasks.
75
+
76
+ Use `-s`/`--swarm` for multi-agent coordination when the task warrants it.
77
+ Use `-h`/`--hive` for consensus-based coordination on architecture decisions.
78
+
79
+ POST-TASK NEURAL LEARNING ALWAYS RUNS regardless of execution mode.
80
+ The hooks system collects learnings after every task completion — normal,
81
+ swarm, or hive-mind.
82
+
83
+ ## COMPREHENSIVE TESTING REQUIREMENT
84
+
85
+ ALL tests MUST pass BEFORE PR creation - NO EXCEPTIONS.
86
+ - Unit Tests: MANDATORY for all new/modified code
87
+ - Integration Tests: MANDATORY for API endpoints and services
88
+ - E2E Tests: MANDATORY for user-facing features
89
+ PR CANNOT BE CREATED until all relevant tests pass.
90
+
91
+ ## Workflow Overview
92
+
93
+ ```
94
+ Research -> Ticket -> Execute -> Testing -> Simplify -> PR+Done
95
+
96
+ Research: Fetch issue, search memory, read guidance, find files
97
+ Ticket: Create or update GitHub issue with description, acceptance criteria, test cases
98
+ Execute: Assign self, create branch, implement changes
99
+ Testing: Unit + Integration + E2E tests (ALL MUST PASS - gate)
100
+ Simplify: Run /simplify on changed code (gate - must run before PR)
101
+ PR+Done: Create PR, update issue status, store learnings
102
+ ```
103
+
104
+ ### Workflow Gates
105
+
106
+ | Gate | Requirement | Blocked Action |
107
+ |------|-------------|----------------|
108
+ | **Testing Gate** | Unit + Integration + E2E must pass | PR creation |
109
+ | **Simplification Gate** | /simplify must run on changed files | PR creation |
110
+
111
+ ### Execution Mode (applies to all phases)
112
+
113
+ | Mode | Description |
114
+ |------|-------------|
115
+ | **NORMAL** (default) | Single Claude execution. Efficient for most tasks. |
116
+ | **SWARM** (-s) | Multi-agent via Task tool: researcher, coder, tester, reviewer |
117
+ | **HIVE-MIND** (-h) | Consensus-based coordination for architecture decisions |
118
+
119
+ ## Phase 1: Research (-r or default first step)
120
+
121
+ ### 1.1 Fetch Issue Details
122
+ ```bash
123
+ gh issue view <issue-number> --json number,title,body,labels,state,assignees,comments,milestone
124
+ ```
125
+
126
+ ### 1.2 Check Ticket Status
127
+ Look for `## Acceptance Criteria` marker in issue body.
128
+ - **If present**: Ticket already enhanced, skip to execute or confirm
129
+ - **If absent**: Proceed with research and ticket update
130
+
131
+ ### 1.3 Search Memory FIRST
132
+ ALWAYS search memory BEFORE reading guidance or docs files.
133
+ Memory has file paths, context, and patterns - often all you need.
134
+ Only read guidance files if memory search returns zero relevant results.
135
+
136
+ ```bash
137
+ npx flo memory search --query "<issue title keywords>" --namespace patterns
138
+ npx flo memory search --query "<domain keywords>" --namespace guidance
139
+ ```
140
+
141
+ Or via MCP: `mcp__moflo__memory_search`
142
+
143
+ ### 1.4 Read Guidance Docs (ONLY if memory insufficient)
144
+ **Only if memory search returned < 3 relevant results**, read guidance files:
145
+ - Bug -> testing patterns, error handling
146
+ - Feature -> domain model, architecture
147
+ - UI -> frontend patterns, components
148
+
149
+ ### 1.5 Research Codebase
150
+ Use Task tool with Explore agent to find:
151
+ - Affected files and their current state
152
+ - Related code and dependencies
153
+ - Existing patterns to follow
154
+ - Test coverage gaps
155
+
156
+ ## Phase 2: Ticket (-t creates or updates a ticket)
157
+
158
+ When given an issue number, `-t` enhances the existing ticket. When given a title (non-numeric argument), `-t` creates a new GitHub issue. Either way, the ticket MUST include all three of the following sections.
159
+
160
+ ### 2.0 Complexity Assessment (MANDATORY before building ticket)
161
+
162
+ After research, assess the complexity of the work. This determines whether the issue stays as a single ticket or gets promoted to an epic with sub-issues.
163
+
164
+ **Complexity Signals — count how many apply:**
165
+
166
+ | Signal | Weight | Example |
167
+ |--------|--------|---------|
168
+ | Multiple files changed (5+) | +2 | Touches models, API, tests, docs, config |
169
+ | New module or package | +2 | Requires new directory structure |
170
+ | Cross-cutting concern | +2 | Auth, logging, error handling across layers |
171
+ | Database/schema changes | +2 | Migrations, new tables, index changes |
172
+ | Multiple independent work streams | +3 | Frontend + backend + infra changes |
173
+ | External API integration | +1 | Third-party service, webhook, OAuth |
174
+ | Breaking change / migration | +2 | Requires deprecation, data migration |
175
+ | Significant test surface | +1 | Needs 10+ new test cases across categories |
176
+ | Security implications | +1 | Authentication, authorization, input validation |
177
+ | UI + backend changes together | +2 | Full-stack feature spanning layers |
178
+
179
+ **Complexity Thresholds:**
180
+
181
+ | Score | Classification | Action |
182
+ |-------|---------------|--------|
183
+ | 0–3 | **Simple** | Single ticket — proceed normally |
184
+ | 4–6 | **Moderate** | Single ticket — flag in description that it may benefit from splitting |
185
+ | 7+ | **Complex** | **PROMOTE TO EPIC** — decompose into sub-issues |
186
+
187
+ **When promoting to epic:**
188
+
189
+ 1. Decompose the work into 2–6 independent, shippable stories
190
+ 2. Each story should be completable in a single PR
191
+ 3. Stories should have clear boundaries (one concern per story)
192
+ 4. Order stories by dependency (independent ones first)
193
+ 5. Create each story as a GitHub issue with its own Description, Acceptance Criteria, and Test Cases
194
+ 6. Create or convert the parent issue into an epic with a `## Stories` checklist
195
+
196
+ ```javascript
197
+ // Complexity assessment pseudocode
198
+ function assessComplexity(research) {
199
+ let score = 0;
200
+ if (research.affectedFiles.length >= 5) score += 2;
201
+ if (research.requiresNewModule) score += 2;
202
+ if (research.crossCutting) score += 2;
203
+ if (research.schemaChanges) score += 2;
204
+ if (research.independentWorkStreams >= 2) score += 3;
205
+ if (research.externalAPIs) score += 1;
206
+ if (research.breakingChanges) score += 2;
207
+ if (research.estimatedTestCases >= 10) score += 1;
208
+ if (research.securityImplications) score += 1;
209
+ if (research.fullStack) score += 2;
210
+ return score;
211
+ }
212
+ ```
213
+
214
+ ### 2.0.1 Epic Decomposition (when score >= 7)
215
+
216
+ When complexity warrants an epic, decompose into stories:
217
+
218
+ ```bash
219
+ # Step 1: Create each sub-issue
220
+ gh issue create --title "Story: <story-title>" --body "<## Description + ## Acceptance Criteria + ## Suggested Test Cases>" --label "story"
221
+ # Capture the new issue number from output
222
+
223
+ # Step 2: Repeat for all stories (2-6 stories typically)
224
+
225
+ # Step 3: Build the epic body with checklist referencing ALL story issue numbers
226
+ # Step 4: If updating an existing issue, convert it to epic:
227
+ gh issue edit <parent-number> --add-label "epic" --body "<epic body with ## Stories checklist>"
228
+
229
+ # Step 5: If creating new, create the epic:
230
+ gh issue create --title "Epic: <title>" --label "epic" --body "<epic body>"
231
+ ```
232
+
233
+ **Epic body format (MANDATORY — this is how tracking works):**
234
+
235
+ ```markdown
236
+ ## Overview
237
+ <High-level description of the epic goal>
238
+
239
+ ## Stories
240
+
241
+ - [ ] #<story-1-number> <story-1-title>
242
+ - [ ] #<story-2-number> <story-2-title>
243
+ - [ ] #<story-3-number> <story-3-title>
244
+
245
+ ## Complexity Assessment
246
+ Score: <N>/20 — <Simple|Moderate|Complex>
247
+ Signals: <list of signals that triggered>
248
+ ```
249
+
250
+ The `## Stories` checklist with `- [ ] #<number>` format is **mandatory** — this is what enables:
251
+ - Epic detection by the `/flo` skill
252
+ - Story extraction for sequential processing
253
+ - Progress tracking via checked/unchecked items
254
+
255
+ ### 2.1 Build Ticket Content
256
+ Compile research into a well-structured ticket. The issue MUST include all three of the following sections:
257
+
258
+ **Detailed Description** — Clear, thorough explanation of what needs to be done and why. Include:
259
+ - Root cause analysis (bugs) or approach rationale (features)
260
+ - Impact and risk factors
261
+ - Affected files (with line numbers), new files, deletions
262
+ - Implementation plan: numbered steps with clear actions, dependencies, decision points
263
+
264
+ **Acceptance Criteria** — Specific, testable conditions that must be true for this issue to be considered complete. Write as a checklist:
265
+ - [ ] Criterion 1 (e.g., "API returns 200 with valid token")
266
+ - [ ] Criterion 2 (e.g., "Error message shown when input exceeds 255 chars")
267
+ - [ ] ...each criterion must be independently verifiable
268
+
269
+ **Suggested Test Cases** — Concrete test scenarios covering happy path, edge cases, and error conditions:
270
+ - Test case 1: description, input, expected output
271
+ - Test case 2: description, input, expected output
272
+ - Include unit, integration, and E2E test suggestions as appropriate
273
+
274
+ ### 2.2 Create or Update GitHub Issue
275
+
276
+ **If issue number was given** (update existing):
277
+ ```bash
278
+ gh issue edit <issue-number> --body "<original body + ## Description + ## Acceptance Criteria + ## Suggested Test Cases>"
279
+ gh issue comment <issue-number> --body "Ticket enhanced with description, acceptance criteria, and test cases. Ready for execution."
280
+ ```
281
+
282
+ **If title was given** (create new):
283
+ ```bash
284
+ gh issue create --title "<title>" --body "<## Description + ## Acceptance Criteria + ## Suggested Test Cases>"
285
+ ```
286
+ Print the new issue URL so the user can see it.
287
+
288
+ ## Phase 3: Execute (default, runs automatically after ticket)
289
+
290
+ ### 3.1 Assign Issue and Update Status
291
+ ```bash
292
+ gh issue edit <issue-number> --add-assignee @me
293
+ gh issue edit <issue-number> --add-label "in-progress"
294
+ ```
295
+
296
+ ### 3.2 Create Branch
297
+ ```bash
298
+ git checkout main && git pull origin main
299
+ git checkout -b <type>/<issue-number>-<short-desc>
300
+ ```
301
+ Types: `feature/`, `fix/`, `refactor/`, `docs/`
302
+
303
+ ### 3.3 Implement
304
+ Follow the implementation plan from the ticket. No prompts - execute all steps.
305
+
306
+ ## Phase 4: Testing (MANDATORY GATE)
307
+
308
+ This is NOT optional. ALL applicable test types must pass for the change type.
309
+ WORKFLOW STOPS HERE until tests pass. No shortcuts. No exceptions.
310
+
311
+ ### 4.1 Write and Run Tests
312
+ Write unit, integration, and E2E tests as appropriate for the change type.
313
+ Follow the project's established test style, runner, and patterns. If no existing tests or test guidance is present, choose the best options for the project's language and stack, taking compatibility with existing dependencies into account.
314
+
315
+ ### 4.2 Test Auto-Fix Loop
316
+ If any tests fail, enter the auto-fix loop (max 3 retries OR 10 minutes):
317
+ 1. Run all tests
318
+ 2. If ALL pass -> proceed to simplification
319
+ 3. If ANY fail: analyze failure, fix test or implementation code, retry
320
+ 4. If retries exhausted -> STOP and report to user
321
+
322
+ ## Phase 4.5: Code Simplification (MANDATORY)
323
+
324
+ The built-in /simplify command reviews ALL changed code for:
325
+ - Reuse opportunities and code quality
326
+ - Efficiency improvements
327
+ - Consistency with existing codebase patterns
328
+ - Preserves ALL functionality - no behavior changes
329
+
330
+ If /simplify makes changes -> re-run tests to confirm nothing broke.
331
+ If re-tests fail -> revert changes, proceed with original code.
332
+
333
+ ## Phase 5: Commit and PR (only after tests pass)
334
+
335
+ ### 5.1 Commit
336
+ ```bash
337
+ git add <specific files>
338
+ git commit -m "type(scope): description
339
+
340
+ Closes #<issue-number>
341
+
342
+ Co-Authored-By: Claude <noreply@anthropic.com>"
343
+ ```
344
+
345
+ ### 5.2 Create PR
346
+ ```bash
347
+ git push -u origin <branch-name>
348
+ gh pr create --title "type(scope): description" --body "## Summary
349
+ <brief description>
350
+
351
+ ## Changes
352
+ <bullet list>
353
+
354
+ ## Testing
355
+ - [x] Unit tests pass
356
+ - [x] Integration tests pass
357
+ - [x] E2E tests pass
358
+ - [ ] Manual testing done
359
+
360
+ Closes #<issue-number>"
361
+ ```
362
+
363
+ ### 5.3 Update Issue Status
364
+ ```bash
365
+ gh issue edit <issue-number> --remove-label "in-progress" --add-label "ready-for-review"
366
+ gh issue comment <issue-number> --body "PR created: <pr-url>"
367
+ ```
368
+
369
+ ## Epic Handling
370
+
371
+ ### Detecting Epics
372
+
373
+ An issue is an **epic** if:
374
+ 1. It has the `epic` label, OR
375
+ 2. Its body contains `## Stories` or `## Tasks` sections, OR
376
+ 3. It has linked child issues (via `- [ ] #123` checklist format)
377
+
378
+ ### Epic Processing Flow
379
+
380
+ 1. DETECT EPIC - Check labels, parse body for ## Stories / ## Tasks, extract issue references
381
+ 2. LIST ALL STORIES - Extract from checklist, order top-to-bottom as listed
382
+ 3. SEQUENTIAL PROCESSING - For each story:
383
+ a. Run full /flo workflow (research -> ticket -> implement -> test -> PR)
384
+ b. After PR is created, **check off the story** in the epic body
385
+ c. Move to the next unchecked story
386
+ 4. COMPLETION - All stories checked off, epic marked as ready-for-review
387
+
388
+ ONE STORY AT A TIME - NO PARALLEL STORY EXECUTION.
389
+ Each story must complete (PR created) before starting next.
390
+
391
+ ### Epic Checklist Tracking (MANDATORY)
392
+
393
+ After each story's PR is created, update the epic body to check off that story:
394
+
395
+ ```bash
396
+ # 1. Fetch current epic body
397
+ EPIC_BODY=$(gh issue view <epic-number> --json body -q '.body')
398
+
399
+ # 2. Replace "- [ ] #<story-number>" with "- [x] #<story-number>"
400
+ UPDATED_BODY=$(echo "$EPIC_BODY" | sed 's/- \[ \] #<story-number>/- [x] #<story-number>/')
401
+
402
+ # 3. Update the epic
403
+ gh issue edit <epic-number> --body "$UPDATED_BODY"
404
+
405
+ # 4. Comment on the epic with progress
406
+ gh issue comment <epic-number> --body "✅ Story #<story-number> completed — PR: <pr-url>"
407
+ ```
408
+
409
+ This applies to ALL epics, regardless of how they were created:
410
+ - Epics created by `/flo -t` complexity promotion
411
+ - Epics created manually by users
412
+ - Epics detected from existing issues
413
+
414
+ The checklist state (`[ ]` vs `[x]`) is the **single source of truth** for epic progress.
415
+
416
+ ### Epic Detection Code
417
+
418
+ ```javascript
419
+ function isEpic(issue) {
420
+ // Label-based detection (case-insensitive)
421
+ const epicLabels = ['epic', 'tracking', 'parent', 'umbrella'];
422
+ if (issue.labels?.some(l => epicLabels.includes(l.name.toLowerCase()))) return true;
423
+ // Section-based detection
424
+ if (issue.body?.includes('## Stories') || issue.body?.includes('## Tasks')) return true;
425
+ // Checklist-linked issues: - [ ] #123 or - [x] #123
426
+ if (/- \[[ x]\] #\d+/.test(issue.body)) return true;
427
+ // Numbered issue references: 1. #123
428
+ if (/\d+\.\s+#\d+/.test(issue.body)) return true;
429
+ // GitHub sub-issues API
430
+ if (issue.subIssues?.length > 0) return true;
431
+ return false;
432
+ }
433
+
434
+ function extractStories(epicBody) {
435
+ const stories = [];
436
+ // Checklist format: - [ ] #123
437
+ const checklistPattern = /- \[[ ]\] #(\d+)/g;
438
+ let match;
439
+ while ((match = checklistPattern.exec(epicBody)) !== null) {
440
+ stories.push(parseInt(match[1]));
441
+ }
442
+ // Numbered format: 1. #123
443
+ if (stories.length === 0) {
444
+ const numberedPattern = /\d+\.\s+#(\d+)/g;
445
+ while ((match = numberedPattern.exec(epicBody)) !== null) {
446
+ stories.push(parseInt(match[1]));
447
+ }
448
+ }
449
+ return stories;
450
+ }
451
+ ```
452
+
453
+ ## Parse Arguments
454
+
455
+ ```javascript
456
+ const args = "$ARGUMENTS".trim().split(/\s+/);
457
+ let workflowMode = "full"; // full, ticket, research
458
+ let execMode = "normal"; // normal (default), swarm, hive
459
+ let issueNumber = null;
460
+ let titleWords = [];
461
+
462
+ for (let i = 0; i < args.length; i++) {
463
+ const arg = args[i];
464
+
465
+ // Workflow mode (what to do)
466
+ if (arg === "-t" || arg === "--ticket") {
467
+ workflowMode = "ticket";
468
+ } else if (arg === "-r" || arg === "--research") {
469
+ workflowMode = "research";
470
+ }
471
+
472
+ // Execution mode (how to do it)
473
+ else if (arg === "-s" || arg === "--swarm") {
474
+ execMode = "swarm";
475
+ } else if (arg === "-h" || arg === "--hive") {
476
+ execMode = "hive";
477
+ } else if (arg === "-n" || arg === "--normal") {
478
+ execMode = "normal";
479
+ }
480
+
481
+ // Issue number or title text
482
+ else if (/^\d+$/.test(arg)) {
483
+ issueNumber = arg;
484
+ } else {
485
+ // Non-flag, non-numeric argument — collect as title words
486
+ titleWords.push(arg);
487
+ }
488
+ }
489
+
490
+ // In ticket mode, a title can be given instead of an issue number
491
+ let ticketTitle = titleWords.join(" ");
492
+ if (!issueNumber && !ticketTitle) {
493
+ throw new Error("Issue number or title required. Usage: /flo <issue-number | title>");
494
+ }
495
+ if (!issueNumber && workflowMode !== "ticket") {
496
+ throw new Error("Issue number required for full/research mode. Use -t for new tickets.");
497
+ }
498
+
499
+ // Log execution mode to prevent silent skipping
500
+ console.log("Execution mode: " + execMode.toUpperCase());
501
+ if (execMode === "swarm") {
502
+ console.log("SWARM MODE: Will spawn agents via Task tool. Do NOT skip this.");
503
+ }
504
+ console.log("TESTING: Unit + Integration + E2E tests REQUIRED before PR.");
505
+ console.log("SIMPLIFY: /simplify command runs on changed code before PR.");
506
+ ```
507
+
508
+ ## Execution Flow
509
+
510
+ ### Workflow Modes (what to do)
511
+
512
+ | Mode | Command | Steps | Stops After |
513
+ |------|---------|-------|-------------|
514
+ | **Full** (default) | `/flo 123` | Research -> Ticket -> Implement -> Test -> Simplify -> PR | PR created |
515
+ | **Epic** | `/flo 42` (epic) | For each story: Full workflow sequentially | All story PRs created |
516
+ | **Ticket** | `/flo -t 123` | Research -> Ticket | Issue updated |
517
+ | **Research** | `/flo -r 123` | Research | Findings output |
518
+
519
+ ### Execution Modes (how to do it)
520
+
521
+ | Mode | Flag | Description | When to Use |
522
+ |------|------|-------------|-------------|
523
+ | **Normal** (DEFAULT) | `-n`, `--normal` | Single Claude, no agents | Default for most tasks |
524
+ | **Swarm** | `-s`, `--swarm` | Multi-agent via Task tool | Complex multi-file changes |
525
+ | **Hive-Mind** | `-h`, `--hive` | Consensus-based coordination | Architecture decisions, tradeoffs |
526
+
527
+ ## Execution Mode Details
528
+
529
+ ### SWARM Mode (-s, --swarm)
530
+
531
+ When swarm is requested, you MUST use the Task tool to spawn agents. No exceptions.
532
+
533
+ **Swarm spawns these agents via Task tool:**
534
+ - `researcher` - Analyzes issue, searches memory, finds patterns
535
+ - `coder` - Implements changes following plan
536
+ - `tester` - Writes and runs tests
537
+ - `/simplify` - Built-in command that reviews changed code before PR
538
+ - `reviewer` - Reviews code before PR
539
+
540
+ **Swarm execution pattern:**
541
+ ```javascript
542
+ // 1. Create task list FIRST
543
+ TaskCreate({ subject: "Research issue #123", ... })
544
+ TaskCreate({ subject: "Implement changes", ... })
545
+ TaskCreate({ subject: "Test implementation", ... })
546
+ TaskCreate({ subject: "Run /simplify on changed files", ... })
547
+ TaskCreate({ subject: "Review and PR", ... })
548
+
549
+ // 2. Init swarm
550
+ Bash("npx flo swarm init --topology hierarchical --max-agents 8 --strategy specialized")
551
+
552
+ // 3. Spawn agents with Task tool (run_in_background: true)
553
+ Task({ prompt: "...", subagent_type: "researcher", run_in_background: true })
554
+ Task({ prompt: "...", subagent_type: "coder", run_in_background: true })
555
+
556
+ // 4. Wait for results, synthesize, continue
557
+ ```
558
+
559
+ ### HIVE-MIND Mode (-h, --hive)
560
+
561
+ Use for consensus-based decisions:
562
+ - Architecture choices
563
+ - Approach tradeoffs
564
+ - Design decisions with multiple valid options
565
+
566
+ ### NORMAL Mode (Default)
567
+
568
+ Single Claude execution without spawning sub-agents.
569
+ - Still uses Task tool for tracking
570
+ - Still creates tasks for visibility
571
+ - Post-task neural learning hooks still fire
572
+ - Just doesn't spawn multiple agents
573
+
574
+ ---
575
+
576
+ **Full mode executes without prompts.** It will:
577
+ 1. Research the issue and codebase
578
+ 2. Enhance the GitHub issue with implementation plan
579
+ 3. Assign issue to self, add "in-progress" label
580
+ 4. Create branch, implement, test
581
+ 5. Run /simplify on changed code, re-test if changes made
582
+ 6. Commit, create PR, update issue status
583
+ 7. Store learnings