@ktpartners/dgs-platform 2.6.2

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 (256) hide show
  1. package/LICENSE +38 -0
  2. package/README.md +851 -0
  3. package/agents/dgs-codebase-cross-analyzer.md +183 -0
  4. package/agents/dgs-codebase-mapper.md +782 -0
  5. package/agents/dgs-codebase-synthesizer.md +156 -0
  6. package/agents/dgs-debugger.md +1256 -0
  7. package/agents/dgs-executor.md +550 -0
  8. package/agents/dgs-integration-checker.md +481 -0
  9. package/agents/dgs-nyquist-auditor.md +178 -0
  10. package/agents/dgs-phase-researcher.md +563 -0
  11. package/agents/dgs-phase-verifier.md +450 -0
  12. package/agents/dgs-plan-checker.md +708 -0
  13. package/agents/dgs-planner.md +1324 -0
  14. package/agents/dgs-project-researcher.md +631 -0
  15. package/agents/dgs-research-synthesizer.md +249 -0
  16. package/agents/dgs-roadmapper.md +652 -0
  17. package/agents/dgs-verifier.md +607 -0
  18. package/bin/install.js +2073 -0
  19. package/commands/dgs/add-doc.md +45 -0
  20. package/commands/dgs/add-idea.md +38 -0
  21. package/commands/dgs/add-phase.md +43 -0
  22. package/commands/dgs/add-repo.md +54 -0
  23. package/commands/dgs/add-tests.md +41 -0
  24. package/commands/dgs/add-todo.md +47 -0
  25. package/commands/dgs/approve-spec.md +38 -0
  26. package/commands/dgs/audit-milestone.md +36 -0
  27. package/commands/dgs/audit-phase.md +37 -0
  28. package/commands/dgs/cancel-job.md +23 -0
  29. package/commands/dgs/capture-principle.md +143 -0
  30. package/commands/dgs/check-todos.md +45 -0
  31. package/commands/dgs/cleanup.md +18 -0
  32. package/commands/dgs/complete-milestone.md +136 -0
  33. package/commands/dgs/complete-project.md +70 -0
  34. package/commands/dgs/consolidate-ideas.md +50 -0
  35. package/commands/dgs/create-milestone-job.md +37 -0
  36. package/commands/dgs/debug.md +164 -0
  37. package/commands/dgs/develop-idea.md +53 -0
  38. package/commands/dgs/discuss-idea.md +41 -0
  39. package/commands/dgs/discuss-phase.md +83 -0
  40. package/commands/dgs/execute-phase.md +41 -0
  41. package/commands/dgs/fast.md +38 -0
  42. package/commands/dgs/find-related-ideas.md +43 -0
  43. package/commands/dgs/health.md +28 -0
  44. package/commands/dgs/help.md +22 -0
  45. package/commands/dgs/import-spec.md +36 -0
  46. package/commands/dgs/init-product.md +28 -0
  47. package/commands/dgs/insert-phase.md +32 -0
  48. package/commands/dgs/join-discord.md +18 -0
  49. package/commands/dgs/list-docs.md +40 -0
  50. package/commands/dgs/list-ideas.md +42 -0
  51. package/commands/dgs/list-jobs.md +22 -0
  52. package/commands/dgs/list-phase-assumptions.md +46 -0
  53. package/commands/dgs/list-projects.md +57 -0
  54. package/commands/dgs/list-specs.md +40 -0
  55. package/commands/dgs/map-codebase.md +92 -0
  56. package/commands/dgs/new-milestone.md +44 -0
  57. package/commands/dgs/new-project.md +42 -0
  58. package/commands/dgs/node-repair.md +26 -0
  59. package/commands/dgs/overlap-check.md +20 -0
  60. package/commands/dgs/pause-work.md +38 -0
  61. package/commands/dgs/plan-milestone-gaps.md +34 -0
  62. package/commands/dgs/plan-phase.md +44 -0
  63. package/commands/dgs/progress.md +24 -0
  64. package/commands/dgs/quick.md +41 -0
  65. package/commands/dgs/reactivate-project.md +70 -0
  66. package/commands/dgs/reapply-patches.md +110 -0
  67. package/commands/dgs/refine-spec.md +38 -0
  68. package/commands/dgs/reject-idea.md +43 -0
  69. package/commands/dgs/remove-doc.md +44 -0
  70. package/commands/dgs/remove-phase.md +31 -0
  71. package/commands/dgs/remove-repo.md +69 -0
  72. package/commands/dgs/research-idea.md +43 -0
  73. package/commands/dgs/research-phase.md +189 -0
  74. package/commands/dgs/restore-idea.md +45 -0
  75. package/commands/dgs/resume-work.md +40 -0
  76. package/commands/dgs/rollback-job.md +24 -0
  77. package/commands/dgs/run-job.md +35 -0
  78. package/commands/dgs/search.md +40 -0
  79. package/commands/dgs/set-profile.md +34 -0
  80. package/commands/dgs/settings.md +38 -0
  81. package/commands/dgs/switch-project.md +58 -0
  82. package/commands/dgs/undo-consolidation.md +42 -0
  83. package/commands/dgs/update-idea.md +44 -0
  84. package/commands/dgs/update.md +37 -0
  85. package/commands/dgs/validate-phase.md +35 -0
  86. package/commands/dgs/verify-work.md +39 -0
  87. package/commands/dgs/write-spec.md +49 -0
  88. package/deliver-great-systems/.planning/phases/09-backend-wiring-and-error-handling/09-01-SUMMARY.md +84 -0
  89. package/deliver-great-systems/.planning/phases/09-backend-wiring-and-error-handling/09-02-SUMMARY.md +86 -0
  90. package/deliver-great-systems/.planning/phases/10-v1-to-v2-migration-flow/10-01-SUMMARY.md +85 -0
  91. package/deliver-great-systems/bin/dgs-tools.cjs +1444 -0
  92. package/deliver-great-systems/bin/lib/auto-test.cjs +1365 -0
  93. package/deliver-great-systems/bin/lib/commands.cjs +570 -0
  94. package/deliver-great-systems/bin/lib/config.cjs +417 -0
  95. package/deliver-great-systems/bin/lib/conflict-agent.cjs +1063 -0
  96. package/deliver-great-systems/bin/lib/conflict-agent.test.cjs +554 -0
  97. package/deliver-great-systems/bin/lib/context.cjs +929 -0
  98. package/deliver-great-systems/bin/lib/context.test.cjs +693 -0
  99. package/deliver-great-systems/bin/lib/core.cjs +744 -0
  100. package/deliver-great-systems/bin/lib/core.test.cjs +822 -0
  101. package/deliver-great-systems/bin/lib/docs.cjs +919 -0
  102. package/deliver-great-systems/bin/lib/docs.test.cjs +211 -0
  103. package/deliver-great-systems/bin/lib/execution.cjs +705 -0
  104. package/deliver-great-systems/bin/lib/execution.test.cjs +1472 -0
  105. package/deliver-great-systems/bin/lib/frontmatter.cjs +324 -0
  106. package/deliver-great-systems/bin/lib/ideas.cjs +1406 -0
  107. package/deliver-great-systems/bin/lib/ideas.test.cjs +1417 -0
  108. package/deliver-great-systems/bin/lib/identity.cjs +125 -0
  109. package/deliver-great-systems/bin/lib/init.cjs +1114 -0
  110. package/deliver-great-systems/bin/lib/init.test.cjs +1271 -0
  111. package/deliver-great-systems/bin/lib/jobs.cjs +2015 -0
  112. package/deliver-great-systems/bin/lib/jobs.test.cjs +2619 -0
  113. package/deliver-great-systems/bin/lib/merge-conflicts.cjs +654 -0
  114. package/deliver-great-systems/bin/lib/merge-conflicts.test.cjs +370 -0
  115. package/deliver-great-systems/bin/lib/migration.cjs +352 -0
  116. package/deliver-great-systems/bin/lib/migration.test.cjs +582 -0
  117. package/deliver-great-systems/bin/lib/milestone.cjs +243 -0
  118. package/deliver-great-systems/bin/lib/overlap.cjs +437 -0
  119. package/deliver-great-systems/bin/lib/overlap.test.cjs +747 -0
  120. package/deliver-great-systems/bin/lib/path-audit.test.cjs +384 -0
  121. package/deliver-great-systems/bin/lib/paths.cjs +144 -0
  122. package/deliver-great-systems/bin/lib/paths.test.cjs +486 -0
  123. package/deliver-great-systems/bin/lib/phase.cjs +910 -0
  124. package/deliver-great-systems/bin/lib/projects.cjs +691 -0
  125. package/deliver-great-systems/bin/lib/projects.test.cjs +871 -0
  126. package/deliver-great-systems/bin/lib/repos.cjs +1432 -0
  127. package/deliver-great-systems/bin/lib/repos.test.cjs +1882 -0
  128. package/deliver-great-systems/bin/lib/roadmap.cjs +305 -0
  129. package/deliver-great-systems/bin/lib/search.cjs +570 -0
  130. package/deliver-great-systems/bin/lib/specs.cjs +1303 -0
  131. package/deliver-great-systems/bin/lib/state.cjs +893 -0
  132. package/deliver-great-systems/bin/lib/template.cjs +228 -0
  133. package/deliver-great-systems/bin/lib/test-helpers.cjs +291 -0
  134. package/deliver-great-systems/bin/lib/verify.cjs +796 -0
  135. package/deliver-great-systems/references/checkpoints.md +776 -0
  136. package/deliver-great-systems/references/conflict-resolution.md +66 -0
  137. package/deliver-great-systems/references/context-tiers.md +166 -0
  138. package/deliver-great-systems/references/continuation-format.md +249 -0
  139. package/deliver-great-systems/references/decimal-phase-calculation.md +67 -0
  140. package/deliver-great-systems/references/git-integration.md +250 -0
  141. package/deliver-great-systems/references/git-planning-commit.md +40 -0
  142. package/deliver-great-systems/references/model-profile-resolution.md +36 -0
  143. package/deliver-great-systems/references/model-profiles.md +95 -0
  144. package/deliver-great-systems/references/phase-argument-parsing.md +61 -0
  145. package/deliver-great-systems/references/planning-config.md +224 -0
  146. package/deliver-great-systems/references/questioning.md +162 -0
  147. package/deliver-great-systems/references/spec-review-loop.md +177 -0
  148. package/deliver-great-systems/references/tdd.md +265 -0
  149. package/deliver-great-systems/references/ui-brand.md +160 -0
  150. package/deliver-great-systems/references/verification-patterns.md +612 -0
  151. package/deliver-great-systems/templates/DEBUG.md +166 -0
  152. package/deliver-great-systems/templates/UAT.md +251 -0
  153. package/deliver-great-systems/templates/VALIDATION.md +95 -0
  154. package/deliver-great-systems/templates/claude-md.md +74 -0
  155. package/deliver-great-systems/templates/codebase/architecture.md +257 -0
  156. package/deliver-great-systems/templates/codebase/concerns.md +312 -0
  157. package/deliver-great-systems/templates/codebase/conventions.md +309 -0
  158. package/deliver-great-systems/templates/codebase/integrations.md +282 -0
  159. package/deliver-great-systems/templates/codebase/stack.md +188 -0
  160. package/deliver-great-systems/templates/codebase/structure.md +287 -0
  161. package/deliver-great-systems/templates/codebase/testing.md +482 -0
  162. package/deliver-great-systems/templates/config.json +38 -0
  163. package/deliver-great-systems/templates/context.md +354 -0
  164. package/deliver-great-systems/templates/continue-here.md +80 -0
  165. package/deliver-great-systems/templates/debug-subagent-prompt.md +93 -0
  166. package/deliver-great-systems/templates/discovery.md +148 -0
  167. package/deliver-great-systems/templates/milestone-archive.md +125 -0
  168. package/deliver-great-systems/templates/milestone.md +117 -0
  169. package/deliver-great-systems/templates/phase-prompt.md +615 -0
  170. package/deliver-great-systems/templates/planner-subagent-prompt.md +119 -0
  171. package/deliver-great-systems/templates/project.md +186 -0
  172. package/deliver-great-systems/templates/requirements.md +233 -0
  173. package/deliver-great-systems/templates/research-project/ARCHITECTURE.md +206 -0
  174. package/deliver-great-systems/templates/research-project/FEATURES.md +149 -0
  175. package/deliver-great-systems/templates/research-project/PITFALLS.md +202 -0
  176. package/deliver-great-systems/templates/research-project/STACK.md +122 -0
  177. package/deliver-great-systems/templates/research-project/SUMMARY.md +172 -0
  178. package/deliver-great-systems/templates/research.md +554 -0
  179. package/deliver-great-systems/templates/retrospective.md +54 -0
  180. package/deliver-great-systems/templates/roadmap.md +204 -0
  181. package/deliver-great-systems/templates/state.md +178 -0
  182. package/deliver-great-systems/templates/summary-complex.md +59 -0
  183. package/deliver-great-systems/templates/summary-minimal.md +41 -0
  184. package/deliver-great-systems/templates/summary-standard.md +48 -0
  185. package/deliver-great-systems/templates/summary.md +253 -0
  186. package/deliver-great-systems/templates/user-setup.md +313 -0
  187. package/deliver-great-systems/templates/verification-report.md +324 -0
  188. package/deliver-great-systems/workflows/add-doc.md +151 -0
  189. package/deliver-great-systems/workflows/add-idea.md +96 -0
  190. package/deliver-great-systems/workflows/add-phase.md +120 -0
  191. package/deliver-great-systems/workflows/add-tests.md +359 -0
  192. package/deliver-great-systems/workflows/add-todo.md +162 -0
  193. package/deliver-great-systems/workflows/approve-spec.md +194 -0
  194. package/deliver-great-systems/workflows/audit-milestone.md +364 -0
  195. package/deliver-great-systems/workflows/audit-phase.md +462 -0
  196. package/deliver-great-systems/workflows/cancel-job.md +108 -0
  197. package/deliver-great-systems/workflows/check-todos.md +181 -0
  198. package/deliver-great-systems/workflows/cleanup.md +247 -0
  199. package/deliver-great-systems/workflows/codereview.md +526 -0
  200. package/deliver-great-systems/workflows/complete-milestone.md +1298 -0
  201. package/deliver-great-systems/workflows/consolidate-ideas.md +365 -0
  202. package/deliver-great-systems/workflows/create-milestone-job.md +177 -0
  203. package/deliver-great-systems/workflows/develop-idea.md +544 -0
  204. package/deliver-great-systems/workflows/diagnose-issues.md +231 -0
  205. package/deliver-great-systems/workflows/discovery-phase.md +301 -0
  206. package/deliver-great-systems/workflows/discuss-idea.md +263 -0
  207. package/deliver-great-systems/workflows/discuss-phase.md +733 -0
  208. package/deliver-great-systems/workflows/execute-phase.md +571 -0
  209. package/deliver-great-systems/workflows/execute-plan.md +592 -0
  210. package/deliver-great-systems/workflows/find-related-ideas.md +271 -0
  211. package/deliver-great-systems/workflows/health.md +173 -0
  212. package/deliver-great-systems/workflows/help.md +997 -0
  213. package/deliver-great-systems/workflows/import-spec.md +381 -0
  214. package/deliver-great-systems/workflows/init-product.md +767 -0
  215. package/deliver-great-systems/workflows/insert-phase.md +138 -0
  216. package/deliver-great-systems/workflows/list-docs.md +119 -0
  217. package/deliver-great-systems/workflows/list-ideas.md +154 -0
  218. package/deliver-great-systems/workflows/list-jobs.md +89 -0
  219. package/deliver-great-systems/workflows/list-phase-assumptions.md +192 -0
  220. package/deliver-great-systems/workflows/list-specs.md +101 -0
  221. package/deliver-great-systems/workflows/map-codebase.md +621 -0
  222. package/deliver-great-systems/workflows/new-milestone.md +591 -0
  223. package/deliver-great-systems/workflows/new-project.md +1113 -0
  224. package/deliver-great-systems/workflows/node-repair.md +94 -0
  225. package/deliver-great-systems/workflows/overlap-check.md +86 -0
  226. package/deliver-great-systems/workflows/pause-work.md +134 -0
  227. package/deliver-great-systems/workflows/plan-milestone-gaps.md +306 -0
  228. package/deliver-great-systems/workflows/plan-phase.md +698 -0
  229. package/deliver-great-systems/workflows/progress.md +386 -0
  230. package/deliver-great-systems/workflows/quick.md +845 -0
  231. package/deliver-great-systems/workflows/refine-spec.md +275 -0
  232. package/deliver-great-systems/workflows/reject-idea.md +109 -0
  233. package/deliver-great-systems/workflows/remove-doc.md +117 -0
  234. package/deliver-great-systems/workflows/remove-phase.md +163 -0
  235. package/deliver-great-systems/workflows/research-idea.md +325 -0
  236. package/deliver-great-systems/workflows/research-phase.md +81 -0
  237. package/deliver-great-systems/workflows/restore-idea.md +101 -0
  238. package/deliver-great-systems/workflows/resume-project.md +311 -0
  239. package/deliver-great-systems/workflows/rollback-job.md +130 -0
  240. package/deliver-great-systems/workflows/run-job.md +498 -0
  241. package/deliver-great-systems/workflows/search.md +130 -0
  242. package/deliver-great-systems/workflows/set-profile.md +83 -0
  243. package/deliver-great-systems/workflows/settings.md +470 -0
  244. package/deliver-great-systems/workflows/transition.md +563 -0
  245. package/deliver-great-systems/workflows/undo-consolidation.md +155 -0
  246. package/deliver-great-systems/workflows/update-idea.md +157 -0
  247. package/deliver-great-systems/workflows/update.md +242 -0
  248. package/deliver-great-systems/workflows/validate-phase.md +177 -0
  249. package/deliver-great-systems/workflows/verify-phase.md +253 -0
  250. package/deliver-great-systems/workflows/verify-work.md +671 -0
  251. package/deliver-great-systems/workflows/write-spec.md +450 -0
  252. package/hooks/dist/dgs-check-update.js +62 -0
  253. package/hooks/dist/dgs-context-monitor.js +141 -0
  254. package/hooks/dist/dgs-statusline.js +115 -0
  255. package/package.json +60 -0
  256. package/scripts/build-hooks.js +43 -0
@@ -0,0 +1,592 @@
1
+ <purpose>
2
+ Execute a phase prompt (PLAN.md) and create the outcome summary (SUMMARY.md).
3
+ </purpose>
4
+
5
+ <context_tier>execution</context_tier>
6
+
7
+ <required_reading>
8
+ Read STATE.md before any operation to load project context.
9
+ Read config.json for planning behavior settings.
10
+
11
+ @~/.claude/deliver-great-systems/references/git-integration.md
12
+ </required_reading>
13
+
14
+ <process>
15
+
16
+ <step name="init_context" priority="first">
17
+ Load execution context (paths only to minimize orchestrator context):
18
+
19
+ ```bash
20
+ INIT=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" init execute-phase "${PHASE}")
21
+ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
22
+ ```
23
+
24
+ Extract from init JSON: `executor_model`, `commit_docs`, `phase_dir`, `phase_number`, `plans`, `summaries`, `incomplete_plans`, `state_path`, `roadmap_path`, `requirements_path`, `config_path`, `author`.
25
+
26
+ **Load execution tier context:**
27
+
28
+ ```bash
29
+ TIER_FILES=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" context load-tier execution --phase "${PHASE}" --raw 2>/dev/null)
30
+ ```
31
+
32
+ Store the file list for passing to segment sub-agents if needed.
33
+
34
+ If planning root missing: error. (In v2, paths are project-qualified via init output.)
35
+ </step>
36
+
37
+ <step name="identify_plan">
38
+ ```bash
39
+ # Use plans/summaries from INIT JSON, or list files
40
+ ls ${phase_dir}/*-PLAN.md 2>/dev/null | sort
41
+ ls ${phase_dir}/*-SUMMARY.md 2>/dev/null | sort
42
+ ```
43
+
44
+ Find first PLAN without matching SUMMARY. Decimal phases supported (`01.1-hotfix/`):
45
+
46
+ ```bash
47
+ PHASE=$(echo "$PLAN_PATH" | grep -oE '[0-9]+(\.[0-9]+)?-[0-9]+')
48
+ # config settings can be fetched via dgs-tools config-get if needed
49
+ ```
50
+
51
+ <if mode="yolo">
52
+ Auto-approve: `⚡ Execute {phase}-{plan}-PLAN.md [Plan X of Y for Phase Z]` → parse_segments.
53
+ </if>
54
+
55
+ <if mode="interactive" OR="custom with gates.execute_next_plan true">
56
+ Present plan identification, wait for confirmation.
57
+ </if>
58
+ </step>
59
+
60
+ <step name="record_start_time">
61
+ ```bash
62
+ PLAN_START_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
63
+ PLAN_START_EPOCH=$(date +%s)
64
+ ```
65
+ </step>
66
+
67
+ <step name="parse_segments">
68
+ ```bash
69
+ grep -n "type=\"checkpoint" ${phase_dir}/{phase}-{plan}-PLAN.md
70
+ ```
71
+
72
+ **Routing by checkpoint type:**
73
+
74
+ | Checkpoints | Pattern | Execution |
75
+ |-------------|---------|-----------|
76
+ | None | A (autonomous) | Single subagent: full plan + SUMMARY + commit |
77
+ | Verify-only | B (segmented) | Segments between checkpoints. After none/human-verify → SUBAGENT. After decision/human-action → MAIN |
78
+ | Decision | C (main) | Execute entirely in main context |
79
+
80
+ **Pattern A:** init_agent_tracking → spawn Task(subagent_type="dgs-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
+
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
+
84
+ **Pattern C:** Execute in main using standard flow (step name="execute").
85
+
86
+ Fresh context per subagent preserves peak quality. Main context stays lean.
87
+ </step>
88
+
89
+ <step name="init_agent_tracking">
90
+ ```bash
91
+ if [ ! -f ${project_root}/agent-history.json ]; then
92
+ echo '{"version":"1.0","max_entries":50,"entries":[]}' > ${project_root}/agent-history.json
93
+ fi
94
+ rm -f ${project_root}/current-agent-id.txt
95
+ if [ -f ${project_root}/current-agent-id.txt ]; then
96
+ INTERRUPTED_ID=$(cat ${project_root}/current-agent-id.txt)
97
+ echo "Found interrupted agent: $INTERRUPTED_ID"
98
+ fi
99
+ ```
100
+
101
+ If interrupted: ask user to resume (Task `resume` parameter) or start fresh.
102
+
103
+ **Tracking protocol:** On spawn: write agent_id to `current-agent-id.txt`, append to agent-history.json: `{"agent_id":"[id]","task_description":"[desc]","phase":"[phase]","plan":"[plan]","segment":[num|null],"timestamp":"[ISO]","status":"spawned","completion_timestamp":null}`. On completion: status → "completed", set completion_timestamp, delete current-agent-id.txt. Prune: if entries > max_entries, remove oldest "completed" (never "spawned").
104
+
105
+ Run for Pattern A/B before spawning. Pattern C: skip.
106
+ </step>
107
+
108
+ <step name="segment_execution">
109
+ Pattern B only (verify-only checkpoints). Skip for A/C.
110
+
111
+ 1. Parse segment map: checkpoint locations and types
112
+ 2. Per segment:
113
+ - Subagent route: spawn dgs-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. Include TIER_FILES in the sub-agent's `<files_to_read>` block for execution-tier context.
114
+ - Main route: execute tasks using standard flow (step name="execute")
115
+ 3. After ALL segments: aggregate files/deviations/decisions → create SUMMARY.md → commit → self-check:
116
+ - Verify key-files.created exist on disk with `[ -f ]`
117
+ - Check `git log --oneline --all --grep="{phase}-{plan}"` returns ≥1 commit
118
+ - Append `## Self-Check: PASSED` or `## Self-Check: FAILED` to SUMMARY
119
+
120
+ **Known Claude Code bug (classifyHandoffIfNeeded):** If any segment agent reports "failed" with `classifyHandoffIfNeeded is not defined`, this is a Claude Code runtime bug — not a real failure. Run spot-checks; if they pass, treat as successful.
121
+
122
+
123
+
124
+
125
+ </step>
126
+
127
+ <step name="load_prompt">
128
+ ```bash
129
+ cat ${phase_dir}/{phase}-{plan}-PLAN.md
130
+ ```
131
+ This IS the execution instructions. Follow exactly. If plan references CONTEXT.md: honor user's vision throughout.
132
+
133
+ **If plan contains `<interfaces>` block:** These are pre-extracted type definitions and contracts. Use them directly — do NOT re-read the source files to discover types. The planner already extracted what you need.
134
+ </step>
135
+
136
+ <step name="preflight_check">
137
+ **Multi-repo pre-flight (v2 only):**
138
+
139
+ If plan has `<repos>` tags on any task AND project is v2 mode:
140
+
141
+ ```bash
142
+ REPOS_LIST=$(grep -oP '(?<=<repos>).*?(?=</repos>)' "${PLAN_FILE}" | tr ',' '\n' | sort -u | tr '\n' ',' | sed 's/,$//')
143
+ if [ -n "$REPOS_LIST" ]; then
144
+ PREFLIGHT=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" commit preflight $REPOS_LIST --raw)
145
+ fi
146
+ ```
147
+
148
+ Parse JSON result. If `clean: false` for any repo, warn:
149
+ ```
150
+ Warning: Dirty repos detected: {repo_names}
151
+ Continue execution anyway? Uncommitted changes may interfere with plan commits.
152
+ ```
153
+
154
+ Preflight is advisory — does not block execution. Display warning and continue.
155
+
156
+ **Manual resolution detection:** If a multi-repo commit fails and the user indicates they've fixed it manually, use:
157
+
158
+ ```bash
159
+ RESOLVED=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" commit detect-manual <repo-name> --files <expected-files> --raw)
160
+ ```
161
+
162
+ If `resolved: true`, skip the failed repo's commit and continue. The `reason` field explains how resolution was detected (sha_verified, manually_resolved).
163
+ </step>
164
+
165
+ <step name="previous_phase_check">
166
+ ```bash
167
+ node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" phases list --type summaries --raw
168
+ # Extract the second-to-last summary from the JSON result
169
+ ```
170
+ If previous SUMMARY has unresolved "Issues Encountered" or "Next Phase Readiness" blockers: AskUserQuestion(header="Previous Issues", options: "Proceed anyway" | "Address first" | "Review previous").
171
+ </step>
172
+
173
+ <step name="execute">
174
+ Deviations are normal — handle via rules below.
175
+
176
+ 1. Read @context files from prompt
177
+ 2. Per task:
178
+ - **MANDATORY read_first gate:** If the task has a `<read_first>` field, you MUST read every listed file BEFORE making any edits. This is not optional. Do not skip files because you "already know" what's in them — read them. The read_first files establish ground truth for the task.
179
+ - `type="auto"`: if `tdd="true"` → TDD execution. Implement with deviation rules + auth gates. Verify done criteria. Commit (see task_commit). Track hash for Summary.
180
+ - `type="checkpoint:*"`: STOP → checkpoint_protocol → wait for user → continue only after confirmation.
181
+ - **MANDATORY acceptance_criteria check:** After completing each task, if it has `<acceptance_criteria>`, verify EVERY criterion before moving to the next task. Use grep, file reads, or CLI commands to confirm each criterion. If any criterion fails, fix the implementation before proceeding. Do not skip criteria or mark them as "will verify later".
182
+ 3. Run `<verification>` checks
183
+ 4. Confirm `<success_criteria>` met
184
+ 5. Document deviations in Summary
185
+ </step>
186
+
187
+ <authentication_gates>
188
+
189
+ ## Authentication Gates
190
+
191
+ Auth errors during execution are NOT failures — they're expected interaction points.
192
+
193
+ **Indicators:** "Not authenticated", "Unauthorized", 401/403, "Please run {tool} login", "Set {ENV_VAR}"
194
+
195
+ **Protocol:**
196
+ 1. Recognize auth gate (not a bug)
197
+ 2. STOP task execution
198
+ 3. Create dynamic checkpoint:human-action with exact auth steps
199
+ 4. Wait for user to authenticate
200
+ 5. Verify credentials work
201
+ 6. Retry original task
202
+ 7. Continue normally
203
+
204
+ **Example:** `vercel --yes` → "Not authenticated" → checkpoint asking user to `vercel login` → verify with `vercel whoami` → retry deploy → continue
205
+
206
+ **In Summary:** Document as normal flow under "## Authentication Gates", not as deviations.
207
+
208
+ </authentication_gates>
209
+
210
+ <deviation_rules>
211
+
212
+ ## Deviation Rules
213
+
214
+ You WILL discover unplanned work. Apply automatically, track all for Summary.
215
+
216
+ | Rule | Trigger | Action | Permission |
217
+ |------|---------|--------|------------|
218
+ | **1: Bug** | Broken behavior, errors, wrong queries, type errors, security vulns, race conditions, leaks | Fix → test → verify → track `[Rule 1 - Bug]` | Auto |
219
+ | **2: Missing Critical** | Missing essentials: error handling, validation, auth, CSRF/CORS, rate limiting, indexes, logging | Add → test → verify → track `[Rule 2 - Missing Critical]` | Auto |
220
+ | **3: Blocking** | Prevents completion: missing deps, wrong types, broken imports, missing env/config/files, circular deps | Fix blocker → verify proceeds → track `[Rule 3 - Blocking]` | Auto |
221
+ | **4: Architectural** | Structural change: new DB table, schema change, new service, switching libs, breaking API, new infra | STOP → present decision (below) → track `[Rule 4 - Architectural]` | Ask user |
222
+
223
+ **Rule 4 format:**
224
+ ```
225
+ ⚠️ Architectural Decision Needed
226
+
227
+ Current task: [task name]
228
+ Discovery: [what prompted this]
229
+ Proposed change: [modification]
230
+ Why needed: [rationale]
231
+ Impact: [what this affects]
232
+ Alternatives: [other approaches]
233
+
234
+ Proceed with proposed change? (yes / different approach / defer)
235
+ ```
236
+
237
+ **Priority:** Rule 4 (STOP) > Rules 1-3 (auto) > unsure → Rule 4
238
+ **Edge cases:** missing validation → R2 | null crash → R1 | new table → R4 | new column → R1/2
239
+ **Heuristic:** Affects correctness/security/completion? → R1-3. Maybe? → R4.
240
+
241
+ </deviation_rules>
242
+
243
+ <deviation_documentation>
244
+
245
+ ## Documenting Deviations
246
+
247
+ Summary MUST include deviations section. None? → `## Deviations from Plan\n\nNone - plan executed exactly as written.`
248
+
249
+ Per deviation: **[Rule N - Category] Title** — Found during: Task X | Issue | Fix | Files modified | Verification | Commit hash
250
+
251
+ End with: **Total deviations:** N auto-fixed (breakdown). **Impact:** assessment.
252
+
253
+ </deviation_documentation>
254
+
255
+ <tdd_plan_execution>
256
+ ## TDD Execution
257
+
258
+ For `type: tdd` plans — RED-GREEN-REFACTOR:
259
+
260
+ 1. **Infrastructure** (first TDD plan only): detect project, install framework, config, verify empty suite
261
+ 2. **RED:** Read `<behavior>` → failing test(s) → run (MUST fail) → commit: `test({phase}-{plan}): add failing test for [feature]`
262
+ 3. **GREEN:** Read `<implementation>` → minimal code → run (MUST pass) → commit: `feat({phase}-{plan}): implement [feature]`
263
+ 4. **REFACTOR:** Clean up → tests MUST pass → commit: `refactor({phase}-{plan}): clean up [feature]`
264
+
265
+ Errors: RED doesn't fail → investigate test/existing feature. GREEN doesn't pass → debug, iterate. REFACTOR breaks → undo.
266
+
267
+ See `~/.claude/deliver-great-systems/references/tdd.md` for structure.
268
+ </tdd_plan_execution>
269
+
270
+ <precommit_failure_handling>
271
+ ## Pre-commit Hook Failure Handling
272
+
273
+ Your commits may trigger pre-commit hooks. Auto-fix hooks handle themselves transparently — files get fixed and re-staged automatically.
274
+
275
+ If a commit is BLOCKED by a hook:
276
+
277
+ 1. The `git commit` command fails with hook error output
278
+ 2. Read the error — it tells you exactly which hook and what failed
279
+ 3. Fix the issue (type error, lint violation, secret leak, etc.)
280
+ 4. `git add` the fixed files
281
+ 5. Retry the commit
282
+ 6. Do NOT use `--no-verify`
283
+
284
+ This is normal and expected. Budget 1-2 retry cycles per commit.
285
+ </precommit_failure_handling>
286
+
287
+ <task_commit>
288
+ ## Task Commit Protocol
289
+
290
+ After each task (verification passed, done criteria met), commit immediately.
291
+
292
+ **1. Check:** `git status --short`
293
+
294
+ **2. Stage individually** (NEVER `git add .` or `git add -A`):
295
+ ```bash
296
+ git add src/api/auth.ts
297
+ git add src/types/user.ts
298
+ ```
299
+
300
+ **3. Commit type:**
301
+
302
+ | Type | When | Example |
303
+ |------|------|---------|
304
+ | `feat` | New functionality | feat(08-02): create user registration endpoint |
305
+ | `fix` | Bug fix | fix(08-02): correct email validation regex |
306
+ | `test` | Test-only (TDD RED) | test(08-02): add failing test for password hashing |
307
+ | `refactor` | No behavior change (TDD REFACTOR) | refactor(08-02): extract validation to helper |
308
+ | `perf` | Performance | perf(08-02): add database index |
309
+ | `docs` | Documentation | docs(08-02): add API docs |
310
+ | `style` | Formatting | style(08-02): format auth module |
311
+ | `chore` | Config/deps | chore(08-02): add bcrypt dependency |
312
+
313
+ **4. Format:** `{type}({phase}-{plan}): {description}` with bullet points for key changes.
314
+
315
+ **5. Record hash:**
316
+ ```bash
317
+ TASK_COMMIT=$(git rev-parse --short HEAD)
318
+ TASK_COMMITS+=("Task ${TASK_NUM}: ${TASK_COMMIT}")
319
+ ```
320
+
321
+ </task_commit>
322
+
323
+ <step name="checkpoint_protocol">
324
+ On `type="checkpoint:*"`: automate everything possible first. Checkpoints are for verification/decisions only.
325
+
326
+ Display: `CHECKPOINT: [Type]` box → Progress {X}/{Y} → Task name → type-specific content → `YOUR ACTION: [signal]`
327
+
328
+ | Type | Content | Resume signal |
329
+ |------|---------|---------------|
330
+ | human-verify (90%) | What was built + verification steps (commands/URLs) | "approved" or describe issues |
331
+ | decision (9%) | Decision needed + context + options with pros/cons | "Select: option-id" |
332
+ | human-action (1%) | What was automated + ONE manual step + verification plan | "done" |
333
+
334
+ After response: verify if specified. Pass → continue. Fail → inform, wait. WAIT for user — do NOT hallucinate completion.
335
+
336
+ See ~/.claude/deliver-great-systems/references/checkpoints.md for details.
337
+ </step>
338
+
339
+ <step name="checkpoint_return_for_orchestrator">
340
+ When spawned via Task and hitting checkpoint: return structured state (cannot interact with user directly).
341
+
342
+ **Required return:** 1) Completed Tasks table (hashes + files) 2) Current Task (what's blocking) 3) Checkpoint Details (user-facing content) 4) Awaiting (what's needed from user)
343
+
344
+ Orchestrator parses → presents to user → spawns fresh continuation with your completed tasks state. You will NOT be resumed. In main context: use checkpoint_protocol above.
345
+ </step>
346
+
347
+ <step name="verification_failure_gate">
348
+ If verification fails:
349
+
350
+ **Check if node repair is enabled** (default: on):
351
+ ```bash
352
+ NODE_REPAIR=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" config-get workflow.node_repair 2>/dev/null || echo "true")
353
+ ```
354
+
355
+ If `NODE_REPAIR` is `true`: invoke `@./.claude/deliver-great-systems/workflows/node-repair.md` with:
356
+ - FAILED_TASK: task number, name, done-criteria
357
+ - ERROR: expected vs actual result
358
+ - PLAN_CONTEXT: adjacent task names + phase goal
359
+ - REPAIR_BUDGET: `workflow.node_repair_budget` from config (default: 2)
360
+
361
+ Node repair will attempt RETRY, DECOMPOSE, or PRUNE autonomously. Only reaches this gate again if repair budget is exhausted (ESCALATE).
362
+
363
+ If `NODE_REPAIR` is `false` OR repair returns ESCALATE: STOP. Present: "Verification failed for Task [X]: [name]. Expected: [criteria]. Actual: [result]. Repair attempted: [summary of what was tried]." Options: Retry | Skip (mark incomplete) | Stop (investigate). If skipped → SUMMARY "Issues Encountered".
364
+ </step>
365
+
366
+ <step name="record_completion_time">
367
+ ```bash
368
+ PLAN_END_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
369
+ PLAN_END_EPOCH=$(date +%s)
370
+
371
+ DURATION_SEC=$(( PLAN_END_EPOCH - PLAN_START_EPOCH ))
372
+ DURATION_MIN=$(( DURATION_SEC / 60 ))
373
+
374
+ if [[ $DURATION_MIN -ge 60 ]]; then
375
+ HRS=$(( DURATION_MIN / 60 ))
376
+ MIN=$(( DURATION_MIN % 60 ))
377
+ DURATION="${HRS}h ${MIN}m"
378
+ else
379
+ DURATION="${DURATION_MIN} min"
380
+ fi
381
+ ```
382
+ </step>
383
+
384
+ <step name="generate_user_setup">
385
+ ```bash
386
+ grep -A 50 "^user_setup:" ${phase_dir}/{phase}-{plan}-PLAN.md | head -50
387
+ ```
388
+
389
+ If user_setup exists: create `{phase}-USER-SETUP.md` using template `~/.claude/deliver-great-systems/templates/user-setup.md`. Per service: env vars table, account setup checklist, dashboard config, local dev notes, verification commands. Status "Incomplete". Set `USER_SETUP_CREATED=true`. If empty/missing: skip.
390
+ </step>
391
+
392
+ <step name="create_summary">
393
+ Create `{phase}-{plan}-SUMMARY.md` at `${phase_dir}/`. Use `~/.claude/deliver-great-systems/templates/summary.md`.
394
+
395
+ **Frontmatter:** phase, plan, subsystem, tags | requires/provides/affects | tech-stack.added/patterns | key-files.created/modified | key-decisions | requirements-completed (**MUST** copy `requirements` array from PLAN.md frontmatter verbatim) | duration ($DURATION), completed ($PLAN_END_TIME date).
396
+
397
+ Include `executed_by: ${author}` (from init JSON) in frontmatter — records who triggered this execution.
398
+
399
+ Title: `# Phase [X] Plan [Y]: [Name] Summary`
400
+
401
+ One-liner SUBSTANTIVE: "JWT auth with refresh rotation using jose library" not "Authentication implemented"
402
+
403
+ Include: duration, start/end times, task count, file count.
404
+
405
+ Next: more plans → "Ready for {next-plan}" | last → "Phase complete, ready for transition".
406
+ </step>
407
+
408
+ <step name="update_current_position">
409
+ Update STATE.md using dgs-tools:
410
+
411
+ ```bash
412
+ # Advance plan counter (handles last-plan edge case)
413
+ node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" state advance-plan
414
+
415
+ # Recalculate progress bar from disk state
416
+ node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" state update-progress
417
+
418
+ # Record execution metrics
419
+ node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" state record-metric \
420
+ --phase "${PHASE}" --plan "${PLAN}" --duration "${DURATION}" \
421
+ --tasks "${TASK_COUNT}" --files "${FILE_COUNT}"
422
+ ```
423
+ </step>
424
+
425
+ <step name="extract_decisions_and_issues">
426
+ From SUMMARY: Extract decisions and add to STATE.md:
427
+
428
+ ```bash
429
+ # Add each decision from SUMMARY key-decisions
430
+ # Prefer file inputs for shell-safe text (preserves `$`, `*`, etc. exactly)
431
+ node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" state add-decision \
432
+ --phase "${PHASE}" --summary-file "${DECISION_TEXT_FILE}" --rationale-file "${RATIONALE_FILE}"
433
+
434
+ # Add blockers if any found
435
+ node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" state add-blocker --text-file "${BLOCKER_TEXT_FILE}"
436
+ ```
437
+ </step>
438
+
439
+ <step name="update_session_continuity">
440
+ Update session info using dgs-tools:
441
+
442
+ ```bash
443
+ node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" state record-session \
444
+ --stopped-at "Completed ${PHASE}-${PLAN}-PLAN.md" \
445
+ --resume-file "None"
446
+ ```
447
+
448
+ Keep STATE.md under 150 lines.
449
+ </step>
450
+
451
+ <step name="issues_review_gate">
452
+ If SUMMARY "Issues Encountered" ≠ "None": yolo → log and continue. Interactive → present issues, wait for acknowledgment.
453
+ </step>
454
+
455
+ <step name="update_roadmap">
456
+ ```bash
457
+ node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" roadmap update-plan-progress "${PHASE}"
458
+ ```
459
+ Counts PLAN vs SUMMARY files on disk. Updates progress table row with correct count and status (`In Progress` or `Complete` with date).
460
+ </step>
461
+
462
+ <step name="update_requirements">
463
+ Mark completed requirements from the PLAN.md frontmatter `requirements:` field:
464
+
465
+ ```bash
466
+ node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" requirements mark-complete ${REQ_IDS}
467
+ ```
468
+
469
+ Extract requirement IDs from the plan's frontmatter (e.g., `requirements: [AUTH-01, AUTH-02]`). If no requirements field, skip.
470
+ </step>
471
+
472
+ <step name="git_commit_metadata">
473
+ **Multi-repo guard:** If any task used `commit --multi-repo` and returned `success: false`, display a warning before committing planning metadata:
474
+
475
+ ```
476
+ Warning: Some repo commits failed. Planning metadata will still be committed to track partial progress.
477
+ Check SUMMARY.md status field for per-repo details.
478
+ ```
479
+
480
+ The planning metadata commit proceeds regardless (to track partial progress), but the warning ensures visibility. The SUMMARY.md `status: partial` field records which repos failed.
481
+
482
+ Task code already committed per-task. Commit plan metadata:
483
+
484
+ ```bash
485
+ node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" commit "docs({phase}-{plan}): complete [plan-name] plan" --files ${phase_dir}/{phase}-{plan}-SUMMARY.md ${state_path} ${roadmap_path} ${requirements_path}
486
+ ```
487
+ </step>
488
+
489
+ <step name="codereview_gate">
490
+ Check if code review is enabled:
491
+
492
+ ```bash
493
+ CODEREVIEW=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" config-get workflow.codereview 2>/dev/null || echo "false")
494
+ ```
495
+
496
+ If `CODEREVIEW` is `true`:
497
+
498
+ Display:
499
+ ```
500
+ ------------------------------------------------------------
501
+ DGS > SPAWNING CODE REVIEW
502
+ ------------------------------------------------------------
503
+
504
+ Reviewing {phase}-{plan} changes across 3 passes...
505
+ ```
506
+
507
+ Compute diff reference for the plan's task commits:
508
+
509
+ ```bash
510
+ FIRST_TASK_COMMIT=$(git log --oneline --grep="feat(${PHASE}-${PLAN}):" --grep="fix(${PHASE}-${PLAN}):" --grep="test(${PHASE}-${PLAN}):" --grep="refactor(${PHASE}-${PLAN}):" --reverse | head -1 | cut -d' ' -f1)
511
+ ```
512
+
513
+ If FIRST_TASK_COMMIT is empty (no task commits found), skip codereview with message: "No task commits found for {phase}-{plan}, skipping code review."
514
+
515
+ Otherwise, invoke the codereview workflow:
516
+
517
+ ```
518
+ @~/.claude/deliver-great-systems/workflows/codereview.md
519
+ ```
520
+
521
+ With inputs:
522
+ - PHASE: ${PHASE}
523
+ - PLAN: ${PLAN}
524
+ - PLAN_PATH: ${phase_dir}/{phase}-{plan}-PLAN.md
525
+ - PHASE_DIR: ${phase_dir}
526
+ - DIFF_REF: ${FIRST_TASK_COMMIT}^..HEAD
527
+
528
+ After codereview completes:
529
+ - If auto-fixes were committed, the fix commit hash is noted in the codereview output
530
+ - The SUMMARY.md already has codereview findings appended and CODEREVIEW.md has been created with the full report (both done by codereview workflow)
531
+ - If the codereview workflow committed auto-fixes, amend the metadata commit to include the updated SUMMARY.md and CODEREVIEW.md:
532
+ ```bash
533
+ node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" commit "" --files ${phase_dir}/{phase}-{plan}-SUMMARY.md ${phase_dir}/{phase}-{plan}-CODEREVIEW.md --amend
534
+ ```
535
+
536
+ If `CODEREVIEW` is `false` or absent: skip silently (no output).
537
+ </step>
538
+
539
+ <step name="update_codebase_map">
540
+ If ${project_root}/codebase/ doesn't exist: skip.
541
+
542
+ ```bash
543
+ FIRST_TASK=$(git log --oneline --grep="feat({phase}-{plan}):" --grep="fix({phase}-{plan}):" --grep="test({phase}-{plan}):" --reverse | head -1 | cut -d' ' -f1)
544
+ git diff --name-only ${FIRST_TASK}^..HEAD 2>/dev/null
545
+ ```
546
+
547
+ Update only structural changes: new src/ dir → STRUCTURE.md | deps → STACK.md | file pattern → CONVENTIONS.md | API client → INTEGRATIONS.md | config → STACK.md | renamed → update paths. Skip code-only/bugfix/content changes.
548
+
549
+ ```bash
550
+ node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" commit "" --files ${project_root}/codebase/*.md --amend
551
+ ```
552
+ </step>
553
+
554
+ <step name="offer_next">
555
+ If `USER_SETUP_CREATED=true`: display `⚠️ USER SETUP REQUIRED` with path + env/config tasks at TOP.
556
+
557
+ ```bash
558
+ ls -1 ${phase_dir}/*-PLAN.md 2>/dev/null | wc -l
559
+ ls -1 ${phase_dir}/*-SUMMARY.md 2>/dev/null | wc -l
560
+ ```
561
+
562
+ **Determine milestone status** (MANDATORY — do not guess from context):
563
+
564
+ ```bash
565
+ ROADMAP_INFO=$(node /Users/adrian/.claude/deliver-great-systems/bin/dgs-tools.cjs roadmap analyze)
566
+ ```
567
+
568
+ Parse the `phases` array from the JSON result. Find the highest phase number in the current milestone. Compare against the current phase number to determine which route to take.
569
+
570
+ | Condition | Route | Action |
571
+ |-----------|-------|--------|
572
+ | summaries < plans | **A: More plans** | Find next PLAN without SUMMARY. Yolo: auto-continue. Interactive: show next plan, suggest `/dgs:execute-phase {phase}` + `/dgs:verify-work`. STOP here. |
573
+ | summaries = plans, current < highest phase | **B: Phase done** | Show completion, suggest `/dgs:plan-phase {Z+1}` + `/dgs:verify-work {Z}` + `/dgs:discuss-phase {Z+1}` |
574
+ | summaries = plans, current = highest phase | **C: Milestone done** | Show banner, suggest `/dgs:complete-milestone` + `/dgs:verify-work` + `/dgs:add-phase` |
575
+
576
+ All routes: `/clear` first for fresh context.
577
+ </step>
578
+
579
+ </process>
580
+
581
+ <success_criteria>
582
+
583
+ - All tasks from PLAN.md completed
584
+ - All verifications pass
585
+ - USER-SETUP.md generated if user_setup in frontmatter
586
+ - SUMMARY.md created with substantive content
587
+ - STATE.md updated (position, decisions, issues, session)
588
+ - ROADMAP.md updated
589
+ - If codebase map exists: map updated with execution changes (or skipped if no significant changes)
590
+ - If USER-SETUP.md created: prominently surfaced in completion output
591
+ - If codereview enabled: code review completed, auto-fixes committed separately, findings logged to SUMMARY, CODEREVIEW.md created with full report
592
+ </success_criteria>