moflo 4.8.78 → 4.8.80-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/.claude/skills/fl/SKILL.md +40 -456
  2. package/.claude/skills/fl/epic.md +48 -0
  3. package/.claude/skills/fl/execution-modes.md +48 -0
  4. package/.claude/skills/fl/phases.md +153 -0
  5. package/.claude/skills/fl/spell-engine.md +48 -0
  6. package/.claude/skills/fl/ticket.md +114 -0
  7. package/README.md +88 -5
  8. package/package.json +2 -2
  9. package/src/modules/cli/dist/src/commands/daemon.js +94 -21
  10. package/src/modules/cli/dist/src/commands/spell-schedule.js +4 -1
  11. package/src/modules/cli/dist/src/commands/spell.js +86 -4
  12. package/src/modules/cli/dist/src/config/moflo-config.js +53 -0
  13. package/src/modules/cli/dist/src/mcp-tools/spell-tools.js +4 -12
  14. package/src/modules/cli/dist/src/services/daemon-dashboard.js +175 -22
  15. package/src/modules/cli/dist/src/services/daemon-readiness.js +9 -8
  16. package/src/modules/cli/dist/src/services/daemon-scheduler-bootstrap.js +38 -0
  17. package/src/modules/cli/dist/src/services/daemon-spell-executor.js +90 -0
  18. package/src/modules/cli/dist/src/services/grimoire-builder.js +40 -0
  19. package/src/modules/cli/dist/src/services/worker-daemon.js +70 -0
  20. package/src/modules/cli/dist/src/version.js +1 -1
  21. package/src/modules/cli/package.json +1 -1
  22. package/src/modules/hooks/dist/reasoningbank/index.js +47 -0
  23. package/src/modules/spells/dist/commands/graph-command.js +67 -0
  24. package/src/modules/spells/dist/commands/imap-command.js +127 -0
  25. package/src/modules/spells/dist/commands/index.js +9 -1
  26. package/src/modules/spells/dist/commands/mcp-command.js +88 -0
  27. package/src/modules/spells/dist/commands/outlook-command.js +9 -1
  28. package/src/modules/spells/dist/commands/prompt-command.js +88 -9
  29. package/src/modules/spells/dist/commands/slack-command.js +85 -0
  30. package/src/modules/spells/dist/connectors/graph-auth.js +167 -0
  31. package/src/modules/spells/dist/connectors/graph.js +241 -0
  32. package/src/modules/spells/dist/connectors/imap.js +305 -0
  33. package/src/modules/spells/dist/connectors/index.js +9 -1
  34. package/src/modules/spells/dist/connectors/local-outlook.js +83 -19
  35. package/src/modules/spells/dist/connectors/mcp-client.js +274 -0
  36. package/src/modules/spells/dist/connectors/shared/optional-import.js +49 -0
  37. package/src/modules/spells/dist/connectors/slack.js +209 -0
  38. package/src/modules/spells/dist/core/docker-sandbox.js +54 -3
  39. package/src/modules/spells/dist/scheduler/scheduler.js +110 -16
  40. package/src/modules/spells/package.json +5 -0
@@ -13,13 +13,11 @@ Research, create tickets for, and execute GitHub issues automatically.
13
13
  ## Usage
14
14
 
15
15
  ```
16
- /flo <issue-number> # Full spell 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
- /flo --epic-branch <branch> <issue> # Epic mode: commit to existing branch, skip branch creation and PR
16
+ /flo <issue-number> # Full spell in NORMAL mode (default)
17
+ /flo -t | --ticket <issue-number> # Ticket only: research and update existing ticket, then STOP
18
+ /flo -t | --ticket <title> # Create a NEW ticket with description, acceptance criteria, test cases
19
+ /flo -r | --research <issue-number> # Research only: analyze issue, output findings
20
+ /flo --epic-branch <branch> <issue> # Epic mode: commit to existing branch, skip branch creation and PR
23
21
  ```
24
22
 
25
23
  Also available as `/fl` (shorthand alias).
@@ -27,22 +25,18 @@ Also available as `/fl` (shorthand alias).
27
25
  ### Spell Engine Mode (-wf)
28
26
 
29
27
  ```
30
- /flo -wf sa ./src # Run security-audit spell with target=./src
31
- /flo -wf security-audit ./src # Same, using full name
32
- /flo -wf list # List available spells
33
- /flo -wf info sa # Show spell details, arguments, steps
28
+ /flo -wf <name|abbreviation> [args] # Run a spell (e.g. `-wf sa ./src` or `-wf security-audit ./src`)
29
+ /flo -wf list # List available spells
30
+ /flo -wf info <name|abbreviation> # Show spell details, arguments, steps
34
31
  ```
35
32
 
36
33
  ### Execution Mode (how work is done)
37
34
 
38
35
  ```
39
36
  /flo 123 # NORMAL mode (default) - single-agent execution
40
- /flo -s 123 # SWARM mode - multi-agent coordination
41
- /flo --swarm 123 # Same as -s
42
- /flo -h 123 # HIVE-MIND mode - consensus-based coordination
43
- /flo --hive 123 # Same as -h
44
- /flo -n 123 # NORMAL mode - single Claude, no agents
45
- /flo --normal 123 # Same as -n
37
+ /flo -s | --swarm 123 # SWARM mode - multi-agent coordination via Task tool
38
+ /flo -h | --hive 123 # HIVE-MIND mode - consensus-based coordination
39
+ /flo -n | --normal 123 # NORMAL mode - explicit single-Claude, no agents
46
40
  ```
47
41
 
48
42
  ### Epic Handling
@@ -58,13 +52,7 @@ Also available as `/fl` (shorthand alias).
58
52
  - Body has numbered issue references: `1. #123`
59
53
  - The issue has GitHub sub-issues (via `subIssues` API field)
60
54
 
61
- **Epic processing:** When an epic is detected, use the same logic as `flo epic run`:
62
- 1. Extract stories using detection from `src/modules/cli/src/epic/detection.ts`
63
- 2. Determine strategy from `moflo.yaml` config (`epic.default_strategy`), defaulting to `single-branch`
64
- 3. For **single-branch**: create shared `epic/<number>-<slug>` branch, process each story via `/flo --epic-branch <branch> <issue>`, then create one consolidated PR
65
- 4. For **auto-merge**: process each story via `/flo <issue>`, merge its PR, then proceed to next
66
-
67
- Individual stories within an epic are still processed via `/flo --epic-branch <branch> <issue>` (for single-branch) or `/flo <issue>` (for auto-merge).
55
+ When an epic is detected, processing runs inline (no shell-out) using `flo epic run` logic. **Read `./epic.md` before proceeding** — it has the strategy selection, branch handling, and checklist tracking details.
68
56
 
69
57
  ## Workflow Overview
70
58
 
@@ -96,330 +84,19 @@ PR+Done: Create PR, update issue status
96
84
  | **SWARM** (-s) | Multi-agent via Task tool: researcher, coder, tester, reviewer |
97
85
  | **HIVE-MIND** (-h) | Consensus-based coordination for architecture decisions |
98
86
 
99
- ## Phase 1: Research (-r or default first step)
100
-
101
- ### 1.1 Fetch Issue Details
102
- ```bash
103
- gh issue view <issue-number> --json number,title,body,labels,state,assignees,comments,milestone
104
- ```
105
-
106
- ### 1.2 Check Ticket Status
107
- Look for `## Acceptance Criteria` marker in issue body.
108
- - **If present**: Ticket already enhanced, skip to execute or confirm
109
- - **If absent**: Proceed with research and ticket update
110
-
111
- ### 1.3 Search Memory FIRST
112
- ALWAYS search memory BEFORE reading guidance or docs files.
113
- Memory has file paths, context, and patterns - often all you need.
114
- Only read guidance files if memory search returns zero relevant results.
115
-
116
- ```bash
117
- flo memory search --query "<issue title keywords>" --namespace patterns
118
- flo memory search --query "<domain keywords>" --namespace guidance
119
- ```
120
-
121
- Or via MCP: `mcp__moflo__memory_search`
122
-
123
- ### 1.4 Read Guidance Docs (ONLY if memory insufficient)
124
- **Only if memory search returned < 3 relevant results**, read guidance files:
125
- - Bug -> testing patterns, error handling
126
- - Feature -> domain model, architecture
127
- - UI -> frontend patterns, components
128
-
129
- ### 1.5 Research Codebase
130
- Use Task tool with Explore agent to find:
131
- - Affected files and their current state
132
- - Related code and dependencies
133
- - Existing patterns to follow
134
- - Test coverage gaps
135
-
136
- ## Phase 2: Ticket (-t creates or updates a ticket)
137
-
138
- 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.
139
-
140
- ### 2.0 Complexity Assessment (MANDATORY before building ticket)
141
-
142
- 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.
143
-
144
- **Complexity Signals — count how many apply:**
145
-
146
- | Signal | Weight | Example |
147
- |--------|--------|---------|
148
- | Multiple files changed (5+) | +2 | Touches models, API, tests, docs, config |
149
- | New module or package | +2 | Requires new directory structure |
150
- | Cross-cutting concern | +2 | Auth, logging, error handling across layers |
151
- | Database/schema changes | +2 | Migrations, new tables, index changes |
152
- | Multiple independent work streams | +3 | Frontend + backend + infra changes |
153
- | External API integration | +1 | Third-party service, webhook, OAuth |
154
- | Breaking change / migration | +2 | Requires deprecation, data migration |
155
- | Significant test surface | +1 | Needs 10+ new test cases across categories |
156
- | Security implications | +1 | Authentication, authorization, input validation |
157
- | UI + backend changes together | +2 | Full-stack feature spanning layers |
158
-
159
- **Complexity Thresholds:**
160
-
161
- | Score | Classification | Action |
162
- |-------|---------------|--------|
163
- | 0–3 | **Simple** | Single ticket — proceed normally |
164
- | 4–6 | **Moderate** | Single ticket — flag in description that it may benefit from splitting |
165
- | 7+ | **Complex** | **PROMOTE TO EPIC** — decompose into sub-issues |
166
-
167
- **When promoting to epic:**
168
-
169
- 1. Decompose the work into 2–6 independent, shippable stories
170
- 2. Each story should be completable in a single PR
171
- 3. Stories should have clear boundaries (one concern per story)
172
- 4. Order stories by dependency (independent ones first)
173
- 5. Create each story as a GitHub issue with its own Description, Acceptance Criteria, and Test Cases
174
- 6. Create or convert the parent issue into an epic with a `## Stories` checklist
175
-
176
- ```javascript
177
- // Complexity assessment pseudocode
178
- function assessComplexity(research) {
179
- let score = 0;
180
- if (research.affectedFiles.length >= 5) score += 2;
181
- if (research.requiresNewModule) score += 2;
182
- if (research.crossCutting) score += 2;
183
- if (research.schemaChanges) score += 2;
184
- if (research.independentWorkStreams >= 2) score += 3;
185
- if (research.externalAPIs) score += 1;
186
- if (research.breakingChanges) score += 2;
187
- if (research.estimatedTestCases >= 10) score += 1;
188
- if (research.securityImplications) score += 1;
189
- if (research.fullStack) score += 2;
190
- return score;
191
- }
192
- ```
193
-
194
- ### 2.0.1 Epic Decomposition (when score >= 7)
195
-
196
- When complexity warrants an epic, decompose into stories:
197
-
198
- ```bash
199
- # Step 1: Create each sub-issue
200
- gh issue create --title "Story: <story-title>" --body "<## Description + ## Acceptance Criteria + ## Suggested Test Cases>" --label "story"
201
- # Capture the new issue number from output
202
-
203
- # Step 2: Repeat for all stories (2-6 stories typically)
204
-
205
- # Step 3: Build the epic body with checklist referencing ALL story issue numbers
206
- # Step 4: If updating an existing issue, convert it to epic:
207
- gh issue edit <parent-number> --add-label "epic" --body "<epic body with ## Stories checklist>"
208
-
209
- # Step 5: If creating new, create the epic:
210
- gh issue create --title "Epic: <title>" --label "epic" --body "<epic body>"
211
- ```
212
-
213
- **Epic body format (MANDATORY — this is how tracking works):**
214
-
215
- ```markdown
216
- ## Overview
217
- <High-level description of the epic goal>
218
-
219
- ## Stories
220
-
221
- - [ ] #<story-1-number> <story-1-title>
222
- - [ ] #<story-2-number> <story-2-title>
223
- - [ ] #<story-3-number> <story-3-title>
224
-
225
- ## Complexity Assessment
226
- Score: <N>/20 — <Simple|Moderate|Complex>
227
- Signals: <list of signals that triggered>
228
- ```
229
-
230
- The `## Stories` checklist with `- [ ] #<number>` format is **mandatory** — this is what enables:
231
- - Epic detection by the `/flo` skill
232
- - Story extraction for sequential processing
233
- - Progress tracking via checked/unchecked items
234
-
235
- ### 2.1 Build Ticket Content
236
- Compile research into a well-structured ticket. The issue MUST include all three of the following sections:
237
-
238
- **Detailed Description** — Clear, thorough explanation of what needs to be done and why. Include:
239
- - Root cause analysis (bugs) or approach rationale (features)
240
- - Impact and risk factors
241
- - Affected files (with line numbers), new files, deletions
242
- - Implementation plan: numbered steps with clear actions, dependencies, decision points
243
-
244
- **Acceptance Criteria** — Specific, testable conditions that must be true for this issue to be considered complete. Write as a checklist:
245
- - [ ] Criterion 1 (e.g., "API returns 200 with valid token")
246
- - [ ] Criterion 2 (e.g., "Error message shown when input exceeds 255 chars")
247
- - [ ] ...each criterion must be independently verifiable
248
-
249
- **Suggested Test Cases** — Concrete test scenarios covering happy path, edge cases, and error conditions:
250
- - Test case 1: description, input, expected output
251
- - Test case 2: description, input, expected output
252
- - Include unit, integration, and E2E test suggestions as appropriate
253
-
254
- ### 2.2 Create or Update GitHub Issue
255
-
256
- **If issue number was given** (update existing):
257
- ```bash
258
- gh issue edit <issue-number> --body "<original body + ## Description + ## Acceptance Criteria + ## Suggested Test Cases>"
259
- gh issue comment <issue-number> --body "Ticket enhanced with description, acceptance criteria, and test cases. Ready for execution."
260
- ```
261
-
262
- **If title was given** (create new):
263
- ```bash
264
- gh issue create --title "<title>" --body "<## Description + ## Acceptance Criteria + ## Suggested Test Cases>"
265
- ```
266
- Print the new issue URL so the user can see it.
267
-
268
- ## Phase 3: Execute (default, runs automatically after ticket)
269
-
270
- ### 3.1 Assign Issue and Update Status
271
- ```bash
272
- gh issue edit <issue-number> --add-assignee @me
273
- gh issue edit <issue-number> --add-label "in-progress"
274
- ```
275
-
276
- ### 3.2 Create Branch
277
-
278
- **If `--epic-branch <branch>` was passed** (epic mode):
279
- Skip branch creation entirely. The epic orchestrator has already created and checked out the shared epic branch. Just verify you're on it:
280
- ```bash
281
- git branch --show-current # Should match the epic branch name
282
- ```
283
-
284
- **Otherwise** (normal mode):
285
- ```bash
286
- git checkout main && git pull origin main
287
- git checkout -b <type>/<issue-number>-<short-desc>
288
- ```
289
- Types: `feature/`, `fix/`, `refactor/`, `docs/`
290
-
291
- ### 3.3 Implement
292
- Follow the implementation plan from the ticket. No prompts - execute all steps.
293
-
294
- ## Phase 4: Testing (MANDATORY GATE)
295
-
296
- This is NOT optional. ALL applicable test types must pass for the change type.
297
- WORKFLOW STOPS HERE until tests pass. No shortcuts. No exceptions.
298
-
299
- ### 4.1 Write and Run Tests
300
- Write unit, integration, and E2E tests as appropriate for the change type.
301
- 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.
302
-
303
- ### 4.2 Test Auto-Fix Loop
304
- If any tests fail, enter the auto-fix loop (max 3 retries OR 10 minutes):
305
- 1. Run all tests
306
- 2. If ALL pass -> proceed to simplification
307
- 3. If ANY fail: analyze failure, fix test or implementation code, retry
308
- 4. If retries exhausted -> STOP and report to user
309
-
310
- ## Phase 4.5: Code Simplification (MANDATORY)
87
+ ## Companion Files (progressive disclosure)
311
88
 
312
- The built-in /simplify command reviews ALL changed code for:
313
- - Reuse opportunities and code quality
314
- - Efficiency improvements
315
- - Consistency with existing codebase patterns
316
- - Preserves ALL functionality - no behavior changes
89
+ This skill is split across focused files. **You MUST read the relevant companion file before executing that phase or mode** — the details are not repeated here.
317
90
 
318
- If /simplify makes changes -> re-run tests to confirm nothing broke.
319
- If re-tests fail -> revert changes, proceed with original code.
91
+ | File | Read when |
92
+ |------|-----------|
93
+ | `./phases.md` | Executing any full-run step: Research (Phase 1), Execute (Phase 3), Testing (Phase 4), Simplify (Phase 4.5), Commit/PR (Phase 5) |
94
+ | `./ticket.md` | Running `-t`, or whenever Phase 2 applies (complexity scoring, ticket content, epic promotion) |
95
+ | `./epic.md` | Processing a detected epic (strategies, inline orchestration, checklist tracking) |
96
+ | `./execution-modes.md` | Any `-s` / `--swarm` or `-h` / `--hive` invocation, or the details of NORMAL mode |
97
+ | `./spell-engine.md` | Any `-wf` / `--workflow` invocation (list, info, execute) |
320
98
 
321
- ## Phase 5: Commit and PR (only after tests pass)
322
-
323
- ### 5.1 Commit
324
- ```bash
325
- git add <specific files>
326
- git commit -m "type(scope): description
327
-
328
- Closes #<issue-number>
329
-
330
- Co-Authored-By: Claude <noreply@anthropic.com>"
331
- ```
332
-
333
- ### 5.2 Store Learnings (REQUIRED — gate blocks PR creation until this runs)
334
-
335
- Before creating a PR, store what was learned using `mcp__moflo__memory_store`.
336
- The `check-before-pr` gate will **block** `gh pr create` if this step is skipped.
337
-
338
- ```
339
- mcp__moflo__memory_store:
340
- key: "pattern:<topic>"
341
- namespace: "patterns"
342
- value: "<what was learned: files changed, patterns used, decisions made>"
343
- tags: ["<relevant-tags>"]
344
- ```
345
-
346
- This must happen BEFORE `gh pr create` — not after.
347
-
348
- ### 5.3 Create PR
349
-
350
- **If `--epic-branch` was passed** (epic mode):
351
- **SKIP PR creation entirely.** The commit from 5.1 (with `Closes #<issue-number>`) is sufficient.
352
- The epic orchestrator will create a single consolidated PR after all stories complete.
353
- Also skip pushing — the epic orchestrator handles the final push.
354
-
355
- Proceed directly to 5.4 (update issue status only).
356
-
357
- **Otherwise** (normal mode):
358
- ```bash
359
- git push -u origin <branch-name>
360
- gh pr create --title "type(scope): description" --body "## Summary
361
- <brief description>
362
-
363
- ## Changes
364
- <bullet list>
365
-
366
- ## Testing
367
- - [x] Unit tests pass
368
- - [x] Integration tests pass
369
- - [x] E2E tests pass
370
- - [ ] Manual testing done
371
-
372
- Closes #<issue-number>"
373
- ```
374
-
375
- ### 5.4 Update Issue Status
376
- ```bash
377
- gh issue edit <issue-number> --remove-label "in-progress" --add-label "ready-for-review"
378
- gh issue comment <issue-number> --body "PR created: <pr-url>"
379
- ```
380
-
381
- ## Epic Handling
382
-
383
- ### Unified Epic Processing
384
-
385
- When `/flo <issue>` detects an epic, it follows the same orchestration logic as `flo epic run`.
386
- The `/flo` skill does NOT shell out — it processes the epic inline within the current Claude session,
387
- following the strategy steps described below. This keeps the full context (memory, guidance, session state)
388
- available throughout story processing.
389
-
390
- Epic detection criteria are listed under **Usage > Epic Handling** above.
391
- Detection uses `isEpicIssue()` from `src/modules/cli/src/epic/detection.ts`.
392
-
393
- ### Epic Strategies
394
-
395
- | Strategy | Default | Description |
396
- |----------|---------|-------------|
397
- | `single-branch` | **Yes** | One shared branch, one commit per story, one PR at the end |
398
- | `auto-merge` | No | Per-story branches and PRs, each auto-merged before the next story |
399
-
400
- Strategy is determined by (in priority order):
401
- 1. CLI flag: `--strategy auto-merge`
402
- 2. Feature definition: `strategy` field in YAML
403
- 3. Config: `epic.default_strategy` in `moflo.yaml`
404
- 4. Default: `single-branch`
405
-
406
- ### How It Works
407
-
408
- The `flo epic run` command:
409
- 1. Fetches the epic issue and validates it
410
- 2. Extracts and orders stories (topological sort for dependencies)
411
- 3. Loads the appropriate spell YAML template
412
- 4. Runs via the spell engine (SpellRunner)
413
- 5. The spell template handles branch creation, story iteration, PR creation, and checklist tracking
414
-
415
- Individual stories within an epic are processed via `/flo --epic-branch <branch> <issue>`,
416
- which the spell engine invokes automatically. The `--epic-branch` flag tells `/flo` to
417
- commit to the existing branch and skip branch creation and PR creation.
418
-
419
- ### Epic Checklist Tracking
420
-
421
- The spell templates automatically check off stories in the epic body after each commit.
422
- The checklist state (`[ ]` vs `[x]`) is the **single source of truth** for epic progress.
99
+ Do not guess at companion content read the file. This is a hard requirement, not a suggestion.
423
100
 
424
101
  ## Parse Arguments
425
102
 
@@ -537,119 +214,26 @@ if (workflowMode === "spell-engine") {
537
214
 
538
215
  ### Workflow Modes (what to do)
539
216
 
540
- | Mode | Command | Steps | Stops After |
541
- |------|---------|-------|-------------|
542
- | **Full** (default) | `/flo 123` | Research -> Ticket -> Implement -> Test -> Simplify -> PR | PR created |
543
- | **Epic** | `/flo 42` (epic) | Inline epic processing: extract stories, run each via /flo | All stories complete |
544
- | **Ticket** | `/flo -t 123` | Research -> Ticket | Issue updated |
545
- | **Research** | `/flo -r 123` | Research | Findings output |
546
- | **Workflow** | `/flo -wf sa ./src` | Load registry -> Resolve spell -> Execute with args | Spell complete |
547
- | **WF List** | `/flo -wf list` | Load registry -> Print all spells | List printed |
548
- | **WF Info** | `/flo -wf info sa` | Load registry -> Print spell details | Info printed |
549
-
550
- Execution modes (normal/swarm/hive) are defined in the table under **Workflow Overview > Execution Mode** above.
551
-
552
- ## Execution Mode Details
553
-
554
- ### SWARM Mode (-s, --swarm)
555
-
556
- When swarm is requested, you MUST use the Task tool to spawn agents. No exceptions.
557
-
558
- **Swarm spawns these agents via Task tool:**
559
- - `researcher` - Analyzes issue, searches memory, finds patterns
560
- - `coder` - Implements changes following plan
561
- - `tester` - Writes and runs tests
562
- - `/simplify` - Built-in command that reviews changed code before PR
563
- - `reviewer` - Reviews code before PR
564
-
565
- **Swarm execution pattern:**
566
- ```javascript
567
- // 1. Create task list FIRST
568
- TaskCreate({ subject: "Research issue #123", ... })
569
- TaskCreate({ subject: "Implement changes", ... })
570
- TaskCreate({ subject: "Test implementation", ... })
571
- TaskCreate({ subject: "Run /simplify on changed files", ... })
572
- TaskCreate({ subject: "Review and PR", ... })
573
-
574
- // 2. Init swarm
575
- Bash("flo swarm init --topology hierarchical --max-agents 8 --strategy specialized")
576
-
577
- // 3. Spawn agents with Task tool (run_in_background: true)
578
- Task({ prompt: "...", subagent_type: "researcher", run_in_background: true })
579
- Task({ prompt: "...", subagent_type: "coder", run_in_background: true })
580
-
581
- // 4. Wait for results, synthesize, continue
582
- ```
583
-
584
- ### HIVE-MIND Mode (-h, --hive)
585
-
586
- Use for consensus-based decisions:
587
- - Architecture choices
588
- - Approach tradeoffs
589
- - Design decisions with multiple valid options
590
-
591
- ### NORMAL Mode (Default)
592
-
593
- Single Claude execution without spawning sub-agents.
594
- - Still uses Task tool for tracking
595
- - Still creates tasks for visibility
596
- - Post-task neural learning hooks still fire
597
- - Just doesn't spawn multiple agents
598
-
599
- ### SPELL ENGINE Mode (-wf, --workflow)
600
-
601
- When `-wf` is used, the /flo skill switches to the generalized spell engine
602
- instead of the hardcoded coding process. This uses the `Grimoire` from
603
- `@moflo/spells` to resolve and run YAML/JSON spell definitions.
604
-
605
- **Scan directories** (in priority order):
606
- 1. Shipped: `src/modules/spells/definitions/` (bundled with moflo)
607
- 2. User: `spells/` and `.claude/spells/` (project-level overrides)
608
-
609
- **Registry behavior:**
610
- - Each spell file defines `name` and optional `abbreviation` in frontmatter
611
- - Registry builds lookup map: abbreviation -> file path, full name -> file path
612
- - Duplicate abbreviations produce a collision error on load
613
- - User definitions override shipped ones by name match
614
-
615
- **Subcommands:**
616
-
617
- `/flo -wf list` — List all available spells:
618
- ```
619
- Use Grimoire.list() to get all registered spells.
620
- Print a table: name | abbreviation | description | tier (shipped/user)
621
- ```
622
-
623
- `/flo -wf info <name|abbreviation>` — Show spell details:
624
- ```
625
- Use Grimoire.info(query) to get detailed info.
626
- Print: name, abbreviation, description, version, source file, arguments, step count, step types
627
- ```
628
-
629
- `/flo -wf <name|abbreviation> [positional-args] [--named-args]` — Execute a spell:
630
- ```
631
- 1. Use Grimoire.resolve(wfName) to find the spell
632
- 2. Map positional args to required arguments in order
633
- 3. Parse named args: --key=value or --key value
634
- 4. Use runSpellFromContent() or createRunner().run() to execute
635
- 5. Print step-by-step progress and final result
636
- ```
217
+ | Mode | Command | Steps | Stops After | Read |
218
+ |------|---------|-------|-------------|------|
219
+ | **Full** (default) | `/flo 123` | Research -> Ticket -> Implement -> Test -> Simplify -> PR | PR created | `./phases.md` + `./ticket.md` |
220
+ | **Epic** | `/flo 42` (epic) | Inline epic processing: extract stories, run each via /flo | All stories complete | `./epic.md` |
221
+ | **Ticket** | `/flo -t 123` | Research -> Ticket | Issue updated | `./ticket.md` |
222
+ | **Research** | `/flo -r 123` | Research | Findings output | `./phases.md` (Phase 1) |
223
+ | **Workflow** | `/flo -wf sa ./src` | Load registry -> Resolve spell -> Execute with args | Spell complete | `./spell-engine.md` |
224
+ | **WF List** | `/flo -wf list` | Load registry -> Print all spells | List printed | `./spell-engine.md` |
225
+ | **WF Info** | `/flo -wf info sa` | Load registry -> Print spell details | Info printed | `./spell-engine.md` |
637
226
 
638
- **Argument mapping:**
639
- - Positional args mapped to required arguments in definition order
640
- - Named args: `--severity=critical` or `--severity critical`
641
- - Boolean flags: `--autofix` (true if present)
642
- - Example: `/flo -wf sa ./src --severity critical --autofix`
643
- Maps to: `{ target: "./src", severity: "critical", autofix: "true" }`
227
+ Execution modes (normal/swarm/hive) are defined in the table under **Workflow Overview > Execution Mode** above. Full agent-spawning details and swarm patterns live in `./execution-modes.md`.
644
228
 
645
229
  ---
646
230
 
647
231
  **Full mode executes without prompts.** It will:
648
- 1. Research the issue and codebase
649
- 2. Enhance the GitHub issue with implementation plan
650
- 3. Assign issue to self, add "in-progress" label
651
- 4. Create branch, implement, test
652
- 5. Run /simplify on changed code, re-test if changes made
653
- 6. Commit changes
654
- 7. Store learnings via mcp__moflo__memory_store (REQUIRED before PR — gate enforced)
655
- 8. Create PR, update issue status
232
+ 1. Research the issue and codebase (see `./phases.md` Phase 1)
233
+ 2. Enhance the GitHub issue with implementation plan (see `./ticket.md`)
234
+ 3. Assign issue to self, add "in-progress" label (see `./phases.md` Phase 3)
235
+ 4. Create branch, implement, test (see `./phases.md` Phases 3–4)
236
+ 5. Run /simplify on changed code, re-test if changes made (see `./phases.md` Phase 4.5)
237
+ 6. Commit changes (see `./phases.md` Phase 5.1)
238
+ 7. Store learnings via mcp__moflo__memory_store (REQUIRED before PR — gate enforced; see `./phases.md` Phase 5.2)
239
+ 8. Create PR, update issue status (see `./phases.md` Phases 5.3–5.4)
@@ -0,0 +1,48 @@
1
+ # Epic Handling
2
+
3
+ ## Unified Epic Processing
4
+
5
+ When `/flo <issue>` detects an epic, it follows the same orchestration logic as `flo epic run`.
6
+ The `/flo` skill does NOT shell out — it processes the epic inline within the current Claude session,
7
+ following the strategy steps below. This keeps the full context (memory, guidance, session state)
8
+ available throughout story processing.
9
+
10
+ Epic detection criteria are listed in `SKILL.md` under **Usage > Epic Handling**.
11
+ Detection uses `isEpicIssue()` from `src/modules/cli/src/epic/detection.ts`.
12
+
13
+ **Inline processing steps when `/flo <issue>` detects an epic:**
14
+ 1. Extract stories using detection from `src/modules/cli/src/epic/detection.ts`
15
+ 2. Determine strategy from `moflo.yaml` config (`epic.default_strategy`), defaulting to `single-branch`
16
+ 3. For **single-branch**: create shared `epic/<number>-<slug>` branch, process each story via `/flo --epic-branch <branch> <issue>`, then create one consolidated PR
17
+ 4. For **auto-merge**: process each story via `/flo <issue>`, merge its PR, then proceed to next
18
+
19
+ ## Epic Strategies
20
+
21
+ | Strategy | Default | Description |
22
+ |----------|---------|-------------|
23
+ | `single-branch` | **Yes** | One shared branch, one commit per story, one PR at the end |
24
+ | `auto-merge` | No | Per-story branches and PRs, each auto-merged before the next story |
25
+
26
+ Strategy is determined by (in priority order):
27
+ 1. CLI flag: `--strategy auto-merge`
28
+ 2. Feature definition: `strategy` field in YAML
29
+ 3. Config: `epic.default_strategy` in `moflo.yaml`
30
+ 4. Default: `single-branch`
31
+
32
+ ## How It Works
33
+
34
+ The `flo epic run` command:
35
+ 1. Fetches the epic issue and validates it
36
+ 2. Extracts and orders stories (topological sort for dependencies)
37
+ 3. Loads the appropriate spell YAML template
38
+ 4. Runs via the spell engine (SpellRunner)
39
+ 5. The spell template handles branch creation, story iteration, PR creation, and checklist tracking
40
+
41
+ Individual stories within an epic are processed via `/flo --epic-branch <branch> <issue>`,
42
+ which the spell engine invokes automatically. The `--epic-branch` flag tells `/flo` to
43
+ commit to the existing branch and skip branch creation and PR creation.
44
+
45
+ ## Epic Checklist Tracking
46
+
47
+ The spell templates automatically check off stories in the epic body after each commit.
48
+ The checklist state (`[ ]` vs `[x]`) is the **single source of truth** for epic progress.
@@ -0,0 +1,48 @@
1
+ # Execution Mode Details
2
+
3
+ Execution mode determines HOW work is carried out across all phases. Mode is chosen via flag: `-s/--swarm`, `-h/--hive`, or `-n/--normal` (default).
4
+
5
+ ## SWARM Mode (-s, --swarm)
6
+
7
+ When swarm is requested, you MUST use the Task tool to spawn agents. No exceptions.
8
+
9
+ **Swarm spawns these agents via Task tool:**
10
+ - `researcher` - Analyzes issue, searches memory, finds patterns
11
+ - `coder` - Implements changes following plan
12
+ - `tester` - Writes and runs tests
13
+ - `/simplify` - Built-in command that reviews changed code before PR
14
+ - `reviewer` - Reviews code before PR
15
+
16
+ **Swarm execution pattern:**
17
+ ```javascript
18
+ // 1. Create task list FIRST
19
+ TaskCreate({ subject: "Research issue #123", ... })
20
+ TaskCreate({ subject: "Implement changes", ... })
21
+ TaskCreate({ subject: "Test implementation", ... })
22
+ TaskCreate({ subject: "Run /simplify on changed files", ... })
23
+ TaskCreate({ subject: "Review and PR", ... })
24
+
25
+ // 2. Init swarm
26
+ Bash("flo swarm init --topology hierarchical --max-agents 8 --strategy specialized")
27
+
28
+ // 3. Spawn agents with Task tool (run_in_background: true)
29
+ Task({ prompt: "...", subagent_type: "researcher", run_in_background: true })
30
+ Task({ prompt: "...", subagent_type: "coder", run_in_background: true })
31
+
32
+ // 4. Wait for results, synthesize, continue
33
+ ```
34
+
35
+ ## HIVE-MIND Mode (-h, --hive)
36
+
37
+ Use for consensus-based decisions:
38
+ - Architecture choices
39
+ - Approach tradeoffs
40
+ - Design decisions with multiple valid options
41
+
42
+ ## NORMAL Mode (Default)
43
+
44
+ Single Claude execution without spawning sub-agents.
45
+ - Still uses Task tool for tracking
46
+ - Still creates tasks for visibility
47
+ - Post-task neural learning hooks still fire
48
+ - Just doesn't spawn multiple agents