mindforge-cc 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) 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/.planning/phases/01-migrate-gsd-to-mindforge/.gitkeep +0 -0
  155. package/CHANGELOG.md +15 -0
  156. package/README.md +2 -2
  157. package/docs/PERSONAS.md +41 -41
  158. package/docs/commands-reference.md +1 -0
  159. package/docs/references/checkpoints.md +778 -0
  160. package/docs/references/continuation-format.md +249 -0
  161. package/docs/references/decimal-phase-calculation.md +64 -0
  162. package/docs/references/git-integration.md +295 -0
  163. package/docs/references/git-planning-commit.md +38 -0
  164. package/docs/references/model-profile-resolution.md +36 -0
  165. package/docs/references/model-profiles.md +139 -0
  166. package/docs/references/phase-argument-parsing.md +61 -0
  167. package/docs/references/planning-config.md +202 -0
  168. package/docs/references/questioning.md +162 -0
  169. package/docs/references/tdd.md +263 -0
  170. package/docs/references/ui-brand.md +160 -0
  171. package/docs/references/user-profiling.md +681 -0
  172. package/docs/references/verification-patterns.md +612 -0
  173. package/docs/references/workstream-flag.md +58 -0
  174. package/docs/skills-authoring-guide.md +1 -1
  175. package/docs/templates/Agents/CLAUDE-MD.md +122 -0
  176. package/docs/templates/Agents/COPILOT-INSTRUCTIONS.md +7 -0
  177. package/docs/templates/Agents/DEBUGGER-PROMPT.md +91 -0
  178. package/docs/templates/Agents/PLANNER-PROMPT.md +117 -0
  179. package/docs/templates/Execution/CONTINUE-HERE.md +78 -0
  180. package/docs/templates/Execution/DISCUSSION-LOG.md +63 -0
  181. package/docs/templates/Execution/PHASE-PROMPT.md +610 -0
  182. package/docs/templates/Execution/STATE.md +176 -0
  183. package/docs/templates/Execution/SUMMARY-COMPLEX.md +59 -0
  184. package/docs/templates/Execution/SUMMARY-MINIMAL.md +41 -0
  185. package/docs/templates/Execution/SUMMARY-STANDARD.md +48 -0
  186. package/docs/templates/Execution/SUMMARY.md +248 -0
  187. package/docs/templates/Profile/DEV-PREFERENCES.md +21 -0
  188. package/docs/templates/Profile/USER-PROFILE.md +146 -0
  189. package/docs/templates/Profile/USER-SETUP.md +311 -0
  190. package/docs/templates/Project/DISCOVERY.md +146 -0
  191. package/docs/templates/Project/MILESTONE-ARCHIVE.md +123 -0
  192. package/docs/templates/Project/MILESTONE.md +115 -0
  193. package/docs/templates/Project/PROJECT.md +206 -0
  194. package/docs/templates/Project/REQUIREMENTS.md +231 -0
  195. package/docs/templates/Project/RETROSPECTIVE.md +54 -0
  196. package/docs/templates/Project/ROADMAP.md +202 -0
  197. package/docs/templates/Quality/DEBUG.md +164 -0
  198. package/docs/templates/Quality/UAT.md +280 -0
  199. package/docs/templates/Quality/UI-SPEC.md +100 -0
  200. package/docs/templates/Quality/VALIDATION.md +76 -0
  201. package/docs/templates/Quality/VERIFICATION-REPORT.md +322 -0
  202. package/docs/templates/System/CONFIG.json +43 -0
  203. package/docs/templates/System/CONTEXT.md +352 -0
  204. package/docs/templates/codebase/architecture.md +255 -0
  205. package/docs/templates/codebase/concerns.md +310 -0
  206. package/docs/templates/codebase/conventions.md +307 -0
  207. package/docs/templates/codebase/integrations.md +280 -0
  208. package/docs/templates/codebase/stack.md +186 -0
  209. package/docs/templates/codebase/structure.md +285 -0
  210. package/docs/templates/codebase/testing.md +480 -0
  211. package/docs/templates/research/ARCHITECTURE.md +204 -0
  212. package/docs/templates/research/FEATURES.md +147 -0
  213. package/docs/templates/research/PITFALLS.md +200 -0
  214. package/docs/templates/research/STACK.md +120 -0
  215. package/docs/templates/research/SUMMARY.md +170 -0
  216. package/docs/user-guide.md +1 -1
  217. package/package.json +7 -2
  218. /package/docs/{Context → context}/Master-Context.md +0 -0
  219. /package/docs/{reference → references}/audit-events.md +0 -0
  220. /package/docs/{reference → references}/commands.md +0 -0
  221. /package/docs/{reference → references}/config-reference.md +0 -0
  222. /package/docs/{reference → references}/sdk-api.md +0 -0
  223. /package/docs/{reference → references}/skills-api.md +0 -0
@@ -0,0 +1,370 @@
1
+ <purpose>
2
+ Orchestrate parallel codebase mapper agents to analyze codebase and produce structured documents in .planning/codebase/
3
+
4
+ Each agent has fresh context, explores a specific focus area, and **writes documents directly**. The orchestrator only receives confirmation + line counts, then writes a summary.
5
+
6
+ Output: .planning/codebase/ folder with 7 structured documents about the codebase state.
7
+ </purpose>
8
+
9
+ <philosophy>
10
+ **Why dedicated mapper agents:**
11
+ - Fresh context per domain (no token contamination)
12
+ - Agents write documents directly (no context transfer back to orchestrator)
13
+ - Orchestrator only summarizes what was created (minimal context usage)
14
+ - Faster execution (agents run simultaneously)
15
+
16
+ **Document quality over length:**
17
+ Include enough detail to be useful as reference. Prioritize practical examples (especially code patterns) over arbitrary brevity.
18
+
19
+ **Always include file paths:**
20
+ Documents are reference material for the agent when planning/executing. Always include actual file paths formatted with backticks: `src/services/user.ts`.
21
+ </philosophy>
22
+
23
+ <process>
24
+
25
+ <step name="init_context" priority="first">
26
+ Load codebase mapping context:
27
+
28
+ ```bash
29
+ INIT=$(node ".agent/bin/mindforge-tools.cjs" init map-codebase)
30
+ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
31
+ ```
32
+
33
+ Extract from init JSON: `mapper_model`, `commit_docs`, `codebase_dir`, `existing_maps`, `has_maps`, `codebase_dir_exists`.
34
+ </step>
35
+
36
+ <step name="check_existing">
37
+ Check if .planning/codebase/ already exists using `has_maps` from init context.
38
+
39
+ If `codebase_dir_exists` is true:
40
+ ```bash
41
+ ls -la .planning/codebase/
42
+ ```
43
+
44
+ **If exists:**
45
+
46
+ ```
47
+ .planning/codebase/ already exists with these documents:
48
+ [List files found]
49
+
50
+ What's next?
51
+ 1. Refresh - Delete existing and remap codebase
52
+ 2. Update - Keep existing, only update specific documents
53
+ 3. Skip - Use existing codebase map as-is
54
+ ```
55
+
56
+ Wait for user response.
57
+
58
+ If "Refresh": Delete .planning/codebase/, continue to create_structure
59
+ If "Update": Ask which documents to update, continue to spawn_agents (filtered)
60
+ If "Skip": Exit workflow
61
+
62
+ **If doesn't exist:**
63
+ Continue to create_structure.
64
+ </step>
65
+
66
+ <step name="create_structure">
67
+ Create .planning/codebase/ directory:
68
+
69
+ ```bash
70
+ mkdir -p .planning/codebase
71
+ ```
72
+
73
+ **Expected output files:**
74
+ - STACK.md (from tech mapper)
75
+ - INTEGRATIONS.md (from tech mapper)
76
+ - ARCHITECTURE.md (from arch mapper)
77
+ - STRUCTURE.md (from arch mapper)
78
+ - CONVENTIONS.md (from quality mapper)
79
+ - TESTING.md (from quality mapper)
80
+ - CONCERNS.md (from concerns mapper)
81
+
82
+ Continue to spawn_agents.
83
+ </step>
84
+
85
+ <step name="detect_runtime_capabilities">
86
+ Before spawning agents, detect whether the current runtime supports the `Task` tool for subagent delegation.
87
+
88
+ **Runtimes with Task tool:** Claude Code, Cursor, OpenCode (native subagent support via `Task` or `task`)
89
+ **Runtimes WITHOUT Task tool:** Antigravity, Gemini CLI, Codex, and others
90
+
91
+ **How to detect:** Check if you have access to a `Task` or `task` tool (either casing counts). If you do NOT have a Task/task tool (or only have tools like `browser_subagent` which is for web browsing, NOT code analysis):
92
+
93
+ → **Skip `spawn_agents` and `collect_confirmations`** — go directly to `sequential_mapping` instead.
94
+
95
+ **CRITICAL:** Never use `browser_subagent` or `Explore` as a substitute for `Task`. The `browser_subagent` tool is exclusively for web page interaction and will fail for codebase analysis. If `Task` is unavailable, perform the mapping sequentially in-context.
96
+ </step>
97
+
98
+ <step name="spawn_agents" condition="Task tool is available">
99
+ Spawn 4 parallel mindforge-codebase-mapper agents.
100
+
101
+ Use Task tool with `subagent_type="mindforge-codebase-mapper"`, `model="{mapper_model}"`, and `run_in_background=true` for parallel execution.
102
+
103
+ **CRITICAL:** Use the dedicated `mindforge-codebase-mapper` agent, NOT `Explore` or `browser_subagent`. The mapper agent writes documents directly.
104
+
105
+ **Agent 1: Tech Focus**
106
+
107
+ ```
108
+ Task(
109
+ subagent_type="mindforge-codebase-mapper",
110
+ model="{mapper_model}",
111
+ run_in_background=true,
112
+ description="Map codebase tech stack",
113
+ prompt="Focus: tech
114
+
115
+ Analyze this codebase for technology stack and external integrations.
116
+
117
+ Write these documents to .planning/codebase/:
118
+ - STACK.md - Languages, runtime, frameworks, dependencies, configuration
119
+ - INTEGRATIONS.md - External APIs, databases, auth providers, webhooks
120
+
121
+ Explore thoroughly. Write documents directly using templates. Return confirmation only."
122
+ )
123
+ ```
124
+
125
+ **Agent 2: Architecture Focus**
126
+
127
+ ```
128
+ Task(
129
+ subagent_type="mindforge-codebase-mapper",
130
+ model="{mapper_model}",
131
+ run_in_background=true,
132
+ description="Map codebase architecture",
133
+ prompt="Focus: arch
134
+
135
+ Analyze this codebase architecture and directory structure.
136
+
137
+ Write these documents to .planning/codebase/:
138
+ - ARCHITECTURE.md - Pattern, layers, data flow, abstractions, entry points
139
+ - STRUCTURE.md - Directory layout, key locations, naming conventions
140
+
141
+ Explore thoroughly. Write documents directly using templates. Return confirmation only."
142
+ )
143
+ ```
144
+
145
+ **Agent 3: Quality Focus**
146
+
147
+ ```
148
+ Task(
149
+ subagent_type="mindforge-codebase-mapper",
150
+ model="{mapper_model}",
151
+ run_in_background=true,
152
+ description="Map codebase conventions",
153
+ prompt="Focus: quality
154
+
155
+ Analyze this codebase for coding conventions and testing patterns.
156
+
157
+ Write these documents to .planning/codebase/:
158
+ - CONVENTIONS.md - Code style, naming, patterns, error handling
159
+ - TESTING.md - Framework, structure, mocking, coverage
160
+
161
+ Explore thoroughly. Write documents directly using templates. Return confirmation only."
162
+ )
163
+ ```
164
+
165
+ **Agent 4: Concerns Focus**
166
+
167
+ ```
168
+ Task(
169
+ subagent_type="mindforge-codebase-mapper",
170
+ model="{mapper_model}",
171
+ run_in_background=true,
172
+ description="Map codebase concerns",
173
+ prompt="Focus: concerns
174
+
175
+ Analyze this codebase for technical debt, known issues, and areas of concern.
176
+
177
+ Write this document to .planning/codebase/:
178
+ - CONCERNS.md - Tech debt, bugs, security, performance, fragile areas
179
+
180
+ Explore thoroughly. Write document directly using template. Return confirmation only."
181
+ )
182
+ ```
183
+
184
+ Continue to collect_confirmations.
185
+ </step>
186
+
187
+ <step name="collect_confirmations">
188
+ Wait for all 4 agents to complete using TaskOutput tool.
189
+
190
+ **For each agent task_id returned by the Agent tool calls above:**
191
+ ```
192
+ TaskOutput tool:
193
+ task_id: "{task_id from Agent result}"
194
+ block: true
195
+ timeout: 300000
196
+ ```
197
+
198
+ Call TaskOutput for all 4 agents in parallel (single message with 4 TaskOutput calls).
199
+
200
+ Once all TaskOutput calls return, read each agent's output file to collect confirmations.
201
+
202
+ **Expected confirmation format from each agent:**
203
+ ```
204
+ ## Mapping Complete
205
+
206
+ **Focus:** {focus}
207
+ **Documents written:**
208
+ - `.planning/codebase/{DOC1}.md` ({N} lines)
209
+ - `.planning/codebase/{DOC2}.md` ({N} lines)
210
+
211
+ Ready for orchestrator summary.
212
+ ```
213
+
214
+ **What you receive:** Just file paths and line counts. NOT document contents.
215
+
216
+ If any agent failed, note the failure and continue with successful documents.
217
+
218
+ Continue to verify_output.
219
+ </step>
220
+
221
+ <step name="sequential_mapping" condition="Task/task tool is NOT available (e.g. Antigravity, Gemini CLI, Codex)">
222
+ When the `Task` tool is unavailable, perform codebase mapping sequentially in the current context. This replaces `spawn_agents` and `collect_confirmations`.
223
+
224
+ **IMPORTANT:** Do NOT use `browser_subagent`, `Explore`, or any browser-based tool. Use only file system tools (Read, Bash, Write, Grep, Glob, list_dir, view_file, grep_search, or equivalent tools available in your runtime).
225
+
226
+ Perform all 4 mapping passes sequentially:
227
+
228
+ **Pass 1: Tech Focus**
229
+ - Explore package.json/Cargo.toml/go.mod/requirements.txt, config files, dependency trees
230
+ - Write `.planning/codebase/STACK.md` — Languages, runtime, frameworks, dependencies, configuration
231
+ - Write `.planning/codebase/INTEGRATIONS.md` — External APIs, databases, auth providers, webhooks
232
+
233
+ **Pass 2: Architecture Focus**
234
+ - Explore directory structure, entry points, module boundaries, data flow
235
+ - Write `.planning/codebase/ARCHITECTURE.md` — Pattern, layers, data flow, abstractions, entry points
236
+ - Write `.planning/codebase/STRUCTURE.md` — Directory layout, key locations, naming conventions
237
+
238
+ **Pass 3: Quality Focus**
239
+ - Explore code style, error handling patterns, test files, CI config
240
+ - Write `.planning/codebase/CONVENTIONS.md` — Code style, naming, patterns, error handling
241
+ - Write `.planning/codebase/TESTING.md` — Framework, structure, mocking, coverage
242
+
243
+ **Pass 4: Concerns Focus**
244
+ - Explore TODOs, known issues, fragile areas, security patterns
245
+ - Write `.planning/codebase/CONCERNS.md` — Tech debt, bugs, security, performance, fragile areas
246
+
247
+ Use the same document templates as the `mindforge-codebase-mapper` agent. Include actual file paths formatted with backticks.
248
+
249
+ Continue to verify_output.
250
+ </step>
251
+
252
+ <step name="verify_output">
253
+ Verify all documents created successfully:
254
+
255
+ ```bash
256
+ ls -la .planning/codebase/
257
+ wc -l .planning/codebase/*.md
258
+ ```
259
+
260
+ **Verification checklist:**
261
+ - All 7 documents exist
262
+ - No empty documents (each should have >20 lines)
263
+
264
+ If any documents missing or empty, note which agents may have failed.
265
+
266
+ Continue to scan_for_secrets.
267
+ </step>
268
+
269
+ <step name="scan_for_secrets">
270
+ **CRITICAL SECURITY CHECK:** Scan output files for accidentally leaked secrets before committing.
271
+
272
+ Run secret pattern detection:
273
+
274
+ ```bash
275
+ # Check for common API key patterns in generated docs
276
+ grep -E '(sk-[a-zA-Z0-9]{20,}|sk_live_[a-zA-Z0-9]+|sk_test_[a-zA-Z0-9]+|ghp_[a-zA-Z0-9]{36}|gho_[a-zA-Z0-9]{36}|glpat-[a-zA-Z0-9_-]+|AKIA[A-Z0-9]{16}|xox[baprs]-[a-zA-Z0-9-]+|-----BEGIN.*PRIVATE KEY|eyJ[a-zA-Z0-9_-]+\.eyJ[a-zA-Z0-9_-]+\.)' .planning/codebase/*.md 2>/dev/null && SECRETS_FOUND=true || SECRETS_FOUND=false
277
+ ```
278
+
279
+ **If SECRETS_FOUND=true:**
280
+
281
+ ```
282
+ ⚠️ SECURITY ALERT: Potential secrets detected in codebase documents!
283
+
284
+ Found patterns that look like API keys or tokens in:
285
+ [show grep output]
286
+
287
+ This would expose credentials if committed.
288
+
289
+ **Action required:**
290
+ 1. Review the flagged content above
291
+ 2. If these are real secrets, they must be removed before committing
292
+ 3. Consider adding sensitive files to Claude Code "Deny" permissions
293
+
294
+ Pausing before commit. Reply "safe to proceed" if the flagged content is not actually sensitive, or edit the files first.
295
+ ```
296
+
297
+ Wait for user confirmation before continuing to commit_codebase_map.
298
+
299
+ **If SECRETS_FOUND=false:**
300
+
301
+ Continue to commit_codebase_map.
302
+ </step>
303
+
304
+ <step name="commit_codebase_map">
305
+ Commit the codebase map:
306
+
307
+ ```bash
308
+ node ".agent/bin/mindforge-tools.cjs" commit "docs: map existing codebase" --files .planning/codebase/*.md
309
+ ```
310
+
311
+ Continue to offer_next.
312
+ </step>
313
+
314
+ <step name="offer_next">
315
+ Present completion summary and next steps.
316
+
317
+ **Get line counts:**
318
+ ```bash
319
+ wc -l .planning/codebase/*.md
320
+ ```
321
+
322
+ **Output format:**
323
+
324
+ ```
325
+ Codebase mapping complete.
326
+
327
+ Created .planning/codebase/:
328
+ - STACK.md ([N] lines) - Technologies and dependencies
329
+ - ARCHITECTURE.md ([N] lines) - System design and patterns
330
+ - STRUCTURE.md ([N] lines) - Directory layout and organization
331
+ - CONVENTIONS.md ([N] lines) - Code style and patterns
332
+ - TESTING.md ([N] lines) - Test structure and practices
333
+ - INTEGRATIONS.md ([N] lines) - External services and APIs
334
+ - CONCERNS.md ([N] lines) - Technical debt and issues
335
+
336
+
337
+ ---
338
+
339
+ ## ▶ Next Up
340
+
341
+ **Initialize project** — use codebase context for planning
342
+
343
+ `/mindforge-new-project`
344
+
345
+ <sub>`/clear` first → fresh context window</sub>
346
+
347
+ ---
348
+
349
+ **Also available:**
350
+ - Re-run mapping: `/mindforge-map-codebase`
351
+ - Review specific file: `cat .planning/codebase/STACK.md`
352
+ - Edit any document before proceeding
353
+
354
+ ---
355
+ ```
356
+
357
+ End workflow.
358
+ </step>
359
+
360
+ </process>
361
+
362
+ <success_criteria>
363
+ - .planning/codebase/ directory created
364
+ - If Task tool available: 4 parallel mindforge-codebase-mapper agents spawned with run_in_background=true
365
+ - If Task tool NOT available: 4 sequential mapping passes performed inline (never using browser_subagent)
366
+ - All 7 codebase documents exist
367
+ - No empty documents (each should have >20 lines)
368
+ - Clear completion summary with line counts
369
+ - User offered clear next steps in MindForge style
370
+ </success_criteria>
@@ -0,0 +1,223 @@
1
+ # Milestone Summary Workflow
2
+
3
+ Generate a comprehensive, human-friendly project summary from completed milestone artifacts.
4
+ Designed for team onboarding — a new contributor can read the output and understand the entire project.
5
+
6
+ ---
7
+
8
+ ## Step 1: Resolve Version
9
+
10
+ ```bash
11
+ VERSION="$ARGUMENTS"
12
+ ```
13
+
14
+ If `$ARGUMENTS` is empty:
15
+ 1. Check `.planning/STATE.md` for current milestone version
16
+ 2. Check `.planning/milestones/` for the latest archived version
17
+ 3. If neither found, check if `.planning/ROADMAP.md` exists (project may be mid-milestone)
18
+ 4. If nothing found: error "No milestone found. Run /mindforge-new-project or /mindforge-new-milestone first."
19
+
20
+ Set `VERSION` to the resolved version (e.g., "1.0").
21
+
22
+ ## Step 2: Locate Artifacts
23
+
24
+ Determine whether the milestone is **archived** or **current**:
25
+
26
+ **Archived milestone** (`.planning/milestones/v{VERSION}-ROADMAP.md` exists):
27
+ ```
28
+ ROADMAP_PATH=".planning/milestones/v${VERSION}-ROADMAP.md"
29
+ REQUIREMENTS_PATH=".planning/milestones/v${VERSION}-REQUIREMENTS.md"
30
+ AUDIT_PATH=".planning/milestones/v${VERSION}-MILESTONE-AUDIT.md"
31
+ ```
32
+
33
+ **Current/in-progress milestone** (no archive yet):
34
+ ```
35
+ ROADMAP_PATH=".planning/ROADMAP.md"
36
+ REQUIREMENTS_PATH=".planning/REQUIREMENTS.md"
37
+ AUDIT_PATH=".planning/v${VERSION}-MILESTONE-AUDIT.md"
38
+ ```
39
+
40
+ Note: The audit file moves to `.planning/milestones/` on archive (per `complete-milestone` workflow). Check both locations as a fallback.
41
+
42
+ **Always available:**
43
+ ```
44
+ PROJECT_PATH=".planning/PROJECT.md"
45
+ RETRO_PATH=".planning/RETROSPECTIVE.md"
46
+ STATE_PATH=".planning/STATE.md"
47
+ ```
48
+
49
+ Read all files that exist. Missing files are fine — the summary adapts to what's available.
50
+
51
+ ## Step 3: Discover Phase Artifacts
52
+
53
+ Find all phase directories:
54
+
55
+ ```bash
56
+ mindforge-tools.cjs init progress
57
+ ```
58
+
59
+ This returns phase metadata. For each phase in the milestone scope:
60
+
61
+ - Read `{phase_dir}/{padded}-SUMMARY.md` if it exists — extract `one_liner`, `accomplishments`, `decisions`
62
+ - Read `{phase_dir}/{padded}-VERIFICATION.md` if it exists — extract status, gaps, deferred items
63
+ - Read `{phase_dir}/{padded}-CONTEXT.md` if it exists — extract key decisions from `<decisions>` section
64
+ - Read `{phase_dir}/{padded}-RESEARCH.md` if it exists — note what was researched
65
+
66
+ Track which phases have which artifacts.
67
+
68
+ **If no phase directories exist** (empty milestone or pre-build state): skip to Step 5 and generate a minimal summary noting "No phases have been executed yet." Do not error — the summary should still capture PROJECT.md and ROADMAP.md content.
69
+
70
+ ## Step 4: Gather Git Statistics
71
+
72
+ Try each method in order until one succeeds:
73
+
74
+ **Method 1 — Tagged milestone** (check first):
75
+ ```bash
76
+ git tag -l "v${VERSION}" | head -1
77
+ ```
78
+ If the tag exists:
79
+ ```bash
80
+ git log v${VERSION} --oneline | wc -l
81
+ git diff --stat $(git log --format=%H --reverse v${VERSION} | head -1)..v${VERSION}
82
+ ```
83
+
84
+ **Method 2 — STATE.md date range** (if no tag):
85
+ Read STATE.md and extract the `started_at` or earliest session date. Use it as the `--since` boundary:
86
+ ```bash
87
+ git log --oneline --since="<started_at_date>" | wc -l
88
+ ```
89
+
90
+ **Method 3 — Earliest phase commit** (if STATE.md has no date):
91
+ Find the earliest `.planning/phases/` commit:
92
+ ```bash
93
+ git log --oneline --diff-filter=A -- ".planning/phases/" | tail -1
94
+ ```
95
+ Use that commit's date as the start boundary.
96
+
97
+ **Method 4 — Skip stats** (if none of the above work):
98
+ Report "Git statistics unavailable — no tag or date range could be determined." This is not an error — the summary continues without the Stats section.
99
+
100
+ Extract (when available):
101
+ - Total commits in milestone
102
+ - Files changed, insertions, deletions
103
+ - Timeline (start date → end date)
104
+ - Contributors (from git log authors)
105
+
106
+ ## Step 5: Generate Summary Document
107
+
108
+ Write to `.planning/reports/MILESTONE_SUMMARY-v${VERSION}.md`:
109
+
110
+ ```markdown
111
+ # Milestone v{VERSION} — Project Summary
112
+
113
+ **Generated:** {date}
114
+ **Purpose:** Team onboarding and project review
115
+
116
+ ---
117
+
118
+ ## 1. Project Overview
119
+
120
+ {From PROJECT.md: "What This Is", core value proposition, target users}
121
+ {If mid-milestone: note which phases are complete vs in-progress}
122
+
123
+ ## 2. Architecture & Technical Decisions
124
+
125
+ {From CONTEXT.md files across phases: key technical choices}
126
+ {From SUMMARY.md decisions: patterns, libraries, frameworks chosen}
127
+ {From PROJECT.md: tech stack if documented}
128
+
129
+ Present as a bulleted list of decisions with brief rationale:
130
+ - **Decision:** {what was chosen}
131
+ - **Why:** {rationale from CONTEXT.md}
132
+ - **Phase:** {which phase made this decision}
133
+
134
+ ## 3. Phases Delivered
135
+
136
+ | Phase | Name | Status | One-Liner |
137
+ |-------|------|--------|-----------|
138
+ {For each phase: number, name, status (complete/in-progress/planned), one_liner from SUMMARY.md}
139
+
140
+ ## 4. Requirements Coverage
141
+
142
+ {From REQUIREMENTS.md: list each requirement with status}
143
+ - ✅ {Requirement met}
144
+ - ⚠️ {Requirement partially met — note gap}
145
+ - ❌ {Requirement not met — note reason}
146
+
147
+ {If MILESTONE-AUDIT.md exists: include audit verdict}
148
+
149
+ ## 5. Key Decisions Log
150
+
151
+ {Aggregate from all CONTEXT.md <decisions> sections}
152
+ {Each decision with: ID, description, phase, rationale}
153
+
154
+ ## 6. Tech Debt & Deferred Items
155
+
156
+ {From VERIFICATION.md files: gaps found, anti-patterns noted}
157
+ {From RETROSPECTIVE.md: lessons learned, what to improve}
158
+ {From CONTEXT.md <deferred> sections: ideas parked for later}
159
+
160
+ ## 7. Getting Started
161
+
162
+ {Entry points for new contributors:}
163
+ - **Run the project:** {from PROJECT.md or SUMMARY.md}
164
+ - **Key directories:** {from codebase structure}
165
+ - **Tests:** {test command from PROJECT.md or GEMINI.md}
166
+ - **Where to look first:** {main entry points, core modules}
167
+
168
+ ---
169
+
170
+ ## Stats
171
+
172
+ - **Timeline:** {start} → {end} ({duration})
173
+ - **Phases:** {count complete} / {count total}
174
+ - **Commits:** {count}
175
+ - **Files changed:** {count} (+{insertions} / -{deletions})
176
+ - **Contributors:** {list}
177
+ ```
178
+
179
+ ## Step 6: Write and Commit
180
+
181
+ **Overwrite guard:** If `.planning/reports/MILESTONE_SUMMARY-v${VERSION}.md` already exists, ask the user:
182
+ > "A milestone summary for v{VERSION} already exists. Overwrite it, or view the existing one?"
183
+ If "view": display existing file and skip to Step 8 (interactive mode). If "overwrite": proceed.
184
+
185
+ Create the reports directory if needed:
186
+ ```bash
187
+ mkdir -p .planning/reports
188
+ ```
189
+
190
+ Write the summary, then commit:
191
+ ```bash
192
+ mindforge-tools.cjs commit "docs(v${VERSION}): generate milestone summary for onboarding" \
193
+ --files ".planning/reports/MILESTONE_SUMMARY-v${VERSION}.md"
194
+ ```
195
+
196
+ ## Step 7: Present Summary
197
+
198
+ Display the full summary document inline.
199
+
200
+ ## Step 8: Offer Interactive Mode
201
+
202
+ After presenting the summary:
203
+
204
+ > "Summary written to `.planning/reports/MILESTONE_SUMMARY-v{VERSION}.md`.
205
+ >
206
+ > I have full context from the build artifacts. Want to ask anything about the project?
207
+ > Architecture decisions, specific phases, requirements, tech debt — ask away."
208
+
209
+ If the user asks questions:
210
+ - Answer from the artifacts already loaded (CONTEXT.md, SUMMARY.md, VERIFICATION.md, etc.)
211
+ - Reference specific files and decisions
212
+ - Stay grounded in what was actually built (not speculation)
213
+
214
+ If the user is done:
215
+ - Suggest next steps: `/mindforge-new-milestone`, `/mindforge-progress`, or sharing the summary with the team
216
+
217
+ ## Step 9: Update STATE.md
218
+
219
+ ```bash
220
+ mindforge-tools.cjs state record-session \
221
+ --stopped-at "Milestone v${VERSION} summary generated" \
222
+ --resume-file ".planning/reports/MILESTONE_SUMMARY-v${VERSION}.md"
223
+ ```