mindsystem-cc 3.12.0 → 3.13.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 (33) hide show
  1. package/agents/ms-consolidator.md +4 -4
  2. package/agents/ms-executor.md +19 -351
  3. package/agents/ms-flutter-code-quality.md +7 -6
  4. package/agents/ms-mock-generator.md +51 -138
  5. package/agents/ms-plan-checker.md +170 -175
  6. package/agents/ms-plan-writer.md +120 -115
  7. package/agents/ms-verifier.md +22 -18
  8. package/commands/ms/check-phase.md +3 -3
  9. package/commands/ms/execute-phase.md +8 -6
  10. package/commands/ms/plan-phase.md +4 -3
  11. package/commands/ms/verify-work.md +7 -7
  12. package/mindsystem/references/goal-backward.md +10 -25
  13. package/mindsystem/references/mock-patterns.md +149 -240
  14. package/mindsystem/references/plan-format.md +326 -247
  15. package/mindsystem/references/scope-estimation.md +29 -24
  16. package/mindsystem/references/tdd-execution.md +70 -0
  17. package/mindsystem/references/tdd.md +53 -194
  18. package/mindsystem/templates/UAT.md +16 -16
  19. package/mindsystem/templates/phase-prompt.md +51 -367
  20. package/mindsystem/templates/roadmap.md +1 -1
  21. package/mindsystem/templates/verification-report.md +2 -2
  22. package/mindsystem/workflows/adhoc.md +16 -21
  23. package/mindsystem/workflows/execute-phase.md +71 -49
  24. package/mindsystem/workflows/execute-plan.md +183 -1054
  25. package/mindsystem/workflows/plan-phase.md +47 -38
  26. package/mindsystem/workflows/verify-phase.md +16 -20
  27. package/mindsystem/workflows/verify-work.md +54 -67
  28. package/package.json +1 -1
  29. package/scripts/update-state.sh +59 -0
  30. package/scripts/validate-execution-order.sh +102 -0
  31. package/skills/flutter-code-quality/SKILL.md +4 -3
  32. package/mindsystem/templates/summary.md +0 -293
  33. package/mindsystem/workflows/generate-mocks.md +0 -261
@@ -1,194 +1,16 @@
1
1
  # Phase Prompt Template
2
2
 
3
- Template for `.planning/phases/XX-name/{phase}-{plan}-PLAN.md` - executable phase plans optimized for parallel execution.
3
+ Process guidance for generating PLAN.md files. For format specification,
4
+ read `~/.claude/mindsystem/references/plan-format.md`.
4
5
 
5
- **Naming:** Use `{phase}-{plan}-PLAN.md` format (e.g., `01-02-PLAN.md` for Phase 1, Plan 2)
6
+ **File naming:** `{phase}-{plan}-PLAN.md` (e.g., `01-02-PLAN.md` for Phase 1, Plan 2)
6
7
 
7
8
  ---
8
9
 
9
- ## File Template
10
+ ## Expected Outputs
10
11
 
11
- ```markdown
12
- ---
13
- phase: XX-name
14
- plan: NN
15
- type: execute
16
- wave: N # Execution wave (1, 2, 3...). Pre-computed at plan time.
17
- depends_on: [] # Plan IDs this plan requires (e.g., ["01-01"]).
18
- files_modified: [] # Files this plan modifies.
19
- subsystem_hint: "" # From planner, for executor SUMMARY.md
20
- user_setup: [] # Human-required setup Claude cannot automate (see below)
21
-
22
- # Goal-backward verification (derived during planning, verified after execution)
23
- must_haves:
24
- truths: [] # Observable behaviors that must be true for goal achievement
25
- artifacts: [] # Files that must exist with real implementation
26
- key_links: [] # Critical connections between artifacts
27
- ---
28
-
29
- <objective>
30
- [What this plan accomplishes]
31
-
32
- Purpose: [Why this matters for the project]
33
- Output: [What artifacts will be created]
34
- </objective>
35
-
36
- <execution_context>
37
- @~/.claude/mindsystem/workflows/execute-plan.md
38
- @~/.claude/mindsystem/templates/summary.md
39
- </execution_context>
40
-
41
- <context>
42
- @.planning/PROJECT.md
43
- @.planning/ROADMAP.md
44
- @.planning/STATE.md
45
-
46
- # Only reference prior plan SUMMARYs if genuinely needed:
47
- # - This plan uses types/exports from prior plan
48
- # - Prior plan made decision that affects this plan
49
- # Do NOT reflexively chain: Plan 02 refs 01, Plan 03 refs 02...
50
-
51
- [Relevant source files:]
52
- @src/path/to/relevant.ts
53
- </context>
54
-
55
- <tasks>
56
-
57
- <task type="auto">
58
- <name>Task 1: [Action-oriented name]</name>
59
- <files>path/to/file.ext, another/file.ext</files>
60
- <action>[Specific implementation - what to do, how to do it, what to avoid and WHY]</action>
61
- <verify>[Command or check to prove it worked]</verify>
62
- <done>[Measurable acceptance criteria]</done>
63
- </task>
64
-
65
- <task type="auto">
66
- <name>Task 2: [Action-oriented name]</name>
67
- <files>path/to/file.ext</files>
68
- <action>[Specific implementation]</action>
69
- <verify>[Command or check]</verify>
70
- <done>[Acceptance criteria]</done>
71
- </task>
72
-
73
- </tasks>
74
-
75
- <verification>
76
- Before declaring plan complete:
77
- - [ ] [Specific test command]
78
- - [ ] [Build/type check passes]
79
- - [ ] [Behavior verification]
80
- </verification>
81
-
82
- <success_criteria>
83
-
84
- - All tasks completed
85
- - All verification checks pass
86
- - No errors or warnings introduced
87
- - [Plan-specific criteria]
88
- </success_criteria>
89
-
90
- <output>
91
- After completion, create `.planning/phases/XX-name/{phase}-{plan}-SUMMARY.md`
92
- </output>
93
- ```
94
-
95
- ---
96
-
97
- ## Frontmatter Fields
98
-
99
- | Field | Required | Purpose |
100
- |-------|----------|---------|
101
- | `phase` | Yes | Phase identifier (e.g., `01-foundation`) |
102
- | `plan` | Yes | Plan number within phase (e.g., `01`, `02`) |
103
- | `type` | Yes | Always `execute` for standard plans, `tdd` for TDD plans |
104
- | `wave` | Yes | Execution wave number (1, 2, 3...). Pre-computed at plan time. |
105
- | `depends_on` | Yes | Array of plan IDs this plan requires. |
106
- | `files_modified` | Yes | Files this plan touches. |
107
- | `subsystem_hint` | No | Subsystem from config.json, assigned by planner for executor to use in SUMMARY.md |
108
- | `user_setup` | No | Array of human-required setup items (external services) |
109
- | `must_haves` | Yes | Goal-backward verification criteria (see below) |
110
-
111
- **Wave is pre-computed:** Wave numbers are assigned during `/ms:plan-phase`. Execute-phase reads `wave` directly from frontmatter and groups plans by wave number. No runtime dependency analysis needed.
112
-
113
- **Must-haves enable verification:** The `must_haves` field carries goal-backward requirements from planning to execution. After all plans complete, execute-phase spawns a verification subagent that checks these criteria against the actual codebase.
114
-
115
- ---
116
-
117
- ## Parallel vs Sequential
118
-
119
- <parallel_examples>
120
-
121
- **Wave 1 candidates (parallel):**
122
-
123
- ```yaml
124
- # Plan 01 - User feature
125
- wave: 1
126
- depends_on: []
127
- files_modified: [src/models/user.ts, src/api/users.ts]
128
-
129
- # Plan 02 - Product feature (no overlap with Plan 01)
130
- wave: 1
131
- depends_on: []
132
- files_modified: [src/models/product.ts, src/api/products.ts]
133
-
134
- # Plan 03 - Order feature (no overlap)
135
- wave: 1
136
- depends_on: []
137
- files_modified: [src/models/order.ts, src/api/orders.ts]
138
- ```
139
-
140
- All three run in parallel (Wave 1) - no dependencies, no file conflicts.
141
-
142
- **Sequential (genuine dependency):**
143
-
144
- ```yaml
145
- # Plan 01 - Auth foundation
146
- wave: 1
147
- depends_on: []
148
- files_modified: [src/lib/auth.ts, src/middleware/auth.ts]
149
-
150
- # Plan 02 - Protected features (needs auth)
151
- wave: 2
152
- depends_on: ["01"]
153
- files_modified: [src/features/dashboard.ts]
154
- ```
155
-
156
- Plan 02 in Wave 2 waits for Plan 01 in Wave 1 - genuine dependency on auth types/middleware.
157
-
158
-
159
- </parallel_examples>
160
-
161
- ---
162
-
163
- ## Context Section
164
-
165
- **Parallel-aware context:**
166
-
167
- ```markdown
168
- <context>
169
- @.planning/PROJECT.md
170
- @.planning/ROADMAP.md
171
- @.planning/STATE.md
172
-
173
- # Only include SUMMARY refs if genuinely needed:
174
- # - This plan imports types from prior plan
175
- # - Prior plan made decision affecting this plan
176
- # - Prior plan's output is input to this plan
177
- #
178
- # Independent plans need NO prior SUMMARY references.
179
- # Do NOT reflexively chain: 02 refs 01, 03 refs 02...
180
-
181
- @src/relevant/source.ts
182
- </context>
183
- ```
184
-
185
- **Bad pattern (creates false dependencies):**
186
- ```markdown
187
- <context>
188
- @.planning/phases/03-features/03-01-SUMMARY.md # Just because it's earlier
189
- @.planning/phases/03-features/03-02-SUMMARY.md # Reflexive chaining
190
- </context>
191
- ```
12
+ 1. **PLAN.md files** — pure markdown following plan-format.md spec
13
+ 2. **EXECUTION-ORDER.md** — wave groups for parallel execution
192
14
 
193
15
  ---
194
16
 
@@ -196,16 +18,17 @@ Plan 02 in Wave 2 waits for Plan 01 in Wave 1 - genuine dependency on auth types
196
18
 
197
19
  **Plan sizing:**
198
20
 
199
- - 2-3 tasks per plan
200
- - ~50% context usage maximum
21
+ - 2-3 tasks per plan, ~50% context usage maximum
22
+ - Default to 3 tasks for simple-medium work, 2 for complex
23
+ - Executor overhead reduction creates headroom for the third task
201
24
  - Complex phases: Multiple focused plans, not one large plan
202
25
 
203
26
  **When to split:**
204
27
 
205
28
  - Different subsystems (auth vs API vs UI)
206
- - >3 tasks
29
+ - More than 3 tasks
207
30
  - Risk of context overflow
208
- - TDD candidates - separate plans
31
+ - TDD candidates separate plans
209
32
 
210
33
  **Vertical slices preferred:**
211
34
 
@@ -220,15 +43,15 @@ AVOID: Plan 01 = All models
220
43
 
221
44
  ---
222
45
 
223
- ## TDD Plans
224
-
225
- TDD features get dedicated plans with `type: tdd`.
46
+ ## TDD Detection
226
47
 
227
48
  **Heuristic:** Can you write `expect(fn(input)).toBe(output)` before writing `fn`?
228
- Yes: Create a TDD plan
229
- No: Standard task in standard plan
49
+ - Yes: Create a TDD plan with `**Type:** tdd`
50
+ - No: Standard plan (type defaults to execute, omit from metadata line)
51
+
52
+ TDD features get dedicated plans. One feature per TDD plan.
230
53
 
231
- See `~/.claude/mindsystem/references/tdd.md` for TDD plan structure.
54
+ See `~/.claude/mindsystem/references/tdd.md` for TDD plan structure (RED/GREEN/REFACTOR in ## Changes).
232
55
 
233
56
  ---
234
57
 
@@ -236,81 +59,51 @@ See `~/.claude/mindsystem/references/tdd.md` for TDD plan structure.
236
59
 
237
60
  | Type | Use For |
238
61
  |------|---------|
239
- | `auto` | Everything Claude can do independently (default) |
62
+ | `execute` | Everything Claude can do independently (default, can be omitted) |
240
63
  | `tdd` | TDD features with RED → GREEN → REFACTOR cycle |
241
64
 
242
- **Decisions:** Resolve during planning via AskUserQuestion, not during execution. For purely technical choices, make the decision and document it in the plan's objective.
65
+ **Decisions:** Resolve during planning via AskUserQuestion, not during execution. For purely technical choices, make the decision and document it in the plan's ## Context.
243
66
 
244
67
  ---
245
68
 
246
- ## Examples
69
+ ## Learnings Integration
247
70
 
248
- **Autonomous parallel plan:**
71
+ When expanding tasks into plan ## Changes subsections, check provided learnings for entries relevant to each change. Embed as directives within the change description:
249
72
 
250
73
  ```markdown
251
- ---
252
- phase: 03-features
253
- plan: 01
254
- type: execute
255
- wave: 1
256
- depends_on: []
257
- files_modified: [src/features/user/model.ts, src/features/user/api.ts, src/features/user/UserList.tsx]
258
- ---
74
+ ### 2. Create auth endpoint
75
+ **Files:** `src/api/auth/login.ts`
259
76
 
260
- <objective>
261
- Implement complete User feature as vertical slice.
262
-
263
- Purpose: Self-contained user management that can run parallel to other features.
264
- Output: User model, API endpoints, and UI components.
265
- </objective>
266
-
267
- <context>
268
- @.planning/PROJECT.md
269
- @.planning/ROADMAP.md
270
- @.planning/STATE.md
271
- </context>
272
-
273
- <tasks>
274
- <task type="auto">
275
- <name>Task 1: Create User model</name>
276
- <files>src/features/user/model.ts</files>
277
- <action>Define User type with id, email, name, createdAt. Export TypeScript interface.</action>
278
- <verify>tsc --noEmit passes</verify>
279
- <done>User type exported and usable</done>
280
- </task>
281
-
282
- <task type="auto">
283
- <name>Task 2: Create User API endpoints</name>
284
- <files>src/features/user/api.ts</files>
285
- <action>GET /users (list), GET /users/:id (single), POST /users (create). Use User type from model.</action>
286
- <verify>curl tests pass for all endpoints</verify>
287
- <done>All CRUD operations work</done>
288
- </task>
289
- </tasks>
290
-
291
- <verification>
292
- - [ ] npm run build succeeds
293
- - [ ] API endpoints respond correctly
294
- </verification>
295
-
296
- <success_criteria>
297
- - All tasks completed
298
- - User feature works end-to-end
299
- </success_criteria>
300
-
301
- <output>
302
- After completion, create `.planning/phases/03-features/03-01-SUMMARY.md`
303
- </output>
77
+ POST endpoint accepting {email, password}...
78
+
79
+ **From prior work:** CommonJS libraries fail silently in Edge runtime — verify ESM compat.
304
80
  ```
305
81
 
82
+ Rules:
83
+ - Maximum 2 learning directives per change (context budget)
84
+ - Only include learnings that change what the executor would do
85
+ - Phrase as imperative directives, not history
86
+ - If no learnings match a change, add nothing
87
+
88
+ ---
89
+
90
+ ## External Services
91
+
92
+ When a plan introduces external services requiring human configuration, describe them in the plan's ## Context section. The user handles external service setup (account creation, secret retrieval) based on plan context.
93
+
94
+ **The automation-first rule:** External service notes contain ONLY what Claude literally cannot do:
95
+ - Account creation (requires human signup)
96
+ - Secret retrieval (requires dashboard access)
97
+ - Dashboard configuration (requires human in browser)
98
+
99
+ **NOT included:** Package installs, code changes, file creation, CLI commands Claude can run.
100
+
306
101
  ---
307
102
 
308
103
  ## Anti-Patterns
309
104
 
310
105
  **Bad: Reflexive dependency chaining**
311
- ```yaml
312
- depends_on: ["03-01"] # Just because 01 comes before 02
313
- ```
106
+ Plan 02 does not depend on Plan 01 just because 01 comes first. Check actual needs/creates.
314
107
 
315
108
  **Bad: Horizontal layer grouping**
316
109
  ```
@@ -320,121 +113,12 @@ Plan 03: All UIs (depends on 02)
320
113
  ```
321
114
 
322
115
  **Bad: Vague tasks**
323
- ```xml
324
- <task type="auto">
325
- <name>Set up authentication</name>
326
- <action>Add auth to the app</action>
327
- </task>
328
116
  ```
329
-
330
- ---
331
-
332
- ## Guidelines
333
-
334
- - Always use XML structure for Claude parsing
335
- - Include `wave`, `depends_on`, `files_modified` in every plan
336
- - Prefer vertical slices over horizontal layers
337
- - Only reference prior SUMMARYs when genuinely needed
338
- - 2-3 tasks per plan, ~50% context max
339
-
340
- ---
341
-
342
- ## User Setup (External Services)
343
-
344
- When a plan introduces external services requiring human configuration, declare in frontmatter:
345
-
346
- ```yaml
347
- user_setup:
348
- - service: stripe
349
- why: "Payment processing requires API keys"
350
- env_vars:
351
- - name: STRIPE_SECRET_KEY
352
- source: "Stripe Dashboard → Developers → API keys → Secret key"
353
- - name: STRIPE_WEBHOOK_SECRET
354
- source: "Stripe Dashboard → Developers → Webhooks → Signing secret"
355
- dashboard_config:
356
- - task: "Create webhook endpoint"
357
- location: "Stripe Dashboard → Developers → Webhooks → Add endpoint"
358
- details: "URL: https://[your-domain]/api/webhooks/stripe"
359
- local_dev:
360
- - "stripe listen --forward-to localhost:3000/api/webhooks/stripe"
117
+ ### 1. Set up authentication
118
+ Implement auth.
361
119
  ```
362
120
 
363
- **The automation-first rule:** `user_setup` contains ONLY what Claude literally cannot do:
364
- - Account creation (requires human signup)
365
- - Secret retrieval (requires dashboard access)
366
- - Dashboard configuration (requires human in browser)
367
-
368
- **NOT included:** Package installs, code changes, file creation, CLI commands Claude can run.
369
-
370
- **Result:** Execute-plan generates `{phase}-USER-SETUP.md` with checklist for the user.
371
-
372
- See `~/.claude/mindsystem/templates/user-setup.md` for full schema and examples
373
-
374
- ---
375
-
376
- ## Must-Haves (Goal-Backward Verification)
377
-
378
- The `must_haves` field defines what must be TRUE for the phase goal to be achieved. Derived during planning, verified after execution.
379
-
380
- **Structure:**
381
-
382
- ```yaml
383
- must_haves:
384
- truths:
385
- - "User can see existing messages"
386
- - "User can send a message"
387
- - "Messages persist across refresh"
388
- artifacts:
389
- - path: "src/components/Chat.tsx"
390
- provides: "Message list rendering"
391
- min_lines: 30
392
- - path: "src/app/api/chat/route.ts"
393
- provides: "Message CRUD operations"
394
- exports: ["GET", "POST"]
395
- - path: "prisma/schema.prisma"
396
- provides: "Message model"
397
- contains: "model Message"
398
- key_links:
399
- - from: "src/components/Chat.tsx"
400
- to: "/api/chat"
401
- via: "fetch in useEffect"
402
- pattern: "fetch.*api/chat"
403
- - from: "src/app/api/chat/route.ts"
404
- to: "prisma.message"
405
- via: "database query"
406
- pattern: "prisma\\.message\\.(find|create)"
407
- ```
121
+ Claude: "How? What type? What library? Where?" plans must be specific enough for immediate implementation.
408
122
 
409
- **Field descriptions:**
410
-
411
- | Field | Purpose |
412
- |-------|---------|
413
- | `truths` | Observable behaviors from user perspective. Each must be testable. |
414
- | `artifacts` | Files that must exist with real implementation. |
415
- | `artifacts[].path` | File path relative to project root. |
416
- | `artifacts[].provides` | What this artifact delivers. |
417
- | `artifacts[].min_lines` | Optional. Minimum lines to be considered substantive. |
418
- | `artifacts[].exports` | Optional. Expected exports to verify. |
419
- | `artifacts[].contains` | Optional. Pattern that must exist in file. |
420
- | `key_links` | Critical connections between artifacts. |
421
- | `key_links[].from` | Source artifact. |
422
- | `key_links[].to` | Target artifact or endpoint. |
423
- | `key_links[].via` | How they connect (description). |
424
- | `key_links[].pattern` | Optional. Regex to verify connection exists. |
425
-
426
- **Why this matters:**
427
-
428
- Task completion ≠ Goal achievement. A task "create chat component" can complete by creating a placeholder. The `must_haves` field captures what must actually work, enabling verification to catch gaps before they compound.
429
-
430
- **Verification flow:**
431
-
432
- 1. Plan-phase derives must_haves from phase goal (goal-backward)
433
- 2. Must_haves written to PLAN.md frontmatter
434
- 3. Execute-phase runs all plans
435
- 4. Verification subagent checks must_haves against codebase
436
- 5. Gaps found → fix plans created → execute → re-verify
437
- 6. All must_haves pass → phase complete
438
-
439
- See `~/.claude/mindsystem/references/goal-backward.md` for derivation process.
440
- See `~/.claude/mindsystem/workflows/verify-phase.md` for verification logic.
123
+ **Bad: Unnecessary SUMMARY references**
124
+ Independent plans need NO prior SUMMARY references. Only reference prior SUMMARYs if genuinely importing types/exports from them.
@@ -132,7 +132,7 @@ Phases execute in numeric order: 2 → 2.1 → 2.2 → 3 → 3.1 → 4
132
132
  **Success criteria:**
133
133
  - 2-5 observable behaviors per phase (from user's perspective)
134
134
  - Cross-checked against requirements during roadmap creation
135
- - Flow downstream to `must_haves` in plan-phase
135
+ - Flow downstream to `## Must-Haves` in plan-phase
136
136
  - Verified by verify-phase after execution
137
137
  - Format: "User can [action]" or "[Thing] works/exists"
138
138
 
@@ -147,7 +147,7 @@ None — all verifiable items checked programmatically.
147
147
  ## Verification Metadata
148
148
 
149
149
  **Verification approach:** Goal-backward (derived from phase goal)
150
- **Must-haves source:** {PLAN.md frontmatter | derived from ROADMAP.md goal}
150
+ **Must-haves source:** {PLAN.md ## Must-Haves section | derived from ROADMAP.md goal}
151
151
  **Automated checks:** {N} passed, {M} failed
152
152
  **Human checks required:** {N}
153
153
  **Total verification time:** {duration}
@@ -311,7 +311,7 @@ None needed until automated gaps are fixed.
311
311
  ## Verification Metadata
312
312
 
313
313
  **Verification approach:** Goal-backward (derived from phase goal)
314
- **Must-haves source:** 03-01-PLAN.md frontmatter
314
+ **Must-haves source:** 03-01-PLAN.md ## Must-Haves section
315
315
  **Automated checks:** 2 passed, 8 failed
316
316
  **Human checks required:** 0 (blocked by automated failures)
317
317
  **Total verification time:** 2 min
@@ -132,33 +132,28 @@ plan_file=".planning/adhoc/${timestamp}-${slug}-PLAN.md"
132
132
  Create minimal PLAN.md:
133
133
 
134
134
  ```markdown
135
- ---
136
- type: adhoc
137
- description: [user description]
138
- created: [ISO timestamp]
139
- related_phase: [current phase from STATE.md, or "none"]
140
- ---
135
+ # Adhoc: [User's description]
141
136
 
142
- <objective>
143
- [User's description of what needs to be done]
144
- </objective>
137
+ **Subsystem:** [subsystem or "general"] | **Type:** execute
145
138
 
146
- <tasks>
139
+ ## Context
140
+ [User's description of what needs to be done and why]
147
141
 
148
- <task type="auto">
149
- <name>Task 1: [Action-oriented name]</name>
150
- <files>[file paths]</files>
151
- <action>[What to do, what to avoid and WHY]</action>
152
- <verify>[Command or check to prove completion]</verify>
153
- </task>
142
+ ## Changes
154
143
 
155
- [Task 2 if needed, same structure]
144
+ ### 1. [Action-oriented name]
145
+ **Files:** `[file paths]`
156
146
 
157
- </tasks>
147
+ [What to do, what to avoid and WHY]
148
+
149
+ [### 2. if needed, same structure]
150
+
151
+ ## Verification
152
+ - [How to verify the work is complete]
158
153
 
159
- <verification>
160
- [How to verify the work is complete]
161
- </verification>
154
+ ## Must-Haves
155
+ - [ ] [Observable outcome 1]
156
+ - [ ] [Observable outcome 2]
162
157
  ```
163
158
 
164
159
  Write to file: