maxsimcli 4.13.0 → 4.15.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.
@@ -5,11 +5,11 @@ Before executing any step in this workflow, verify:
5
5
  </sanity_check>
6
6
 
7
7
  <purpose>
8
- Execute all plans in a phase using wave-based parallel execution. Orchestrator stays lean — delegates plan execution to subagents.
8
+ Execute all plans in a phase using wave-based parallel execution. Orchestrator stays lean — delegates plan execution to subagents. Plans are read from GitHub issue comments; summaries are posted as GitHub comments; task sub-issues are transitioned on the board per task.
9
9
  </purpose>
10
10
 
11
11
  <core_principle>
12
- Orchestrator coordinates, not executes. Each subagent loads the full execute-plan context. Orchestrator: discover plans → analyze deps → group waves → spawn agents → handle checkpoints → collect results.
12
+ Orchestrator coordinates, not executes. Each subagent loads the full execute-plan context. Orchestrator: discover plans from GitHub → analyze deps → group waves → spawn agents → handle checkpoints → collect results.
13
13
  </core_principle>
14
14
 
15
15
  <agent_teams>
@@ -37,7 +37,7 @@ Load all context in one call:
37
37
  INIT=$(node ~/.claude/maxsim/bin/maxsim-tools.cjs init execute-phase "${PHASE_ARG}")
38
38
  ```
39
39
 
40
- Parse JSON for: `executor_model`, `verifier_model`, `commit_docs`, `parallelization`, `branching_strategy`, `branch_name`, `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `plans`, `incomplete_plans`, `plan_count`, `incomplete_count`, `state_exists`, `roadmap_exists`, `phase_req_ids`.
40
+ Parse JSON for: `executor_model`, `verifier_model`, `commit_docs`, `parallelization`, `branching_strategy`, `branch_name`, `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `plans`, `incomplete_plans`, `plan_count`, `incomplete_count`, `state_exists`, `roadmap_exists`, `phase_req_ids`, `phase_issue_number`, `task_mappings`.
41
41
 
42
42
  Also extract parallel execution fields:
43
43
  ```
@@ -47,7 +47,7 @@ REVIEW_CONFIG (from init JSON review_config — spec_review, code_review, simpli
47
47
  ```
48
48
 
49
49
  **If `phase_found` is false:** Error — phase directory not found.
50
- **If `plan_count` is 0:** Error no plans found in phase.
50
+ **If `plan_count` is 0:** Check GitHub before reporting no plans (see discover_and_group_plans step).
51
51
  **If `state_exists` is false but `.planning/` exists:** Offer reconstruct or continue.
52
52
 
53
53
  When `parallelization` is false, plans within a wave execute sequentially.
@@ -86,7 +86,47 @@ Report: "Found {plan_count} plans in {phase_dir} ({incomplete_count} incomplete)
86
86
  </step>
87
87
 
88
88
  <step name="discover_and_group_plans">
89
- Load plan inventory with wave grouping in one call:
89
+
90
+ ## Plan Discovery -- GitHub First
91
+
92
+ When `phase_issue_number` is set (GitHub integration active):
93
+
94
+ 1. **Check for external edits (WIRE-06):**
95
+ ```
96
+ mcp_detect_external_edits(issue_number: phase_issue_number)
97
+ ```
98
+ If external edits detected: warn user before continuing.
99
+
100
+ 2. **Fetch the phase issue and its comments:**
101
+ ```
102
+ mcp_get_issue_detail(issue_number: phase_issue_number)
103
+ ```
104
+
105
+ 3. **Parse plan comments:** Identify comments containing either:
106
+ - `<!-- maxsim:type=plan -->` HTML marker, OR
107
+ - A heading `## Plan NN` (where NN is a number)
108
+
109
+ 4. **For each plan comment:**
110
+ - Extract plan number from the heading or frontmatter
111
+ - Parse YAML frontmatter from the comment body for: `wave`, `dependencies`, `autonomous`, `objective`, `gap_closure`, `task_count`
112
+ - Store plan content in memory as `PLAN_COMMENTS[]`
113
+
114
+ 5. **Determine completion status for each plan:**
115
+ - Call `mcp_list_sub_issues(issue_number: phase_issue_number)` to get all task sub-issues
116
+ - A plan is complete when all its task sub-issues are closed (cross-reference using `task_mappings`)
117
+ - Also check for `<!-- maxsim:type=summary -->` comments as a secondary completion signal
118
+
119
+ 6. **Build plan inventory:**
120
+ - `plans[]`: each with `id`, `wave`, `autonomous`, `objective`, `has_summary` (true if all sub-issues closed), `plan_comment_body`, `task_mappings`
121
+ - `waves`: map of wave number → plan IDs
122
+ - `incomplete`: IDs of plans that are not yet complete
123
+ - `has_checkpoints`: true if any plan has `autonomous: false`
124
+
125
+ **Filtering:** Skip plans where `has_summary: true`. If `--gaps-only`: also skip non-gap_closure plans. If all filtered: "No matching incomplete plans" → exit.
126
+
127
+ **Fallback -- no GitHub integration:**
128
+
129
+ When `phase_issue_number` is not set, use local file scanning:
90
130
 
91
131
  ```bash
92
132
  PLAN_INDEX=$(node ~/.claude/maxsim/bin/maxsim-tools.cjs phase-plan-index "${PHASE_NUMBER}")
@@ -94,7 +134,7 @@ PLAN_INDEX=$(node ~/.claude/maxsim/bin/maxsim-tools.cjs phase-plan-index "${PHAS
94
134
 
95
135
  Parse JSON for: `phase`, `plans[]` (each with `id`, `wave`, `autonomous`, `objective`, `files_modified`, `task_count`, `has_summary`), `waves` (map of wave number → plan IDs), `incomplete`, `has_checkpoints`.
96
136
 
97
- **Filtering:** Skip plans where `has_summary: true`. If `--gaps-only`: also skip non-gap_closure plans. If all filtered: "No matching incomplete plans" → exit.
137
+ **Skip plans where `has_summary: true`** (local SUMMARY.md file present). If `--gaps-only`: also skip non-gap_closure plans.
98
138
 
99
139
  Report:
100
140
  ```
@@ -136,7 +176,7 @@ Display decision:
136
176
 
137
177
  **If batch mode, validate plan independence:**
138
178
  ```bash
139
- # Build plans JSON from PLAN_INDEX data
179
+ # Build plans JSON from plan inventory data
140
180
  VALID=$(node ~/.claude/maxsim/bin/maxsim-tools.cjs validate-plan-independence "$PLANS_JSON")
141
181
  ```
142
182
  If conflicts found: report conflicts, fall back to standard mode with warning.
@@ -159,7 +199,7 @@ For each wave:
159
199
 
160
200
  2. **Describe what is being built (BEFORE spawning):**
161
201
 
162
- Read each plan's `<objective>`. Extract what is being built and why.
202
+ Read each plan's `<objective>` from the plan comment content. Extract what is being built and why.
163
203
 
164
204
  ```
165
205
  ---
@@ -183,7 +223,8 @@ For each wave:
183
223
  prompt="
184
224
  <objective>
185
225
  Execute plan {plan_number} of phase {phase_number}-{phase_name}.
186
- Commit each task atomically. Create SUMMARY.md.
226
+ Commit each task atomically. Post SUMMARY as GitHub comment.
227
+ Move task sub-issues on the board: In Progress when started, Done when completed.
187
228
  IMPORTANT: Do NOT update STATE.md or ROADMAP.md — the orchestrator handles metadata.
188
229
  </objective>
189
230
 
@@ -193,9 +234,14 @@ For each wave:
193
234
  @./references/checkpoints.md
194
235
  </execution_context>
195
236
 
237
+ <github_context>
238
+ Phase issue number: {phase_issue_number}
239
+ Plan comment body: {plan_comment_body}
240
+ Task mappings: {task_mappings_for_this_plan}
241
+ </github_context>
242
+
196
243
  <files_to_read>
197
244
  Read these files at execution start using the Read tool:
198
- - {phase_dir}/{plan_file} (Plan)
199
245
  - .planning/STATE.md (State — READ ONLY, do not modify)
200
246
  - .planning/config.json (Config, if exists)
201
247
  - ./CLAUDE.md (Project instructions, if exists)
@@ -203,14 +249,15 @@ For each wave:
203
249
 
204
250
  <constraints>
205
251
  - You are running in a worktree. Do NOT modify .planning/STATE.md or .planning/ROADMAP.md.
206
- - Only create SUMMARY.md and commit task code.
252
+ - Only post summary comment to GitHub and commit task code.
207
253
  - The orchestrator will handle metadata updates after all agents complete.
208
254
  </constraints>
209
255
 
210
256
  <success_criteria>
211
257
  - [ ] All tasks executed
212
258
  - [ ] Each task committed individually
213
- - [ ] SUMMARY.md created in plan directory
259
+ - [ ] Summary posted as GitHub comment (type=summary) on phase issue #{phase_issue_number}
260
+ - [ ] Task sub-issues moved: In Progress → Done per task
214
261
  </success_criteria>
215
262
  ",
216
263
  run_in_background=true
@@ -226,8 +273,8 @@ For each wave:
226
273
  ```
227
274
 
228
275
  5. **After all agents in wave complete, collect results:**
229
- - Read each SUMMARY.md from the worktree paths
230
- - Run spot-checks (same as standard path: files exist, commits present, review cycle check)
276
+ - Check for `<!-- maxsim:type=summary -->` comments on the phase issue for each plan
277
+ - Run spot-checks (same as standard path: summary comment exists, commits present, sub-issues closed, review cycle check)
231
278
  - Orchestrator performs batch metadata updates:
232
279
  ```bash
233
280
  for PLAN_ID in $COMPLETED_PLANS; do
@@ -242,7 +289,7 @@ For each wave:
242
289
  ## Wave {N} Complete (Batch)
243
290
 
244
291
  **{Plan ID}: {Plan Name}**
245
- {What was built — from SUMMARY.md}
292
+ {What was built — from summary comment}
246
293
  {Notable deviations, if any}
247
294
 
248
295
  {If more waves: what this enables for next wave}
@@ -256,12 +303,12 @@ For each wave:
256
303
 
257
304
  7. **Prepare inter-wave handoff context (for waves after Wave 1):**
258
305
 
259
- When spawning agents for the next wave, include a brief context block so they can reference prior wave outputs without reading full SUMMARYs:
306
+ When spawning agents for the next wave, include a brief context block so they can reference prior wave outputs without fetching full summary comments:
260
307
 
261
308
  ```
262
309
  <prior_wave_results>
263
310
  Wave {N-1} completed:
264
- {For each plan in prior wave: plan ID, one-liner from SUMMARY.md, key files created/modified}
311
+ {For each plan in prior wave: plan ID, one-liner from summary comment, key files created/modified}
265
312
  </prior_wave_results>
266
313
  ```
267
314
 
@@ -275,7 +322,7 @@ For each wave:
275
322
 
276
323
  1. **Describe what's being built (BEFORE spawning):**
277
324
 
278
- Read each plan's `<objective>`. Extract what's being built and why.
325
+ Read each plan's `<objective>` from the plan comment content (or local PLAN.md in fallback). Extract what's being built and why.
279
326
 
280
327
  ```
281
328
  ---
@@ -302,7 +349,7 @@ For each wave:
302
349
 
303
350
  3. **Spawn executor agents:**
304
351
 
305
- Pass paths only — executors read files themselves with their fresh 200k context.
352
+ Pass plan content from GitHub and GitHub context — executors do NOT need to read local PLAN.md files.
306
353
  This keeps orchestrator context lean (~10-15%).
307
354
 
308
355
  When the wave has multiple plans (parallel execution), add `team_name` to group agents:
@@ -315,7 +362,8 @@ For each wave:
315
362
  prompt="
316
363
  <objective>
317
364
  Execute plan {plan_number} of phase {phase_number}-{phase_name}.
318
- Commit each task atomically. Create SUMMARY.md. Update STATE.md and ROADMAP.md.
365
+ Commit each task atomically. Post SUMMARY as GitHub comment. Update STATE.md and ROADMAP.md.
366
+ Move task sub-issues on the board: In Progress when started, Done when completed.
319
367
  </objective>
320
368
 
321
369
  <execution_context>
@@ -325,9 +373,14 @@ For each wave:
325
373
  @./references/tdd.md
326
374
  </execution_context>
327
375
 
376
+ <github_context>
377
+ Phase issue number: {phase_issue_number}
378
+ Plan comment body: {plan_comment_body}
379
+ Task mappings: {task_mappings_for_this_plan}
380
+ </github_context>
381
+
328
382
  <files_to_read>
329
383
  Read these files at execution start using the Read tool:
330
- - {phase_dir}/{plan_file} (Plan)
331
384
  - .planning/STATE.md (State)
332
385
  - .planning/config.json (Config, if exists)
333
386
  - ./CLAUDE.md (Project instructions, if exists — follow project-specific guidelines and coding conventions)
@@ -337,7 +390,8 @@ For each wave:
337
390
  <success_criteria>
338
391
  - [ ] All tasks executed
339
392
  - [ ] Each task committed individually
340
- - [ ] SUMMARY.md created in plan directory
393
+ - [ ] Summary posted as GitHub comment (type=summary) on phase issue #{phase_issue_number}
394
+ - [ ] Task sub-issues moved: In Progress when started, Done when completed
341
395
  - [ ] STATE.md updated with position and decisions
342
396
  - [ ] ROADMAP.md updated with plan progress (via `roadmap update-plan-progress`)
343
397
  </success_criteria>
@@ -349,17 +403,21 @@ For each wave:
349
403
 
350
404
  4. **Report completion — spot-check claims and review cycle:**
351
405
 
352
- For each SUMMARY.md:
353
- - Verify first 2 files from `key-files.created` exist on disk
406
+ For each completed plan:
407
+ - Fetch the phase issue comments and verify a `<!-- maxsim:type=summary -->` comment exists for this plan
354
408
  - Check `git log --oneline --all --grep="{phase}-{plan}"` returns ≥1 commit
355
- - Check for `## Self-Check: FAILED` marker
356
- - **Check for `## Review Cycle` section** — verify both review stages (Spec and Code) show PASS or SKIPPED (not BLOCKED or FAIL)
409
+ - Verify all task sub-issues for this plan are closed:
410
+ ```
411
+ mcp_list_sub_issues(issue_number: phase_issue_number)
412
+ ```
413
+ - Check for `## Self-Check: FAILED` in the summary comment body
414
+ - **Check for `## Review Cycle` section** in the summary comment — verify both review stages (Spec and Code) show PASS or SKIPPED (not BLOCKED or FAIL)
357
415
 
358
416
  If ANY spot-check fails: report which plan failed, route to failure handler — ask "Retry plan?" or "Continue with remaining waves?"
359
417
 
360
418
  If review cycle is missing or has unresolved issues: flag the plan as **review-incomplete** — ask "Run review cycle for this plan?" or "Continue (review will block phase completion)?"
361
419
 
362
- **Note:** The executor agent runs the two-stage review (Spec Review + Code Review) after each wave. The orchestrator does NOT run reviews itself -- it only checks the executor's review results in SUMMARY.md. If review is missing, the executor failed to run it, and the orchestrator should offer to re-run the affected plan.
420
+ **Note:** The executor agent runs the two-stage review (Spec Review + Code Review) after each wave. The orchestrator does NOT run reviews itself it only checks the executor's review results in the summary comment. If review is missing, the executor failed to run it, and the orchestrator should offer to re-run the affected plan.
363
421
 
364
422
  Review stages to check: `Spec:` and `Code:` lines in `## Review Cycle`. Both must be PASS or SKIPPED for the plan to be considered review-complete.
365
423
 
@@ -378,7 +436,7 @@ For each wave:
378
436
  ## Wave {N} Complete
379
437
 
380
438
  **{Plan ID}: {Plan Name}**
381
- {What was built — from SUMMARY.md}
439
+ {What was built — from summary comment}
382
440
  {Notable deviations, if any}
383
441
 
384
442
  {If more waves: what this enables for next wave}
@@ -390,7 +448,7 @@ For each wave:
390
448
 
391
449
  5. **Handle failures:**
392
450
 
393
- **Known Claude Code bug (classifyHandoffIfNeeded):** If an agent reports "failed" with error containing `classifyHandoffIfNeeded is not defined`, this is a Claude Code runtime bug — not a MAXSIM or agent issue. The error fires in the completion handler AFTER all tool calls finish. In this case: run the same spot-checks as step 4 (SUMMARY.md exists, git commits present, no Self-Check: FAILED). If spot-checks PASS → treat as **successful**. If spot-checks FAIL → treat as real failure below.
451
+ **Known Claude Code bug (classifyHandoffIfNeeded):** If an agent reports "failed" with error containing `classifyHandoffIfNeeded is not defined`, this is a Claude Code runtime bug — not a MAXSIM or agent issue. The error fires in the completion handler AFTER all tool calls finish. In this case: run the same spot-checks as step 4 (summary comment exists, git commits present, sub-issues closed, no Self-Check: FAILED). If spot-checks PASS → treat as **successful**. If spot-checks FAIL → treat as real failure below.
394
452
 
395
453
  For real failures: report which plan failed → ask "Continue?" or "Stop?" → if continue, dependent plans may also fail. If stop, partial completion report.
396
454
 
@@ -398,12 +456,12 @@ For each wave:
398
456
 
399
457
  7. **Prepare inter-wave handoff context (for waves after Wave 1):**
400
458
 
401
- When spawning agents for the next wave, include a brief context block so they can reference prior wave outputs without reading full SUMMARYs:
459
+ When spawning agents for the next wave, include a brief context block so they can reference prior wave outputs without fetching full summary comments:
402
460
 
403
461
  ```
404
462
  <prior_wave_results>
405
463
  Wave {N-1} completed:
406
- {For each plan in prior wave: plan ID, one-liner from SUMMARY.md, key files created/modified}
464
+ {For each plan in prior wave: plan ID, one-liner from summary comment, key files created/modified}
407
465
  </prior_wave_results>
408
466
  ```
409
467
 
@@ -448,6 +506,7 @@ When executor returns a checkpoint AND `AUTO_CFG` is `"true"`:
448
506
  - `{resume_task_number}` + `{resume_task_name}`: Current task
449
507
  - `{user_response}`: What user provided
450
508
  - `{resume_instructions}`: Based on checkpoint type
509
+ - `{github_context}`: Pass phase_issue_number and task_mappings for board transitions
451
510
  7. Continuation agent verifies previous commits, continues from resume point
452
511
  8. Repeat until plan completes or user stops
453
512
 
@@ -473,8 +532,8 @@ After all waves:
473
532
  | 2 | plan-04 | ✓ Complete |
474
533
 
475
534
  ### Plan Details
476
- 1. **03-01**: [one-liner from SUMMARY.md]
477
- 2. **03-02**: [one-liner from SUMMARY.md]
535
+ 1. **03-01**: [one-liner from summary comment]
536
+ 2. **03-02**: [one-liner from summary comment]
478
537
 
479
538
  ### Review Cycle Summary
480
539
  | Plan | Spec Review | Code Review | Retries |
@@ -482,15 +541,15 @@ After all waves:
482
541
  | 03-01 | PASS | PASS | 0 |
483
542
  | 03-02 | PASS | PASS | 1 |
484
543
 
485
- [Aggregate review findings from each plan's SUMMARY.md `## Review Cycle` section.
486
- If any plan has no Review Cycle section: mark as "NOT RUN" and flag for attention.
544
+ [Aggregate review findings from each plan's summary comment `## Review Cycle` section.
545
+ If any plan has no Review Cycle section in its summary comment: mark as "NOT RUN" and flag for attention.
487
546
  If any plan has unresolved BLOCKED/FAIL status: list the blocking issues below.]
488
547
 
489
548
  ### Unresolved Review Issues
490
549
  [List any plans with BLOCKED or FAIL review stages. These MUST be resolved before phase completion.]
491
550
 
492
551
  ### Issues Encountered
493
- [Aggregate from SUMMARYs, or "None"]
552
+ [Aggregate from summary comments, or "None"]
494
553
  ```
495
554
 
496
555
  **Phase completion gate:** If any plan has unresolved review issues (BLOCKED or FAIL in Spec Review or Code Review stages), the phase CANNOT proceed to `verify_phase_goal`. Present unresolved issues and offer:
@@ -511,7 +570,14 @@ if [[ "$PHASE_NUMBER" == *.* ]]; then
511
570
  fi
512
571
  ```
513
572
 
514
- **2. Find parent UAT file:**
573
+ **2. Find parent UAT:**
574
+
575
+ When GitHub integration is active, look for `<!-- maxsim:type=uat -->` comments on the parent phase issue:
576
+ ```
577
+ mcp_get_issue_detail(issue_number: parent_phase_issue_number)
578
+ ```
579
+
580
+ As fallback, check local files:
515
581
  ```bash
516
582
  PARENT_INFO=$(node ~/.claude/maxsim/bin/maxsim-tools.cjs find-phase "${PARENT_PHASE}" --raw)
517
583
  # Extract directory from PARENT_INFO JSON, then find UAT file in that directory
@@ -521,14 +587,13 @@ PARENT_INFO=$(node ~/.claude/maxsim/bin/maxsim-tools.cjs find-phase "${PARENT_PH
521
587
 
522
588
  **3. Update UAT gap statuses:**
523
589
 
524
- Read the parent UAT file's `## Gaps` section. For each gap entry with `status: failed`:
590
+ Read the parent UAT content (from comment or local file). For each gap entry with `status: failed`:
525
591
  - Update to `status: resolved`
526
592
 
527
- **4. Update UAT frontmatter:**
593
+ **4. If all gaps resolved — update UAT status:**
528
594
 
529
- If all gaps now have `status: resolved`:
530
- - Update frontmatter `status: diagnosed` → `status: resolved`
531
- - Update frontmatter `updated:` timestamp
595
+ - If posting to GitHub: update the UAT comment body with resolved statuses
596
+ - If local file: update frontmatter `status: diagnosed` → `status: resolved`, update `updated:` timestamp
532
597
 
533
598
  **5. Resolve referenced debug sessions:**
534
599
 
@@ -555,17 +620,26 @@ Verify phase achieved its GOAL, not just completed tasks.
555
620
  Task(
556
621
  prompt="Verify phase {phase_number} goal achievement.
557
622
  Phase directory: {phase_dir}
623
+ Phase issue: #{phase_issue_number}
558
624
  Phase goal: {goal from ROADMAP.md}
559
625
  Phase requirement IDs: {phase_req_ids}
560
626
  Check must_haves against actual codebase.
561
- Cross-reference requirement IDs from PLAN frontmatter against REQUIREMENTS.md — every ID MUST be accounted for.
562
- Create VERIFICATION.md.",
627
+ Cross-reference requirement IDs from plan frontmatter against REQUIREMENTS.md — every ID MUST be accounted for.
628
+ Post verification results as a GitHub comment (mcp_post_comment with type=verification) on phase issue #{phase_issue_number}.
629
+ Also write VERIFICATION.md to the phase directory for local reference.",
563
630
  subagent_type="verifier",
564
631
  model="{verifier_model}"
565
632
  )
566
633
  ```
567
634
 
568
- Read status:
635
+ Read status from the verification comment posted to GitHub:
636
+ ```
637
+ mcp_get_issue_detail(issue_number: phase_issue_number)
638
+ ```
639
+
640
+ Look for `<!-- maxsim:type=verification -->` comment and parse `status:` field.
641
+
642
+ Fallback:
569
643
  ```bash
570
644
  grep "^status:" "$PHASE_DIR"/*-VERIFICATION.md | cut -d: -f2 | tr -d ' '
571
645
  ```
@@ -578,37 +652,37 @@ grep "^status:" "$PHASE_DIR"/*-VERIFICATION.md | cut -d: -f2 | tr -d ' '
578
652
 
579
653
  **If human_needed:**
580
654
  ```
581
- ## Phase {X}: {Name} — Human Verification Required
655
+ ## Phase {X}: {Name} — Human Verification Required
582
656
 
583
657
  All automated checks passed. {N} items need human testing:
584
658
 
585
- {From VERIFICATION.md human_verification section}
659
+ {From verification comment human_verification section}
586
660
 
587
661
  "approved" → continue | Report issues → gap closure
588
662
  ```
589
663
 
590
664
  **If gaps_found:**
591
665
  ```
592
- ## Phase {X}: {Name} — Gaps Found
666
+ ## Phase {X}: {Name} — Gaps Found
593
667
 
594
668
  **Score:** {N}/{M} must-haves verified
595
- **Report:** {phase_dir}/{phase_num}-VERIFICATION.md
669
+ **Report:** Phase issue #{phase_issue_number} (verification comment)
596
670
 
597
671
  ### What's Missing
598
- {Gap summaries from VERIFICATION.md}
672
+ {Gap summaries from verification comment}
599
673
 
600
674
  ---
601
- ## Next Up
675
+ ## Next Up
602
676
 
603
677
  `/maxsim:plan {X} --gaps`
604
678
 
605
679
  <sub>`/clear` first → fresh context window</sub>
606
680
 
607
- Also: `cat {phase_dir}/{phase_num}-VERIFICATION.md` full report
681
+ Also: view the verification comment on issue #{phase_issue_number} for the full report
608
682
  Also: `/maxsim:execute {X}` (includes verification) — manual testing first
609
683
  ```
610
684
 
611
- Gap closure cycle: `/maxsim:plan {X} --gaps` reads VERIFICATION.md → creates gap plans with `gap_closure: true` → user runs `/maxsim:execute {X} --gaps-only` → verifier re-runs.
685
+ Gap closure cycle: `/maxsim:plan {X} --gaps` reads verification comment → creates gap plans as new comments on phase issue (with `gap_closure: true` frontmatter) → user runs `/maxsim:execute {X} --gaps-only` → verifier re-runs.
612
686
  </step>
613
687
 
614
688
  <step name="update_roadmap">
@@ -631,6 +705,20 @@ Extract from result: `next_phase`, `next_phase_name`, `is_last_phase`.
631
705
  node ~/.claude/maxsim/bin/maxsim-tools.cjs commit "docs(phase-{X}): complete phase execution" --files .planning/ROADMAP.md .planning/STATE.md .planning/REQUIREMENTS.md {phase_dir}/*-VERIFICATION.md
632
706
  ```
633
707
 
708
+ **Move phase issue to Done on GitHub:**
709
+ ```
710
+ mcp_move_issue(issue_number: phase_issue_number, status: "Done")
711
+ ```
712
+
713
+ **Post phase completion summary comment on the phase issue:**
714
+ ```
715
+ mcp_post_comment(
716
+ issue_number: phase_issue_number,
717
+ type: "phase-complete",
718
+ body: "## Phase {phase_number} Execution Complete\n\nAll plans executed and verified.\n\n**Execution Mode:** {Batch | Standard}\n**Waves:** {wave_count}\n**Plans:** {completed}/{total}\n**Verification:** Passed\n\n### Plan Summary\n{one-liner per plan from summary comments}"
719
+ )
720
+ ```
721
+
634
722
  **Emit phase-complete lifecycle event** (if `DASHBOARD_ACTIVE`):
635
723
  ```
636
724
  mcp__maxsim-dashboard__submit_lifecycle_event(
@@ -660,6 +748,7 @@ After verification passes and roadmap is updated, return completion status to pa
660
748
  Phase: ${PHASE_NUMBER} - ${PHASE_NAME}
661
749
  Plans: ${completed_count}/${total_count}
662
750
  Verification: {Passed | Gaps Found}
751
+ GitHub: Phase issue #{phase_issue_number} moved to Done
663
752
 
664
753
  [Include aggregate_results output]
665
754
  ```
@@ -698,18 +787,20 @@ The workflow ends. The user runs `/maxsim:progress` or invokes the transition wo
698
787
 
699
788
  <context_efficiency>
700
789
  Orchestrator: ~10-15% context. Subagents: fresh 200k each. No polling (Task blocks). No context bleed.
790
+ Plan content passed directly from GitHub comments to subagents — no local PLAN.md reads in the orchestrator.
701
791
  </context_efficiency>
702
792
 
703
793
  <failure_handling>
704
- - **classifyHandoffIfNeeded false failure:** Agent reports "failed" but error is `classifyHandoffIfNeeded is not defined` → Claude Code bug, not MAXSIM. Spot-check (SUMMARY exists, commits present) → if pass, treat as success
705
- - **Agent fails mid-plan:** Missing SUMMARY.md → report, ask user how to proceed
794
+ - **classifyHandoffIfNeeded false failure:** Agent reports "failed" but error is `classifyHandoffIfNeeded is not defined` → Claude Code bug, not MAXSIM. Spot-check (summary comment exists, commits present, sub-issues closed) → if pass, treat as success
795
+ - **Agent fails mid-plan:** Missing summary comment on GitHub → report, ask user how to proceed
706
796
  - **Dependency chain breaks:** Wave 1 fails → Wave 2 dependents likely fail → user chooses attempt or skip
707
797
  - **All agents in wave fail:** Systemic issue → stop, report for investigation
708
798
  - **Checkpoint unresolvable:** "Skip this plan?" or "Abort phase execution?" → record partial progress in STATE.md
799
+ - **GitHub integration unavailable:** Fall back to local file I/O for all plan reading and summary writing
709
800
  </failure_handling>
710
801
 
711
802
  <resumption>
712
- Re-run `/maxsim:execute {phase}` → discover_plans finds completed SUMMARYs → skips them → resumes from first incomplete plan → continues wave execution.
803
+ Re-run `/maxsim:execute {phase}` → discover_and_group_plans fetches the phase issue comments and checks sub-issue closure → skips plans with all sub-issues closed → resumes from first incomplete plan → continues wave execution.
713
804
 
714
805
  STATE.md tracks: last completed plan, current wave, pending checkpoints.
715
806
  </resumption>