mindsystem-cc 3.14.0 → 3.16.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 (48) hide show
  1. package/README.md +1 -0
  2. package/agents/ms-codebase-researcher.md +105 -0
  3. package/agents/ms-consolidator.md +137 -286
  4. package/agents/ms-debugger.md +1 -0
  5. package/agents/ms-designer.md +1 -0
  6. package/agents/ms-executor.md +2 -1
  7. package/agents/ms-flutter-reviewer.md +1 -0
  8. package/agents/ms-integration-checker.md +1 -0
  9. package/agents/ms-plan-checker.md +17 -327
  10. package/agents/ms-researcher.md +25 -343
  11. package/agents/ms-roadmapper.md +10 -75
  12. package/agents/ms-verifier.md +33 -309
  13. package/agents/ms-verify-fixer.md +1 -0
  14. package/commands/ms/check-phase.md +24 -55
  15. package/commands/ms/complete-milestone.md +6 -25
  16. package/commands/ms/create-roadmap.md +3 -15
  17. package/commands/ms/design-phase.md +34 -0
  18. package/commands/ms/discuss-phase.md +1 -9
  19. package/commands/ms/doctor.md +224 -0
  20. package/commands/ms/execute-phase.md +22 -12
  21. package/commands/ms/help.md +11 -0
  22. package/commands/ms/new-milestone.md +3 -3
  23. package/commands/ms/plan-phase.md +1 -1
  24. package/commands/ms/research-phase.md +249 -85
  25. package/commands/ms/verify-work.md +1 -0
  26. package/mindsystem/templates/context.md +1 -11
  27. package/mindsystem/templates/discovery.md +2 -3
  28. package/mindsystem/templates/knowledge.md +99 -0
  29. package/mindsystem/templates/requirements.md +3 -61
  30. package/mindsystem/templates/research-comparison-output.md +50 -0
  31. package/mindsystem/templates/research-feasibility-output.md +43 -0
  32. package/mindsystem/templates/research-project-output.md +81 -0
  33. package/mindsystem/templates/research-subagent-prompt.md +164 -48
  34. package/mindsystem/templates/roadmap-milestone.md +67 -0
  35. package/mindsystem/templates/roadmap.md +2 -66
  36. package/mindsystem/workflows/complete-milestone.md +23 -140
  37. package/mindsystem/workflows/define-requirements.md +4 -8
  38. package/mindsystem/workflows/discuss-phase.md +25 -8
  39. package/mindsystem/workflows/execute-phase.md +34 -0
  40. package/mindsystem/workflows/execute-plan.md +8 -0
  41. package/mindsystem/workflows/plan-phase.md +40 -102
  42. package/mindsystem/workflows/verify-work.md +20 -0
  43. package/package.json +1 -1
  44. package/scripts/cleanup-phase-artifacts.sh +68 -0
  45. package/scripts/scan-artifact-subsystems.sh +55 -0
  46. package/scripts/scan-planning-context.py +689 -0
  47. package/mindsystem/templates/decisions.md +0 -145
  48. package/mindsystem/templates/learnings.md +0 -150
@@ -13,9 +13,7 @@ Output: {phase}-CONTEXT.md capturing the user's vision for the phase
13
13
  </objective>
14
14
 
15
15
  <execution_context>
16
- @~/.claude/mindsystem/references/principles.md
17
16
  @~/.claude/mindsystem/workflows/discuss-phase.md
18
- @~/.claude/mindsystem/templates/context.md
19
17
  </execution_context>
20
18
 
21
19
  <context>
@@ -38,6 +36,7 @@ PHASE=$(printf "%02d" "$PHASE_ARG" 2>/dev/null || echo "$PHASE_ARG")
38
36
  1. Validate phase number argument (error if missing or invalid)
39
37
  2. Check if phase exists in roadmap
40
38
  3. Check if CONTEXT.md already exists (offer to update if yes)
39
+ 3.5. **Load prior knowledge** — determine relevant subsystem(s) by matching ROADMAP.md phase description against subsystem names in config.json. Load matching `.planning/knowledge/{subsystem}.md` files. If knowledge exists, present brief "What we know so far" summary before questioning.
41
40
  4. Follow discuss-phase.md workflow with **ALL questions using AskUserQuestion**:
42
41
  - Present phase from roadmap
43
42
  - Use AskUserQuestion: "How do you imagine this working?" with interpretation options
@@ -50,13 +49,6 @@ PHASE=$(printf "%02d" "$PHASE_ARG" 2>/dev/null || echo "$PHASE_ARG")
50
49
  - Format: `Last Command: ms:discuss-phase $ARGUMENTS | YYYY-MM-DD HH:MM`
51
50
 
52
51
  **CRITICAL: ALL questions use AskUserQuestion. Never ask inline text questions.**
53
-
54
- User is the visionary, you are the builder:
55
- - Ask about vision, feel, essential outcomes
56
- - DON'T ask about technical risks (you figure those out)
57
- - DON'T ask about codebase patterns (you read the code)
58
- - DON'T ask about success metrics (too corporate)
59
- - DON'T interrogate about constraints they didn't mention
60
52
  </process>
61
53
 
62
54
  <success_criteria>
@@ -0,0 +1,224 @@
1
+ ---
2
+ name: ms:doctor
3
+ description: Health check and fix project configuration
4
+ allowed-tools:
5
+ - Read
6
+ - Write
7
+ - Edit
8
+ - Bash
9
+ - Glob
10
+ - Grep
11
+ - AskUserQuestion
12
+ ---
13
+
14
+ <objective>
15
+ Run health checks on project configuration. Detect and fix configuration issues.
16
+
17
+ V1 check: subsystem vocabulary setup and validation. Ensures `.planning/config.json` has a canonical `subsystems` array and all artifacts use values from it.
18
+
19
+ Idempotent — safe to run repeatedly.
20
+ </objective>
21
+
22
+ <context>
23
+ @.planning/config.json
24
+ </context>
25
+
26
+ <process>
27
+
28
+ <step name="check_planning_dir">
29
+ ```bash
30
+ [ -d .planning ] && echo "EXISTS" || echo "MISSING"
31
+ ```
32
+
33
+ If MISSING:
34
+
35
+ ```
36
+ No .planning/ directory found.
37
+
38
+ Run `/ms:new-project` to initialize this project.
39
+ ```
40
+
41
+ Exit.
42
+ </step>
43
+
44
+ <step name="ensure_config">
45
+ ```bash
46
+ [ -f .planning/config.json ] && echo "EXISTS" || echo "MISSING"
47
+ ```
48
+
49
+ If MISSING, create from template structure:
50
+
51
+ ```json
52
+ {
53
+ "subsystems": [],
54
+ "code_review": {
55
+ "adhoc": null,
56
+ "phase": null,
57
+ "milestone": null
58
+ }
59
+ }
60
+ ```
61
+
62
+ Write to `.planning/config.json`. Log: "Created config.json with empty subsystems."
63
+
64
+ Proceed to next step.
65
+ </step>
66
+
67
+ <step name="read_current_subsystems">
68
+ ```bash
69
+ jq -r '.subsystems // [] | length' .planning/config.json
70
+ ```
71
+
72
+ - If 0 → **State A**: no subsystems configured. Go to `audit_existing_usage`.
73
+ - If >0 → **State B**: subsystems exist. Go to `validate_vocabulary`.
74
+ </step>
75
+
76
+ <step name="audit_existing_usage">
77
+ **State A only.** Scan all artifact types for existing free-form `subsystem:` values.
78
+
79
+ ```bash
80
+ ~/.claude/mindsystem/scripts/scan-artifact-subsystems.sh --values-only
81
+ ```
82
+
83
+ Collect all unique values found. Note count of artifacts scanned and values found.
84
+ </step>
85
+
86
+ <step name="derive_and_confirm">
87
+ **State A only.** Read `.planning/PROJECT.md` and `.planning/ROADMAP.md`.
88
+
89
+ Derive 5-12 canonical subsystem identifiers from:
90
+
91
+ 1. Unique values found in `audit_existing_usage`
92
+ 2. Project domain from PROJECT.md
93
+ 3. Phase structure from ROADMAP.md
94
+
95
+ Rules:
96
+ - Lowercase, single-word or hyphenated (e.g., "auth", "real-time", "ui")
97
+ - Merge synonyms into one canonical value (pick shortest/most common)
98
+ - Cover all existing usage plus obvious gaps
99
+ - Include infrastructure-level subsystems if relevant (api, database, infra, testing)
100
+
101
+ Present the proposed list with merge mappings (e.g., "authentication" -> "auth").
102
+
103
+ Use AskUserQuestion:
104
+ - header: "Subsystems"
105
+ - question: "These subsystems were derived from your project. Look good?"
106
+ - options:
107
+ - "Looks good" — accept and apply
108
+ - "Add/remove some" — iterate on the list
109
+ - "Start over" — re-derive from scratch
110
+
111
+ After confirmation:
112
+
113
+ 1. Update `config.json` — set `subsystems` array as first field
114
+ 2. If existing artifacts had free-form values, standardize each `subsystem:` field to the canonical value using the Edit tool (only modify the `subsystem:` line, never body content)
115
+ 3. Commit all changes:
116
+
117
+ ```bash
118
+ git add .planning/config.json
119
+ git add .planning/phases/*/*-SUMMARY.md 2>/dev/null
120
+ git add .planning/adhoc/*-SUMMARY.md 2>/dev/null
121
+ git add .planning/debug/*.md 2>/dev/null
122
+ git add .planning/debug/resolved/*.md 2>/dev/null
123
+ git add .planning/todos/pending/*.md 2>/dev/null
124
+ git add .planning/todos/done/*.md 2>/dev/null
125
+ ```
126
+
127
+ ```bash
128
+ git commit -m "$(cat <<'EOF'
129
+ chore: initialize subsystem vocabulary
130
+
131
+ Added subsystems array to config.json and standardized existing artifact values.
132
+ EOF
133
+ )"
134
+ ```
135
+ </step>
136
+
137
+ <step name="validate_vocabulary">
138
+ **State B only.** Read canonical list from config.json:
139
+
140
+ ```bash
141
+ jq -r '.subsystems[]' .planning/config.json
142
+ ```
143
+
144
+ Scan all artifacts for `subsystem:` values. Extract from YAML frontmatter:
145
+
146
+ ```bash
147
+ ~/.claude/mindsystem/scripts/scan-artifact-subsystems.sh
148
+ ```
149
+
150
+ Classify each artifact's `subsystem:` value:
151
+ - **OK** — value is in canonical list
152
+ - **MISMATCH** — value exists but not in canonical list
153
+ - **MISSING** — no `subsystem:` field found
154
+
155
+ Display results grouped by status. If all OK:
156
+
157
+ ```
158
+ ## Subsystem Vocabulary
159
+
160
+ PASS — all N artifacts use canonical subsystem values.
161
+ ```
162
+
163
+ Go to `report`.
164
+
165
+ If MISMATCH or MISSING found, use AskUserQuestion:
166
+ - header: "Fix issues"
167
+ - question: "Found N issues (X mismatches, Y missing). How to proceed?"
168
+ - options:
169
+ - "Fix all" — apply best-match canonical values to all issues
170
+ - "Review each" — present each issue individually for decision
171
+ - "Skip" — leave as-is
172
+
173
+ For fixes:
174
+ - MISMATCH: propose closest canonical value (fuzzy match on prefix/synonym)
175
+ - MISSING: propose based on artifact content/path context
176
+
177
+ Apply fixes using Edit tool. Commit:
178
+
179
+ ```bash
180
+ git add .planning/phases/*/*-SUMMARY.md 2>/dev/null
181
+ git add .planning/adhoc/*-SUMMARY.md 2>/dev/null
182
+ git add .planning/debug/*.md 2>/dev/null
183
+ git add .planning/debug/resolved/*.md 2>/dev/null
184
+ git add .planning/todos/pending/*.md 2>/dev/null
185
+ git add .planning/todos/done/*.md 2>/dev/null
186
+ ```
187
+
188
+ ```bash
189
+ git commit -m "$(cat <<'EOF'
190
+ chore: fix subsystem vocabulary mismatches
191
+
192
+ Standardized artifact subsystem values to canonical vocabulary.
193
+ EOF
194
+ )"
195
+ ```
196
+ </step>
197
+
198
+ <step name="report">
199
+ Final summary:
200
+
201
+ ```
202
+ ## Doctor Report
203
+
204
+ | Check | Result | Details |
205
+ |------------------------|-------------|----------------------------|
206
+ | Subsystem vocabulary | PASS / INIT | N artifacts, M subsystems |
207
+
208
+ All checks passed.
209
+ ```
210
+
211
+ - **PASS**: subsystems were already configured and all artifacts validated
212
+ - **INIT**: subsystems were initialized during this run
213
+ - Include artifact count (how many scanned) and subsystem count
214
+ </step>
215
+
216
+ </process>
217
+
218
+ <success_criteria>
219
+ - [ ] State A: config.json updated, existing artifacts standardized to canonical values, changes committed
220
+ - [ ] State B issues: offers fix/review/skip, applies fixes, commits
221
+ - [ ] Final report displayed with check name, result, and artifact/subsystem counts
222
+ - [ ] State A: derives canonical list from audit + project context, confirms with user before applying
223
+ - [ ] State B: all artifacts scanned and classified; reports PASS if all OK
224
+ </success_criteria>
@@ -90,10 +90,17 @@ PHASE=$(printf "%02d" "$PHASE_ARG" 2>/dev/null || echo "$PHASE_ARG")
90
90
  - Verify: patch file exists OR skip message logged
91
91
  - Note: Patch captures all changes including simplifications
92
92
 
93
- 9. **Update roadmap and state**
94
- - Update ROADMAP.md, STATE.md
93
+ 9. **Consolidate knowledge**
94
+ - Spawn `ms-consolidator` with phase directory and number
95
+ - Consolidator reads phase artifacts and existing knowledge files
96
+ - Produces updated `.planning/knowledge/{subsystem}.md` files
97
+ - Deletes PLAN.md files (execution instructions consumed)
98
+ - Verify: knowledge files written to `.planning/knowledge/`
95
99
 
96
- 10. **Update requirements**
100
+ 10. **Update roadmap and state**
101
+ - Update ROADMAP.md, STATE.md
102
+
103
+ 11. **Update requirements**
97
104
  Mark phase requirements as Complete:
98
105
  - Read ROADMAP.md, find this phase's `Requirements:` line (e.g., "AUTH-01, AUTH-02")
99
106
  - Read REQUIREMENTS.md traceability table
@@ -101,16 +108,18 @@ PHASE=$(printf "%02d" "$PHASE_ARG" 2>/dev/null || echo "$PHASE_ARG")
101
108
  - Write updated REQUIREMENTS.md
102
109
  - Skip if: REQUIREMENTS.md doesn't exist, or phase has no Requirements line
103
110
 
104
- 11. **Commit phase completion**
111
+ 12. **Commit phase completion**
105
112
  Bundle all phase metadata updates in one commit:
106
113
  - Stage: `git add .planning/ROADMAP.md .planning/STATE.md`
114
+ - Stage knowledge files: `git add .planning/knowledge/*.md`
115
+ - Stage PLAN.md deletions: `git add -u .planning/phases/{phase_dir}/*-PLAN.md`
107
116
  - Stage REQUIREMENTS.md if updated: `git add .planning/REQUIREMENTS.md`
108
117
  - Commit: `docs({phase}): complete {phase-name} phase`
109
118
 
110
- 12. **Offer next steps**
119
+ 13. **Offer next steps**
111
120
  - Route to next action (see `<offer_next>`)
112
121
 
113
- 13. **Update last command**
122
+ 14. **Update last command**
114
123
  - Update `.planning/STATE.md` Last Command field
115
124
  - Format: `Last Command: ms:execute-phase $ARGUMENTS | YYYY-MM-DD HH:MM`
116
125
  </process>
@@ -213,8 +222,10 @@ After code simplification step:
213
222
 
214
223
  After all plans in phase complete:
215
224
  1. Stage: ROADMAP.md, STATE.md, REQUIREMENTS.md (if updated), VERIFICATION.md
216
- 2. Commit with format: `docs({phase}): complete {phase-name} phase`
217
- 3. Bundles all phase-level state updates in one commit
225
+ 2. Stage knowledge files: `git add .planning/knowledge/*.md`
226
+ 3. Stage PLAN.md deletions: `git add -u .planning/phases/{phase_dir}/*-PLAN.md`
227
+ 4. Commit with format: `docs({phase}): complete {phase-name} phase`
228
+ 5. Bundles all phase-level state updates in one commit
218
229
 
219
230
  **NEVER use:**
220
231
  - `git add .`
@@ -226,13 +237,12 @@ After all plans in phase complete:
226
237
 
227
238
  <success_criteria>
228
239
  - [ ] All incomplete plans in phase executed
229
- - [ ] Each plan has SUMMARY.md
230
240
  - [ ] Code review completed (or skipped if config says "skip")
231
241
  - [ ] Phase goal verified (Must-Haves checked against codebase)
232
242
  - [ ] VERIFICATION.md created in phase directory
233
243
  - [ ] Patch file generated OR explicitly skipped with message
234
- - [ ] STATE.md reflects phase completion
235
- - [ ] ROADMAP.md updated
244
+ - [ ] Knowledge files written to .planning/knowledge/ (consolidation complete)
245
+ - [ ] PLAN.md files deleted from phase directory
246
+ - [ ] STATE.md and ROADMAP.md reflect phase completion
236
247
  - [ ] REQUIREMENTS.md updated (phase requirements marked Complete)
237
- - [ ] User informed of next steps
238
248
  </success_criteria>
@@ -376,6 +376,17 @@ Usage: `/ms:adhoc Fix auth token not refreshing on 401`
376
376
 
377
377
  ### Utility Commands
378
378
 
379
+ **`/ms:doctor`**
380
+ Health check and fix project configuration.
381
+
382
+ - Use when: subsystems are missing, artifacts have inconsistent vocabulary, or periodic health check
383
+ - V1: subsystem vocabulary setup and validation
384
+ - If subsystems missing: derives from project context and guides through setup
385
+ - If subsystems present: validates all artifacts use canonical values
386
+ - Idempotent — safe to run repeatedly
387
+
388
+ Usage: `/ms:doctor`
389
+
379
390
  **`/ms:help`**
380
391
  Show this command reference.
381
392
 
@@ -63,10 +63,9 @@ Milestone name: $ARGUMENTS (optional — will emerge during discovery if not pro
63
63
 
64
64
  3. **Strategic assessment (silent — do not output this step):**
65
65
  - Check for previous milestone artifacts using calculated version:
66
- - `.planning/milestones/v{VERSION}-DECISIONS.md` (if exists)
66
+ - `.planning/knowledge/*.md` (subsystem knowledge files — persist across milestones)
67
67
  - `.planning/milestones/v{VERSION}-MILESTONE-AUDIT.md` (if exists)
68
68
  - `.planning/TECH-DEBT.md` (if exists)
69
- - `.planning/LEARNINGS.md` (if exists)
70
69
  - Identify: outstanding tech debt, untested assumptions, high-impact gaps, unaddressed requirements
71
70
  - This is background analysis — synthesize silently, surface through suggestions in step 4
72
71
 
@@ -85,7 +84,8 @@ Milestone name: $ARGUMENTS (optional — will emerge during discovery if not pro
85
84
  ```
86
85
 
87
86
  Sources for suggestions:
88
- - High-impact tech debt from TECH-DEBT.md or MILESTONE-AUDIT.md
87
+ - Tech debt from TECH-DEBT.md, MILESTONE-AUDIT.md, or knowledge file Pitfalls sections
88
+ - Settled decisions and patterns from knowledge files
89
89
  - Untested assumptions from previous audit
90
90
  - Unaddressed requirements from previous milestones
91
91
  - Strategic features inferred from PROJECT.md's problem/audience/USP
@@ -84,7 +84,7 @@ Check for `.planning/codebase/` and load relevant documents based on phase type.
84
84
  5. Follow plan-phase.md workflow:
85
85
  - Load project state and accumulated decisions
86
86
  - Perform mandatory discovery (Level 0-3 as appropriate)
87
- - Read project history (prior decisions, issues, debug resolutions, adhoc learnings, cross-milestone patterns)
87
+ - Scan project history via context scanner script (prior decisions, issues, debug resolutions, adhoc learnings, cross-milestone patterns)
88
88
  - Break phase into tasks
89
89
  - Estimate scope and split into multiple plans if needed
90
90
  - Create PLAN.md file(s) with executable structure