@thierrynakoa/fire-flow 10.0.0

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 (215) hide show
  1. package/.claude-plugin/plugin.json +64 -0
  2. package/ARCHITECTURE-DIAGRAM.md +440 -0
  3. package/COMMAND-REFERENCE.md +172 -0
  4. package/DOMINION-FLOW-OVERVIEW.md +421 -0
  5. package/LICENSE +21 -0
  6. package/QUICK-START.md +351 -0
  7. package/README.md +398 -0
  8. package/TROUBLESHOOTING.md +264 -0
  9. package/agents/fire-codebase-mapper.md +484 -0
  10. package/agents/fire-debugger.md +535 -0
  11. package/agents/fire-executor.md +949 -0
  12. package/agents/fire-fact-checker.md +276 -0
  13. package/agents/fire-learncoding-explainer.md +237 -0
  14. package/agents/fire-learncoding-walker.md +147 -0
  15. package/agents/fire-planner.md +675 -0
  16. package/agents/fire-project-researcher.md +155 -0
  17. package/agents/fire-research-synthesizer.md +166 -0
  18. package/agents/fire-researcher.md +723 -0
  19. package/agents/fire-reviewer.md +499 -0
  20. package/agents/fire-roadmapper.md +203 -0
  21. package/agents/fire-verifier.md +880 -0
  22. package/bin/cli.js +208 -0
  23. package/commands/fire-0-orient.md +476 -0
  24. package/commands/fire-1-new.md +281 -0
  25. package/commands/fire-1a-discuss.md +455 -0
  26. package/commands/fire-2-plan.md +527 -0
  27. package/commands/fire-3-execute.md +1303 -0
  28. package/commands/fire-4-verify.md +845 -0
  29. package/commands/fire-5-handoff.md +515 -0
  30. package/commands/fire-6-resume.md +501 -0
  31. package/commands/fire-7-review.md +409 -0
  32. package/commands/fire-add-new-skill.md +598 -0
  33. package/commands/fire-analytics.md +499 -0
  34. package/commands/fire-assumptions.md +78 -0
  35. package/commands/fire-autonomous.md +528 -0
  36. package/commands/fire-brainstorm.md +413 -0
  37. package/commands/fire-complete-milestone.md +270 -0
  38. package/commands/fire-dashboard.md +375 -0
  39. package/commands/fire-debug.md +663 -0
  40. package/commands/fire-discover.md +616 -0
  41. package/commands/fire-double-check.md +460 -0
  42. package/commands/fire-execute-plan.md +182 -0
  43. package/commands/fire-learncoding.md +242 -0
  44. package/commands/fire-loop-resume.md +272 -0
  45. package/commands/fire-loop-stop.md +198 -0
  46. package/commands/fire-loop.md +1168 -0
  47. package/commands/fire-map-codebase.md +313 -0
  48. package/commands/fire-new-milestone.md +356 -0
  49. package/commands/fire-reflect.md +235 -0
  50. package/commands/fire-research.md +246 -0
  51. package/commands/fire-search.md +330 -0
  52. package/commands/fire-security-audit-repo.md +293 -0
  53. package/commands/fire-security-scan.md +484 -0
  54. package/commands/fire-session-summary.md +252 -0
  55. package/commands/fire-skills-diff.md +506 -0
  56. package/commands/fire-skills-history.md +388 -0
  57. package/commands/fire-skills-rollback.md +408 -0
  58. package/commands/fire-skills-sync.md +470 -0
  59. package/commands/fire-test.md +520 -0
  60. package/commands/fire-todos.md +335 -0
  61. package/commands/fire-transition.md +186 -0
  62. package/commands/fire-update.md +312 -0
  63. package/commands/fire-verify-uat.md +146 -0
  64. package/commands/fire-vuln-scan.md +493 -0
  65. package/hooks/hooks.json +16 -0
  66. package/hooks/run-hook.cmd +69 -0
  67. package/hooks/run-hook.sh +8 -0
  68. package/hooks/run-session-end.cmd +49 -0
  69. package/hooks/run-session-end.sh +7 -0
  70. package/hooks/session-end.sh +90 -0
  71. package/hooks/session-start.sh +111 -0
  72. package/package.json +52 -0
  73. package/plugin.json +7 -0
  74. package/references/auto-skill-extraction.md +136 -0
  75. package/references/behavioral-directives.md +365 -0
  76. package/references/blocker-tracking.md +155 -0
  77. package/references/checkpoints.md +165 -0
  78. package/references/circuit-breaker.md +410 -0
  79. package/references/context-engineering.md +587 -0
  80. package/references/decision-time-guidance.md +289 -0
  81. package/references/error-classification.md +326 -0
  82. package/references/execution-mode-intelligence.md +242 -0
  83. package/references/git-integration.md +217 -0
  84. package/references/honesty-protocols.md +304 -0
  85. package/references/integration-architecture.md +470 -0
  86. package/references/issue-to-pr-pipeline.md +150 -0
  87. package/references/metrics-and-trends.md +234 -0
  88. package/references/playwright-e2e-testing.md +326 -0
  89. package/references/questioning.md +125 -0
  90. package/references/research-improvements.md +110 -0
  91. package/references/skills-usage-guide.md +429 -0
  92. package/references/tdd.md +131 -0
  93. package/references/testing-enforcement.md +192 -0
  94. package/references/ui-brand.md +383 -0
  95. package/references/validation-checklist.md +456 -0
  96. package/references/verification-patterns.md +187 -0
  97. package/references/warrior-principles.md +173 -0
  98. package/skills-library/SKILLS-INDEX.md +588 -0
  99. package/skills-library/_general/frontend/html-visual-reports.md +292 -0
  100. package/skills-library/_general/methodology/debug-swarm-researcher-escape-hatch.md +240 -0
  101. package/skills-library/_general/methodology/learncoding-agentic-pattern.md +114 -0
  102. package/skills-library/_general/methodology/shell-autonomous-loop-fixplan.md +238 -0
  103. package/skills-library/basics/api-rest-basics.md +162 -0
  104. package/skills-library/basics/env-variables.md +96 -0
  105. package/skills-library/basics/error-handling-basics.md +125 -0
  106. package/skills-library/basics/git-commit-conventions.md +106 -0
  107. package/skills-library/basics/readme-template.md +108 -0
  108. package/skills-library/common-tasks/async-await-patterns.md +157 -0
  109. package/skills-library/common-tasks/auth-jwt-basics.md +164 -0
  110. package/skills-library/common-tasks/database-schema-design.md +166 -0
  111. package/skills-library/common-tasks/file-upload-basics.md +166 -0
  112. package/skills-library/common-tasks/form-validation.md +159 -0
  113. package/skills-library/debugging/FAILURE_TAXONOMY_CLASSIFICATION.md +117 -0
  114. package/skills-library/debugging/THREE_AGENT_HYPOTHESIS_DEBUGGING.md +86 -0
  115. package/skills-library/methodology/BREATH_BASED_PARALLEL_EXECUTION.md +678 -0
  116. package/skills-library/methodology/CONFIDENCE_GATED_EXECUTION.md +243 -0
  117. package/skills-library/methodology/EVIDENCE_BASED_VALIDATION.md +308 -0
  118. package/skills-library/methodology/MULTI_PERSPECTIVE_CODE_REVIEW.md +330 -0
  119. package/skills-library/methodology/PATH_VERIFICATION_GATE.md +211 -0
  120. package/skills-library/methodology/REFLEXION_MEMORY_PATTERN.md +183 -0
  121. package/skills-library/methodology/RESEARCH_BACKED_WORKFLOW_UPGRADE.md +263 -0
  122. package/skills-library/methodology/SABBATH_REST_PATTERN.md +267 -0
  123. package/skills-library/methodology/STONE_AND_SCAFFOLD.md +220 -0
  124. package/skills-library/performance/cache-augmented-generation.md +172 -0
  125. package/skills-library/quality-safety/debugging-steps.md +147 -0
  126. package/skills-library/quality-safety/deployment-checklist.md +155 -0
  127. package/skills-library/quality-safety/security-checklist.md +204 -0
  128. package/skills-library/quality-safety/testing-basics.md +180 -0
  129. package/skills-library/security/agent-security-scanner.md +445 -0
  130. package/skills-library/specialists/api-architecture/api-designer.md +49 -0
  131. package/skills-library/specialists/api-architecture/graphql-architect.md +49 -0
  132. package/skills-library/specialists/api-architecture/mcp-developer.md +51 -0
  133. package/skills-library/specialists/api-architecture/microservices-architect.md +50 -0
  134. package/skills-library/specialists/api-architecture/websocket-engineer.md +48 -0
  135. package/skills-library/specialists/backend/django-expert.md +52 -0
  136. package/skills-library/specialists/backend/fastapi-expert.md +52 -0
  137. package/skills-library/specialists/backend/laravel-specialist.md +52 -0
  138. package/skills-library/specialists/backend/nestjs-expert.md +51 -0
  139. package/skills-library/specialists/backend/rails-expert.md +53 -0
  140. package/skills-library/specialists/backend/spring-boot-engineer.md +56 -0
  141. package/skills-library/specialists/data-ml/fine-tuning-expert.md +48 -0
  142. package/skills-library/specialists/data-ml/ml-pipeline.md +47 -0
  143. package/skills-library/specialists/data-ml/pandas-pro.md +47 -0
  144. package/skills-library/specialists/data-ml/rag-architect.md +51 -0
  145. package/skills-library/specialists/data-ml/spark-engineer.md +47 -0
  146. package/skills-library/specialists/frontend/angular-architect.md +52 -0
  147. package/skills-library/specialists/frontend/flutter-expert.md +51 -0
  148. package/skills-library/specialists/frontend/nextjs-developer.md +54 -0
  149. package/skills-library/specialists/frontend/react-native-expert.md +50 -0
  150. package/skills-library/specialists/frontend/vue-expert.md +51 -0
  151. package/skills-library/specialists/infrastructure/chaos-engineer.md +74 -0
  152. package/skills-library/specialists/infrastructure/cloud-architect.md +70 -0
  153. package/skills-library/specialists/infrastructure/database-optimizer.md +64 -0
  154. package/skills-library/specialists/infrastructure/devops-engineer.md +70 -0
  155. package/skills-library/specialists/infrastructure/kubernetes-specialist.md +52 -0
  156. package/skills-library/specialists/infrastructure/monitoring-expert.md +70 -0
  157. package/skills-library/specialists/infrastructure/sre-engineer.md +70 -0
  158. package/skills-library/specialists/infrastructure/terraform-engineer.md +51 -0
  159. package/skills-library/specialists/languages/cpp-pro.md +74 -0
  160. package/skills-library/specialists/languages/csharp-developer.md +69 -0
  161. package/skills-library/specialists/languages/dotnet-core-expert.md +54 -0
  162. package/skills-library/specialists/languages/golang-pro.md +51 -0
  163. package/skills-library/specialists/languages/java-architect.md +49 -0
  164. package/skills-library/specialists/languages/javascript-pro.md +68 -0
  165. package/skills-library/specialists/languages/kotlin-specialist.md +68 -0
  166. package/skills-library/specialists/languages/php-pro.md +49 -0
  167. package/skills-library/specialists/languages/python-pro.md +52 -0
  168. package/skills-library/specialists/languages/react-expert.md +51 -0
  169. package/skills-library/specialists/languages/rust-engineer.md +50 -0
  170. package/skills-library/specialists/languages/sql-pro.md +56 -0
  171. package/skills-library/specialists/languages/swift-expert.md +69 -0
  172. package/skills-library/specialists/languages/typescript-pro.md +51 -0
  173. package/skills-library/specialists/platform/atlassian-mcp.md +52 -0
  174. package/skills-library/specialists/platform/embedded-systems.md +53 -0
  175. package/skills-library/specialists/platform/game-developer.md +53 -0
  176. package/skills-library/specialists/platform/salesforce-developer.md +53 -0
  177. package/skills-library/specialists/platform/shopify-expert.md +49 -0
  178. package/skills-library/specialists/platform/wordpress-pro.md +49 -0
  179. package/skills-library/specialists/quality/code-documenter.md +51 -0
  180. package/skills-library/specialists/quality/code-reviewer.md +67 -0
  181. package/skills-library/specialists/quality/debugging-wizard.md +51 -0
  182. package/skills-library/specialists/quality/fullstack-guardian.md +51 -0
  183. package/skills-library/specialists/quality/legacy-modernizer.md +50 -0
  184. package/skills-library/specialists/quality/playwright-expert.md +65 -0
  185. package/skills-library/specialists/quality/spec-miner.md +56 -0
  186. package/skills-library/specialists/quality/test-master.md +65 -0
  187. package/skills-library/specialists/security/secure-code-guardian.md +55 -0
  188. package/skills-library/specialists/security/security-reviewer.md +53 -0
  189. package/skills-library/specialists/workflow/architecture-designer.md +53 -0
  190. package/skills-library/specialists/workflow/cli-developer.md +70 -0
  191. package/skills-library/specialists/workflow/feature-forge.md +65 -0
  192. package/skills-library/specialists/workflow/prompt-engineer.md +54 -0
  193. package/skills-library/specialists/workflow/the-fool.md +62 -0
  194. package/templates/ASSUMPTIONS.md +125 -0
  195. package/templates/BLOCKERS.md +73 -0
  196. package/templates/DECISION_LOG.md +116 -0
  197. package/templates/UAT.md +96 -0
  198. package/templates/blueprint.md +94 -0
  199. package/templates/brainstorm.md +185 -0
  200. package/templates/conscience.md +92 -0
  201. package/templates/fire-handoff.md +159 -0
  202. package/templates/metrics.md +67 -0
  203. package/templates/phase-prompt.md +142 -0
  204. package/templates/record.md +131 -0
  205. package/templates/review-report.md +117 -0
  206. package/templates/skills-index.md +157 -0
  207. package/templates/verification.md +149 -0
  208. package/templates/vision.md +79 -0
  209. package/validation-config.yml +793 -0
  210. package/version.json +7 -0
  211. package/workflows/execute-phase.md +732 -0
  212. package/workflows/handoff-session.md +678 -0
  213. package/workflows/new-project.md +578 -0
  214. package/workflows/plan-phase.md +592 -0
  215. package/workflows/verify-phase.md +874 -0
@@ -0,0 +1,1303 @@
1
+ ---
2
+ description: Execute a phase with breath-based parallelism and honesty protocols
3
+ ---
4
+
5
+ # /fire-3-execute
6
+
7
+ > Execute phase N with breath-based parallelization and honesty protocols
8
+
9
+ ---
10
+
11
+ ## Purpose
12
+
13
+ Execute all plans in a specified phase using breath-based parallel execution. Each plan is handled by a fire-executor agent that applies honesty protocols, references skills, and creates unified handoff documents. After execution completes, a fire-verifier validates the work.
14
+
15
+ ---
16
+
17
+ ## Arguments
18
+
19
+ ```yaml
20
+ arguments:
21
+ phase_number:
22
+ required: true
23
+ type: integer
24
+ description: "Phase number to execute (e.g., 1, 2, 3)"
25
+ example: "/fire-3-execute 3"
26
+
27
+ optional_flags:
28
+ --breath: "Execute only a specific breath (e.g., --breath 2)"
29
+ --plan: "Execute only a specific plan (e.g., --plan 03-02)"
30
+ --skip-verify: "Skip verification after execution (not recommended)"
31
+ --continue: "Continue from last checkpoint (for interrupted execution)"
32
+ --auto-continue: "Enable Double-Shot Latte pattern - no 'continue?' interrupts"
33
+ --skip-review: "Skip the parallel code review (not recommended)"
34
+ --autonomous: "Auto-route merge gate verdicts without human checkpoints (DEFAULT in v10.0, used by /fire-autonomous)"
35
+ --manual: "Opt-in to human checkpoints at merge gate (v9.0 behavior)"
36
+ --worktree: "Use git worktree isolation for parallel breath execution (v10.0)"
37
+ --model-split: "Force architect/editor model split for all tasks (v10.0)"
38
+ ```
39
+
40
+ ---
41
+
42
+ ## Auto-Continuation Mode (Double-Shot Latte Pattern)
43
+
44
+ When `--auto-continue` is enabled, execution proceeds without "continue?" interrupts:
45
+
46
+ ```
47
+ ┌─────────────────────────────────────────────────────────────────────────────┐
48
+ │ AUTO-CONTINUATION ACTIVE │
49
+ ├─────────────────────────────────────────────────────────────────────────────┤
50
+ │ │
51
+ │ Breath completion → Automatic checkpoint → Next breath starts immediately │
52
+ │ │
53
+ │ Benefits: │
54
+ │ • Uninterrupted execution flow │
55
+ │ • Faster phase completion │
56
+ │ • Progress saved at each breath checkpoint │
57
+ │ │
58
+ │ Safety: │
59
+ │ • Checkpoints created between breaths │
60
+ │ • Can resume from any breath if interrupted │
61
+ │ • Blocking errors still pause execution │
62
+ │ │
63
+ └─────────────────────────────────────────────────────────────────────────────┘
64
+ ```
65
+
66
+ **Usage:**
67
+ ```bash
68
+ # Full auto-execution (review is on by default in v8.0)
69
+ /fire-3-execute 2 --auto-continue
70
+ ```
71
+
72
+ ---
73
+
74
+ ## Process
75
+
76
+ ### Step 1: Load Context (Dominion Flow Standard)
77
+
78
+ ```
79
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
80
+ DOMINION FLOW > PHASE {N} EXECUTION
81
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
82
+ ```
83
+
84
+ **Load CONSCIENCE.md:**
85
+ ```markdown
86
+ @.planning/CONSCIENCE.md
87
+ ```
88
+
89
+ **Extract:**
90
+ - Current phase and status
91
+ - Completed plans (if resuming)
92
+ - Session context
93
+
94
+ ### Step 2: Discover Plans (Dominion Flow Standard)
95
+
96
+ **Scan for plans:**
97
+ ```bash
98
+ .planning/phases/{N}-{name}/{N}-*-BLUEPRINT.md
99
+ ```
100
+
101
+ **Build execution manifest:**
102
+ ```markdown
103
+ ## Phase {N} Execution Manifest
104
+
105
+ ### Plans Discovered
106
+ | Plan | Name | Breath | Dependencies | Status |
107
+ |------|------|------|--------------|--------|
108
+ | {N}-01 | {name} | 1 | none | pending |
109
+ | {N}-02 | {name} | 1 | none | pending |
110
+ | {N}-03 | {name} | 2 | {N}-01 | pending |
111
+ ```
112
+
113
+ ### Step 3: Group by Breath (Dominion Flow Standard)
114
+
115
+ **Breath Grouping Rules:**
116
+ - Plans in same breath execute in parallel
117
+ - Breath N+1 waits for Breath N to complete
118
+ - Dependencies must be in earlier breaths
119
+
120
+ **Display:**
121
+ ```
122
+ â—† Execution Plan
123
+ Breath 1: 2 plans (parallel)
124
+ ├─ {N}-01: {name}
125
+ └─ {N}-02: {name}
126
+ Breath 2: 1 plan
127
+ └─ {N}-03: {name} (depends on {N}-01)
128
+ ```
129
+
130
+ ### Step 3.5: Path Verification Gate (MANDATORY — v5.0)
131
+
132
+ **Research basis:** SDFT (MIT, 2026) — recovery from own errors > memorizing expert paths.
133
+ **Trigger:** The wrong-repo incident (subagent explored `my-other-project` instead of `MY-PROJECT`).
134
+
135
+ **Before ANY file operation, verify these HARD GATES (no confidence override):**
136
+
137
+ ```
138
+ PATH VERIFICATION — ALWAYS RUN (not confidence-gated)
139
+
140
+ 1. WORKING DIRECTORY CHECK
141
+ expected_project = extract from CONSCIENCE.md or VISION.md
142
+ actual_cwd = pwd
143
+ IF actual_cwd does NOT contain expected_project path:
144
+ → HARD STOP. Display:
145
+ "WRONG DIRECTORY: Expected {expected}, got {actual_cwd}"
146
+ "Aborting to prevent cross-project contamination."
147
+
148
+ 2. SUBAGENT PATH INJECTION
149
+ When spawning ANY subagent (Task tool), ALWAYS include:
150
+ <path_constraint>
151
+ MANDATORY: All file operations MUST be within:
152
+ {project_root_path}
153
+
154
+ VERIFY before every Read/Write/Edit/Bash:
155
+ - File path starts with {project_root_path}
156
+ - No ../../ escapes above project root
157
+ - Bash commands operate on correct directory
158
+
159
+ If you find yourself in the wrong directory: STOP immediately.
160
+ Do NOT read, edit, or delete files outside the project.
161
+ </path_constraint>
162
+
163
+ 3. DELETION SAFETY
164
+ Before deleting files, verify:
165
+ - File path is within project root (absolute path check)
166
+ - File is not in the "keep" list (shared services, core files)
167
+ - Count matches: planned deletions == actual files found
168
+ - If count mismatch: STOP and report discrepancy
169
+ (e.g., "Plan says 28, found 27 — investigate missing file")
170
+
171
+ 4. CROSS-PROJECT CONTAMINATION CHECK
172
+ If multiple working directories exist in session:
173
+ - Explicitly name the TARGET project in every tool call
174
+ - Never use relative paths that could resolve to wrong project
175
+ - Log which project each operation targets
176
+ ```
177
+
178
+ **Why this is mandatory (not confidence-gated):**
179
+ Confidence gates allow override at HIGH confidence. Path verification does NOT.
180
+ A subagent editing the wrong repo at 95% confidence is still catastrophic.
181
+ This gate is a circuit breaker, not a confidence check.
182
+
183
+ ### Step 3.6: Select Execution Mode (Automatic)
184
+
185
+ **For each breath, automatically determine execution strategy.**
186
+
187
+ See `@references/execution-mode-intelligence.md` for full algorithm.
188
+
189
+ ```
190
+ FOR each breath:
191
+ plans_in_wave = plans with matching breath number
192
+ file_sets = [plan.files_modified for each plan]
193
+
194
+ IF plans_in_wave.count == 1:
195
+ MODE = SEQUENTIAL
196
+
197
+ ELIF plans_in_wave.count >= 3 AND no file overlap between plans:
198
+ MODE = SWARM
199
+ Compose team: Backend/Frontend/Test specialists based on file patterns
200
+
201
+ ELIF plans_in_wave.count >= 2 AND no file overlap:
202
+ MODE = SUBAGENT (Task tool parallelism)
203
+
204
+ ELIF plans_in_wave.count >= 2 AND file overlap detected:
205
+ MODE = SEQUENTIAL (serialize to avoid conflicts)
206
+
207
+ ELSE:
208
+ MODE = SEQUENTIAL (safe default)
209
+ ```
210
+
211
+ **Display mode decision:**
212
+ ```
213
+ +---------------------------------------------------------------+
214
+ | EXECUTION MODE: [SWARM/SUBAGENT/SEQUENTIAL] |
215
+ +---------------------------------------------------------------+
216
+ | Breath {W}: {N} plans |
217
+ | File overlap: [None/Detected] |
218
+ | Rationale: [why this mode was selected] |
219
+ | |
220
+ | [If SWARM:] |
221
+ | Team composition: |
222
+ | Backend Agent: Plan {N}-01 (API work) |
223
+ | Frontend Agent: Plan {N}-02 (UI work) |
224
+ | Test Agent: Plan {N}-03 (test work) |
225
+ +-----------------------------------------------------------------+
226
+ ```
227
+
228
+ **Override flags:** `--swarm`, `--sequential`, or `--subagent` force a specific mode.
229
+
230
+ **Fallback chain:** SWARM -> SUBAGENT -> SEQUENTIAL (if higher mode unavailable or fails).
231
+
232
+ ### Step 3.7: Git Worktree Isolation (v10.0 — Optional)
233
+
234
+ > **Research basis (v10.0):** Cursor's worktree isolation pattern (2025-2026) — parallel agents
235
+ > working in isolated git worktrees prevent file conflicts without coordination overhead.
236
+ > Google/MIT Scaling Laws (Dec 2025) confirm: isolation removes the 39-70% degradation from
237
+ > shared-state contention in parallelizable tasks.
238
+
239
+ **When `--worktree` flag is set OR execution mode is SWARM/SUBAGENT:**
240
+
241
+ ```
242
+ FOR each parallel agent in breath:
243
+ # Create isolated worktree
244
+ branch_name = "fire-execute/{plan_id}"
245
+ worktree_path = ".claude/worktrees/{plan_id}"
246
+
247
+ git worktree add -b {branch_name} {worktree_path} HEAD
248
+
249
+ # Agent works in isolated copy
250
+ agent.working_directory = {worktree_path}
251
+ agent.path_constraint = {worktree_path}
252
+
253
+ AFTER all agents in breath complete:
254
+ # Merge worktree branches back to main
255
+ FOR each completed worktree:
256
+ git merge --no-ff {branch_name}
257
+
258
+ IF merge conflict:
259
+ → Log conflict files
260
+ → Attempt auto-resolution (accept both sides for additive changes)
261
+ → If unresolvable: flag for human review
262
+
263
+ # Clean up
264
+ git worktree remove {worktree_path}
265
+ git branch -d {branch_name}
266
+ ```
267
+
268
+ **Benefits over shared-state coordination:**
269
+ - Zero file conflicts between parallel agents (each has own copy)
270
+ - No `.shared-state.json` needed — git merge handles integration
271
+ - Atomic: if one agent fails, its worktree is discarded without affecting others
272
+ - Rollback: `git worktree remove` cleanly reverts any agent's work
273
+
274
+ **When NOT to use worktrees:**
275
+ - SEQUENTIAL mode (no parallelism needed)
276
+ - Single-plan breaths (no contention possible)
277
+ - Tasks that need to see each other's changes in real-time
278
+
279
+ ### Inter-Agent Coordination (SWARM mode)
280
+
281
+ When running in SWARM mode, agents coordinate via `.planning/.shared-state.json`:
282
+
283
+ - **Before creating new types/interfaces/exports,** check if another agent already created it by reading `.planning/.shared-state.json`. Duplicate type definitions across agents cause merge conflicts.
284
+ - **Append discoveries** to the shared state file using atomic writes. Each agent writes its own key (e.g., `"backend": { "exports": [...] }`).
285
+ - **If a file conflict is detected** (two agents modified the same file), PAUSE and log a coordination request in the shared state: `"conflicts": [{ "file": "...", "agents": ["backend", "frontend"] }]`.
286
+ - **The Team Lead periodically checks** shared state and resolves conflicts by assigning the contested file to a single agent.
287
+
288
+ ```json
289
+ // .planning/.shared-state.json example
290
+ {
291
+ "backend": {
292
+ "exports": ["UserService", "AuthMiddleware"],
293
+ "files_modified": ["src/services/user.ts", "src/middleware/auth.ts"]
294
+ },
295
+ "frontend": {
296
+ "exports": ["UserContext", "LoginForm"],
297
+ "files_modified": ["src/contexts/user.tsx", "src/components/LoginForm.tsx"]
298
+ },
299
+ "conflicts": []
300
+ }
301
+ ```
302
+
303
+ ### Reasoning Trace Sharing (MAKER v9.1)
304
+
305
+ > **Research basis:** MAKER (2025) — Multi-Agent Knowledge Exchange and Reasoning.
306
+ > Agents sharing intermediate reasoning (not just outputs) produce better coordinated results.
307
+
308
+ In SWARM mode, agents write reasoning traces to shared state so other agents can build on their decisions.
309
+
310
+ **Extended shared-state.json structure:**
311
+
312
+ ```json
313
+ {
314
+ "backend": {
315
+ "exports": ["UserService", "AuthMiddleware"],
316
+ "files_modified": ["src/services/user.ts"],
317
+ "reasoning": [
318
+ { "step": "Chose connection pooling over per-request", "why": "10+ concurrent queries expected", "confidence": 85 },
319
+ { "step": "Added index on user_id", "why": "JOIN was full table scan", "confidence": 95 }
320
+ ]
321
+ },
322
+ "frontend": {
323
+ "exports": ["UserContext"],
324
+ "files_modified": ["src/contexts/user.tsx"],
325
+ "reasoning": [
326
+ { "step": "Used React Query over useState+useEffect", "why": "Backend noted 10+ concurrent queries — caching prevents redundant fetches", "confidence": 90 }
327
+ ]
328
+ }
329
+ }
330
+ ```
331
+
332
+ **Add to SWARM executor prompt:**
333
+
334
+ ```
335
+ <shared_reasoning>
336
+ Before making architectural decisions, READ .planning/.shared-state.json for reasoning
337
+ from other agents. Your decisions should be informed by their context.
338
+
339
+ After each significant decision, APPEND to your reasoning array:
340
+ { "step": "what you decided", "why": "rationale", "confidence": N }
341
+
342
+ Focus on decisions that OTHER agents would benefit from knowing about —
343
+ API contracts, data shapes, library choices, performance trade-offs.
344
+ </shared_reasoning>
345
+ ```
346
+
347
+ ### Architect/Editor Model Split (v10.0)
348
+
349
+ > **Research basis (v10.0):** Aider's dual-model architecture (2025-2026) — strong model
350
+ > plans changes as a structured diff spec, fast model applies them. Achieves 85% on
351
+ > SWE-bench by separating reasoning from execution. Anthropic's own model tiering
352
+ > (Opus/Sonnet/Haiku) makes this practical without additional API setup.
353
+
354
+ **When `--model-split` flag is set OR task difficulty is COMPLEX:**
355
+
356
+ ```
357
+ ARCHITECT PHASE (Opus — strong reasoning):
358
+ Input: BLUEPRINT.md task description + relevant source files
359
+ Output: Structured change specification:
360
+
361
+ ## Change Spec for Task {N}
362
+ ### File: {path}
363
+ - Action: CREATE | MODIFY | DELETE
364
+ - Location: line {N} (for MODIFY)
365
+ - Change: {description of what to change and why}
366
+ - New code sketch: {pseudocode or key logic}
367
+ ### Dependencies: {files that must exist first}
368
+ ### Verification: {how to confirm the change works}
369
+
370
+ EDITOR PHASE (Haiku — fast execution):
371
+ Input: Change spec from Architect + source files
372
+ Output: Actual file edits using Edit/Write tools
373
+
374
+ Rules for Editor:
375
+ - Follow change spec EXACTLY — do not deviate
376
+ - If spec is ambiguous: ask Architect (not user)
377
+ - If spec is impossible: report back with reason
378
+ - Apply code comments standard v3.2 to all changes
379
+ ```
380
+
381
+ **Model routing by difficulty (automatic):**
382
+
383
+ | Difficulty | Architect | Editor | Rationale |
384
+ |-----------|-----------|--------|-----------|
385
+ | SIMPLE | skip | Haiku | No planning needed, direct edit |
386
+ | MODERATE | Sonnet | Haiku | Balance of reasoning + speed |
387
+ | COMPLEX | Opus | Sonnet | Maximum reasoning + reliable execution |
388
+
389
+ **Cost savings:** ~60% of tasks are SIMPLE (Haiku only). MODERATE tasks use Sonnet+Haiku
390
+ instead of Opus for everything. Only COMPLEX tasks use full Opus reasoning.
391
+
392
+ **Override:** `--model-split` forces architect/editor for all tasks regardless of difficulty.
393
+
394
+ ### Task-Level Resume
395
+
396
+ When resuming with `--continue`, read RECORD.md for the current plan:
397
+
398
+ - **Skip tasks already marked as completed** -- verify artifacts still exist via `git log` and file existence checks before skipping.
399
+ - **Start execution from the first incomplete task** in the current breath.
400
+ - **Do NOT re-execute completed tasks** to avoid duplicate commits, redundant file modifications, and wasted context.
401
+
402
+ ```
403
+ IF --continue flag is set:
404
+ 1. Read .planning/phases/{N}-{name}/{N}-{NN}-RECORD.md for each plan
405
+ 2. For each plan with existing RECORD.md:
406
+ - Parse completed tasks from the "Accomplishments" section
407
+ - Verify key_files.created still exist on disk
408
+ - Verify commits exist in git log
409
+ - IF all verified → mark plan as COMPLETE, skip execution
410
+ - IF artifacts missing → mark plan as INCOMPLETE, re-execute
411
+ 3. For plans without RECORD.md → execute normally
412
+ 4. Resume from the first incomplete breath
413
+ ```
414
+
415
+ ### Step 4: Execute Breath (Enhanced with WARRIOR + Mode Intelligence)
416
+
417
+ For each breath, execute using the selected mode:
418
+
419
+ ```
420
+ ━━━ DOMINION FLOW ► BREATH {W} EXECUTION ({MODE}) ━━━
421
+ ```
422
+
423
+ **MODE = SWARM:**
424
+ ```
425
+ Team Lead delegates to specialist teammates:
426
+ "Execute Breath {W} as a team.
427
+ - Backend Agent: Plan {N}-01 (@BLUEPRINT.md)
428
+ - Frontend Agent: Plan {N}-02 (@BLUEPRINT.md)
429
+ - Test Agent: Plan {N}-03 (@BLUEPRINT.md)
430
+ Each agent: atomic commits per task, create RECORD.md"
431
+ ```
432
+
433
+ **MODE = SUBAGENT:**
434
+ ```
435
+ â—† Spawning executors for Breath {W}...
436
+ âš¡ fire-executor: Plan {N}-01 - {description}
437
+ âš¡ fire-executor: Plan {N}-02 - {description}
438
+ ```
439
+
440
+ **MODE = SEQUENTIAL:**
441
+ ```
442
+ â—† Executing Breath {W} sequentially...
443
+ → Plan {N}-01: {description} (executing...)
444
+ [complete]
445
+ → Plan {N}-02: {description} (executing...)
446
+ ```
447
+
448
+ **Spawn fire-executor per plan (parallel for SUBAGENT/SWARM):**
449
+
450
+ ```
451
+ â—† Spawning executors for Breath {W}...
452
+ âš¡ fire-executor: Plan {N}-01 - {description}
453
+ âš¡ fire-executor: Plan {N}-02 - {description}
454
+ ```
455
+
456
+ ### Step 5: fire-executor Agent Behavior
457
+
458
+ Each fire-executor receives:
459
+
460
+ **Context Injection:**
461
+ ```markdown
462
+ <plan_context>
463
+ @.planning/phases/{N}-{name}/{N}-{NN}-BLUEPRINT.md
464
+ </plan_context>
465
+
466
+ <skills_context>
467
+ Skills to apply for this plan:
468
+ @skills-library/{category}/{skill-1}.md
469
+ @skills-library/{category}/{skill-2}.md
470
+
471
+ Apply these patterns during implementation.
472
+ Document which skills you actually used.
473
+ </skills_context>
474
+
475
+ <honesty_protocol>
476
+ While executing tasks:
477
+
478
+ **If uncertain:**
479
+ 1. Document the uncertainty
480
+ 2. Search skills library for guidance
481
+ 3. Research if needed
482
+ 4. Proceed with transparency
483
+
484
+ **If blocked:**
485
+ 1. Admit the blocker explicitly
486
+ 2. Document what's blocking
487
+ 3. Request help or create .continue-here.md
488
+ 4. Don't fake progress
489
+
490
+ **If assuming:**
491
+ 1. Document the assumption
492
+ 2. Mark as assumption in code comments
493
+ 3. Add to handoff Issues section
494
+ </honesty_protocol>
495
+
496
+ <kv_cache_strategy>
497
+ <!-- v10.0: KV-Cache-Aware Context Management -->
498
+ <!-- Research basis: Production patterns from Manus AI, Cursor, Devin -->
499
+ <!-- Key insight: KV-cache hit rates collapse when context prefix changes -->
500
+
501
+ **Context Ordering Rule:** Place STABLE context first, DYNAMIC context last.
502
+ The KV-cache reuses computation for unchanged prefix tokens.
503
+
504
+ 1. System prompt + project rules (STABLE — never changes mid-execution)
505
+ 2. Plan context + skills loaded (SEMI-STABLE — changes between plans only)
506
+ 3. Episodic recall + confidence (DYNAMIC — changes per task)
507
+ 4. Current task instructions (DYNAMIC — changes every call)
508
+
509
+ **Re-injection Strategy:**
510
+ - When switching between plans in SWARM mode, re-inject stable prefix unchanged
511
+ - Only append/replace the dynamic tail — this preserves KV-cache across tasks
512
+ - Avoid re-ordering context blocks between executor calls
513
+ - If context exceeds 80% of window, compress episodic recall first (it has lowest reuse value)
514
+ </kv_cache_strategy>
515
+
516
+ <episodic_recall>
517
+ <!-- v6.0: CoALA Per-Turn Episodic Auto-Injection -->
518
+ <!-- Past experiences relevant to this plan's tasks -->
519
+ <!-- Retrieved via: npm run search -- "{plan keywords}" --limit 3 --two-phase -->
520
+
521
+ {For each relevant memory with score > 0.7:}
522
+ **[{sourceType}] {title}** (score: {score}, utility: {utilityScore})
523
+ {text excerpt — first 300 chars}
524
+ Source: {sourceFile} | Date: {date}
525
+
526
+ <!-- If no relevant memories found, this block is omitted -->
527
+ </episodic_recall>
528
+
529
+ <confidence_gates>
530
+ <!-- v5.0: Confidence-Gated Execution (SAUP-inspired) -->
531
+
532
+ Before each plan task, estimate confidence:
533
+
534
+ **Confidence Signals:**
535
+ + Matching skill found in library: +20
536
+ + Similar reflection exists: +15
537
+ + Tests available to verify: +25
538
+ + Familiar technology/framework: +15
539
+ + Clear, unambiguous requirements: +15
540
+ - Unfamiliar framework/library: -20
541
+ - No tests available: -15
542
+ - Ambiguous/incomplete requirements: -20
543
+ - Security-sensitive change: -10
544
+ - Destructive operation (delete, drop, overwrite): -15
545
+
546
+ **Confidence Levels:**
547
+
548
+ HIGH (>80%): Proceed autonomously
549
+ → Execute task directly
550
+ → Run Self-Judge after
551
+
552
+ MEDIUM (50-80%): Proceed with extra validation
553
+ → Search reflections: /fire-remember "{task description}" --type reflection
554
+ → Search skills: /fire-search "{technology}"
555
+ → Run Self-Judge before AND after
556
+ → Log uncertainty reason in RECORD.md
557
+
558
+ LOW (<50%): Pause and escalate
559
+ → Search Context7 for current library docs
560
+ → Check if this is outside trained domain
561
+ → Ask user for guidance before proceeding
562
+ → Create checkpoint before attempting
563
+
564
+ **Log confidence in RECORD.md:**
565
+ ```yaml
566
+ confidence_log:
567
+ - task: 1
568
+ score: 85
569
+ level: HIGH
570
+ signals: [skill_match, tests_available, familiar_tech]
571
+ - task: 3
572
+ score: 45
573
+ level: LOW
574
+ signals: [unfamiliar_framework, no_tests, ambiguous_requirements]
575
+ action: "Asked user for clarification on WebSocket auth approach"
576
+ ```
577
+ </confidence_gates>
578
+ ```
579
+
580
+ ### Step 5.1: Populate Episodic Recall (v6.0 — CoALA)
581
+
582
+ > **Research basis:** CoALA (Berkeley 2024) — Every decision cycle requires episodic memory injection.
583
+
584
+ Before spawning executors, the orchestrator populates the `<episodic_recall>` block:
585
+
586
+ ```
587
+ # 1. Extract keywords from plan tasks
588
+ plan_keywords = extract_keywords(BLUEPRINT.md task descriptions)
589
+
590
+ # 2. Search vector memory with two-phase retrieval
591
+ cd ~/.claude/memory
592
+ results = npm run search -- "{plan_keywords}" --limit 3 --two-phase
593
+
594
+ # 3. Fill <episodic_recall> block in executor prompt
595
+ IF results exist AND top_result.score > 0.7:
596
+ Fill block with top 3 results (title, score, utility, text excerpt)
597
+ ELSE:
598
+ Remove <episodic_recall> block entirely (no noise for novel tasks)
599
+ ```
600
+
601
+ **Cost control:** Only inject memories with score > 0.7. Cap at 3 results (~500 tokens).
602
+
603
+ ---
604
+
605
+ **Executor Creates:**
606
+ 1. Implements all tasks from BLUEPRINT.md
607
+ 2. **Runs Quick Self-Judge after each task** (v5.0 — Agent-as-Judge)
608
+ 3. Runs verification commands for each task
609
+ 4. Creates `{N}-{NN}-RECORD.md` (fire-handoff.md format)
610
+ 5. Updates SKILLS-INDEX.md with skills applied
611
+
612
+ ### Step 5.5: Quick Self-Judge (v5.0 — Agent-as-Judge)
613
+
614
+ **Research basis:** Agent-as-Judge (2025) — 95% error recovery when self-evaluation present
615
+
616
+ After completing each task in a plan, pause for 30 seconds of self-critique:
617
+
618
+ ```markdown
619
+ ## Quick Self-Judge (before marking task complete)
620
+ 1. Does this change do what the plan asked? [Y/N]
621
+ 2. Could this break something that was working? [Y/N — if Y, what?]
622
+ 3. Am I confident this is correct, or am I guessing? [confident/uncertain]
623
+ 4. Did I check for the obvious: imports, types, null cases? [Y/N]
624
+ 5. Would I approve this in a code review? [Y/N]
625
+
626
+ IF any N or "uncertain":
627
+ → STOP. Re-examine before proceeding.
628
+ → Document what triggered the pause.
629
+
630
+ IF "uncertain":
631
+ → Log to ~/.claude/reflections/{date}_uncertain-{task-slug}.md
632
+ → Include: what made you uncertain, what you checked, what you decided
633
+ → trigger: "self-judge-uncertain"
634
+ ```
635
+
636
+ **This is NOT a full verification.** It's a 30-second gut check that catches:
637
+ - Wrong file edited
638
+ - Missing import after refactor
639
+ - Accidentally deleted working code
640
+ - Copying a pattern that doesn't apply here
641
+
642
+ **When to skip:** Trivial changes (typo fix, comment update, config value change)
643
+
644
+ ### Step 5.6: Call-Path Verification — Dead Code Prevention (v11.0)
645
+
646
+ > **Research basis (v11.0):** Failure pattern mining (6+ instances across v10-v12) —
647
+ > features declared, committed, and documented but never wired. Examples: findSimilar()
648
+ > declared but never called, parentId field added but never populated. The fix: verify
649
+ > every new function/export has at least one call site before marking task complete.
650
+
651
+ After each task that creates new functions, exports, or API endpoints:
652
+
653
+ ```
654
+ FOR each new_symbol created in this task:
655
+ call_sites = grep -r "{symbol_name}" src/ --include="*.ts" --include="*.tsx" | grep -v "export\|function\|const.*="
656
+
657
+ IF call_sites == 0:
658
+ FLAG: "DEAD CODE: {symbol_name} declared in {file} but never called"
659
+ ACTION: Wire it into the appropriate caller before proceeding
660
+
661
+ IF call_sites == 1 AND call_site is only the test file:
662
+ NOTE: "Only called from tests — verify production code path exists"
663
+ ```
664
+
665
+ **Skip condition:** Pure type definitions, interfaces, and configuration constants
666
+ (these are consumed implicitly by the type system, not called directly).
667
+
668
+ ### Step 6: Create fire-handoff.md (Unified Format)
669
+
670
+ Each executor creates a summary using the unified format:
671
+
672
+ ```markdown
673
+ ---
674
+ # Dominion Flow Frontmatter
675
+ phase: {N}-{name}
676
+ plan: NN
677
+ subsystem: {category}
678
+ duration: "{X} min"
679
+ start_time: "{ISO timestamp}"
680
+ end_time: "{ISO timestamp}"
681
+
682
+ # Skills & Quality (WARRIOR)
683
+ skills_applied:
684
+ - "{category}/{skill}"
685
+ honesty_checkpoints:
686
+ - task: {N}
687
+ gap: "{what was uncertain}"
688
+ action: "{how it was resolved}"
689
+ validation_score: {X}/70
690
+
691
+ # Dominion Flow Execution Metadata
692
+ requires: [dependencies]
693
+ provides: [what this creates]
694
+ key_files:
695
+ created: [list]
696
+ modified: [list]
697
+ key_decisions:
698
+ - "{decision made during execution}"
699
+ ---
700
+
701
+ # Power Handoff: Plan {N}-{NN}
702
+
703
+ ## Quick Summary
704
+ {One paragraph of what was accomplished}
705
+
706
+ ## Dominion Flow Accomplishments
707
+ {Task commits, files created/modified, decisions}
708
+
709
+ ## Skills Applied (WARRIOR)
710
+ {Which skills were used and how}
711
+
712
+ ## WARRIOR 7-Step Handoff
713
+ {W-A-R-R-I-O-R sections}
714
+ ```
715
+
716
+ ### Step 7: Wait for Breath Completion (Dominion Flow Standard)
717
+
718
+ ```
719
+ â—† Breath {W} in progress...
720
+ ├─ ⚡ Plan {N}-01: Running (backend)
721
+ └─ ⚡ Plan {N}-02: Running (frontend)
722
+
723
+ [After completion]
724
+
725
+ ✓ Breath {W} complete
726
+ ├─ ✓ Plan {N}-01: Complete (12 min)
727
+ └─ ✓ Plan {N}-02: Complete (8 min)
728
+ ```
729
+
730
+ **Breath Completion Checks:**
731
+ - All executors finished
732
+ - All RECORD.md files created
733
+ - No blocking errors
734
+
735
+ **If Blocking Error:**
736
+ - Create `.continue-here.md` with context
737
+ - Pause execution
738
+ - Display error and recovery instructions
739
+
740
+ ### Step 7.4: Post-Feature Config Sync (v10.0)
741
+
742
+ After breath completion, check if new features need config file updates.
743
+
744
+ **Trigger conditions:**
745
+ - Breath created new feature with `enabled` toggle
746
+ - Breath added new config keys referenced in DEFAULT_CONFIG but not in user config
747
+ - Breath created settings UI that references config paths
748
+
749
+ **Actions:**
750
+ 1. Detect config files in project (*.yaml, *.json, *.toml)
751
+ 2. If deep_merge/defaults pattern detected:
752
+ - Load config through app's config loader
753
+ - Save back to disk (writes merged defaults)
754
+ - Log: `"Config synced: {file} now includes {N} new feature sections"`
755
+ 3. If settings dialog exists:
756
+ - Verify all new features appear in GUI widget list
757
+ - Log: `"Settings dialog covers {N}/{M} features"`
758
+
759
+ **If no config pattern detected:** Skip silently.
760
+
761
+ ### Step 7.5: Versioned Context Checkpoint (v6.0 — GCC)
762
+
763
+ > **Research basis:** GCC (Jul 2025) — Git-style versioned context management.
764
+ > Achieved 48% on SWE-Bench-Lite. Agents spontaneously adopted disciplined behaviors
765
+ > when they knew they could checkpoint and rollback.
766
+
767
+ After each breath completes successfully, create a checkpoint commit:
768
+
769
+ ```
770
+ IF breath completed without blocking errors:
771
+
772
+ # 1. Stage all modified files from this breath
773
+ git add {files from breath RECORD.md frontmatter: key_files.created + key_files.modified}
774
+
775
+ # 2. Create checkpoint commit
776
+ git commit -m "checkpoint: phase {N} breath {W} complete — {summary}
777
+
778
+ Files: {count} modified, {count} created
779
+ Plans: {list of plan IDs completed in this breath}
780
+ Dominion Flow v6.0 checkpoint"
781
+
782
+ # 3. Record checkpoint hash
783
+ checkpoint_hash = git rev-parse HEAD
784
+
785
+ # 4. Update CONSCIENCE.md with checkpoint
786
+ Append to CONSCIENCE.md under ## Checkpoints:
787
+ | Breath | Commit | Date | Plans | Status |
788
+ | {W} | {checkpoint_hash:7} | {date} | {plan IDs} | Complete |
789
+
790
+ Display:
791
+ "Checkpoint: {checkpoint_hash:7} — Breath {W} complete ({plans count} plans)"
792
+
793
+ IF breath FAILED and checkpoint exists:
794
+ # Offer rollback option
795
+ Display:
796
+ "Breath {W} failed. Last checkpoint: {last_checkpoint_hash:7}
797
+ To rollback: git reset --hard {last_checkpoint_hash}
798
+ To continue: fix blocking error and re-run"
799
+ ```
800
+
801
+ **Note:** Only commit files tracked by the plan. Never auto-commit .env, credentials, or
802
+ files not in the BLUEPRINT.md scope. This is a lightweight GCC adaptation, not full branching.
803
+
804
+ ---
805
+
806
+ ### Step 7.6: Classify Review Depth (v8.0)
807
+
808
+ Determine review depth from phase scope:
809
+
810
+ ```
811
+ total_files = count of all key_files.created + key_files.modified across SUMMARYs
812
+ has_security = any file in auth/, security/, middleware/, crypto/
813
+ has_cross_cutting = files span 3+ top-level directories
814
+
815
+ IF total_files <= 3 AND NOT has_security:
816
+ review_depth = "shallow" → 5 personas (Simplicity + Security + Perf + Test + Pattern)
817
+ ELIF total_files >= 10 OR has_security OR has_cross_cutting:
818
+ review_depth = "deep" → 16 personas + cross-file analysis
819
+ ELSE:
820
+ review_depth = "normal" → 16 personas
821
+ ```
822
+
823
+ ---
824
+
825
+ ### Step 7.7: Mandatory Skill Extraction (v10.0)
826
+
827
+ After each phase completes, automatically evaluate whether the build produced
828
+ reusable patterns worth capturing as skills.
829
+
830
+ **This step is MANDATORY after every build phase.** It runs the skill creation
831
+ wizard in auto-detection mode with duplicate checking.
832
+
833
+ ```
834
+ # 1. Analyze what was built in this phase
835
+ built_files = all key_files.created from phase SUMMARYs
836
+ built_patterns = extract_patterns(built_files)
837
+ Patterns to detect:
838
+ - Config-driven feature toggles (togglable pipeline)
839
+ - Settings dialogs generated from config
840
+ - Thread-safety patterns (cross-thread marshaling)
841
+ - API route patterns (CRUD, auth, middleware)
842
+ - Component hierarchies (parent→child wiring)
843
+ - Build/deploy configurations
844
+ - Error handling strategies
845
+ - Data migration patterns
846
+
847
+ # 2. Check for duplicates against existing skills
848
+ FOR each detected pattern:
849
+ /fire-search "{pattern keywords}" --scope general
850
+ IF similarity > 80%:
851
+ Log: "Skill already exists: {existing_skill_name} (skip)"
852
+ CONTINUE
853
+ ELIF similarity > 50%:
854
+ Log: "Similar skill found: {existing_skill_name} — consider updating"
855
+ # Offer to update existing skill with new insights
856
+ ELSE:
857
+ # New pattern — queue for skill creation
858
+
859
+ # 3. Create skills for novel patterns
860
+ IF new_patterns.length > 0:
861
+ Display:
862
+ "◆ Skill extraction found {N} new patterns:
863
+ ├─ {pattern_1_name} (no existing match)
864
+ ├─ {pattern_2_name} (partial match — update candidate)
865
+ └─ ...
866
+
867
+ Auto-create skills? [Yes / No / Review each]"
868
+
869
+ IF Yes (default in autonomous mode):
870
+ FOR each new_pattern:
871
+ /fire-add-new-skill --from session --quick
872
+ # Uses --quick flag for minimal prompts
873
+ # Security scan + credential filter still run (Steps 4.5, 4.6)
874
+
875
+ IF No:
876
+ Log: "Skill extraction skipped by user. Patterns noted in autonomous-log.md"
877
+
878
+ # 4. Log results
879
+ Append to .planning/autonomous-log.md:
880
+ ## Skill Extraction — Phase {N}
881
+ Patterns detected: {count}
882
+ New skills created: {count}
883
+ Duplicates skipped: {count}
884
+ Updates suggested: {count}
885
+ ```
886
+
887
+ **In autonomous mode:** Skills are auto-created (Yes is default). The security
888
+ scan and credential filter gates in `/fire-add-new-skill` (Steps 4.5, 4.6)
889
+ still run to prevent malicious or leaked content.
890
+
891
+ **In manual mode:** User is prompted for each pattern.
892
+
893
+ ---
894
+
895
+ ### Step 8: Spawn Parallel Verification + Review (v8.0)
896
+
897
+ After all breaths complete, spawn BOTH agents simultaneously:
898
+
899
+ ```
900
+ IF --skip-review NOT set:
901
+
902
+ â—† Spawning parallel verification + review for Phase {N}...
903
+ â"œâ"€ fire-verifier: 70-point WARRIOR validation
904
+ â""â"€ fire-reviewer: {review_depth} review (Simplicity + 15 personas)
905
+
906
+ # Spawn fire-verifier (existing â€" unchanged)
907
+ Task(subagent_type="fire-verifier", prompt="""
908
+ Phase: {N}, Plans: {list}, Must-Haves: {count}
909
+ @references/validation-checklist.md
910
+ """)
911
+
912
+ # Spawn fire-reviewer (NEW â€" v8.0)
913
+ Task(subagent_type="fire-reviewer", prompt="""
914
+ <review_scope>
915
+ Phase: {N} - {name}
916
+ Review Depth: {review_depth}
917
+ </review_scope>
918
+
919
+ <files_to_review>
920
+ {all key_files.created + key_files.modified from RECORD.md files}
921
+ </files_to_review>
922
+
923
+ <plan_intent>
924
+ {Quick Summary from each RECORD.md â€" what was INTENDED vs what was built}
925
+ </plan_intent>
926
+
927
+ <simplicity_mandate>
928
+ STRICT: Flag over-engineering as HIGH.
929
+ Three similar lines > premature abstraction.
930
+ Direct approach > clever approach.
931
+ If a junior dev can't read it in 30 seconds â†' too complex.
932
+ </simplicity_mandate>
933
+
934
+ Output to: .planning/phases/{N}-{name}/{N}-REVIEW.md
935
+ """)
936
+
937
+ ELSE:
938
+ # Only verifier (legacy behavior â€" --skip-review was passed)
939
+ â—† Spawning fire-verifier for Phase {N}... (review skipped)
940
+ Task(subagent_type="fire-verifier", prompt="""
941
+ Phase: {N}, Plans: {list}, Must-Haves: {count}
942
+ @references/validation-checklist.md
943
+ """)
944
+ ```
945
+
946
+ **Route based on verifier result (when review skipped):**
947
+ - **PASS:** Proceed to Step 9
948
+ - **FAIL with gaps:** Create gap closure plan, route to `/fire-2-plan {N} --gaps`
949
+
950
+ ### Step 8.5: Merge Gate â€" Combined Quality Decision (v8.0)
951
+
952
+ Wait for BOTH agents to complete, then evaluate combined verdict.
953
+
954
+ **Autonomous Mode Routing (v9.0):**
955
+
956
+ ```
957
+ IF --autonomous flag is set:
958
+
959
+ IF combined_verdict == "READY FOR HUMAN":
960
+ Log to autonomous-log: "Merge gate: READY FOR HUMAN (auto-proceeding)"
961
+ → Skip display, continue to Step 9 (CONSCIENCE.md update)
962
+
963
+ IF combined_verdict contains "FIX":
964
+ Log to autonomous-log: "Merge gate: FIX required (auto-routing to fix cycle)"
965
+ → Route to gap closure automatically (no Options display)
966
+
967
+ // Non-autonomous mode: fall through to standard display below
968
+ ```
969
+
970
+ **COMBINED VERDICT MATRIX:**
971
+
972
+ | Verifier â†" / Reviewer â†' | APPROVE | APPROVE W/ FIXES | BLOCK |
973
+ |--------------------------|---------|------------------|-------|
974
+ | APPROVED | READY FOR HUMAN | FIX REVIEW FINDINGS | FIX BLOCKERS |
975
+ | CONDITIONAL | FIX VERIFIER GAPS | FIX BOTH | FIX BOTH |
976
+ | REJECTED | FIX VERIFIER | FIX BOTH | FIX BOTH (critical) |
977
+
978
+ **RULE:** The stricter verdict ALWAYS wins.
979
+
980
+ **DISAGREEMENT HANDLING:**
981
+
982
+ ```
983
+ Verifier APPROVED + Reviewer BLOCK:
984
+ "Code passes tests but has quality/simplicity issues.
985
+ FIX BEFORE HUMAN TESTING."
986
+ (This is the MOST VALUABLE case â€" why redundancy exists)
987
+
988
+ Verifier REJECTED + Reviewer APPROVE:
989
+ "Code is clean but doesn't work. Fix functional failures first."
990
+ ```
991
+
992
+ **Display combined result:**
993
+
994
+ ```
995
+ â•"â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•—
996
+ â•' MERGE GATE â€" Phase {N} â•'
997
+ â• â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•£
998
+ â•' â•'
999
+ â•' Verifier: {X}/70 â€" {APPROVED/CONDITIONAL/REJECTED} â•'
1000
+ â•' Reviewer: {verdict} â€" {critical}C / {high}H / {medium}M / {low}L â•'
1001
+ â•' Simplicity: {N} over-engineering flags â•'
1002
+ â•' â•'
1003
+ â•' Combined Verdict: {READY FOR HUMAN / FIX REVIEW FINDINGS / FIX BOTH} â•'
1004
+ â•' â•'
1005
+ â•' {If FIX needed:} â•'
1006
+ â•' Issues to resolve: â•'
1007
+ â•' ✗ {file:line â€" description} â•'
1008
+ â•' ✗ {file:line â€" description} â•'
1009
+ â•' â•'
1010
+ â•' Options: â•'
1011
+ â•' A) Fix issues â•'
1012
+ â•' B) Override with known issues â•'
1013
+ â•' C) Gap closure plan â•'
1014
+ â•' â•'
1015
+ ╚â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
1016
+ ```
1017
+
1018
+ **FEEDBACK LOOP (Behavioral Directive Proposals):**
1019
+
1020
+ ```
1021
+ IF reviewer found CRITICAL or HIGH findings:
1022
+ For each finding with severity >= HIGH:
1023
+ Add proposed behavioral directive:
1024
+ IF: {condition from finding}
1025
+ DONT: {the anti-pattern or over-engineering found}
1026
+ BECAUSE: {reviewer explanation}
1027
+ Source: fire-reviewer Phase {N} | Confidence: 1/5
1028
+ ```
1029
+
1030
+ **VERSION PERFORMANCE TRACKING (v8.0):**
1031
+
1032
+ ```
1033
+ After gate verdict is displayed and user responds:
1034
+
1035
+ Record outcome to .planning/version-performance.md:
1036
+
1037
+ | Date | Version | Gate | Verdict | Override? | Outcome | Notes |
1038
+ | {now} | v8.0 | merge | {verdict} | {A=no, B=yes} | pending | Phase {N} |
1039
+
1040
+ "Override?" = yes if user chose option B (override with known issues)
1041
+ "Outcome" = filled retroactively after human testing (correct/false-positive/false-negative)
1042
+
1043
+ AFTER 5+ records exist, check degradation signals:
1044
+ - override_rate > 40% → rules too strict, suggest rollback
1045
+ - false_positive_rate > 30% → gate crying wolf, retire offending rule
1046
+ - Same rule overridden 3+ times → retire that specific rule
1047
+ See: references/behavioral-directives.md § Version Performance Registry
1048
+ ```
1049
+
1050
+ ### Step 8.75: Auto-Route Merge Gate (v10.0 — Default Autonomous)
1051
+
1052
+ By default (v10.0), execution auto-routes based on combined_verdict without human pause:
1053
+
1054
+ ```
1055
+ IF combined_verdict in ["APPROVED", "APPROVE"]:
1056
+ → Auto-advance to next breath. No human pause.
1057
+ → Log: "Auto-routed: {verdict} (score {N}/70)"
1058
+
1059
+ IF combined_verdict in ["CONDITIONAL", "APPROVE WITH FIXES"]:
1060
+ → Auto-advance but log gaps to .planning/autonomous-notes.md
1061
+ → Log: "Auto-routed with notes: {N} non-critical gaps"
1062
+
1063
+ IF combined_verdict in ["REJECTED", "BLOCK"]:
1064
+ → STOP. Display blocker. Request human intervention.
1065
+ → This is the ONLY case where execution pauses.
1066
+
1067
+ IF --manual flag is set:
1068
+ → Revert to v9.0 behavior: display all checkpoints, wait for human.
1069
+ ```
1070
+
1071
+ **Safety gates ALWAYS active regardless of mode:**
1072
+ - Path verification (MANDATORY — cannot disable)
1073
+ - HAC enforcement (confidence 5/5 rules)
1074
+ - Circuit breaker (stall/spin/degrade detect)
1075
+ - Power-verifier (70-point WARRIOR validation)
1076
+ - Power-reviewer (16-persona code review)
1077
+
1078
+ ### Step 9: Update CONSCIENCE.md and SKILLS-INDEX.md
1079
+
1080
+ **CONSCIENCE.md Updates:**
1081
+ ```markdown
1082
+ ## Current Position
1083
+ - Phase: {N} of {total}
1084
+ - Status: Complete (or Verified with gaps)
1085
+ - Last activity: {timestamp} - Phase {N} execution complete
1086
+
1087
+ ## WARRIOR Integration
1088
+ - Skills Applied: {new_total} total
1089
+ - {skill-1} (Phase {N}, Plan {NN})
1090
+ - {skill-2} (Phase {N}, Plan {NN})
1091
+ - Honesty Checkpoints: {count}
1092
+ - Validation Status: Phase {N} passed {X}/70 checks
1093
+ - Code Review: Phase {N} {reviewer_verdict} ({critical}/{high}/{medium}/{low})
1094
+ - Combined Gate: {combined_verdict}
1095
+ - Simplicity Findings: {count of Simplicity Guardian findings}
1096
+ ```
1097
+
1098
+ **SKILLS-INDEX.md Updates:**
1099
+ ```markdown
1100
+ ## By Phase
1101
+
1102
+ ### Phase {N}: {name}
1103
+ **Plan {N}-01:**
1104
+ - {category}/{skill-1}
1105
+ - {category}/{skill-2}
1106
+
1107
+ **Plan {N}-02:**
1108
+ - {category}/{skill-3}
1109
+ ```
1110
+
1111
+ ---
1112
+
1113
+ ## Agent Spawning Instructions
1114
+
1115
+ ### fire-executor (Parallel per Plan)
1116
+
1117
+ **Agent File:** `@agents/fire-executor.md`
1118
+
1119
+ **Spawn Pattern:**
1120
+ ```
1121
+ For each plan in breath:
1122
+ Spawn fire-executor with:
1123
+ - Plan file context
1124
+ - Skills library context
1125
+ - Honesty protocol reminder
1126
+ ```
1127
+
1128
+ **Executor Outputs:**
1129
+ - Task implementations
1130
+ - `{N}-{NN}-RECORD.md` (fire-handoff format)
1131
+ - SKILLS-INDEX.md updates
1132
+
1133
+ ### fire-verifier (After All Breaths)
1134
+
1135
+ **Agent File:** `@agents/fire-verifier.md`
1136
+
1137
+ **Context:**
1138
+ ```markdown
1139
+ Phase: {N} - {name}
1140
+ Plans Executed: {list}
1141
+ Must-Haves: {aggregated from all plans}
1142
+ WARRIOR Validation: {checklist}
1143
+ ```
1144
+
1145
+ **Verifier Outputs:**
1146
+ - `{N}-VERIFICATION.md`
1147
+ - Gap analysis (if any)
1148
+
1149
+ ### fire-reviewer (Parallel with Verifier — v8.0)
1150
+
1151
+ **Agent File:** `@agents/fire-reviewer.md`
1152
+
1153
+ **Context:**
1154
+ ```markdown
1155
+ <review_scope>
1156
+ Phase: {N} - {name}
1157
+ Review Depth: {shallow|normal|deep} (from Step 7.6)
1158
+ </review_scope>
1159
+
1160
+ <files_to_review>
1161
+ {All key_files.created + key_files.modified from RECORD.md files}
1162
+ </files_to_review>
1163
+
1164
+ <plan_intent>
1165
+ {Quick Summary from each RECORD.md}
1166
+ </plan_intent>
1167
+
1168
+ <simplicity_mandate>STRICT</simplicity_mandate>
1169
+ ```
1170
+
1171
+ **Reviewer Outputs:**
1172
+ - `{N}-REVIEW.md`
1173
+ - Severity table (CRITICAL/HIGH/MEDIUM/LOW)
1174
+ - Proposed behavioral directives for HIGH+ findings
1175
+
1176
+ ---
1177
+
1178
+ ## Success Criteria
1179
+
1180
+ ### Required Outputs
1181
+ - [ ] All plans in phase executed
1182
+ - [ ] Quick Self-Judge run after each task (v5.0)
1183
+ - [ ] All RECORD.md files created (fire-handoff format)
1184
+ - [ ] All verification commands passed
1185
+ - [ ] SKILLS-INDEX.md updated
1186
+ - [ ] CONSCIENCE.md updated
1187
+ - [ ] VERIFICATION.md created
1188
+ - [ ] Must-haves verified
1189
+ - [ ] Code review run in parallel with verification (v8.0)
1190
+ - [ ] {N}-REVIEW.md created alongside {N}-VERIFICATION.md
1191
+ - [ ] Combined quality gate evaluated — both must agree
1192
+ - [ ] CRITICAL/HIGH findings fed into behavioral directives
1193
+ - [ ] Simplicity Guardian findings surfaced in report
1194
+
1195
+ ### Completion Display
1196
+
1197
+ ```
1198
+ ╔══════════════════════════════════════════════════════════════════════════════╗
1199
+ ║ ✓ PHASE {N} EXECUTION COMPLETE ║
1200
+ ╠══════════════════════════════════════════════════════════════════════════════╣
1201
+ â•‘ â•‘
1202
+ â•‘ Phase: {N} - {name} â•‘
1203
+ â•‘ Plans Executed: {count} â•‘
1204
+ â•‘ Breaths: {wave_count} â•‘
1205
+ â•‘ Total Time: {duration} â•‘
1206
+ â•‘ â•‘
1207
+ â•‘ Execution Summary: â•‘
1208
+ â•‘ Breath 1: â•‘
1209
+ ║ ✓ {N}-01 - {description} (12 min) ║
1210
+ ║ ✓ {N}-02 - {description} (8 min) ║
1211
+ â•‘ Breath 2: â•‘
1212
+ ║ ✓ {N}-03 - {description} (15 min) ║
1213
+ â•‘ â•‘
1214
+ â•‘ Skills Applied: {count} â•‘
1215
+ â•‘ Honesty Checkpoints: {count} â•‘
1216
+ â•‘ Validation: {X}/70 checks passed â•‘
1217
+ â•‘ â•‘
1218
+ ╠══════════════════════════════════════════════════════════════════════════════╣
1219
+ â•‘ NEXT UP â•‘
1220
+ ├──────────────────────────────────────────────────────────────────────────────┤
1221
+ â•‘ â•‘
1222
+ ║ → Run `/fire-4-verify {N}` for detailed validation report ║
1223
+ ║ → Or run `/fire-2-plan {N+1}` to plan next phase ║
1224
+ ║ → Or run `/fire-5-handoff` to create session handoff ║
1225
+ â•‘ â•‘
1226
+ ╚══════════════════════════════════════════════════════════════════════════════╝
1227
+ ```
1228
+
1229
+ ---
1230
+
1231
+ ## Error Handling
1232
+
1233
+ ### Executor Blocked
1234
+
1235
+ ```
1236
+ ╔══════════════════════════════════════════════════════════════════════════════╗
1237
+ â•‘ âš  EXECUTION BLOCKED â•‘
1238
+ ╠══════════════════════════════════════════════════════════════════════════════╣
1239
+ â•‘ â•‘
1240
+ â•‘ Plan {N}-{NN} encountered a blocking issue: â•‘
1241
+ â•‘ â•‘
1242
+ â•‘ Issue: {description} â•‘
1243
+ â•‘ Task: {task number and description} â•‘
1244
+ â•‘ â•‘
1245
+ â•‘ Created: .planning/phases/{N}-{name}/.continue-here.md â•‘
1246
+ â•‘ â•‘
1247
+ â•‘ Options: â•‘
1248
+ â•‘ A) Resolve issue and run `/fire-3-execute {N} --continue` â•‘
1249
+ â•‘ B) Skip this plan: `/fire-3-execute {N} --skip {N}-{NN}` â•‘
1250
+ â•‘ C) Create handoff: `/fire-5-handoff` â•‘
1251
+ â•‘ â•‘
1252
+ ╚══════════════════════════════════════════════════════════════════════════════╝
1253
+ ```
1254
+
1255
+ ### Verification Failed
1256
+
1257
+ ```
1258
+ ╔══════════════════════════════════════════════════════════════════════════════╗
1259
+ â•‘ âš  VERIFICATION GAPS DETECTED â•‘
1260
+ ╠══════════════════════════════════════════════════════════════════════════════╣
1261
+ â•‘ â•‘
1262
+ â•‘ Phase {N} execution complete but verification found gaps: â•‘
1263
+ â•‘ â•‘
1264
+ â•‘ Gaps: â•‘
1265
+ ║ ✗ Must-have: "User can paginate results" - Not verified ║
1266
+ ║ ✗ WARRIOR: Test coverage 65% (required 80%) ║
1267
+ â•‘ â•‘
1268
+ â•‘ Options: â•‘
1269
+ â•‘ A) Run `/fire-2-plan {N} --gaps` to plan gap closure â•‘
1270
+ â•‘ B) Run `/fire-4-verify {N}` for detailed report â•‘
1271
+ â•‘ C) Accept gaps and proceed: `/fire-2-plan {N+1}` â•‘
1272
+ â•‘ â•‘
1273
+ ╚══════════════════════════════════════════════════════════════════════════════╝
1274
+ ```
1275
+
1276
+ ### Breath Timeout
1277
+
1278
+ ```
1279
+ ┌─────────────────────────────────────────────────────────────────────────────┐
1280
+ │ ⚠ WARNING: Breath Timeout │
1281
+ ├─────────────────────────────────────────────────────────────────────────────┤
1282
+ │ │
1283
+ │ Breath {W} exceeded expected duration. │
1284
+ │ │
1285
+ │ Status: │
1286
+ │ ✓ Plan {N}-01: Complete │
1287
+ │ ◆ Plan {N}-02: Still running (45 min) │
1288
+ │ │
1289
+ │ Action: Continuing to wait... (use Ctrl+C to interrupt) │
1290
+ │ │
1291
+ └─────────────────────────────────────────────────────────────────────────────┘
1292
+ ```
1293
+
1294
+ ---
1295
+
1296
+ ## References
1297
+
1298
+ - **Agent:** `@agents/fire-executor.md` - Execution agent with honesty protocols
1299
+ - **Agent:** `@agents/fire-verifier.md` - Verification agent with combined checks
1300
+ - **Template:** `@templates/fire-handoff.md` - Unified summary format
1301
+ - **Protocol:** `@references/honesty-protocols.md` - Execution honesty guidance
1302
+ - **Protocol:** `@references/validation-checklist.md` - 70-point validation
1303
+ - **Brand:** `@references/ui-brand.md` - Visual output standards