mindsystem-cc 3.2.2 → 3.3.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 (56) hide show
  1. package/README.md +2 -2
  2. package/agents/ms-code-simplifier.md +215 -0
  3. package/agents/ms-consolidator.md +377 -0
  4. package/agents/ms-executor.md +32 -261
  5. package/{commands/ms/simplify-flutter.md → agents/ms-flutter-simplifier.md} +41 -49
  6. package/agents/ms-researcher.md +2 -2
  7. package/commands/ms/complete-milestone.md +24 -3
  8. package/commands/ms/do-work.md +17 -3
  9. package/commands/ms/execute-phase.md +29 -14
  10. package/commands/ms/help.md +4 -23
  11. package/commands/ms/new-milestone.md +42 -30
  12. package/commands/ms/new-project.md +5 -14
  13. package/commands/ms/progress.md +1 -1
  14. package/commands/ms/research-project.md +8 -0
  15. package/commands/ms/review-design.md +1 -1
  16. package/commands/ms/whats-new.md +3 -3
  17. package/mindsystem/references/git-integration.md +2 -2
  18. package/mindsystem/references/goal-backward.md +2 -2
  19. package/mindsystem/references/principles.md +1 -1
  20. package/mindsystem/templates/adhoc-summary.md +3 -0
  21. package/mindsystem/templates/codebase/architecture.md +2 -2
  22. package/mindsystem/templates/codebase/structure.md +1 -1
  23. package/mindsystem/templates/config.json +2 -12
  24. package/mindsystem/templates/decisions.md +145 -0
  25. package/mindsystem/workflows/complete-milestone.md +58 -25
  26. package/mindsystem/workflows/create-milestone.md +60 -20
  27. package/mindsystem/workflows/do-work.md +81 -4
  28. package/mindsystem/workflows/execute-phase.md +66 -0
  29. package/mindsystem/workflows/execute-plan.md +1 -53
  30. package/mindsystem/workflows/map-codebase.md +9 -1
  31. package/mindsystem/workflows/plan-phase.md +0 -39
  32. package/mindsystem/workflows/transition.md +0 -74
  33. package/mindsystem/workflows/verify-work.md +1 -1
  34. package/package.json +1 -1
  35. package/scripts/generate-adhoc-patch.sh +79 -0
  36. package/scripts/ms-lookup/uv.lock +17 -17
  37. package/commands/ms/discuss-milestone.md +0 -48
  38. package/commands/ms/linear.md +0 -195
  39. package/mindsystem/templates/milestone-context.md +0 -93
  40. package/scripts/ms-linear/ms_linear/__init__.py +0 -3
  41. package/scripts/ms-linear/ms_linear/__main__.py +0 -6
  42. package/scripts/ms-linear/ms_linear/__pycache__/__init__.cpython-314.pyc +0 -0
  43. package/scripts/ms-linear/ms_linear/__pycache__/__main__.cpython-314.pyc +0 -0
  44. package/scripts/ms-linear/ms_linear/__pycache__/cli.cpython-314.pyc +0 -0
  45. package/scripts/ms-linear/ms_linear/__pycache__/client.cpython-314.pyc +0 -0
  46. package/scripts/ms-linear/ms_linear/__pycache__/config.cpython-314.pyc +0 -0
  47. package/scripts/ms-linear/ms_linear/__pycache__/errors.cpython-314.pyc +0 -0
  48. package/scripts/ms-linear/ms_linear/__pycache__/output.cpython-314.pyc +0 -0
  49. package/scripts/ms-linear/ms_linear/cli.py +0 -604
  50. package/scripts/ms-linear/ms_linear/client.py +0 -503
  51. package/scripts/ms-linear/ms_linear/config.py +0 -104
  52. package/scripts/ms-linear/ms_linear/errors.py +0 -29
  53. package/scripts/ms-linear/ms_linear/output.py +0 -45
  54. package/scripts/ms-linear/pyproject.toml +0 -16
  55. package/scripts/ms-linear/uv.lock +0 -196
  56. package/scripts/ms-linear-wrapper.sh +0 -22
@@ -64,17 +64,6 @@ Parse:
64
64
  - Include verification criteria from DESIGN.md in your task verification
65
65
  </step>
66
66
 
67
- <step name="record_start_time">
68
- Record execution start time for performance tracking:
69
-
70
- ```bash
71
- PLAN_START_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
72
- PLAN_START_EPOCH=$(date +%s)
73
- ```
74
-
75
- Store in shell variables for duration calculation at completion.
76
- </step>
77
-
78
67
  <step name="determine_execution_pattern">
79
68
  Check for checkpoints in the plan:
80
69
 
@@ -144,88 +133,45 @@ Apply these rules automatically. Track all deviations for Summary documentation.
144
133
 
145
134
  **RULE 1: Auto-fix bugs**
146
135
 
147
- **Trigger:** Code doesn't work as intended (broken behavior, incorrect output, errors)
136
+ **Trigger:** Code doesn't work as intended (broken behavior, errors)
148
137
 
149
138
  **Action:** Fix immediately, track for Summary
150
139
 
151
- **Examples:**
152
-
153
- - Wrong SQL query returning incorrect data
154
- - Logic errors (inverted condition, off-by-one, infinite loop)
155
- - Type errors, null pointer exceptions, undefined references
156
- - Broken validation (accepts invalid input, rejects valid input)
157
- - Security vulnerabilities (SQL injection, XSS, CSRF, insecure auth)
158
- - Race conditions, deadlocks
159
- - Memory leaks, resource leaks
160
-
161
- **Process:**
140
+ **Examples:** Logic errors, null crashes, type errors, broken validation
162
141
 
163
- 1. Fix the bug inline
164
- 2. Add/update tests to prevent regression
165
- 3. Verify fix works
166
- 4. Continue task
167
- 5. Track in deviations list: `[Rule 1 - Bug] [description]`
142
+ **Process:** Fix inline add test → verify → continue → track as `[Rule 1 - Bug]`
168
143
 
169
- **No user permission needed.** Bugs must be fixed for correct operation.
144
+ **No user permission needed.**
170
145
 
171
146
  ---
172
147
 
173
148
  **RULE 2: Auto-add missing critical functionality**
174
149
 
175
- **Trigger:** Code is missing essential features for correctness, security, or basic operation
150
+ **Trigger:** Code is missing essential features for correctness, security, or operation
176
151
 
177
152
  **Action:** Add immediately, track for Summary
178
153
 
179
- **Examples:**
154
+ **Examples:** Missing input validation, missing auth on protected routes, missing error handling
180
155
 
181
- - Missing error handling (no try/catch, unhandled promise rejections)
182
- - No input validation (accepts malicious data, type coercion issues)
183
- - Missing null/undefined checks (crashes on edge cases)
184
- - No authentication on protected routes
185
- - Missing authorization checks (users can access others' data)
186
- - No CSRF protection, missing CORS configuration
187
- - No rate limiting on public APIs
188
- - Missing required database indexes (causes timeouts)
189
- - No logging for errors (can't debug production)
156
+ **Boundary:** "Add missing validation" = Rule 2. "Add new column for validation" = Rule 1/2. "Add new table" = Rule 4.
190
157
 
191
- **Process:**
158
+ **Process:** Add inline → test → verify → continue → track as `[Rule 2 - Missing Critical]`
192
159
 
193
- 1. Add the missing functionality inline
194
- 2. Add tests for the new functionality
195
- 3. Verify it works
196
- 4. Continue task
197
- 5. Track in deviations list: `[Rule 2 - Missing Critical] [description]`
198
-
199
- **Critical = required for correct/secure/performant operation**
200
- **No user permission needed.** These are not "features" - they're requirements for basic correctness.
160
+ **No user permission needed.** Critical = required for correct/secure operation.
201
161
 
202
162
  ---
203
163
 
204
164
  **RULE 3: Auto-fix blocking issues**
205
165
 
206
- **Trigger:** Something prevents you from completing current task
166
+ **Trigger:** Something prevents completing current task
207
167
 
208
168
  **Action:** Fix immediately to unblock, track for Summary
209
169
 
210
- **Examples:**
211
-
212
- - Missing dependency (package not installed, import fails)
213
- - Wrong types blocking compilation
214
- - Broken import paths (file moved, wrong relative path)
215
- - Missing environment variable (app won't start)
216
- - Database connection config error
217
- - Build configuration error (webpack, tsconfig, etc.)
218
- - Missing file referenced in code
219
- - Circular dependency blocking module resolution
170
+ **Examples:** Missing dependency, broken imports, wrong types blocking compilation, missing env var
220
171
 
221
- **Process:**
172
+ **Process:** Fix blocker → verify task proceeds → continue → track as `[Rule 3 - Blocking]`
222
173
 
223
- 1. Fix the blocking issue
224
- 2. Verify task can now proceed
225
- 3. Continue task
226
- 4. Track in deviations list: `[Rule 3 - Blocking] [description]`
227
-
228
- **No user permission needed.** Can't complete task without fixing blocker.
174
+ **No user permission needed.**
229
175
 
230
176
  ---
231
177
 
@@ -233,26 +179,11 @@ Apply these rules automatically. Track all deviations for Summary documentation.
233
179
 
234
180
  **Trigger:** Fix/addition requires significant structural modification
235
181
 
236
- **Action:** STOP, present to user, wait for decision
237
-
238
- **Examples:**
239
-
240
- - Adding new database table (not just column)
241
- - Major schema changes (changing primary key, splitting tables)
242
- - Introducing new service layer or architectural pattern
243
- - Switching libraries/frameworks (React → Vue, REST → GraphQL)
244
- - Changing authentication approach (sessions → JWT)
245
- - Adding new infrastructure (message queue, cache layer, CDN)
246
- - Changing API contracts (breaking changes to endpoints)
247
- - Adding new deployment environment
182
+ **Action:** STOP, return checkpoint, wait for decision
248
183
 
249
- **Process:**
184
+ **Examples:** Adding new table (not column), new service layer, switching frameworks, changing auth approach, breaking API changes
250
185
 
251
- 1. STOP current task
252
- 2. Return checkpoint with architectural decision needed
253
- 3. Include: what you found, proposed change, why needed, impact, alternatives
254
- 4. WAIT for orchestrator to get user decision
255
- 5. Fresh agent continues with decision
186
+ **Process:** STOP return checkpoint with: what found, proposed change, why, impact, alternatives → WAIT
256
187
 
257
188
  **User decision required.** These changes affect system design.
258
189
 
@@ -278,67 +209,13 @@ Apply these rules automatically. Track all deviations for Summary documentation.
278
209
  </deviation_rules>
279
210
 
280
211
  <authentication_gates>
281
- **When you encounter authentication errors during `type="auto"` task execution:**
282
-
283
- This is NOT a failure. Authentication gates are expected and normal. Handle them by returning a checkpoint.
284
-
285
- **Authentication error indicators:**
286
-
287
- - CLI returns: "Error: Not authenticated", "Not logged in", "Unauthorized", "401", "403"
288
- - API returns: "Authentication required", "Invalid API key", "Missing credentials"
289
- - Command fails with: "Please run {tool} login" or "Set {ENV_VAR} environment variable"
290
-
291
- **Authentication gate protocol:**
292
-
293
- 1. **Recognize it's an auth gate** - Not a bug, just needs credentials
294
- 2. **STOP current task execution** - Don't retry repeatedly
295
- 3. **Return checkpoint with type `human-action`**
296
- 4. **Provide exact authentication steps** - CLI commands, where to get keys
297
- 5. **Specify verification** - How you'll confirm auth worked
298
-
299
- **Example return for auth gate:**
300
-
301
- ```markdown
302
- ## CHECKPOINT REACHED
303
-
304
- **Type:** human-action
305
- **Plan:** 01-01
306
- **Progress:** 1/3 tasks complete
307
-
308
- ### Completed Tasks
309
-
310
- | Task | Name | Commit | Files |
311
- | ---- | -------------------------- | ------- | ------------------ |
312
- | 1 | Initialize Next.js project | d6fe73f | package.json, app/ |
313
-
314
- ### Current Task
315
-
316
- **Task 2:** Deploy to Vercel
317
- **Status:** blocked
318
- **Blocked by:** Vercel CLI authentication required
319
-
320
- ### Checkpoint Details
321
-
322
- **Automation attempted:**
323
- Ran `vercel --yes` to deploy
324
-
325
- **Error encountered:**
326
- "Error: Not authenticated. Please run 'vercel login'"
327
-
328
- **What you need to do:**
329
-
330
- 1. Run: `vercel login`
331
- 2. Complete browser authentication
212
+ Authentication errors during `type="auto"` tasks are NOT failures — they're expected gates.
332
213
 
333
- **I'll verify after:**
334
- `vercel whoami` returns your account
335
-
336
- ### Awaiting
214
+ **Recognize auth errors:** "Not authenticated", "Unauthorized", "401/403", "Please run X login", "Set ENV_VAR"
337
215
 
338
- Type "done" when authenticated.
339
- ```
216
+ **Response:** Return `checkpoint:human-action` with exact auth steps and verification command. Don't retry repeatedly.
340
217
 
341
- **In Summary documentation:** Document authentication gates as normal flow, not deviations.
218
+ Document in Summary as normal flow, not deviations.
342
219
  </authentication_gates>
343
220
 
344
221
  <checkpoint_protocol>
@@ -451,41 +328,11 @@ When you hit a checkpoint or auth gate, return this EXACT structure:
451
328
 
452
329
  [What user needs to do/provide]
453
330
  ```
454
-
455
- **Why this structure:**
456
-
457
- - **Completed Tasks table:** Fresh continuation agent knows what's done
458
- - **Commit hashes:** Verification that work was committed
459
- - **Files column:** Quick reference for what exists
460
- - **Current Task + Blocked by:** Precise continuation point
461
- - **Checkpoint Details:** User-facing content orchestrator presents directly
462
- </checkpoint_return_format>
331
+ </checkpoint_return_format>
463
332
 
464
333
  <continuation_handling>
465
- If you were spawned as a continuation agent (your prompt has `<completed_tasks>` section):
466
-
467
- 1. **Verify previous commits exist:**
468
-
469
- ```bash
470
- git log --oneline -5
471
- ```
472
-
473
- Check that commit hashes from completed_tasks table appear
474
-
475
- 2. **DO NOT redo completed tasks** - They're already committed
476
-
477
- 3. **Start from resume point** specified in your prompt
478
-
479
- 4. **Handle based on checkpoint type:**
480
-
481
- - **After human-action:** Verify the action worked, then continue
482
- - **After human-verify:** User approved, continue to next task
483
- - **After decision:** Implement the selected option
484
-
485
- 5. **If you hit another checkpoint:** Return checkpoint with ALL completed tasks (previous + new)
486
-
487
- 6. **Continue until plan completes or next checkpoint**
488
- </continuation_handling>
334
+ If your prompt has `<completed_tasks>`: verify those commits exist (`git log --oneline -5`), DO NOT redo them, resume from the specified task. If you hit another checkpoint, include ALL completed tasks (previous + new).
335
+ </continuation_handling>
489
336
 
490
337
  <tdd_execution>
491
338
  When executing a task with `tdd="true"` attribute, follow RED-GREEN-REFACTOR cycle.
@@ -543,20 +390,9 @@ git add src/api/auth.ts
543
390
  git add src/types/user.ts
544
391
  ```
545
392
 
546
- **3. Determine commit type:**
547
-
548
- | Type | When to Use |
549
- | ---------- | ----------------------------------------------- |
550
- | `feat` | New feature, endpoint, component, functionality |
551
- | `fix` | Bug fix, error correction |
552
- | `test` | Test-only changes (TDD RED phase) |
553
- | `refactor` | Code cleanup, no behavior change |
554
- | `perf` | Performance improvement |
555
- | `docs` | Documentation changes |
556
- | `style` | Formatting, linting fixes |
557
- | `chore` | Config, tooling, dependencies |
393
+ **3. Craft commit message:**
558
394
 
559
- **4. Craft commit message:**
395
+ Use conventional commit types (feat/fix/test/refactor/chore/docs/perf/style).
560
396
 
561
397
  Format: `{type}({phase}-{plan}): {task-name-or-description}`
562
398
 
@@ -569,21 +405,14 @@ git commit -m "{type}({phase}-{plan}): {concise task description}
569
405
  "
570
406
  ```
571
407
 
572
- **5. Record commit hash:**
408
+ **4. Record commit hash:**
573
409
 
574
410
  ```bash
575
411
  TASK_COMMIT=$(git rev-parse --short HEAD)
576
412
  ```
577
413
 
578
414
  Track for SUMMARY.md generation.
579
-
580
- **Atomic commit benefits:**
581
-
582
- - Each task independently revertable
583
- - Git bisect finds exact failing task
584
- - Git blame traces line to specific task context
585
- - Clear history for Claude in future sessions
586
- </task_commit_protocol>
415
+ </task_commit_protocol>
587
416
 
588
417
  <summary_creation>
589
418
  After all tasks complete, create `{phase}-{plan}-SUMMARY.md`.
@@ -592,33 +421,7 @@ After all tasks complete, create `{phase}-{plan}-SUMMARY.md`.
592
421
 
593
422
  **Use template from:** @~/.claude/mindsystem/templates/summary.md
594
423
 
595
- **Frontmatter population:**
596
-
597
- 1. **Basic identification:** phase, plan, subsystem (categorize based on phase focus), tags (tech keywords)
598
-
599
- 2. **Dependency graph:**
600
-
601
- - requires: Prior phases this built upon
602
- - provides: What was delivered
603
- - affects: Future phases that might need this
604
-
605
- 3. **Tech tracking:**
606
-
607
- - tech-stack.added: New libraries
608
- - tech-stack.patterns: Architectural patterns established
609
-
610
- 4. **File tracking:**
611
-
612
- - key-files.created: Files created
613
- - key-files.modified: Files modified
614
-
615
- 5. **Decisions:** From "Decisions Made" section
616
-
617
- 6. **Metrics:**
618
- - duration: Calculated from start/end time
619
- - completed: End date (YYYY-MM-DD)
620
-
621
- **Title format:** `# Phase [X] Plan [Y]: [Name] Summary`
424
+ Follow the template's frontmatter structure exactly.
622
425
 
623
426
  **One-liner must be SUBSTANTIVE:**
624
427
 
@@ -659,40 +462,10 @@ During execution, these authentication requirements were handled:
659
462
  </summary_creation>
660
463
 
661
464
  <state_updates>
662
- After creating SUMMARY.md, update STATE.md.
663
-
664
- **Update Current Position:**
665
-
666
- ```markdown
667
- Phase: [current] of [total] ([phase name])
668
- Plan: [just completed] of [total in phase]
669
- Status: [In progress / Phase complete]
670
- Last activity: [today] - Completed {phase}-{plan}-PLAN.md
671
-
672
- Progress: [progress bar]
673
- ```
674
-
675
- **Calculate progress bar:**
676
-
677
- - Count total plans across all phases
678
- - Count completed plans (SUMMARY.md files that exist)
679
- - Progress = (completed / total) × 100%
680
- - Render: ░ for incomplete, █ for complete
681
-
682
- **Extract decisions and issues:**
683
-
684
- - Read SUMMARY.md "Decisions Made" section
685
- - Add each decision to STATE.md Decisions table
686
- - Read "Next Phase Readiness" for blockers/concerns
687
- - Add to STATE.md if relevant
688
-
689
- **Update Session Continuity:**
690
-
691
- ```markdown
692
- Last session: [current date and time]
693
- Stopped at: Completed {phase}-{plan}-PLAN.md
694
- ```
695
-
465
+ After creating SUMMARY.md, update STATE.md sections:
466
+ - **Current Position:** phase, plan, status, last activity, progress bar
467
+ - **Decisions:** extract from SUMMARY.md "Decisions Made"
468
+ - **Session Continuity:** last session timestamp and stopped-at point
696
469
  </state_updates>
697
470
 
698
471
  <final_commit>
@@ -736,8 +509,6 @@ When plan completes successfully, return:
736
509
  - {hash}: {message}
737
510
  - {hash}: {message}
738
511
  ...
739
-
740
- **Duration:** {time}
741
512
  ```
742
513
 
743
514
  Include commits from both task execution and metadata commit.
@@ -1,56 +1,42 @@
1
1
  ---
2
- name: ms:simplify-flutter
3
- description: Simplify and refine Flutter/Dart code for clarity, consistency, and maintainability while preserving all functionality
4
- argument-hint: [file path, feature name, or description of what to simplify]
2
+ name: ms-flutter-simplifier
3
+ description: Simplifies Flutter/Dart code for clarity, consistency, and maintainability. Spawned by execute-phase/do-work after code changes.
4
+ tools: Read, Write, Edit, Bash, Grep, Glob
5
+ color: cyan
5
6
  ---
6
7
 
7
- <objective>
8
- Simplify Flutter/Dart code to improve clarity, consistency, and maintainability while preserving exact functionality.
8
+ You are an expert Flutter/Dart code simplification specialist. Your expertise lies in making code easier to read, understand, and maintain without changing what it does. You prioritize readable, explicit code over overly compact solutions.
9
9
 
10
- You are an expert code simplification specialist. Your expertise lies in making code easier to read, understand, and maintain without changing what it does. You prioritize readable, explicit code over overly compact solutions.
10
+ **Core principle:** Simplification means making code easier to reason about not making it shorter at the cost of clarity.
11
11
 
12
- **Core principle:** Simplification means making code easier to reason about—not making it shorter at the cost of clarity.
13
- </objective>
12
+ <input_contract>
13
+ You receive:
14
+ - A list of files modified in the current phase/adhoc work (via git diff or explicit list)
15
+ - The files are Flutter/Dart code (.dart extension)
14
16
 
15
- <context>
16
- **User's simplification request:**
17
- $ARGUMENTS
18
-
19
- **Current git status:**
20
- !`git status --short`
21
- </context>
17
+ You return:
18
+ - Structured completion report (what was simplified, verification results)
19
+ - If changes made: files are edited and ready to be committed
20
+ - If no changes needed: clear statement that code already follows good patterns
21
+ </input_contract>
22
22
 
23
23
  <process>
24
24
 
25
- ## Phase 1: Identify Target Code
26
-
27
- ### Step 1.1: Parse Arguments
28
-
29
- Analyze `$ARGUMENTS` to determine what code to simplify:
25
+ ## Phase 1: Identify Target Files
30
26
 
31
- - **File path provided** (e.g., `lib/features/home/home_screen.dart`) Read and analyze that file
32
- - **Feature/area named** (e.g., `home feature`, `authentication`) → Search for relevant files in that area
33
- - **Description provided** (e.g., `the code I just wrote`) → Check recent git changes or conversation context
34
- - **Empty or unclear** Use AskUserQuestion:
27
+ Parse the provided scope to determine which files to analyze:
28
+ - If file list provided: use those files
29
+ - If scope is "phase X": get files from git commits matching `({X}-` pattern
30
+ - If scope is "adhoc": get uncommitted changes
35
31
 
32
+ Filter to .dart files only:
33
+ ```bash
34
+ echo "$FILES" | grep '\.dart$'
36
35
  ```
37
- Question: "What Flutter code should I simplify?"
38
- Options:
39
- - "Uncommitted changes" - Simplify files with uncommitted modifications
40
- - "Specific file" - I'll provide a file path
41
- - "Recent feature work" - Simplify files related to recent feature development
42
- ```
43
-
44
- ### Step 1.2: Gather Code
45
-
46
- Based on the identified scope:
47
- - Read the target file(s)
48
- - For features, also read related files (widgets, providers, domain models)
49
- - Understand the existing patterns and structure before making changes
50
36
 
51
37
  ## Phase 2: Analyze for Simplification Opportunities
52
38
 
53
- Review the code looking for opportunities to improve clarity without changing behavior.
39
+ Review each file looking for opportunities to improve clarity without changing behavior.
54
40
 
55
41
  ### What to Simplify
56
42
 
@@ -113,7 +99,7 @@ Review the code looking for opportunities to improve clarity without changing be
113
99
  For each identified opportunity:
114
100
 
115
101
  1. **Verify preservation** - Confirm the change won't alter behavior
116
- 2. **Make the edit** - Apply the simplification
102
+ 2. **Make the edit** - Apply the simplification using Edit tool
117
103
  3. **Keep scope tight** - Only change what genuinely improves the code
118
104
 
119
105
  **Edit principles:**
@@ -124,7 +110,7 @@ For each identified opportunity:
124
110
 
125
111
  ## Phase 4: Verify No Regressions
126
112
 
127
- After completing simplifications, run verification:
113
+ After completing simplifications:
128
114
 
129
115
  ### Step 4.1: Static Analysis
130
116
 
@@ -145,13 +131,13 @@ If tests fail:
145
131
  2. Revert or fix that specific change
146
132
  3. Re-run tests until passing
147
133
 
148
- ### Step 4.3: Summary
134
+ </process>
149
135
 
150
- Report what was simplified:
136
+ <output_format>
151
137
 
152
138
  **If changes were made:**
153
139
  ```
154
- ## Simplification Summary
140
+ ## Simplification Complete
155
141
 
156
142
  **Files modified:** [count]
157
143
  **Changes applied:** [count]
@@ -167,27 +153,33 @@ Report what was simplified:
167
153
  ### Verification
168
154
  - flutter analyze: [pass/fail]
169
155
  - flutter test: [pass/fail]
156
+
157
+ ### Files Ready for Commit
158
+ [list of modified file paths]
170
159
  ```
171
160
 
172
161
  **If no changes needed:**
173
162
  ```
174
163
  ## No Simplification Needed
175
164
 
176
- Reviewed [files] and found no opportunities for simplification that would improve clarity without risking behavior changes.
165
+ Reviewed [N] files and found no opportunities for simplification that would improve clarity without risking behavior changes.
177
166
 
178
167
  The code already follows good patterns for:
179
168
  - [Specific positive observation]
180
169
  - [Another positive observation]
170
+
171
+ ### Verification
172
+ - flutter analyze: pass
173
+ - flutter test: pass
181
174
  ```
182
175
 
183
- </process>
176
+ </output_format>
184
177
 
185
178
  <success_criteria>
186
- - Target code scope clarified (via arguments or AskUserQuestion)
187
- - Code read and analyzed before any changes
179
+ - All target .dart files analyzed
188
180
  - Only genuine simplifications applied (clarity improvement, not just shorter)
189
- - All functionality preserved - no behavior changes
181
+ - All functionality preserved no behavior changes
190
182
  - `flutter analyze` passes after changes
191
183
  - `flutter test` passes after changes
192
- - Clear summary provided (changes made or "no changes needed")
184
+ - Clear report provided (changes made or "no changes needed")
193
185
  </success_criteria>
@@ -39,11 +39,11 @@ If CONTEXT.md exists, it constrains your research scope. Don't waste context exp
39
39
  - Marked as Claude's discretion → research options and recommend
40
40
  </upstream_input>
41
41
 
42
- <gsd_integration>
42
+ <mindsystem_integration>
43
43
 
44
44
  ## Research Feeds Planning
45
45
 
46
- Your output is consumed by downstream GSD workflows. The orchestrator's prompt tells you:
46
+ Your output is consumed by downstream Mindsystem workflows. The orchestrator's prompt tells you:
47
47
  - `<research_type>` — Phase research vs project research
48
48
  - `<downstream_consumer>` — What workflow uses your output and how
49
49
  - `<quality_gate>` — Checklist before declaring complete
@@ -7,6 +7,7 @@ allowed-tools:
7
7
  - Read
8
8
  - Write
9
9
  - Bash
10
+ - Task
10
11
  ---
11
12
 
12
13
  <objective>
@@ -67,6 +68,25 @@ Output: Milestone archived (roadmap + requirements), PROJECT.md evolved, git tag
67
68
  - Present milestone scope and stats
68
69
  - Wait for confirmation
69
70
 
71
+ 1.5. **Consolidate decisions:**
72
+
73
+ Spawn ms-consolidator to extract decisions from phase artifacts:
74
+
75
+ ```
76
+ Task(
77
+ prompt="Consolidate decisions from milestone v{{version}}.
78
+ Phase range: [PHASE_START]-[PHASE_END]
79
+ Create v{{version}}-DECISIONS.md.
80
+ Delete source files (PLAN, CONTEXT, RESEARCH, DESIGN).",
81
+ subagent_type="ms-consolidator"
82
+ )
83
+ ```
84
+
85
+ Wait for completion. Verify DECISIONS.md created:
86
+ ```bash
87
+ ls .planning/milestones/v{{version}}-DECISIONS.md
88
+ ```
89
+
70
90
  2. **Gather stats:**
71
91
 
72
92
  - Count phases, plans, tasks
@@ -108,13 +128,14 @@ Output: Milestone archived (roadmap + requirements), PROJECT.md evolved, git tag
108
128
  - Ask about pushing tag
109
129
 
110
130
  8. **Offer next steps:**
111
- - `/ms:discuss-milestone` — thinking partner, creates context file
112
- - Then `/ms:new-milestone` — update PROJECT.md with new goals
131
+ - `/ms:new-milestone` — discover goals and update PROJECT.md (includes optional discovery mode)
113
132
 
114
133
  </process>
115
134
 
116
135
  <success_criteria>
117
136
 
137
+ - Decisions consolidated to `.planning/milestones/v{{version}}-DECISIONS.md`
138
+ - Phase artifacts cleaned (PLAN, CONTEXT, RESEARCH, DESIGN deleted)
118
139
  - Milestone archived to `.planning/milestones/v{{version}}-ROADMAP.md`
119
140
  - Requirements archived to `.planning/milestones/v{{version}}-REQUIREMENTS.md`
120
141
  - `.planning/REQUIREMENTS.md` deleted (fresh for next milestone)
@@ -122,7 +143,7 @@ Output: Milestone archived (roadmap + requirements), PROJECT.md evolved, git tag
122
143
  - PROJECT.md updated with current state
123
144
  - Git tag v{{version}} created
124
145
  - Commit successful
125
- - User knows next steps (including need for fresh requirements)
146
+ - User knows next steps (/ms:new-milestone)
126
147
  </success_criteria>
127
148
 
128
149
  <critical_rules>
@@ -57,13 +57,25 @@ Run verify commands from tasks.
57
57
  Create .planning/adhoc/{timestamp}-{slug}-SUMMARY.md.
58
58
  </step>
59
59
 
60
+ <step name="simplify_code">
61
+ Read `simplifier` from config.json (default: `ms-code-simplifier`).
62
+ If `"skip"`: proceed to update_state_and_commit.
63
+ Spawn simplifier agent with modified files.
64
+ Track if simplifications were applied for commit message.
65
+ </step>
66
+
60
67
  <step name="update_state_and_commit">
61
68
  Add entry to STATE.md "Recent Adhoc Work" section.
62
- Single git commit with all changes (code + PLAN.md + SUMMARY.md + STATE.md).
69
+ Single git commit with all changes (code + simplifications + PLAN.md + SUMMARY.md + STATE.md).
70
+ </step>
71
+
72
+ <step name="generate_patch">
73
+ Generate patch file from adhoc commit.
74
+ Run generate-adhoc-patch.sh with commit hash and output path.
63
75
  </step>
64
76
 
65
77
  <step name="completion">
66
- Report what was done, show commit hash and file paths.
78
+ Report what was done, show commit hash, file paths, and patch file path.
67
79
  </step>
68
80
 
69
81
  </process>
@@ -83,8 +95,10 @@ Adhoc work is complete when:
83
95
  - [ ] .planning/adhoc/ directory exists
84
96
  - [ ] PLAN.md created with tasks
85
97
  - [ ] All tasks executed and verified
98
+ - [ ] Code simplified (or skipped if config says "skip")
86
99
  - [ ] SUMMARY.md created with outcomes
87
100
  - [ ] STATE.md updated with adhoc entry
88
- - [ ] Single git commit with all changes
101
+ - [ ] Single git commit with all changes (including simplifications)
102
+ - [ ] Patch file generated OR explicitly skipped with message
89
103
  - [ ] User informed of completion and commit hash
90
104
  </success_criteria>