mindsystem-cc 3.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 (139) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +501 -0
  3. package/agents/ms-codebase-mapper.md +739 -0
  4. package/agents/ms-debugger.md +1184 -0
  5. package/agents/ms-designer.md +414 -0
  6. package/agents/ms-executor.md +760 -0
  7. package/agents/ms-integration-checker.md +423 -0
  8. package/agents/ms-milestone-auditor.md +448 -0
  9. package/agents/ms-mock-generator.md +182 -0
  10. package/agents/ms-plan-checker.md +746 -0
  11. package/agents/ms-research-synthesizer.md +248 -0
  12. package/agents/ms-researcher.md +962 -0
  13. package/agents/ms-roadmapper.md +606 -0
  14. package/agents/ms-verifier.md +779 -0
  15. package/agents/ms-verify-fixer.md +124 -0
  16. package/bin/install.js +296 -0
  17. package/commands/ms/add-phase.md +207 -0
  18. package/commands/ms/add-todo.md +182 -0
  19. package/commands/ms/audit-milestone.md +318 -0
  20. package/commands/ms/check-phase.md +162 -0
  21. package/commands/ms/check-todos.md +217 -0
  22. package/commands/ms/complete-milestone.md +137 -0
  23. package/commands/ms/create-roadmap.md +273 -0
  24. package/commands/ms/debug.md +149 -0
  25. package/commands/ms/define-requirements.md +121 -0
  26. package/commands/ms/design-phase.md +341 -0
  27. package/commands/ms/discuss-milestone.md +48 -0
  28. package/commands/ms/discuss-phase.md +60 -0
  29. package/commands/ms/do-work.md +90 -0
  30. package/commands/ms/execute-phase.md +289 -0
  31. package/commands/ms/help.md +623 -0
  32. package/commands/ms/insert-phase.md +227 -0
  33. package/commands/ms/list-phase-assumptions.md +50 -0
  34. package/commands/ms/map-codebase.md +71 -0
  35. package/commands/ms/new-milestone.md +193 -0
  36. package/commands/ms/new-project.md +338 -0
  37. package/commands/ms/pause-work.md +123 -0
  38. package/commands/ms/plan-milestone-gaps.md +285 -0
  39. package/commands/ms/plan-phase.md +105 -0
  40. package/commands/ms/progress.md +370 -0
  41. package/commands/ms/remove-phase.md +338 -0
  42. package/commands/ms/research-phase.md +175 -0
  43. package/commands/ms/research-project.md +339 -0
  44. package/commands/ms/resume-work.md +40 -0
  45. package/commands/ms/review-design.md +484 -0
  46. package/commands/ms/simplify-flutter.md +193 -0
  47. package/commands/ms/update.md +159 -0
  48. package/commands/ms/verify-work.md +92 -0
  49. package/commands/ms/whats-new.md +124 -0
  50. package/mindsystem/references/checkpoints.md +788 -0
  51. package/mindsystem/references/continuation-format.md +255 -0
  52. package/mindsystem/references/debugging/debugging-mindset.md +11 -0
  53. package/mindsystem/references/debugging/hypothesis-testing.md +11 -0
  54. package/mindsystem/references/debugging/investigation-techniques.md +11 -0
  55. package/mindsystem/references/debugging/verification-patterns.md +11 -0
  56. package/mindsystem/references/debugging/when-to-research.md +11 -0
  57. package/mindsystem/references/git-integration.md +254 -0
  58. package/mindsystem/references/goal-backward.md +286 -0
  59. package/mindsystem/references/mock-patterns.md +294 -0
  60. package/mindsystem/references/plan-format.md +473 -0
  61. package/mindsystem/references/principles.md +73 -0
  62. package/mindsystem/references/questioning.md +140 -0
  63. package/mindsystem/references/research-pitfalls.md +233 -0
  64. package/mindsystem/references/scope-estimation.md +256 -0
  65. package/mindsystem/references/tdd.md +263 -0
  66. package/mindsystem/references/verification-patterns.md +595 -0
  67. package/mindsystem/templates/DEBUG.md +159 -0
  68. package/mindsystem/templates/UAT.md +403 -0
  69. package/mindsystem/templates/adhoc-summary.md +153 -0
  70. package/mindsystem/templates/codebase/architecture.md +255 -0
  71. package/mindsystem/templates/codebase/concerns.md +310 -0
  72. package/mindsystem/templates/codebase/conventions.md +307 -0
  73. package/mindsystem/templates/codebase/integrations.md +280 -0
  74. package/mindsystem/templates/codebase/stack.md +186 -0
  75. package/mindsystem/templates/codebase/structure.md +285 -0
  76. package/mindsystem/templates/codebase/testing.md +480 -0
  77. package/mindsystem/templates/config.json +26 -0
  78. package/mindsystem/templates/context.md +140 -0
  79. package/mindsystem/templates/continue-here.md +78 -0
  80. package/mindsystem/templates/debug-subagent-prompt.md +91 -0
  81. package/mindsystem/templates/design-iteration.md +208 -0
  82. package/mindsystem/templates/design.md +417 -0
  83. package/mindsystem/templates/discovery.md +146 -0
  84. package/mindsystem/templates/milestone-archive.md +123 -0
  85. package/mindsystem/templates/milestone-context.md +93 -0
  86. package/mindsystem/templates/milestone.md +115 -0
  87. package/mindsystem/templates/phase-prompt.md +574 -0
  88. package/mindsystem/templates/project.md +184 -0
  89. package/mindsystem/templates/requirements.md +231 -0
  90. package/mindsystem/templates/research-project/ARCHITECTURE.md +204 -0
  91. package/mindsystem/templates/research-project/FEATURES.md +147 -0
  92. package/mindsystem/templates/research-project/PITFALLS.md +200 -0
  93. package/mindsystem/templates/research-project/STACK.md +120 -0
  94. package/mindsystem/templates/research-project/SUMMARY.md +170 -0
  95. package/mindsystem/templates/research-subagent-prompt.md +92 -0
  96. package/mindsystem/templates/research.md +529 -0
  97. package/mindsystem/templates/roadmap.md +214 -0
  98. package/mindsystem/templates/state.md +224 -0
  99. package/mindsystem/templates/summary.md +269 -0
  100. package/mindsystem/templates/user-setup.md +323 -0
  101. package/mindsystem/templates/verification-report.md +322 -0
  102. package/mindsystem/workflows/complete-milestone.md +759 -0
  103. package/mindsystem/workflows/create-milestone.md +203 -0
  104. package/mindsystem/workflows/debug.md +14 -0
  105. package/mindsystem/workflows/define-requirements.md +330 -0
  106. package/mindsystem/workflows/diagnose-issues.md +241 -0
  107. package/mindsystem/workflows/discovery-phase.md +293 -0
  108. package/mindsystem/workflows/discuss-milestone.md +310 -0
  109. package/mindsystem/workflows/discuss-phase.md +237 -0
  110. package/mindsystem/workflows/do-work.md +359 -0
  111. package/mindsystem/workflows/execute-phase.md +644 -0
  112. package/mindsystem/workflows/execute-plan.md +1828 -0
  113. package/mindsystem/workflows/generate-mocks.md +187 -0
  114. package/mindsystem/workflows/list-phase-assumptions.md +178 -0
  115. package/mindsystem/workflows/map-codebase.md +289 -0
  116. package/mindsystem/workflows/plan-phase.md +876 -0
  117. package/mindsystem/workflows/research-phase.md +17 -0
  118. package/mindsystem/workflows/research-project.md +23 -0
  119. package/mindsystem/workflows/resume-project.md +311 -0
  120. package/mindsystem/workflows/transition.md +564 -0
  121. package/mindsystem/workflows/verify-phase.md +629 -0
  122. package/mindsystem/workflows/verify-work.md +823 -0
  123. package/package.json +32 -0
  124. package/scripts/generate-phase-patch.sh +169 -0
  125. package/scripts/ms-lookup/README.md +112 -0
  126. package/scripts/ms-lookup/ms_lookup/__init__.py +3 -0
  127. package/scripts/ms-lookup/ms_lookup/__main__.py +6 -0
  128. package/scripts/ms-lookup/ms_lookup/backends/__init__.py +6 -0
  129. package/scripts/ms-lookup/ms_lookup/backends/context7.py +219 -0
  130. package/scripts/ms-lookup/ms_lookup/backends/perplexity.py +145 -0
  131. package/scripts/ms-lookup/ms_lookup/cache.py +48 -0
  132. package/scripts/ms-lookup/ms_lookup/cli.py +219 -0
  133. package/scripts/ms-lookup/ms_lookup/config.py +23 -0
  134. package/scripts/ms-lookup/ms_lookup/errors.py +24 -0
  135. package/scripts/ms-lookup/ms_lookup/output.py +49 -0
  136. package/scripts/ms-lookup/ms_lookup/tokens.py +56 -0
  137. package/scripts/ms-lookup/pyproject.toml +17 -0
  138. package/scripts/ms-lookup/uv.lock +207 -0
  139. package/scripts/ms-lookup-wrapper.sh +21 -0
@@ -0,0 +1,217 @@
1
+ ---
2
+ name: ms:check-todos
3
+ description: List pending todos and select one to work on
4
+ argument-hint: [area filter]
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Bash
9
+ - Glob
10
+ - AskUserQuestion
11
+ ---
12
+
13
+ <objective>
14
+ List all pending todos, allow selection, load full context for the selected todo, and route to appropriate action.
15
+
16
+ Enables reviewing captured ideas and deciding what to work on next.
17
+ </objective>
18
+
19
+ <context>
20
+ @.planning/STATE.md
21
+ @.planning/ROADMAP.md
22
+ </context>
23
+
24
+ <process>
25
+
26
+ <step name="check_exist">
27
+ ```bash
28
+ TODO_COUNT=$(ls .planning/todos/pending/*.md 2>/dev/null | wc -l | tr -d ' ')
29
+ echo "Pending todos: $TODO_COUNT"
30
+ ```
31
+
32
+ If count is 0:
33
+ ```
34
+ No pending todos.
35
+
36
+ Todos are captured during work sessions with /ms:add-todo.
37
+
38
+ ---
39
+
40
+ Would you like to:
41
+
42
+ 1. Continue with current phase (/ms:progress)
43
+ 2. Add a todo now (/ms:add-todo)
44
+ ```
45
+
46
+ Exit.
47
+ </step>
48
+
49
+ <step name="parse_filter">
50
+ Check for area filter in arguments:
51
+ - `/ms:check-todos` → show all
52
+ - `/ms:check-todos api` → filter to area:api only
53
+ </step>
54
+
55
+ <step name="list_todos">
56
+ ```bash
57
+ for file in .planning/todos/pending/*.md; do
58
+ created=$(grep "^created:" "$file" | cut -d' ' -f2)
59
+ title=$(grep "^title:" "$file" | cut -d':' -f2- | xargs)
60
+ area=$(grep "^area:" "$file" | cut -d' ' -f2)
61
+ echo "$created|$title|$area|$file"
62
+ done | sort
63
+ ```
64
+
65
+ Apply area filter if specified. Display as numbered list:
66
+
67
+ ```
68
+ Pending Todos:
69
+
70
+ 1. Add auth token refresh (api, 2d ago)
71
+ 2. Fix modal z-index issue (ui, 1d ago)
72
+ 3. Refactor database connection pool (database, 5h ago)
73
+
74
+ ---
75
+
76
+ Reply with a number to view details, or:
77
+ - `/ms:check-todos [area]` to filter by area
78
+ - `q` to exit
79
+ ```
80
+
81
+ Format age as relative time.
82
+ </step>
83
+
84
+ <step name="handle_selection">
85
+ Wait for user to reply with a number.
86
+
87
+ If valid: load selected todo, proceed.
88
+ If invalid: "Invalid selection. Reply with a number (1-[N]) or `q` to exit."
89
+ </step>
90
+
91
+ <step name="load_context">
92
+ Read the todo file completely. Display:
93
+
94
+ ```
95
+ ## [title]
96
+
97
+ **Area:** [area]
98
+ **Created:** [date] ([relative time] ago)
99
+ **Files:** [list or "None"]
100
+
101
+ ### Problem
102
+ [problem section content]
103
+
104
+ ### Solution
105
+ [solution section content]
106
+ ```
107
+
108
+ If `files` field has entries, read and briefly summarize each.
109
+ </step>
110
+
111
+ <step name="check_roadmap">
112
+ ```bash
113
+ ls .planning/ROADMAP.md 2>/dev/null && echo "Roadmap exists"
114
+ ```
115
+
116
+ If roadmap exists:
117
+ 1. Check if todo's area matches an upcoming phase
118
+ 2. Check if todo's files overlap with a phase's scope
119
+ 3. Note any match for action options
120
+ </step>
121
+
122
+ <step name="offer_actions">
123
+ **If todo maps to a roadmap phase:**
124
+
125
+ Use AskUserQuestion:
126
+ - header: "Action"
127
+ - question: "This todo relates to Phase [N]: [name]. What would you like to do?"
128
+ - options:
129
+ - "Work on it now" — move to done, start working
130
+ - "Add to phase plan" — include when planning Phase [N]
131
+ - "Brainstorm approach" — think through before deciding
132
+ - "Put it back" — return to list
133
+
134
+ **If no roadmap match:**
135
+
136
+ Use AskUserQuestion:
137
+ - header: "Action"
138
+ - question: "What would you like to do with this todo?"
139
+ - options:
140
+ - "Work on it now" — move to done, start working
141
+ - "Create a phase" — /ms:add-phase with this scope
142
+ - "Brainstorm approach" — think through before deciding
143
+ - "Put it back" — return to list
144
+ </step>
145
+
146
+ <step name="execute_action">
147
+ **Work on it now:**
148
+ ```bash
149
+ mv ".planning/todos/pending/[filename]" ".planning/todos/done/"
150
+ ```
151
+ Update STATE.md todo count. Present problem/solution context. Begin work or ask how to proceed.
152
+
153
+ **Add to phase plan:**
154
+ Note todo reference in phase planning notes. Keep in pending. Return to list or exit.
155
+
156
+ **Create a phase:**
157
+ Display: `/ms:add-phase [description from todo]`
158
+ Keep in pending. User runs command in fresh context.
159
+
160
+ **Brainstorm approach:**
161
+ Keep in pending. Start discussion about problem and approaches.
162
+
163
+ **Put it back:**
164
+ Return to list_todos step.
165
+ </step>
166
+
167
+ <step name="update_state">
168
+ After any action that changes todo count:
169
+
170
+ ```bash
171
+ ls .planning/todos/pending/*.md 2>/dev/null | wc -l
172
+ ```
173
+
174
+ Update STATE.md "### Pending Todos" section if exists.
175
+ </step>
176
+
177
+ <step name="git_commit">
178
+ If todo was moved to done/, commit the change:
179
+
180
+ ```bash
181
+ git add .planning/todos/done/[filename]
182
+ git rm --cached .planning/todos/pending/[filename] 2>/dev/null || true
183
+ [ -f .planning/STATE.md ] && git add .planning/STATE.md
184
+ git commit -m "$(cat <<'EOF'
185
+ docs: start work on todo - [title]
186
+
187
+ Moved to done/, beginning implementation.
188
+ EOF
189
+ )"
190
+ ```
191
+
192
+ Confirm: "Committed: docs: start work on todo - [title]"
193
+ </step>
194
+
195
+ </process>
196
+
197
+ <output>
198
+ - Moved todo to `.planning/todos/done/` (if "Work on it now")
199
+ - Updated `.planning/STATE.md` (if todo count changed)
200
+ </output>
201
+
202
+ <anti_patterns>
203
+ - Don't delete todos — move to done/ when work begins
204
+ - Don't start work without moving to done/ first
205
+ - Don't create plans from this command — route to /ms:plan-phase or /ms:add-phase
206
+ </anti_patterns>
207
+
208
+ <success_criteria>
209
+ - [ ] All pending todos listed with title, area, age
210
+ - [ ] Area filter applied if specified
211
+ - [ ] Selected todo's full context loaded
212
+ - [ ] Roadmap context checked for phase match
213
+ - [ ] Appropriate actions offered
214
+ - [ ] Selected action executed
215
+ - [ ] STATE.md updated if todo count changed
216
+ - [ ] Changes committed to git (if todo moved to done/)
217
+ </success_criteria>
@@ -0,0 +1,137 @@
1
+ ---
2
+ type: prompt
3
+ name: ms:complete-milestone
4
+ description: Archive completed milestone and prepare for next version
5
+ argument-hint: <version>
6
+ allowed-tools:
7
+ - Read
8
+ - Write
9
+ - Bash
10
+ ---
11
+
12
+ <objective>
13
+ Mark milestone {{version}} complete, archive to milestones/, and update ROADMAP.md and REQUIREMENTS.md.
14
+
15
+ Purpose: Create historical record of shipped version, archive milestone artifacts (roadmap + requirements), and prepare for next milestone.
16
+ Output: Milestone archived (roadmap + requirements), PROJECT.md evolved, git tagged.
17
+ </objective>
18
+
19
+ <execution_context>
20
+ **Load these files NOW (before proceeding):**
21
+
22
+ - @~/.claude/mindsystem/workflows/complete-milestone.md (main workflow)
23
+ - @~/.claude/mindsystem/templates/milestone-archive.md (archive template)
24
+ </execution_context>
25
+
26
+ <context>
27
+ **Project files:**
28
+ - `.planning/ROADMAP.md`
29
+ - `.planning/REQUIREMENTS.md`
30
+ - `.planning/STATE.md`
31
+ - `.planning/PROJECT.md`
32
+
33
+ **User input:**
34
+
35
+ - Version: {{version}} (e.g., "1.0", "1.1", "2.0")
36
+ </context>
37
+
38
+ <process>
39
+
40
+ **Follow complete-milestone.md workflow:**
41
+
42
+ 0. **Check for audit:**
43
+
44
+ - Look for `.planning/v{{version}}-MILESTONE-AUDIT.md`
45
+ - If missing or stale: recommend `/ms:audit-milestone` first
46
+ - If audit status is `gaps_found`: recommend `/ms:plan-milestone-gaps` first
47
+ - If audit status is `passed`: proceed to step 1
48
+
49
+ ```markdown
50
+ ## Pre-flight Check
51
+
52
+ {If no v{{version}}-MILESTONE-AUDIT.md:}
53
+ ⚠ No milestone audit found. Run `/ms:audit-milestone` first to verify
54
+ requirements coverage, cross-phase integration, and E2E flows.
55
+
56
+ {If audit has gaps:}
57
+ ⚠ Milestone audit found gaps. Run `/ms:plan-milestone-gaps` to create
58
+ phases that close the gaps, or proceed anyway to accept as tech debt.
59
+
60
+ {If audit passed:}
61
+ ✓ Milestone audit passed. Proceeding with completion.
62
+ ```
63
+
64
+ 1. **Verify readiness:**
65
+
66
+ - Check all phases in milestone have completed plans (SUMMARY.md exists)
67
+ - Present milestone scope and stats
68
+ - Wait for confirmation
69
+
70
+ 2. **Gather stats:**
71
+
72
+ - Count phases, plans, tasks
73
+ - Calculate git range, file changes, LOC
74
+ - Extract timeline from git log
75
+ - Present summary, confirm
76
+
77
+ 3. **Extract accomplishments:**
78
+
79
+ - Read all phase SUMMARY.md files in milestone range
80
+ - Extract 4-6 key accomplishments
81
+ - Present for approval
82
+
83
+ 4. **Archive milestone:**
84
+
85
+ - Create `.planning/milestones/v{{version}}-ROADMAP.md`
86
+ - Extract full phase details from ROADMAP.md
87
+ - Fill milestone-archive.md template
88
+ - Update ROADMAP.md to one-line summary with link
89
+
90
+ 5. **Archive requirements:**
91
+
92
+ - Create `.planning/milestones/v{{version}}-REQUIREMENTS.md`
93
+ - Mark all v1 requirements as complete (checkboxes checked)
94
+ - Note requirement outcomes (validated, adjusted, dropped)
95
+ - Delete `.planning/REQUIREMENTS.md` (fresh one created for next milestone)
96
+
97
+ 6. **Update PROJECT.md:**
98
+
99
+ - Add "Current State" section with shipped version
100
+ - Add "Next Milestone Goals" section
101
+ - Archive previous content in `<details>` (if v1.1+)
102
+
103
+ 7. **Commit and tag:**
104
+
105
+ - Stage: MILESTONES.md, PROJECT.md, ROADMAP.md, STATE.md, archive files
106
+ - Commit: `chore: archive v{{version}} milestone`
107
+ - Tag: `git tag -a v{{version}} -m "[milestone summary]"`
108
+ - Ask about pushing tag
109
+
110
+ 8. **Offer next steps:**
111
+ - `/ms:discuss-milestone` — thinking partner, creates context file
112
+ - Then `/ms:new-milestone` — update PROJECT.md with new goals
113
+
114
+ </process>
115
+
116
+ <success_criteria>
117
+
118
+ - Milestone archived to `.planning/milestones/v{{version}}-ROADMAP.md`
119
+ - Requirements archived to `.planning/milestones/v{{version}}-REQUIREMENTS.md`
120
+ - `.planning/REQUIREMENTS.md` deleted (fresh for next milestone)
121
+ - ROADMAP.md collapsed to one-line entry
122
+ - PROJECT.md updated with current state
123
+ - Git tag v{{version}} created
124
+ - Commit successful
125
+ - User knows next steps (including need for fresh requirements)
126
+ </success_criteria>
127
+
128
+ <critical_rules>
129
+
130
+ - **Load workflow first:** Read complete-milestone.md before executing
131
+ - **Verify completion:** All phases must have SUMMARY.md files
132
+ - **User confirmation:** Wait for approval at verification gates
133
+ - **Archive before deleting:** Always create archive files before updating/deleting originals
134
+ - **One-line summary:** Collapsed milestone in ROADMAP.md should be single line with link
135
+ - **Context efficiency:** Archive keeps ROADMAP.md and REQUIREMENTS.md constant size per milestone
136
+ - **Fresh requirements:** Next milestone starts with `/ms:define-requirements`, not reusing old file
137
+ </critical_rules>
@@ -0,0 +1,273 @@
1
+ ---
2
+ name: ms:create-roadmap
3
+ description: Create roadmap with phases for the project
4
+ allowed-tools:
5
+ - Read
6
+ - Write
7
+ - Bash
8
+ - AskUserQuestion
9
+ - Glob
10
+ - Task
11
+ ---
12
+
13
+ <objective>
14
+ Create project roadmap with phase breakdown.
15
+
16
+ Roadmaps define what work happens in what order. Phases map to requirements.
17
+
18
+ Run after `/ms:define-requirements`.
19
+
20
+ **Improvement:** Spawns ms-roadmapper agent for heavy lifting, presents roadmap for approval before committing.
21
+ </objective>
22
+
23
+ <execution_context>
24
+ @~/.claude/mindsystem/references/principles.md
25
+ @~/.claude/mindsystem/templates/roadmap.md
26
+ @~/.claude/mindsystem/templates/state.md
27
+ @~/.claude/mindsystem/references/goal-backward.md
28
+ </execution_context>
29
+
30
+ <context>
31
+ @.planning/PROJECT.md
32
+ @.planning/config.json
33
+ @.planning/REQUIREMENTS.md
34
+ @.planning/research/SUMMARY.md (if exists)
35
+ </context>
36
+
37
+ <process>
38
+
39
+ <step name="validate">
40
+ ```bash
41
+ # Verify project exists
42
+ [ -f .planning/PROJECT.md ] || { echo "ERROR: No PROJECT.md found. Run /ms:new-project first."; exit 1; }
43
+
44
+ # Verify requirements exist
45
+ [ -f .planning/REQUIREMENTS.md ] || { echo "ERROR: No REQUIREMENTS.md found. Run /ms:define-requirements first."; exit 1; }
46
+ ```
47
+ </step>
48
+
49
+ <step name="check_existing">
50
+ Check if roadmap already exists:
51
+
52
+ ```bash
53
+ [ -f .planning/ROADMAP.md ] && echo "ROADMAP_EXISTS" || echo "NO_ROADMAP"
54
+ ```
55
+
56
+ **If ROADMAP_EXISTS:**
57
+ Use AskUserQuestion:
58
+ - header: "Roadmap exists"
59
+ - question: "A roadmap already exists. What would you like to do?"
60
+ - options:
61
+ - "View existing" — Show current roadmap
62
+ - "Replace" — Create new roadmap (will overwrite)
63
+ - "Cancel" — Keep existing roadmap
64
+
65
+ If "View existing": `cat .planning/ROADMAP.md` and exit
66
+ If "Cancel": Exit
67
+ If "Replace": Continue
68
+ </step>
69
+
70
+ <step name="spawn_roadmapper">
71
+ **Calculate starting phase number:**
72
+
73
+ ```bash
74
+ # Find highest existing phase number
75
+ LAST_PHASE=$(ls -d .planning/phases/[0-9]*-* 2>/dev/null | sort -V | tail -1 | grep -oE '[0-9]+' | head -1)
76
+
77
+ if [ -n "$LAST_PHASE" ]; then
78
+ # Remove leading zeros for arithmetic
79
+ LAST_NUM=$((10#$LAST_PHASE))
80
+ START_PHASE=$((LAST_NUM + 1))
81
+ echo "Existing phases found. New phases will start at: $START_PHASE"
82
+ else
83
+ START_PHASE=1
84
+ echo "No existing phases. Starting at Phase 1"
85
+ fi
86
+ ```
87
+
88
+ Spawn ms-roadmapper agent with full context:
89
+
90
+ ```
91
+ Task(
92
+ subagent_type="ms-roadmapper",
93
+ prompt="""
94
+ <planning_context>
95
+
96
+ **Project:**
97
+ @.planning/PROJECT.md
98
+
99
+ **Requirements:**
100
+ @.planning/REQUIREMENTS.md
101
+
102
+ **Starting phase number:** $START_PHASE
103
+
104
+ **Research (if exists):**
105
+ @.planning/research/SUMMARY.md
106
+
107
+ **Config:**
108
+ @.planning/config.json
109
+
110
+ </planning_context>
111
+
112
+ <instructions>
113
+ Create roadmap:
114
+ 1. Derive phases from requirements (don't impose structure)
115
+ 2. **Start phase numbering at $START_PHASE** (not 1, unless this is the first milestone)
116
+ 3. Map every v1 requirement to exactly one phase
117
+ 4. Derive 2-5 success criteria per phase (observable user behaviors)
118
+ 5. Validate 100% coverage
119
+ 6. Write files immediately (ROADMAP.md, STATE.md, update REQUIREMENTS.md traceability)
120
+ 7. Return ROADMAP CREATED with summary
121
+
122
+ Write files first, then return. This ensures artifacts persist even if context is lost.
123
+ </instructions>
124
+ """,
125
+ description="Create roadmap"
126
+ )
127
+ ```
128
+ </step>
129
+
130
+ <step name="handle_return">
131
+ **If `## ROADMAP BLOCKED`:**
132
+ - Present blocker information
133
+ - Work with user to resolve
134
+ - Re-spawn when resolved
135
+
136
+ **If `## ROADMAP CREATED`:**
137
+
138
+ Read the created ROADMAP.md and present it inline:
139
+
140
+ ```
141
+ ---
142
+
143
+ ## Proposed Roadmap
144
+
145
+ **[N] phases** | **[X] requirements mapped** | All v1 requirements covered ✓
146
+
147
+ | # | Phase | Goal | Requirements | Success Criteria |
148
+ |---|-------|------|--------------|------------------|
149
+ | 1 | [Name] | [Goal] | [REQ-IDs] | [count] |
150
+ | 2 | [Name] | [Goal] | [REQ-IDs] | [count] |
151
+ ...
152
+
153
+ ### Phase Details
154
+
155
+ **Phase 1: [Name]**
156
+ Goal: [goal]
157
+ Requirements: [REQ-IDs]
158
+ Success criteria:
159
+ 1. [criterion]
160
+ 2. [criterion]
161
+
162
+ **Phase 2: [Name]**
163
+ Goal: [goal]
164
+ Requirements: [REQ-IDs]
165
+ Success criteria:
166
+ 1. [criterion]
167
+ 2. [criterion]
168
+
169
+ [... continue for all phases ...]
170
+
171
+ ---
172
+ ```
173
+ </step>
174
+
175
+ <step name="approval_gate">
176
+ **CRITICAL: Ask for approval before committing:**
177
+
178
+ Use AskUserQuestion:
179
+ - header: "Roadmap"
180
+ - question: "Does this roadmap structure work for you?"
181
+ - options:
182
+ - "Approve" — Commit and continue
183
+ - "Adjust phases" — Tell me what to change
184
+ - "Review full file" — Show raw ROADMAP.md
185
+
186
+ **If "Approve":** Continue to commit step.
187
+
188
+ **If "Adjust phases":**
189
+ - Get user's adjustment notes (ask inline what they want to change)
190
+ - Re-spawn roadmapper with revision context:
191
+ ```
192
+ Task(
193
+ subagent_type="ms-roadmapper",
194
+ prompt="""
195
+ <revision>
196
+ User feedback on roadmap:
197
+ [user's notes]
198
+
199
+ Current ROADMAP.md: @.planning/ROADMAP.md
200
+
201
+ Update the roadmap based on feedback. Edit files in place.
202
+ Return ROADMAP REVISED with changes made.
203
+ </revision>
204
+ """,
205
+ description="Revise roadmap"
206
+ )
207
+ ```
208
+ - Present revised roadmap
209
+ - Loop until user approves
210
+
211
+ **If "Review full file":** Display raw `cat .planning/ROADMAP.md`, then re-ask approval.
212
+ </step>
213
+
214
+ <step name="commit">
215
+ After user approval:
216
+
217
+ ```bash
218
+ git add .planning/ROADMAP.md .planning/STATE.md .planning/REQUIREMENTS.md
219
+ git commit -m "$(cat <<'EOF'
220
+ docs: create roadmap ([N] phases)
221
+
222
+ Phases:
223
+ 1. [phase-name]: [requirements covered]
224
+ 2. [phase-name]: [requirements covered]
225
+ ...
226
+
227
+ All v1 requirements mapped to phases.
228
+ EOF
229
+ )"
230
+ ```
231
+ </step>
232
+
233
+ <step name="done">
234
+ ```
235
+ Roadmap created:
236
+
237
+ - Roadmap: .planning/ROADMAP.md
238
+ - State: .planning/STATE.md
239
+ - [N] phases defined
240
+
241
+ ---
242
+
243
+ ## ▶ Next Up
244
+
245
+ **Phase 1: [Name]** — [Goal from ROADMAP.md]
246
+
247
+ `/ms:plan-phase 1`
248
+
249
+ <sub>`/clear` first → fresh context window</sub>
250
+
251
+ ---
252
+
253
+ **Also available:**
254
+ - `/ms:discuss-phase 1` — gather context first
255
+ - `/ms:research-phase 1` — investigate unknowns
256
+
257
+ ---
258
+ ```
259
+ </step>
260
+
261
+ </process>
262
+
263
+ <success_criteria>
264
+ - [ ] PROJECT.md validated
265
+ - [ ] REQUIREMENTS.md validated
266
+ - [ ] ms-roadmapper spawned with context
267
+ - [ ] All v1 requirements mapped to phases (no orphans)
268
+ - [ ] Success criteria derived for each phase (2-5 observable behaviors)
269
+ - [ ] Roadmap presented to user for approval
270
+ - [ ] User feedback incorporated (if any)
271
+ - [ ] ROADMAP.md, STATE.md committed after approval
272
+ - [ ] REQUIREMENTS.md traceability section updated
273
+ </success_criteria>