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,241 @@
1
+ <purpose>
2
+ Orchestrate parallel debug agents to investigate UAT gaps and find root causes.
3
+
4
+ After UAT finds gaps, spawn one debug agent per gap. Each agent investigates autonomously with symptoms pre-filled from UAT. Collect root causes, update UAT.md gaps with diagnosis, then hand off to plan-phase --gaps with actual diagnoses.
5
+
6
+ Orchestrator stays lean: parse gaps, spawn agents, collect results, update UAT.
7
+ </purpose>
8
+
9
+ <paths>
10
+ DEBUG_DIR=.planning/debug
11
+
12
+ Debug files use the `.planning/debug/` path (hidden directory with leading dot).
13
+ </paths>
14
+
15
+ <core_principle>
16
+ **Diagnose before planning fixes.**
17
+
18
+ UAT tells us WHAT is broken (symptoms). Debug agents find WHY (root cause). plan-phase --gaps then creates targeted fixes based on actual causes, not guesses.
19
+
20
+ Without diagnosis: "Comment doesn't refresh" → guess at fix → maybe wrong
21
+ With diagnosis: "Comment doesn't refresh" → "useEffect missing dependency" → precise fix
22
+ </core_principle>
23
+
24
+ <process>
25
+
26
+ <step name="parse_gaps">
27
+ **Extract gaps from UAT.md:**
28
+
29
+ Read the "Gaps" section (YAML format):
30
+ ```yaml
31
+ - truth: "Comment appears immediately after submission"
32
+ status: failed
33
+ reason: "User reported: works but doesn't show until I refresh the page"
34
+ severity: major
35
+ test: 2
36
+ artifacts: []
37
+ missing: []
38
+ ```
39
+
40
+ For each gap, also read the corresponding test from "Tests" section to get full context.
41
+
42
+ Build gap list:
43
+ ```
44
+ gaps = [
45
+ {truth: "Comment appears immediately...", severity: "major", test_num: 2, reason: "..."},
46
+ {truth: "Reply button positioned correctly...", severity: "minor", test_num: 5, reason: "..."},
47
+ ...
48
+ ]
49
+ ```
50
+ </step>
51
+
52
+ <step name="report_plan">
53
+ **Report diagnosis plan to user:**
54
+
55
+ ```
56
+ ## Diagnosing {N} Gaps
57
+
58
+ Spawning parallel debug agents to investigate root causes:
59
+
60
+ | Gap (Truth) | Severity |
61
+ |-------------|----------|
62
+ | Comment appears immediately after submission | major |
63
+ | Reply button positioned correctly | minor |
64
+ | Delete removes comment | blocker |
65
+
66
+ Each agent will:
67
+ 1. Create DEBUG-{slug}.md with symptoms pre-filled
68
+ 2. Investigate autonomously (read code, form hypotheses, test)
69
+ 3. Return root cause
70
+
71
+ This runs in parallel - all gaps investigated simultaneously.
72
+ ```
73
+ </step>
74
+
75
+ <step name="spawn_agents">
76
+ **Spawn debug agents in parallel:**
77
+
78
+ For each gap, fill the debug-subagent-prompt template and spawn:
79
+
80
+ ```
81
+ Task(
82
+ prompt=filled_debug_subagent_prompt,
83
+ subagent_type="general-purpose",
84
+ description="Debug: {truth_short}"
85
+ )
86
+ ```
87
+
88
+ **All agents spawn in single message** (parallel execution).
89
+
90
+ Template placeholders:
91
+ - `{truth}`: The expected behavior that failed
92
+ - `{expected}`: From UAT test
93
+ - `{actual}`: Verbatim user description from reason field
94
+ - `{errors}`: Any error messages from UAT (or "None reported")
95
+ - `{reproduction}`: "Test {test_num} in UAT"
96
+ - `{timeline}`: "Discovered during UAT"
97
+ - `{goal}`: `find_root_cause_only` (UAT flow - plan-phase --gaps handles fixes)
98
+ - `{slug}`: Generated from truth
99
+ </step>
100
+
101
+ <step name="collect_results">
102
+ **Collect root causes from agents:**
103
+
104
+ Each agent returns with:
105
+ ```
106
+ ## ROOT CAUSE FOUND
107
+
108
+ **Debug Session:** ${DEBUG_DIR}/{slug}.md
109
+
110
+ **Root Cause:** {specific cause with evidence}
111
+
112
+ **Evidence Summary:**
113
+ - {key finding 1}
114
+ - {key finding 2}
115
+ - {key finding 3}
116
+
117
+ **Files Involved:**
118
+ - {file1}: {what's wrong}
119
+ - {file2}: {related issue}
120
+
121
+ **Suggested Fix Direction:** {brief hint for plan-phase --gaps}
122
+ ```
123
+
124
+ Parse each return to extract:
125
+ - root_cause: The diagnosed cause
126
+ - files: Files involved
127
+ - debug_path: Path to debug session file
128
+ - suggested_fix: Hint for gap closure plan
129
+
130
+ If agent returns `## INVESTIGATION INCONCLUSIVE`:
131
+ - root_cause: "Investigation inconclusive - manual review needed"
132
+ - Note which issue needs manual attention
133
+ - Include remaining possibilities from agent return
134
+ </step>
135
+
136
+ <step name="update_uat">
137
+ **Update UAT.md gaps with diagnosis:**
138
+
139
+ For each gap in the Gaps section, add artifacts and missing fields:
140
+
141
+ ```yaml
142
+ - truth: "Comment appears immediately after submission"
143
+ status: failed
144
+ reason: "User reported: works but doesn't show until I refresh the page"
145
+ severity: major
146
+ test: 2
147
+ root_cause: "useEffect in CommentList.tsx missing commentCount dependency"
148
+ artifacts:
149
+ - path: "src/components/CommentList.tsx"
150
+ issue: "useEffect missing dependency"
151
+ missing:
152
+ - "Add commentCount to useEffect dependency array"
153
+ - "Trigger re-render when new comment added"
154
+ debug_session: .planning/debug/comment-not-refreshing.md
155
+ ```
156
+
157
+ Update status in frontmatter to "diagnosed".
158
+
159
+ Commit the updated UAT.md:
160
+ ```bash
161
+ git add ".planning/phases/XX-name/{phase}-UAT.md"
162
+ git commit -m "docs({phase}): add root causes from diagnosis"
163
+ ```
164
+ </step>
165
+
166
+ <step name="report_results">
167
+ **Report diagnosis results:**
168
+
169
+ ```
170
+ ## Diagnosis Complete
171
+
172
+ | Gap (Truth) | Root Cause | Files |
173
+ |-------------|------------|-------|
174
+ | Comment appears immediately | useEffect missing dependency | CommentList.tsx |
175
+ | Reply button positioned correctly | CSS flex order incorrect | ReplyButton.tsx |
176
+ | Delete removes comment | API missing auth header | api/comments.ts |
177
+
178
+ Debug sessions: ${DEBUG_DIR}/
179
+
180
+ ---
181
+
182
+ ## Next Up
183
+
184
+ **Plan fixes** — create fix plans from diagnosed gaps
185
+
186
+ `/ms:plan-phase {phase} --gaps`
187
+
188
+ `/clear` first for fresh context window
189
+
190
+ ---
191
+
192
+ **Also available:**
193
+ - Review debug sessions for detailed investigation
194
+ - `/ms:debug {issue}` — investigate specific issue further
195
+ ```
196
+ </step>
197
+
198
+ </process>
199
+
200
+ <context_efficiency>
201
+ **Orchestrator context:** ~15%
202
+ - Parse UAT.md gaps
203
+ - Fill template strings
204
+ - Spawn parallel Task calls
205
+ - Collect results
206
+ - Update UAT.md
207
+
208
+ **Each debug agent:** Fresh 200k context
209
+ - Loads full debug workflow
210
+ - Loads debugging references
211
+ - Investigates with full capacity
212
+ - Returns root cause
213
+
214
+ **No symptom gathering.** Agents start with symptoms pre-filled from UAT.
215
+ **No fix application.** Agents only diagnose - plan-phase --gaps handles fixes.
216
+ </context_efficiency>
217
+
218
+ <failure_handling>
219
+ **Agent fails to find root cause:**
220
+ - Mark gap as "needs manual review"
221
+ - Continue with other gaps
222
+ - Report incomplete diagnosis
223
+
224
+ **Agent times out:**
225
+ - Check DEBUG-{slug}.md for partial progress
226
+ - Can resume with /ms:debug
227
+
228
+ **All agents fail:**
229
+ - Something systemic (permissions, git, etc.)
230
+ - Report for manual investigation
231
+ - Fall back to plan-phase --gaps without root causes (less precise)
232
+ </failure_handling>
233
+
234
+ <success_criteria>
235
+ - [ ] Gaps parsed from UAT.md
236
+ - [ ] Debug agents spawned in parallel
237
+ - [ ] Root causes collected from all agents
238
+ - [ ] UAT.md gaps updated with artifacts and missing
239
+ - [ ] Debug sessions saved to ${DEBUG_DIR}/
240
+ - [ ] User knows next steps (plan-phase --gaps)
241
+ </success_criteria>
@@ -0,0 +1,293 @@
1
+ <purpose>
2
+ Execute discovery at the appropriate depth level.
3
+ Produces DISCOVERY.md (for Level 2-3) that informs PLAN.md creation.
4
+
5
+ Called from plan-phase.md's mandatory_discovery step with a depth parameter.
6
+
7
+ NOTE: For comprehensive ecosystem research ("how do experts build this"), use /ms:research-phase instead, which produces RESEARCH.md.
8
+ </purpose>
9
+
10
+ <depth_levels>
11
+ **This workflow supports three depth levels:**
12
+
13
+ | Level | Name | Time | Output | When |
14
+ | ----- | ------------ | --------- | -------------------------------------------- | ----------------------------------------- |
15
+ | 1 | Quick Verify | 2-5 min | No file, proceed with verified knowledge | Single library, confirming current syntax |
16
+ | 2 | Standard | 15-30 min | DISCOVERY.md | Choosing between options, new integration |
17
+ | 3 | Deep Dive | 1+ hour | Detailed DISCOVERY.md with validation gates | Architectural decisions, novel problems |
18
+
19
+ **Depth is determined by plan-phase.md before routing here.**
20
+ </depth_levels>
21
+
22
+ <source_hierarchy>
23
+ **MANDATORY: Context7 BEFORE WebSearch**
24
+
25
+ Claude's training data is 6-18 months stale. Always verify.
26
+
27
+ 1. **Context7 MCP FIRST** - Current docs, no hallucination
28
+ 2. **Official docs** - When Context7 lacks coverage
29
+ 3. **WebSearch LAST** - For comparisons and trends only
30
+
31
+ See ~/.claude/mindsystem/templates/discovery.md `<discovery_protocol>` for full protocol.
32
+ </source_hierarchy>
33
+
34
+ <process>
35
+
36
+ <step name="determine_depth">
37
+ Check the depth parameter passed from plan-phase.md:
38
+ - `depth=verify` → Level 1 (Quick Verification)
39
+ - `depth=standard` → Level 2 (Standard Discovery)
40
+ - `depth=deep` → Level 3 (Deep Dive)
41
+
42
+ Route to appropriate level workflow below.
43
+ </step>
44
+
45
+ <step name="level_1_quick_verify">
46
+ **Level 1: Quick Verification (2-5 minutes)**
47
+
48
+ For: Single known library, confirming syntax/version still correct.
49
+
50
+ **Process:**
51
+
52
+ 1. Resolve library in Context7:
53
+
54
+ ```
55
+ mcp__context7__resolve-library-id with libraryName: "[library]"
56
+ ```
57
+
58
+ 2. Fetch relevant docs:
59
+
60
+ ```
61
+ mcp__context7__get-library-docs with:
62
+ - context7CompatibleLibraryID: [from step 1]
63
+ - topic: [specific concern]
64
+ ```
65
+
66
+ 3. Verify:
67
+
68
+ - Current version matches expectations
69
+ - API syntax unchanged
70
+ - No breaking changes in recent versions
71
+
72
+ 4. **If verified:** Return to plan-phase.md with confirmation. No DISCOVERY.md needed.
73
+
74
+ 5. **If concerns found:** Escalate to Level 2.
75
+
76
+ **Output:** Verbal confirmation to proceed, or escalation to Level 2.
77
+ </step>
78
+
79
+ <step name="level_2_standard">
80
+ **Level 2: Standard Discovery (15-30 minutes)**
81
+
82
+ For: Choosing between options, new external integration.
83
+
84
+ **Process:**
85
+
86
+ 1. **Identify what to discover:**
87
+
88
+ - What options exist?
89
+ - What are the key comparison criteria?
90
+ - What's our specific use case?
91
+
92
+ 2. **Context7 for each option:**
93
+
94
+ ```
95
+ For each library/framework:
96
+ - mcp__context7__resolve-library-id
97
+ - mcp__context7__get-library-docs (mode: "code" for API, "info" for concepts)
98
+ ```
99
+
100
+ 3. **Official docs** for anything Context7 lacks.
101
+
102
+ 4. **WebSearch** for comparisons:
103
+
104
+ - "[option A] vs [option B] {current_year}"
105
+ - "[option] known issues"
106
+ - "[option] with [our stack]"
107
+
108
+ 5. **Cross-verify:** Any WebSearch finding → confirm with Context7/official docs.
109
+
110
+ 6. **Quality check:** Before finalizing findings, consult ~/.claude/mindsystem/references/research-pitfalls.md to avoid common research gaps.
111
+
112
+ 7. **Create DISCOVERY.md** using ~/.claude/mindsystem/templates/discovery.md structure:
113
+
114
+ - Summary with recommendation
115
+ - Key findings per option
116
+ - Code examples from Context7
117
+ - Confidence level (should be MEDIUM-HIGH for Level 2)
118
+
119
+ 8. Return to plan-phase.md.
120
+
121
+ **Output:** `.planning/phases/XX-name/DISCOVERY.md`
122
+ </step>
123
+
124
+ <step name="level_3_deep_dive">
125
+ **Level 3: Deep Dive (1+ hour)**
126
+
127
+ For: Architectural decisions, novel problems, high-risk choices.
128
+
129
+ **Process:**
130
+
131
+ 1. **Scope the discovery** using ~/.claude/mindsystem/templates/discovery.md:
132
+
133
+ - Define clear scope
134
+ - Define include/exclude boundaries
135
+ - List specific questions to answer
136
+
137
+ 2. **Exhaustive Context7 research:**
138
+
139
+ - All relevant libraries
140
+ - Related patterns and concepts
141
+ - Multiple topics per library if needed
142
+
143
+ 3. **Official documentation deep read:**
144
+
145
+ - Architecture guides
146
+ - Best practices sections
147
+ - Migration/upgrade guides
148
+ - Known limitations
149
+
150
+ 4. **WebSearch for ecosystem context:**
151
+
152
+ - How others solved similar problems
153
+ - Production experiences
154
+ - Gotchas and anti-patterns
155
+ - Recent changes/announcements
156
+
157
+ 5. **Cross-verify ALL findings:**
158
+
159
+ - Every WebSearch claim → verify with authoritative source
160
+ - Mark what's verified vs assumed
161
+ - Flag contradictions
162
+
163
+ 6. **Quality check:** Before finalizing findings, consult ~/.claude/mindsystem/references/research-pitfalls.md to ensure comprehensive coverage and avoid common research gaps.
164
+
165
+ 7. **Create comprehensive DISCOVERY.md:**
166
+
167
+ - Full structure from ~/.claude/mindsystem/templates/discovery.md
168
+ - Quality report with source attribution
169
+ - Confidence by finding
170
+ - If LOW confidence on any critical finding → add validation checkpoints
171
+
172
+ 8. **Confidence gate:** If overall confidence is LOW, present options before proceeding.
173
+
174
+ 9. Return to plan-phase.md.
175
+
176
+ **Output:** `.planning/phases/XX-name/DISCOVERY.md` (comprehensive)
177
+ </step>
178
+
179
+ <step name="identify_unknowns">
180
+ **For Level 2-3:** Define what we need to learn.
181
+
182
+ Ask: What do we need to learn before we can plan this phase?
183
+
184
+ - Technology choices?
185
+ - Best practices?
186
+ - API patterns?
187
+ - Architecture approach?
188
+ </step>
189
+
190
+ <step name="create_discovery_scope">
191
+ Use ~/.claude/mindsystem/templates/discovery.md.
192
+
193
+ Include:
194
+
195
+ - Clear discovery objective
196
+ - Scoped include/exclude lists
197
+ - Source preferences (official docs, Context7, current year)
198
+ - Output structure for DISCOVERY.md
199
+ </step>
200
+
201
+ <step name="execute_discovery">
202
+ Run the discovery:
203
+ - Use web search for current info
204
+ - Use Context7 MCP for library docs
205
+ - Prefer current year sources
206
+ - Structure findings per template
207
+ </step>
208
+
209
+ <step name="create_discovery_output">
210
+ Write `.planning/phases/XX-name/DISCOVERY.md`:
211
+ - Summary with recommendation
212
+ - Key findings with sources
213
+ - Code examples if applicable
214
+ - Metadata (confidence, dependencies, open questions, assumptions)
215
+ </step>
216
+
217
+ <step name="confidence_gate">
218
+ After creating DISCOVERY.md, check confidence level.
219
+
220
+ If confidence is LOW:
221
+ Use AskUserQuestion:
222
+
223
+ - header: "Low Confidence"
224
+ - question: "Discovery confidence is LOW: [reason]. How would you like to proceed?"
225
+ - options:
226
+ - "Dig deeper" - Do more research before planning
227
+ - "Proceed anyway" - Accept uncertainty, plan with caveats
228
+ - "Pause" - I need to think about this
229
+
230
+ If confidence is MEDIUM:
231
+ Inline: "Discovery complete (medium confidence). [brief reason]. Proceed to planning?"
232
+
233
+ If confidence is HIGH:
234
+ Proceed directly, just note: "Discovery complete (high confidence)."
235
+ </step>
236
+
237
+ <step name="open_questions_gate">
238
+ If DISCOVERY.md has open_questions:
239
+
240
+ Present them inline:
241
+ "Open questions from discovery:
242
+
243
+ - [Question 1]
244
+ - [Question 2]
245
+
246
+ These may affect implementation. Acknowledge and proceed? (yes / address first)"
247
+
248
+ If "address first": Gather user input on questions, update discovery.
249
+ </step>
250
+
251
+ <step name="offer_next">
252
+ ```
253
+ Discovery complete: .planning/phases/XX-name/DISCOVERY.md
254
+ Recommendation: [one-liner]
255
+ Confidence: [level]
256
+
257
+ What's next?
258
+
259
+ 1. Discuss phase context (/ms:discuss-phase [current-phase])
260
+ 2. Create phase plan (/ms:plan-phase [current-phase])
261
+ 3. Refine discovery (dig deeper)
262
+ 4. Review discovery
263
+
264
+ ```
265
+
266
+ NOTE: DISCOVERY.md is NOT committed separately. It will be committed with phase completion.
267
+ </step>
268
+
269
+ </process>
270
+
271
+ <success_criteria>
272
+ **Level 1 (Quick Verify):**
273
+ - Context7 consulted for library/topic
274
+ - Current state verified or concerns escalated
275
+ - Verbal confirmation to proceed (no files)
276
+
277
+ **Level 2 (Standard):**
278
+ - Context7 consulted for all options
279
+ - WebSearch findings cross-verified
280
+ - DISCOVERY.md created with recommendation
281
+ - Confidence level MEDIUM or higher
282
+ - Ready to inform PLAN.md creation
283
+
284
+ **Level 3 (Deep Dive):**
285
+ - Discovery scope defined
286
+ - Context7 exhaustively consulted
287
+ - All WebSearch findings verified against authoritative sources
288
+ - DISCOVERY.md created with comprehensive analysis
289
+ - Quality report with source attribution
290
+ - If LOW confidence findings → validation checkpoints defined
291
+ - Confidence gate passed
292
+ - Ready to inform PLAN.md creation
293
+ </success_criteria>