maxsimcli 4.8.0 → 4.9.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.
- package/dist/assets/CHANGELOG.md +13 -0
- package/dist/assets/hooks/maxsim-check-update.cjs +38 -0
- package/dist/assets/hooks/maxsim-check-update.cjs.map +1 -1
- package/dist/assets/hooks/maxsim-statusline.cjs +116 -48
- package/dist/assets/hooks/maxsim-statusline.cjs.map +1 -1
- package/dist/assets/hooks/maxsim-sync-reminder.cjs +117 -0
- package/dist/assets/hooks/maxsim-sync-reminder.cjs.map +1 -0
- package/dist/assets/templates/agents/AGENTS.md +78 -106
- package/dist/assets/templates/agents/executor.md +101 -0
- package/dist/assets/templates/agents/planner.md +86 -0
- package/dist/assets/templates/agents/researcher.md +71 -0
- package/dist/assets/templates/agents/verifier.md +88 -0
- package/dist/assets/templates/commands/maxsim/debug.md +7 -7
- package/dist/assets/templates/commands/maxsim/execute.md +45 -0
- package/dist/assets/templates/commands/maxsim/go.md +29 -0
- package/dist/assets/templates/commands/maxsim/help.md +2 -2
- package/dist/assets/templates/commands/maxsim/init.md +52 -0
- package/dist/assets/templates/commands/maxsim/plan.md +50 -0
- package/dist/assets/templates/commands/maxsim/progress.md +4 -3
- package/dist/assets/templates/commands/maxsim/quick.md +6 -4
- package/dist/assets/templates/commands/maxsim/settings.md +4 -3
- package/dist/assets/templates/references/continuation-format.md +16 -16
- package/dist/assets/templates/references/model-profile-resolution.md +1 -1
- package/dist/assets/templates/references/model-profiles.md +12 -19
- package/dist/assets/templates/rules/conventions.md +51 -0
- package/dist/assets/templates/rules/verification-protocol.md +57 -0
- package/dist/assets/templates/skills/agent-system-map/SKILL.md +92 -0
- package/dist/assets/templates/skills/brainstorming/SKILL.md +48 -36
- package/dist/assets/templates/skills/code-review/SKILL.md +40 -61
- package/dist/assets/templates/skills/commit-conventions/SKILL.md +75 -0
- package/dist/assets/templates/skills/evidence-collection/SKILL.md +87 -0
- package/dist/assets/templates/skills/handoff-contract/SKILL.md +70 -0
- package/dist/assets/templates/skills/input-validation/SKILL.md +51 -0
- package/dist/assets/templates/skills/maxsim-batch/SKILL.md +41 -45
- package/dist/assets/templates/skills/maxsim-simplify/SKILL.md +37 -90
- package/dist/assets/templates/skills/memory-management/SKILL.md +32 -67
- package/dist/assets/templates/skills/research-methodology/SKILL.md +137 -0
- package/dist/assets/templates/skills/roadmap-writing/SKILL.md +40 -58
- package/dist/assets/templates/skills/sdd/SKILL.md +34 -69
- package/dist/assets/templates/skills/systematic-debugging/SKILL.md +20 -26
- package/dist/assets/templates/skills/tdd/SKILL.md +25 -33
- package/dist/assets/templates/skills/tool-priority-guide/SKILL.md +80 -0
- package/dist/assets/templates/skills/using-maxsim/SKILL.md +42 -73
- package/dist/assets/templates/skills/verification-before-completion/SKILL.md +12 -24
- package/dist/assets/templates/skills/verification-gates/SKILL.md +169 -0
- package/dist/assets/templates/templates/UAT.md +3 -3
- package/dist/assets/templates/templates/VALIDATION.md +1 -1
- package/dist/assets/templates/templates/context.md +4 -4
- package/dist/assets/templates/templates/debug-subagent-prompt.md +3 -3
- package/dist/assets/templates/templates/discovery.md +2 -2
- package/dist/assets/templates/templates/phase-prompt.md +2 -2
- package/dist/assets/templates/templates/planner-subagent-prompt.md +7 -7
- package/dist/assets/templates/templates/project.md +1 -1
- package/dist/assets/templates/templates/research.md +1 -1
- package/dist/assets/templates/templates/state.md +2 -2
- package/dist/assets/templates/templates/summary.md +41 -0
- package/dist/assets/templates/workflows/batch.md +5 -5
- package/dist/assets/templates/workflows/diagnose-issues.md +2 -2
- package/dist/assets/templates/workflows/discovery-phase.md +3 -3
- package/dist/assets/templates/workflows/discuss-phase.md +11 -11
- package/dist/assets/templates/workflows/execute-phase.md +205 -11
- package/dist/assets/templates/workflows/execute-plan.md +299 -34
- package/dist/assets/templates/workflows/execute.md +421 -0
- package/dist/assets/templates/workflows/go.md +250 -0
- package/dist/assets/templates/workflows/health.md +5 -5
- package/dist/assets/templates/workflows/help.md +165 -435
- package/dist/assets/templates/workflows/init-existing.md +23 -23
- package/dist/assets/templates/workflows/init.md +205 -0
- package/dist/assets/templates/workflows/new-milestone.md +9 -9
- package/dist/assets/templates/workflows/new-project.md +26 -26
- package/dist/assets/templates/workflows/plan-create.md +298 -0
- package/dist/assets/templates/workflows/plan-discuss.md +347 -0
- package/dist/assets/templates/workflows/plan-phase.md +29 -29
- package/dist/assets/templates/workflows/plan-research.md +177 -0
- package/dist/assets/templates/workflows/plan.md +231 -0
- package/dist/assets/templates/workflows/progress.md +46 -42
- package/dist/assets/templates/workflows/quick.md +195 -14
- package/dist/assets/templates/workflows/research-phase.md +5 -5
- package/dist/assets/templates/workflows/sdd.md +20 -12
- package/dist/assets/templates/workflows/settings.md +18 -14
- package/dist/assets/templates/workflows/verify-phase.md +1 -1
- package/dist/assets/templates/workflows/verify-work.md +16 -16
- package/dist/cli.cjs +496 -91
- package/dist/cli.cjs.map +1 -1
- package/dist/core-D5zUr9cb.cjs.map +1 -1
- package/dist/install.cjs +234 -17
- package/dist/install.cjs.map +1 -1
- package/dist/mcp-server.cjs +21 -2
- package/dist/mcp-server.cjs.map +1 -1
- package/dist/skills-CjFWZIGM.cjs.map +1 -1
- package/package.json +1 -1
- package/dist/assets/hooks/maxsim-context-monitor.cjs +0 -121
- package/dist/assets/hooks/maxsim-context-monitor.cjs.map +0 -1
- package/dist/assets/templates/agents/maxsim-code-reviewer.md +0 -239
- package/dist/assets/templates/agents/maxsim-codebase-mapper.md +0 -214
- package/dist/assets/templates/agents/maxsim-debugger.md +0 -572
- package/dist/assets/templates/agents/maxsim-drift-checker.md +0 -522
- package/dist/assets/templates/agents/maxsim-executor.md +0 -504
- package/dist/assets/templates/agents/maxsim-integration-checker.md +0 -273
- package/dist/assets/templates/agents/maxsim-phase-researcher.md +0 -305
- package/dist/assets/templates/agents/maxsim-plan-checker.md +0 -343
- package/dist/assets/templates/agents/maxsim-planner.md +0 -610
- package/dist/assets/templates/agents/maxsim-project-researcher.md +0 -359
- package/dist/assets/templates/agents/maxsim-research-synthesizer.md +0 -263
- package/dist/assets/templates/agents/maxsim-roadmapper.md +0 -324
- package/dist/assets/templates/agents/maxsim-spec-reviewer.md +0 -245
- package/dist/assets/templates/agents/maxsim-verifier.md +0 -393
- package/dist/assets/templates/commands/maxsim/add-phase.md +0 -43
- package/dist/assets/templates/commands/maxsim/add-tests.md +0 -41
- package/dist/assets/templates/commands/maxsim/add-todo.md +0 -57
- package/dist/assets/templates/commands/maxsim/artefakte.md +0 -122
- package/dist/assets/templates/commands/maxsim/audit-milestone.md +0 -36
- package/dist/assets/templates/commands/maxsim/batch.md +0 -42
- package/dist/assets/templates/commands/maxsim/check-drift.md +0 -56
- package/dist/assets/templates/commands/maxsim/check-todos.md +0 -46
- package/dist/assets/templates/commands/maxsim/cleanup.md +0 -18
- package/dist/assets/templates/commands/maxsim/complete-milestone.md +0 -136
- package/dist/assets/templates/commands/maxsim/discuss-phase.md +0 -87
- package/dist/assets/templates/commands/maxsim/discuss.md +0 -70
- package/dist/assets/templates/commands/maxsim/execute-phase.md +0 -41
- package/dist/assets/templates/commands/maxsim/health.md +0 -22
- package/dist/assets/templates/commands/maxsim/init-existing.md +0 -46
- package/dist/assets/templates/commands/maxsim/insert-phase.md +0 -32
- package/dist/assets/templates/commands/maxsim/list-phase-assumptions.md +0 -46
- package/dist/assets/templates/commands/maxsim/map-codebase.md +0 -71
- package/dist/assets/templates/commands/maxsim/new-milestone.md +0 -44
- package/dist/assets/templates/commands/maxsim/new-project.md +0 -46
- package/dist/assets/templates/commands/maxsim/pause-work.md +0 -38
- package/dist/assets/templates/commands/maxsim/plan-milestone-gaps.md +0 -34
- package/dist/assets/templates/commands/maxsim/plan-phase.md +0 -44
- package/dist/assets/templates/commands/maxsim/realign.md +0 -39
- package/dist/assets/templates/commands/maxsim/reapply-patches.md +0 -110
- package/dist/assets/templates/commands/maxsim/remove-phase.md +0 -31
- package/dist/assets/templates/commands/maxsim/research-phase.md +0 -189
- package/dist/assets/templates/commands/maxsim/resume-work.md +0 -40
- package/dist/assets/templates/commands/maxsim/roadmap.md +0 -19
- package/dist/assets/templates/commands/maxsim/sdd.md +0 -39
- package/dist/assets/templates/commands/maxsim/set-profile.md +0 -34
- package/dist/assets/templates/commands/maxsim/update.md +0 -37
- package/dist/assets/templates/commands/maxsim/verify-work.md +0 -38
- package/dist/assets/templates/workflows/add-phase.md +0 -111
- package/dist/assets/templates/workflows/add-tests.md +0 -351
- package/dist/assets/templates/workflows/add-todo.md +0 -247
- package/dist/assets/templates/workflows/audit-milestone.md +0 -297
- package/dist/assets/templates/workflows/check-drift.md +0 -248
- package/dist/assets/templates/workflows/check-todos.md +0 -261
- package/dist/assets/templates/workflows/cleanup.md +0 -153
- package/dist/assets/templates/workflows/complete-milestone.md +0 -701
- package/dist/assets/templates/workflows/discuss.md +0 -343
- package/dist/assets/templates/workflows/insert-phase.md +0 -129
- package/dist/assets/templates/workflows/list-phase-assumptions.md +0 -178
- package/dist/assets/templates/workflows/map-codebase.md +0 -315
- package/dist/assets/templates/workflows/pause-work.md +0 -122
- package/dist/assets/templates/workflows/plan-milestone-gaps.md +0 -274
- package/dist/assets/templates/workflows/realign.md +0 -288
- package/dist/assets/templates/workflows/remove-phase.md +0 -154
- package/dist/assets/templates/workflows/resume-project.md +0 -306
- package/dist/assets/templates/workflows/roadmap.md +0 -130
- package/dist/assets/templates/workflows/set-profile.md +0 -81
- package/dist/assets/templates/workflows/transition.md +0 -544
- package/dist/assets/templates/workflows/update.md +0 -220
|
@@ -77,7 +77,7 @@ grep -n "type=\"checkpoint" .planning/phases/XX-name/{phase}-{plan}-PLAN.md
|
|
|
77
77
|
| Verify-only | B (segmented) | Segments between checkpoints. After none/human-verify → SUBAGENT. After decision/human-action → MAIN |
|
|
78
78
|
| Decision | C (main) | Execute entirely in main context |
|
|
79
79
|
|
|
80
|
-
**Pattern A:** init_agent_tracking → spawn Task(subagent_type="
|
|
80
|
+
**Pattern A:** init_agent_tracking → spawn Task(subagent_type="executor", model=executor_model) with prompt: execute plan at [path], autonomous, all tasks + SUMMARY + commit, follow deviation/auth rules, report: plan name, tasks, SUMMARY path, commit hash → track agent_id → wait → update tracking → report.
|
|
81
81
|
|
|
82
82
|
**Pattern B:** Execute segment-by-segment. Autonomous segments: spawn subagent for assigned tasks only (no SUMMARY/commit). Checkpoints: main context. After all segments: aggregate, create SUMMARY, commit. See segment_execution.
|
|
83
83
|
|
|
@@ -110,7 +110,7 @@ Pattern B only (verify-only checkpoints). Skip for A/C.
|
|
|
110
110
|
|
|
111
111
|
1. Parse segment map: checkpoint locations and types
|
|
112
112
|
2. Per segment:
|
|
113
|
-
- Subagent route: spawn
|
|
113
|
+
- Subagent route: spawn executor for assigned tasks only. Prompt: task range, plan path, read full plan for context, execute assigned tasks, track deviations, NO SUMMARY/commit. Track via agent protocol.
|
|
114
114
|
- Main route: execute tasks using standard flow (step name="execute")
|
|
115
115
|
3. After ALL segments: aggregate files/deviations/decisions → create SUMMARY.md → commit → self-check:
|
|
116
116
|
- Verify key-files.created exist on disk with `[ -f ]`
|
|
@@ -131,6 +131,42 @@ cat .planning/phases/XX-name/{phase}-{plan}-PLAN.md
|
|
|
131
131
|
This IS the execution instructions. Follow exactly. If plan references CONTEXT.md: honor user's vision throughout.
|
|
132
132
|
</step>
|
|
133
133
|
|
|
134
|
+
<step name="pre_execution_gates">
|
|
135
|
+
Validate requirements before execution. These gates ensure spec-driven development.
|
|
136
|
+
|
|
137
|
+
**Gate G1: Requirement Existence** — All requirement IDs from the plan's frontmatter must exist in REQUIREMENTS.md.
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
# Extract requirement IDs from plan frontmatter
|
|
141
|
+
REQ_IDS=$(grep "^requirements:" "$PLAN_PATH" | sed 's/requirements:\s*\[//;s/\]//;s/,/ /g;s/"//g;s/'\''//g' | tr -s ' ')
|
|
142
|
+
if [ -n "$REQ_IDS" ]; then
|
|
143
|
+
G1_RESULT=$(node ~/.claude/maxsim/bin/maxsim-tools.cjs verify requirement-existence $REQ_IDS)
|
|
144
|
+
G1_VALID=$(echo "$G1_RESULT" | node -e "process.stdin.on('data',d=>console.log(JSON.parse(d).valid))")
|
|
145
|
+
if [ "$G1_VALID" != "true" ]; then
|
|
146
|
+
G1_MISSING=$(echo "$G1_RESULT" | node -e "process.stdin.on('data',d=>console.log(JSON.parse(d).missing.join(', ')))")
|
|
147
|
+
echo "GATE G1 FAILED: Requirements not found in REQUIREMENTS.md: $G1_MISSING"
|
|
148
|
+
echo "Fix: Add missing requirements to REQUIREMENTS.md or update plan frontmatter."
|
|
149
|
+
# STOP execution — this is a hard gate
|
|
150
|
+
fi
|
|
151
|
+
fi
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
**Gate G2: Requirement Status** — Requirement IDs must not already be marked Complete.
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
if [ -n "$REQ_IDS" ]; then
|
|
158
|
+
G2_RESULT=$(node ~/.claude/maxsim/bin/maxsim-tools.cjs verify requirement-status $REQ_IDS)
|
|
159
|
+
G2_VALID=$(echo "$G2_RESULT" | node -e "process.stdin.on('data',d=>console.log(JSON.parse(d).valid))")
|
|
160
|
+
if [ "$G2_VALID" != "true" ]; then
|
|
161
|
+
G2_COMPLETE=$(echo "$G2_RESULT" | node -e "process.stdin.on('data',d=>console.log(JSON.parse(d).already_complete.join(', ')))")
|
|
162
|
+
echo "GATE G2 WARNING: Requirements already marked complete: $G2_COMPLETE"
|
|
163
|
+
echo "This plan may be re-implementing completed work. Proceeding with warning."
|
|
164
|
+
# WARNING only — log but continue (re-execution scenarios are valid)
|
|
165
|
+
fi
|
|
166
|
+
fi
|
|
167
|
+
```
|
|
168
|
+
</step>
|
|
169
|
+
|
|
134
170
|
<step name="previous_phase_check">
|
|
135
171
|
```bash
|
|
136
172
|
node ~/.claude/maxsim/bin/maxsim-tools.cjs phases list --type summaries --raw
|
|
@@ -348,12 +384,41 @@ Next: more plans → "Ready for {next-plan}" | last → "Phase complete, ready f
|
|
|
348
384
|
|
|
349
385
|
After implementation is complete and SUMMARY.md is created, run the full review cycle before proceeding. All four stages must pass before the plan is considered done.
|
|
350
386
|
|
|
351
|
-
|
|
387
|
+
### Retry Counter Initialization
|
|
388
|
+
|
|
389
|
+
```
|
|
390
|
+
SPEC_ATTEMPTS=0
|
|
391
|
+
CODE_ATTEMPTS=0
|
|
392
|
+
SIMPLIFY_ATTEMPTS=0
|
|
393
|
+
FINAL_ATTEMPTS=0
|
|
394
|
+
MAX_REVIEW_ATTEMPTS=3
|
|
395
|
+
REVIEW_ESCALATIONS=0
|
|
396
|
+
REVIEW_ESCALATION_DETAILS=""
|
|
397
|
+
REVIEW_CYCLE_START=$(date +%s)
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
---
|
|
401
|
+
|
|
402
|
+
### Stage 1: Spec Review — Verify implementation matches plan spec.
|
|
403
|
+
|
|
404
|
+
```
|
|
405
|
+
SPEC_STAGE_START=$(date +%s)
|
|
406
|
+
SPEC_RESULT="PENDING"
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
**Retry loop (max MAX_REVIEW_ATTEMPTS):**
|
|
410
|
+
|
|
411
|
+
1. Increment `SPEC_ATTEMPTS`
|
|
412
|
+
2. Spawn verifier:
|
|
352
413
|
|
|
353
414
|
```
|
|
354
415
|
Task(
|
|
355
|
-
subagent_type="
|
|
416
|
+
subagent_type="verifier",
|
|
356
417
|
prompt="
|
|
418
|
+
## Task: Review for spec compliance
|
|
419
|
+
|
|
420
|
+
## Suggested Skills: verification-gates, evidence-collection
|
|
421
|
+
|
|
357
422
|
<objective>
|
|
358
423
|
Review plan {phase}-{plan} for spec compliance.
|
|
359
424
|
</objective>
|
|
@@ -381,14 +446,54 @@ Task(
|
|
|
381
446
|
)
|
|
382
447
|
```
|
|
383
448
|
|
|
384
|
-
**If
|
|
449
|
+
3. **If PASS:** Set `SPEC_RESULT="PASS"`, record `SPEC_STAGE_END=$(date +%s)`, proceed to Stage 2.
|
|
450
|
+
|
|
451
|
+
4. **If FAIL and SPEC_ATTEMPTS < MAX_REVIEW_ATTEMPTS:** Fix the unmet requirements identified by the verifier, re-stage and commit fixes (`fix({phase}-{plan}): address spec review findings`), update SUMMARY.md, then loop back to step 1.
|
|
452
|
+
|
|
453
|
+
5. **If FAIL and SPEC_ATTEMPTS >= MAX_REVIEW_ATTEMPTS:** Escalate to user:
|
|
454
|
+
|
|
455
|
+
```markdown
|
|
456
|
+
## Review Escalation: Spec Review Failed After 3 Attempts
|
|
457
|
+
|
|
458
|
+
**Stage:** Spec Review
|
|
459
|
+
**Attempts:** 3/3
|
|
460
|
+
**Last failure reason:** {failure details from verifier}
|
|
461
|
+
|
|
462
|
+
The spec review has failed 3 times. This may indicate a fundamental mismatch between the plan spec and the implementation.
|
|
463
|
+
|
|
464
|
+
**Options:**
|
|
465
|
+
1. Fix manually and type "retry" to re-run spec review (resets attempt counter)
|
|
466
|
+
2. Type "override" to skip spec review (will be flagged in SUMMARY.md)
|
|
467
|
+
3. Type "abort" to stop execution
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
Wait for user response:
|
|
471
|
+
- **"retry":** Reset `SPEC_ATTEMPTS=0`, loop back to step 1.
|
|
472
|
+
- **"override":** Set `SPEC_RESULT="OVERRIDDEN"`, increment `REVIEW_ESCALATIONS`, record `SPEC_STAGE_END=$(date +%s)`, proceed to Stage 2.
|
|
473
|
+
- **"abort":** Stop execution, create partial SUMMARY.md with review status.
|
|
474
|
+
|
|
475
|
+
---
|
|
476
|
+
|
|
477
|
+
### Stage 2: Code Review — Check code quality, security, error handling.
|
|
478
|
+
|
|
479
|
+
```
|
|
480
|
+
CODE_STAGE_START=$(date +%s)
|
|
481
|
+
CODE_RESULT="PENDING"
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
**Retry loop (max MAX_REVIEW_ATTEMPTS):**
|
|
385
485
|
|
|
386
|
-
|
|
486
|
+
1. Increment `CODE_ATTEMPTS`
|
|
487
|
+
2. Spawn verifier:
|
|
387
488
|
|
|
388
489
|
```
|
|
389
490
|
Task(
|
|
390
|
-
subagent_type="
|
|
491
|
+
subagent_type="verifier",
|
|
391
492
|
prompt="
|
|
493
|
+
## Task: Review code quality
|
|
494
|
+
|
|
495
|
+
## Suggested Skills: code-review
|
|
496
|
+
|
|
392
497
|
<objective>
|
|
393
498
|
Review plan {phase}-{plan} code quality. Spec compliance already verified.
|
|
394
499
|
</objective>
|
|
@@ -407,16 +512,61 @@ Task(
|
|
|
407
512
|
)
|
|
408
513
|
```
|
|
409
514
|
|
|
410
|
-
**If
|
|
515
|
+
3. **If APPROVED:** Set `CODE_RESULT="APPROVED"`, record `CODE_STAGE_END=$(date +%s)`, proceed to Stage 3.
|
|
411
516
|
|
|
412
|
-
|
|
517
|
+
4. **If BLOCKED and CODE_ATTEMPTS < MAX_REVIEW_ATTEMPTS:** Fix all blocker and high-severity issues, re-stage and commit fixes (`fix({phase}-{plan}): address code review findings`), then loop back to step 1.
|
|
413
518
|
|
|
414
|
-
**
|
|
519
|
+
5. **If BLOCKED and CODE_ATTEMPTS >= MAX_REVIEW_ATTEMPTS:** Escalate to user:
|
|
520
|
+
|
|
521
|
+
```markdown
|
|
522
|
+
## Review Escalation: Code Review Failed After 3 Attempts
|
|
523
|
+
|
|
524
|
+
**Stage:** Code Review
|
|
525
|
+
**Attempts:** 3/3
|
|
526
|
+
**Last failure reason:** {blocking issues from verifier}
|
|
527
|
+
|
|
528
|
+
The code review has been blocked 3 times. Remaining issues may require architectural changes or user guidance.
|
|
529
|
+
|
|
530
|
+
**Options:**
|
|
531
|
+
1. Fix manually and type "retry" to re-run code review (resets attempt counter)
|
|
532
|
+
2. Type "override" to skip code review (will be flagged in SUMMARY.md)
|
|
533
|
+
3. Type "abort" to stop execution
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
Wait for user response:
|
|
537
|
+
- **"retry":** Reset `CODE_ATTEMPTS=0`, loop back to step 1.
|
|
538
|
+
- **"override":** Set `CODE_RESULT="OVERRIDDEN"`, increment `REVIEW_ESCALATIONS`, record `CODE_STAGE_END=$(date +%s)`, proceed to Stage 3.
|
|
539
|
+
- **"abort":** Stop execution, create partial SUMMARY.md with review status.
|
|
540
|
+
|
|
541
|
+
---
|
|
542
|
+
|
|
543
|
+
### Stage 3: Simplify — Config-gated, spawn 3 parallel reviewers.
|
|
544
|
+
|
|
545
|
+
**Config gate check:**
|
|
546
|
+
```bash
|
|
547
|
+
SIMPLIFY_ENABLED=$(node ~/.claude/maxsim/bin/maxsim-tools.cjs config-get review.simplify_review 2>/dev/null || echo "true")
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
**If `SIMPLIFY_ENABLED` is "false":** Skip Stage 3 and Stage 4 entirely. Log: "Simplify stage skipped (disabled in config)". Set `SIMPLIFY_RESULT="SKIPPED"`, `FINAL_RESULT="N/A"`. Proceed to review cycle tracking.
|
|
551
|
+
|
|
552
|
+
**If `SIMPLIFY_ENABLED` is "true" (default):**
|
|
553
|
+
|
|
554
|
+
```
|
|
555
|
+
SIMPLIFY_STAGE_START=$(date +%s)
|
|
556
|
+
SIMPLIFY_RESULT="PENDING"
|
|
557
|
+
SIMPLIFY_ATTEMPTS=0
|
|
558
|
+
```
|
|
559
|
+
|
|
560
|
+
**Reviewer 1 -- Code Reuse:**
|
|
415
561
|
|
|
416
562
|
```
|
|
417
563
|
Task(
|
|
418
|
-
subagent_type="
|
|
564
|
+
subagent_type="verifier",
|
|
419
565
|
prompt="
|
|
566
|
+
## Task: Review for code reuse opportunities
|
|
567
|
+
|
|
568
|
+
## Suggested Skills: code-review
|
|
569
|
+
|
|
420
570
|
<objective>
|
|
421
571
|
Review plan {phase}-{plan} for code reuse opportunities.
|
|
422
572
|
</objective>
|
|
@@ -437,12 +587,16 @@ Task(
|
|
|
437
587
|
)
|
|
438
588
|
```
|
|
439
589
|
|
|
440
|
-
**Reviewer 2
|
|
590
|
+
**Reviewer 2 -- Code Quality:**
|
|
441
591
|
|
|
442
592
|
```
|
|
443
593
|
Task(
|
|
444
|
-
subagent_type="
|
|
594
|
+
subagent_type="verifier",
|
|
445
595
|
prompt="
|
|
596
|
+
## Task: Review for code quality issues
|
|
597
|
+
|
|
598
|
+
## Suggested Skills: code-review
|
|
599
|
+
|
|
446
600
|
<objective>
|
|
447
601
|
Review plan {phase}-{plan} for code quality issues.
|
|
448
602
|
</objective>
|
|
@@ -463,12 +617,16 @@ Task(
|
|
|
463
617
|
)
|
|
464
618
|
```
|
|
465
619
|
|
|
466
|
-
**Reviewer 3
|
|
620
|
+
**Reviewer 3 -- Efficiency:**
|
|
467
621
|
|
|
468
622
|
```
|
|
469
623
|
Task(
|
|
470
|
-
subagent_type="
|
|
624
|
+
subagent_type="verifier",
|
|
471
625
|
prompt="
|
|
626
|
+
## Task: Review for efficiency issues
|
|
627
|
+
|
|
628
|
+
## Suggested Skills: code-review
|
|
629
|
+
|
|
472
630
|
<objective>
|
|
473
631
|
Review plan {phase}-{plan} for efficiency issues.
|
|
474
632
|
</objective>
|
|
@@ -492,14 +650,15 @@ Task(
|
|
|
492
650
|
**Consolidation (after all 3 reviewers complete):**
|
|
493
651
|
|
|
494
652
|
After all three reviewers report:
|
|
495
|
-
- If ALL returned CLEAN:
|
|
653
|
+
- If ALL returned CLEAN: Set `SIMPLIFY_RESULT="CLEAN"`, record `SIMPLIFY_STAGE_END=$(date +%s)`, skip Stage 4. Set `FINAL_RESULT="N/A"`.
|
|
496
654
|
- If ANY returned ISSUES_FOUND:
|
|
497
|
-
1.
|
|
498
|
-
2.
|
|
655
|
+
1. Increment `SIMPLIFY_ATTEMPTS`
|
|
656
|
+
2. Merge findings into deduplicated list
|
|
657
|
+
3. Spawn single executor to apply fixes:
|
|
499
658
|
|
|
500
659
|
```
|
|
501
660
|
Task(
|
|
502
|
-
subagent_type="
|
|
661
|
+
subagent_type="executor",
|
|
503
662
|
prompt="
|
|
504
663
|
<objective>
|
|
505
664
|
Apply simplification fixes for plan {phase}-{plan} based on reviewer findings.
|
|
@@ -523,16 +682,56 @@ Task(
|
|
|
523
682
|
)
|
|
524
683
|
```
|
|
525
684
|
|
|
526
|
-
**If
|
|
685
|
+
4. **If FIXED:** Set `SIMPLIFY_RESULT="FIXED"`, record `SIMPLIFY_STAGE_END=$(date +%s)`, proceed to Stage 4.
|
|
527
686
|
|
|
528
|
-
**
|
|
687
|
+
5. **If BLOCKED and SIMPLIFY_ATTEMPTS < MAX_REVIEW_ATTEMPTS:** Re-run the 3 reviewers to find alternative fixes, then loop.
|
|
688
|
+
|
|
689
|
+
6. **If BLOCKED and SIMPLIFY_ATTEMPTS >= MAX_REVIEW_ATTEMPTS:** Escalate to user:
|
|
690
|
+
|
|
691
|
+
```markdown
|
|
692
|
+
## Review Escalation: Simplify Stage Blocked After 3 Attempts
|
|
529
693
|
|
|
530
|
-
|
|
694
|
+
**Stage:** Simplify
|
|
695
|
+
**Attempts:** 3/3
|
|
696
|
+
**Last failure reason:** {architectural issues from executor}
|
|
697
|
+
|
|
698
|
+
The simplify stage has been blocked 3 times. Remaining issues require architectural changes.
|
|
699
|
+
|
|
700
|
+
**Options:**
|
|
701
|
+
1. Fix manually and type "retry" to re-run simplify (resets attempt counter)
|
|
702
|
+
2. Type "override" to skip simplify (will be flagged in SUMMARY.md)
|
|
703
|
+
3. Type "abort" to stop execution
|
|
704
|
+
```
|
|
705
|
+
|
|
706
|
+
Wait for user response:
|
|
707
|
+
- **"retry":** Reset `SIMPLIFY_ATTEMPTS=0`, re-run 3 reviewers.
|
|
708
|
+
- **"override":** Set `SIMPLIFY_RESULT="OVERRIDDEN"`, increment `REVIEW_ESCALATIONS`, record `SIMPLIFY_STAGE_END=$(date +%s)`, skip Stage 4. Set `FINAL_RESULT="N/A"`.
|
|
709
|
+
- **"abort":** Stop execution, create partial SUMMARY.md with review status.
|
|
710
|
+
|
|
711
|
+
---
|
|
712
|
+
|
|
713
|
+
### Stage 4: Final Review — If simplify made changes, one more code review pass.
|
|
714
|
+
|
|
715
|
+
Run this stage ONLY if Stage 3 reported FIXED (i.e., simplify found and applied fixes). If Stage 3 was CLEAN, SKIPPED, or OVERRIDDEN: set `FINAL_RESULT="N/A"`, skip to review cycle tracking.
|
|
716
|
+
|
|
717
|
+
```
|
|
718
|
+
FINAL_STAGE_START=$(date +%s)
|
|
719
|
+
FINAL_RESULT="PENDING"
|
|
720
|
+
```
|
|
721
|
+
|
|
722
|
+
**Retry loop (max MAX_REVIEW_ATTEMPTS):**
|
|
723
|
+
|
|
724
|
+
1. Increment `FINAL_ATTEMPTS`
|
|
725
|
+
2. Spawn verifier:
|
|
531
726
|
|
|
532
727
|
```
|
|
533
728
|
Task(
|
|
534
|
-
subagent_type="
|
|
729
|
+
subagent_type="verifier",
|
|
535
730
|
prompt="
|
|
731
|
+
## Task: Final review after simplification
|
|
732
|
+
|
|
733
|
+
## Suggested Skills: code-review
|
|
734
|
+
|
|
536
735
|
<objective>
|
|
537
736
|
Final review pass after simplification changes on plan {phase}-{plan}.
|
|
538
737
|
Verify simplification fixes did not introduce regressions.
|
|
@@ -558,18 +757,64 @@ Task(
|
|
|
558
757
|
)
|
|
559
758
|
```
|
|
560
759
|
|
|
561
|
-
**If
|
|
760
|
+
3. **If APPROVED:** Set `FINAL_RESULT="APPROVED"`, record `FINAL_STAGE_END=$(date +%s)`, proceed to review cycle tracking.
|
|
761
|
+
|
|
762
|
+
4. **If BLOCKED and FINAL_ATTEMPTS < MAX_REVIEW_ATTEMPTS:** Fix issues, re-stage and commit fixes (`fix({phase}-{plan}): address final review findings`), then loop back to step 1.
|
|
763
|
+
|
|
764
|
+
5. **If BLOCKED and FINAL_ATTEMPTS >= MAX_REVIEW_ATTEMPTS:** Escalate to user:
|
|
765
|
+
|
|
766
|
+
```markdown
|
|
767
|
+
## Review Escalation: Final Review Blocked After 3 Attempts
|
|
768
|
+
|
|
769
|
+
**Stage:** Final Review
|
|
770
|
+
**Attempts:** 3/3
|
|
771
|
+
**Last failure reason:** {blocking issues from verifier}
|
|
772
|
+
|
|
773
|
+
The final review has been blocked 3 times after simplification changes.
|
|
774
|
+
|
|
775
|
+
**Options:**
|
|
776
|
+
1. Fix manually and type "retry" to re-run final review (resets attempt counter)
|
|
777
|
+
2. Type "override" to skip final review (will be flagged in SUMMARY.md)
|
|
778
|
+
3. Type "abort" to stop execution
|
|
779
|
+
```
|
|
780
|
+
|
|
781
|
+
Wait for user response:
|
|
782
|
+
- **"retry":** Reset `FINAL_ATTEMPTS=0`, loop back to step 1.
|
|
783
|
+
- **"override":** Set `FINAL_RESULT="OVERRIDDEN"`, increment `REVIEW_ESCALATIONS`, record `FINAL_STAGE_END=$(date +%s)`, proceed to review cycle tracking.
|
|
784
|
+
- **"abort":** Stop execution, create partial SUMMARY.md with review status.
|
|
785
|
+
|
|
786
|
+
---
|
|
787
|
+
|
|
788
|
+
### Review Cycle Tracking
|
|
789
|
+
|
|
790
|
+
```
|
|
791
|
+
REVIEW_CYCLE_END=$(date +%s)
|
|
792
|
+
REVIEW_CYCLE_TOTAL=$(( REVIEW_CYCLE_END - REVIEW_CYCLE_START ))
|
|
793
|
+
```
|
|
794
|
+
|
|
795
|
+
Calculate per-stage durations:
|
|
796
|
+
```
|
|
797
|
+
SPEC_DURATION=$(( SPEC_STAGE_END - SPEC_STAGE_START ))
|
|
798
|
+
CODE_DURATION=$(( CODE_STAGE_END - CODE_STAGE_START ))
|
|
799
|
+
# Only if simplify ran:
|
|
800
|
+
SIMPLIFY_DURATION=$(( SIMPLIFY_STAGE_END - SIMPLIFY_STAGE_START )) # or "N/A" if skipped
|
|
801
|
+
# Only if final review ran:
|
|
802
|
+
FINAL_DURATION=$(( FINAL_STAGE_END - FINAL_STAGE_START )) # or "N/A" if skipped
|
|
803
|
+
```
|
|
562
804
|
|
|
563
|
-
|
|
805
|
+
Record review results in SUMMARY.md under a `## Review Cycle` section:
|
|
564
806
|
```markdown
|
|
565
807
|
## Review Cycle
|
|
566
808
|
|
|
567
|
-
| Stage | Result | Findings |
|
|
568
|
-
|
|
569
|
-
| Spec Review | PASS | All requirements met |
|
|
570
|
-
| Code Review | APPROVED | No blocking issues |
|
|
571
|
-
| Simplify | FIXED |
|
|
572
|
-
| Final Review | APPROVED |
|
|
809
|
+
| Stage | Result | Attempts | Duration | Findings |
|
|
810
|
+
|-------|--------|----------|----------|----------|
|
|
811
|
+
| Spec Review | {PASS|FAIL|OVERRIDDEN} | {SPEC_ATTEMPTS}/3 | {SPEC_DURATION}s | {summary or "All requirements met"} |
|
|
812
|
+
| Code Review | {APPROVED|BLOCKED|OVERRIDDEN} | {CODE_ATTEMPTS}/3 | {CODE_DURATION}s | {summary or "No blocking issues"} |
|
|
813
|
+
| Simplify | {CLEAN|FIXED|BLOCKED|SKIPPED|OVERRIDDEN} | {SIMPLIFY_ATTEMPTS}/3 | {SIMPLIFY_DURATION}s | {summary or "N/A"} |
|
|
814
|
+
| Final Review | {APPROVED|BLOCKED|SKIPPED|N/A|OVERRIDDEN} | {FINAL_ATTEMPTS}/3 | {FINAL_DURATION}s | {summary or "N/A"} |
|
|
815
|
+
|
|
816
|
+
**Total review time:** {REVIEW_CYCLE_TOTAL}s
|
|
817
|
+
**Escalations:** {REVIEW_ESCALATIONS} ({REVIEW_ESCALATION_DETAILS or "None"})
|
|
573
818
|
```
|
|
574
819
|
|
|
575
820
|
Update the SUMMARY.md commit after the review cycle completes:
|
|
@@ -578,6 +823,26 @@ node ~/.claude/maxsim/bin/maxsim-tools.cjs commit "docs({phase}-{plan}): add rev
|
|
|
578
823
|
```
|
|
579
824
|
</step>
|
|
580
825
|
|
|
826
|
+
<step name="evidence_gate">
|
|
827
|
+
**Gate G6: Evidence Completeness** — SUMMARY.md must have evidence for each requirement.
|
|
828
|
+
|
|
829
|
+
After the review cycle and before committing metadata, validate that the SUMMARY.md contains requirement evidence for all requirements in the plan's frontmatter.
|
|
830
|
+
|
|
831
|
+
```bash
|
|
832
|
+
if [ -n "$REQ_IDS" ]; then
|
|
833
|
+
SUMMARY_PATH=".planning/phases/XX-name/{phase}-{plan}-SUMMARY.md"
|
|
834
|
+
G6_RESULT=$(node ~/.claude/maxsim/bin/maxsim-tools.cjs verify evidence-completeness "$SUMMARY_PATH" $REQ_IDS)
|
|
835
|
+
G6_VALID=$(echo "$G6_RESULT" | node -e "process.stdin.on('data',d=>console.log(JSON.parse(d).valid))")
|
|
836
|
+
if [ "$G6_VALID" != "true" ]; then
|
|
837
|
+
G6_MISSING=$(echo "$G6_RESULT" | node -e "process.stdin.on('data',d=>console.log(JSON.parse(d).missing_evidence.join(', ')))")
|
|
838
|
+
echo "GATE G6: Missing requirement evidence for: $G6_MISSING"
|
|
839
|
+
echo "Add Requirement Evidence rows to SUMMARY.md for these requirements before proceeding."
|
|
840
|
+
# Present as warning with instruction to fix — executor should add evidence
|
|
841
|
+
fi
|
|
842
|
+
fi
|
|
843
|
+
```
|
|
844
|
+
</step>
|
|
845
|
+
|
|
581
846
|
<step name="update_current_position">
|
|
582
847
|
Update STATE.md using maxsim-tools:
|
|
583
848
|
|
|
@@ -675,9 +940,9 @@ ls -1 .planning/phases/[current-phase-dir]/*-SUMMARY.md 2>/dev/null | wc -l
|
|
|
675
940
|
|
|
676
941
|
| Condition | Route | Action |
|
|
677
942
|
|-----------|-------|--------|
|
|
678
|
-
| summaries < plans | **A: More plans** | Find next PLAN without SUMMARY. Yolo: auto-continue. Interactive: show next plan, suggest `/maxsim:execute
|
|
679
|
-
| summaries = plans, current < highest phase | **B: Phase done** | Show completion, suggest `/maxsim:plan
|
|
680
|
-
| summaries = plans, current = highest phase | **C: Milestone done** | Show banner, suggest `/maxsim:
|
|
943
|
+
| summaries < plans | **A: More plans** | Find next PLAN without SUMMARY. Yolo: auto-continue. Interactive: show next plan, suggest `/maxsim:execute {phase}`. STOP here. |
|
|
944
|
+
| summaries = plans, current < highest phase | **B: Phase done** | Show completion, suggest `/maxsim:plan {Z+1}`. |
|
|
945
|
+
| summaries = plans, current = highest phase | **C: Milestone done** | Show banner, suggest `/maxsim:progress`. |
|
|
681
946
|
|
|
682
947
|
All routes: `/clear` first for fresh context.
|
|
683
948
|
</step>
|