get-research-done 1.1.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 (127) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +560 -0
  3. package/agents/grd-architect.md +789 -0
  4. package/agents/grd-codebase-mapper.md +738 -0
  5. package/agents/grd-critic.md +1065 -0
  6. package/agents/grd-debugger.md +1203 -0
  7. package/agents/grd-evaluator.md +948 -0
  8. package/agents/grd-executor.md +784 -0
  9. package/agents/grd-explorer.md +2063 -0
  10. package/agents/grd-graduator.md +484 -0
  11. package/agents/grd-integration-checker.md +423 -0
  12. package/agents/grd-phase-researcher.md +641 -0
  13. package/agents/grd-plan-checker.md +745 -0
  14. package/agents/grd-planner.md +1386 -0
  15. package/agents/grd-project-researcher.md +865 -0
  16. package/agents/grd-research-synthesizer.md +256 -0
  17. package/agents/grd-researcher.md +2361 -0
  18. package/agents/grd-roadmapper.md +605 -0
  19. package/agents/grd-verifier.md +778 -0
  20. package/bin/install.js +1294 -0
  21. package/commands/grd/add-phase.md +207 -0
  22. package/commands/grd/add-todo.md +193 -0
  23. package/commands/grd/architect.md +283 -0
  24. package/commands/grd/audit-milestone.md +277 -0
  25. package/commands/grd/check-todos.md +228 -0
  26. package/commands/grd/complete-milestone.md +136 -0
  27. package/commands/grd/debug.md +169 -0
  28. package/commands/grd/discuss-phase.md +86 -0
  29. package/commands/grd/evaluate.md +1095 -0
  30. package/commands/grd/execute-phase.md +339 -0
  31. package/commands/grd/explore.md +258 -0
  32. package/commands/grd/graduate.md +323 -0
  33. package/commands/grd/help.md +482 -0
  34. package/commands/grd/insert-phase.md +227 -0
  35. package/commands/grd/insights.md +231 -0
  36. package/commands/grd/join-discord.md +18 -0
  37. package/commands/grd/list-phase-assumptions.md +50 -0
  38. package/commands/grd/map-codebase.md +71 -0
  39. package/commands/grd/new-milestone.md +721 -0
  40. package/commands/grd/new-project.md +1008 -0
  41. package/commands/grd/pause-work.md +134 -0
  42. package/commands/grd/plan-milestone-gaps.md +295 -0
  43. package/commands/grd/plan-phase.md +525 -0
  44. package/commands/grd/progress.md +364 -0
  45. package/commands/grd/quick-explore.md +236 -0
  46. package/commands/grd/quick.md +309 -0
  47. package/commands/grd/remove-phase.md +349 -0
  48. package/commands/grd/research-phase.md +200 -0
  49. package/commands/grd/research.md +681 -0
  50. package/commands/grd/resume-work.md +40 -0
  51. package/commands/grd/set-profile.md +106 -0
  52. package/commands/grd/settings.md +136 -0
  53. package/commands/grd/update.md +172 -0
  54. package/commands/grd/verify-work.md +219 -0
  55. package/get-research-done/config/default.json +15 -0
  56. package/get-research-done/references/checkpoints.md +1078 -0
  57. package/get-research-done/references/continuation-format.md +249 -0
  58. package/get-research-done/references/git-integration.md +254 -0
  59. package/get-research-done/references/model-profiles.md +73 -0
  60. package/get-research-done/references/planning-config.md +94 -0
  61. package/get-research-done/references/questioning.md +141 -0
  62. package/get-research-done/references/tdd.md +263 -0
  63. package/get-research-done/references/ui-brand.md +160 -0
  64. package/get-research-done/references/verification-patterns.md +612 -0
  65. package/get-research-done/templates/DEBUG.md +159 -0
  66. package/get-research-done/templates/UAT.md +247 -0
  67. package/get-research-done/templates/archive-reason.md +195 -0
  68. package/get-research-done/templates/codebase/architecture.md +255 -0
  69. package/get-research-done/templates/codebase/concerns.md +310 -0
  70. package/get-research-done/templates/codebase/conventions.md +307 -0
  71. package/get-research-done/templates/codebase/integrations.md +280 -0
  72. package/get-research-done/templates/codebase/stack.md +186 -0
  73. package/get-research-done/templates/codebase/structure.md +285 -0
  74. package/get-research-done/templates/codebase/testing.md +480 -0
  75. package/get-research-done/templates/config.json +35 -0
  76. package/get-research-done/templates/context.md +283 -0
  77. package/get-research-done/templates/continue-here.md +78 -0
  78. package/get-research-done/templates/critic-log.md +288 -0
  79. package/get-research-done/templates/data-report.md +173 -0
  80. package/get-research-done/templates/debug-subagent-prompt.md +91 -0
  81. package/get-research-done/templates/decision-log.md +58 -0
  82. package/get-research-done/templates/decision.md +138 -0
  83. package/get-research-done/templates/discovery.md +146 -0
  84. package/get-research-done/templates/experiment-readme.md +104 -0
  85. package/get-research-done/templates/graduated-script.md +180 -0
  86. package/get-research-done/templates/iteration-summary.md +234 -0
  87. package/get-research-done/templates/milestone-archive.md +123 -0
  88. package/get-research-done/templates/milestone.md +115 -0
  89. package/get-research-done/templates/objective.md +271 -0
  90. package/get-research-done/templates/phase-prompt.md +567 -0
  91. package/get-research-done/templates/planner-subagent-prompt.md +117 -0
  92. package/get-research-done/templates/project.md +184 -0
  93. package/get-research-done/templates/requirements.md +231 -0
  94. package/get-research-done/templates/research-project/ARCHITECTURE.md +204 -0
  95. package/get-research-done/templates/research-project/FEATURES.md +147 -0
  96. package/get-research-done/templates/research-project/PITFALLS.md +200 -0
  97. package/get-research-done/templates/research-project/STACK.md +120 -0
  98. package/get-research-done/templates/research-project/SUMMARY.md +170 -0
  99. package/get-research-done/templates/research.md +529 -0
  100. package/get-research-done/templates/roadmap.md +202 -0
  101. package/get-research-done/templates/scorecard.json +113 -0
  102. package/get-research-done/templates/state.md +287 -0
  103. package/get-research-done/templates/summary.md +246 -0
  104. package/get-research-done/templates/user-setup.md +311 -0
  105. package/get-research-done/templates/verification-report.md +322 -0
  106. package/get-research-done/workflows/complete-milestone.md +756 -0
  107. package/get-research-done/workflows/diagnose-issues.md +231 -0
  108. package/get-research-done/workflows/discovery-phase.md +289 -0
  109. package/get-research-done/workflows/discuss-phase.md +433 -0
  110. package/get-research-done/workflows/execute-phase.md +657 -0
  111. package/get-research-done/workflows/execute-plan.md +1844 -0
  112. package/get-research-done/workflows/list-phase-assumptions.md +178 -0
  113. package/get-research-done/workflows/map-codebase.md +322 -0
  114. package/get-research-done/workflows/resume-project.md +307 -0
  115. package/get-research-done/workflows/transition.md +556 -0
  116. package/get-research-done/workflows/verify-phase.md +628 -0
  117. package/get-research-done/workflows/verify-work.md +596 -0
  118. package/hooks/dist/grd-check-update.js +61 -0
  119. package/hooks/dist/grd-statusline.js +84 -0
  120. package/package.json +47 -0
  121. package/scripts/audit-help-commands.sh +115 -0
  122. package/scripts/build-hooks.js +42 -0
  123. package/scripts/verify-all-commands.sh +246 -0
  124. package/scripts/verify-architect-warning.sh +35 -0
  125. package/scripts/verify-insights-mode.sh +40 -0
  126. package/scripts/verify-quick-mode.sh +20 -0
  127. package/scripts/verify-revise-data-routing.sh +139 -0
@@ -0,0 +1,657 @@
1
+ <purpose>
2
+ Execute all plans in a phase using wave-based parallel execution. Orchestrator stays lean by delegating plan execution to subagents.
3
+ </purpose>
4
+
5
+ <core_principle>
6
+ The orchestrator's job is coordination, not execution. Each subagent loads the full execute-plan context itself. Orchestrator discovers plans, analyzes dependencies, groups into waves, spawns agents, handles checkpoints, collects results.
7
+ </core_principle>
8
+
9
+ <required_reading>
10
+ Read STATE.md before any operation to load project context.
11
+ Read config.json for planning behavior settings.
12
+ </required_reading>
13
+
14
+ <process>
15
+
16
+ <step name="resolve_model_profile" priority="first">
17
+ Read model profile for agent spawning:
18
+
19
+ ```bash
20
+ MODEL_PROFILE=$(cat .planning/config.json 2>/dev/null | grep -o '"model_profile"[[:space:]]*:[[:space:]]*"[^"]*"' | grep -o '"[^"]*"$' | tr -d '"' || echo "balanced")
21
+ ```
22
+
23
+ Default to "balanced" if not set.
24
+
25
+ **Model lookup table:**
26
+
27
+ | Agent | quality | balanced | budget |
28
+ |-------|---------|----------|--------|
29
+ | grd-executor | opus | sonnet | sonnet |
30
+ | grd-verifier | sonnet | sonnet | haiku |
31
+ | general-purpose | — | — | — |
32
+
33
+ Store resolved models for use in Task calls below.
34
+ </step>
35
+
36
+ <step name="load_project_state">
37
+ Before any operation, read project state:
38
+
39
+ ```bash
40
+ cat .planning/STATE.md 2>/dev/null
41
+ ```
42
+
43
+ **If file exists:** Parse and internalize:
44
+ - Current position (phase, plan, status)
45
+ - Accumulated decisions (constraints on this execution)
46
+ - Blockers/concerns (things to watch for)
47
+
48
+ **If file missing but .planning/ exists:**
49
+ ```
50
+ STATE.md missing but planning artifacts exist.
51
+ Options:
52
+ 1. Reconstruct from existing artifacts
53
+ 2. Continue without project state (may lose accumulated context)
54
+ ```
55
+
56
+ **If .planning/ doesn't exist:** Error - project not initialized.
57
+
58
+ **Load planning config:**
59
+
60
+ ```bash
61
+ # Check if planning docs should be committed (default: true)
62
+ COMMIT_PLANNING_DOCS=$(cat .planning/config.json 2>/dev/null | grep -o '"commit_docs"[[:space:]]*:[[:space:]]*[^,}]*' | grep -o 'true\|false' || echo "true")
63
+ # Auto-detect gitignored (overrides config)
64
+ git check-ignore -q .planning 2>/dev/null && COMMIT_PLANNING_DOCS=false
65
+ ```
66
+
67
+ Store `COMMIT_PLANNING_DOCS` for use in git operations.
68
+ </step>
69
+
70
+ <step name="validate_phase">
71
+ Confirm phase exists and has plans:
72
+
73
+ ```bash
74
+ # Match both zero-padded (05-*) and unpadded (5-*) folders
75
+ PADDED_PHASE=$(printf "%02d" ${PHASE_ARG} 2>/dev/null || echo "${PHASE_ARG}")
76
+ PHASE_DIR=$(ls -d .planning/phases/${PADDED_PHASE}-* .planning/phases/${PHASE_ARG}-* 2>/dev/null | head -1)
77
+ if [ -z "$PHASE_DIR" ]; then
78
+ echo "ERROR: No phase directory matching '${PHASE_ARG}'"
79
+ exit 1
80
+ fi
81
+
82
+ PLAN_COUNT=$(ls -1 "$PHASE_DIR"/*-PLAN.md 2>/dev/null | wc -l | tr -d ' ')
83
+ if [ "$PLAN_COUNT" -eq 0 ]; then
84
+ echo "ERROR: No plans found in $PHASE_DIR"
85
+ exit 1
86
+ fi
87
+ ```
88
+
89
+ Report: "Found {N} plans in {phase_dir}"
90
+ </step>
91
+
92
+ <step name="discover_plans">
93
+ List all plans and extract metadata:
94
+
95
+ ```bash
96
+ # Get all plans
97
+ ls -1 "$PHASE_DIR"/*-PLAN.md 2>/dev/null | sort
98
+
99
+ # Get completed plans (have SUMMARY.md)
100
+ ls -1 "$PHASE_DIR"/*-SUMMARY.md 2>/dev/null | sort
101
+ ```
102
+
103
+ For each plan, read frontmatter to extract:
104
+ - `wave: N` - Execution wave (pre-computed)
105
+ - `autonomous: true/false` - Whether plan has checkpoints
106
+ - `gap_closure: true/false` - Whether plan closes gaps from verification/UAT
107
+
108
+ Build plan inventory:
109
+ - Plan path
110
+ - Plan ID (e.g., "03-01")
111
+ - Wave number
112
+ - Autonomous flag
113
+ - Gap closure flag
114
+ - Completion status (SUMMARY exists = complete)
115
+
116
+ **Filtering:**
117
+ - Skip completed plans (have SUMMARY.md)
118
+ - If `--gaps-only` flag: also skip plans where `gap_closure` is not `true`
119
+
120
+ If all plans filtered out, report "No matching incomplete plans" and exit.
121
+ </step>
122
+
123
+ <step name="group_by_wave">
124
+ Read `wave` from each plan's frontmatter and group by wave number:
125
+
126
+ ```bash
127
+ # For each plan, extract wave from frontmatter
128
+ for plan in $PHASE_DIR/*-PLAN.md; do
129
+ wave=$(grep "^wave:" "$plan" | cut -d: -f2 | tr -d ' ')
130
+ autonomous=$(grep "^autonomous:" "$plan" | cut -d: -f2 | tr -d ' ')
131
+ echo "$plan:$wave:$autonomous"
132
+ done
133
+ ```
134
+
135
+ **Group plans:**
136
+ ```
137
+ waves = {
138
+ 1: [plan-01, plan-02],
139
+ 2: [plan-03, plan-04],
140
+ 3: [plan-05]
141
+ }
142
+ ```
143
+
144
+ **No dependency analysis needed.** Wave numbers are pre-computed during `/grd:plan-phase`.
145
+
146
+ Report wave structure with context:
147
+ ```
148
+ ## Execution Plan
149
+
150
+ **Phase {X}: {Name}** — {total_plans} plans across {wave_count} waves
151
+
152
+ | Wave | Plans | What it builds |
153
+ |------|-------|----------------|
154
+ | 1 | 01-01, 01-02 | {from plan objectives} |
155
+ | 2 | 01-03 | {from plan objectives} |
156
+ | 3 | 01-04 [checkpoint] | {from plan objectives} |
157
+
158
+ ```
159
+
160
+ The "What it builds" column comes from skimming plan names/objectives. Keep it brief (3-8 words).
161
+ </step>
162
+
163
+ <step name="execute_waves">
164
+ Execute each wave in sequence. Autonomous plans within a wave run in parallel.
165
+
166
+ **For each wave:**
167
+
168
+ 1. **Describe what's being built (BEFORE spawning):**
169
+
170
+ Read each plan's `<objective>` section. Extract what's being built and why it matters.
171
+
172
+ **Output:**
173
+ ```
174
+ ---
175
+
176
+ ## Wave {N}
177
+
178
+ **{Plan ID}: {Plan Name}**
179
+ {2-3 sentences: what this builds, key technical approach, why it matters in context}
180
+
181
+ **{Plan ID}: {Plan Name}** (if parallel)
182
+ {same format}
183
+
184
+ Spawning {count} agent(s)...
185
+
186
+ ---
187
+ ```
188
+
189
+ **Examples:**
190
+ - Bad: "Executing terrain generation plan"
191
+ - Good: "Procedural terrain generator using Perlin noise — creates height maps, biome zones, and collision meshes. Required before vehicle physics can interact with ground."
192
+
193
+ 2. **Read files and spawn all autonomous agents in wave simultaneously:**
194
+
195
+ Before spawning, read file contents. The `@` syntax does not work across Task() boundaries - content must be inlined.
196
+
197
+ ```bash
198
+ # Read each plan in the wave
199
+ PLAN_CONTENT=$(cat "{plan_path}")
200
+ STATE_CONTENT=$(cat .planning/STATE.md)
201
+ CONFIG_CONTENT=$(cat .planning/config.json 2>/dev/null)
202
+ ```
203
+
204
+ Use Task tool with multiple parallel calls. Each agent gets prompt with inlined content:
205
+
206
+ ```
207
+ <objective>
208
+ Execute plan {plan_number} of phase {phase_number}-{phase_name}.
209
+
210
+ Commit each task atomically. Create SUMMARY.md. Update STATE.md.
211
+ </objective>
212
+
213
+ <execution_context>
214
+ @~/.claude/get-research-done/workflows/execute-plan.md
215
+ @~/.claude/get-research-done/templates/summary.md
216
+ @~/.claude/get-research-done/references/checkpoints.md
217
+ @~/.claude/get-research-done/references/tdd.md
218
+ </execution_context>
219
+
220
+ <context>
221
+ Plan:
222
+ {plan_content}
223
+
224
+ Project state:
225
+ {state_content}
226
+
227
+ Config (if exists):
228
+ {config_content}
229
+ </context>
230
+
231
+ <success_criteria>
232
+ - [ ] All tasks executed
233
+ - [ ] Each task committed individually
234
+ - [ ] SUMMARY.md created in plan directory
235
+ - [ ] STATE.md updated with position and decisions
236
+ </success_criteria>
237
+ ```
238
+
239
+ 2. **Wait for all agents in wave to complete:**
240
+
241
+ Task tool blocks until each agent finishes. All parallel agents return together.
242
+
243
+ 3. **Report completion and what was built:**
244
+
245
+ For each completed agent:
246
+ - Verify SUMMARY.md exists at expected path
247
+ - Read SUMMARY.md to extract what was built
248
+ - Note any issues or deviations
249
+
250
+ **Output:**
251
+ ```
252
+ ---
253
+
254
+ ## Wave {N} Complete
255
+
256
+ **{Plan ID}: {Plan Name}**
257
+ {What was built — from SUMMARY.md deliverables}
258
+ {Notable deviations or discoveries, if any}
259
+
260
+ **{Plan ID}: {Plan Name}** (if parallel)
261
+ {same format}
262
+
263
+ {If more waves: brief note on what this enables for next wave}
264
+
265
+ ---
266
+ ```
267
+
268
+ **Examples:**
269
+ - Bad: "Wave 2 complete. Proceeding to Wave 3."
270
+ - Good: "Terrain system complete — 3 biome types, height-based texturing, physics collision meshes. Vehicle physics (Wave 3) can now reference ground surfaces."
271
+
272
+ 4. **Handle failures:**
273
+
274
+ If any agent in wave fails:
275
+ - Report which plan failed and why
276
+ - Ask user: "Continue with remaining waves?" or "Stop execution?"
277
+ - If continue: proceed to next wave (dependent plans may also fail)
278
+ - If stop: exit with partial completion report
279
+
280
+ 5. **Execute checkpoint plans between waves:**
281
+
282
+ See `<checkpoint_handling>` for details.
283
+
284
+ 6. **Proceed to next wave**
285
+
286
+ </step>
287
+
288
+ <step name="checkpoint_handling">
289
+ Plans with `autonomous: false` require user interaction.
290
+
291
+ **Detection:** Check `autonomous` field in frontmatter.
292
+
293
+ **Execution flow for checkpoint plans:**
294
+
295
+ 1. **Spawn agent for checkpoint plan:**
296
+ ```
297
+ Task(prompt="{subagent-task-prompt}", subagent_type="grd-executor", model="{executor_model}")
298
+ ```
299
+
300
+ 2. **Agent runs until checkpoint:**
301
+ - Executes auto tasks normally
302
+ - Reaches checkpoint task (e.g., `type="checkpoint:human-verify"`) or auth gate
303
+ - Agent returns with structured checkpoint (see checkpoint-return.md template)
304
+
305
+ 3. **Agent return includes (structured format):**
306
+ - Completed Tasks table with commit hashes and files
307
+ - Current task name and blocker
308
+ - Checkpoint type and details for user
309
+ - What's awaited from user
310
+
311
+ 4. **Orchestrator presents checkpoint to user:**
312
+
313
+ Extract and display the "Checkpoint Details" and "Awaiting" sections from agent return:
314
+ ```
315
+ ## Checkpoint: [Type]
316
+
317
+ **Plan:** 03-03 Dashboard Layout
318
+ **Progress:** 2/3 tasks complete
319
+
320
+ [Checkpoint Details section from agent return]
321
+
322
+ [Awaiting section from agent return]
323
+ ```
324
+
325
+ 5. **User responds:**
326
+ - "approved" / "done" → spawn continuation agent
327
+ - Description of issues → spawn continuation agent with feedback
328
+ - Decision selection → spawn continuation agent with choice
329
+
330
+ 6. **Spawn continuation agent (NOT resume):**
331
+
332
+ Use the continuation-prompt.md template:
333
+ ```
334
+ Task(
335
+ prompt=filled_continuation_template,
336
+ subagent_type="grd-executor",
337
+ model="{executor_model}"
338
+ )
339
+ ```
340
+
341
+ Fill template with:
342
+ - `{completed_tasks_table}`: From agent's checkpoint return
343
+ - `{resume_task_number}`: Current task from checkpoint
344
+ - `{resume_task_name}`: Current task name from checkpoint
345
+ - `{user_response}`: What user provided
346
+ - `{resume_instructions}`: Based on checkpoint type (see continuation-prompt.md)
347
+
348
+ 7. **Continuation agent executes:**
349
+ - Verifies previous commits exist
350
+ - Continues from resume point
351
+ - May hit another checkpoint (repeat from step 4)
352
+ - Or completes plan
353
+
354
+ 8. **Repeat until plan completes or user stops**
355
+
356
+ **Why fresh agent instead of resume:**
357
+ Resume relies on Claude Code's internal serialization which breaks with parallel tool calls.
358
+ Fresh agents with explicit state are more reliable and maintain full context.
359
+
360
+ **Checkpoint in parallel context:**
361
+ If a plan in a parallel wave has a checkpoint:
362
+ - Spawn as normal
363
+ - Agent pauses at checkpoint and returns with structured state
364
+ - Other parallel agents may complete while waiting
365
+ - Present checkpoint to user
366
+ - Spawn continuation agent with user response
367
+ - Wait for all agents to finish before next wave
368
+ </step>
369
+
370
+ <step name="aggregate_results">
371
+ After all waves complete, aggregate results:
372
+
373
+ ```markdown
374
+ ## Phase {X}: {Name} Execution Complete
375
+
376
+ **Waves executed:** {N}
377
+ **Plans completed:** {M} of {total}
378
+
379
+ ### Wave Summary
380
+
381
+ | Wave | Plans | Status |
382
+ |------|-------|--------|
383
+ | 1 | plan-01, plan-02 | ✓ Complete |
384
+ | CP | plan-03 | ✓ Verified |
385
+ | 2 | plan-04 | ✓ Complete |
386
+ | 3 | plan-05 | ✓ Complete |
387
+
388
+ ### Plan Details
389
+
390
+ 1. **03-01**: [one-liner from SUMMARY.md]
391
+ 2. **03-02**: [one-liner from SUMMARY.md]
392
+ ...
393
+
394
+ ### Issues Encountered
395
+ [Aggregate from all SUMMARYs, or "None"]
396
+ ```
397
+ </step>
398
+
399
+ <step name="verify_phase_goal">
400
+ Verify phase achieved its GOAL, not just completed its TASKS.
401
+
402
+ **Spawn verifier:**
403
+
404
+ ```
405
+ Task(
406
+ prompt="Verify phase {phase_number} goal achievement.
407
+
408
+ Phase directory: {phase_dir}
409
+ Phase goal: {goal from ROADMAP.md}
410
+
411
+ Check must_haves against actual codebase. Create VERIFICATION.md.
412
+ Verify what actually exists in the code.",
413
+ subagent_type="grd-verifier",
414
+ model="{verifier_model}"
415
+ )
416
+ ```
417
+
418
+ **Read verification status:**
419
+
420
+ ```bash
421
+ grep "^status:" "$PHASE_DIR"/*-VERIFICATION.md | cut -d: -f2 | tr -d ' '
422
+ ```
423
+
424
+ **Route by status:**
425
+
426
+ | Status | Action |
427
+ |--------|--------|
428
+ | `passed` | Continue to update_roadmap |
429
+ | `human_needed` | Present items to user, get approval or feedback |
430
+ | `gaps_found` | Present gap summary, offer `/grd:plan-phase {phase} --gaps` |
431
+
432
+ **If passed:**
433
+
434
+ Phase goal verified. Proceed to update_roadmap.
435
+
436
+ **If human_needed:**
437
+
438
+ ```markdown
439
+ ## ✓ Phase {X}: {Name} — Human Verification Required
440
+
441
+ All automated checks passed. {N} items need human testing:
442
+
443
+ ### Human Verification Checklist
444
+
445
+ {Extract from VERIFICATION.md human_verification section}
446
+
447
+ ---
448
+
449
+ **After testing:**
450
+ - "approved" → continue to update_roadmap
451
+ - Report issues → will route to gap closure planning
452
+ ```
453
+
454
+ If user approves → continue to update_roadmap.
455
+ If user reports issues → treat as gaps_found.
456
+
457
+ **If gaps_found:**
458
+
459
+ Present gaps and offer next command:
460
+
461
+ ```markdown
462
+ ## ⚠ Phase {X}: {Name} — Gaps Found
463
+
464
+ **Score:** {N}/{M} must-haves verified
465
+ **Report:** {phase_dir}/{phase}-VERIFICATION.md
466
+
467
+ ### What's Missing
468
+
469
+ {Extract gap summaries from VERIFICATION.md gaps section}
470
+
471
+ ---
472
+
473
+ ## ▶ Next Up
474
+
475
+ **Plan gap closure** — create additional plans to complete the phase
476
+
477
+ `/grd:plan-phase {X} --gaps`
478
+
479
+ <sub>`/clear` first → fresh context window</sub>
480
+
481
+ ---
482
+
483
+ **Also available:**
484
+ - `cat {phase_dir}/{phase}-VERIFICATION.md` — see full report
485
+ - `/grd:verify-work {X}` — manual testing before planning
486
+ ```
487
+
488
+ User runs `/grd:plan-phase {X} --gaps` which:
489
+ 1. Reads VERIFICATION.md gaps
490
+ 2. Creates additional plans (04, 05, etc.) with `gap_closure: true` to close gaps
491
+ 3. User then runs `/grd:execute-phase {X} --gaps-only`
492
+ 4. Execute-phase runs only gap closure plans (04-05)
493
+ 5. Verifier runs again after new plans complete
494
+
495
+ User stays in control at each decision point.
496
+ </step>
497
+
498
+ <step name="update_roadmap">
499
+ Update ROADMAP.md to reflect phase completion:
500
+
501
+ ```bash
502
+ # Mark phase complete
503
+ # Update completion date
504
+ # Update status
505
+ ```
506
+
507
+ **Check planning config:**
508
+
509
+ If `COMMIT_PLANNING_DOCS=false` (set in load_project_state):
510
+ - Skip all git operations for .planning/ files
511
+ - Planning docs exist locally but are gitignored
512
+ - Log: "Skipping planning docs commit (commit_docs: false)"
513
+ - Proceed to offer_next step
514
+
515
+ If `COMMIT_PLANNING_DOCS=true` (default):
516
+ - Continue with git operations below
517
+
518
+ Commit phase completion (roadmap, state, verification):
519
+ ```bash
520
+ git add .planning/ROADMAP.md .planning/STATE.md .planning/phases/{phase_dir}/*-VERIFICATION.md
521
+ git add .planning/REQUIREMENTS.md # if updated
522
+ git commit -m "docs(phase-{X}): complete phase execution"
523
+ ```
524
+ </step>
525
+
526
+ <step name="offer_next">
527
+ Present next steps based on milestone status:
528
+
529
+ **If more phases remain:**
530
+ ```
531
+ ## Next Up
532
+
533
+ **Phase {X+1}: {Name}** — {Goal}
534
+
535
+ `/grd:plan-phase {X+1}`
536
+
537
+ <sub>`/clear` first for fresh context</sub>
538
+ ```
539
+
540
+ **If milestone complete:**
541
+ ```
542
+ MILESTONE COMPLETE!
543
+
544
+ All {N} phases executed.
545
+
546
+ `/grd:complete-milestone`
547
+ ```
548
+ </step>
549
+
550
+ </process>
551
+
552
+ ## Critic Exit Code Routing (Phase 4+)
553
+
554
+ When executing phases that include the recursive validation loop (Phase 4+), the Critic agent returns exit codes that determine workflow routing:
555
+
556
+ | Exit Code | Action | Target |
557
+ |-----------|--------|--------|
558
+ | PROCEED | Continue to Evaluator | Quantitative benchmarking |
559
+ | REVISE_METHOD | Return to Researcher | With critique feedback |
560
+ | REVISE_DATA | Return to Explorer | For targeted re-analysis |
561
+
562
+ ### REVISE_DATA Handling
563
+
564
+ When Critic returns REVISE_DATA:
565
+ 1. Extract data-specific concerns from Critic feedback
566
+ 2. Spawn grd-explorer agent with `--targeted` flag
567
+ 3. Pass concerns as context: "Re-examine: {concern_list}"
568
+ 4. Explorer updates DATA_REPORT.md (append or revise sections)
569
+ 5. Resume validation loop from Researcher
570
+
571
+ **Example concerns that trigger REVISE_DATA:**
572
+ - "Feature X shows 0.92 correlation with target but not in leakage warnings"
573
+ - "Class imbalance severity may be understated for this domain"
574
+ - "Temporal leakage check missing for time-series features"
575
+ - "Outlier analysis didn't account for domain-specific bounds"
576
+
577
+ ### Targeted Re-exploration
578
+
579
+ Unlike full exploration, targeted re-analysis:
580
+ - Only re-examines aspects flagged by Critic
581
+ - Does not re-run all profiling/detection
582
+ - Appends "## Targeted Re-analysis" section to DATA_REPORT.md
583
+ - Includes timestamp and Critic iteration reference
584
+
585
+ **DATA_REPORT.md structure after targeted re-analysis:**
586
+ ```markdown
587
+ ## Targeted Re-analysis
588
+
589
+ **Iteration:** 2 (from Critic feedback iteration 1)
590
+ **Date:** 2026-02-15
591
+ **Concern:** Feature correlation with target
592
+
593
+ ### Re-examination: Feature X correlation
594
+
595
+ Original analysis: Pearson correlation = 0.92 (p < 0.001)
596
+
597
+ Time-based splits analysis:
598
+ - Temporal split 1 (2023-01): r = 0.89
599
+ - Temporal split 2 (2023-06): r = 0.35
600
+ - Temporal split 3 (2024-01): r = 0.38
601
+
602
+ **Finding:** Feature X exhibits temporal leakage. High correlation in training period degrades significantly in validation periods.
603
+
604
+ **Recommendation:** Exclude Feature X from model features (HIGH severity).
605
+ ```
606
+
607
+ **Routing implementation:**
608
+ This routing is wired in Phase 4. The execute-phase orchestrator detects Critic exit codes and spawns appropriate agents. Explorer agent recognizes `--targeted` flag and adjusts its workflow accordingly.
609
+
610
+ **Maximum iterations:**
611
+ To prevent infinite loops, validation cycles are limited to 5 iterations (configurable). After max iterations, Critic must either PROCEED or escalate to human review.
612
+
613
+ <context_efficiency>
614
+ Orchestrator: ~10-15% context (frontmatter, spawning, results).
615
+ Subagents: Fresh 200k each (full workflow + execution).
616
+ No polling (Task blocks). No context bleed.
617
+ </context_efficiency>
618
+
619
+ <failure_handling>
620
+ **Subagent fails mid-plan:**
621
+ - SUMMARY.md won't exist
622
+ - Orchestrator detects missing SUMMARY
623
+ - Reports failure, asks user how to proceed
624
+
625
+ **Dependency chain breaks:**
626
+ - Wave 1 plan fails
627
+ - Wave 2 plans depending on it will likely fail
628
+ - Orchestrator can still attempt them (user choice)
629
+ - Or skip dependent plans entirely
630
+
631
+ **All agents in wave fail:**
632
+ - Something systemic (git issues, permissions, etc.)
633
+ - Stop execution
634
+ - Report for manual investigation
635
+
636
+ **Checkpoint fails to resolve:**
637
+ - User can't approve or provides repeated issues
638
+ - Ask: "Skip this plan?" or "Abort phase execution?"
639
+ - Record partial progress in STATE.md
640
+ </failure_handling>
641
+
642
+ <resumption>
643
+ **Resuming interrupted execution:**
644
+
645
+ If phase execution was interrupted (context limit, user exit, error):
646
+
647
+ 1. Run `/grd:execute-phase {phase}` again
648
+ 2. discover_plans finds completed SUMMARYs
649
+ 3. Skips completed plans
650
+ 4. Resumes from first incomplete plan
651
+ 5. Continues wave-based execution
652
+
653
+ **STATE.md tracks:**
654
+ - Last completed plan
655
+ - Current wave
656
+ - Any pending checkpoints
657
+ </resumption>