mindsystem-cc 3.17.1 → 3.18.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 (37) hide show
  1. package/agents/ms-consolidator.md +4 -4
  2. package/agents/ms-debugger.md +3 -3
  3. package/agents/ms-designer.md +33 -70
  4. package/agents/ms-executor.md +7 -6
  5. package/agents/ms-plan-writer.md +52 -26
  6. package/agents/ms-researcher.md +13 -13
  7. package/commands/ms/check-phase.md +1 -1
  8. package/commands/ms/complete-milestone.md +47 -54
  9. package/commands/ms/design-phase.md +33 -30
  10. package/commands/ms/review-design.md +106 -395
  11. package/mindsystem/references/principles.md +3 -3
  12. package/mindsystem/references/routing/next-phase-routing.md +1 -1
  13. package/mindsystem/references/scope-estimation.md +22 -35
  14. package/mindsystem/templates/design-iteration.md +13 -13
  15. package/mindsystem/templates/design.md +145 -327
  16. package/mindsystem/templates/knowledge.md +1 -1
  17. package/mindsystem/templates/milestone-archive.md +3 -3
  18. package/mindsystem/templates/phase-prompt.md +6 -7
  19. package/mindsystem/templates/research-subagent-prompt.md +2 -2
  20. package/mindsystem/templates/research.md +7 -7
  21. package/mindsystem/templates/roadmap.md +1 -1
  22. package/mindsystem/templates/verification-report.md +1 -1
  23. package/mindsystem/workflows/complete-milestone.md +52 -227
  24. package/mindsystem/workflows/discuss-phase.md +3 -3
  25. package/mindsystem/workflows/execute-plan.md +1 -1
  26. package/mindsystem/workflows/plan-phase.md +22 -50
  27. package/mindsystem/workflows/verify-phase.md +1 -1
  28. package/package.json +1 -1
  29. package/scripts/archive-milestone-files.sh +68 -0
  30. package/scripts/archive-milestone-phases.sh +138 -0
  31. package/scripts/gather-milestone-stats.sh +179 -0
  32. package/scripts/ms-lookup/ms_lookup/backends/context7.py +17 -5
  33. package/scripts/ms-lookup/ms_lookup/backends/perplexity.py +17 -3
  34. package/scripts/ms-lookup-wrapper.sh +1 -1
  35. package/scripts/scan-planning-context.py +186 -36
  36. package/scripts/validate-execution-order.sh +4 -5
  37. package/scripts/cleanup-phase-artifacts.sh +0 -68
@@ -67,10 +67,10 @@ You are a Mindsystem knowledge consolidator spawned by execute-phase after plan
67
67
 
68
68
  | DESIGN Content | Target Knowledge Section |
69
69
  |----------------|------------------------|
70
- | Component specs, layout choices | Design |
71
- | Design tokens, color values, spacing | Design |
72
- | UX flows, interaction patterns | Design |
73
- | Component states, responsive behavior | Design |
70
+ | Wireframe layouts, inline annotations | Design |
71
+ | Design tokens (colors, spacing, typography) | Design |
72
+ | Behavior notes, interaction patterns | Design |
73
+ | States tables, platform hints | Design |
74
74
 
75
75
  ### RESEARCH.md (distribute across affected subsystems)
76
76
 
@@ -615,7 +615,7 @@ The cost of insufficient verification: bug returns, user frustration, emergency
615
615
  **2. Library/framework behavior doesn't match expectations**
616
616
  - Using library correctly but it's not working
617
617
  - Documentation contradicts behavior
618
- - **Action:** Check official docs (Context7), GitHub issues
618
+ - **Action:** Check official docs (`ms-lookup docs`), GitHub issues
619
619
 
620
620
  **3. Domain knowledge gaps**
621
621
  - Debugging auth: need to understand OAuth flow
@@ -657,7 +657,7 @@ The cost of insufficient verification: bug returns, user frustration, emergency
657
657
  - Include version: `"react 18 useEffect behavior"`
658
658
  - Add "github issue" for known bugs
659
659
 
660
- **Context7 MCP:**
660
+ **`ms-lookup docs`:**
661
661
  - For API reference, library concepts, function signatures
662
662
 
663
663
  **GitHub Issues:**
@@ -687,7 +687,7 @@ Is this an error message I don't recognize?
687
687
  └─ NO ↓
688
688
 
689
689
  Is this library/framework behavior I don't understand?
690
- ├─ YES → Check docs (Context7 or official docs)
690
+ ├─ YES → Check docs (`ms-lookup docs` or official docs)
691
691
  └─ NO ↓
692
692
 
693
693
  Is this code I/my team wrote?
@@ -17,10 +17,9 @@ Your job: Transform user vision into concrete, implementable design specificatio
17
17
  **Core responsibilities:**
18
18
  - Analyze existing project aesthetic (project UI skill, codebase patterns)
19
19
  - Apply quality-forcing patterns (commercial benchmark, pre-emptive criticism, self-review)
20
- - Create ASCII wireframes with precise spacing and component placement
21
- - Specify component behaviors, states, and platform-specific requirements
22
- - Document UX flows with clear user journey steps
23
- - Provide verification criteria that prove design was implemented correctly
20
+ - Create ASCII wireframes with inline annotations (token refs, spacing, dimensions, component names)
21
+ - Specify component states, non-obvious behaviors, and implementation hints per screen
22
+ - Produce a compact Design Tokens table where every value appears exactly once
24
23
  </role>
25
24
 
26
25
  <upstream_input>
@@ -196,7 +195,8 @@ After completing design but BEFORE returning:
196
195
  2. **Verify color pairs** — Primary text/background, secondary text/background
197
196
  3. **Check all interactive elements** — Buttons, links, inputs, cards with actions
198
197
  4. **Fix violations** — Adjust specs until all checks pass
199
- 5. **Document in Verification Criteria** — Note which validations were verified
198
+
199
+ Append `Validation: passed` to the end of DESIGN.md after all checks pass.
200
200
 
201
201
  **This validation is not optional.** A design that violates these constraints will cause implementation issues. Fix now, not later.
202
202
  </validation_rules>
@@ -242,54 +242,19 @@ Based on context chain, determine:
242
242
  - **Color direction:** warm, cool, monochromatic, vibrant (with specific values)
243
243
  - **Density:** tight, comfortable, spacious
244
244
 
245
- Document these decisions in the Visual Identity section.
245
+ Capture these in the Design Direction section and populate the Design Tokens table.
246
246
 
247
- ## Step 5: Design Screens/Layouts
247
+ ## Step 5: Design Screens
248
248
 
249
249
  For each screen in the phase:
250
- 1. Create ASCII wireframe with component placement
251
- 2. Specify spacing (edge padding, component gaps) with exact values
252
- 3. List components used (reference existing or define new)
253
- 4. Note responsive behavior (breakpoints, layout changes)
250
+ 1. Create ASCII wireframe with inline annotations (token refs, spacing values, dimensions, component names)
251
+ 2. Create States table (element, state, change, trigger)
252
+ 3. Write Behavior notes (non-obvious interactions only skip obvious actions)
253
+ 4. Write Hints (framework-specific reuse, gotchas, responsive behavior)
254
254
 
255
255
  Apply quality-forcing patterns — check for generic output after each screen.
256
256
 
257
- ## Step 6: Specify Components
258
-
259
- For each new or modified component:
260
- 1. Visual description (colors, borders, shadows with exact values)
261
- 2. States (default, hover, active, disabled, loading)
262
- 3. Size constraints (min/max dimensions)
263
- 4. Platform-specific notes (if cross-platform)
264
-
265
- ## Step 7: Document UX Flows
266
-
267
- For each user journey in this phase:
268
- 1. Entry point (what triggers the flow)
269
- 2. Steps (numbered sequence of user actions and system responses)
270
- 3. Decision points (branches in the flow)
271
- 4. Success state (what user sees on completion)
272
- 5. Error handling (what happens when things go wrong)
273
-
274
- ## Step 8: Capture Design Decisions
275
-
276
- Create decision table with rationale:
277
-
278
- | Category | Decision | Values | Rationale |
279
- |----------|----------|--------|-----------|
280
- | Colors | Primary | `#[hex]` | [why this specific color] |
281
- | Typography | Headings | [font] | [why chosen] |
282
- | Spacing | Base unit | [value]px | [why this scale] |
283
-
284
- ## Step 9: Write Verification Criteria
285
-
286
- Observable behaviors that prove correct implementation:
287
- - Visual verification (colors, typography, spacing match spec)
288
- - Functional verification (interactions work as designed)
289
- - Platform verification (responsive, touch targets, safe areas)
290
- - Accessibility verification (contrast, screen reader, focus states)
291
-
292
- ## Step 10: Self-Review and Refine
257
+ ## Step 6: Self-Review and Refine
293
258
 
294
259
  Run through the quality-forcing checklist:
295
260
  - [ ] Does the color palette have character or is it generic?
@@ -299,7 +264,7 @@ Run through the quality-forcing checklist:
299
264
 
300
265
  If any answer is "generic/arbitrary/default/no" → refine before returning.
301
266
 
302
- ## Step 11: Mathematical Validation (BLOCKING)
267
+ ## Step 7: Mathematical Validation (BLOCKING)
303
268
 
304
269
  Run through validation rules from `<validation_rules>` section:
305
270
 
@@ -313,10 +278,7 @@ Run through validation rules from `<validation_rules>` section:
313
278
  - Re-run validation
314
279
  - Do NOT proceed until all checks pass
315
280
 
316
- **Document in Verification Criteria:**
317
- - "Validation passed: bounds, touch targets, spacing, contrast"
318
-
319
- ## Step 12: Write DESIGN.md
281
+ ## Step 8: Write DESIGN.md
320
282
 
321
283
  Write to: `.planning/phases/{phase}-{slug}/{phase}-DESIGN.md`
322
284
 
@@ -328,20 +290,22 @@ Return brief confirmation to orchestrator.
328
290
  <output_format>
329
291
  ## DESIGN.md Structure
330
292
 
331
- Write the design specification following the 7-section template:
293
+ Write the design specification following the 3-section template:
332
294
 
333
- 1. **Visual Identity** — Philosophy, direction, inspiration (2-3 sentences)
334
- 2. **Screen Layouts** — ASCII wireframes with dimensions, spacing, components
335
- 3. **Component Specifications** — Visual, states, content, platform notes
336
- 4. **UX Flows** Entry, steps, decisions, success, error handling
337
- 5. **Design System Decisions** — Colors, typography, spacing with rationale table
338
- 6. **Platform-Specific Notes** Responsive, touch targets, accessibility
339
- 7. **Verification Criteria** Observable behaviors proving correct implementation
295
+ 1. **Design Direction** — 1-2 sentences: feel, inspiration, what sets this apart
296
+ 2. **Design Tokens** — Compact table: token, value, note. Every value appears once.
297
+ 3. **Screens** — Each screen is self-contained:
298
+ - ASCII wireframe with inline annotations (token refs, spacing, dimensions)
299
+ - States table (element, state, change, trigger)
300
+ - Behavior notes (non-obvious interactions only)
301
+ - Hints (framework-specific reuse, gotchas, responsive)
340
302
 
341
303
  All values must be specific:
342
304
  - Colors: `#hex` values, not "blue" or "primary"
343
305
  - Spacing: `16px`, not "some padding"
344
306
  - Typography: `14px/500`, not "medium text"
307
+
308
+ End with `Validation: passed` after mathematical validation completes.
345
309
  </output_format>
346
310
 
347
311
  <structured_returns>
@@ -362,9 +326,9 @@ When design finishes successfully:
362
326
 
363
327
  ### Screens Designed
364
328
 
365
- | Screen | Components | Notes |
366
- |--------|------------|-------|
367
- | [name] | [count] | [key feature] |
329
+ | Screen | States | Hints | Notes |
330
+ |--------|--------|-------|-------|
331
+ | [name] | [count] | [count] | [key feature] |
368
332
 
369
333
  ### Files Created
370
334
 
@@ -408,20 +372,19 @@ User decision to continue design.
408
372
  <success_criteria>
409
373
  Design is complete when:
410
374
 
411
- - [ ] All screens have ASCII layouts with spacing specified
412
- - [ ] All new components have state definitions
375
+ - [ ] All screens have ASCII wireframes with inline annotations (token refs, spacing, dimensions)
376
+ - [ ] All component states defined in per-screen States tables
413
377
  - [ ] Color palette has character (not generic dark gray + blue)
414
378
  - [ ] Spacing values follow consistent scale (4/8/12/16/24/32)
415
379
  - [ ] Typography hierarchy is explicit (sizes, weights, colors)
416
- - [ ] UX flows document all user journeys
417
- - [ ] Verification criteria are observable and testable
380
+ - [ ] Non-obvious behaviors documented in Behavior notes
381
+ - [ ] Implementation hints provided per screen (reuse, gotchas, responsive)
418
382
  - [ ] Self-review checklist passed (no generic/arbitrary answers)
419
- - [ ] **Mathematical validation passed (bounds, touch targets, spacing, contrast)**
420
- - [ ] DESIGN.md written to phase directory
383
+ - [ ] **Mathematical validation passed (bounds, touch targets, spacing, contrast) and DESIGN.md written to phase directory**
421
384
 
422
385
  Quality indicators:
423
386
  - **Specific:** Hex codes, pixel values, font weights — not vague descriptions
424
387
  - **Intentional:** Every decision has rationale — not arbitrary choices
425
388
  - **Professional:** Passes accountability check — would show to a designer
426
- - **Verifiable:** Criteria are observablecan prove implementation matches
389
+ - **Compact:** Values appear exactly once in tokens table or inline annotation
427
390
  </success_criteria>
@@ -17,12 +17,13 @@ Follow the workflow exactly:
17
17
  </role>
18
18
 
19
19
  <design_context>
20
- **If plan references DESIGN.md:** The DESIGN.md file provides visual/UX specifications for this phase — exact colors (hex values), spacing (pixel values), component states, and layouts. When implementing UI:
21
- - Use exact color values from the design spec, not approximations
22
- - Follow the specified spacing scale (e.g., 4/8/12/16/24/32)
23
- - Implement all component states (default, hover, active, disabled, loading)
24
- - Match ASCII wireframe layouts for component placement
25
- - Include verification criteria from DESIGN.md in your task verification
20
+ **If plan references DESIGN.md:** The DESIGN.md file provides visual/UX specifications for this phase. When implementing UI:
21
+ - Use exact values from the Design Tokens table (hex colors, px spacing, font weights)
22
+ - Follow inline wireframe annotations for layout, spacing, and component placement
23
+ - Implement all states from per-screen States tables (default, hover, active, disabled, loading)
24
+ - Follow Behavior notes for non-obvious interactions
25
+ - Apply Hints for framework-specific reuse and gotchas
26
+ - Derive verification criteria from token values, states, and behavior specs
26
27
  </design_context>
27
28
 
28
29
  <completion_format>
@@ -151,24 +151,43 @@ Wave assignments are written to EXECUTION-ORDER.md, not to individual plans.
151
151
  </step>
152
152
 
153
153
  <step name="group_into_plans">
154
- **Group tasks into plans based on wave and feature affinity.**
154
+ **Group tasks into plans using budget-based packing per wave.**
155
155
 
156
- Rules:
157
- 1. **Same-wave tasks with no file conflicts → parallel plans**
158
- 2. **Tasks with shared files → same plan**
159
- 3. **TDD candidates → dedicated plans (one feature per TDD plan)**
160
- 4. **2-3 tasks per plan, ~50% context target**
161
- 5. **Default to 3 tasks for simple-medium work, 2 for complex**
156
+ **1. Classify task weight** (L/M/H) from action description, file count, domain complexity using the weight table in scope-estimation.md.
162
157
 
163
- Grouping algorithm:
158
+ **2. Greedy budget packing per wave:**
164
159
  ```
165
- 1. Start with Wave 1 tasks (no dependencies)
166
- 2. Group by feature affinity (vertical slice)
167
- 3. Check file ownership (no conflicts)
168
- 4. Move to Wave 2, repeat
169
- 5. Continue until all tasks assigned
160
+ For each wave:
161
+ Sort tasks by feature affinity (vertical slice)
162
+ current_plan = new plan
163
+ current_budget = 0
164
+
165
+ For each task:
166
+ If task.tdd_candidate:
167
+ Create dedicated plan for this task (TDD plans always standalone)
168
+ Continue
169
+
170
+ task_cost = marginal_cost(task.weight)
171
+ If current_budget + task_cost > 45% AND current_plan not empty:
172
+ Finalize current_plan
173
+ current_plan = new plan
174
+ current_budget = 0
175
+
176
+ If no file conflicts with current_plan:
177
+ Add task to current_plan
178
+ current_budget += task_cost
179
+ Else:
180
+ Finalize current_plan
181
+ current_plan = new plan with this task
182
+ current_budget = task_cost
170
183
  ```
171
184
 
185
+ **3. Minimum threshold check:** Plans under ~10% → merge with adjacent same-wave plan if no file conflicts and combined budget <= 45%.
186
+
187
+ **4. File ownership constraint:** Tasks sharing files must be in the same plan.
188
+
189
+ **5. Record grouping rationale** for each plan (weight classification, budget total, merge decisions).
190
+
172
191
  **Plan assignment:**
173
192
  - Each plan gets a sequential number (01, 02, 03...)
174
193
  </step>
@@ -197,16 +216,14 @@ The verifier derives artifacts and key_links from the plan's ## Changes section.
197
216
  **Verify each plan fits context budget.**
198
217
 
199
218
  Per plan:
200
- - Count tasks (target: 2-3, max: 3)
201
- - Count files modified (target: 5-8, max: 10)
202
- - Estimate context usage (target: ~50%)
219
+ - Sum weights (target: 25-45%)
220
+ - Check minimum threshold (plans under ~10% → consolidate)
221
+ - Count files modified (max: 10)
203
222
 
204
223
  If any plan exceeds:
205
- - 4+ tasks: Split by feature
224
+ - Budget > 45%: Split by feature affinity
206
225
  - 10+ files: Split by subsystem
207
- - Complex domain (auth, payments): Consider extra split
208
-
209
- Default to 3 tasks for simple-medium work, 2 for complex. Executor overhead reduction creates headroom for the third task.
226
+ - Under 10%: Merge with related same-wave plan
210
227
  </step>
211
228
 
212
229
  <step name="write_plan_files">
@@ -334,11 +351,11 @@ Capture commit hash for return.
334
351
  score = 0
335
352
  factors = []
336
353
 
337
- # Task count (4+ tasks in any plan)
338
- max_tasks = max(task_count for each plan)
339
- if max_tasks >= 4:
354
+ # Budget per plan (>45%)
355
+ max_budget = max(budget_sum for each plan)
356
+ if max_budget > 45:
340
357
  score += 15
341
- factors.append(f"Plan has {max_tasks} tasks")
358
+ factors.append(f"Plan exceeds 45% budget ({max_budget}%)")
342
359
 
343
360
  # Plan count (5+ plans in phase)
344
361
  if plan_count >= 5:
@@ -400,6 +417,13 @@ Return structured markdown to orchestrator:
400
417
  | 1 | 01, 02 | None (parallel) |
401
418
  | 2 | 03 | Waits for 01, 02 |
402
419
 
420
+ ### Grouping Rationale
421
+
422
+ | Plan | Tasks | Est. Marginal | Notes |
423
+ |------|-------|---------------|-------|
424
+ | 01 | 4 (L+L+L+M) | ~25% | Merged light fixes with medium refactor |
425
+ | 02 | 3 (M+M+M) | ~30% | Vertical slice: model + API + tests |
426
+
403
427
  ### Risk Assessment
404
428
 
405
429
  **Score:** {score}/100 ({tier})
@@ -416,6 +440,8 @@ Return structured markdown to orchestrator:
416
440
  - ...
417
441
  ```
418
442
 
443
+ **Include Grouping Rationale** only when consolidation occurred or grouping is non-obvious. Omit for straightforward groupings.
444
+
419
445
  The orchestrator parses this to present risk via AskUserQuestion and offer next steps.
420
446
  </output_format>
421
447
 
@@ -433,7 +459,7 @@ Bad: Plan 01 = all models, Plan 02 = all APIs
433
459
  Good: Plan 01 = User (model + API), Plan 02 = Product (model + API)
434
460
 
435
461
  **DO NOT exceed scope limits.**
436
- 4+ tasks per plan → split. Complex domainssplit. Files > 10 → split.
462
+ Budget > 45% → split. Single light task alone consolidate. Files > 10 → split.
437
463
 
438
464
  **DO NOT write implementation-focused truths.**
439
465
  Bad: "bcrypt library installed"
@@ -451,7 +477,7 @@ Plan writing complete when:
451
477
  - [ ] References loaded (phase-prompt, plan-format, scope-estimation, + tdd if needed)
452
478
  - [ ] Dependency graph built from needs/creates
453
479
  - [ ] Waves assigned (all roots wave 1, dependents correct)
454
- - [ ] Tasks grouped into plans (2-3 tasks, ~50% context)
480
+ - [ ] Tasks grouped into plans (budget-based, target 25-45%, consolidate under 10%)
455
481
  - [ ] Must-haves derived as markdown checklists
456
482
  - [ ] PLAN.md files written with pure markdown format
457
483
  - [ ] EXECUTION-ORDER.md generated with wave groups
@@ -59,9 +59,9 @@ Claude's training data is 6-18 months stale. Treat pre-existing knowledge as hyp
59
59
  - Wrong (Claude misremembered or hallucinated)
60
60
 
61
61
  **The discipline:**
62
- 1. **Verify before asserting** - Don't state library capabilities without checking Context7 or official docs
62
+ 1. **Verify before asserting** - Don't state library capabilities without checking `ms-lookup docs` or official docs
63
63
  2. **Date your knowledge** - "As of my training" is a warning flag, not a confidence marker
64
- 3. **Prefer current sources** - Context7 and official docs trump training data
64
+ 3. **Prefer current sources** - `ms-lookup docs` and official docs trump training data
65
65
  4. **Flag uncertainty** - LOW confidence when only training data supports a claim
66
66
 
67
67
  ## Honest Reporting
@@ -197,7 +197,7 @@ When researching "best library for X":
197
197
 
198
198
  The CLI is at `~/.claude/mindsystem/scripts/ms-lookup-wrapper.sh`.
199
199
 
200
- ### Library Documentation (Context7)
200
+ ### Library Documentation
201
201
 
202
202
  ```bash
203
203
  ~/.claude/mindsystem/scripts/ms-lookup-wrapper.sh docs <library> "<query>"
@@ -213,7 +213,7 @@ Example:
213
213
 
214
214
  **Response format:** JSON with results array containing title, content, source_url, tokens.
215
215
 
216
- ### Deep Research (Perplexity)
216
+ ### Deep Research
217
217
 
218
218
  ```bash
219
219
  ~/.claude/mindsystem/scripts/ms-lookup-wrapper.sh deep "<query>"
@@ -255,7 +255,7 @@ WebSearch("[technology] vs [alternative] {current_year}")
255
255
 
256
256
  **Always include current year** in queries for freshness.
257
257
 
258
- **Why WebSearch over Perplexity search:** Free with Max subscription. Perplexity search costs $5/1k queries with marginal quality improvement for discovery tasks.
258
+ **Why WebSearch over `ms-lookup deep`:** WebSearch is free. `ms-lookup deep` costs money per query reserve it for high-value questions, not discovery.
259
259
 
260
260
  ## Token Limit Strategy (for ms-lookup)
261
261
 
@@ -264,7 +264,7 @@ WebSearch("[technology] vs [alternative] {current_year}")
264
264
  **Rationale:**
265
265
  - The 50% rule: Research must complete before hitting 100k tokens
266
266
  - At 2000 tokens/query, you can make ~50 queries
267
- - Context7 returns results ranked by relevance — first 3-4 snippets are most important
267
+ - `ms-lookup docs` returns results ranked by relevance — first 3-4 snippets are most important
268
268
  - Query flexibility > per-query comprehensiveness
269
269
 
270
270
  **When to increase (`--max-tokens 4000-6000`):**
@@ -296,15 +296,15 @@ WebSearch("[technology] vs [alternative] {current_year}")
296
296
 
297
297
  | Level | Sources | Use |
298
298
  |-------|---------|-----|
299
- | HIGH | Context7, official documentation, official releases | State as fact |
299
+ | HIGH | `ms-lookup docs`, official documentation, official releases | State as fact |
300
300
  | MEDIUM | WebSearch verified with official source, multiple credible sources agree | State with attribution |
301
301
  | LOW | WebSearch only, single source, unverified | Flag as needing validation |
302
302
 
303
303
  ## Source Prioritization
304
304
 
305
- **1. Context7 (highest priority)**
306
- - Current, authoritative documentation
307
- - Library-specific, version-aware
305
+ **1. `ms-lookup docs` (highest priority)**
306
+ - Current, authoritative library documentation
307
+ - Version-aware, sourced from official docs
308
308
  - Trust completely for API/feature questions
309
309
 
310
310
  **2. Official Documentation**
@@ -526,7 +526,7 @@ Based on research question, identify what needs investigating:
526
526
 
527
527
  For each domain, follow tool strategy in order:
528
528
 
529
- 1. **Context7 First** - Resolve library, query topics
529
+ 1. **`ms-lookup docs` First** - Query library documentation
530
530
  2. **Official Docs** - WebFetch for gaps
531
531
  3. **WebSearch** - Ecosystem discovery with year
532
532
  4. **Verification** - Cross-reference all findings
@@ -626,7 +626,7 @@ When research cannot proceed:
626
626
  Research is complete when:
627
627
 
628
628
  - [ ] Research question answered with actionable findings
629
- - [ ] Source hierarchy followed (Context7 → Official → WebSearch)
629
+ - [ ] Source hierarchy followed (`ms-lookup docs` → Official → WebSearch)
630
630
  - [ ] All findings have confidence levels
631
631
  - [ ] Verification protocol checklist passed
632
632
  - [ ] Output file(s) created in correct format
@@ -636,7 +636,7 @@ Research is complete when:
636
636
  Research quality indicators:
637
637
 
638
638
  - **Specific, not vague:** "Three.js r160 with @react-three/fiber 8.15" not "use Three.js"
639
- - **Verified, not assumed:** Findings cite Context7 or official docs
639
+ - **Verified, not assumed:** Findings cite `ms-lookup docs` or official docs
640
640
  - **Honest about gaps:** LOW confidence items flagged, unknowns admitted
641
641
  - **Actionable:** Developer could start work based on this research
642
642
  - **Current:** Year included in searches, publication dates checked
@@ -21,7 +21,7 @@ This spawns ms-plan-checker to analyze your PLAN.md files against the phase goal
21
21
  2. **Task Completeness** — Does every change have Files, implementation details, and verification?
22
22
  3. **Dependency Correctness** — Are plan dependencies valid and acyclic?
23
23
  4. **Key Links Planned** — Are artifacts wired together, not just created in isolation?
24
- 5. **Scope Sanity** — Will plans complete within context budget (2-3 tasks per plan)?
24
+ 5. **Scope Sanity** — Will plans complete within context budget (target 25-45%)?
25
25
  6. **Verification Derivation** — Are Must-Haves user-observable, not implementation-focused?
26
26
  7. **Context Compliance** — Do plans honor decisions from CONTEXT.md?
27
27
  </what_it_checks>
@@ -62,96 +62,89 @@ Output: Milestone archived (roadmap + requirements), PROJECT.md evolved, git tag
62
62
  ✓ Milestone audit passed. Proceeding with completion.
63
63
  ```
64
64
 
65
- 1. **Verify readiness:**
66
-
67
- - Check all phases in milestone have completed plans (SUMMARY.md exists)
68
- - Present milestone scope and stats
69
- - Wait for confirmation
70
-
71
- 1.5. **Clean up raw artifacts:**
72
-
73
- Delete remaining raw artifacts from phase directories. Knowledge files are already current from phase-level consolidation in execute-phase.
65
+ 1. **Verify readiness and gather stats:**
74
66
 
75
67
  ```bash
76
- ~/.claude/mindsystem/scripts/cleanup-phase-artifacts.sh $PHASE_START $PHASE_END
68
+ ~/.claude/mindsystem/scripts/gather-milestone-stats.sh $PHASE_START $PHASE_END
77
69
  ```
78
70
 
79
- 2. **Gather stats:**
80
-
81
- - Count phases, plans, tasks
82
- - Calculate git range, file changes, LOC
83
- - Extract timeline from git log
84
- - Present summary, confirm
71
+ - If NOT READY: stop and report incomplete plans
72
+ - If READY: present readiness + stats summary, proceed
85
73
 
86
- 3. **Extract accomplishments:**
74
+ 2. **Extract accomplishments:**
87
75
 
88
76
  - Read all phase SUMMARY.md files in milestone range
89
77
  - Extract 4-6 key accomplishments
90
- - Present for approval
91
78
 
92
- 4. **Archive milestone:**
79
+ 3. **Create MILESTONES.md entry:**
80
+
81
+ - Create or update `.planning/MILESTONES.md` using `templates/milestone.md`
82
+ - Prepend new entry (reverse chronological order)
83
+
84
+ 4. **Update PROJECT.md:**
85
+
86
+ - Full evolution review (What This Is, Core Value, Requirements audit, Key Decisions, Context)
87
+ - Move all shipped requirements to Validated
88
+ - Update "Last updated" footer
89
+
90
+ 5. **Archive milestone:**
93
91
 
94
92
  - Create `.planning/milestones/v{{version}}/` directory
95
- - Create `.planning/milestones/v{{version}}/ROADMAP.md`
96
- - Extract full phase details from ROADMAP.md
97
- - Fill milestone-archive.md template
98
- - Update ROADMAP.md to one-line summary with link
93
+ - Create `.planning/milestones/v{{version}}/ROADMAP.md` from template
94
+ - Delete ROADMAP.md
99
95
 
100
- 5. **Archive requirements:**
96
+ 6. **Archive requirements:**
101
97
 
102
98
  - Create `.planning/milestones/v{{version}}/REQUIREMENTS.md`
103
- - Mark all v1 requirements as complete (checkboxes checked)
104
- - Note requirement outcomes (validated, adjusted, dropped)
105
- - Delete `.planning/REQUIREMENTS.md` (fresh one created for next milestone)
99
+ - Mark all requirements as complete with outcomes
100
+ - Delete `.planning/REQUIREMENTS.md`
101
+
102
+ 7. **Archive milestone files:**
106
103
 
107
- 5.5. **Archive research:**
104
+ ```bash
105
+ ~/.claude/mindsystem/scripts/archive-milestone-files.sh v{{version}}
106
+ ```
108
107
 
109
- - If `.planning/research/` exists, move to `.planning/milestones/v{{version}}/research/`
110
- - Skip silently if no research directory exists
108
+ 8. **Archive and cleanup phases:**
109
+
110
+ ```bash
111
+ ~/.claude/mindsystem/scripts/archive-milestone-phases.sh $PHASE_START $PHASE_END v{{version}}
112
+ ```
111
113
 
112
- 6. **Update PROJECT.md:**
114
+ 9. **Update STATE.md:**
113
115
 
114
- - Add "Current State" section with shipped version
115
- - Add "Next Milestone Goals" section
116
- - Archive previous content in `<details>` (if v1.1+)
116
+ - Update project reference with current core value and next focus
117
+ - Reset current position for next milestone
117
118
 
118
- 7. **Commit and tag:**
119
+ 10. **Commit and tag:**
119
120
 
120
- - Stage: MILESTONES.md, PROJECT.md, ROADMAP.md, STATE.md, archive files
121
- - Commit: `chore: archive v{{version}} milestone`
122
- - Tag: `git tag -a v{{version}} -m "[milestone summary]"`
123
- - Ask about pushing tag
121
+ - Stage: MILESTONES.md, PROJECT.md, STATE.md, archive files, deletions
122
+ - Commit: `chore: archive v{{version}} milestone`
123
+ - Tag: `git tag -a v{{version}} -m "[milestone summary]"`
124
+ - Ask about pushing tag
124
125
 
125
- 8. **Offer next steps:**
126
- - `/ms:new-milestone` — discover goals and update PROJECT.md (includes optional discovery mode)
126
+ 11. **Offer next steps:**
127
+ - `/ms:new-milestone` — discover goals and update PROJECT.md
127
128
 
128
- 9. **Update last command**
129
- - Update `.planning/STATE.md` Last Command field
130
- - Format: `Last Command: ms:complete-milestone $ARGUMENTS | YYYY-MM-DD HH:MM`
129
+ 12. **Update last command:**
130
+ - Format: `Last Command: ms:complete-milestone $ARGUMENTS | YYYY-MM-DD HH:MM`
131
131
 
132
132
  </process>
133
133
 
134
134
  <success_criteria>
135
135
 
136
- - Raw artifacts cleaned from phase directories (CONTEXT, DESIGN, RESEARCH, SUMMARY, UAT, VERIFICATION, EXECUTION-ORDER)
136
+ - PROJECT.md full evolution review completed (What This Is, Core Value, Requirements, Key Decisions, Context)
137
+ - All shipped requirements moved to Validated in PROJECT.md
138
+ - Key Decisions updated with outcomes
137
139
  - Milestone archived to `.planning/milestones/v{{version}}/ROADMAP.md`
138
140
  - Requirements archived to `.planning/milestones/v{{version}}/REQUIREMENTS.md`
139
- - Research archived to `.planning/milestones/v{{version}}/research/` (if existed)
140
141
  - `.planning/REQUIREMENTS.md` deleted (fresh for next milestone)
141
- - ROADMAP.md collapsed to one-line entry
142
- - PROJECT.md updated with current state
143
142
  - Git tag v{{version}} created
144
- - Commit successful
145
- - User knows next steps (/ms:new-milestone)
146
143
  </success_criteria>
147
144
 
148
145
  <critical_rules>
149
146
 
150
- - **Load workflow first:** Read complete-milestone.md before executing
151
147
  - **Verify completion:** All phases must have SUMMARY.md files
152
- - **User confirmation:** Wait for approval at verification gates
153
148
  - **Archive before deleting:** Always create archive files (ROADMAP, REQUIREMENTS) before updating/deleting originals
154
149
  - **One-line summary:** Collapsed milestone in ROADMAP.md should be single line with link
155
- - **Context efficiency:** Archive keeps ROADMAP.md and REQUIREMENTS.md constant size per milestone
156
- - **Fresh requirements:** Next milestone starts with `/ms:create-roadmap`, not reusing old file
157
150
  </critical_rules>