claude-cook 1.10.8 → 1.11.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 (39) hide show
  1. package/agents/cook-pm.md +135 -59
  2. package/commands/cook/help.md +110 -417
  3. package/commands/cook/pm-start.md +73 -120
  4. package/cook/workflows/pm-check.md +9 -8
  5. package/cook/workflows/pm-cycle.md +87 -21
  6. package/package.json +1 -1
  7. package/scripts/pm-loop.sh +30 -10
  8. package/agents/cook-debugger.md +0 -1203
  9. package/agents/cook-executor.md +0 -784
  10. package/agents/cook-integration-checker.md +0 -423
  11. package/agents/cook-phase-researcher.md +0 -641
  12. package/agents/cook-verifier.md +0 -778
  13. package/commands/cook/add-todo.md +0 -193
  14. package/commands/cook/audit-milestone.md +0 -277
  15. package/commands/cook/check-todos.md +0 -228
  16. package/commands/cook/debug.md +0 -169
  17. package/commands/cook/discuss-phase.md +0 -86
  18. package/commands/cook/execute-phase.md +0 -339
  19. package/commands/cook/list-phase-assumptions.md +0 -50
  20. package/commands/cook/pause-work.md +0 -134
  21. package/commands/cook/plan-milestone-gaps.md +0 -295
  22. package/commands/cook/quick.md +0 -309
  23. package/commands/cook/research-phase.md +0 -200
  24. package/commands/cook/resume-work.md +0 -40
  25. package/commands/cook/verify-work.md +0 -219
  26. package/cook/references/checkpoints.md +0 -1078
  27. package/cook/references/tdd.md +0 -263
  28. package/cook/references/verification-patterns.md +0 -612
  29. package/cook/templates/DEBUG.md +0 -159
  30. package/cook/templates/UAT.md +0 -247
  31. package/cook/templates/debug-subagent-prompt.md +0 -91
  32. package/cook/templates/verification-report.md +0 -322
  33. package/cook/workflows/diagnose-issues.md +0 -231
  34. package/cook/workflows/discuss-phase.md +0 -433
  35. package/cook/workflows/execute-phase.md +0 -671
  36. package/cook/workflows/execute-plan.md +0 -1844
  37. package/cook/workflows/list-phase-assumptions.md +0 -178
  38. package/cook/workflows/verify-phase.md +0 -628
  39. package/cook/workflows/verify-work.md +0 -596
@@ -1,671 +0,0 @@
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
- | cook-executor | opus | sonnet | sonnet |
30
- | cook-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
-
69
- **Load git branching config:**
70
-
71
- ```bash
72
- # Get branching strategy (default: none)
73
- BRANCHING_STRATEGY=$(cat .planning/config.json 2>/dev/null | grep -o '"branching_strategy"[[:space:]]*:[[:space:]]*"[^"]*"' | sed 's/.*:.*"\([^"]*\)"/\1/' || echo "none")
74
-
75
- # Get templates
76
- PHASE_BRANCH_TEMPLATE=$(cat .planning/config.json 2>/dev/null | grep -o '"phase_branch_template"[[:space:]]*:[[:space:]]*"[^"]*"' | sed 's/.*:.*"\([^"]*\)"/\1/' || echo "cook/phase-{phase}-{slug}")
77
- MILESTONE_BRANCH_TEMPLATE=$(cat .planning/config.json 2>/dev/null | grep -o '"milestone_branch_template"[[:space:]]*:[[:space:]]*"[^"]*"' | sed 's/.*:.*"\([^"]*\)"/\1/' || echo "cook/{milestone}-{slug}")
78
- ```
79
-
80
- Store `BRANCHING_STRATEGY` and templates for use in branch creation step.
81
- </step>
82
-
83
- <step name="handle_branching">
84
- Create or switch to appropriate branch based on branching strategy.
85
-
86
- **Skip if strategy is "none":**
87
-
88
- ```bash
89
- if [ "$BRANCHING_STRATEGY" = "none" ]; then
90
- # No branching, continue on current branch
91
- exit 0
92
- fi
93
- ```
94
-
95
- **For "phase" strategy — create phase branch:**
96
-
97
- ```bash
98
- if [ "$BRANCHING_STRATEGY" = "phase" ]; then
99
- # Get phase name from directory (e.g., "03-authentication" → "authentication")
100
- PHASE_NAME=$(basename "$PHASE_DIR" | sed 's/^[0-9]*-//')
101
-
102
- # Create slug from phase name
103
- PHASE_SLUG=$(echo "$PHASE_NAME" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g' | sed 's/--*/-/g' | sed 's/^-//;s/-$//')
104
-
105
- # Apply template
106
- BRANCH_NAME=$(echo "$PHASE_BRANCH_TEMPLATE" | sed "s/{phase}/$PADDED_PHASE/g" | sed "s/{slug}/$PHASE_SLUG/g")
107
-
108
- # Create or switch to branch
109
- git checkout -b "$BRANCH_NAME" 2>/dev/null || git checkout "$BRANCH_NAME"
110
-
111
- echo "Branch: $BRANCH_NAME (phase branching)"
112
- fi
113
- ```
114
-
115
- **For "milestone" strategy — create/switch to milestone branch:**
116
-
117
- ```bash
118
- if [ "$BRANCHING_STRATEGY" = "milestone" ]; then
119
- # Get current milestone info from ROADMAP.md
120
- MILESTONE_VERSION=$(grep -oE 'v[0-9]+\.[0-9]+' .planning/ROADMAP.md | head -1 || echo "v1.0")
121
- MILESTONE_NAME=$(grep -A1 "## .*$MILESTONE_VERSION" .planning/ROADMAP.md | tail -1 | sed 's/.*- //' | cut -d'(' -f1 | tr -d ' ' || echo "milestone")
122
-
123
- # Create slug
124
- MILESTONE_SLUG=$(echo "$MILESTONE_NAME" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g' | sed 's/--*/-/g' | sed 's/^-//;s/-$//')
125
-
126
- # Apply template
127
- BRANCH_NAME=$(echo "$MILESTONE_BRANCH_TEMPLATE" | sed "s/{milestone}/$MILESTONE_VERSION/g" | sed "s/{slug}/$MILESTONE_SLUG/g")
128
-
129
- # Create or switch to branch (same branch for all phases in milestone)
130
- git checkout -b "$BRANCH_NAME" 2>/dev/null || git checkout "$BRANCH_NAME"
131
-
132
- echo "Branch: $BRANCH_NAME (milestone branching)"
133
- fi
134
- ```
135
-
136
- **Report branch status:**
137
-
138
- ```
139
- Branching: {strategy} → {branch_name}
140
- ```
141
-
142
- **Note:** All subsequent plan commits go to this branch. User handles merging based on their workflow.
143
- </step>
144
-
145
- <step name="validate_phase">
146
- Confirm phase exists and has plans:
147
-
148
- ```bash
149
- # Match both zero-padded (05-*) and unpadded (5-*) folders
150
- PADDED_PHASE=$(printf "%02d" ${PHASE_ARG} 2>/dev/null || echo "${PHASE_ARG}")
151
- PHASE_DIR=$(ls -d .planning/phases/${PADDED_PHASE}-* .planning/phases/${PHASE_ARG}-* 2>/dev/null | head -1)
152
- if [ -z "$PHASE_DIR" ]; then
153
- echo "ERROR: No phase directory matching '${PHASE_ARG}'"
154
- exit 1
155
- fi
156
-
157
- PLAN_COUNT=$(ls -1 "$PHASE_DIR"/*-PLAN.md 2>/dev/null | wc -l | tr -d ' ')
158
- if [ "$PLAN_COUNT" -eq 0 ]; then
159
- echo "ERROR: No plans found in $PHASE_DIR"
160
- exit 1
161
- fi
162
- ```
163
-
164
- Report: "Found {N} plans in {phase_dir}"
165
- </step>
166
-
167
- <step name="discover_plans">
168
- List all plans and extract metadata:
169
-
170
- ```bash
171
- # Get all plans
172
- ls -1 "$PHASE_DIR"/*-PLAN.md 2>/dev/null | sort
173
-
174
- # Get completed plans (have SUMMARY.md)
175
- ls -1 "$PHASE_DIR"/*-SUMMARY.md 2>/dev/null | sort
176
- ```
177
-
178
- For each plan, read frontmatter to extract:
179
- - `wave: N` - Execution wave (pre-computed)
180
- - `autonomous: true/false` - Whether plan has checkpoints
181
- - `gap_closure: true/false` - Whether plan closes gaps from verification/UAT
182
-
183
- Build plan inventory:
184
- - Plan path
185
- - Plan ID (e.g., "03-01")
186
- - Wave number
187
- - Autonomous flag
188
- - Gap closure flag
189
- - Completion status (SUMMARY exists = complete)
190
-
191
- **Filtering:**
192
- - Skip completed plans (have SUMMARY.md)
193
- - If `--gaps-only` flag: also skip plans where `gap_closure` is not `true`
194
-
195
- If all plans filtered out, report "No matching incomplete plans" and exit.
196
- </step>
197
-
198
- <step name="group_by_wave">
199
- Read `wave` from each plan's frontmatter and group by wave number:
200
-
201
- ```bash
202
- # For each plan, extract wave from frontmatter
203
- for plan in $PHASE_DIR/*-PLAN.md; do
204
- wave=$(grep "^wave:" "$plan" | cut -d: -f2 | tr -d ' ')
205
- autonomous=$(grep "^autonomous:" "$plan" | cut -d: -f2 | tr -d ' ')
206
- echo "$plan:$wave:$autonomous"
207
- done
208
- ```
209
-
210
- **Group plans:**
211
- ```
212
- waves = {
213
- 1: [plan-01, plan-02],
214
- 2: [plan-03, plan-04],
215
- 3: [plan-05]
216
- }
217
- ```
218
-
219
- **No dependency analysis needed.** Wave numbers are pre-computed during `/cook:plan-phase`.
220
-
221
- Report wave structure with context:
222
- ```
223
- ## Execution Plan
224
-
225
- **Phase {X}: {Name}** — {total_plans} plans across {wave_count} waves
226
-
227
- | Wave | Plans | What it builds |
228
- |------|-------|----------------|
229
- | 1 | 01-01, 01-02 | {from plan objectives} |
230
- | 2 | 01-03 | {from plan objectives} |
231
- | 3 | 01-04 [checkpoint] | {from plan objectives} |
232
-
233
- ```
234
-
235
- The "What it builds" column comes from skimming plan names/objectives. Keep it brief (3-8 words).
236
- </step>
237
-
238
- <step name="execute_waves">
239
- Execute each wave in sequence. Autonomous plans within a wave run in parallel.
240
-
241
- **For each wave:**
242
-
243
- 1. **Describe what's being built (BEFORE spawning):**
244
-
245
- Read each plan's `<objective>` section. Extract what's being built and why it matters.
246
-
247
- **Output:**
248
- ```
249
- ---
250
-
251
- ## Wave {N}
252
-
253
- **{Plan ID}: {Plan Name}**
254
- {2-3 sentences: what this builds, key technical approach, why it matters in context}
255
-
256
- **{Plan ID}: {Plan Name}** (if parallel)
257
- {same format}
258
-
259
- Spawning {count} agent(s)...
260
-
261
- ---
262
- ```
263
-
264
- **Examples:**
265
- - Bad: "Executing terrain generation plan"
266
- - Good: "Procedural terrain generator using Perlin noise — creates height maps, biome zones, and collision meshes. Required before vehicle physics can interact with ground."
267
-
268
- 2. **Read files and spawn all autonomous agents in wave simultaneously:**
269
-
270
- Before spawning, read file contents. The `@` syntax does not work across Task() boundaries - content must be inlined.
271
-
272
- ```bash
273
- # Read each plan in the wave
274
- PLAN_CONTENT=$(cat "{plan_path}")
275
- STATE_CONTENT=$(cat .planning/STATE.md)
276
- CONFIG_CONTENT=$(cat .planning/config.json 2>/dev/null)
277
- ```
278
-
279
- Use Task tool with multiple parallel calls. Each agent gets prompt with inlined content:
280
-
281
- ```
282
- <objective>
283
- Execute plan {plan_number} of phase {phase_number}-{phase_name}.
284
-
285
- Commit each task atomically. Create SUMMARY.md. Update STATE.md.
286
- </objective>
287
-
288
- <execution_context>
289
- @~/.claude/cook/workflows/execute-plan.md
290
- @~/.claude/cook/templates/summary.md
291
- @~/.claude/cook/references/checkpoints.md
292
- @~/.claude/cook/references/tdd.md
293
- </execution_context>
294
-
295
- <context>
296
- Plan:
297
- {plan_content}
298
-
299
- Project state:
300
- {state_content}
301
-
302
- Config (if exists):
303
- {config_content}
304
- </context>
305
-
306
- <success_criteria>
307
- - [ ] All tasks executed
308
- - [ ] Each task committed individually
309
- - [ ] SUMMARY.md created in plan directory
310
- - [ ] STATE.md updated with position and decisions
311
- </success_criteria>
312
- ```
313
-
314
- 2. **Wait for all agents in wave to complete:**
315
-
316
- Task tool blocks until each agent finishes. All parallel agents return together.
317
-
318
- 3. **Report completion and what was built:**
319
-
320
- For each completed agent:
321
- - Verify SUMMARY.md exists at expected path
322
- - Read SUMMARY.md to extract what was built
323
- - Note any issues or deviations
324
-
325
- **Output:**
326
- ```
327
- ---
328
-
329
- ## Wave {N} Complete
330
-
331
- **{Plan ID}: {Plan Name}**
332
- {What was built — from SUMMARY.md deliverables}
333
- {Notable deviations or discoveries, if any}
334
-
335
- **{Plan ID}: {Plan Name}** (if parallel)
336
- {same format}
337
-
338
- {If more waves: brief note on what this enables for next wave}
339
-
340
- ---
341
- ```
342
-
343
- **Examples:**
344
- - Bad: "Wave 2 complete. Proceeding to Wave 3."
345
- - Good: "Terrain system complete — 3 biome types, height-based texturing, physics collision meshes. Vehicle physics (Wave 3) can now reference ground surfaces."
346
-
347
- 4. **Handle failures:**
348
-
349
- If any agent in wave fails:
350
- - Report which plan failed and why
351
- - Ask user: "Continue with remaining waves?" or "Stop execution?"
352
- - If continue: proceed to next wave (dependent plans may also fail)
353
- - If stop: exit with partial completion report
354
-
355
- 5. **Execute checkpoint plans between waves:**
356
-
357
- See `<checkpoint_handling>` for details.
358
-
359
- 6. **Proceed to next wave**
360
-
361
- </step>
362
-
363
- <step name="checkpoint_handling">
364
- Plans with `autonomous: false` require user interaction.
365
-
366
- **Detection:** Check `autonomous` field in frontmatter.
367
-
368
- **Execution flow for checkpoint plans:**
369
-
370
- 1. **Spawn agent for checkpoint plan:**
371
- ```
372
- Task(prompt="{subagent-task-prompt}", subagent_type="cook-executor", model="{executor_model}")
373
- ```
374
-
375
- 2. **Agent runs until checkpoint:**
376
- - Executes auto tasks normally
377
- - Reaches checkpoint task (e.g., `type="checkpoint:human-verify"`) or auth gate
378
- - Agent returns with structured checkpoint (see checkpoint-return.md template)
379
-
380
- 3. **Agent return includes (structured format):**
381
- - Completed Tasks table with commit hashes and files
382
- - Current task name and blocker
383
- - Checkpoint type and details for user
384
- - What's awaited from user
385
-
386
- 4. **Orchestrator presents checkpoint to user:**
387
-
388
- Extract and display the "Checkpoint Details" and "Awaiting" sections from agent return:
389
- ```
390
- ## Checkpoint: [Type]
391
-
392
- **Plan:** 03-03 Dashboard Layout
393
- **Progress:** 2/3 tasks complete
394
-
395
- [Checkpoint Details section from agent return]
396
-
397
- [Awaiting section from agent return]
398
- ```
399
-
400
- 5. **User responds:**
401
- - "approved" / "done" → spawn continuation agent
402
- - Description of issues → spawn continuation agent with feedback
403
- - Decision selection → spawn continuation agent with choice
404
-
405
- 6. **Spawn continuation agent (NOT resume):**
406
-
407
- Use the continuation-prompt.md template:
408
- ```
409
- Task(
410
- prompt=filled_continuation_template,
411
- subagent_type="cook-executor",
412
- model="{executor_model}"
413
- )
414
- ```
415
-
416
- Fill template with:
417
- - `{completed_tasks_table}`: From agent's checkpoint return
418
- - `{resume_task_number}`: Current task from checkpoint
419
- - `{resume_task_name}`: Current task name from checkpoint
420
- - `{user_response}`: What user provided
421
- - `{resume_instructions}`: Based on checkpoint type (see continuation-prompt.md)
422
-
423
- 7. **Continuation agent executes:**
424
- - Verifies previous commits exist
425
- - Continues from resume point
426
- - May hit another checkpoint (repeat from step 4)
427
- - Or completes plan
428
-
429
- 8. **Repeat until plan completes or user stops**
430
-
431
- **Why fresh agent instead of resume:**
432
- Resume relies on Claude Code's internal serialization which breaks with parallel tool calls.
433
- Fresh agents with explicit state are more reliable and maintain full context.
434
-
435
- **Checkpoint in parallel context:**
436
- If a plan in a parallel wave has a checkpoint:
437
- - Spawn as normal
438
- - Agent pauses at checkpoint and returns with structured state
439
- - Other parallel agents may complete while waiting
440
- - Present checkpoint to user
441
- - Spawn continuation agent with user response
442
- - Wait for all agents to finish before next wave
443
- </step>
444
-
445
- <step name="aggregate_results">
446
- After all waves complete, aggregate results:
447
-
448
- ```markdown
449
- ## Phase {X}: {Name} Execution Complete
450
-
451
- **Waves executed:** {N}
452
- **Plans completed:** {M} of {total}
453
-
454
- ### Wave Summary
455
-
456
- | Wave | Plans | Status |
457
- |------|-------|--------|
458
- | 1 | plan-01, plan-02 | ✓ Complete |
459
- | CP | plan-03 | ✓ Verified |
460
- | 2 | plan-04 | ✓ Complete |
461
- | 3 | plan-05 | ✓ Complete |
462
-
463
- ### Plan Details
464
-
465
- 1. **03-01**: [one-liner from SUMMARY.md]
466
- 2. **03-02**: [one-liner from SUMMARY.md]
467
- ...
468
-
469
- ### Issues Encountered
470
- [Aggregate from all SUMMARYs, or "None"]
471
- ```
472
- </step>
473
-
474
- <step name="verify_phase_goal">
475
- Verify phase achieved its GOAL, not just completed its TASKS.
476
-
477
- **Spawn verifier:**
478
-
479
- ```
480
- Task(
481
- prompt="Verify phase {phase_number} goal achievement.
482
-
483
- Phase directory: {phase_dir}
484
- Phase goal: {goal from ROADMAP.md}
485
-
486
- Check must_haves against actual codebase. Create VERIFICATION.md.
487
- Verify what actually exists in the code.",
488
- subagent_type="cook-verifier",
489
- model="{verifier_model}"
490
- )
491
- ```
492
-
493
- **Read verification status:**
494
-
495
- ```bash
496
- grep "^status:" "$PHASE_DIR"/*-VERIFICATION.md | cut -d: -f2 | tr -d ' '
497
- ```
498
-
499
- **Route by status:**
500
-
501
- | Status | Action |
502
- |--------|--------|
503
- | `passed` | Continue to update_roadmap |
504
- | `human_needed` | Present items to user, get approval or feedback |
505
- | `gaps_found` | Present gap summary, offer `/cook:plan-phase {phase} --gaps` |
506
-
507
- **If passed:**
508
-
509
- Phase goal verified. Proceed to update_roadmap.
510
-
511
- **If human_needed:**
512
-
513
- ```markdown
514
- ## ✓ Phase {X}: {Name} — Human Verification Required
515
-
516
- All automated checks passed. {N} items need human testing:
517
-
518
- ### Human Verification Checklist
519
-
520
- {Extract from VERIFICATION.md human_verification section}
521
-
522
- ---
523
-
524
- **After testing:**
525
- - "approved" → continue to update_roadmap
526
- - Report issues → will route to gap closure planning
527
- ```
528
-
529
- If user approves → continue to update_roadmap.
530
- If user reports issues → treat as gaps_found.
531
-
532
- **If gaps_found:**
533
-
534
- Present gaps and offer next command:
535
-
536
- ```markdown
537
- ## ⚠ Phase {X}: {Name} — Gaps Found
538
-
539
- **Score:** {N}/{M} must-haves verified
540
- **Report:** {phase_dir}/{phase}-VERIFICATION.md
541
-
542
- ### What's Missing
543
-
544
- {Extract gap summaries from VERIFICATION.md gaps section}
545
-
546
- ---
547
-
548
- ## ▶ Next Up
549
-
550
- **Plan gap closure** — create additional plans to complete the phase
551
-
552
- `/cook:plan-phase {X} --gaps`
553
-
554
- <sub>`/clear` first → fresh context window</sub>
555
-
556
- ---
557
-
558
- **Also available:**
559
- - `cat {phase_dir}/{phase}-VERIFICATION.md` — see full report
560
- - `/cook:verify-work {X}` — manual testing before planning
561
- ```
562
-
563
- User runs `/cook:plan-phase {X} --gaps` which:
564
- 1. Reads VERIFICATION.md gaps
565
- 2. Creates additional plans (04, 05, etc.) with `gap_closure: true` to close gaps
566
- 3. User then runs `/cook:execute-phase {X} --gaps-only`
567
- 4. Execute-phase runs only gap closure plans (04-05)
568
- 5. Verifier runs again after new plans complete
569
-
570
- User stays in control at each decision point.
571
- </step>
572
-
573
- <step name="update_roadmap">
574
- Update ROADMAP.md to reflect phase completion:
575
-
576
- ```bash
577
- # Mark phase complete
578
- # Update completion date
579
- # Update status
580
- ```
581
-
582
- **Check planning config:**
583
-
584
- If `COMMIT_PLANNING_DOCS=false` (set in load_project_state):
585
- - Skip all git operations for .planning/ files
586
- - Planning docs exist locally but are gitignored
587
- - Log: "Skipping planning docs commit (commit_docs: false)"
588
- - Proceed to offer_next step
589
-
590
- If `COMMIT_PLANNING_DOCS=true` (default):
591
- - Continue with git operations below
592
-
593
- Commit phase completion (roadmap, state, verification):
594
- ```bash
595
- git add .planning/ROADMAP.md .planning/STATE.md .planning/phases/{phase_dir}/*-VERIFICATION.md
596
- git add .planning/REQUIREMENTS.md # if updated
597
- git commit -m "docs(phase-{X}): complete phase execution"
598
- ```
599
- </step>
600
-
601
- <step name="offer_next">
602
- Present next steps based on milestone status:
603
-
604
- **If more phases remain:**
605
- ```
606
- ## Next Up
607
-
608
- **Phase {X+1}: {Name}** — {Goal}
609
-
610
- `/cook:plan-phase {X+1}`
611
-
612
- <sub>`/clear` first for fresh context</sub>
613
- ```
614
-
615
- **If milestone complete:**
616
- ```
617
- MILESTONE COMPLETE!
618
-
619
- All {N} phases executed.
620
-
621
- `/cook:complete-milestone`
622
- ```
623
- </step>
624
-
625
- </process>
626
-
627
- <context_efficiency>
628
- Orchestrator: ~10-15% context (frontmatter, spawning, results).
629
- Subagents: Fresh 200k each (full workflow + execution).
630
- No polling (Task blocks). No context bleed.
631
- </context_efficiency>
632
-
633
- <failure_handling>
634
- **Subagent fails mid-plan:**
635
- - SUMMARY.md won't exist
636
- - Orchestrator detects missing SUMMARY
637
- - Reports failure, asks user how to proceed
638
-
639
- **Dependency chain breaks:**
640
- - Wave 1 plan fails
641
- - Wave 2 plans depending on it will likely fail
642
- - Orchestrator can still attempt them (user choice)
643
- - Or skip dependent plans entirely
644
-
645
- **All agents in wave fail:**
646
- - Something systemic (git issues, permissions, etc.)
647
- - Stop execution
648
- - Report for manual investigation
649
-
650
- **Checkpoint fails to resolve:**
651
- - User can't approve or provides repeated issues
652
- - Ask: "Skip this plan?" or "Abort phase execution?"
653
- - Record partial progress in STATE.md
654
- </failure_handling>
655
-
656
- <resumption>
657
- **Resuming interrupted execution:**
658
-
659
- If phase execution was interrupted (context limit, user exit, error):
660
-
661
- 1. Run `/cook:execute-phase {phase}` again
662
- 2. discover_plans finds completed SUMMARYs
663
- 3. Skips completed plans
664
- 4. Resumes from first incomplete plan
665
- 5. Continues wave-based execution
666
-
667
- **STATE.md tracks:**
668
- - Last completed plan
669
- - Current wave
670
- - Any pending checkpoints
671
- </resumption>