mindsystem-cc 3.20.0 → 3.22.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 (113) hide show
  1. package/README.md +9 -18
  2. package/agents/ms-mockup-designer.md +1 -1
  3. package/agents/ms-plan-checker.md +30 -30
  4. package/agents/ms-plan-writer.md +1 -1
  5. package/agents/ms-product-researcher.md +71 -0
  6. package/agents/ms-research-synthesizer.md +1 -1
  7. package/agents/ms-researcher.md +8 -8
  8. package/agents/ms-roadmapper.md +9 -13
  9. package/agents/ms-verifier.md +25 -117
  10. package/bin/install.js +68 -5
  11. package/commands/ms/add-phase.md +7 -8
  12. package/commands/ms/add-todo.md +3 -4
  13. package/commands/ms/adhoc.md +4 -5
  14. package/commands/ms/audit-milestone.md +15 -14
  15. package/commands/ms/complete-milestone.md +27 -24
  16. package/commands/ms/config.md +229 -0
  17. package/commands/ms/create-roadmap.md +3 -4
  18. package/commands/ms/debug.md +3 -4
  19. package/commands/ms/design-phase.md +11 -13
  20. package/commands/ms/discuss-phase.md +26 -22
  21. package/commands/ms/doctor.md +28 -205
  22. package/commands/ms/execute-phase.md +20 -12
  23. package/commands/ms/help.md +46 -39
  24. package/commands/ms/insert-phase.md +6 -7
  25. package/commands/ms/map-codebase.md +1 -2
  26. package/commands/ms/new-milestone.md +41 -19
  27. package/commands/ms/new-project.md +56 -47
  28. package/commands/ms/plan-milestone-gaps.md +7 -9
  29. package/commands/ms/plan-phase.md +4 -5
  30. package/commands/ms/progress.md +3 -4
  31. package/commands/ms/remove-phase.md +3 -4
  32. package/commands/ms/research-phase.md +11 -16
  33. package/commands/ms/research-project.md +19 -26
  34. package/commands/ms/review-design.md +4 -2
  35. package/commands/ms/verify-work.md +6 -8
  36. package/mindsystem/references/continuation-format.md +3 -3
  37. package/mindsystem/references/principles.md +1 -1
  38. package/mindsystem/references/routing/audit-result-routing.md +12 -11
  39. package/mindsystem/references/routing/between-milestones-routing.md +2 -2
  40. package/mindsystem/references/routing/milestone-complete-routing.md +1 -1
  41. package/mindsystem/references/routing/next-phase-routing.md +4 -2
  42. package/mindsystem/references/verification-patterns.md +0 -37
  43. package/mindsystem/templates/config.json +2 -1
  44. package/mindsystem/templates/context.md +7 -6
  45. package/mindsystem/templates/milestone-archive.md +5 -5
  46. package/mindsystem/templates/milestone-context.md +1 -1
  47. package/mindsystem/templates/milestone.md +9 -9
  48. package/mindsystem/templates/project.md +2 -2
  49. package/mindsystem/templates/research-subagent-prompt.md +3 -3
  50. package/mindsystem/templates/roadmap-milestone.md +14 -14
  51. package/mindsystem/templates/roadmap.md +10 -8
  52. package/mindsystem/templates/state.md +2 -2
  53. package/mindsystem/templates/verification-report.md +3 -26
  54. package/mindsystem/workflows/adhoc.md +1 -1
  55. package/mindsystem/workflows/complete-milestone.md +40 -75
  56. package/mindsystem/workflows/discuss-phase.md +141 -65
  57. package/mindsystem/workflows/doctor-fixes.md +273 -0
  58. package/mindsystem/workflows/execute-phase.md +9 -21
  59. package/mindsystem/workflows/execute-plan.md +3 -0
  60. package/mindsystem/workflows/map-codebase.md +6 -12
  61. package/mindsystem/workflows/mockup-generation.md +47 -23
  62. package/mindsystem/workflows/plan-phase.md +13 -6
  63. package/mindsystem/workflows/transition.md +2 -2
  64. package/mindsystem/workflows/verify-work.md +97 -70
  65. package/package.json +1 -1
  66. package/scripts/__pycache__/ms-tools.cpython-314.pyc +0 -0
  67. package/scripts/__pycache__/test_ms_tools.cpython-314-pytest-9.0.2.pyc +0 -0
  68. package/scripts/fixtures/scan-context/.planning/ROADMAP.md +16 -0
  69. package/scripts/fixtures/scan-context/.planning/adhoc/20260220-fix-token-SUMMARY.md +12 -0
  70. package/scripts/fixtures/scan-context/.planning/config.json +3 -0
  71. package/scripts/fixtures/scan-context/.planning/debug/resolved/token-bug.md +11 -0
  72. package/scripts/fixtures/scan-context/.planning/knowledge/auth.md +11 -0
  73. package/scripts/fixtures/scan-context/.planning/phases/02-infra/02-1-SUMMARY.md +20 -0
  74. package/scripts/fixtures/scan-context/.planning/phases/04-setup/04-1-SUMMARY.md +21 -0
  75. package/scripts/fixtures/scan-context/.planning/phases/05-auth/05-1-SUMMARY.md +28 -0
  76. package/scripts/fixtures/scan-context/.planning/todos/done/setup-db.md +10 -0
  77. package/scripts/fixtures/scan-context/.planning/todos/pending/add-logout.md +10 -0
  78. package/scripts/fixtures/scan-context/expected-output.json +257 -0
  79. package/scripts/ms-tools.py +2884 -0
  80. package/scripts/test_ms_tools.py +1622 -0
  81. package/agents/ms-flutter-code-quality.md +0 -169
  82. package/agents/ms-flutter-reviewer.md +0 -211
  83. package/agents/ms-flutter-simplifier.md +0 -79
  84. package/commands/ms/list-phase-assumptions.md +0 -56
  85. package/mindsystem/workflows/list-phase-assumptions.md +0 -178
  86. package/mindsystem/workflows/verify-phase.md +0 -625
  87. package/scripts/__pycache__/compare_mockups.cpython-314.pyc +0 -0
  88. package/scripts/archive-milestone-files.sh +0 -68
  89. package/scripts/archive-milestone-phases.sh +0 -138
  90. package/scripts/doctor-scan.sh +0 -402
  91. package/scripts/gather-milestone-stats.sh +0 -179
  92. package/scripts/generate-adhoc-patch.sh +0 -79
  93. package/scripts/generate-phase-patch.sh +0 -169
  94. package/scripts/scan-artifact-subsystems.sh +0 -55
  95. package/scripts/scan-planning-context.py +0 -839
  96. package/scripts/update-state.sh +0 -59
  97. package/scripts/validate-execution-order.sh +0 -104
  98. package/skills/flutter-code-quality/SKILL.md +0 -143
  99. package/skills/flutter-code-simplification/SKILL.md +0 -102
  100. package/skills/flutter-senior-review/AGENTS.md +0 -869
  101. package/skills/flutter-senior-review/SKILL.md +0 -205
  102. package/skills/flutter-senior-review/principles/dependencies-data-not-callbacks.md +0 -75
  103. package/skills/flutter-senior-review/principles/dependencies-provider-tree.md +0 -85
  104. package/skills/flutter-senior-review/principles/dependencies-temporal-coupling.md +0 -97
  105. package/skills/flutter-senior-review/principles/pragmatism-consistent-error-handling.md +0 -130
  106. package/skills/flutter-senior-review/principles/pragmatism-speculative-generality.md +0 -91
  107. package/skills/flutter-senior-review/principles/state-data-clumps.md +0 -64
  108. package/skills/flutter-senior-review/principles/state-invalid-states.md +0 -53
  109. package/skills/flutter-senior-review/principles/state-single-source-of-truth.md +0 -68
  110. package/skills/flutter-senior-review/principles/state-type-hierarchies.md +0 -75
  111. package/skills/flutter-senior-review/principles/structure-composition-over-config.md +0 -105
  112. package/skills/flutter-senior-review/principles/structure-shared-visual-patterns.md +0 -107
  113. package/skills/flutter-senior-review/principles/structure-wrapper-pattern.md +0 -90
@@ -96,18 +96,12 @@ Write these documents to .planning/codebase/:
96
96
  - STACK.md - Languages, runtime, frameworks, dependencies, configuration
97
97
  - INTEGRATIONS.md - External APIs, databases, auth providers, webhooks
98
98
 
99
- After writing STACK.md, update config.json code_review fields with the appropriate agent names:
100
- 1. Read STACK.md to detect primary framework
101
- 2. Map framework to code review agent names:
102
- - Flutter/Dart:
103
- - adhoc: "ms-flutter-simplifier"
104
- - phase: "ms-flutter-simplifier"
105
- - milestone: "ms-flutter-reviewer"
106
- - All others (React, Next.js, Node, Swift, Kotlin, etc.):
107
- - adhoc: "ms-code-simplifier"
108
- - phase: "ms-code-simplifier"
109
- - milestone: (leave as null — runtime defaults to ms-flutter-reviewer)
110
- 3. If .planning/config.json exists: update all three code_review fields
99
+ After writing STACK.md, update config.json code_review fields with the default agent names:
100
+ 1. Default for all frameworks:
101
+ - adhoc: "ms-code-simplifier"
102
+ - phase: "ms-code-simplifier"
103
+ - milestone: null
104
+ 2. If .planning/config.json exists: update all three code_review fields
111
105
  If not: note the recommended code review agents for later config creation
112
106
 
113
107
  Explore thoroughly. Write documents directly using templates. Return confirmation only.
@@ -6,8 +6,6 @@ Called by design-phase command (step 4b) when user opts into mockup generation.
6
6
 
7
7
  <required_reading>
8
8
  @~/.claude/mindsystem/references/design-directions.md
9
- @~/.claude/mindsystem/templates/mockup-mobile.md (if mobile)
10
- @~/.claude/mindsystem/templates/mockup-web.md (if web)
11
9
  </required_reading>
12
10
 
13
11
  <process>
@@ -82,17 +80,18 @@ Extract the HTML scaffold from the `<template>` block.
82
80
  <step name="spawn_agents">
83
81
  ```bash
84
82
  PHASE_DIR=$(ls -d .planning/phases/${PHASE}-* 2>/dev/null | head -1)
83
+ # Assumes single match. If empty, phase directory is missing — stop and report.
85
84
  mkdir -p "${PHASE_DIR}/mockups"
86
85
  ```
87
86
 
88
87
  Spawn 3 ms-mockup-designer agents IN PARALLEL, each receiving:
89
- - `<product_context>` — From PROJECT.md
90
- - `<phase_context>` — From ROADMAP.md phase entry
91
- - `<design_direction>` — One of the 3 derived directions (name, philosophy, concrete choices)
92
- - `<platform>` — `mobile` or `web`
93
- - `<feature_grounding>` — The screen/feature being mocked
94
- - `<existing_aesthetic>` — Colors/fonts from project UI skill or codebase (if exists)
95
- - `<mockup_template>` — The HTML scaffold from the template file
88
+ - `<product_context>` — from PROJECT.md "What This Is" section
89
+ - `<phase_context>` — from ROADMAP.md phase entry
90
+ - `<design_direction>` — one of the 3 directions from `derive_directions` (name, philosophy, concrete choices)
91
+ - `<platform>` — `mobile` or `web` from `determine_platform`
92
+ - `<feature_grounding>` — screen/feature identified in `identify_primary_screen`
93
+ - `<existing_aesthetic>` — from project UI skill (`SKILL.md` with design tokens) if exists, else scan codebase theme/style files for colors and fonts. If greenfield, state "No existing aesthetic."
94
+ - `<mockup_template>` — HTML scaffold from `read_template`
96
95
  - Output path: `.planning/phases/{phase}-{slug}/mockups/variant-a.html` (b, c for others)
97
96
 
98
97
  ```
@@ -106,14 +105,25 @@ Task(prompt=assembled_context, subagent_type="ms-mockup-designer", description="
106
105
  After all 3 agents return, run the comparison script to create the comparison page. Do NOT generate comparison HTML manually — use the script:
107
106
 
108
107
  ```bash
109
- uv run ~/.claude/mindsystem/scripts/compare_mockups.py "${PHASE_DIR}/mockups"
110
- open "${PHASE_DIR}/mockups/comparison.html"
108
+ ms-compare-mockups "${PHASE_DIR}/mockups"
111
109
  ```
112
110
 
113
- Display summary:
111
+ Read the `open_mockups` config setting:
112
+
113
+ ```bash
114
+ OPEN_MOCKUPS=$(cat .planning/config.json 2>/dev/null | jq -r '.open_mockups // "auto"')
115
+ ```
116
+
117
+ Branch on the value:
118
+
119
+ - **`"auto"` (default):** Run `open "${PHASE_DIR}/mockups/comparison.html"`. Display summary with "comparison page opened in browser."
120
+ - **`"ask"`:** Display summary with "comparison page ready." Ask "Open mockup comparison in browser?" (Yes/No). If Yes, run `open`.
121
+ - **`"off"`:** Display summary with explicit comparison page path. No open.
122
+
123
+ **Summary template** (adapt first line per branch above):
114
124
 
115
125
  ```markdown
116
- 3 mockup variants generated — comparison page opened in browser.
126
+ 3 mockup variants generated — {status line from branch}.
117
127
 
118
128
  Individual variants for reference:
119
129
  - **A: {Direction A name}** — `.planning/phases/{phase}-{slug}/mockups/variant-a.html`
@@ -121,7 +131,7 @@ Individual variants for reference:
121
131
  - **C: {Direction C name}** — `.planning/phases/{phase}-{slug}/mockups/variant-c.html`
122
132
  ```
123
133
 
124
- Use AskUserQuestion:
134
+ **After displaying summary**, use AskUserQuestion:
125
135
  > "Which direction works best?"
126
136
  > 1. **A: {name}** — Use this direction
127
137
  > 2. **B: {name}** — Use this direction
@@ -145,15 +155,29 @@ Handle user response:
145
155
  </step>
146
156
 
147
157
  <step name="extract_specs">
148
- Read the chosen HTML file. Extract from the inline CSS:
149
- - Direction name and description (from the derived direction that was selected)
150
- - Color palette — `background`, `color`, CSS custom properties, repeated accent values
151
- - Layout structure — container arrangement (sidebar/topnav/stacked, grid/list)
152
- - Typography `font-size`, `font-weight`, `line-height` from headings and body
153
- - Spacing `padding`, `gap`, `margin` values used consistently
154
- - User preferences (any specific feedback from selection)
155
-
156
- Assemble into a `<mockup_direction>` block for ms-designer. See the `<mockup_direction>` template in `design-phase.md` step 5 for the expected format.
158
+ Read the chosen HTML file. Extract from the inline CSS and assemble into a `<mockup_direction>` block with this exact structure:
159
+
160
+ ```xml
161
+ <mockup_direction>
162
+ Direction: [chosen direction name]
163
+ Philosophy: [direction one-sentence philosophy]
164
+
165
+ Color palette:
166
+ [Extracted hex values background, text, accent, secondary from `background`, `color`, CSS custom properties, repeated accent values]
167
+
168
+ Layout structure:
169
+ [Container arrangement from CSS — sidebar/topnav/stacked, grid/list]
170
+
171
+ Typography:
172
+ [`font-size`, `font-weight`, `line-height` from headings and body]
173
+
174
+ Spacing:
175
+ [`padding`, `gap`, `margin` values used consistently]
176
+
177
+ User preferences:
178
+ [Any specific feedback from mockup selection — "I liked X but want Y changed"]
179
+ </mockup_direction>
180
+ ```
157
181
 
158
182
  Return this block to the design-phase orchestrator.
159
183
  </step>
@@ -277,7 +277,7 @@ PHASE_NAME=$(grep -A2 "Phase ${PHASE}:" .planning/ROADMAP.md 2>/dev/null | head
277
277
  **2. Run context scanner:**
278
278
 
279
279
  ```bash
280
- uv run ~/.claude/mindsystem/scripts/scan-planning-context.py \
280
+ ms-tools scan-planning-context \
281
281
  --phase "${PHASE}" \
282
282
  --phase-name "${PHASE_NAME}" \
283
283
  ${SUBSYSTEM:+--subsystem="${SUBSYSTEM}"}
@@ -447,9 +447,15 @@ Tasks: {task_ids} — {brief rationale}
447
447
  **Waves:** {wave structure}
448
448
  ```
449
449
 
450
- The user may adjust, merge, or split plans. Once confirmed (or if the user proceeds without objection), pass the proposed grouping to the plan-writer.
451
-
452
450
  **TDD plans are always standalone** — propose them as dedicated plans regardless of budget.
451
+
452
+ **Confirm via AskUserQuestion:**
453
+ - header: "Plan Structure"
454
+ - question: "Does this plan structure look good?"
455
+ - Options: "Looks good, proceed", "Adjust grouping"
456
+
457
+ **"Looks good, proceed":** Continue to discover_skills.
458
+ **"Adjust grouping":** User describes changes in free-text. Apply adjustments, re-present, and confirm again.
453
459
  </step>
454
460
 
455
461
  <step name="discover_skills">
@@ -462,9 +468,10 @@ After the user confirms the plan structure, check if project skills could improv
462
468
  - The domain of the tasks identified (UI patterns, API design, state management, etc.)
463
469
  - Keywords from RESEARCH.md or CONTEXT.md if they exist
464
470
 
465
- **If matches found:** Present via AskUserQuestion:
466
- - List each matching skill with its description
467
- - Always include an escape hatch option for the user to name skills manually or skip entirely
471
+ **If matches found:** Present via AskUserQuestion with `multiSelect: true`:
472
+ - Each matching skill is one option (label: skill name, description: what it provides)
473
+ - Always include a "None skip skill loading" option
474
+ - User selects which to load, skips, or types a skill name in the free-text field
468
475
 
469
476
  **If no matches:** Skip silently — no need to ask the user.
470
477
 
@@ -400,12 +400,12 @@ Exit skill and invoke SlashCommand("/ms:plan-phase [X+1]")
400
400
  ```
401
401
  Phase {X} marked complete.
402
402
 
403
- 🎉 Milestone {version} is 100% complete — all {N} phases finished!
403
+ 🎉 Milestone is 100% complete — all {N} phases finished!
404
404
 
405
405
  ⚡ Auto-continuing: Complete milestone and archive
406
406
  ```
407
407
 
408
- Exit skill and invoke SlashCommand("/ms:complete-milestone {version}")
408
+ Exit skill and invoke SlashCommand("/ms:complete-milestone")
409
409
 
410
410
  </step>
411
411
 
@@ -175,21 +175,27 @@ Each batch has: batch number, name, mock_type, and test list.
175
175
  </step>
176
176
 
177
177
  <step name="create_uat_file">
178
- **Create UAT file:**
178
+ **Create UAT file via ms-tools:**
179
+
180
+ Construct JSON from classified tests and batch data, pipe to `uat-init`:
179
181
 
180
182
  ```bash
181
- mkdir -p "$PHASE_DIR"
183
+ ms-tools uat-init $PHASE_NUMBER <<'EOF'
184
+ {"source":["XX-01-SUMMARY.md"],"tests":[{"name":"...","expected":"...","mock_required":false,"mock_type":null}],"batches":[{"name":"No Mocks","mock_type":null,"tests":[1,2]}]}
185
+ EOF
182
186
  ```
183
187
 
184
- Create file at `.planning/phases/XX-name/{phase}-UAT.md` following the template structure in context. Populate with classified tests and batch data from previous steps.
188
+ - `source`: list of SUMMARY.md filenames tested
189
+ - `tests`: array of `{name, expected, mock_required, mock_type}` from classification
190
+ - `batches`: array of `{name, mock_type, tests: [nums]}` from batch grouping
185
191
 
186
- Proceed to `execute_batch`.
192
+ stdout confirms path and counts. Proceed to `execute_batch`.
187
193
  </step>
188
194
 
189
195
  <step name="execute_batch">
190
196
  **Execute current batch:**
191
197
 
192
- Read current batch from UAT.md.
198
+ Read current batch from UAT.md (test descriptions needed for presenting to user).
193
199
 
194
200
  **1. Handle mock generation (if needed):**
195
201
 
@@ -198,7 +204,7 @@ If `mock_type` is not null AND different from previous batch:
198
204
  ```bash
199
205
  git checkout -- <mocked_files>
200
206
  ```
201
- - Clear `mocked_files` in frontmatter
207
+ - Clear mocked_files: `ms-tools uat-update $PHASE_NUMBER --session mocked_files=`
202
208
  - Go to `generate_mocks`
203
209
 
204
210
  If `mock_type` is null or same as previous:
@@ -314,11 +320,24 @@ For each question:
314
320
  | color, font, spacing, alignment, visual | cosmetic |
315
321
  | Default | major |
316
322
 
317
- **Update UAT.md after processing all responses in batch:**
318
- - Update each test's result
319
- - Update Progress counts
320
- - Update Batches section
321
- - Update timestamp
323
+ **Update UAT.md via ms-tools after processing each response:**
324
+
325
+ ```bash
326
+ # Pass:
327
+ ms-tools uat-update $PHASE_NUMBER --test N result=pass
328
+
329
+ # Blocked:
330
+ ms-tools uat-update $PHASE_NUMBER --test N result=blocked
331
+
332
+ # Skipped:
333
+ ms-tools uat-update $PHASE_NUMBER --test N result=skipped
334
+ echo '{"test":N,"name":"...","expected":"...","reason":"..."}' | ms-tools uat-update $PHASE_NUMBER --append-assumption
335
+
336
+ # Issue:
337
+ ms-tools uat-update $PHASE_NUMBER --test N result=issue reported="user description" severity=major fix_status=investigating retry_count=0
338
+ ```
339
+
340
+ Progress auto-recalculates on every `uat-update` call. No manual progress recalculation needed.
322
341
 
323
342
  **For each issue found:** Go to `investigate_issue` before processing next test.
324
343
  </step>
@@ -372,21 +391,31 @@ Use `mocked_files` list from UAT.md frontmatter.
372
391
  - Edit the file(s)
373
392
  - Test that fix compiles/runs
374
393
 
375
- **3. Commit with proper message:**
394
+ **3. Commit (amend on retry when safe):**
376
395
  ```bash
377
396
  git add [specific files]
378
- git commit -m "fix({phase}-uat): {description}"
397
+
398
+ # Check if this is a retry AND HEAD matches the test's previous fix_commit:
399
+ PREV_FIX=$(ms-tools uat-status $PHASE_NUMBER | python3 -c "import sys,json; d=json.load(sys.stdin); t=[x for x in d['fixing_tests'] if x['num']==N]; print(t[0].get('fix_commit','') if t else '')" 2>/dev/null)
400
+ HEAD_SHORT=$(git rev-parse --short HEAD)
401
+
402
+ if [ "$PREV_FIX" = "$HEAD_SHORT" ] && [ -n "$PREV_FIX" ]; then
403
+ git commit --amend --no-edit
404
+ else
405
+ git commit -m "fix({phase}-uat): {description}"
406
+ fi
379
407
  ```
380
408
 
381
- **4. Record in UAT.md:**
382
- - Update test: `fix_status: applied`, `fix_commit: {hash}`
383
- - Append to Fixes Applied section:
384
- ```yaml
385
- - commit: {hash}
386
- test: {N}
387
- description: "{what was fixed}"
388
- files: [{changed files}]
389
- ```
409
+ Safety: only amend if HEAD matches recorded fix_commit. If HEAD has moved (other fixes in between), create new commit.
410
+
411
+ **4. Record in UAT.md via ms-tools:**
412
+ ```bash
413
+ FIX_HASH=$(git rev-parse --short HEAD)
414
+ ms-tools uat-update $PHASE_NUMBER --test N fix_status=applied fix_commit=$FIX_HASH
415
+ echo '{"commit":"'$FIX_HASH'","test":N,"description":"what was fixed","files":["changed.ts"]}' | ms-tools uat-update $PHASE_NUMBER --append-fix
416
+ ```
417
+
418
+ `append-fix` updates in-place if a fix for the same test already exists (amend support).
390
419
 
391
420
  **5. Restore mocks:**
392
421
  ```bash
@@ -459,7 +488,7 @@ Mocks are stashed — working tree is clean.
459
488
  **3. Handle fixer return:**
460
489
 
461
490
  **If FIX COMPLETE:**
462
- - Update UAT.md with fix details
491
+ - Record fix via ms-tools (same as `apply_fix` step 4: `uat-update --test N` + `--append-fix`)
463
492
  - Restore mocks: `git stash pop`
464
493
  - Handle conflicts as in `apply_fix`
465
494
  - Request re-test
@@ -484,11 +513,15 @@ Mocks are stashed — working tree is clean.
484
513
  AskUserQuestion: Pass / Still broken / New issue.
485
514
 
486
515
  **If Pass:**
487
- - Update test: `result: pass`, `fix_status: verified`
516
+ ```bash
517
+ ms-tools uat-update $PHASE_NUMBER --test N result=pass fix_status=verified
518
+ ```
488
519
  - Continue to next issue or next batch
489
520
 
490
521
  **If Still broken (retry_count < 2):**
491
- - Increment `retry_count` in UAT.md test entry
522
+ ```bash
523
+ ms-tools uat-update $PHASE_NUMBER --test N retry_count=1
524
+ ```
492
525
  - Go back to `investigate_issue` with new context
493
526
 
494
527
  **If Still broken (retry_count >= 2):**
@@ -513,7 +546,12 @@ AskUserQuestion: Pass / Still broken / New issue.
513
546
  <step name="resume_from_file">
514
547
  **Resume testing from UAT file:**
515
548
 
516
- Read full UAT file.
549
+ Use `uat-status` for compact status determination:
550
+ ```bash
551
+ ms-tools uat-status $PHASE_NUMBER
552
+ ```
553
+
554
+ Returns JSON with: `status`, `current_batch`, `total_batches`, `progress`, `mocked_files`, `fixing_tests`, `pending_tests`, `blocked_tests`, `pre_work_stash`, `path`.
517
555
 
518
556
  Check `mocked_files` — if non-empty, verify mocks are still present:
519
557
  ```bash
@@ -522,19 +560,17 @@ git diff --name-only
522
560
  If mocked files have uncommitted changes, mocks are still active — continue.
523
561
  If mocked files are clean, mocks were lost — regenerate for current batch.
524
562
 
525
- Find current position:
526
- - current_batch
527
- - Tests with `[pending]` or `blocked` or `fixing` status
563
+ Read full UAT.md only if test descriptions needed (for re-presenting tests to user).
528
564
 
529
565
  Announce:
530
566
  ```
531
567
  Resuming: Phase {phase} UAT
532
- Batch: {current} of {total}
568
+ Batch: {current_batch} of {total_batches}
533
569
  Progress: {tested}/{total}
534
570
  Issues being fixed: {fixing count}
535
571
  ```
536
572
 
537
- If `fix_status: fixing` exists, go to `handle_retest` for that issue.
573
+ If `fixing_tests` is non-empty, go to `handle_retest` for that issue.
538
574
  Otherwise, go to `execute_batch`.
539
575
  </step>
540
576
 
@@ -548,17 +584,15 @@ If blocked tests exist AND no issues remain in `fixing` status:
548
584
  - Re-present the blocked tests via `present_tests`
549
585
  - Blocked tests were waiting on other issues to be fixed first
550
586
 
551
- **2. Update Batches section (when no blocked tests remain):**
587
+ **2. Update batch and session via ms-tools (when no blocked tests remain):**
552
588
 
553
- ```yaml
554
- ### Batch {N}: [Name]
555
- tests: [...]
556
- status: complete
557
- mock_type: [...]
558
- passed: {count}
559
- issues: {count}
589
+ ```bash
590
+ ms-tools uat-update $PHASE_NUMBER --batch N status=complete passed=X issues=Y
591
+ ms-tools uat-update $PHASE_NUMBER --session current_batch=N+1
560
592
  ```
561
593
 
594
+ The `--session current_batch=N` call auto-syncs the Current Batch section with the new batch's info.
595
+
562
596
  **If more batches remain:**
563
597
  - Increment current_batch
564
598
  - Check if next batch needs different mock_type
@@ -580,7 +614,7 @@ Use `mocked_files` list from UAT.md frontmatter. Clear the list after reverting.
580
614
 
581
615
  **2. Generate UAT fixes patch (if fixes were made):**
582
616
  ```bash
583
- ~/.claude/mindsystem/scripts/generate-phase-patch.sh ${PHASE_NUMBER} --suffix=uat-fixes
617
+ ms-tools generate-phase-patch ${PHASE_NUMBER} --suffix=uat-fixes
584
618
  ```
585
619
  Output: `.planning/phases/{phase_dir}/{phase}-uat-fixes.patch`
586
620
 
@@ -591,15 +625,12 @@ PRE_WORK_STASH=$(git stash list | grep "pre-verify-work" | head -1 | cut -d: -f1
591
625
  [ -n "$PRE_WORK_STASH" ] && git stash pop "$PRE_WORK_STASH"
592
626
  ```
593
627
 
594
- **4. Update UAT.md:**
595
- - status: complete
596
- - Clear current_batch, mocked_files
597
- - Final Progress counts
598
-
599
- **5. Commit UAT.md:**
628
+ **4. Update UAT.md and commit together with STATE.md:**
600
629
  ```bash
601
- git add ".planning/phases/XX-name/{phase}-UAT.md"
602
- git commit -m "test({phase}): complete UAT - {passed} passed, {fixed} fixed, {skipped} assumptions"
630
+ ms-tools uat-update $PHASE_NUMBER --session status=complete current_batch= mocked_files=
631
+ ms-tools set-last-command "ms:verify-work $ARGUMENTS"
632
+ git add "$PHASE_DIR/${PHASE}-UAT.md" .planning/STATE.md
633
+ git commit -m "test(${PHASE}): complete UAT - {passed} passed, {fixed} fixed, {skipped} assumptions"
603
634
  ```
604
635
 
605
636
  **5.5. Update knowledge pitfalls (lightweight):**
@@ -653,28 +684,24 @@ Check if more phases remain in ROADMAP.md:
653
684
  **Issue adds:** reported, severity, fix_status (investigating | applied | verified), fix_commit, retry_count
654
685
  **Skipped adds:** reason
655
686
 
656
- **Write UAT.md after:**
657
- - Each batch of responses processed
658
- - Each fix applied
659
- - Each re-test completed
660
- - Session complete
661
-
662
- | Section | Rule | When |
663
- |---------|------|------|
664
- | Frontmatter.status | OVERWRITE | Phase transitions |
665
- | Frontmatter.current_batch | OVERWRITE | Batch transitions |
666
- | Frontmatter.mocked_files | OVERWRITE | Mock generation/cleanup |
667
- | Frontmatter.pre_work_stash | OVERWRITE | Dirty tree handling |
668
- | Frontmatter.updated | OVERWRITE | Every write |
669
- | Progress | OVERWRITE | After each test result |
670
- | Current Batch | OVERWRITE | Batch transitions |
671
- | Tests.{N}.result | OVERWRITE | When user responds |
672
- | Tests.{N}.fix_status | OVERWRITE | During fix flow |
673
- | Tests.{N}.fix_commit | OVERWRITE | After fix committed |
674
- | Tests.{N}.retry_count | OVERWRITE | On re-test failure |
675
- | Fixes Applied | APPEND | After each fix committed |
676
- | Batches.{N}.status | OVERWRITE | Batch transitions |
677
- | Assumptions | APPEND | When test skipped |
687
+ **All UAT.md updates use ms-tools commands.** Never Read/Edit UAT.md manually for field updates.
688
+
689
+ | Trigger | Command |
690
+ |---------|---------|
691
+ | User responds to test | `ms-tools uat-update $PHASE --test N result=pass` |
692
+ | Issue found | `ms-tools uat-update $PHASE --test N result=issue severity=major fix_status=investigating retry_count=0` |
693
+ | Fix applied | `ms-tools uat-update $PHASE --test N fix_status=applied fix_commit=HASH` |
694
+ | Fix verified | `ms-tools uat-update $PHASE --test N result=pass fix_status=verified` |
695
+ | Re-test failed | `ms-tools uat-update $PHASE --test N retry_count=N` |
696
+ | Record fix | `echo '{"commit":"...","test":N,...}' \| ms-tools uat-update $PHASE --append-fix` |
697
+ | Test skipped | `ms-tools uat-update $PHASE --test N result=skipped` + `--append-assumption` |
698
+ | Batch complete | `ms-tools uat-update $PHASE --batch N status=complete passed=X issues=Y` |
699
+ | Batch transition | `ms-tools uat-update $PHASE --session current_batch=N` |
700
+ | Mock files changed | `ms-tools uat-update $PHASE --session mocked_files=a.dart,b.dart` |
701
+ | Session complete | `ms-tools uat-update $PHASE --session status=complete current_batch= mocked_files=` |
702
+ | Resume session | `ms-tools uat-status $PHASE` (read-only JSON) |
703
+
704
+ Progress auto-recalculates on every `uat-update` call. Timestamp auto-updates on every write.
678
705
  </update_rules>
679
706
 
680
707
  <severity_inference>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindsystem-cc",
3
- "version": "3.20.0",
3
+ "version": "3.22.0",
4
4
  "description": "A meta-prompting, context engineering and spec-driven development system for Claude Code by TÂCHES.",
5
5
  "bin": {
6
6
  "mindsystem-cc": "bin/install.js"
@@ -0,0 +1,16 @@
1
+ # Roadmap
2
+
3
+ ## Phase 02: Infrastructure
4
+ Database setup and core infrastructure.
5
+
6
+ ## Phase 03: Core Models
7
+ Data models and schemas.
8
+
9
+ ## Phase 04: Setup
10
+ Project configuration and tooling.
11
+
12
+ ## Phase 05: Authentication
13
+ User auth with JWT tokens.
14
+
15
+ ## Phase 06: UI
16
+ Frontend components and screens.
@@ -0,0 +1,12 @@
1
+ ---
2
+ subsystem: auth
3
+ learnings:
4
+ - Token expiry must account for clock skew
5
+ - Always validate token signature before checking claims
6
+ related_phase: "05-auth"
7
+ tags: [jwt, tokens]
8
+ ---
9
+
10
+ # Fix Token Validation
11
+
12
+ Fixed edge case where expired tokens passed validation due to clock skew.
@@ -0,0 +1,3 @@
1
+ {
2
+ "subsystems": ["auth", "database", "api"]
3
+ }
@@ -0,0 +1,11 @@
1
+ ---
2
+ subsystem: auth
3
+ root_cause: Clock skew between servers caused token validation to fail intermittently
4
+ resolution: Added 30-second leeway to token expiry check
5
+ tags: [jwt, timing]
6
+ phase: "05-auth"
7
+ ---
8
+
9
+ # Token Validation Bug
10
+
11
+ Intermittent auth failures due to clock skew between API servers.
@@ -0,0 +1,11 @@
1
+ # Auth Subsystem Knowledge
2
+
3
+ ## Authentication Flow
4
+ 1. User submits credentials to POST /api/auth/login
5
+ 2. Server validates with bcrypt
6
+ 3. JWT issued as httpOnly cookie
7
+ 4. Middleware validates on subsequent requests
8
+
9
+ ## Key Patterns
10
+ - Token rotation on refresh
11
+ - Clock skew leeway of 30 seconds
@@ -0,0 +1,20 @@
1
+ ---
2
+ phase: "02-infra"
3
+ subsystem: database
4
+ affects: []
5
+ requires: []
6
+ tags: [postgres, migrations]
7
+ tech-stack:
8
+ added: [postgres]
9
+ patterns: []
10
+ patterns-established: []
11
+ key-files:
12
+ created: [db/schema.sql]
13
+ modified: []
14
+ key-decisions:
15
+ - Use PostgreSQL for primary store
16
+ ---
17
+
18
+ # Phase 02 Plan 1 Summary
19
+
20
+ Set up database infrastructure with migrations.
@@ -0,0 +1,21 @@
1
+ ---
2
+ phase: "04-setup"
3
+ subsystem: api
4
+ affects: []
5
+ requires: []
6
+ tags: [jwt, config]
7
+ tech-stack:
8
+ added: [dotenv]
9
+ patterns: [env-config]
10
+ patterns-established:
11
+ - Config loading pattern
12
+ key-files:
13
+ created: [src/config.ts]
14
+ modified: [package.json]
15
+ key-decisions:
16
+ - Use dotenv for configuration
17
+ ---
18
+
19
+ # Phase 04 Plan 1 Summary
20
+
21
+ Project setup and configuration with JWT support.
@@ -0,0 +1,28 @@
1
+ ---
2
+ phase: "05-auth"
3
+ subsystem: auth
4
+ affects: ["06-ui"]
5
+ requires: ["04-setup"]
6
+ tags: [jwt, auth, tokens]
7
+ tech-stack:
8
+ added: [jose, bcrypt]
9
+ patterns: [jwt-auth]
10
+ patterns-established:
11
+ - JWT token rotation
12
+ - Password hashing with bcrypt
13
+ key-files:
14
+ created: [src/auth/login.ts, src/auth/middleware.ts]
15
+ modified: [src/config.ts]
16
+ key-decisions:
17
+ - JWT with httpOnly cookies
18
+ - bcrypt for password hashing
19
+ ---
20
+
21
+ # Phase 05 Plan 1 Summary
22
+
23
+ Authentication system with JWT and bcrypt.
24
+
25
+ ## Next Phase Readiness
26
+
27
+ - UI phase needs auth context provider
28
+ - Token refresh endpoint not yet implemented
@@ -0,0 +1,10 @@
1
+ ---
2
+ title: Set up database migrations
3
+ subsystem: database
4
+ priority: high
5
+ phase_origin: "02-infra"
6
+ ---
7
+
8
+ # Set Up Database Migrations
9
+
10
+ Configure migration tooling for PostgreSQL.
@@ -0,0 +1,10 @@
1
+ ---
2
+ title: Add logout endpoint
3
+ subsystem: auth
4
+ priority: medium
5
+ phase_origin: "05-auth"
6
+ ---
7
+
8
+ # Add Logout Endpoint
9
+
10
+ Implement POST /api/auth/logout to invalidate tokens.