mindsystem-cc 3.13.1 → 3.16.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 (54) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1 -0
  3. package/agents/ms-codebase-researcher.md +105 -0
  4. package/agents/ms-consolidator.md +137 -286
  5. package/agents/ms-debugger.md +1 -0
  6. package/agents/ms-designer.md +1 -0
  7. package/agents/ms-executor.md +2 -1
  8. package/agents/ms-flutter-reviewer.md +1 -0
  9. package/agents/ms-integration-checker.md +1 -0
  10. package/agents/ms-plan-checker.md +17 -327
  11. package/agents/ms-researcher.md +25 -343
  12. package/agents/ms-roadmapper.md +10 -75
  13. package/agents/ms-verifier.md +33 -309
  14. package/agents/ms-verify-fixer.md +1 -0
  15. package/commands/ms/check-phase.md +24 -55
  16. package/commands/ms/complete-milestone.md +6 -25
  17. package/commands/ms/create-roadmap.md +3 -15
  18. package/commands/ms/design-phase.md +40 -2
  19. package/commands/ms/discuss-phase.md +1 -9
  20. package/commands/ms/doctor.md +224 -0
  21. package/commands/ms/execute-phase.md +22 -12
  22. package/commands/ms/help.md +11 -0
  23. package/commands/ms/new-milestone.md +3 -3
  24. package/commands/ms/plan-phase.md +1 -1
  25. package/commands/ms/research-phase.md +249 -85
  26. package/commands/ms/verify-work.md +7 -13
  27. package/mindsystem/templates/UAT.md +0 -274
  28. package/mindsystem/templates/context.md +1 -11
  29. package/mindsystem/templates/discovery.md +2 -3
  30. package/mindsystem/templates/knowledge.md +99 -0
  31. package/mindsystem/templates/requirements.md +3 -61
  32. package/mindsystem/templates/research-comparison-output.md +50 -0
  33. package/mindsystem/templates/research-feasibility-output.md +43 -0
  34. package/mindsystem/templates/research-project-output.md +81 -0
  35. package/mindsystem/templates/research-subagent-prompt.md +164 -48
  36. package/mindsystem/templates/roadmap-milestone.md +67 -0
  37. package/mindsystem/templates/roadmap.md +2 -66
  38. package/mindsystem/workflows/complete-milestone.md +23 -140
  39. package/mindsystem/workflows/define-requirements.md +4 -8
  40. package/mindsystem/workflows/discuss-phase.md +25 -8
  41. package/mindsystem/workflows/execute-phase.md +34 -0
  42. package/mindsystem/workflows/execute-plan.md +8 -0
  43. package/mindsystem/workflows/mockup-generation.md +1 -1
  44. package/mindsystem/workflows/plan-phase.md +40 -102
  45. package/mindsystem/workflows/verify-work.md +40 -234
  46. package/package.json +1 -1
  47. package/scripts/cleanup-phase-artifacts.sh +68 -0
  48. package/scripts/scan-artifact-subsystems.sh +55 -0
  49. package/scripts/scan-planning-context.py +689 -0
  50. package/skills/flutter-code-quality/SKILL.md +1 -1
  51. package/skills/flutter-code-simplification/SKILL.md +1 -1
  52. package/skills/flutter-senior-review/SKILL.md +1 -1
  53. package/mindsystem/templates/decisions.md +0 -145
  54. package/mindsystem/templates/learnings.md +0 -150
@@ -1,92 +1,208 @@
1
- # Research Subagent Prompt Template
1
+ # Research Subagent Prompt Templates
2
2
 
3
- Template for spawning ms-researcher agent. The agent contains all research expertise - this template provides research context only.
3
+ Templates for the 3 parallel agents spawned by `/ms:research-phase`. The orchestrator constructs prompts inline. These templates serve as reference documentation.
4
4
 
5
5
  ---
6
6
 
7
- ## Template
7
+ ## Common Context (injected into all 3 agents)
8
8
 
9
- ```markdown
10
- <objective>
11
- Research: {research_question}
9
+ | Placeholder | Source |
10
+ |-------------|--------|
11
+ | `{existing_tech}` | Dependency file (pubspec.yaml / package.json / etc.) |
12
+ | `{phase_description}` | ROADMAP.md phase entry |
13
+ | `{requirements}` | REQUIREMENTS.md |
14
+ | `{locked_decisions}` | CONTEXT.md + STATE.md decisions |
15
+ | `{design_specs}` | DESIGN.md (if exists) |
16
+ | `{mode}` | Research mode: ecosystem / feasibility / implementation / comparison |
17
+ | `{framed_question}` | Mode + phase description combined into research question |
18
+ | `{scan_hints}` | Keywords extracted from phase description |
12
19
 
13
- Mode: {research_mode}
14
- </objective>
20
+ ---
15
21
 
16
- <context>
17
- **Phase:** {phase_number} - {phase_name}
18
- **Description:** {phase_description}
22
+ ## Template 1: External Docs (ms-researcher)
19
23
 
20
- **Requirements:**
21
- {phase_requirements}
24
+ **Focus:** Library documentation, APIs, verified code examples
25
+ **Tools emphasized:** ms-lookup docs (Context7), ms-lookup deep (Perplexity), WebSearch, WebFetch
26
+ **Returns:** Structured findings (not files)
22
27
 
23
- **Constraints:**
24
- {constraints_from_state}
28
+ ```markdown
29
+ <research_type>
30
+ Phase Research — External Documentation focus.
31
+ </research_type>
32
+
33
+ <focus>
34
+ Library documentation, APIs, version-specific behavior, verified code examples.
35
+ Use the ms-lookup CLI for library docs and deep research:
36
+ ~/.claude/mindsystem/scripts/ms-lookup-wrapper.sh docs <library> '<query>'
37
+ ~/.claude/mindsystem/scripts/ms-lookup-wrapper.sh deep '<query>'
38
+ Use WebSearch for ecosystem discovery.
39
+ Focus on finding authoritative, current documentation for the libraries and tools
40
+ needed to implement this phase.
41
+ </focus>
42
+
43
+ <existing_tech>
44
+ {existing_tech}
45
+ </existing_tech>
25
46
 
26
- **Phase context (if available):**
27
- {context_md_content}
47
+ <objective>
48
+ Research external documentation for Phase {N}: {name}
49
+ Mode: {mode}
50
+ </objective>
51
+
52
+ <context>
53
+ {phase_description, requirements, locked_decisions, design_specs}
28
54
  </context>
29
55
 
56
+ <downstream_consumer>
57
+ Your findings feed into orchestrator synthesis -> RESEARCH.md sections:
58
+ - Standard Stack (libraries, versions, install commands)
59
+ - Architecture Patterns (library-recommended patterns)
60
+ - Don't Hand-Roll (library solutions for common problems)
61
+ - Code Examples (verified from official docs)
62
+ - State of the Art (latest approaches, deprecated patterns)
63
+ Be prescriptive. Specific versions. Verified code.
64
+ </downstream_consumer>
65
+
30
66
  <output>
31
- Write research findings to: {output_path}
32
- Use RESEARCH.md template structure for phase research.
67
+ Return findings as structured text. Do NOT write to filesystem.
68
+ Format:
69
+ ## EXTERNAL DOCS FINDINGS
70
+ ### Recommended Libraries (name, version, purpose, install)
71
+ ### API Patterns & Code Examples (verified from docs)
72
+ ### Architecture Recommendations (from library docs)
73
+ ### Don't Hand-Roll (library solutions exist for these)
74
+ ### Version Constraints & Compatibility
75
+ ### Confidence (HIGH/MEDIUM/LOW per section with sources)
76
+ Complete your built-in verification protocol and quality checklist before returning findings.
33
77
  </output>
34
78
  ```
35
79
 
36
80
  ---
37
81
 
38
- ## Placeholders
82
+ ## Template 2: Codebase Patterns (ms-codebase-researcher)
83
+
84
+ **Focus:** Existing patterns, learnings, established conventions
85
+ **Tools emphasized:** Grep, Glob, Read
86
+ **Returns:** Structured findings (not files)
87
+
88
+ ```markdown
89
+ <objective>
90
+ Analyze project codebase for patterns relevant to Phase {N}: {name}
91
+ </objective>
92
+
93
+ <research_question>
94
+ {framed_question}
95
+ </research_question>
96
+
97
+ <phase_context>
98
+ {phase_description, requirements, locked_decisions}
99
+ </phase_context>
100
+
101
+ <existing_tech>
102
+ {existing_tech}
103
+ </existing_tech>
39
104
 
40
- | Placeholder | Source | Example |
41
- |-------------|--------|---------|
42
- | `{research_question}` | Phase description | `How to implement 3D visualization` |
43
- | `{research_mode}` | Orchestrator sets | `ecosystem` |
44
- | `{phase_number}` | From roadmap | `5` |
45
- | `{phase_name}` | From roadmap | `3d-visualization` |
46
- | `{phase_description}` | From roadmap | `Add interactive 3D model viewer` |
47
- | `{phase_requirements}` | From REQUIREMENTS.md | `VIZ-01: Support GLB format` |
48
- | `{constraints_from_state}` | From STATE.md decisions | `Using React, not Vue` |
49
- | `{context_md_content}` | From CONTEXT.md | User's vision notes |
50
- | `{output_path}` | Generated | `.planning/phases/5-viz/5-RESEARCH.md` |
105
+ <scan_hints>
106
+ {scan_hints}
107
+ </scan_hints>
108
+
109
+ <quality>
110
+ Complete your built-in success criteria checklist before returning findings.
111
+ </quality>
112
+ ```
113
+
114
+ The agent's built-in `<what_to_scan>` section handles the systematic scan checklist (dependency file, source patterns, codebase docs, learnings, summaries, debug resolutions, adhoc summaries). The prompt only needs to provide context.
51
115
 
52
116
  ---
53
117
 
54
- ## Usage
118
+ ## Template 3: Best Practices (ms-researcher)
119
+
120
+ **Focus:** Community consensus, pitfalls, SOTA
121
+ **Tools emphasized:** ms-lookup deep (Perplexity), WebSearch
122
+ **Returns:** Structured findings (not files)
123
+
124
+ ```markdown
125
+ <research_type>
126
+ Phase Research — Best Practices & Community Consensus focus.
127
+ </research_type>
128
+
129
+ <focus>
130
+ Community consensus, common pitfalls, proven approaches, state of the art.
131
+ Use the ms-lookup CLI for deep research on high-value questions:
132
+ ~/.claude/mindsystem/scripts/ms-lookup-wrapper.sh deep '<query>'
133
+ Use WebSearch for community articles, blog posts, Stack Overflow patterns.
134
+ Focus on what practitioners recommend and what mistakes to avoid.
135
+ </focus>
136
+
137
+ <existing_tech>
138
+ {existing_tech}
139
+ </existing_tech>
55
140
 
56
- **From /ms:research-phase:**
57
- ```python
58
- Task(
59
- prompt=filled_template,
60
- subagent_type="ms-researcher",
61
- description="Research Phase {phase}"
62
- )
141
+ <objective>
142
+ Research best practices for Phase {N}: {name}
143
+ Mode: {mode}
144
+ </objective>
145
+
146
+ <context>
147
+ {phase_description, requirements, locked_decisions, design_specs}
148
+ </context>
149
+
150
+ <downstream_consumer>
151
+ Your findings feed into orchestrator synthesis -> RESEARCH.md sections:
152
+ - Common Pitfalls (community war stories, warning signs)
153
+ - State of the Art (current vs deprecated approaches)
154
+ - Architecture Patterns (industry patterns, not library-specific)
155
+ - Don't Hand-Roll (community-known solved problems)
156
+ - Alternatives Considered (why X over Y)
157
+ Be prescriptive. Cite sources. Flag confidence levels.
158
+ </downstream_consumer>
159
+
160
+ <output>
161
+ Return findings as structured text. Do NOT write to filesystem.
162
+ Format:
163
+ ## BEST PRACTICES FINDINGS
164
+ ### Recommended Approaches (community consensus)
165
+ ### Common Pitfalls (what goes wrong, warning signs, prevention)
166
+ ### State of the Art (current vs deprecated, when things changed)
167
+ ### Alternative Approaches (what else exists, why not chosen)
168
+ ### Industry Patterns (architecture, testing, deployment)
169
+ ### Confidence (HIGH/MEDIUM/LOW per section with sources)
170
+ Complete your built-in verification protocol and quality checklist before returning findings.
171
+ </output>
63
172
  ```
64
173
 
65
174
  ---
66
175
 
67
- ## Continuation
176
+ ## Continuation (for checkpoints)
68
177
 
69
- For checkpoints, spawn fresh agent with:
178
+ If an agent returns a CHECKPOINT, spawn a fresh agent of the same type with:
179
+
180
+ `{partial_findings}` = the checkpointed agent's full text response (inline content, not a file reference). The orchestrator captures this from the Task result and injects it directly.
70
181
 
71
182
  ```markdown
72
183
  <objective>
73
- Continue research for Phase {phase_number}: {phase_name}
184
+ Continue research for Phase {N}: {name}
74
185
  </objective>
75
186
 
187
+ <existing_tech>
188
+ {existing_tech}
189
+ </existing_tech>
190
+
191
+ <phase_context>
192
+ {phase_description, requirements, locked_decisions}
193
+ </phase_context>
194
+
76
195
  <prior_state>
77
- Research file: @{output_path}
196
+ Research findings so far:
197
+ {partial_findings}
78
198
  </prior_state>
79
199
 
80
200
  <checkpoint_response>
81
201
  **Type:** {checkpoint_type}
82
202
  **Response:** {user_response}
83
203
  </checkpoint_response>
84
-
85
- <mode>
86
- Continue: {research_mode}
87
- </mode>
88
204
  ```
89
205
 
90
206
  ---
91
207
 
92
- **Note:** Research methodology, tool strategy (Context7 > Official > WebSearch), and verification protocols are baked into the ms-researcher agent. This template only passes context.
208
+ **Note:** Research methodology, tool strategy (ms-lookup docs > Official > ms-lookup deep > WebSearch), verification protocols, and source confidence levels are baked into `ms-researcher`. Codebase scan methodology is baked into `ms-codebase-researcher`. These templates pass context only and reinforce that built-in quality processes still apply.
@@ -0,0 +1,67 @@
1
+ # Milestone-Grouped Roadmap Template
2
+
3
+ Template for reorganizing `ROADMAP.md` after first milestone ships. Collapse completed milestones, expand current/future work.
4
+
5
+ ```markdown
6
+ # Roadmap: [Project Name]
7
+
8
+ ## Milestones
9
+
10
+ - ✅ **v1.0 MVP** - Phases 1-4 (shipped YYYY-MM-DD)
11
+ - 🚧 **v1.1 [Name]** - Phases 5-6 (in progress)
12
+ - 📋 **v2.0 [Name]** - Phases 7-10 (planned)
13
+
14
+ ## Phases
15
+
16
+ <details>
17
+ <summary>✅ v1.0 MVP (Phases 1-4) - SHIPPED YYYY-MM-DD</summary>
18
+
19
+ ### Phase 1: [Name]
20
+ **Goal**: [What this phase delivers]
21
+ **Plans**: 3 plans
22
+
23
+ Plans:
24
+ - [x] 01-01: [Brief description]
25
+ - [x] 01-02: [Brief description]
26
+ - [x] 01-03: [Brief description]
27
+
28
+ [... remaining v1.0 phases ...]
29
+
30
+ </details>
31
+
32
+ ### 🚧 v1.1 [Name] (In Progress)
33
+
34
+ **Milestone Goal:** [What v1.1 delivers]
35
+
36
+ #### Phase 5: [Name]
37
+ **Goal**: [What this phase delivers]
38
+ **Depends on**: Phase 4
39
+ **Plans**: 2 plans
40
+
41
+ Plans:
42
+ - [ ] 05-01: [Brief description]
43
+ - [ ] 05-02: [Brief description]
44
+
45
+ [... remaining v1.1 phases ...]
46
+
47
+ ### 📋 v2.0 [Name] (Planned)
48
+
49
+ **Milestone Goal:** [What v2.0 delivers]
50
+
51
+ [... v2.0 phases ...]
52
+
53
+ ## Progress
54
+
55
+ | Phase | Milestone | Plans Complete | Status | Completed |
56
+ |-------|-----------|----------------|--------|-----------|
57
+ | 1. Foundation | v1.0 | 3/3 | Complete | YYYY-MM-DD |
58
+ | 2. Features | v1.0 | 2/2 | Complete | YYYY-MM-DD |
59
+ | 5. Security | v1.1 | 0/2 | Not started | - |
60
+ ```
61
+
62
+ **Notes:**
63
+ - Milestone emoji: ✅ shipped, 🚧 in progress, 📋 planned
64
+ - Completed milestones collapsed in `<details>` for readability
65
+ - Current/future milestones expanded
66
+ - Continuous phase numbering (01-99)
67
+ - Progress table includes milestone column
@@ -157,70 +157,6 @@ Phases execute in numeric order: 2 → 2.1 → 2.2 → 3 → 3.1 → 4
157
157
  - `Deferred` - Pushed to later (with reason)
158
158
  </status_values>
159
159
 
160
- ## Milestone-Grouped Roadmap (After v1.0 Ships)
160
+ ## Milestone-Grouped Roadmap
161
161
 
162
- After completing first milestone, reorganize with milestone groupings:
163
-
164
- ```markdown
165
- # Roadmap: [Project Name]
166
-
167
- ## Milestones
168
-
169
- - ✅ **v1.0 MVP** - Phases 1-4 (shipped YYYY-MM-DD)
170
- - 🚧 **v1.1 [Name]** - Phases 5-6 (in progress)
171
- - 📋 **v2.0 [Name]** - Phases 7-10 (planned)
172
-
173
- ## Phases
174
-
175
- <details>
176
- <summary>✅ v1.0 MVP (Phases 1-4) - SHIPPED YYYY-MM-DD</summary>
177
-
178
- ### Phase 1: [Name]
179
- **Goal**: [What this phase delivers]
180
- **Plans**: 3 plans
181
-
182
- Plans:
183
- - [x] 01-01: [Brief description]
184
- - [x] 01-02: [Brief description]
185
- - [x] 01-03: [Brief description]
186
-
187
- [... remaining v1.0 phases ...]
188
-
189
- </details>
190
-
191
- ### 🚧 v1.1 [Name] (In Progress)
192
-
193
- **Milestone Goal:** [What v1.1 delivers]
194
-
195
- #### Phase 5: [Name]
196
- **Goal**: [What this phase delivers]
197
- **Depends on**: Phase 4
198
- **Plans**: 2 plans
199
-
200
- Plans:
201
- - [ ] 05-01: [Brief description]
202
- - [ ] 05-02: [Brief description]
203
-
204
- [... remaining v1.1 phases ...]
205
-
206
- ### 📋 v2.0 [Name] (Planned)
207
-
208
- **Milestone Goal:** [What v2.0 delivers]
209
-
210
- [... v2.0 phases ...]
211
-
212
- ## Progress
213
-
214
- | Phase | Milestone | Plans Complete | Status | Completed |
215
- |-------|-----------|----------------|--------|-----------|
216
- | 1. Foundation | v1.0 | 3/3 | Complete | YYYY-MM-DD |
217
- | 2. Features | v1.0 | 2/2 | Complete | YYYY-MM-DD |
218
- | 5. Security | v1.1 | 0/2 | Not started | - |
219
- ```
220
-
221
- **Notes:**
222
- - Milestone emoji: ✅ shipped, 🚧 in progress, 📋 planned
223
- - Completed milestones collapsed in `<details>` for readability
224
- - Current/future milestones expanded
225
- - Continuous phase numbering (01-99)
226
- - Progress table includes milestone column
162
+ After first milestone ships, reorganize with milestone groupings. Read `templates/roadmap-milestone.md` for the milestone-grouped format.
@@ -22,16 +22,16 @@ This is the ritual that separates "development" from "shipped."
22
22
 
23
23
  When a milestone completes, this workflow:
24
24
 
25
- 1. Consolidates phase decisions into `.planning/milestones/v[X.Y]-DECISIONS.md`
26
- 2. Cleans up phase artifacts (PLAN, CONTEXT, RESEARCH, DESIGN files deleted)
27
- 3. Extracts full milestone details to `.planning/milestones/v[X.Y]-ROADMAP.md`
28
- 4. Archives requirements to `.planning/milestones/v[X.Y]-REQUIREMENTS.md`
29
- 5. Archives milestone context to `.planning/milestones/v[X.Y]-CONTEXT.md`
30
- 6. Updates ROADMAP.md to replace milestone details with one-line summary
31
- 7. Deletes REQUIREMENTS.md (fresh one created for next milestone)
32
- 8. Extracts learnings into `.planning/LEARNINGS.md` (curated one-line patterns with source refs)
33
- 9. Performs full PROJECT.md evolution review
34
- 10. Routes to `/ms:new-milestone` for next milestone
25
+ 1. Cleans up raw phase artifacts (CONTEXT, DESIGN, RESEARCH, SUMMARY, UAT, VERIFICATION, EXECUTION-ORDER deleted)
26
+ 2. Extracts full milestone details to `.planning/milestones/v[X.Y]-ROADMAP.md`
27
+ 3. Archives requirements to `.planning/milestones/v[X.Y]-REQUIREMENTS.md`
28
+ 4. Archives milestone context to `.planning/milestones/v[X.Y]-CONTEXT.md`
29
+ 5. Updates ROADMAP.md to replace milestone details with one-line summary
30
+ 6. Deletes REQUIREMENTS.md (fresh one created for next milestone)
31
+ 7. Performs full PROJECT.md evolution review
32
+ 8. Routes to `/ms:new-milestone` for next milestone
33
+
34
+ Knowledge files in `.planning/knowledge/` persist across milestones (maintained by phase-level consolidation in execute-phase).
35
35
 
36
36
  **Context Efficiency:**
37
37
 
@@ -102,136 +102,25 @@ cat .planning/config.json 2>/dev/null
102
102
  Proceeding to stats gathering...
103
103
  ```
104
104
 
105
- Proceed directly to consolidate_decisions step.
105
+ Proceed directly to cleanup_artifacts step.
106
106
 
107
107
  </step>
108
108
 
109
- <step name="consolidate_decisions">
110
-
111
- Consolidate phase decisions before archiving.
112
-
113
- **Spawn ms-consolidator agent:**
114
-
115
- ```
116
- Task(
117
- prompt="Consolidate decisions from milestone v[X.Y] [Name].
118
-
119
- Phase range: [PHASE_START]-[PHASE_END]
120
- Phase directories:
121
- - .planning/phases/01-foundation
122
- - .planning/phases/02-auth
123
- - [etc. for all phases in milestone]
124
-
125
- Extract decisions from PLAN, CONTEXT, RESEARCH, DESIGN files.
126
- Create v[X.Y]-DECISIONS.md in .planning/milestones/.
127
- Delete source files (preserve SUMMARY, VERIFICATION, UAT).",
128
- subagent_type="ms-consolidator"
129
- )
130
- ```
131
-
132
- **Wait for completion and verify:**
133
-
134
- ```bash
135
- ls .planning/milestones/v[X.Y]-DECISIONS.md
136
- ```
137
-
138
- **Present consolidation summary:**
139
-
140
- ```
141
- ✓ Decisions consolidated: [N] decisions in [M] categories
142
- ✓ Source files cleaned: PLAN, CONTEXT, RESEARCH, DESIGN deleted
143
- ✓ Preserved: SUMMARY, VERIFICATION, UAT files
144
-
145
- Report: .planning/milestones/v[X.Y]-DECISIONS.md
146
- ```
147
-
148
- Continue to extract_learnings step.
149
-
150
- </step>
151
-
152
- <step name="extract_learnings">
153
-
154
- Extract reusable patterns from milestone artifacts into `.planning/LEARNINGS.md`.
155
-
156
- **Runs in main context** (not subagent) — curation requires judgment.
157
-
158
- **Reference:** `~/.claude/mindsystem/templates/learnings.md`
159
-
160
- **1. Scan source artifacts:**
109
+ <step name="cleanup_artifacts">
161
110
 
162
- All sources are PRESERVED by ms-consolidator (only PLAN, CONTEXT, RESEARCH, DESIGN are deleted).
111
+ Delete remaining raw artifacts from phase directories. Knowledge files are already current from phase-level consolidation in execute-phase no consolidation or learnings extraction needed.
163
112
 
164
113
  ```bash
165
- # Debug resolutions — parse frontmatter for root_cause, resolution, subsystem, prevention
166
- ls .planning/debug/resolved/*.md 2>/dev/null
114
+ ~/.claude/mindsystem/scripts/cleanup-phase-artifacts.sh $PHASE_START $PHASE_END
167
115
  ```
168
116
 
169
- ```bash
170
- # Adhoc summaries — parse frontmatter for learnings array, subsystem
171
- ls .planning/adhoc/*-SUMMARY.md 2>/dev/null
172
- ```
117
+ Knowledge files in `.planning/knowledge/` persist (they ARE the milestone's knowledge output).
173
118
 
174
- ```bash
175
- # Phase summaries in milestone range — read Deviations/Issues sections, parse subsystem
176
- ls .planning/phases/{PHASE_START}*/{PHASE_START}*-SUMMARY.md .planning/phases/{PHASE_END}*/{PHASE_END}*-SUMMARY.md 2>/dev/null
177
- # (expand to all phases in milestone range)
178
- ```
119
+ **Present cleanup summary:**
179
120
 
180
- ```bash
181
- # Completed todos — scan for reusable patterns (lower priority)
182
- ls .planning/todos/done/*.md 2>/dev/null
183
121
  ```
184
-
185
- For each source found, read frontmatter and relevant sections. Extract candidate learnings.
186
-
187
- **2. Curate entries:**
188
-
189
- - Select 4-8 entries max from candidates
190
- - Exclude: decisions (belong in DECISIONS.md), trivial fixes, one-time issues
191
- - Prefer prevention framing: "Always validate X before Y" over "We found a bug in X"
192
- - Deduplicate: if two sources surface the same pattern, keep the more prescriptive version
193
-
194
- **3. Group by subsystem:**
195
-
196
- ```bash
197
- jq -r '.subsystems[]' .planning/config.json 2>/dev/null
198
- ```
199
-
200
- Group entries under subsystem headings from config.json vocabulary.
201
-
202
- **4. Write to LEARNINGS.md:**
203
-
204
- Format per entry:
205
- ```
206
- - **{Brief title}**: {Prescriptive action} → `{source_ref}`
207
- ```
208
-
209
- If `.planning/LEARNINGS.md` does not exist (first milestone):
210
- - Create file with header from template
211
- - Add milestone section
212
-
213
- If `.planning/LEARNINGS.md` exists (subsequent milestone):
214
- - Prepend new milestone section after header (reverse chronological)
215
- - Update "Last updated" footer
216
-
217
- **5. Handle "no learnings" gracefully:**
218
-
219
- If no meaningful patterns found across all sources:
220
- - Do NOT create or modify LEARNINGS.md
221
- - Present informational message:
222
- ```
223
- ℹ No reusable learnings found for v[X.Y]
224
- Sources scanned: [N] debug docs, [N] adhoc summaries, [N] phase summaries, [N] completed todos
225
- Skipping LEARNINGS.md update
226
- ```
227
-
228
- **6. Present summary:**
229
-
230
- ```
231
- ✓ Learnings extracted: [N] entries across [M] subsystems
232
- - [subsystem1]: [count] entries
233
- - [subsystem2]: [count] entries
234
- Written to: .planning/LEARNINGS.md
122
+ Raw artifacts cleaned from phase directories
123
+ Knowledge files persist in .planning/knowledge/
235
124
  ```
236
125
 
237
126
  Continue to gather_stats step.
@@ -757,21 +646,17 @@ Commit milestone completion including archive files and deletions.
757
646
 
758
647
  ```bash
759
648
  # Stage archive files (new)
760
- git add .planning/milestones/v[X.Y]-DECISIONS.md
761
649
  git add .planning/milestones/v[X.Y]-ROADMAP.md
762
650
  git add .planning/milestones/v[X.Y]-REQUIREMENTS.md
763
651
  git add .planning/milestones/v[X.Y]-MILESTONE-AUDIT.md 2>/dev/null || true
764
652
  git add .planning/milestones/v[X.Y]-CONTEXT.md 2>/dev/null || true
765
653
 
766
- # Stage learnings (may not exist if no learnings found)
767
- git add .planning/LEARNINGS.md 2>/dev/null || true
768
-
769
654
  # Stage updated files
770
655
  git add .planning/MILESTONES.md
771
656
  git add .planning/PROJECT.md
772
657
  git add .planning/STATE.md
773
658
 
774
- # Stage deletions
659
+ # Stage deletions (raw artifacts cleaned from phase directories)
775
660
  git add -u .planning/
776
661
 
777
662
  # Commit with descriptive message
@@ -779,13 +664,13 @@ git commit -m "$(cat <<'EOF'
779
664
  chore: complete v[X.Y] milestone
780
665
 
781
666
  Archived:
782
- - milestones/v[X.Y]-DECISIONS.md (consolidated decisions)
783
667
  - milestones/v[X.Y]-ROADMAP.md
784
668
  - milestones/v[X.Y]-REQUIREMENTS.md
785
669
  - milestones/v[X.Y]-MILESTONE-AUDIT.md (if audit was run)
786
670
 
787
671
  Cleaned:
788
- - Phase PLAN, CONTEXT, RESEARCH, DESIGN files (consolidated into DECISIONS.md)
672
+ - Raw phase artifacts (CONTEXT, DESIGN, RESEARCH, SUMMARY, UAT, VERIFICATION, EXECUTION-ORDER)
673
+ - Knowledge files persist in .planning/knowledge/
789
674
 
790
675
  Deleted (fresh for next milestone):
791
676
  - ROADMAP.md
@@ -795,7 +680,6 @@ Updated:
795
680
  - MILESTONES.md (new entry)
796
681
  - PROJECT.md (requirements → Validated)
797
682
  - STATE.md (reset for next milestone)
798
- - LEARNINGS.md (curated patterns, if any found)
799
683
 
800
684
  Tagged: v[X.Y]
801
685
  EOF
@@ -886,9 +770,8 @@ If yes → milestone. If no → keep working.
886
770
 
887
771
  Milestone completion is successful when:
888
772
 
889
- - [ ] Decisions consolidated (milestones/v[X.Y]-DECISIONS.md created)
890
- - [ ] Phase artifacts cleaned (PLAN, CONTEXT, RESEARCH, DESIGN deleted)
891
- - [ ] Learnings extracted to .planning/LEARNINGS.md (or gracefully skipped if none found)
773
+ - [ ] Raw artifacts cleaned from phase directories (CONTEXT, DESIGN, RESEARCH, SUMMARY, UAT, VERIFICATION, EXECUTION-ORDER)
774
+ - [ ] Knowledge files persist in .planning/knowledge/
892
775
  - [ ] MILESTONES.md entry created with stats and accomplishments
893
776
  - [ ] PROJECT.md full evolution review completed
894
777
  - [ ] All shipped requirements moved to Validated in PROJECT.md
@@ -4,8 +4,6 @@ Define concrete, checkable requirements for v1.
4
4
  Two modes:
5
5
  1. **With research** — Transform FEATURES.md into scoped requirements
6
6
  2. **Without research** — Gather requirements through questioning
7
-
8
- This is the bridge between "what's possible/wanted" and "what we're committing to."
9
7
  </purpose>
10
8
 
11
9
  <required_reading>
@@ -318,13 +316,11 @@ Requirements defined:
318
316
  </quality_criteria>
319
317
 
320
318
  <success_criteria>
321
- - [ ] PROJECT.md core value extracted
322
- - [ ] Features gathered (from research OR conversation)
323
- - [ ] All categories presented to user
324
- - [ ] User scoped each category (v1/v2/out of scope)
325
- - [ ] User had opportunity to add requirements
326
319
  - [ ] Core value alignment validated
320
+ - [ ] User had opportunity to add requirements
321
+ - [ ] User scoped each category (v1/v2/out of scope)
322
+ - [ ] All categories presented to user
327
323
  - [ ] REQUIREMENTS.md created with REQ-IDs
328
324
  - [ ] v1, v2, and out of scope clearly separated
329
- - [ ] Requirements committed to git
325
+ - [ ] Features gathered (from research OR conversation)
330
326
  </success_criteria>