maxsimcli 4.4.0 → 4.5.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 (53) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/assets/CHANGELOG.md +19 -0
  3. package/dist/assets/dashboard/server.js +248 -240
  4. package/dist/assets/templates/agents/AGENTS.md +1 -0
  5. package/dist/assets/templates/agents/maxsim-drift-checker.md +522 -0
  6. package/dist/assets/templates/commands/maxsim/check-drift.md +56 -0
  7. package/dist/assets/templates/commands/maxsim/discuss.md +70 -0
  8. package/dist/assets/templates/commands/maxsim/realign.md +39 -0
  9. package/dist/assets/templates/workflows/check-drift.md +248 -0
  10. package/dist/assets/templates/workflows/discuss.md +343 -0
  11. package/dist/assets/templates/workflows/progress.md +8 -0
  12. package/dist/assets/templates/workflows/realign.md +288 -0
  13. package/dist/assets/templates/workflows/roadmap.md +69 -20
  14. package/dist/backend-server.cjs +52 -29
  15. package/dist/backend-server.cjs.map +1 -1
  16. package/dist/cli.cjs +261 -5
  17. package/dist/cli.cjs.map +1 -1
  18. package/dist/cli.js +20 -1
  19. package/dist/cli.js.map +1 -1
  20. package/dist/core/core.d.ts.map +1 -1
  21. package/dist/core/core.js +1 -0
  22. package/dist/core/core.js.map +1 -1
  23. package/dist/core/drift.d.ts +37 -0
  24. package/dist/core/drift.d.ts.map +1 -0
  25. package/dist/core/drift.js +213 -0
  26. package/dist/core/drift.js.map +1 -0
  27. package/dist/core/frontmatter.d.ts.map +1 -1
  28. package/dist/core/frontmatter.js +3 -0
  29. package/dist/core/frontmatter.js.map +1 -1
  30. package/dist/core/index.d.ts +3 -2
  31. package/dist/core/index.d.ts.map +1 -1
  32. package/dist/core/index.js +12 -2
  33. package/dist/core/index.js.map +1 -1
  34. package/dist/core/init.d.ts +5 -3
  35. package/dist/core/init.d.ts.map +1 -1
  36. package/dist/core/init.js +89 -0
  37. package/dist/core/init.js.map +1 -1
  38. package/dist/core/types.d.ts +50 -1
  39. package/dist/core/types.d.ts.map +1 -1
  40. package/dist/core/types.js.map +1 -1
  41. package/dist/core-RRjCSt0G.cjs.map +1 -1
  42. package/dist/{lifecycle-0M4VqOMm.cjs → lifecycle-DxCru7rk.cjs} +2 -2
  43. package/dist/{lifecycle-0M4VqOMm.cjs.map → lifecycle-DxCru7rk.cjs.map} +1 -1
  44. package/dist/mcp/phase-tools.d.ts.map +1 -1
  45. package/dist/mcp/phase-tools.js +17 -4
  46. package/dist/mcp/phase-tools.js.map +1 -1
  47. package/dist/mcp-server.cjs +20 -5
  48. package/dist/mcp-server.cjs.map +1 -1
  49. package/dist/{server-G1MIg_Oe.cjs → server-By0TN-nC.cjs} +21 -6
  50. package/dist/server-By0TN-nC.cjs.map +1 -0
  51. package/dist/skills-MYlMkYNt.cjs.map +1 -1
  52. package/package.json +1 -1
  53. package/dist/server-G1MIg_Oe.cjs.map +0 -1
@@ -0,0 +1,248 @@
1
+ <purpose>
2
+ Orchestrate a drift-checker agent to compare .planning/ spec against the codebase and produce DRIFT-REPORT.md.
3
+
4
+ The drift-checker agent writes the report directly. The orchestrator only receives a summary (status + counts) to prevent context bloat. After the report is generated, the orchestrator reads only the YAML frontmatter for key metrics and presents results to the user.
5
+
6
+ Output: .planning/DRIFT-REPORT.md with severity-tiered findings and YAML frontmatter.
7
+ </purpose>
8
+
9
+ <philosophy>
10
+ **Agent writes output directly:**
11
+ The drift-checker agent writes DRIFT-REPORT.md directly to `.planning/`. The orchestrator does NOT receive the full report content -- it only gets confirmation and counts. This follows the same pattern as maxsim-codebase-mapper (which writes documents directly to `.planning/codebase/`).
12
+
13
+ **Why:** The drift report can be large (50+ items with evidence). Passing the full report back to the orchestrator would waste context. Only metadata flows back.
14
+
15
+ **Fresh scan every run:**
16
+ Every drift check performs a fresh codebase analysis. Previous reports are only used for diff tracking (NEW/RESOLVED/UNCHANGED labels), never as a substitute for current analysis.
17
+ </philosophy>
18
+
19
+ <process>
20
+
21
+ <step name="init_context" priority="first">
22
+ Load drift check context:
23
+
24
+ ```bash
25
+ INIT=$(node ~/.claude/maxsim/bin/maxsim-tools.cjs init check-drift)
26
+ ```
27
+
28
+ Extract from init JSON:
29
+ - `drift_model` -- model resolution for the drift-checker agent
30
+ - `commit_docs` -- whether to commit the report
31
+ - `has_planning` -- whether .planning/ exists
32
+ - `has_requirements` -- whether REQUIREMENTS.md exists
33
+ - `has_roadmap` -- whether ROADMAP.md exists
34
+ - `has_nogos` -- whether NO-GOS.md exists
35
+ - `has_conventions` -- whether CONVENTIONS.md exists
36
+ - `has_previous_report` -- whether a previous DRIFT-REPORT.md exists
37
+ - `spec_files` -- list of all spec file paths found
38
+ - `phase_dirs` -- list of active phase directories
39
+ - `archived_milestone_dirs` -- list of archived milestone directories
40
+ - Paths: `requirements_path`, `roadmap_path`, `nogos_path`, `conventions_path`, `state_path`
41
+ </step>
42
+
43
+ <step name="validate">
44
+ **Gate: Verify project is initialized.**
45
+
46
+ If `has_planning` is false:
47
+
48
+ ```
49
+ No .planning/ directory found.
50
+
51
+ Run `/maxsim:new-project` to initialize your project first.
52
+ ```
53
+
54
+ Stop workflow.
55
+
56
+ If `has_requirements` is false AND `has_roadmap` is false:
57
+
58
+ ```
59
+ No REQUIREMENTS.md or ROADMAP.md found in .planning/.
60
+
61
+ At least one spec file is needed for drift detection.
62
+ Run `/maxsim:new-project` to create project specification.
63
+ ```
64
+
65
+ Stop workflow.
66
+
67
+ If `has_planning` is true and at least one spec file exists, continue.
68
+
69
+ If some spec files are missing (e.g., no NO-GOS.md or CONVENTIONS.md), note this for the agent -- it will include a warning in the report header.
70
+ </step>
71
+
72
+ <step name="announce">
73
+ Display progress to user:
74
+
75
+ ```
76
+ Scanning codebase for spec drift...
77
+
78
+ Spec files: {list of found spec files}
79
+ Phase directories: {count} active{, {count} archived if any}
80
+ {If previous report exists: "Previous report found -- will track NEW/RESOLVED/UNCHANGED"}
81
+ {If no previous report: "First drift check -- all findings will be marked NEW"}
82
+
83
+ Spawning drift-checker agent...
84
+ ```
85
+ </step>
86
+
87
+ <step name="spawn_drift_checker">
88
+ Spawn the maxsim-drift-checker agent using the Task tool.
89
+
90
+ ```
91
+ Task(
92
+ subagent_type="maxsim-drift-checker",
93
+ model="{drift_model}",
94
+ description="Check spec-vs-code drift",
95
+ prompt="Perform a complete drift analysis of this project.
96
+
97
+ <check_drift_context>
98
+ {Full CheckDriftContext JSON from init step}
99
+ </check_drift_context>
100
+
101
+ {If $ARGUMENTS contains a phase number:}
102
+ <phase_filter>
103
+ Focus analysis on phase {phase_number}. Still check no-gos and conventions globally.
104
+ </phase_filter>
105
+
106
+ Analyze all spec files against the codebase. Write DRIFT-REPORT.md to .planning/.
107
+ Return only your summary (status and counts) -- do NOT return the full report content."
108
+ )
109
+ ```
110
+
111
+ Wait for agent to complete.
112
+ </step>
113
+
114
+ <step name="read_results">
115
+ After the agent returns, read ONLY the frontmatter of the drift report (not the full content):
116
+
117
+ ```bash
118
+ head -20 .planning/DRIFT-REPORT.md
119
+ ```
120
+
121
+ Parse the YAML frontmatter for:
122
+ - `status` (aligned | drift)
123
+ - `critical_count`
124
+ - `warning_count`
125
+ - `info_count`
126
+ - `undocumented_count`
127
+ - `total_items`
128
+ - `aligned_count`
129
+
130
+ If the file was not created, report agent failure and suggest re-running.
131
+ </step>
132
+
133
+ <step name="commit_report">
134
+ If `commit_docs` is true, commit the drift report:
135
+
136
+ ```bash
137
+ node ~/.claude/maxsim/bin/maxsim-tools.cjs commit "docs: drift report - {status}" --files .planning/DRIFT-REPORT.md
138
+ ```
139
+ </step>
140
+
141
+ <step name="present_results">
142
+ Present the drift check results to the user.
143
+
144
+ **If status is "aligned":**
145
+
146
+ ```
147
+ ## Drift Check Complete
148
+
149
+ **Status:** ALIGNED
150
+ **Total items checked:** {total_items}
151
+ **All {aligned_count} items aligned** -- spec and code are in sync.
152
+
153
+ Report: .planning/DRIFT-REPORT.md
154
+
155
+ ---
156
+
157
+ No realignment needed. Ready to continue development.
158
+
159
+ - `/maxsim:execute-phase` -- Continue executing current phase
160
+ - `/maxsim:plan-phase` -- Plan next phase
161
+ ```
162
+
163
+ **If status is "drift":**
164
+
165
+ ```
166
+ ## Drift Check Complete
167
+
168
+ **Status:** DRIFT DETECTED
169
+
170
+ | Category | Count |
171
+ |----------|-------|
172
+ | Aligned | {aligned_count} |
173
+ | Critical | {critical_count} |
174
+ | Warning | {warning_count} |
175
+ | Info | {info_count} |
176
+ | Undocumented | {undocumented_count} |
177
+
178
+ {If critical_count > 0:}
179
+ **Critical findings require attention** -- requirements marked complete but implementation is missing.
180
+
181
+ Report: .planning/DRIFT-REPORT.md
182
+
183
+ Review the full report, then choose:
184
+ ```
185
+
186
+ Continue to offer_realignment.
187
+ </step>
188
+
189
+ <step name="offer_realignment">
190
+ Present realignment options:
191
+
192
+ ```
193
+ ---
194
+
195
+ ## Realignment Options
196
+
197
+ 1. **Realign to code** -- Update `.planning/` to match what's actually built
198
+ Accepts current implementation as source of truth. Updates requirements and roadmap.
199
+ `/maxsim:realign to-code`
200
+
201
+ 2. **Realign to spec** -- Create new phases to close implementation gaps
202
+ Keeps spec as source of truth. Generates fix phases for missing implementations.
203
+ `/maxsim:realign to-spec`
204
+
205
+ 3. **Done** -- Acknowledge drift, no action needed now
206
+ The DRIFT-REPORT.md is saved for future reference.
207
+
208
+ ---
209
+ ```
210
+
211
+ Wait for user response.
212
+
213
+ - If user chooses option 1: Direct them to run `/maxsim:realign to-code`
214
+ - If user chooses option 2: Direct them to run `/maxsim:realign to-spec`
215
+ - If user chooses option 3 or "done": End workflow
216
+ </step>
217
+
218
+ </process>
219
+
220
+ <error_handling>
221
+
222
+ **Agent failure:** If the drift-checker agent fails or returns without creating DRIFT-REPORT.md:
223
+ ```
224
+ Drift check failed. The drift-checker agent did not produce a report.
225
+
226
+ Possible causes:
227
+ - Insufficient spec files for analysis
228
+ - Agent context overload (too many requirements)
229
+
230
+ Try: `/maxsim:check-drift {specific_phase}` to narrow the scope.
231
+ ```
232
+
233
+ **Partial spec:** The agent handles partial specs internally (runs analysis on what exists, warns about missing files). The workflow does not need to handle this specially.
234
+
235
+ **Previous report comparison failure:** If `drift previous-hash` fails, the agent runs without diff tracking. All items will be marked `[NEW]`.
236
+
237
+ </error_handling>
238
+
239
+ <success_criteria>
240
+ - [ ] Init context loaded with all spec file existence flags
241
+ - [ ] Validation gate prevents running on un-initialized projects
242
+ - [ ] Drift-checker agent spawned with full context
243
+ - [ ] Report frontmatter read (not full content) for result display
244
+ - [ ] Report committed if commit_docs is true
245
+ - [ ] Results presented with counts and status
246
+ - [ ] Realignment options offered when drift detected
247
+ - [ ] Only frontmatter read from report (no context bloat)
248
+ </success_criteria>
@@ -0,0 +1,343 @@
1
+ <sanity_check>
2
+ Before executing any step in this workflow, verify:
3
+ 1. The current directory contains a `.planning/` folder -- if not, stop and tell the user to run `/maxsim:new-project` first.
4
+ 2. `.planning/ROADMAP.md` exists -- if not, stop and tell the user to initialize the project.
5
+ </sanity_check>
6
+
7
+ <purpose>
8
+ Triage an unknown problem, idea, or bug into the right size -- quick todo or new phase -- through collaborative discussion.
9
+
10
+ You are a thinking partner, not a form collector. The user has something on their mind -- help them clarify it, size it, and file it in the right place. Then offer the next action so momentum continues.
11
+
12
+ **Key distinction:** This workflow triages an UNKNOWN item into the right size. `/maxsim:discuss-phase` gathers decisions for a KNOWN phase. They are complementary, not overlapping.
13
+ </purpose>
14
+
15
+ <required_reading>
16
+ Read all files referenced by the invoking prompt's execution_context before starting.
17
+ @./references/dashboard-bridge.md
18
+ @./references/thinking-partner.md
19
+ </required_reading>
20
+
21
+ <tool_mandate>
22
+ **CRITICAL -- Structured user interaction is MANDATORY.**
23
+
24
+ Every question directed at the user MUST use a structured tool. NEVER write a question as plain text and wait for the user to respond. This applies to:
25
+
26
+ - Existing todo confirmation
27
+ - Every clarifying question during discussion
28
+ - Triage size classification proposal
29
+ - Filing confirmation
30
+ - Next action offers
31
+ - Any follow-up or clarification
32
+
33
+ **Tool selection:** At workflow start, probe for the dashboard (see @dashboard-bridge). Then:
34
+ - **DASHBOARD_ACTIVE = true** -- use `mcp__maxsim-dashboard__ask_question` (questions appear in browser). Follow the schema translation rules from @dashboard-bridge.
35
+ - **DASHBOARD_ACTIVE = false** -- use `AskUserQuestion` (questions appear in terminal).
36
+
37
+ **The rule is simple:** If you need input from the user -- use the appropriate structured tool based on dashboard availability. Zero exceptions.
38
+ </tool_mandate>
39
+
40
+ <process>
41
+
42
+ <step name="init_context">
43
+ Load project state and todo context:
44
+
45
+ ```bash
46
+ STATE=$(node ~/.claude/maxsim/bin/maxsim-tools.cjs state-load --raw)
47
+ ```
48
+
49
+ Check `planning_exists` from state. **Hard stop** if false -- tell user to run `/maxsim:new-project` first.
50
+
51
+ ```bash
52
+ INIT=$(node ~/.claude/maxsim/bin/maxsim-tools.cjs init todos)
53
+ ```
54
+
55
+ Extract from init JSON: `commit_docs`, `date`, `timestamp`, `todo_count`, `todos`, `pending_dir`, `todos_dir_exists`.
56
+
57
+ Ensure directories exist:
58
+ ```bash
59
+ mkdir -p .planning/todos/pending .planning/todos/done
60
+ ```
61
+
62
+ Parse user input from $ARGUMENTS (if any):
63
+ - If arguments provided: store as `user_input` for use in detect_existing_todo and gather_context
64
+ - If no arguments: `user_input` is empty -- will ask interactively in gather_context
65
+
66
+ Note existing areas from the todos array for consistency in later area inference.
67
+ </step>
68
+
69
+ <step name="detect_existing_todo">
70
+ **Only runs if `user_input` is non-empty.**
71
+
72
+ Search pending todos for a title or slug match against the user's input:
73
+
74
+ ```bash
75
+ # Search for matching words in existing todo titles
76
+ grep -l -i "[key words from user_input]" .planning/todos/pending/*.md 2>/dev/null
77
+ ```
78
+
79
+ Also compare against the `todos` array from init context -- check `title` and filename fields for partial matches.
80
+
81
+ **If a match is found:**
82
+
83
+ Use AskUserQuestion:
84
+ - header: "Existing Todo"
85
+ - question: "Found a pending todo that might match: **[todo title]**. Want to discuss this one?"
86
+ - options:
87
+ - "Yes, discuss this todo" -- Load its context and continue discussion about it
88
+ - "No, this is something new" -- Proceed as a new item
89
+
90
+ If "Yes": Read the matched todo file. Use its content as context for the discussion. The user may want to refine scope, change priority, or decide to work on it now.
91
+
92
+ If "No": Proceed to gather_context as a new item, using `user_input` as the starting description.
93
+
94
+ **If no match found (or no user_input):**
95
+
96
+ Proceed to gather_context.
97
+ </step>
98
+
99
+ <step name="gather_context">
100
+ Use adaptive questioning to understand what the user is describing.
101
+
102
+ **Apply thinking-partner behaviors from @./references/thinking-partner.md:**
103
+ - Challenge vague descriptions -- "broken" means what exactly?
104
+ - Surface unstated assumptions -- "this should be easy" might hide complexity
105
+ - Propose alternatives if the user's framing suggests a different approach
106
+ - Follow the thread -- build each question on the previous answer
107
+
108
+ **If `user_input` is non-empty (user provided a description):**
109
+
110
+ Start by reflecting back what you understood, then ask your first clarifying question.
111
+
112
+ Use AskUserQuestion:
113
+ - header: "Clarify"
114
+ - question: Based on the user's description, ask the most important clarifying question. For example: "You mentioned [X]. What specifically is the problem -- is it [scenario A] or [scenario B]?"
115
+ - options: 2-3 concrete options that capture likely answers, plus the implicit "Other" for free-text
116
+
117
+ **If `user_input` is empty (no arguments):**
118
+
119
+ Use AskUserQuestion:
120
+ - header: "Discuss"
121
+ - question: "What's on your mind? Describe the problem, idea, or bug you want to discuss."
122
+ - options: (none -- free text only, do not provide options for the opening question)
123
+
124
+ **After the first response, ask 1-2 more adaptive follow-up questions:**
125
+
126
+ Each follow-up uses AskUserQuestion with header, question, and options tailored to what the user just said.
127
+
128
+ **Adaptive depth:**
129
+ - If answers reveal the item is simple and well-defined (clear problem, clear scope, obvious size): move to triage after 2 questions
130
+ - If answers reveal complexity (multiple systems involved, unclear scope, competing approaches): ask up to 2 more questions before triage
131
+ - Maximum: 4 questions before triage. Read the room -- don't over-probe simple bugs.
132
+
133
+ **What to extract from the discussion:**
134
+ - `title`: 3-10 word descriptive title (action verb preferred)
135
+ - `problem`: What is wrong or why this is needed
136
+ - `scope_hint`: Simple fix, or touches multiple systems?
137
+ - `files`: Any file paths or areas mentioned
138
+ - `size_signal`: Does this feel like a quick todo or a multi-day phase?
139
+ </step>
140
+
141
+ <step name="triage">
142
+ Based on gathered context, propose a size classification.
143
+
144
+ **Assess the item:**
145
+ - Quick todo: Well-defined problem, clear fix, single area, could be done in one session
146
+ - Phase: Touches multiple systems, needs research, unclear approach, requires planning
147
+
148
+ **Present classification via AskUserQuestion:**
149
+ - header: "Size"
150
+ - question: "Based on what you described, this looks like [your assessment with brief explanation]. Does that match?"
151
+ - options:
152
+ - "Quick fix (todo)" -- File as a todo for later or work on it now
153
+ - "Needs a phase" -- Too big for a todo, add to the roadmap as a new phase
154
+ - "Let me explain more" -- I want to provide more context before deciding
155
+
156
+ Include a brief explanation of WHY you suggest the classification you suggest. For example: "This sounds like a focused bug fix in one file -- a quick todo should cover it." Or: "This touches auth, database, and the API layer -- that's phase-sized work."
157
+
158
+ **CRITICAL: Always present this as a question. Never auto-route.** Even if the size is obvious, the user confirms.
159
+
160
+ **If user selects "Let me explain more":**
161
+ Loop back to gather_context for 1-2 more questions, then return to triage with updated assessment.
162
+
163
+ **If user selects "Quick fix (todo)":**
164
+ Proceed to file_as_todo.
165
+
166
+ **If user selects "Needs a phase":**
167
+ Proceed to file_as_phase.
168
+ </step>
169
+
170
+ <step name="file_as_todo">
171
+ File the item as a todo using existing maxsim-tools.cjs commands.
172
+
173
+ **1. Generate slug:**
174
+ ```bash
175
+ slug=$(node ~/.claude/maxsim/bin/maxsim-tools.cjs generate-slug "$title" --raw)
176
+ ```
177
+
178
+ **2. Infer area from discussion context:**
179
+
180
+ Use file paths and topic from the discussion to infer area:
181
+
182
+ | Path pattern | Area |
183
+ |--------------|------|
184
+ | `src/api/*`, `api/*` | `api` |
185
+ | `src/components/*`, `src/ui/*` | `ui` |
186
+ | `src/auth/*`, `auth/*` | `auth` |
187
+ | `src/db/*`, `database/*` | `database` |
188
+ | `tests/*`, `__tests__/*` | `testing` |
189
+ | `docs/*` | `docs` |
190
+ | `.planning/*` | `planning` |
191
+ | `scripts/*`, `bin/*` | `tooling` |
192
+ | No files or unclear | `general` |
193
+
194
+ Use existing areas from init context if a similar match exists.
195
+
196
+ **3. Check for duplicates:**
197
+ ```bash
198
+ # Search for key words from title in existing todos
199
+ grep -l -i "[key words from title]" .planning/todos/pending/*.md 2>/dev/null
200
+ ```
201
+
202
+ If potential duplicate found, read the existing todo and compare scope.
203
+
204
+ If overlapping, use AskUserQuestion:
205
+ - header: "Duplicate?"
206
+ - question: "A similar todo already exists: **[existing title]**. What would you like to do?"
207
+ - options:
208
+ - "Skip" -- Keep the existing todo as-is
209
+ - "Replace" -- Update the existing todo with new context from this discussion
210
+ - "Add anyway" -- Create a separate todo (they cover different aspects)
211
+
212
+ If "Skip": Jump to offer_next_action (nothing filed).
213
+ If "Replace": Update the existing file instead of creating new.
214
+ If "Add anyway": Continue creating new todo.
215
+
216
+ **4. Create todo file:**
217
+
218
+ Use values from init context: `timestamp` and `date` are already available.
219
+
220
+ Write to `.planning/todos/pending/${date}-${slug}.md`:
221
+
222
+ ```markdown
223
+ ---
224
+ created: [timestamp]
225
+ title: [title]
226
+ area: [area]
227
+ mode: discussed
228
+ files:
229
+ - [file paths from discussion, if any]
230
+ ---
231
+
232
+ ## Problem
233
+
234
+ [Problem description enriched with discussion insights -- enough context for a future Claude session to understand weeks later]
235
+
236
+ ## Solution
237
+
238
+ [Approach hints from the discussion, or "TBD" if only the problem was clarified]
239
+ ```
240
+
241
+ **5. Commit:**
242
+ ```bash
243
+ node ~/.claude/maxsim/bin/maxsim-tools.cjs commit "docs: add todo [slug]" --files .planning/todos/pending/${date}-${slug}.md
244
+ ```
245
+
246
+ Confirm to user: "Filed as todo: **[title]**"
247
+
248
+ Proceed to offer_next_action.
249
+ </step>
250
+
251
+ <step name="file_as_phase">
252
+ File the item as a new phase on the roadmap.
253
+
254
+ **1. Gather phase details via AskUserQuestion:**
255
+ - header: "Phase"
256
+ - question: "What should this phase be called? And in one sentence, what's the goal?"
257
+ - options: (none -- free text for naming)
258
+
259
+ Parse the response to extract:
260
+ - `phase_name`: Short name (2-5 words)
261
+ - `phase_goal`: One-sentence goal description
262
+
263
+ **2. Preview and confirm via AskUserQuestion:**
264
+
265
+ First, check the current roadmap to determine what the next phase number would be:
266
+ ```bash
267
+ node ~/.claude/maxsim/bin/maxsim-tools.cjs roadmap analyze --raw
268
+ ```
269
+
270
+ - header: "Confirm"
271
+ - question: "This would add **Phase [N]: [phase_name]** to the roadmap with goal: *[phase_goal]*. Proceed?"
272
+ - options:
273
+ - "Yes, add it" -- Add to roadmap
274
+ - "Let me adjust" -- I want to change the name or goal
275
+ - "Cancel" -- Don't add anything
276
+
277
+ If "Let me adjust": Ask again for name/goal, then re-preview.
278
+ If "Cancel": Jump to offer_next_action (nothing filed).
279
+ If "Yes, add it": Continue.
280
+
281
+ **3. Create the phase:**
282
+ ```bash
283
+ node ~/.claude/maxsim/bin/maxsim-tools.cjs phase add "[phase_name]"
284
+ ```
285
+
286
+ **4. Commit:**
287
+ ```bash
288
+ node ~/.claude/maxsim/bin/maxsim-tools.cjs commit "docs: add phase [phase_name]" --files .planning/ROADMAP.md .planning/phases/
289
+ ```
290
+
291
+ Confirm to user: "Added to roadmap: **Phase [N]: [phase_name]**"
292
+
293
+ Proceed to offer_next_action.
294
+ </step>
295
+
296
+ <step name="offer_next_action">
297
+ After filing (or skipping), offer contextual next actions.
298
+
299
+ **If filed as todo:**
300
+
301
+ Use AskUserQuestion:
302
+ - header: "Next"
303
+ - question: "Todo filed. What would you like to do next?"
304
+ - options:
305
+ - "Work on it now" -- Start a quick task with /maxsim:quick
306
+ - "Save for later" -- It's captured, move on
307
+ - "Check all todos" -- See pending todos with /maxsim:check-todos
308
+
309
+ If "Work on it now": Tell the user to run `/maxsim:quick [todo-title]` (print the command, do not auto-execute).
310
+ If "Save for later": Confirm and end workflow.
311
+ If "Check all todos": Tell the user to run `/maxsim:check-todos`.
312
+
313
+ **If filed as phase:**
314
+
315
+ Use AskUserQuestion:
316
+ - header: "Next"
317
+ - question: "Phase added to roadmap. What would you like to do next?"
318
+ - options:
319
+ - "Discuss it" -- Gather implementation context with /maxsim:discuss-phase [phase]
320
+ - "Plan it" -- Jump to planning with /maxsim:plan-phase [phase]
321
+ - "Save for later" -- It's on the roadmap, move on
322
+
323
+ If "Discuss it": Tell the user to run `/maxsim:discuss-phase [phase-number]`.
324
+ If "Plan it": Tell the user to run `/maxsim:plan-phase [phase-number]`.
325
+ If "Save for later": Confirm and end workflow.
326
+
327
+ **If nothing was filed (duplicate skip or cancel):**
328
+
329
+ Confirm that no action was taken and the discussion is complete.
330
+
331
+ **User always chooses -- no auto-start.** Print the recommended command for the user to copy and run, do not execute it.
332
+ </step>
333
+
334
+ </process>
335
+
336
+ <success_criteria>
337
+ - [ ] User's problem/idea/bug understood through adaptive discussion
338
+ - [ ] Existing todo detected if user referenced one
339
+ - [ ] Triage routing confirmed by user before any filing
340
+ - [ ] Item filed correctly (todo file in pending, or phase added to roadmap)
341
+ - [ ] Git commit created for the filed item
342
+ - [ ] Next action offered with concrete commands to run
343
+ </success_criteria>
@@ -127,6 +127,14 @@ CONTEXT: [✓ if has_context | - if not]
127
127
  [Next phase/plan objective from roadmap analyze]
128
128
  ```
129
129
 
130
+ **Performance metrics table truncation:**
131
+
132
+ When displaying the performance metrics table from STATE.md (the `## Performance Metrics` section):
133
+ - Show only the **last 20 entries** (most recent) by default.
134
+ - If there are more than 20 metric entries in STATE.md, add a note above the table: `Showing last 20 of {total} metrics entries.`
135
+ - This is a **display-time truncation only** — STATE.md retains all metrics as the source of truth. Do not modify or remove older entries from STATE.md.
136
+ - If there are 20 or fewer entries, show all without any truncation note.
137
+
130
138
  </step>
131
139
 
132
140
  <step name="route">