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