@ktpartners/dgs-platform 2.9.0 → 3.3.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 (166) hide show
  1. package/CHANGELOG.md +197 -0
  2. package/README.md +34 -2
  3. package/agents/dgs-executor.md +124 -3
  4. package/agents/dgs-idea-researcher.md +447 -0
  5. package/agents/dgs-plan-checker.md +61 -3
  6. package/agents/dgs-planner.md +51 -8
  7. package/bin/install.js +44 -0
  8. package/commands/dgs/abandon-quick.md +28 -0
  9. package/commands/dgs/add-tests.md +2 -2
  10. package/commands/dgs/audit-milestone.md +4 -3
  11. package/commands/dgs/capture-principle.md +11 -11
  12. package/commands/dgs/cleanup.md +2 -2
  13. package/commands/dgs/complete-milestone.md +11 -11
  14. package/commands/dgs/complete-quick.md +28 -0
  15. package/commands/dgs/create-milestone-job.md +2 -2
  16. package/commands/dgs/debug.md +3 -3
  17. package/commands/dgs/develop-idea.md +1 -1
  18. package/commands/dgs/diff-report.md +124 -0
  19. package/commands/dgs/fast.md +3 -1
  20. package/commands/dgs/health.md +1 -1
  21. package/commands/dgs/map-codebase.md +6 -6
  22. package/commands/dgs/new-milestone.md +5 -5
  23. package/commands/dgs/new-project.md +8 -21
  24. package/commands/dgs/package-scan.md +43 -0
  25. package/commands/dgs/plan-milestone-gaps.md +1 -1
  26. package/commands/dgs/progress.md +3 -3
  27. package/commands/dgs/quick-abandon.md +8 -0
  28. package/commands/dgs/quick-complete.md +8 -0
  29. package/commands/dgs/quick.md +10 -3
  30. package/commands/dgs/research-idea.md +3 -2
  31. package/commands/dgs/research-phase.md +3 -3
  32. package/commands/dgs/switch-project.md +14 -1
  33. package/commands/dgs/write-spec.md +3 -3
  34. package/deliver-great-systems/bin/dgs-tools.cjs +401 -32
  35. package/deliver-great-systems/bin/lib/audit-tolerance.cjs +77 -0
  36. package/deliver-great-systems/bin/lib/audit-tolerance.test.cjs +101 -0
  37. package/deliver-great-systems/bin/lib/commands.cjs +626 -46
  38. package/deliver-great-systems/bin/lib/commands.test.cjs +451 -0
  39. package/deliver-great-systems/bin/lib/commit-verify.test.cjs +236 -0
  40. package/deliver-great-systems/bin/lib/config.cjs +80 -6
  41. package/deliver-great-systems/bin/lib/config.test.cjs +309 -0
  42. package/deliver-great-systems/bin/lib/context.cjs +120 -0
  43. package/deliver-great-systems/bin/lib/core.cjs +35 -14
  44. package/deliver-great-systems/bin/lib/core.test.cjs +79 -1
  45. package/deliver-great-systems/bin/lib/execution.cjs +49 -17
  46. package/deliver-great-systems/bin/lib/fast-routing.cjs +199 -0
  47. package/deliver-great-systems/bin/lib/fast-routing.test.cjs +108 -0
  48. package/deliver-great-systems/bin/lib/final-commit-precondition.test.cjs +87 -0
  49. package/deliver-great-systems/bin/lib/fixtures/package-scan/bundler-audit-gemfile.json +21 -0
  50. package/deliver-great-systems/bin/lib/fixtures/package-scan/gate-parity-expected.md +186 -0
  51. package/deliver-great-systems/bin/lib/fixtures/package-scan/gate-parity-runresult.json +235 -0
  52. package/deliver-great-systems/bin/lib/fixtures/package-scan/govulncheck-import.json +3 -0
  53. package/deliver-great-systems/bin/lib/fixtures/package-scan/npm-audit-v10.json +37 -0
  54. package/deliver-great-systems/bin/lib/fixtures/package-scan/osv-clean.json +3 -0
  55. package/deliver-great-systems/bin/lib/fixtures/package-scan/osv-vulns.json +77 -0
  56. package/deliver-great-systems/bin/lib/fixtures/package-scan/pip-audit-requirements.json +28 -0
  57. package/deliver-great-systems/bin/lib/fixtures/package-scan/snyk-lodash.json +30 -0
  58. package/deliver-great-systems/bin/lib/fixtures/package-scan/snyk-workspaces.json +55 -0
  59. package/deliver-great-systems/bin/lib/flat-migration.test.cjs +396 -0
  60. package/deliver-great-systems/bin/lib/frontmatter.cjs +1 -1
  61. package/deliver-great-systems/bin/lib/governance.cjs +211 -0
  62. package/deliver-great-systems/bin/lib/governance.test.cjs +339 -0
  63. package/deliver-great-systems/bin/lib/health-untracked-phase.test.cjs +269 -0
  64. package/deliver-great-systems/bin/lib/ideas.cjs +206 -91
  65. package/deliver-great-systems/bin/lib/ideas.test.cjs +244 -1
  66. package/deliver-great-systems/bin/lib/init.cjs +357 -61
  67. package/deliver-great-systems/bin/lib/init.test.cjs +625 -8
  68. package/deliver-great-systems/bin/lib/jobs.cjs +131 -25
  69. package/deliver-great-systems/bin/lib/jobs.test.cjs +193 -74
  70. package/deliver-great-systems/bin/lib/migration.cjs +409 -1
  71. package/deliver-great-systems/bin/lib/migration.test.cjs +158 -1
  72. package/deliver-great-systems/bin/lib/milestone.cjs +154 -31
  73. package/deliver-great-systems/bin/lib/milestone.test.cjs +203 -0
  74. package/deliver-great-systems/bin/lib/package-adapters.cjs +530 -0
  75. package/deliver-great-systems/bin/lib/package-adapters.test.cjs +618 -0
  76. package/deliver-great-systems/bin/lib/package-ecosystems.cjs +350 -0
  77. package/deliver-great-systems/bin/lib/package-ecosystems.test.cjs +348 -0
  78. package/deliver-great-systems/bin/lib/package-runner.cjs +199 -0
  79. package/deliver-great-systems/bin/lib/package-runner.test.cjs +198 -0
  80. package/deliver-great-systems/bin/lib/package-scan-provenance.cjs +56 -0
  81. package/deliver-great-systems/bin/lib/package-scan-provenance.test.cjs +103 -0
  82. package/deliver-great-systems/bin/lib/package-scan-report.cjs +1140 -0
  83. package/deliver-great-systems/bin/lib/package-scan-report.test.cjs +1963 -0
  84. package/deliver-great-systems/bin/lib/package-scan-skill.cjs +96 -0
  85. package/deliver-great-systems/bin/lib/package-scan-skill.test.cjs +136 -0
  86. package/deliver-great-systems/bin/lib/package-scan.cjs +919 -0
  87. package/deliver-great-systems/bin/lib/package-scan.test.cjs +2147 -0
  88. package/deliver-great-systems/bin/lib/phase.cjs +146 -3
  89. package/deliver-great-systems/bin/lib/phase.test.cjs +420 -0
  90. package/deliver-great-systems/bin/lib/plan-number-validity.test.cjs +48 -0
  91. package/deliver-great-systems/bin/lib/projects.cjs +65 -10
  92. package/deliver-great-systems/bin/lib/projects.test.cjs +198 -2
  93. package/deliver-great-systems/bin/lib/quick.cjs +739 -0
  94. package/deliver-great-systems/bin/lib/quick.test.cjs +730 -0
  95. package/deliver-great-systems/bin/lib/repos.cjs +37 -13
  96. package/deliver-great-systems/bin/lib/review.cjs +1821 -0
  97. package/deliver-great-systems/bin/lib/roadmap.cjs +34 -13
  98. package/deliver-great-systems/bin/lib/specs.cjs +3 -81
  99. package/deliver-great-systems/bin/lib/state-transition-gate.test.cjs +160 -0
  100. package/deliver-great-systems/bin/lib/state.cjs +147 -55
  101. package/deliver-great-systems/bin/lib/summary-frontmatter.cjs +54 -0
  102. package/deliver-great-systems/bin/lib/summary-frontmatter.test.cjs +78 -0
  103. package/deliver-great-systems/bin/lib/sweep-scope.test.cjs +263 -0
  104. package/deliver-great-systems/bin/lib/sync.cjs +75 -0
  105. package/deliver-great-systems/bin/lib/verify.cjs +198 -7
  106. package/deliver-great-systems/bin/lib/verify.test.cjs +82 -0
  107. package/deliver-great-systems/bin/lib/wave-0-template-rename.test.cjs +40 -0
  108. package/deliver-great-systems/bin/lib/worktrees.cjs +790 -0
  109. package/deliver-great-systems/bin/lib/worktrees.test.cjs +963 -0
  110. package/deliver-great-systems/references/agent-step-reliability.md +60 -0
  111. package/deliver-great-systems/references/conflict-resolution.md +4 -0
  112. package/deliver-great-systems/references/context-tiers.md +4 -0
  113. package/deliver-great-systems/references/package-scan-config.md +151 -0
  114. package/deliver-great-systems/references/questioning.md +0 -30
  115. package/deliver-great-systems/references/spec-review-loop.md +1 -2
  116. package/deliver-great-systems/references/workflow-conventions.md +29 -0
  117. package/deliver-great-systems/skills/dgs-tests/package-scan.md +44 -0
  118. package/deliver-great-systems/templates/REVIEW.md +35 -0
  119. package/deliver-great-systems/templates/VALIDATION.md +1 -1
  120. package/deliver-great-systems/templates/claude-md.md +27 -0
  121. package/deliver-great-systems/templates/package-scan-report.md +108 -0
  122. package/deliver-great-systems/templates/project.md +6 -170
  123. package/deliver-great-systems/templates/summary.md +3 -1
  124. package/deliver-great-systems/workflows/abandon-quick.md +89 -0
  125. package/deliver-great-systems/workflows/add-idea.md +3 -3
  126. package/deliver-great-systems/workflows/add-phase.md +5 -0
  127. package/deliver-great-systems/workflows/add-tests.md +14 -0
  128. package/deliver-great-systems/workflows/add-todo.md +1 -0
  129. package/deliver-great-systems/workflows/approve-spec.md +25 -4
  130. package/deliver-great-systems/workflows/audit-milestone.md +66 -10
  131. package/deliver-great-systems/workflows/audit-phase.md +15 -5
  132. package/deliver-great-systems/workflows/cancel-job.md +2 -2
  133. package/deliver-great-systems/workflows/check-todos.md +2 -3
  134. package/deliver-great-systems/workflows/codereview.md +103 -9
  135. package/deliver-great-systems/workflows/complete-milestone.md +218 -24
  136. package/deliver-great-systems/workflows/complete-quick.md +106 -0
  137. package/deliver-great-systems/workflows/consolidate-ideas.md +1 -1
  138. package/deliver-great-systems/workflows/create-milestone-job.md +4 -4
  139. package/deliver-great-systems/workflows/develop-idea.md +11 -11
  140. package/deliver-great-systems/workflows/diagnose-issues.md +14 -0
  141. package/deliver-great-systems/workflows/discuss-idea.md +1 -1
  142. package/deliver-great-systems/workflows/discuss-phase.md +3 -2
  143. package/deliver-great-systems/workflows/execute-phase.md +209 -33
  144. package/deliver-great-systems/workflows/execute-plan.md +22 -22
  145. package/deliver-great-systems/workflows/help.md +53 -20
  146. package/deliver-great-systems/workflows/import-spec.md +65 -7
  147. package/deliver-great-systems/workflows/init-product.md +45 -167
  148. package/deliver-great-systems/workflows/new-milestone.md +140 -33
  149. package/deliver-great-systems/workflows/new-project.md +60 -331
  150. package/deliver-great-systems/workflows/package-scan.md +59 -0
  151. package/deliver-great-systems/workflows/plan-phase.md +79 -1
  152. package/deliver-great-systems/workflows/progress-all.md +133 -0
  153. package/deliver-great-systems/workflows/quick-abandon.md +89 -0
  154. package/deliver-great-systems/workflows/quick-complete.md +106 -0
  155. package/deliver-great-systems/workflows/quick.md +328 -26
  156. package/deliver-great-systems/workflows/refine-spec.md +1 -1
  157. package/deliver-great-systems/workflows/research-idea.md +77 -139
  158. package/deliver-great-systems/workflows/resume-project.md +2 -2
  159. package/deliver-great-systems/workflows/run-job.md +29 -43
  160. package/deliver-great-systems/workflows/settings.md +13 -77
  161. package/deliver-great-systems/workflows/validate-phase.md +39 -1
  162. package/deliver-great-systems/workflows/verify-work.md +14 -0
  163. package/deliver-great-systems/workflows/write-spec.md +11 -13
  164. package/hooks/dist/dgs-enforce-discipline.js +196 -0
  165. package/package.json +1 -1
  166. package/scripts/build-hooks.js +1 -0
@@ -44,12 +44,29 @@ The spec must have status: final.
44
44
 
45
45
  <process>
46
46
 
47
+ ## 0. Resolve Paths and Models
48
+
49
+ ```bash
50
+ INIT=$(node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs init new-milestone)
51
+ ```
52
+
53
+ Extract from init JSON: `researcher_model`, `synthesizer_model`, `roadmapper_model`, `commit_docs`, `research_enabled`, `current_milestone`, `current_milestone_name`, `project_exists`, `roadmap_exists`, `state_exists`, `project_path`, `roadmap_path`, `state_path`, `product_milestones_path`, `product_milestones_exists`, `current_project`, `project_root`.
54
+
55
+ Load planning-tier context files:
56
+
57
+ ```bash
58
+ TIER_FILES=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" context load-tier planning --raw 2>/dev/null)
59
+ ```
60
+
61
+ All subsequent steps use these resolved paths. Never reference PROJECT.md, STATE.md, etc. by bare name — always use `${project_path}`, `${state_path}`, `${project_root}`, etc.
62
+
47
63
  ## 1. Load Context
48
64
 
49
- - Read PROJECT.md (existing project, validated requirements, decisions)
50
- - Read MILESTONES.md (what shipped previously) — if file does not exist, this is the first milestone; skip and use defaults
51
- - Read STATE.md (pending todos, blockers) if file does not exist, will be created in Step 5
52
- - Check for MILESTONE-CONTEXT.md (from /dgs:discuss-milestone)
65
+ - Read `${project_path}` (existing project, validated requirements, decisions)
66
+ - Read `${product_milestones_path}` (product-level MILESTONES.md — authoritative record of what shipped across ALL projects in this product; used here for global version and phase continuity) — if `${product_milestones_exists}` is false, this is the first milestone in the product; skip and use defaults
67
+ - Optionally read `${project_root}/MILESTONES.md` (per-project shipped record) for project-specific context if it exists do NOT use it for version or phase numbering, which are global across the product
68
+ - Read `${state_path}` (pending todos, blockers) — if file does not exist, will be created in Step 5
69
+ - Check for `${project_root}/MILESTONE-CONTEXT.md` (from /dgs:discuss-milestone)
53
70
 
54
71
  ## 1b. Spec-Driven Milestone (auto mode only)
55
72
 
@@ -67,7 +84,37 @@ Read the spec file and extract:
67
84
 
68
85
  ### Determine Milestone Version
69
86
 
70
- Parse MILESTONES.md for last version. If no MILESTONES.md exists (first milestone): default to v1.0 (auto mode: use v1.0 without asking). Suggest next version automatically (e.g., v1.0 v1.1, or v2.0 for major). In auto mode, use the minor bump without asking.
87
+ Parse `${product_milestones_path}` for last version (versions are global across the product a new milestone in project A continues the sequence from milestones shipped in any sibling project).
88
+
89
+ **Compute candidates:**
90
+ - If `${product_milestones_exists}` is false (first milestone in the product): the version is fixed at `v1.0` — skip the question below.
91
+ - Otherwise, last version is `vX.Y`:
92
+ - Minor candidate: `v[X].[Y+1]` (e.g. v1.3 → v1.4)
93
+ - Major candidate: `v[X+1].0` (e.g. v1.3 → v2.0)
94
+
95
+ **Derive recommendation from the spec's Problem and Goals sections:**
96
+ - Recommend **major** if content signals a breaking change, rewrite, replacement, migration, deprecation, or removal of a major capability.
97
+ - Otherwise recommend **minor**.
98
+
99
+ Compose a one-sentence reason for the recommendation (e.g. "Adds notification features without changing existing contracts" or "Replaces legacy auth with OIDC, deprecating session-token storage").
100
+
101
+ **Confirm with the user** via AskUserQuestion (auto mode no longer hardcodes minor — version is the one gate auto mode still surfaces, because a wrong major/minor call is hard to undo and the spec content alone is insufficient signal):
102
+
103
+ ```
104
+ AskUserQuestion(
105
+ header: "Version",
106
+ question: "Which version for this milestone? Recommendation: v[recommended] (${recommended_kind}) — ${reason}.",
107
+ options: [
108
+ { label: "v[recommended] — ${recommended_kind} (recommended)", description: "${reason}" },
109
+ { label: "v[other] — ${other_kind}", description: "${other_kind_brief_description}" },
110
+ { label: "Custom", description: "Enter a version manually" }
111
+ ]
112
+ )
113
+ ```
114
+
115
+ If the user selects "Custom", prompt for manual entry and validate it parses as `vX.Y`.
116
+
117
+ The chosen `vX.Y` is used for PROJECT.md, STATE.md, and commit messages throughout the rest of the auto-mode flow.
71
118
 
72
119
  ### Repo Cross-Check (v2 only)
73
120
 
@@ -93,10 +140,18 @@ AskUserQuestion([{
93
140
  }])
94
141
  ```
95
142
 
96
- Handle each choice identically to new-project's repo cross-check:
97
- - **Continue:** Skip, proceed
98
- - **Register existing:** Ask path, run `repos add`
99
- - **Create + Register:** `mkdir -p`, `git init`, `repos add`
143
+ For each unregistered repo, handle the user's choice:
144
+ - **Continue:** Skip this repo, proceed to next
145
+ - **Register existing:** Ask for path (suggest `../{repo_name}`), then run:
146
+ ```bash
147
+ node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs repos add "{path}" --name "{repo_name}"
148
+ ```
149
+ - **Create + Register:**
150
+ ```bash
151
+ mkdir -p ../{repo_name}
152
+ cd ../{repo_name} && git init
153
+ node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs repos add "../{repo_name}" --name "{repo_name}"
154
+ ```
100
155
  - **Cancel:** Stop with message: "Milestone creation cancelled. Resolve repo registration and try again."
101
156
 
102
157
  If no unregistered repos OR not v2: skip silently.
@@ -148,7 +203,7 @@ node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs commit "specs: link $SPEC
148
203
 
149
204
  ### Continue to Step 7
150
205
 
151
- Skip Steps 2-6 (questioning, version determination, update, cleanup, context loading) — they're replaced by spec-driven derivation. Proceed to Step 7 (Load Context and Resolve Models), then:
206
+ Skip Steps 2-6 (questioning, version determination, update, cleanup) — they're replaced by spec-driven derivation. Proceed to Step 8 (Research Decision), then:
152
207
 
153
208
  - Step 8 (Research Decision): Default to "Research first" in auto mode
154
209
  - Step 9 (Define Requirements): Generate from spec instead of interactive scoping:
@@ -164,9 +219,43 @@ Skip Steps 2-6 (questioning, version determination, update, cleanup, context loa
164
219
  - Step 10.5 (Overlap Check): Run as usual
165
220
  - Step 11 (Done): Show source spec in completion output
166
221
 
222
+ ## 1c. Migrate Historical Quick Directories
223
+
224
+ One-time migration for projects with quick dirs accumulated from before per-milestone archival.
225
+
226
+ Check if `${project_root}/quick/` exists and contains any directories (beyond HISTORY.md):
227
+
228
+ ```bash
229
+ QUICK_DIR="${project_root}/quick"
230
+ if [ -d "$QUICK_DIR" ]; then
231
+ QUICK_DIRS=$(ls -d "$QUICK_DIR"/*/ 2>/dev/null | wc -l)
232
+ fi
233
+ ```
234
+
235
+ If directories exist (count > 0):
236
+
237
+ 1. Create `milestones/historical-quick/` in the planning root
238
+ 2. Move ALL directories from `${project_root}/quick/` into `milestones/historical-quick/`
239
+ 3. Do NOT move HISTORY.md (it is a file, not a directory -- the glob naturally skips it)
240
+ 4. Do NOT move other plain files in quick/
241
+ 5. Log: `Migrated {N} historical quick directories to milestones/historical-quick/`
242
+
243
+ ```bash
244
+ PLAN_ROOT=$(node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs paths planning-root --raw)
245
+ HIST_DIR="$PLAN_ROOT/milestones/historical-quick"
246
+ mkdir -p "$HIST_DIR"
247
+ for d in "$QUICK_DIR"/*/; do
248
+ [ -d "$d" ] && mv "$d" "$HIST_DIR/"
249
+ done
250
+ ```
251
+
252
+ If no directories exist: skip silently (no output needed).
253
+
254
+ This is idempotent -- once dirs are moved, subsequent runs find nothing to migrate.
255
+
167
256
  ## 2. Gather Milestone Goals
168
257
 
169
- **If MILESTONE-CONTEXT.md exists:**
258
+ **If `${project_root}/MILESTONE-CONTEXT.md` exists:**
170
259
  - Use features and scope from discuss-milestone
171
260
  - Present summary for confirmation
172
261
 
@@ -177,10 +266,37 @@ Skip Steps 2-6 (questioning, version determination, update, cleanup, context loa
177
266
 
178
267
  ## 3. Determine Milestone Version
179
268
 
180
- - Parse last version from MILESTONES.md
181
- - If no MILESTONES.md exists (first milestone): default to v1.0 and suggest it to user
182
- - Suggest next version (v1.0 → v1.1, or v2.0 for major)
183
- - Confirm with user
269
+ Parse last version from `${product_milestones_path}` (product-level — versions are global across all projects in the product).
270
+
271
+ **Compute candidates:**
272
+ - If `${product_milestones_exists}` is false (first milestone in the product): the version is fixed at `v1.0` — skip the question below.
273
+ - Otherwise, last version is `vX.Y`:
274
+ - Minor candidate: `v[X].[Y+1]` (e.g. v1.3 → v1.4)
275
+ - Major candidate: `v[X+1].0` (e.g. v1.3 → v2.0)
276
+
277
+ **Derive recommendation from the milestone goals gathered in Step 2:**
278
+ - Recommend **major** if the goals signal a breaking change, rewrite, replacement, migration, deprecation, or removal of a major capability.
279
+ - Otherwise recommend **minor**.
280
+
281
+ Compose a one-sentence reason for the recommendation (e.g. "Adds notification features without changing existing contracts" or "Replaces legacy auth with OIDC, deprecating session-token storage").
282
+
283
+ **Confirm with the user** via AskUserQuestion:
284
+
285
+ ```
286
+ AskUserQuestion(
287
+ header: "Version",
288
+ question: "Which version for this milestone? Recommendation: v[recommended] (${recommended_kind}) — ${reason}.",
289
+ options: [
290
+ { label: "v[recommended] — ${recommended_kind} (recommended)", description: "${reason}" },
291
+ { label: "v[other] — ${other_kind}", description: "${other_kind_brief_description}" },
292
+ { label: "Custom", description: "Enter a version manually" }
293
+ ]
294
+ )
295
+ ```
296
+
297
+ If the user selects "Custom", prompt for manual entry and validate it parses as `vX.Y`.
298
+
299
+ The chosen `vX.Y` is used for PROJECT.md, STATE.md, and commit messages throughout the rest of the workflow.
184
300
 
185
301
  ## 4. Update PROJECT.md
186
302
 
@@ -201,8 +317,8 @@ Update Active requirements section and "Last updated" footer.
201
317
 
202
318
  ## 5. Update STATE.md
203
319
 
204
- **If STATE.md does not exist (first milestone):** Create it with the structure below.
205
- **If STATE.md exists:** Update the Current Position section.
320
+ **If `${state_path}` does not exist (first milestone):** Create it with the structure below.
321
+ **If it exists:** Update the Current Position section.
206
322
 
207
323
  ```markdown
208
324
  ## Current Position
@@ -217,25 +333,15 @@ Keep Accumulated Context section from previous milestone.
217
333
 
218
334
  ## 6. Cleanup and Commit
219
335
 
220
- Delete MILESTONE-CONTEXT.md if exists (consumed).
336
+ Delete `${project_root}/MILESTONE-CONTEXT.md` if exists (consumed).
221
337
 
222
338
  ```bash
223
339
  node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs commit "docs: start milestone v[X.Y] [Name]" --push --files ${project_path} ${state_path}
224
340
  ```
225
341
 
226
- ## 7. Load Context and Resolve Models
227
-
228
- ```bash
229
- INIT=$(node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs init new-milestone)
230
- ```
231
-
232
- Extract from init JSON: `researcher_model`, `synthesizer_model`, `roadmapper_model`, `commit_docs`, `research_enabled`, `current_milestone`, `project_exists`, `roadmap_exists`.
233
-
234
- Load planning-tier context files:
342
+ ## 7. Research Decision Gate
235
343
 
236
- ```bash
237
- TIER_FILES=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" context load-tier planning --raw 2>/dev/null)
238
- ```
344
+ Paths and models already resolved in Step 0.
239
345
 
240
346
  ## 8. Research Decision
241
347
 
@@ -416,7 +522,7 @@ If "adjust": Return to scoping.
416
522
 
417
523
  **Commit requirements:**
418
524
  ```bash
419
- node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs commit "docs: define milestone v[X.Y] requirements" --push --files ${project_root}/REQUIREMENTS.md
525
+ node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs commit "docs: define milestone v[X.Y] requirements" --push --files ${project_root}/REQUIREMENTS.md config.json
420
526
  ```
421
527
 
422
528
  ## 10. Create Roadmap
@@ -429,7 +535,7 @@ node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs commit "docs: define mile
429
535
  ◆ Spawning roadmapper...
430
536
  ```
431
537
 
432
- **Starting phase number:** Read MILESTONES.md for last phase number. Continue from there (v1.0 ended at phase 5v1.1 starts at phase 6). If no MILESTONES.md exists (first milestone): start phase numbering at 1.
538
+ **Starting phase number:** Read `${product_milestones_path}` for last phase number (phase numbers are global across the product — the next phase continues the sequence from the most recent milestone shipped in any project). Continue from there (e.g., v23.0 ended at phase 148v23.1 starts at phase 149). If `${product_milestones_exists}` is false (first milestone in the product): start phase numbering at 1.
433
539
 
434
540
  ```
435
541
  Task(prompt="
@@ -439,7 +545,7 @@ Task(prompt="
439
545
  - ${project_root}/REQUIREMENTS.md
440
546
  - ${project_root}/research/SUMMARY.md (if exists)
441
547
  - ${config_path}
442
- - ${project_root}/MILESTONES.md
548
+ - ${product_milestones_path}
443
549
  - ${project_root}/docs/product/ARCHITECTURE.md (Target architecture, if exists)
444
550
  - ${project_root}/docs/product/PRODUCT-SUMMARY.md (Product summary, if exists)
445
551
  </files_to_read>
@@ -579,6 +685,7 @@ Also: `/dgs:plan-phase [N]` — skip discussion, plan directly
579
685
  - [ ] Auto mode: repo cross-check completed (if v2)
580
686
  - [ ] Auto mode: one milestone per spec enforced
581
687
  - [ ] Auto mode: spec milestones field updated with link-milestone call
688
+ - [ ] Both modes: version selection presented as AskUserQuestion with minor/major candidates and a recommendation derived from spec/goals content (auto mode included — version is the one gate auto mode still surfaces)
582
689
 
583
690
  **Atomic commits:** Each phase commits its artifacts immediately.
584
691
  </success_criteria>