mindforge-cc 2.1.0 → 2.1.2

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 (236) hide show
  1. package/.agent/bin/lib/commands.cjs +959 -0
  2. package/.agent/bin/lib/config.cjs +421 -0
  3. package/.agent/bin/lib/core.cjs +1166 -0
  4. package/.agent/bin/lib/frontmatter.cjs +307 -0
  5. package/.agent/bin/lib/init.cjs +1336 -0
  6. package/.agent/bin/lib/milestone.cjs +252 -0
  7. package/.agent/bin/lib/model-profiles.cjs +68 -0
  8. package/.agent/bin/lib/phase.cjs +888 -0
  9. package/.agent/bin/lib/profile-output.cjs +952 -0
  10. package/.agent/bin/lib/profile-pipeline.cjs +539 -0
  11. package/.agent/bin/lib/roadmap.cjs +329 -0
  12. package/.agent/bin/lib/security.cjs +356 -0
  13. package/.agent/bin/lib/state.cjs +969 -0
  14. package/.agent/bin/lib/template.cjs +222 -0
  15. package/.agent/bin/lib/uat.cjs +189 -0
  16. package/.agent/bin/lib/verify.cjs +851 -0
  17. package/.agent/bin/lib/workstream.cjs +491 -0
  18. package/.agent/bin/mindforge-tools.cjs +897 -0
  19. package/.agent/file-manifest.json +219 -0
  20. package/.agent/hooks/mindforge-check-update.js +114 -0
  21. package/.agent/hooks/mindforge-context-monitor.js +156 -0
  22. package/.agent/hooks/mindforge-prompt-guard.js +96 -0
  23. package/.agent/hooks/mindforge-statusline.js +119 -0
  24. package/.agent/hooks/mindforge-workflow-guard.js +94 -0
  25. package/.agent/mindforge/discuss-phase.md +1 -1
  26. package/.agent/mindforge/help.md +1 -1
  27. package/.agent/mindforge/learn.md +3 -2
  28. package/.agent/mindforge/research.md +3 -2
  29. package/.agent/mindforge/steer.md +1 -1
  30. package/.agent/settings.json +38 -0
  31. package/.agent/skills/mindforge-add-backlog/SKILL.md +72 -0
  32. package/.agent/skills/mindforge-add-phase/SKILL.md +39 -0
  33. package/.agent/skills/mindforge-add-tests/SKILL.md +28 -0
  34. package/.agent/skills/mindforge-add-todo/SKILL.md +42 -0
  35. package/.agent/skills/mindforge-audit-milestone/SKILL.md +29 -0
  36. package/.agent/skills/mindforge-audit-uat/SKILL.md +20 -0
  37. package/.agent/skills/mindforge-autonomous/SKILL.md +33 -0
  38. package/.agent/skills/mindforge-check-todos/SKILL.md +40 -0
  39. package/.agent/skills/mindforge-cleanup/SKILL.md +19 -0
  40. package/.agent/skills/mindforge-complete-milestone/SKILL.md +131 -0
  41. package/.agent/skills/mindforge-debug/SKILL.md +163 -0
  42. package/.agent/skills/mindforge-discuss-phase/SKILL.md +54 -0
  43. package/.agent/skills/mindforge-do/SKILL.md +26 -0
  44. package/.agent/skills/mindforge-execute-phase/SKILL.md +49 -0
  45. package/.agent/skills/mindforge-fast/SKILL.md +23 -0
  46. package/.agent/skills/mindforge-forensics/SKILL.md +49 -0
  47. package/.agent/skills/mindforge-health/SKILL.md +17 -0
  48. package/.agent/skills/mindforge-help/SKILL.md +23 -0
  49. package/.agent/skills/mindforge-insert-phase/SKILL.md +28 -0
  50. package/.agent/skills/mindforge-join-discord/SKILL.md +19 -0
  51. package/.agent/skills/mindforge-list-phase-assumptions/SKILL.md +41 -0
  52. package/.agent/skills/mindforge-list-workspaces/SKILL.md +17 -0
  53. package/.agent/skills/mindforge-manager/SKILL.md +32 -0
  54. package/.agent/skills/mindforge-map-codebase/SKILL.md +64 -0
  55. package/.agent/skills/mindforge-milestone-summary/SKILL.md +44 -0
  56. package/.agent/skills/mindforge-new-milestone/SKILL.md +38 -0
  57. package/.agent/skills/mindforge-new-project/SKILL.md +36 -0
  58. package/.agent/skills/mindforge-new-workspace/SKILL.md +39 -0
  59. package/.agent/skills/mindforge-next/SKILL.md +19 -0
  60. package/.agent/skills/mindforge-note/SKILL.md +29 -0
  61. package/.agent/skills/mindforge-pause-work/SKILL.md +35 -0
  62. package/.agent/skills/mindforge-plan-milestone-gaps/SKILL.md +28 -0
  63. package/.agent/skills/mindforge-plan-phase/SKILL.md +37 -0
  64. package/.agent/skills/mindforge-plant-seed/SKILL.md +22 -0
  65. package/.agent/skills/mindforge-pr-branch/SKILL.md +21 -0
  66. package/.agent/skills/mindforge-profile-user/SKILL.md +38 -0
  67. package/.agent/skills/mindforge-progress/SKILL.md +19 -0
  68. package/.agent/skills/mindforge-quick/SKILL.md +38 -0
  69. package/.agent/skills/mindforge-reapply-patches/SKILL.md +124 -0
  70. package/.agent/skills/mindforge-remove-phase/SKILL.md +26 -0
  71. package/.agent/skills/mindforge-remove-workspace/SKILL.md +22 -0
  72. package/.agent/skills/mindforge-research-phase/SKILL.md +186 -0
  73. package/.agent/skills/mindforge-resume-work/SKILL.md +35 -0
  74. package/.agent/skills/mindforge-review/SKILL.md +31 -0
  75. package/.agent/skills/mindforge-review-backlog/SKILL.md +58 -0
  76. package/.agent/skills/mindforge-session-report/SKILL.md +16 -0
  77. package/.agent/skills/mindforge-set-profile/SKILL.md +9 -0
  78. package/.agent/skills/mindforge-settings/SKILL.md +32 -0
  79. package/.agent/skills/mindforge-ship/SKILL.md +16 -0
  80. package/.agent/skills/mindforge-stats/SKILL.md +16 -0
  81. package/.agent/skills/mindforge-thread/SKILL.md +123 -0
  82. package/.agent/skills/mindforge-ui-phase/SKILL.md +24 -0
  83. package/.agent/skills/mindforge-ui-review/SKILL.md +24 -0
  84. package/.agent/skills/mindforge-update/SKILL.md +35 -0
  85. package/.agent/skills/mindforge-validate-phase/SKILL.md +26 -0
  86. package/.agent/skills/mindforge-verify-work/SKILL.md +30 -0
  87. package/.agent/skills/mindforge-workstreams/SKILL.md +65 -0
  88. package/.agent/workflows/mindforge-add-phase.md +112 -0
  89. package/.agent/workflows/mindforge-add-tests.md +351 -0
  90. package/.agent/workflows/mindforge-add-todo.md +158 -0
  91. package/.agent/workflows/mindforge-audit-milestone.md +332 -0
  92. package/.agent/workflows/mindforge-audit-uat.md +109 -0
  93. package/.agent/workflows/mindforge-autonomous.md +815 -0
  94. package/.agent/workflows/mindforge-check-todos.md +177 -0
  95. package/.agent/workflows/mindforge-cleanup.md +152 -0
  96. package/.agent/workflows/mindforge-complete-milestone.md +766 -0
  97. package/.agent/workflows/mindforge-diagnose-issues.md +220 -0
  98. package/.agent/workflows/mindforge-discovery-phase.md +289 -0
  99. package/.agent/workflows/mindforge-discuss-phase-assumptions.md +645 -0
  100. package/.agent/workflows/mindforge-discuss-phase.md +1047 -0
  101. package/.agent/workflows/mindforge-do.md +104 -0
  102. package/.agent/workflows/mindforge-execute-phase.md +838 -0
  103. package/.agent/workflows/mindforge-execute-plan.md +509 -0
  104. package/.agent/workflows/mindforge-fast.md +105 -0
  105. package/.agent/workflows/mindforge-forensics.md +265 -0
  106. package/.agent/workflows/mindforge-health.md +181 -0
  107. package/.agent/workflows/mindforge-help.md +606 -0
  108. package/.agent/workflows/mindforge-insert-phase.md +130 -0
  109. package/.agent/workflows/mindforge-list-phase-assumptions.md +178 -0
  110. package/.agent/workflows/mindforge-list-workspaces.md +56 -0
  111. package/.agent/workflows/mindforge-manager.md +360 -0
  112. package/.agent/workflows/mindforge-map-codebase.md +370 -0
  113. package/.agent/workflows/mindforge-milestone-summary.md +223 -0
  114. package/.agent/workflows/mindforge-new-milestone.md +469 -0
  115. package/.agent/workflows/mindforge-new-project.md +1226 -0
  116. package/.agent/workflows/mindforge-new-workspace.md +237 -0
  117. package/.agent/workflows/mindforge-next.md +97 -0
  118. package/.agent/workflows/mindforge-node-repair.md +92 -0
  119. package/.agent/workflows/mindforge-note.md +156 -0
  120. package/.agent/workflows/mindforge-pause-work.md +176 -0
  121. package/.agent/workflows/mindforge-plan-milestone-gaps.md +273 -0
  122. package/.agent/workflows/mindforge-plan-phase.md +848 -0
  123. package/.agent/workflows/mindforge-plant-seed.md +169 -0
  124. package/.agent/workflows/mindforge-pr-branch.md +129 -0
  125. package/.agent/workflows/mindforge-profile-user.md +450 -0
  126. package/.agent/workflows/mindforge-progress.md +507 -0
  127. package/.agent/workflows/mindforge-quick.md +732 -0
  128. package/.agent/workflows/mindforge-remove-phase.md +155 -0
  129. package/.agent/workflows/mindforge-remove-workspace.md +90 -0
  130. package/.agent/workflows/mindforge-research-phase.md +74 -0
  131. package/.agent/workflows/mindforge-resume-project.md +325 -0
  132. package/.agent/workflows/mindforge-review.md +228 -0
  133. package/.agent/workflows/mindforge-session-report.md +146 -0
  134. package/.agent/workflows/mindforge-settings.md +283 -0
  135. package/.agent/workflows/mindforge-ship.md +228 -0
  136. package/.agent/workflows/mindforge-stats.md +60 -0
  137. package/.agent/workflows/mindforge-transition.md +671 -0
  138. package/.agent/workflows/mindforge-ui-phase.md +290 -0
  139. package/.agent/workflows/mindforge-ui-review.md +157 -0
  140. package/.agent/workflows/mindforge-update.md +323 -0
  141. package/.agent/workflows/mindforge-validate-phase.md +167 -0
  142. package/.agent/workflows/mindforge-verify-phase.md +254 -0
  143. package/.agent/workflows/mindforge-verify-work.md +623 -0
  144. package/.mindforge/personas/advisor-researcher.md +3 -3
  145. package/.mindforge/personas/debug-specialist.md +1 -1
  146. package/.mindforge/personas/debugger.md +1 -1
  147. package/.mindforge/personas/developer.md +1 -1
  148. package/.mindforge/personas/phase-researcher.md +4 -4
  149. package/.mindforge/personas/project-researcher.md +3 -3
  150. package/.mindforge/personas/research-agent.md +4 -3
  151. package/.mindforge/personas/tech-writer.md +1 -1
  152. package/.mindforge/personas/ui-researcher.md +1 -1
  153. package/.planning/ROADMAP.md +10 -0
  154. package/CHANGELOG.md +34 -0
  155. package/README.md +70 -45
  156. package/RELEASENOTES.md +26 -26
  157. package/bin/install.js +41 -41
  158. package/bin/installer-core.js +67 -26
  159. package/bin/wizard/setup-wizard.js +11 -24
  160. package/bin/wizard/theme.js +141 -0
  161. package/docs/PERSONAS.md +119 -87
  162. package/docs/References/checkpoints.md +778 -0
  163. package/docs/References/config-reference.md +81 -0
  164. package/docs/References/continuation-format.md +249 -0
  165. package/docs/References/decimal-phase-calculation.md +64 -0
  166. package/docs/References/git-integration.md +295 -0
  167. package/docs/References/git-planning-commit.md +38 -0
  168. package/docs/References/model-profile-resolution.md +36 -0
  169. package/docs/References/model-profiles.md +139 -0
  170. package/docs/References/phase-argument-parsing.md +61 -0
  171. package/docs/References/planning-config.md +202 -0
  172. package/docs/References/questioning.md +162 -0
  173. package/docs/References/tdd.md +263 -0
  174. package/docs/References/ui-brand.md +160 -0
  175. package/docs/References/user-profiling.md +681 -0
  176. package/docs/References/verification-patterns.md +612 -0
  177. package/docs/References/workstream-flag.md +58 -0
  178. package/docs/Templates/Agents/CLAUDE-MD.md +122 -0
  179. package/docs/Templates/Agents/COPILOT-INSTRUCTIONS.md +7 -0
  180. package/docs/Templates/Agents/DEBUGGER-PROMPT.md +91 -0
  181. package/docs/Templates/Agents/PLANNER-PROMPT.md +117 -0
  182. package/docs/Templates/Codebase/architecture.md +255 -0
  183. package/docs/Templates/Codebase/concerns.md +310 -0
  184. package/docs/Templates/Codebase/conventions.md +307 -0
  185. package/docs/Templates/Codebase/integrations.md +280 -0
  186. package/docs/Templates/Codebase/stack.md +186 -0
  187. package/docs/Templates/Codebase/structure.md +285 -0
  188. package/docs/Templates/Codebase/testing.md +480 -0
  189. package/docs/Templates/Execution/CONTINUE-HERE.md +78 -0
  190. package/docs/Templates/Execution/DISCUSSION-LOG.md +63 -0
  191. package/docs/Templates/Execution/PHASE-PROMPT.md +610 -0
  192. package/docs/Templates/Execution/STATE.md +176 -0
  193. package/docs/Templates/Execution/SUMMARY-COMPLEX.md +59 -0
  194. package/docs/Templates/Execution/SUMMARY-MINIMAL.md +41 -0
  195. package/docs/Templates/Execution/SUMMARY-STANDARD.md +48 -0
  196. package/docs/Templates/Execution/SUMMARY.md +248 -0
  197. package/docs/Templates/Profile/DEV-PREFERENCES.md +21 -0
  198. package/docs/Templates/Profile/USER-PROFILE.md +146 -0
  199. package/docs/Templates/Profile/USER-SETUP.md +311 -0
  200. package/docs/Templates/Project/DISCOVERY.md +146 -0
  201. package/docs/Templates/Project/MILESTONE-ARCHIVE.md +123 -0
  202. package/docs/Templates/Project/MILESTONE.md +115 -0
  203. package/docs/Templates/Project/PROJECT.md +206 -0
  204. package/docs/Templates/Project/REQUIREMENTS.md +231 -0
  205. package/docs/Templates/Project/RETROSPECTIVE.md +54 -0
  206. package/docs/Templates/Project/ROADMAP.md +202 -0
  207. package/docs/Templates/Quality/DEBUG.md +164 -0
  208. package/docs/Templates/Quality/UAT.md +280 -0
  209. package/docs/Templates/Quality/UI-SPEC.md +100 -0
  210. package/docs/Templates/Quality/VALIDATION.md +76 -0
  211. package/docs/Templates/Quality/VERIFICATION-REPORT.md +322 -0
  212. package/docs/Templates/Research/ARCHITECTURE.md +204 -0
  213. package/docs/Templates/Research/FEATURES.md +147 -0
  214. package/docs/Templates/Research/PITFALLS.md +200 -0
  215. package/docs/Templates/Research/STACK.md +120 -0
  216. package/docs/Templates/Research/SUMMARY.md +170 -0
  217. package/docs/Templates/System/CONFIG.json +43 -0
  218. package/docs/Templates/System/CONTEXT.md +352 -0
  219. package/docs/architecture/README.md +54 -42
  220. package/docs/commands-reference.md +62 -14
  221. package/docs/getting-started.md +26 -18
  222. package/docs/skills-authoring-guide.md +40 -12
  223. package/docs/tutorial.md +83 -116
  224. package/docs/user-guide.md +72 -198
  225. package/package.json +7 -2
  226. package/.mindforge/memory/knowledge-base.jsonl +0 -7
  227. package/.mindforge/memory/pattern-library.jsonl +0 -1
  228. package/.mindforge/memory/team-preferences.jsonl +0 -4
  229. package/.planning/browser-daemon.log +0 -32
  230. package/docs/mindforge-md-reference.md +0 -57
  231. package/docs/reference/config-reference.md +0 -64
  232. /package/{.mindforge/memory/decision-library.jsonl → .planning/phases/01-migrate-gsd-to-mindforge/.gitkeep} +0 -0
  233. /package/docs/{reference → References}/audit-events.md +0 -0
  234. /package/docs/{reference → References}/commands.md +0 -0
  235. /package/docs/{reference → References}/sdk-api.md +0 -0
  236. /package/docs/{reference → References}/skills-api.md +0 -0
@@ -0,0 +1,815 @@
1
+ <purpose>
2
+
3
+ Drive all remaining milestone phases autonomously. For each incomplete phase: discuss → plan → execute using Skill() flat invocations. Pauses only for explicit user decisions (grey area acceptance, blockers, validation requests). Re-reads ROADMAP.md after each phase to catch dynamically inserted phases.
4
+
5
+ </purpose>
6
+
7
+ <required_reading>
8
+
9
+ Read all files referenced by the invoking prompt's execution_context before starting.
10
+
11
+ </required_reading>
12
+
13
+ <process>
14
+
15
+ <step name="initialize" priority="first">
16
+
17
+ ## 1. Initialize
18
+
19
+ Parse `$ARGUMENTS` for `--from N` flag:
20
+
21
+ ```bash
22
+ FROM_PHASE=""
23
+ if echo "$ARGUMENTS" | grep -qE '\-\-from\s+[0-9]'; then
24
+ FROM_PHASE=$(echo "$ARGUMENTS" | grep -oE '\-\-from\s+[0-9]+\.?[0-9]*' | awk '{print $2}')
25
+ fi
26
+ ```
27
+
28
+ Bootstrap via milestone-level init:
29
+
30
+ ```bash
31
+ INIT=$(node ".agent/bin/mindforge-tools.cjs" init milestone-op)
32
+ ```
33
+
34
+ Parse JSON for: `milestone_version`, `milestone_name`, `phase_count`, `completed_phases`, `roadmap_exists`, `state_exists`, `commit_docs`.
35
+
36
+ **If `roadmap_exists` is false:** Error — "No ROADMAP.md found. Run `/mindforge-new-milestone` first."
37
+ **If `state_exists` is false:** Error — "No STATE.md found. Run `/mindforge-new-milestone` first."
38
+
39
+ Display startup banner:
40
+
41
+ ```
42
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
43
+ MindForge ► AUTONOMOUS
44
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
45
+
46
+ Milestone: {milestone_version} — {milestone_name}
47
+ Phases: {phase_count} total, {completed_phases} complete
48
+ ```
49
+
50
+ If `FROM_PHASE` is set, display: `Starting from phase ${FROM_PHASE}`
51
+
52
+ </step>
53
+
54
+ <step name="discover_phases">
55
+
56
+ ## 2. Discover Phases
57
+
58
+ Run phase discovery:
59
+
60
+ ```bash
61
+ ROADMAP=$(node ".agent/bin/mindforge-tools.cjs" roadmap analyze)
62
+ ```
63
+
64
+ Parse the JSON `phases` array.
65
+
66
+ **Filter to incomplete phases:** Keep only phases where `disk_status !== "complete"` OR `roadmap_complete === false`.
67
+
68
+ **Apply `--from N` filter:** If `FROM_PHASE` was provided, additionally filter out phases where `number < FROM_PHASE` (use numeric comparison — handles decimal phases like "5.1").
69
+
70
+ **Sort by `number`** in numeric ascending order.
71
+
72
+ **If no incomplete phases remain:**
73
+
74
+ ```
75
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
76
+ MindForge ► AUTONOMOUS ▸ COMPLETE 🎉
77
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
78
+
79
+ All phases complete! Nothing left to do.
80
+ ```
81
+
82
+ Exit cleanly.
83
+
84
+ **Display phase plan:**
85
+
86
+ ```
87
+ ## Phase Plan
88
+
89
+ | # | Phase | Status |
90
+ |---|-------|--------|
91
+ | 5 | Skill Scaffolding & Phase Discovery | In Progress |
92
+ | 6 | Smart Discuss | Not Started |
93
+ | 7 | Auto-Chain Refinements | Not Started |
94
+ | 8 | Lifecycle Orchestration | Not Started |
95
+ ```
96
+
97
+ **Fetch details for each phase:**
98
+
99
+ ```bash
100
+ DETAIL=$(node ".agent/bin/mindforge-tools.cjs" roadmap get-phase ${PHASE_NUM})
101
+ ```
102
+
103
+ Extract `phase_name`, `goal`, `success_criteria` from each. Store for use in execute_phase and transition messages.
104
+
105
+ </step>
106
+
107
+ <step name="execute_phase">
108
+
109
+ ## 3. Execute Phase
110
+
111
+ For the current phase, display the progress banner:
112
+
113
+ ```
114
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
115
+ MindForge ► AUTONOMOUS ▸ Phase {N}/{T}: {Name} [████░░░░] {P}%
116
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
117
+ ```
118
+
119
+ Where N = current phase number (from the ROADMAP, e.g., 6), T = total milestone phases (from `phase_count` parsed in initialize step, e.g., 8), P = percentage of all milestone phases completed so far. Calculate P as: (number of phases with `disk_status` "complete" from the latest `roadmap analyze` / T × 100). Use █ for filled and ░ for empty segments in the progress bar (8 characters wide).
120
+
121
+ **3a. Smart Discuss**
122
+
123
+ Check if CONTEXT.md already exists for this phase:
124
+
125
+ ```bash
126
+ PHASE_STATE=$(node ".agent/bin/mindforge-tools.cjs" init phase-op ${PHASE_NUM})
127
+ ```
128
+
129
+ Parse `has_context` from JSON.
130
+
131
+ **If has_context is true:** Skip discuss — context already gathered. Display:
132
+
133
+ ```
134
+ Phase ${PHASE_NUM}: Context exists — skipping discuss.
135
+ ```
136
+
137
+ Proceed to 3b.
138
+
139
+ **If has_context is false:** Check if discuss is disabled via settings:
140
+
141
+ ```bash
142
+ SKIP_DISCUSS=$(node ".agent/bin/mindforge-tools.cjs" config-get workflow.skip_discuss 2>/dev/null || echo "false")
143
+ ```
144
+
145
+ **If SKIP_DISCUSS is `true`:** Skip discuss entirely — the ROADMAP phase description is the spec. Display:
146
+
147
+ ```
148
+ Phase ${PHASE_NUM}: Discuss skipped (workflow.skip_discuss=true) — using ROADMAP phase goal as spec.
149
+ ```
150
+
151
+ Write a minimal CONTEXT.md so downstream plan-phase has valid input. Get phase details:
152
+
153
+ ```bash
154
+ DETAIL=$(node ".agent/bin/mindforge-tools.cjs" roadmap get-phase ${PHASE_NUM})
155
+ ```
156
+
157
+ Extract `goal` and `requirements` from JSON. Write `${phase_dir}/${padded_phase}-CONTEXT.md` with:
158
+
159
+ ```markdown
160
+ # Phase {PHASE_NUM}: {Phase Name} - Context
161
+
162
+ **Gathered:** {date}
163
+ **Status:** Ready for planning
164
+ **Mode:** Auto-generated (discuss skipped via workflow.skip_discuss)
165
+
166
+ <domain>
167
+ ## Phase Boundary
168
+
169
+ {goal from ROADMAP phase description}
170
+
171
+ </domain>
172
+
173
+ <decisions>
174
+ ## Implementation Decisions
175
+
176
+ ### the agent's Discretion
177
+ All implementation choices are at the agent's discretion — discuss phase was skipped per user setting. Use ROADMAP phase goal, success criteria, and codebase conventions to guide decisions.
178
+
179
+ </decisions>
180
+
181
+ <code_context>
182
+ ## Existing Code Insights
183
+
184
+ Codebase context will be gathered during plan-phase research.
185
+
186
+ </code_context>
187
+
188
+ <specifics>
189
+ ## Specific Ideas
190
+
191
+ No specific requirements — discuss phase skipped. Refer to ROADMAP phase description and success criteria.
192
+
193
+ </specifics>
194
+
195
+ <deferred>
196
+ ## Deferred Ideas
197
+
198
+ None — discuss phase skipped.
199
+
200
+ </deferred>
201
+ ```
202
+
203
+ Commit the minimal context:
204
+
205
+ ```bash
206
+ node ".agent/bin/mindforge-tools.cjs" commit "docs(${PADDED_PHASE}): auto-generated context (discuss skipped)" --files "${phase_dir}/${padded_phase}-CONTEXT.md"
207
+ ```
208
+
209
+ Proceed to 3b.
210
+
211
+ **If SKIP_DISCUSS is `false` (or unset):** Execute the smart_discuss step for this phase.
212
+
213
+ After smart_discuss completes, verify context was written:
214
+
215
+ ```bash
216
+ PHASE_STATE=$(node ".agent/bin/mindforge-tools.cjs" init phase-op ${PHASE_NUM})
217
+ ```
218
+
219
+ Check `has_context`. If false → go to handle_blocker: "Smart discuss for phase ${PHASE_NUM} did not produce CONTEXT.md."
220
+
221
+ **3b. Plan**
222
+
223
+ ```
224
+ Skill(skill="mindforge-plan-phase", args="${PHASE_NUM}")
225
+ ```
226
+
227
+ Verify plan produced output — re-run `init phase-op` and check `has_plans`. If false → go to handle_blocker: "Plan phase ${PHASE_NUM} did not produce any plans."
228
+
229
+ **3c. Execute**
230
+
231
+ ```
232
+ Skill(skill="mindforge-execute-phase", args="${PHASE_NUM} --no-transition")
233
+ ```
234
+
235
+ **3d. Post-Execution Routing**
236
+
237
+ After execute-phase returns, read the verification result:
238
+
239
+ ```bash
240
+ VERIFY_STATUS=$(grep "^status:" "${PHASE_DIR}"/*-VERIFICATION.md 2>/dev/null | head -1 | cut -d: -f2 | tr -d ' ')
241
+ ```
242
+
243
+ Where `PHASE_DIR` comes from the `init phase-op` call already made in step 3a. If the variable is not in scope, re-fetch:
244
+
245
+ ```bash
246
+ PHASE_STATE=$(node ".agent/bin/mindforge-tools.cjs" init phase-op ${PHASE_NUM})
247
+ ```
248
+
249
+ Parse `phase_dir` from the JSON.
250
+
251
+ **If VERIFY_STATUS is empty** (no VERIFICATION.md or no status field):
252
+
253
+ Go to handle_blocker: "Execute phase ${PHASE_NUM} did not produce verification results."
254
+
255
+ **If `passed`:**
256
+
257
+ Display:
258
+ ```
259
+ Phase ${PHASE_NUM} ✅ ${PHASE_NAME} — Verification passed
260
+ ```
261
+
262
+ Proceed to iterate step.
263
+
264
+ **If `human_needed`:**
265
+
266
+ Read the human_verification section from VERIFICATION.md to get the count and items requiring manual testing.
267
+
268
+ Display the items, then ask user via AskUserQuestion:
269
+ - **question:** "Phase ${PHASE_NUM} has items needing manual verification. Validate now or continue to next phase?"
270
+ - **options:** "Validate now" / "Continue without validation"
271
+
272
+ On **"Validate now"**: Present the specific items from VERIFICATION.md's human_verification section. After user reviews, ask:
273
+ - **question:** "Validation result?"
274
+ - **options:** "All good — continue" / "Found issues"
275
+
276
+ On "All good — continue": Display `Phase ${PHASE_NUM} ✅ Human validation passed` and proceed to iterate step.
277
+
278
+ On "Found issues": Go to handle_blocker with the user's reported issues as the description.
279
+
280
+ On **"Continue without validation"**: Display `Phase ${PHASE_NUM} ⏭ Human validation deferred` and proceed to iterate step.
281
+
282
+ **If `gaps_found`:**
283
+
284
+ Read gap summary from VERIFICATION.md (score and missing items). Display:
285
+ ```
286
+ ⚠ Phase ${PHASE_NUM}: ${PHASE_NAME} — Gaps Found
287
+ Score: {N}/{M} must-haves verified
288
+ ```
289
+
290
+ Ask user via AskUserQuestion:
291
+ - **question:** "Gaps found in phase ${PHASE_NUM}. How to proceed?"
292
+ - **options:** "Run gap closure" / "Continue without fixing" / "Stop autonomous mode"
293
+
294
+ On **"Run gap closure"**: Execute gap closure cycle (limit: 1 attempt):
295
+
296
+ ```
297
+ Skill(skill="mindforge-plan-phase", args="${PHASE_NUM} --gaps")
298
+ ```
299
+
300
+ Verify gap plans were created — re-run `init phase-op ${PHASE_NUM}` and check `has_plans`. If no new gap plans → go to handle_blocker: "Gap closure planning for phase ${PHASE_NUM} did not produce plans."
301
+
302
+ Re-execute:
303
+ ```
304
+ Skill(skill="mindforge-execute-phase", args="${PHASE_NUM} --no-transition")
305
+ ```
306
+
307
+ Re-read verification status:
308
+ ```bash
309
+ VERIFY_STATUS=$(grep "^status:" "${PHASE_DIR}"/*-VERIFICATION.md 2>/dev/null | head -1 | cut -d: -f2 | tr -d ' ')
310
+ ```
311
+
312
+ If `passed` or `human_needed`: Route normally (continue or ask user as above).
313
+
314
+ If still `gaps_found` after this retry: Display "Gaps persist after closure attempt." and ask via AskUserQuestion:
315
+ - **question:** "Gap closure did not fully resolve issues. How to proceed?"
316
+ - **options:** "Continue anyway" / "Stop autonomous mode"
317
+
318
+ On "Continue anyway": Proceed to iterate step.
319
+ On "Stop autonomous mode": Go to handle_blocker.
320
+
321
+ This limits gap closure to 1 automatic retry to prevent infinite loops.
322
+
323
+ On **"Continue without fixing"**: Display `Phase ${PHASE_NUM} ⏭ Gaps deferred` and proceed to iterate step.
324
+
325
+ On **"Stop autonomous mode"**: Go to handle_blocker with "User stopped — gaps remain in phase ${PHASE_NUM}".
326
+
327
+ </step>
328
+
329
+ <step name="smart_discuss">
330
+
331
+ ## Smart Discuss
332
+
333
+ Run smart discuss for the current phase. Proposes grey area answers in batch tables — the user accepts or overrides per area. Produces identical CONTEXT.md output to regular discuss-phase.
334
+
335
+ > **Note:** Smart discuss is an autonomous-optimized variant of the `mindforge-discuss-phase` skill. It produces identical CONTEXT.md output but uses batch table proposals instead of sequential questioning. The original `discuss-phase` skill remains unchanged (per CTRL-03). Future milestones may extract this to a separate skill file.
336
+
337
+ **Inputs:** `PHASE_NUM` from execute_phase. Run init to get phase paths:
338
+
339
+ ```bash
340
+ PHASE_STATE=$(node ".agent/bin/mindforge-tools.cjs" init phase-op ${PHASE_NUM})
341
+ ```
342
+
343
+ Parse from JSON: `phase_dir`, `phase_slug`, `padded_phase`, `phase_name`.
344
+
345
+ ---
346
+
347
+ ### Sub-step 1: Load prior context
348
+
349
+ Read project-level and prior phase context to avoid re-asking decided questions.
350
+
351
+ **Read project files:**
352
+
353
+ ```bash
354
+ cat .planning/PROJECT.md 2>/dev/null
355
+ cat .planning/REQUIREMENTS.md 2>/dev/null
356
+ cat .planning/STATE.md 2>/dev/null
357
+ ```
358
+
359
+ Extract from these:
360
+ - **PROJECT.md** — Vision, principles, non-negotiables, user preferences
361
+ - **REQUIREMENTS.md** — Acceptance criteria, constraints, must-haves vs nice-to-haves
362
+ - **STATE.md** — Current progress, decisions logged so far
363
+
364
+ **Read all prior CONTEXT.md files:**
365
+
366
+ ```bash
367
+ find .planning/phases -name "*-CONTEXT.md" 2>/dev/null | sort
368
+ ```
369
+
370
+ For each CONTEXT.md where phase number < current phase:
371
+ - Read the `<decisions>` section — these are locked preferences
372
+ - Read `<specifics>` — particular references or "I want it like X" moments
373
+ - Note patterns (e.g., "user consistently prefers minimal UI", "user rejected verbose output")
374
+
375
+ **Build internal prior_decisions context** (do not write to file):
376
+
377
+ ```
378
+ <prior_decisions>
379
+ ## Project-Level
380
+ - [Key principle or constraint from PROJECT.md]
381
+ - [Requirement affecting this phase from REQUIREMENTS.md]
382
+
383
+ ## From Prior Phases
384
+ ### Phase N: [Name]
385
+ - [Decision relevant to current phase]
386
+ - [Preference that establishes a pattern]
387
+ </prior_decisions>
388
+ ```
389
+
390
+ If no prior context exists, continue without — expected for early phases.
391
+
392
+ ---
393
+
394
+ ### Sub-step 2: Scout Codebase
395
+
396
+ Lightweight codebase scan to inform grey area identification and proposals. Keep under ~5% context.
397
+
398
+ **Check for existing codebase maps:**
399
+
400
+ ```bash
401
+ ls .planning/codebase/*.md 2>/dev/null
402
+ ```
403
+
404
+ **If codebase maps exist:** Read the most relevant ones (CONVENTIONS.md, STRUCTURE.md, STACK.md based on phase type). Extract reusable components, established patterns, integration points. Skip to building context below.
405
+
406
+ **If no codebase maps, do targeted grep:**
407
+
408
+ Extract key terms from the phase goal. Search for related files:
409
+
410
+ ```bash
411
+ grep -rl "{term1}\|{term2}" src/ app/ --include="*.ts" --include="*.tsx" --include="*.js" --include="*.jsx" 2>/dev/null | head -10
412
+ ls src/components/ src/hooks/ src/lib/ src/utils/ 2>/dev/null
413
+ ```
414
+
415
+ Read the 3-5 most relevant files to understand existing patterns.
416
+
417
+ **Build internal codebase_context** (do not write to file):
418
+ - **Reusable assets** — existing components, hooks, utilities usable in this phase
419
+ - **Established patterns** — how the codebase does state management, styling, data fetching
420
+ - **Integration points** — where new code connects (routes, nav, providers)
421
+
422
+ ---
423
+
424
+ ### Sub-step 3: Analyze Phase and Generate Proposals
425
+
426
+ **Get phase details:**
427
+
428
+ ```bash
429
+ DETAIL=$(node ".agent/bin/mindforge-tools.cjs" roadmap get-phase ${PHASE_NUM})
430
+ ```
431
+
432
+ Extract `goal`, `requirements`, `success_criteria` from the JSON response.
433
+
434
+ **Infrastructure detection — check FIRST before generating grey areas:**
435
+
436
+ A phase is pure infrastructure when ALL of these are true:
437
+ 1. Goal keywords match: "scaffolding", "plumbing", "setup", "configuration", "migration", "refactor", "rename", "restructure", "upgrade", "infrastructure"
438
+ 2. AND success criteria are all technical: "file exists", "test passes", "config valid", "command runs"
439
+ 3. AND no user-facing behavior is described (no "users can", "displays", "shows", "presents")
440
+
441
+ **If infrastructure-only:** Skip Sub-step 4. Jump directly to Sub-step 5 with minimal CONTEXT.md. Display:
442
+
443
+ ```
444
+ Phase ${PHASE_NUM}: Infrastructure phase — skipping discuss, writing minimal context.
445
+ ```
446
+
447
+ Use these defaults for the CONTEXT.md:
448
+ - `<domain>`: Phase boundary from ROADMAP goal
449
+ - `<decisions>`: Single "### the agent's Discretion" subsection — "All implementation choices are at the agent's discretion — pure infrastructure phase"
450
+ - `<code_context>`: Whatever the codebase scout found
451
+ - `<specifics>`: "No specific requirements — infrastructure phase"
452
+ - `<deferred>`: "None"
453
+
454
+ **If NOT infrastructure — generate grey area proposals:**
455
+
456
+ Determine domain type from the phase goal:
457
+ - Something users **SEE** → visual: layout, interactions, states, density
458
+ - Something users **CALL** → interface: contracts, responses, errors, auth
459
+ - Something users **RUN** → execution: invocation, output, behavior modes, flags
460
+ - Something users **READ** → content: structure, tone, depth, flow
461
+ - Something being **ORGANIZED** → organization: criteria, grouping, exceptions, naming
462
+
463
+ Check prior_decisions — skip grey areas already decided in prior phases.
464
+
465
+ Generate **3-4 grey areas** with **~4 questions each**. For each question:
466
+ - **Pre-select a recommended answer** based on: prior decisions (consistency), codebase patterns (reuse), domain conventions (standard approaches), ROADMAP success criteria
467
+ - Generate **1-2 alternatives** per question
468
+ - **Annotate** with prior decision context ("You decided X in Phase N") and code context ("Component Y exists with Z variants") where relevant
469
+
470
+ ---
471
+
472
+ ### Sub-step 4: Present Proposals Per Area
473
+
474
+ Present grey areas **one at a time**. For each area (M of N):
475
+
476
+ Display a table:
477
+
478
+ ```
479
+ ### Grey Area {M}/{N}: {Area Name}
480
+
481
+ | # | Question | ✅ Recommended | Alternative(s) |
482
+ |---|----------|---------------|-----------------|
483
+ | 1 | {question} | {answer} — {rationale} | {alt1}; {alt2} |
484
+ | 2 | {question} | {answer} — {rationale} | {alt1} |
485
+ | 3 | {question} | {answer} — {rationale} | {alt1}; {alt2} |
486
+ | 4 | {question} | {answer} — {rationale} | {alt1} |
487
+ ```
488
+
489
+ Then prompt the user via **AskUserQuestion**:
490
+ - **header:** "Area {M}/{N}"
491
+ - **question:** "Accept these answers for {Area Name}?"
492
+ - **options:** Build dynamically — always "Accept all" first, then "Change Q1" through "Change QN" for each question (up to 4), then "Discuss deeper" last. Cap at 6 explicit options max (AskUserQuestion adds "Other" automatically).
493
+
494
+ **On "Accept all":** Record all recommended answers for this area. Move to next area.
495
+
496
+ **On "Change QN":** Use AskUserQuestion with the alternatives for that specific question:
497
+ - **header:** "{Area Name}"
498
+ - **question:** "Q{N}: {question text}"
499
+ - **options:** List the 1-2 alternatives plus "You decide" (maps to the agent's Discretion)
500
+
501
+ Record the user's choice. Re-display the updated table with the change reflected. Re-present the full acceptance prompt so the user can make additional changes or accept.
502
+
503
+ **On "Discuss deeper":** Switch to interactive mode for this area only — ask questions one at a time using AskUserQuestion with 2-3 concrete options per question plus "You decide". After 4 questions, prompt:
504
+ - **header:** "{Area Name}"
505
+ - **question:** "More questions about {area name}, or move to next?"
506
+ - **options:** "More questions" / "Next area"
507
+
508
+ If "More questions", ask 4 more. If "Next area", display final summary table of captured answers for this area and move on.
509
+
510
+ **On "Other" (free text):** Interpret as either a specific change request or general feedback. Incorporate into the area's decisions, re-display updated table, re-present acceptance prompt.
511
+
512
+ **Scope creep handling:** If user mentions something outside the phase domain:
513
+
514
+ ```
515
+ "{Feature} sounds like a new capability — that belongs in its own phase.
516
+ I'll note it as a deferred idea.
517
+
518
+ Back to {current area}: {return to current question}"
519
+ ```
520
+
521
+ Track deferred ideas internally for inclusion in CONTEXT.md.
522
+
523
+ ---
524
+
525
+ ### Sub-step 5: Write CONTEXT.md
526
+
527
+ After all areas are resolved (or infrastructure skip), write the CONTEXT.md file.
528
+
529
+ **File path:** `${phase_dir}/${padded_phase}-CONTEXT.md`
530
+
531
+ Use **exactly** this structure (identical to discuss-phase output):
532
+
533
+ ```markdown
534
+ # Phase {PHASE_NUM}: {Phase Name} - Context
535
+
536
+ **Gathered:** {date}
537
+ **Status:** Ready for planning
538
+
539
+ <domain>
540
+ ## Phase Boundary
541
+
542
+ {Domain boundary statement from analysis — what this phase delivers}
543
+
544
+ </domain>
545
+
546
+ <decisions>
547
+ ## Implementation Decisions
548
+
549
+ ### {Area 1 Name}
550
+ - {Accepted/chosen answer for Q1}
551
+ - {Accepted/chosen answer for Q2}
552
+ - {Accepted/chosen answer for Q3}
553
+ - {Accepted/chosen answer for Q4}
554
+
555
+ ### {Area 2 Name}
556
+ - {Accepted/chosen answer for Q1}
557
+ - {Accepted/chosen answer for Q2}
558
+ ...
559
+
560
+ ### the agent's Discretion
561
+ {Any "You decide" answers collected — note the agent has flexibility here}
562
+
563
+ </decisions>
564
+
565
+ <code_context>
566
+ ## Existing Code Insights
567
+
568
+ ### Reusable Assets
569
+ - {From codebase scout — components, hooks, utilities}
570
+
571
+ ### Established Patterns
572
+ - {From codebase scout — state management, styling, data fetching}
573
+
574
+ ### Integration Points
575
+ - {From codebase scout — where new code connects}
576
+
577
+ </code_context>
578
+
579
+ <specifics>
580
+ ## Specific Ideas
581
+
582
+ {Any specific references or "I want it like X" from discussion}
583
+ {If none: "No specific requirements — open to standard approaches"}
584
+
585
+ </specifics>
586
+
587
+ <deferred>
588
+ ## Deferred Ideas
589
+
590
+ {Ideas captured but out of scope for this phase}
591
+ {If none: "None — discussion stayed within phase scope"}
592
+
593
+ </deferred>
594
+ ```
595
+
596
+ Write the file.
597
+
598
+ **Commit:**
599
+
600
+ ```bash
601
+ node ".agent/bin/mindforge-tools.cjs" commit "docs(${PADDED_PHASE}): smart discuss context" --files "${phase_dir}/${padded_phase}-CONTEXT.md"
602
+ ```
603
+
604
+ Display confirmation:
605
+
606
+ ```
607
+ Created: {path}
608
+ Decisions captured: {count} across {area_count} areas
609
+ ```
610
+
611
+ </step>
612
+
613
+ <step name="iterate">
614
+
615
+ ## 4. Iterate
616
+
617
+ After each phase completes, re-read ROADMAP.md to catch phases inserted mid-execution (decimal phases like 5.1):
618
+
619
+ ```bash
620
+ ROADMAP=$(node ".agent/bin/mindforge-tools.cjs" roadmap analyze)
621
+ ```
622
+
623
+ Re-filter incomplete phases using the same logic as discover_phases:
624
+ - Keep phases where `disk_status !== "complete"` OR `roadmap_complete === false`
625
+ - Apply `--from N` filter if originally provided
626
+ - Sort by number ascending
627
+
628
+ Read STATE.md fresh:
629
+
630
+ ```bash
631
+ cat .planning/STATE.md
632
+ ```
633
+
634
+ Check for blockers in the Blockers/Concerns section. If blockers are found, go to handle_blocker with the blocker description.
635
+
636
+ If incomplete phases remain: proceed to next phase, loop back to execute_phase.
637
+
638
+ If all phases complete, proceed to lifecycle step.
639
+
640
+ </step>
641
+
642
+ <step name="lifecycle">
643
+
644
+ ## 5. Lifecycle
645
+
646
+ After all phases complete, run the milestone lifecycle sequence: audit → complete → cleanup.
647
+
648
+ Display lifecycle transition banner:
649
+
650
+ ```
651
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
652
+ MindForge ► AUTONOMOUS ▸ LIFECYCLE
653
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
654
+
655
+ All phases complete → Starting lifecycle: audit → complete → cleanup
656
+ Milestone: {milestone_version} — {milestone_name}
657
+ ```
658
+
659
+ **5a. Audit**
660
+
661
+ ```
662
+ Skill(skill="mindforge-audit-milestone")
663
+ ```
664
+
665
+ After audit completes, detect the result:
666
+
667
+ ```bash
668
+ AUDIT_FILE=".planning/v${milestone_version}-MILESTONE-AUDIT.md"
669
+ AUDIT_STATUS=$(grep "^status:" "${AUDIT_FILE}" 2>/dev/null | head -1 | cut -d: -f2 | tr -d ' ')
670
+ ```
671
+
672
+ **If AUDIT_STATUS is empty** (no audit file or no status field):
673
+
674
+ Go to handle_blocker: "Audit did not produce results — audit file missing or malformed."
675
+
676
+ **If `passed`:**
677
+
678
+ Display:
679
+ ```
680
+ Audit ✅ passed — proceeding to complete milestone
681
+ ```
682
+
683
+ Proceed to 5b (no user pause — per CTRL-01).
684
+
685
+ **If `gaps_found`:**
686
+
687
+ Read the gaps summary from the audit file. Display:
688
+ ```
689
+ ⚠ Audit: Gaps Found
690
+ ```
691
+
692
+ Ask user via AskUserQuestion:
693
+ - **question:** "Milestone audit found gaps. How to proceed?"
694
+ - **options:** "Continue anyway — accept gaps" / "Stop — fix gaps manually"
695
+
696
+ On **"Continue anyway"**: Display `Audit ⏭ Gaps accepted — proceeding to complete milestone` and proceed to 5b.
697
+
698
+ On **"Stop"**: Go to handle_blocker with "User stopped — audit gaps remain. Run /mindforge-audit-milestone to review, then /mindforge-complete-milestone when ready."
699
+
700
+ **If `tech_debt`:**
701
+
702
+ Read the tech debt summary from the audit file. Display:
703
+ ```
704
+ ⚠ Audit: Tech Debt Identified
705
+ ```
706
+
707
+ Show the summary, then ask user via AskUserQuestion:
708
+ - **question:** "Milestone audit found tech debt. How to proceed?"
709
+ - **options:** "Continue with tech debt" / "Stop — address debt first"
710
+
711
+ On **"Continue with tech debt"**: Display `Audit ⏭ Tech debt acknowledged — proceeding to complete milestone` and proceed to 5b.
712
+
713
+ On **"Stop"**: Go to handle_blocker with "User stopped — tech debt to address. Run /mindforge-audit-milestone to review details."
714
+
715
+ **5b. Complete Milestone**
716
+
717
+ ```
718
+ Skill(skill="mindforge-complete-milestone", args="${milestone_version}")
719
+ ```
720
+
721
+ After complete-milestone returns, verify it produced output:
722
+
723
+ ```bash
724
+ ls .planning/milestones/v${milestone_version}-ROADMAP.md 2>/dev/null
725
+ ```
726
+
727
+ If the archive file does not exist, go to handle_blocker: "Complete milestone did not produce expected archive files."
728
+
729
+ **5c. Cleanup**
730
+
731
+ ```
732
+ Skill(skill="mindforge-cleanup")
733
+ ```
734
+
735
+ Cleanup shows its own dry-run and asks user for approval internally — this is an acceptable pause per CTRL-01 since it's an explicit decision about file deletion.
736
+
737
+ **5d. Final Completion**
738
+
739
+ Display final completion banner:
740
+
741
+ ```
742
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
743
+ MindForge ► AUTONOMOUS ▸ COMPLETE 🎉
744
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
745
+
746
+ Milestone: {milestone_version} — {milestone_name}
747
+ Status: Complete ✅
748
+ Lifecycle: audit ✅ → complete ✅ → cleanup ✅
749
+
750
+ Ship it! 🚀
751
+ ```
752
+
753
+ </step>
754
+
755
+ <step name="handle_blocker">
756
+
757
+ ## 6. Handle Blocker
758
+
759
+ When any phase operation fails or a blocker is detected, present 3 options via AskUserQuestion:
760
+
761
+ **Prompt:** "Phase {N} ({Name}) encountered an issue: {description}"
762
+
763
+ **Options:**
764
+ 1. **"Fix and retry"** — Re-run the failed step (discuss, plan, or execute) for this phase
765
+ 2. **"Skip this phase"** — Mark phase as skipped, continue to the next incomplete phase
766
+ 3. **"Stop autonomous mode"** — Display summary of progress so far and exit cleanly
767
+
768
+ **On "Fix and retry":** Loop back to the failed step within execute_phase. If the same step fails again after retry, re-present these options.
769
+
770
+ **On "Skip this phase":** Log `Phase {N} ⏭ {Name} — Skipped by user` and proceed to iterate.
771
+
772
+ **On "Stop autonomous mode":** Display progress summary:
773
+
774
+ ```
775
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
776
+ MindForge ► AUTONOMOUS ▸ STOPPED
777
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
778
+
779
+ Completed: {list of completed phases}
780
+ Skipped: {list of skipped phases}
781
+ Remaining: {list of remaining phases}
782
+
783
+ Resume with: /mindforge-autonomous --from {next_phase}
784
+ ```
785
+
786
+ </step>
787
+
788
+ </process>
789
+
790
+ <success_criteria>
791
+ - [ ] All incomplete phases executed in order (smart discuss → plan → execute each)
792
+ - [ ] Smart discuss proposes grey area answers in tables, user accepts or overrides per area
793
+ - [ ] Progress banners displayed between phases
794
+ - [ ] Execute-phase invoked with --no-transition (autonomous manages transitions)
795
+ - [ ] Post-execution verification reads VERIFICATION.md and routes on status
796
+ - [ ] Passed verification → automatic continue to next phase
797
+ - [ ] Human-needed verification → user prompted to validate or skip
798
+ - [ ] Gaps-found → user offered gap closure, continue, or stop
799
+ - [ ] Gap closure limited to 1 retry (prevents infinite loops)
800
+ - [ ] Plan-phase and execute-phase failures route to handle_blocker
801
+ - [ ] ROADMAP.md re-read after each phase (catches inserted phases)
802
+ - [ ] STATE.md checked for blockers before each phase
803
+ - [ ] Blockers handled via user choice (retry / skip / stop)
804
+ - [ ] Final completion or stop summary displayed
805
+ - [ ] After all phases complete, lifecycle step is invoked (not manual suggestion)
806
+ - [ ] Lifecycle transition banner displayed before audit
807
+ - [ ] Audit invoked via Skill(skill="mindforge-audit-milestone")
808
+ - [ ] Audit result routing: passed → auto-continue, gaps_found → user decides, tech_debt → user decides
809
+ - [ ] Audit technical failure (no file/no status) routes to handle_blocker
810
+ - [ ] Complete-milestone invoked via Skill() with ${milestone_version} arg
811
+ - [ ] Cleanup invoked via Skill() — internal confirmation is acceptable (CTRL-01)
812
+ - [ ] Final completion banner displayed after lifecycle
813
+ - [ ] Progress bar uses phase number / total milestone phases (not position among incomplete)
814
+ - [ ] Smart discuss documents relationship to discuss-phase with CTRL-03 note
815
+ </success_criteria>