@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,563 @@
1
+ <required_reading>
2
+
3
+ **Read these files NOW** (paths resolved via init phase-op in load_project_state step):
4
+
5
+ 1. STATE.md (via `${state_path}`)
6
+ 2. PROJECT.md (via `${project_root}/PROJECT.md`)
7
+ 3. ROADMAP.md (via `${roadmap_path}`)
8
+ 4. Current phase's plan files (`${phase_dir}/*-PLAN.md`)
9
+ 5. Current phase's summary files (`${phase_dir}/*-SUMMARY.md`)
10
+
11
+ </required_reading>
12
+
13
+ <purpose>
14
+
15
+ Mark current phase complete and advance to next. This is the natural point where progress tracking and PROJECT.md evolution happen.
16
+
17
+ "Planning next phase" = "current phase is done"
18
+
19
+ </purpose>
20
+
21
+ <context_tier>execution</context_tier>
22
+
23
+ <process>
24
+
25
+ <step name="load_project_state" priority="first">
26
+
27
+ Initialize project context and resolve paths:
28
+
29
+ ```bash
30
+ INIT=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" init phase-op "${current_phase}")
31
+ ```
32
+
33
+ Parse JSON for: `state_path`, `roadmap_path`, `requirements_path`, `phase_dir`, `phase_number`, `phase_name`, `project_root`.
34
+
35
+ **Load execution tier context:**
36
+
37
+ ```bash
38
+ TIER_FILES=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" context load-tier execution --phase "${current_phase}" --raw 2>/dev/null)
39
+ ```
40
+
41
+ Before transition, read project state:
42
+
43
+ ```bash
44
+ cat ${state_path} 2>/dev/null
45
+ cat ${project_root}/PROJECT.md 2>/dev/null
46
+ ```
47
+
48
+ Parse current position to verify we're transitioning the right phase.
49
+ Note accumulated context that may need updating after transition.
50
+
51
+ </step>
52
+
53
+ <step name="verify_completion">
54
+
55
+ Check current phase has all plan summaries:
56
+
57
+ ```bash
58
+ ls ${phase_dir}/*-PLAN.md 2>/dev/null | sort
59
+ ls ${phase_dir}/*-SUMMARY.md 2>/dev/null | sort
60
+ ```
61
+
62
+ **Verification logic:**
63
+
64
+ - Count PLAN files
65
+ - Count SUMMARY files
66
+ - If counts match: all plans complete
67
+ - If counts don't match: incomplete
68
+
69
+ <config-check>
70
+
71
+ ```bash
72
+ cat ${config_path} 2>/dev/null
73
+ ```
74
+
75
+ </config-check>
76
+
77
+ **If all plans complete:**
78
+
79
+ <if mode="yolo">
80
+
81
+ ```
82
+ ⚡ Auto-approved: Transition Phase [X] → Phase [X+1]
83
+ Phase [X] complete — all [Y] plans finished.
84
+
85
+ Proceeding to mark done and advance...
86
+ ```
87
+
88
+ Proceed directly to cleanup_handoff step.
89
+
90
+ </if>
91
+
92
+ <if mode="interactive" OR="custom with gates.confirm_transition true">
93
+
94
+ Ask: "Phase [X] complete — all [Y] plans finished. Ready to mark done and move to Phase [X+1]?"
95
+
96
+ Wait for confirmation before proceeding.
97
+
98
+ </if>
99
+
100
+ **If plans incomplete:**
101
+
102
+ **SAFETY RAIL: always_confirm_destructive applies here.**
103
+ Skipping incomplete plans is destructive — ALWAYS prompt regardless of mode.
104
+
105
+ Present:
106
+
107
+ ```
108
+ Phase [X] has incomplete plans:
109
+ - {phase}-01-SUMMARY.md ✓ Complete
110
+ - {phase}-02-SUMMARY.md ✗ Missing
111
+ - {phase}-03-SUMMARY.md ✗ Missing
112
+
113
+ ⚠️ Safety rail: Skipping plans requires confirmation (destructive action)
114
+
115
+ Options:
116
+ 1. Continue current phase (execute remaining plans)
117
+ 2. Mark complete anyway (skip remaining plans)
118
+ 3. Review what's left
119
+ ```
120
+
121
+ Wait for user decision.
122
+
123
+ </step>
124
+
125
+ <step name="cleanup_handoff">
126
+
127
+ Check for lingering handoffs:
128
+
129
+ ```bash
130
+ ls ${phase_dir}/.continue-here*.md 2>/dev/null
131
+ ```
132
+
133
+ If found, delete them — phase is complete, handoffs are stale.
134
+
135
+ </step>
136
+
137
+ <step name="update_roadmap_and_state">
138
+
139
+ **Delegate ROADMAP.md and STATE.md updates to dgs-tools:**
140
+
141
+ ```bash
142
+ TRANSITION=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" phase complete "${current_phase}")
143
+ ```
144
+
145
+ The CLI handles:
146
+ - Marking the phase checkbox as `[x]` complete with today's date
147
+ - Updating plan count to final (e.g., "3/3 plans complete")
148
+ - Updating the Progress table (Status → Complete, adding date)
149
+ - Advancing STATE.md to next phase (Current Phase, Status → Ready to plan, Current Plan → Not started)
150
+ - Detecting if this is the last phase in the milestone
151
+
152
+ Extract from result: `completed_phase`, `plans_executed`, `next_phase`, `next_phase_name`, `is_last_phase`.
153
+
154
+ </step>
155
+
156
+ <step name="archive_prompts">
157
+
158
+ If prompts were generated for the phase, they stay in place.
159
+ The `completed/` subfolder pattern from create-meta-prompts handles archival.
160
+
161
+ </step>
162
+
163
+ <step name="evolve_project">
164
+
165
+ Evolve PROJECT.md to reflect learnings from completed phase.
166
+
167
+ **Read phase summaries:**
168
+
169
+ ```bash
170
+ cat ${phase_dir}/*-SUMMARY.md
171
+ ```
172
+
173
+ **Assess requirement changes:**
174
+
175
+ 1. **Requirements validated?**
176
+ - Any Active requirements shipped in this phase?
177
+ - Move to Validated with phase reference: `- ✓ [Requirement] — Phase X`
178
+
179
+ 2. **Requirements invalidated?**
180
+ - Any Active requirements discovered to be unnecessary or wrong?
181
+ - Move to Out of Scope with reason: `- [Requirement] — [why invalidated]`
182
+
183
+ 3. **Requirements emerged?**
184
+ - Any new requirements discovered during building?
185
+ - Add to Active: `- [ ] [New requirement]`
186
+
187
+ 4. **Decisions to log?**
188
+ - Extract decisions from SUMMARY.md files
189
+ - Add to Key Decisions table with outcome if known
190
+
191
+ 5. **"What This Is" still accurate?**
192
+ - If the product has meaningfully changed, update the description
193
+ - Keep it current and accurate
194
+
195
+ **Update PROJECT.md:**
196
+
197
+ Make the edits inline. Update "Last updated" footer:
198
+
199
+ ```markdown
200
+ ---
201
+ *Last updated: [date] after Phase [X]*
202
+ ```
203
+
204
+ **Example evolution:**
205
+
206
+ Before:
207
+
208
+ ```markdown
209
+ ### Active
210
+
211
+ - [ ] JWT authentication
212
+ - [ ] Real-time sync < 500ms
213
+ - [ ] Offline mode
214
+
215
+ ### Out of Scope
216
+
217
+ - OAuth2 — complexity not needed for v1
218
+ ```
219
+
220
+ After (Phase 2 shipped JWT auth, discovered rate limiting needed):
221
+
222
+ ```markdown
223
+ ### Validated
224
+
225
+ - ✓ JWT authentication — Phase 2
226
+
227
+ ### Active
228
+
229
+ - [ ] Real-time sync < 500ms
230
+ - [ ] Offline mode
231
+ - [ ] Rate limiting on sync endpoint
232
+
233
+ ### Out of Scope
234
+
235
+ - OAuth2 — complexity not needed for v1
236
+ ```
237
+
238
+ **Step complete when:**
239
+
240
+ - [ ] Phase summaries reviewed for learnings
241
+ - [ ] Validated requirements moved from Active
242
+ - [ ] Invalidated requirements moved to Out of Scope with reason
243
+ - [ ] Emerged requirements added to Active
244
+ - [ ] New decisions logged with rationale
245
+ - [ ] "What This Is" updated if product changed
246
+ - [ ] "Last updated" footer reflects this transition
247
+
248
+ </step>
249
+
250
+ <step name="update_current_position_after_transition">
251
+
252
+ **Note:** Basic position updates (Current Phase, Status, Current Plan, Last Activity) were already handled by `dgs-tools phase complete` in the update_roadmap_and_state step.
253
+
254
+ Verify the updates are correct by reading STATE.md. If the progress bar needs updating, use:
255
+
256
+ ```bash
257
+ PROGRESS=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" progress bar --raw)
258
+ ```
259
+
260
+ Update the progress bar line in STATE.md with the result.
261
+
262
+ **Step complete when:**
263
+
264
+ - [ ] Phase number incremented to next phase (done by phase complete)
265
+ - [ ] Plan status reset to "Not started" (done by phase complete)
266
+ - [ ] Status shows "Ready to plan" (done by phase complete)
267
+ - [ ] Progress bar reflects total completed plans
268
+
269
+ </step>
270
+
271
+ <step name="update_project_reference">
272
+
273
+ Update Project Reference section in STATE.md.
274
+
275
+ ```markdown
276
+ ## Project Reference
277
+
278
+ See: ${project_root}/PROJECT.md (updated [today])
279
+
280
+ **Core value:** [Current core value from PROJECT.md]
281
+ **Current focus:** [Next phase name]
282
+ ```
283
+
284
+ Update the date and current focus to reflect the transition.
285
+
286
+ </step>
287
+
288
+ <step name="review_accumulated_context">
289
+
290
+ Review and update Accumulated Context section in STATE.md.
291
+
292
+ **Decisions:**
293
+
294
+ - Note recent decisions from this phase (3-5 max)
295
+ - Full log lives in PROJECT.md Key Decisions table
296
+
297
+ **Blockers/Concerns:**
298
+
299
+ - Review blockers from completed phase
300
+ - If addressed in this phase: Remove from list
301
+ - If still relevant for future: Keep with "Phase X" prefix
302
+ - Add any new concerns from completed phase's summaries
303
+
304
+ **Example:**
305
+
306
+ Before:
307
+
308
+ ```markdown
309
+ ### Blockers/Concerns
310
+
311
+ - ⚠️ [Phase 1] Database schema not indexed for common queries
312
+ - ⚠️ [Phase 2] WebSocket reconnection behavior on flaky networks unknown
313
+ ```
314
+
315
+ After (if database indexing was addressed in Phase 2):
316
+
317
+ ```markdown
318
+ ### Blockers/Concerns
319
+
320
+ - ⚠️ [Phase 2] WebSocket reconnection behavior on flaky networks unknown
321
+ ```
322
+
323
+ **Step complete when:**
324
+
325
+ - [ ] Recent decisions noted (full log in PROJECT.md)
326
+ - [ ] Resolved blockers removed from list
327
+ - [ ] Unresolved blockers kept with phase prefix
328
+ - [ ] New concerns from completed phase added
329
+
330
+ </step>
331
+
332
+ <step name="update_session_continuity_after_transition">
333
+
334
+ Update Session Continuity section in STATE.md to reflect transition completion.
335
+
336
+ **Format:**
337
+
338
+ ```markdown
339
+ Last session: [today]
340
+ Stopped at: Phase [X] complete, ready to plan Phase [X+1]
341
+ Resume file: None
342
+ ```
343
+
344
+ **Step complete when:**
345
+
346
+ - [ ] Last session timestamp updated to current date and time
347
+ - [ ] Stopped at describes phase completion and next phase
348
+ - [ ] Resume file confirmed as None (transitions don't use resume files)
349
+
350
+ </step>
351
+
352
+ <step name="offer_next_phase">
353
+
354
+ **MANDATORY: Verify milestone status before presenting next steps.**
355
+
356
+ **Use the transition result from `dgs-tools phase complete`:**
357
+
358
+ The `is_last_phase` field from the phase complete result tells you directly:
359
+ - `is_last_phase: false` → More phases remain → Go to **Route A**
360
+ - `is_last_phase: true` → Milestone complete → Go to **Route B**
361
+
362
+ The `next_phase` and `next_phase_name` fields give you the next phase details.
363
+
364
+ If you need additional context, use:
365
+ ```bash
366
+ ROADMAP=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" roadmap analyze)
367
+ ```
368
+
369
+ This returns all phases with goals, disk status, and completion info.
370
+
371
+ ---
372
+
373
+ **Route A: More phases remain in milestone**
374
+
375
+ Read ROADMAP.md to get the next phase's name and goal.
376
+
377
+ **Check if next phase has CONTEXT.md:**
378
+
379
+ Use dgs-tools to resolve the next phase directory (from `next_phase` returned by phase complete):
380
+ ```bash
381
+ NEXT_PHASE_INFO=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" init phase-op "${next_phase}")
382
+ # Parse next_phase_dir from JSON, then:
383
+ ls ${next_phase_dir}/*-CONTEXT.md 2>/dev/null
384
+ ```
385
+
386
+ **If next phase exists:**
387
+
388
+ <if mode="yolo">
389
+
390
+ **If CONTEXT.md exists:**
391
+
392
+ ```
393
+ Phase [X] marked complete.
394
+
395
+ Next: Phase [X+1] — [Name]
396
+
397
+ ⚡ Auto-continuing: Plan Phase [X+1] in detail
398
+ ```
399
+
400
+ Exit skill and invoke SlashCommand("/dgs:plan-phase [X+1] --auto")
401
+
402
+ **If CONTEXT.md does NOT exist:**
403
+
404
+ ```
405
+ Phase [X] marked complete.
406
+
407
+ Next: Phase [X+1] — [Name]
408
+
409
+ ⚡ Auto-continuing: Discuss Phase [X+1] first
410
+ ```
411
+
412
+ Exit skill and invoke SlashCommand("/dgs:discuss-phase [X+1] --auto")
413
+
414
+ </if>
415
+
416
+ <if mode="interactive" OR="custom with gates.confirm_transition true">
417
+
418
+ **If CONTEXT.md does NOT exist:**
419
+
420
+ ```
421
+ ## ✓ Phase [X] Complete
422
+
423
+ ---
424
+
425
+ ## ▶ Next Up
426
+
427
+ **Phase [X+1]: [Name]** — [Goal from ROADMAP.md]
428
+
429
+ `/dgs:discuss-phase [X+1]` — gather context and clarify approach
430
+
431
+ <sub>`/clear` first → fresh context window</sub>
432
+
433
+ ---
434
+
435
+ **Also available:**
436
+ - `/dgs:plan-phase [X+1]` — skip discussion, plan directly
437
+ - `/dgs:research-phase [X+1]` — investigate unknowns
438
+
439
+ ---
440
+ ```
441
+
442
+ **If CONTEXT.md exists:**
443
+
444
+ ```
445
+ ## ✓ Phase [X] Complete
446
+
447
+ ---
448
+
449
+ ## ▶ Next Up
450
+
451
+ **Phase [X+1]: [Name]** — [Goal from ROADMAP.md]
452
+ <sub>✓ Context gathered, ready to plan</sub>
453
+
454
+ `/dgs:plan-phase [X+1]`
455
+
456
+ <sub>`/clear` first → fresh context window</sub>
457
+
458
+ ---
459
+
460
+ **Also available:**
461
+ - `/dgs:discuss-phase [X+1]` — revisit context
462
+ - `/dgs:research-phase [X+1]` — investigate unknowns
463
+
464
+ ---
465
+ ```
466
+
467
+ </if>
468
+
469
+ ---
470
+
471
+ **Route B: Milestone complete (all phases done)**
472
+
473
+ **Clear auto-advance chain flag** — milestone boundary is the natural stopping point:
474
+ ```bash
475
+ node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" config-set workflow._auto_chain_active false
476
+ ```
477
+
478
+ <if mode="yolo">
479
+
480
+ ```
481
+ Phase {X} marked complete.
482
+
483
+ 🎉 Milestone {version} is 100% complete — all {N} phases finished!
484
+
485
+ ⚡ Auto-continuing: Complete milestone and archive
486
+ ```
487
+
488
+ Exit skill and invoke SlashCommand("/dgs:complete-milestone {version}")
489
+
490
+ </if>
491
+
492
+ <if mode="interactive" OR="custom with gates.confirm_transition true">
493
+
494
+ ```
495
+ ## ✓ Phase {X}: {Phase Name} Complete
496
+
497
+ 🎉 Milestone {version} is 100% complete — all {N} phases finished!
498
+
499
+ ---
500
+
501
+ ## ▶ Next Up
502
+
503
+ **Complete Milestone {version}** — archive and prepare for next
504
+
505
+ `/dgs:complete-milestone {version}`
506
+
507
+ <sub>`/clear` first → fresh context window</sub>
508
+
509
+ ---
510
+
511
+ **Also available:**
512
+ - Review accomplishments before archiving
513
+
514
+ ---
515
+ ```
516
+
517
+ </if>
518
+
519
+ </step>
520
+
521
+ </process>
522
+
523
+ <implicit_tracking>
524
+ Progress tracking is IMPLICIT: planning phase N implies phases 1-(N-1) complete. No separate progress step—forward motion IS progress.
525
+ </implicit_tracking>
526
+
527
+ <partial_completion>
528
+
529
+ If user wants to move on but phase isn't fully complete:
530
+
531
+ ```
532
+ Phase [X] has incomplete plans:
533
+ - {phase}-02-PLAN.md (not executed)
534
+ - {phase}-03-PLAN.md (not executed)
535
+
536
+ Options:
537
+ 1. Mark complete anyway (plans weren't needed)
538
+ 2. Defer work to later phase
539
+ 3. Stay and finish current phase
540
+ ```
541
+
542
+ Respect user judgment — they know if work matters.
543
+
544
+ **If marking complete with incomplete plans:**
545
+
546
+ - Update ROADMAP: "2/3 plans complete" (not "3/3")
547
+ - Note in transition message which plans were skipped
548
+
549
+ </partial_completion>
550
+
551
+ <success_criteria>
552
+
553
+ Transition is complete when:
554
+
555
+ - [ ] Current phase plan summaries verified (all exist or user chose to skip)
556
+ - [ ] Any stale handoffs deleted
557
+ - [ ] ROADMAP.md updated with completion status and plan count
558
+ - [ ] PROJECT.md evolved (requirements, decisions, description if needed)
559
+ - [ ] STATE.md updated (position, project reference, context, session)
560
+ - [ ] Progress table updated
561
+ - [ ] User knows next steps
562
+
563
+ </success_criteria>
@@ -0,0 +1,155 @@
1
+ <purpose>
2
+ Undo a previous idea consolidation. Validates the target idea is a consolidated result (has consolidated_from), displays the affected ideas for confirmation, calls the CLI for the atomic undo operation (restore sources to pending, delete consolidated result, git commit), and shows the result.
3
+ </purpose>
4
+
5
+ <context_tier>lite</context_tier>
6
+
7
+ <required_reading>
8
+ Read all files referenced by the invoking prompt's execution_context before starting.
9
+ </required_reading>
10
+
11
+ <process>
12
+
13
+ <step name="load_context" priority="first">
14
+ Load project context via tier system:
15
+
16
+ ```bash
17
+ TIER_FILES=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" context load-tier lite --raw 2>/dev/null)
18
+ ```
19
+
20
+ Use `TIER_FILES` JSON `files` array for project context (PROJECT.md, STATE.md, config.json).
21
+ </step>
22
+
23
+ <step name="parse_arguments">
24
+ Parse `$ARGUMENTS` for the consolidated idea ID.
25
+
26
+ - Extract the numeric positional argument as the idea ID (e.g., `/dgs:undo-consolidation 5` -> id=5)
27
+
28
+ If no ID provided, find pending ideas that have `consolidated_from` and prompt for selection:
29
+
30
+ ```bash
31
+ ALL=$(node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs ideas list --state pending --raw)
32
+ ```
33
+
34
+ Parse the JSON `ideas` array. For each idea, read the idea file and check if it has `consolidated_from` in its frontmatter.
35
+
36
+ **If no consolidated ideas found:**
37
+ ```
38
+ No consolidated ideas found. Nothing to undo.
39
+ ```
40
+ Exit workflow.
41
+
42
+ **If consolidated ideas exist:** Display them as a numbered list showing ID, title, and sources:
43
+
44
+ ```
45
+ ## Consolidated Ideas
46
+
47
+ | # | ID | Title | Consolidated From |
48
+ |---|-----|-------|-------------------|
49
+ | 1 | 005 | Improve API resilience | #001, #003, #017 |
50
+ ```
51
+
52
+ Use AskUserQuestion: "Which consolidated idea would you like to undo? (enter the idea ID)"
53
+
54
+ Parse the response as the idea ID.
55
+ </step>
56
+
57
+ <step name="validate_and_display">
58
+ Find the consolidated idea and display its details.
59
+
60
+ ```bash
61
+ ALL=$(node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs ideas list --all --raw)
62
+ ```
63
+
64
+ Parse the JSON result. Find the idea matching the provided ID.
65
+
66
+ **If not found:** Error "Idea #{id} not found." and exit.
67
+
68
+ Read the idea file to get its full content. Check that it has `consolidated_from` in its frontmatter.
69
+
70
+ **If no `consolidated_from`:** Error "Idea #{id} is not a consolidated idea (no consolidated_from field). Nothing to undo." and exit.
71
+
72
+ Extract the `consolidated_from` array (list of source idea IDs).
73
+
74
+ Display:
75
+ ```
76
+ ## Undo Consolidation
77
+
78
+ **Idea to remove:** #{id} --- {title}
79
+ **Created from:** #{source1}, #{source2}, #{source3}
80
+
81
+ The following source ideas will be restored to pending:
82
+ ```
83
+
84
+ For each source ID in `consolidated_from`, find the source idea in the full list (it should be in `consolidated/` state) and display:
85
+ ```
86
+ - #{sourceId} --- {sourceTitle} (currently in consolidated/)
87
+ ```
88
+
89
+ If a source idea cannot be found, note it as missing:
90
+ ```
91
+ - #{sourceId} --- (not found -- may have been manually deleted)
92
+ ```
93
+ </step>
94
+
95
+ <step name="confirm">
96
+ Ask the user for confirmation before proceeding.
97
+
98
+ Use AskUserQuestion:
99
+ - question: "This will:\n- Delete idea #{id} ({title})\n- Restore {N} source ideas to pending\n\nProceed? (yes/no)"
100
+
101
+ **If no (or cancel):**
102
+ ```
103
+ Undo cancelled. No changes made.
104
+ ```
105
+ Exit workflow.
106
+
107
+ **If yes:** Proceed to execute_undo step.
108
+ </step>
109
+
110
+ <step name="execute_undo">
111
+ Call the CLI to perform the atomic undo operation.
112
+
113
+ ```bash
114
+ node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs ideas undo-consolidation --id ${ID} --raw
115
+ ```
116
+
117
+ Parse the JSON result. The CLI returns:
118
+ ```json
119
+ {
120
+ "undone_idea_id": 5,
121
+ "title": "Improve API resilience",
122
+ "restored_ids": ["001", "003", "017"],
123
+ "deleted_file": "005-improve-api-resilience.md"
124
+ }
125
+ ```
126
+
127
+ If the CLI returns an error, display it and exit.
128
+ </step>
129
+
130
+ <step name="confirm_output">
131
+ Display the result of the undo operation.
132
+
133
+ ```
134
+ ## Undo Complete
135
+
136
+ **Deleted:** #{id} --- {title}
137
+ **Restored to pending:** #{source1}, #{source2}, #{source3}
138
+ **Git commit:** ideas: undo consolidation #{id} - {title}
139
+
140
+ The source ideas are back in pending/ state. Their consolidated_into references have been removed.
141
+ You can redo this consolidation with /dgs:consolidate-ideas {source1} {source2} {source3}
142
+ ```
143
+ </step>
144
+
145
+ </process>
146
+
147
+ <success_criteria>
148
+ - [ ] Argument parsed correctly (consolidated idea ID)
149
+ - [ ] Interactive selection works when no ID provided
150
+ - [ ] Idea validated as a consolidated result (has consolidated_from)
151
+ - [ ] Source ideas displayed with their current state
152
+ - [ ] User confirmation required before proceeding
153
+ - [ ] CLI called for atomic undo operation
154
+ - [ ] Confirmation output shows deleted idea and restored sources
155
+ </success_criteria>