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,293 +0,0 @@
1
- # Summary Template
2
-
3
- Template for `.planning/phases/XX-name/{phase}-{plan}-SUMMARY.md` - phase completion documentation.
4
-
5
- ---
6
-
7
- ## File Template
8
-
9
- ```markdown
10
- ---
11
- phase: XX-name
12
- plan: YY
13
- subsystem: [from .planning/config.json subsystems list]
14
- tags: [searchable tech: jwt, stripe, react, postgres, prisma]
15
-
16
- # Dependency graph
17
- requires:
18
- - phase: [prior phase this depends on]
19
- provides: [what that phase built that this uses]
20
- provides:
21
- - [bullet list of what this phase built/delivered]
22
- affects: [list of phase names or keywords that will need this context]
23
-
24
- # Tech tracking
25
- tech-stack:
26
- added: [libraries/tools added in this phase]
27
- patterns: [architectural/code patterns established]
28
-
29
- key-files:
30
- created: [important files created]
31
- modified: [important files modified]
32
-
33
- key-decisions:
34
- - "Decision 1"
35
- - "Decision 2"
36
-
37
- patterns-established:
38
- - "Pattern 1: description"
39
- - "Pattern 2: description"
40
-
41
- # Verification hints (required — aids verify-work mock classification, use `none` if not applicable)
42
- mock_hints:
43
- transient_states:
44
- - state: "[description of transient UI state]"
45
- component: "[file path]"
46
- trigger: "[async call | animation | timer]"
47
- external_data:
48
- - source: "[API endpoint or data source]"
49
- data_type: "[what kind of data]"
50
- components: ["[file1]", "[file2]"]
51
-
52
- # Metrics
53
- duration: Xmin
54
- completed: YYYY-MM-DD
55
- ---
56
-
57
- # Phase [X]: [Name] Summary
58
-
59
- **[Substantive one-liner describing outcome - NOT "phase complete" or "implementation finished"]**
60
-
61
- ## Performance
62
-
63
- - **Duration:** [time] (e.g., 23 min, 1h 15m)
64
- - **Started:** [ISO timestamp]
65
- - **Completed:** [ISO timestamp]
66
- - **Tasks:** [count completed]
67
- - **Files modified:** [count]
68
-
69
- ## Accomplishments
70
- - [Most important outcome]
71
- - [Second key accomplishment]
72
- - [Third if applicable]
73
-
74
- ## Task Commits
75
-
76
- Each task was committed atomically:
77
-
78
- 1. **Task 1: [task name]** - `abc123f` (feat/fix/test/refactor)
79
- 2. **Task 2: [task name]** - `def456g` (feat/fix/test/refactor)
80
- 3. **Task 3: [task name]** - `hij789k` (feat/fix/test/refactor)
81
-
82
- **Plan metadata:** `lmn012o` (docs: complete plan)
83
-
84
- _Note: TDD tasks may have multiple commits (test → feat → refactor)_
85
-
86
- ## Files Created/Modified
87
- - `path/to/file.ts` - What it does
88
- - `path/to/another.ts` - What it does
89
-
90
- ## Verification Hints
91
-
92
- [If phase built UI with transient states or external data dependencies, list them.
93
- If not applicable: "None — no transient states or external data dependencies."]
94
-
95
- **Transient states:** [States that appear briefly during async operations]
96
- - [state description] in `[component]` — triggered by [what]
97
-
98
- **External data:** [Features that fetch specific data from APIs]
99
- - [data type] from [source] — used by `[component1]`, `[component2]`
100
-
101
- ## Decisions Made
102
- [Key decisions with brief rationale, or "None - followed plan as specified"]
103
-
104
- ## Deviations from Plan
105
-
106
- [If no deviations: "None - plan executed exactly as written"]
107
-
108
- [If deviations occurred:]
109
-
110
- ### Auto-fixed Issues
111
-
112
- **1. [Rule X - Category] Brief description**
113
- - **Found during:** Task [N] ([task name])
114
- - **Issue:** [What was wrong]
115
- - **Fix:** [What was done]
116
- - **Files modified:** [file paths]
117
- - **Verification:** [How it was verified]
118
- - **Committed in:** [hash] (part of task commit)
119
-
120
- [... repeat for each auto-fix ...]
121
-
122
- ---
123
-
124
- **Total deviations:** [N] auto-fixed ([breakdown by rule])
125
- **Impact on plan:** [Brief assessment - e.g., "All auto-fixes necessary for correctness/security. No scope creep."]
126
-
127
- ## Issues Encountered
128
- [Problems and how they were resolved, or "None"]
129
-
130
- [Note: "Deviations from Plan" documents unplanned work that was handled automatically via deviation rules. "Issues Encountered" documents problems during planned work that required problem-solving.]
131
-
132
- ## User Setup Required
133
-
134
- [If USER-SETUP.md was generated:]
135
- **External services require manual configuration.** See [{phase}-USER-SETUP.md](./{phase}-USER-SETUP.md) for:
136
- - Environment variables to add
137
- - Dashboard configuration steps
138
- - Verification commands
139
-
140
- [If no USER-SETUP.md:]
141
- None - no external service configuration required.
142
-
143
- ## Next Phase Readiness
144
- [What's ready for next phase]
145
- [Any blockers or concerns]
146
-
147
- ---
148
- *Phase: XX-name*
149
- *Completed: [date]*
150
- ```
151
-
152
- <frontmatter_guidance>
153
- **Purpose:** Enable automatic context assembly via dependency graph. Frontmatter makes summary metadata machine-readable so plan-phase can scan all summaries quickly and select relevant ones based on dependencies.
154
-
155
- **Fast scanning:** Frontmatter is first ~25 lines, cheap to scan across all summaries without reading full content.
156
-
157
- **Dependency graph:** `requires`/`provides`/`affects` create explicit links between phases, enabling transitive closure for context selection.
158
-
159
- **Subsystem:** Primary categorization from `.planning/config.json` subsystems list. If work doesn't fit any existing subsystem, add a new value to config.json and use it.
160
-
161
- **Tags:** Searchable technical keywords (libraries, frameworks, tools) for tech stack awareness.
162
-
163
- **Key-files:** Important files for @context references in PLAN.md.
164
-
165
- **Patterns:** Established conventions future phases should maintain.
166
-
167
- **Population:** Frontmatter is populated during summary creation in execute-plan.md. See `<step name="create_summary">` for field-by-field guidance.
168
-
169
- **Mock hints (required):** Captures verification-relevant knowledge about transient UI states and external data dependencies. Transient states are UI states that appear briefly (loading skeletons, animations, transitions) — verify-work needs these to generate mocks that force/extend the state. External data entries identify features depending on API data — verify-work uses these to ask the user whether test data exists locally. Populate when the phase builds UI with these characteristics. When a phase has no transient states or external data dependencies, write `mock_hints: none` (with optional comment, e.g., `mock_hints: none # purely backend, no async UI`). Always populate — `none` is a valid value that tells verify-work to skip mock analysis.
170
- </frontmatter_guidance>
171
-
172
- <one_liner_rules>
173
- The one-liner MUST be substantive:
174
-
175
- **Good:**
176
- - "JWT auth with refresh rotation using jose library"
177
- - "Prisma schema with User, Session, and Product models"
178
- - "Dashboard with real-time metrics via Server-Sent Events"
179
-
180
- **Bad:**
181
- - "Phase complete"
182
- - "Authentication implemented"
183
- - "Foundation finished"
184
- - "All tasks done"
185
-
186
- The one-liner should tell someone what actually shipped.
187
- </one_liner_rules>
188
-
189
- <example>
190
- ```markdown
191
- # Phase 1: Foundation Summary
192
-
193
- **JWT auth with refresh rotation using jose library, Prisma User model, and protected API middleware**
194
-
195
- ## Performance
196
-
197
- - **Duration:** 28 min
198
- - **Started:** 2025-01-15T14:22:10Z
199
- - **Completed:** 2025-01-15T14:50:33Z
200
- - **Tasks:** 5
201
- - **Files modified:** 8
202
-
203
- ## Accomplishments
204
- - User model with email/password auth
205
- - Login/logout endpoints with httpOnly JWT cookies
206
- - Protected route middleware checking token validity
207
- - Refresh token rotation on each request
208
-
209
- ## Files Created/Modified
210
- - `prisma/schema.prisma` - User and Session models
211
- - `src/app/api/auth/login/route.ts` - Login endpoint
212
- - `src/app/api/auth/logout/route.ts` - Logout endpoint
213
- - `src/middleware.ts` - Protected route checks
214
- - `src/lib/auth.ts` - JWT helpers using jose
215
-
216
- ## Decisions Made
217
- - Used jose instead of jsonwebtoken (ESM-native, Edge-compatible)
218
- - 15-min access tokens with 7-day refresh tokens
219
- - Storing refresh tokens in database for revocation capability
220
-
221
- ## Deviations from Plan
222
-
223
- ### Auto-fixed Issues
224
-
225
- **1. [Rule 2 - Missing Critical] Added password hashing with bcrypt**
226
- - **Found during:** Task 2 (Login endpoint implementation)
227
- - **Issue:** Plan didn't specify password hashing - storing plaintext would be critical security flaw
228
- - **Fix:** Added bcrypt hashing on registration, comparison on login with salt rounds 10
229
- - **Files modified:** src/app/api/auth/login/route.ts, src/lib/auth.ts
230
- - **Verification:** Password hash test passes, plaintext never stored
231
- - **Committed in:** abc123f (Task 2 commit)
232
-
233
- **2. [Rule 3 - Blocking] Installed missing jose dependency**
234
- - **Found during:** Task 4 (JWT token generation)
235
- - **Issue:** jose package not in package.json, import failing
236
- - **Fix:** Ran `npm install jose`
237
- - **Files modified:** package.json, package-lock.json
238
- - **Verification:** Import succeeds, build passes
239
- - **Committed in:** def456g (Task 4 commit)
240
-
241
- ---
242
-
243
- **Total deviations:** 2 auto-fixed (1 missing critical, 1 blocking)
244
- **Impact on plan:** Both auto-fixes essential for security and functionality. No scope creep.
245
-
246
- ## Issues Encountered
247
- - jsonwebtoken CommonJS import failed in Edge runtime - switched to jose (planned library change, worked as expected)
248
-
249
- ## Next Phase Readiness
250
- - Auth foundation complete, ready for feature development
251
- - User registration endpoint needed before public launch
252
-
253
- ---
254
- *Phase: 01-foundation*
255
- *Completed: 2025-01-15*
256
- ```
257
- </example>
258
-
259
- <guidelines>
260
- **When to create:**
261
- - After completing each phase plan
262
- - Required output from execute-plan workflow
263
- - Documents what actually happened vs what was planned
264
-
265
- **Frontmatter completion:**
266
- - MANDATORY: Complete all frontmatter fields during summary creation
267
- - See <frontmatter_guidance> for field purposes
268
- - Frontmatter enables automatic context assembly for future planning
269
-
270
- **One-liner requirements:**
271
- - Must be substantive (describe what shipped, not "phase complete")
272
- - Should tell someone what was accomplished
273
- - Examples: "JWT auth with refresh rotation using jose library" not "Authentication implemented"
274
-
275
- **Performance tracking:**
276
- - Include duration, start/end timestamps
277
- - Used for velocity metrics in STATE.md
278
-
279
- **Deviations section:**
280
- - Documents unplanned work handled via deviation rules
281
- - Separate from "Issues Encountered" (which is planned work problems)
282
- - Auto-fixed issues: What was wrong, how fixed, verification
283
-
284
- **Decisions section:**
285
- - Key decisions made during execution
286
- - Include rationale (why this choice)
287
- - Extracted to STATE.md accumulated context
288
- - Use "None - followed plan as specified" if no deviations
289
-
290
- **After creation:**
291
- - STATE.md updated with position, decisions, issues
292
- - Next plan can reference decisions made
293
- </guidelines>
@@ -1,261 +0,0 @@
1
- <purpose>
2
- Generate framework-specific mock code for manual UAT testing. Creates override files with toggle flags and minimal production hooks.
3
-
4
- Called by verify-work workflow when a test batch requires mock state.
5
- </purpose>
6
-
7
- <philosophy>
8
- **Mocks are temporary scaffolding.**
9
-
10
- They exist only as uncommitted changes during testing. They enable reaching UI states that require specific backend conditions (premium user, error states, empty lists, loading states).
11
-
12
- **Principles:**
13
- - Minimal footprint: One override file + minimal hooks
14
- - Easy removal: Delete file, remove imports, done
15
- - Framework-appropriate: Match project conventions
16
- - User-controlled: Clear toggle instructions
17
- </philosophy>
18
-
19
- <framework_detection>
20
-
21
- **Step 1: Read PROJECT.md**
22
- ```bash
23
- cat .planning/PROJECT.md 2>/dev/null | head -50
24
- ```
25
-
26
- **Step 2: Verify with config files**
27
-
28
- | Check | Indicates |
29
- |-------|-----------|
30
- | `pubspec.yaml` exists | Flutter |
31
- | `package.json` has `"react"` or `"next"` | React/Next.js |
32
- | `package.json` has `"react-native"` | React Native |
33
- | `package.json` has `"vue"` | Vue |
34
-
35
- **Step 3: Determine file locations**
36
-
37
- | Framework | Override File | Import Pattern |
38
- |-----------|---------------|----------------|
39
- | Flutter | `lib/test_overrides.dart` | `import 'package:{app}/test_overrides.dart';` |
40
- | React/Next.js | `src/testOverrides.ts` | `import { testOverrides } from '@/testOverrides';` |
41
- | React Native | `src/testOverrides.ts` | `import { testOverrides } from '../testOverrides';` |
42
- | Vue | `src/testOverrides.ts` | `import { testOverrides } from '@/testOverrides';` |
43
-
44
- </framework_detection>
45
-
46
- <override_file_pattern>
47
-
48
- **Structure:**
49
-
50
- ```
51
- // Test Overrides - DELETE THIS FILE BEFORE COMMITTING
52
- // Used for manual UAT testing only
53
-
54
- // === STATE FLAGS ===
55
- // Set to true to enable mock state
56
-
57
- {flag declarations based on mock_type}
58
-
59
- // === MOCK DATA ===
60
- // Returned when flags are true
61
-
62
- {mock data structures}
63
-
64
- // === RESET ===
65
- // Call to disable all overrides
66
-
67
- {reset function}
68
- ```
69
-
70
- **Flag naming convention:**
71
- - `force{State}` for boolean flags (e.g., `forcePremiumUser`, `forceErrorState`)
72
- - `mock{DataType}` for mock data (e.g., `mockUserData`, `mockErrorMessage`)
73
-
74
- </override_file_pattern>
75
-
76
- <production_hook_pattern>
77
-
78
- **Minimal hooks at service/repository layer:**
79
-
80
- ```
81
- // Check override BEFORE real implementation
82
- if (testOverrides.force{State}) {
83
- return testOverrides.mock{Data};
84
- }
85
-
86
- // Real implementation continues here...
87
- ```
88
-
89
- **Placement:**
90
- - In services/repositories, not UI components
91
- - At the data fetch point, not the render point
92
- - Single if-check, no complex branching
93
-
94
- **Marking:**
95
- ```
96
- // TEST OVERRIDE - Remove before commit
97
- if (testOverrides.forceError) {
98
- throw testOverrides.mockError;
99
- }
100
- ```
101
-
102
- </production_hook_pattern>
103
-
104
- <mock_types>
105
-
106
- Common mock types and what they enable:
107
-
108
- | Mock Type | Enables Testing | Typical Flags |
109
- |-----------|-----------------|---------------|
110
- | `error_state` | Error messages, retry UI, fallback displays | `forceError`, `mockErrorMessage` |
111
- | `premium_user` | Premium badges, gated features, upgrade prompts | `forcePremium`, `mockPremiumData` |
112
- | `empty_response` | Empty states, placeholder UI, "no results" | `forceEmpty` |
113
- | `loading_state` | Loading spinners, skeleton screens | `forceLoading`, `mockLoadingDelay` |
114
- | `offline` | Offline UI, cached data, sync indicators | `forceOffline` |
115
- | `transient_state` | Brief async states (loading skeletons, transitions) | `forceTransient`, `mockTransientDelay` |
116
- | `external_data` | Features depending on API data that may not exist locally | `forceMockData`, `mockDataSet` |
117
-
118
- </mock_types>
119
-
120
- <transient_state_patterns>
121
-
122
- **Transient states are UI states that appear briefly during async operations.** Loading skeletons, shimmer effects, transition animations — they resolve too fast to observe and test manually.
123
-
124
- **Two mock strategies:**
125
-
126
- **1. Extended delay strategy (default):**
127
-
128
- Add a configurable delay before the real data returns. The transient state stays visible long enough to test.
129
-
130
- ```dart
131
- // Flutter — Completer-based delay
132
- Future<List<Recipe>> getRecipes() async {
133
- // TEST OVERRIDE - Extend loading state for testing
134
- if (TestOverrides.forceTransientState) {
135
- await Future.delayed(TestOverrides.mockTransientDelay); // default 5s
136
- }
137
- // Real implementation continues...
138
- final response = await _api.get('/recipes');
139
- return response.data.map((j) => Recipe.fromJson(j)).toList();
140
- }
141
- ```
142
-
143
- ```typescript
144
- // React/Next.js — Promise delay
145
- async function getRecipes(): Promise<Recipe[]> {
146
- // TEST OVERRIDE - Extend loading state for testing
147
- if (testOverrides.forceTransientState) {
148
- await new Promise(resolve => setTimeout(resolve, testOverrides.mockTransientDelayMs));
149
- }
150
- // Real implementation continues...
151
- const response = await fetch('/api/recipes');
152
- return response.json();
153
- }
154
- ```
155
-
156
- **When to use:** Testing that the loading UI (skeleton, spinner) displays correctly while waiting.
157
-
158
- **2. Never-resolve strategy:**
159
-
160
- The async call never completes. The transient state stays permanently visible.
161
-
162
- ```dart
163
- // Flutter — Completer that never completes
164
- Future<List<Recipe>> getRecipes() async {
165
- // TEST OVERRIDE - Never resolve, keep loading state visible
166
- if (TestOverrides.forceTransientState && TestOverrides.mockTransientDelay == Duration.zero) {
167
- await Completer<void>().future; // Never completes
168
- }
169
- // Real implementation continues...
170
- }
171
- ```
172
-
173
- ```typescript
174
- // JS — Promise that never resolves
175
- async function getRecipes(): Promise<Recipe[]> {
176
- // TEST OVERRIDE - Never resolve, keep loading state visible
177
- if (testOverrides.forceTransientState && testOverrides.mockTransientDelayMs === 0) {
178
- await new Promise(() => {}); // Never resolves
179
- }
180
- // Real implementation continues...
181
- }
182
- ```
183
-
184
- **When to use:** Testing that the loading UI itself is correct (layout, styling, animation) without it disappearing.
185
-
186
- **Choosing between strategies:**
187
- - Testing the transition (loading → loaded): Use extended delay (5s default)
188
- - Testing the loading UI appearance: Use never-resolve (set delay to 0)
189
-
190
- </transient_state_patterns>
191
-
192
- <toggle_instructions_template>
193
-
194
- **Format for each mock state:**
195
-
196
- ```markdown
197
- **To enable {state_name}:**
198
- 1. Open `{override_file_path}`
199
- 2. Set `{flag_name} = true`
200
- 3. {Hot reload command or restart instruction}
201
- 4. Verify: {What user should see to confirm mock is active}
202
-
203
- **To disable:**
204
- 1. Set `{flag_name} = false`
205
- 2. {Hot reload / restart}
206
- ```
207
-
208
- **Framework-specific apply instructions:**
209
-
210
- | Framework | Apply Changes |
211
- |-----------|---------------|
212
- | Flutter | Hot reload (r in terminal) or hot restart (R) |
213
- | React/Next.js (dev) | Auto hot reload on save |
214
- | React Native | Shake device → Reload, or `r` in Metro |
215
- | Vue (dev) | Auto hot reload on save |
216
-
217
- </toggle_instructions_template>
218
-
219
- <spawn_mock_generator>
220
-
221
- When verify-work needs mocks:
222
-
223
- ```
224
- Task(
225
- prompt="""
226
- You are generating test mocks for manual UI verification.
227
-
228
- ## Context
229
-
230
- Project type: {detected_framework}
231
- Phase: {phase_name}
232
- Mock type needed: {mock_type}
233
-
234
- ## Tests requiring this mock
235
-
236
- {test_list_with_expected_behavior}
237
-
238
- ## Requirements
239
-
240
- 1. Create override file at standard location for this framework
241
- 2. Add minimal hooks to relevant services (if needed)
242
- 3. Provide clear toggle instructions
243
- 4. Write all files to disk
244
-
245
- Follow the patterns from @~/.claude/mindsystem/workflows/generate-mocks.md
246
- """,
247
- subagent_type="ms-mock-generator",
248
- description="Generate {mock_type} mocks"
249
- )
250
- ```
251
-
252
- </spawn_mock_generator>
253
-
254
- <success_criteria>
255
- - [ ] Framework correctly detected
256
- - [ ] Override file created at standard location
257
- - [ ] Minimal hooks added (only if needed)
258
- - [ ] Toggle instructions clear and complete
259
- - [ ] Files written to disk (uncommitted)
260
- - [ ] Easy to remove (clear cleanup path)
261
- </success_criteria>