@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,83 @@
1
+ <purpose>
2
+ Switch the model profile used by DGS agents. Controls which Claude model each agent uses, balancing quality vs token spend.
3
+ </purpose>
4
+
5
+ <context_tier>none</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="validate">
14
+ Validate argument:
15
+
16
+ ```
17
+ if $ARGUMENTS.profile not in ["quality", "balanced", "budget"]:
18
+ Error: Invalid profile "$ARGUMENTS.profile"
19
+ Valid profiles: quality, balanced, budget
20
+ EXIT
21
+ ```
22
+ </step>
23
+
24
+ <step name="ensure_and_load_config">
25
+ Ensure config exists and load current state:
26
+
27
+ ```bash
28
+ node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" config-ensure-section
29
+ INIT=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" state load)
30
+ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
31
+ ```
32
+
33
+ This creates `dgs.config.json` with defaults if missing and loads current config.
34
+ </step>
35
+
36
+ <step name="update_config">
37
+ Read current config from state load or directly:
38
+
39
+ Update `model_profile` field:
40
+ ```json
41
+ {
42
+ "model_profile": "$ARGUMENTS.profile"
43
+ }
44
+ ```
45
+
46
+ Write updated config back to `dgs.config.json`.
47
+ </step>
48
+
49
+ <step name="confirm">
50
+ Display confirmation with model table for selected profile:
51
+
52
+ ```
53
+ ✓ Model profile set to: $ARGUMENTS.profile
54
+
55
+ Agents will now use:
56
+
57
+ [Show table from MODEL_PROFILES in dgs-tools.cjs for selected profile]
58
+
59
+ Example:
60
+ | Agent | Model |
61
+ |-------|-------|
62
+ | dgs-planner | opus |
63
+ | dgs-executor | sonnet |
64
+ | dgs-verifier | haiku |
65
+ | ... | ... |
66
+
67
+ Next spawned agents will use the new profile.
68
+ ```
69
+
70
+ Map profile names:
71
+ - quality: use "quality" column from MODEL_PROFILES
72
+ - balanced: use "balanced" column from MODEL_PROFILES
73
+ - budget: use "budget" column from MODEL_PROFILES
74
+ </step>
75
+
76
+ </process>
77
+
78
+ <success_criteria>
79
+ - [ ] Argument validated
80
+ - [ ] Config file ensured
81
+ - [ ] Config updated with new model_profile
82
+ - [ ] Confirmation displayed with model table
83
+ </success_criteria>
@@ -0,0 +1,470 @@
1
+ <purpose>
2
+ Interactive configuration of DGS workflow agents (research, plan_check, verifier) and model profile selection via multi-question prompt. Updates ${config_path} with user preferences. Optionally saves settings as global defaults (~/.dgs/defaults.json) for future projects.
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="initialize" priority="first">
14
+ Load planning context:
15
+
16
+ ```bash
17
+ INIT=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" init progress)
18
+ TIER_FILES=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" context load-tier lite --raw 2>/dev/null)
19
+ ```
20
+
21
+ Extract: `project_root`, `config_path` as needed by the workflow.
22
+ Use `TIER_FILES` JSON `files` array for project context (PROJECT.md, STATE.md, config.json).
23
+ </step>
24
+
25
+ <step name="ensure_and_load_config">
26
+ Ensure config exists and load current state:
27
+
28
+ ```bash
29
+ node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" config-ensure-section
30
+ INIT=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" state load)
31
+ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
32
+ ```
33
+
34
+ Creates `${config_path}` with defaults if missing and loads current config values.
35
+ </step>
36
+
37
+ <step name="read_current">
38
+ ```bash
39
+ cat ${config_path}
40
+ ```
41
+
42
+ Parse current values (default to `true` if not present):
43
+ - `workflow.research` — spawn researcher during plan-phase
44
+ - `workflow.plan_check` — spawn plan checker during plan-phase
45
+ - `workflow.verifier` — spawn verifier during execute-phase
46
+ - `workflow.nyquist_validation` — validation architecture research during plan-phase (default: true if absent)
47
+ - `workflow.codereview` — spawn code reviewer after plan execution (default: false if absent)
48
+ - `model_profile` — which model each agent uses (default: `balanced`)
49
+ - `git.branching_strategy` — branching approach (default: `"none"`)
50
+ - `git.base_branch` — integration target branch for code repos (default: `"main"`)
51
+ - `workflow.discipline` — whether CLAUDE.md workflow routing is active (default: true if absent)
52
+
53
+ Also detect whether `./CLAUDE.md` exists and contains a DGS section:
54
+ ```bash
55
+ CLAUDE_MD_EXISTS=$(test -f ./CLAUDE.md && echo "true" || echo "false")
56
+ CLAUDE_MD_HAS_DGS=$(grep -l 'DGS:BEGIN' ./CLAUDE.md 2>/dev/null && echo "true" || echo "false")
57
+ ```
58
+ </step>
59
+
60
+ <step name="detect_old_templates">
61
+ After loading current config, check if the branch templates use old defaults without `{project}`:
62
+
63
+ ```bash
64
+ CURRENT_PHASE_TPL=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" config-get git.phase_branch_template --raw 2>/dev/null)
65
+ CURRENT_MILESTONE_TPL=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" config-get git.milestone_branch_template --raw 2>/dev/null)
66
+ ```
67
+
68
+ If either template is set AND does not contain `{project}`, and `branching_strategy` is not `"none"`, show migration hint before the settings questions:
69
+
70
+ ```
71
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
72
+ DGS ► BRANCH TEMPLATE UPDATE AVAILABLE
73
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
74
+
75
+ Your branch templates don't include the project name, which can cause
76
+ collisions in multi-project setups.
77
+
78
+ Current: {current_phase_tpl}
79
+ Suggested: dgs/{project}/phase-{phase}-{slug}
80
+
81
+ Current: {current_milestone_tpl}
82
+ Suggested: dgs/{project}/{milestone}-{slug}
83
+ ```
84
+
85
+ Use AskUserQuestion:
86
+ ```
87
+ AskUserQuestion([{
88
+ question: "Update branch templates to include project name?",
89
+ header: "Templates",
90
+ multiSelect: false,
91
+ options: [
92
+ { label: "Yes (Recommended)", description: "Updates templates to include {project} for multi-project safety" },
93
+ { label: "No", description: "Keep current templates" }
94
+ ]
95
+ }])
96
+ ```
97
+
98
+ If "Yes": write updated templates to config.json using config-set:
99
+ ```bash
100
+ node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" config-set git.phase_branch_template "dgs/{project}/phase-{phase}-{slug}"
101
+ node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" config-set git.milestone_branch_template "dgs/{project}/{milestone}-{slug}"
102
+ ```
103
+
104
+ Show confirmation:
105
+ ```
106
+ Updated branch templates to include {project}.
107
+ Branch names will now look like: dgs/your-project/phase-03-auth
108
+
109
+ Note: Existing branches using the old format will NOT be renamed.
110
+ Only new branches will use the updated format.
111
+ ```
112
+
113
+ If templates already contain `{project}` or branching_strategy is "none": skip this step silently.
114
+ </step>
115
+
116
+ <step name="present_settings">
117
+ Use AskUserQuestion with current values pre-selected:
118
+
119
+ ```
120
+ AskUserQuestion([
121
+ {
122
+ question: "Which model profile for agents?",
123
+ header: "Model",
124
+ multiSelect: false,
125
+ options: [
126
+ { label: "Quality", description: "Opus everywhere except verification (highest cost)" },
127
+ { label: "Balanced (Recommended)", description: "Opus for planning, Sonnet for execution/verification" },
128
+ { label: "Budget", description: "Sonnet for writing, Haiku for research/verification (lowest cost)" }
129
+ ]
130
+ },
131
+ {
132
+ question: "Spawn Plan Researcher? (researches domain before planning)",
133
+ header: "Research",
134
+ multiSelect: false,
135
+ options: [
136
+ { label: "Yes", description: "Research phase goals before planning" },
137
+ { label: "No", description: "Skip research, plan directly" }
138
+ ]
139
+ },
140
+ {
141
+ question: "Spawn Plan Checker? (verifies plans before execution)",
142
+ header: "Plan Check",
143
+ multiSelect: false,
144
+ options: [
145
+ { label: "Yes", description: "Verify plans meet phase goals" },
146
+ { label: "No", description: "Skip plan verification" }
147
+ ]
148
+ },
149
+ {
150
+ question: "Spawn Execution Verifier? (verifies phase completion)",
151
+ header: "Verifier",
152
+ multiSelect: false,
153
+ options: [
154
+ { label: "Yes", description: "Verify must-haves after execution" },
155
+ { label: "No", description: "Skip post-execution verification" }
156
+ ]
157
+ },
158
+ {
159
+ question: "Auto-advance pipeline? (discuss → plan → execute automatically)",
160
+ header: "Auto",
161
+ multiSelect: false,
162
+ options: [
163
+ { label: "No (Recommended)", description: "Manual /clear + paste between stages" },
164
+ { label: "Yes", description: "Chain stages via Task() subagents (same isolation)" }
165
+ ]
166
+ },
167
+ {
168
+ question: "Enable Nyquist Validation? (researches test coverage during planning)",
169
+ header: "Nyquist",
170
+ multiSelect: false,
171
+ options: [
172
+ { label: "Yes (Recommended)", description: "Research automated test coverage during plan-phase. Adds validation requirements to plans. Blocks approval if tasks lack automated verify." },
173
+ { label: "No", description: "Skip validation research. Good for rapid prototyping or no-test phases." }
174
+ ]
175
+ },
176
+ {
177
+ question: "Spawn Code Reviewer? (multi-agent code review after plan execution)",
178
+ header: "Code Review",
179
+ multiSelect: false,
180
+ options: [
181
+ { label: "No (Default)", description: "Skip code review after plan execution" },
182
+ { label: "Yes", description: "Run 3-pass, 9-agent code review after each plan commits. Auto-fixes low-risk issues." }
183
+ ]
184
+ },
185
+ {
186
+ question: "Git branching strategy?",
187
+ header: "Branching",
188
+ multiSelect: false,
189
+ options: [
190
+ { label: "None (Recommended)", description: "Commit to current branch (fine for single projects)" },
191
+ { label: "Per Phase", description: "Branch per phase, review before merging" },
192
+ { label: "Per Milestone", description: "Branch per project, merge all at end (for parallel projects)" }
193
+ ]
194
+ },
195
+ {
196
+ question: "Base branch for code repos? (integration target for branching operations)",
197
+ header: "Git",
198
+ multiSelect: false,
199
+ freeform: true,
200
+ placeholder: currentConfig.base_branch || "main"
201
+ }
202
+ ])
203
+ ```
204
+ </step>
205
+
206
+ <step name="present_discipline_settings">
207
+ Read the current discipline state:
208
+
209
+ ```bash
210
+ DISCIPLINE_STATE=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" config-get workflow.discipline --raw 2>/dev/null || echo "true")
211
+ ```
212
+
213
+ Determine current state display:
214
+ - If `DISCIPLINE_STATE` is `"true"`: current is "On"
215
+ - If `DISCIPLINE_STATE` is `"false"`: current is "Off"
216
+ - Default (key missing): treat as "On" (matches init-product default)
217
+
218
+ Also check CLAUDE.md file state:
219
+ ```bash
220
+ CLAUDE_MD_EXISTS=$(test -f ./CLAUDE.md && echo "true" || echo "false")
221
+ ```
222
+
223
+ Display current state inline before prompting:
224
+ ```
225
+ Workflow Discipline: {On/Off} {(CLAUDE.md present) or (CLAUDE.md not found)}
226
+ ```
227
+
228
+ Use AskUserQuestion:
229
+ ```
230
+ AskUserQuestion([{
231
+ question: "Workflow discipline routes code changes through /dgs:* commands via CLAUDE.md. Currently: {On/Off}.",
232
+ header: "Workflow Discipline",
233
+ multiSelect: false,
234
+ options: [
235
+ { label: "On", description: "CLAUDE.md with DGS command routing rules (creates if missing)" },
236
+ { label: "Off", description: "Remove DGS routing rules from CLAUDE.md" }
237
+ ]
238
+ }])
239
+ ```
240
+
241
+ Pre-select the option matching current state.
242
+
243
+ **If user selects "On" (toggle on or keep on):**
244
+
245
+ Read the template:
246
+ ```bash
247
+ CLAUDE_TEMPLATE=$(cat ~/.claude/deliver-great-systems/templates/claude-md.md)
248
+ ```
249
+
250
+ Check if `./CLAUDE.md` exists:
251
+
252
+ - **If CLAUDE.md does NOT exist:** Create `./CLAUDE.md` with DGS section delimiters:
253
+
254
+ ```
255
+ <!-- DGS:BEGIN — managed by deliver-great-systems, do not edit this section manually -->
256
+ {CLAUDE_TEMPLATE content}
257
+ <!-- DGS:END -->
258
+ ```
259
+
260
+ - **If CLAUDE.md exists but has NO DGS section** (no `<!-- DGS:BEGIN` found): Append DGS section to end:
261
+
262
+ ```
263
+ {existing content}
264
+
265
+ <!-- DGS:BEGIN — managed by deliver-great-systems, do not edit this section manually -->
266
+ {CLAUDE_TEMPLATE content}
267
+ <!-- DGS:END -->
268
+ ```
269
+
270
+ - **If CLAUDE.md exists AND has DGS section** (`<!-- DGS:BEGIN` found): Replace everything from `<!-- DGS:BEGIN` line through `<!-- DGS:END -->` line (inclusive) with the latest template version. Preserve all content before and after the DGS section.
271
+
272
+ Set config:
273
+ ```bash
274
+ node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" config-set workflow.discipline true
275
+ ```
276
+
277
+ Display: `Workflow discipline: On`
278
+
279
+ **If user selects "Off" (toggle off):**
280
+
281
+ Check current state -- if already off, just confirm and skip:
282
+ ```
283
+ Workflow discipline is already off.
284
+ ```
285
+
286
+ If currently on, show consequences and confirm:
287
+
288
+ ```
289
+ AskUserQuestion([{
290
+ question: "Turning off workflow discipline means Claude will no longer be routed through /dgs:* commands for code changes. The DGS section will be removed from CLAUDE.md (any content you wrote outside the DGS section will be preserved). Continue?",
291
+ header: "Confirm",
292
+ multiSelect: false,
293
+ options: [
294
+ { label: "Yes, turn off", description: "Remove DGS routing rules from CLAUDE.md" },
295
+ { label: "Cancel", description: "Keep workflow discipline on" }
296
+ ]
297
+ }])
298
+ ```
299
+
300
+ **If "Yes, turn off":**
301
+
302
+ Check `./CLAUDE.md`:
303
+
304
+ - **If CLAUDE.md exists with DGS section:** Read file content. Remove everything from the `<!-- DGS:BEGIN` line through the `<!-- DGS:END -->` line (inclusive). Trim any resulting double-blank-lines down to single blank lines. If the remaining content (after trimming whitespace) is empty, delete the entire CLAUDE.md file. Otherwise write the cleaned content back.
305
+
306
+ - **If CLAUDE.md exists without DGS section:** Leave it unchanged (nothing to remove).
307
+
308
+ - **If CLAUDE.md does not exist:** Nothing to do.
309
+
310
+ Set config:
311
+ ```bash
312
+ node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" config-set workflow.discipline false
313
+ ```
314
+
315
+ Display: `Workflow discipline: Off`
316
+
317
+ **If "Cancel":**
318
+
319
+ Display: `Kept workflow discipline on.`
320
+ Do not change config or CLAUDE.md.
321
+ </step>
322
+
323
+ <step name="present_review_settings">
324
+ Load current review configuration:
325
+
326
+ ```bash
327
+ REVIEW=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" review-config --raw)
328
+ ```
329
+
330
+ Parse the JSON to get `reviewers.openai.api_key`, `reviewers.openai.model`, `reviewers.gemini.api_key`, `reviewers.gemini.model`, and `max_rounds`.
331
+
332
+ Display review key status (DO NOT prompt for keys -- users edit review-keys.json directly):
333
+
334
+ ```
335
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
336
+ Review Configuration (read-only)
337
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
338
+
339
+ | Setting | Status |
340
+ |-------------------|---------------|
341
+ | OpenAI API Key | {set/not set} |
342
+ | OpenAI Model | {model} |
343
+ | Gemini API Key | {set/not set} |
344
+ | Gemini Model | {model} |
345
+ | Max Rounds | {N} |
346
+
347
+ To configure review keys, edit: review-keys.json (in your planning root)
348
+ ```
349
+
350
+ Do NOT use AskUserQuestion for any review settings.
351
+ </step>
352
+
353
+ <step name="update_config">
354
+ Merge new settings into existing config:
355
+
356
+ ```json
357
+ {
358
+ ...existing_config,
359
+ "model_profile": "quality" | "balanced" | "budget",
360
+ "workflow": {
361
+ "research": true/false,
362
+ "plan_check": true/false,
363
+ "verifier": true/false,
364
+ "auto_advance": true/false,
365
+ "nyquist_validation": true/false,
366
+ "codereview": true/false,
367
+ "discipline": true/false
368
+ },
369
+ "git": {
370
+ "branching_strategy": "none" | "phase" | "milestone",
371
+ "base_branch": "main" | user_answer
372
+ }
373
+ }
374
+ ```
375
+
376
+ Write updated config to `${config_path}`. Review keys are NOT stored in config -- they live in review-keys.json (edited directly by the user).
377
+ </step>
378
+
379
+ <step name="save_as_defaults">
380
+ Ask whether to save these settings as global defaults for future projects:
381
+
382
+ ```
383
+ AskUserQuestion([
384
+ {
385
+ question: "Save these as default settings for all new projects?",
386
+ header: "Defaults",
387
+ multiSelect: false,
388
+ options: [
389
+ { label: "Yes", description: "New projects start with these settings (saved to ~/.dgs/defaults.json)" },
390
+ { label: "No", description: "Only apply to this project" }
391
+ ]
392
+ }
393
+ ])
394
+ ```
395
+
396
+ If "Yes": write the same config object (minus project-specific fields like `brave_search`) to `~/.dgs/defaults.json`:
397
+
398
+ ```bash
399
+ mkdir -p ~/.dgs
400
+ ```
401
+
402
+ Write `~/.dgs/defaults.json` with:
403
+ ```json
404
+ {
405
+ "mode": <current>,
406
+ "granularity": <current>,
407
+ "model_profile": <current>,
408
+ "commit_docs": <current>,
409
+ "parallelization": <current>,
410
+ "branching_strategy": <current>,
411
+ "workflow": {
412
+ "research": <current>,
413
+ "plan_check": <current>,
414
+ "verifier": <current>,
415
+ "auto_advance": <current>,
416
+ "nyquist_validation": <current>,
417
+ "codereview": <current>,
418
+ "discipline": <current>
419
+ }
420
+ }
421
+ ```
422
+ </step>
423
+
424
+ <step name="confirm">
425
+ Display:
426
+
427
+ ```
428
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
429
+ DGS ► SETTINGS UPDATED
430
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
431
+
432
+ | Setting | Value |
433
+ |----------------------|-------|
434
+ | Model Profile | {quality/balanced/budget} |
435
+ | Plan Researcher | {On/Off} |
436
+ | Plan Checker | {On/Off} |
437
+ | Execution Verifier | {On/Off} |
438
+ | Auto-Advance | {On/Off} |
439
+ | Nyquist Validation | {On/Off} |
440
+ | Code Reviewer | {On/Off} |
441
+ | Git Branching | {None/Per Phase/Per Milestone} |
442
+ | Base Branch | {main/develop/etc.} |
443
+ | Workflow Discipline | {On/Off} |
444
+ | OpenAI Key | {set/not set} (edit review-keys.json) |
445
+ | Gemini Key | {set/not set} (edit review-keys.json) |
446
+ | Saved as Defaults | {Yes/No} |
447
+
448
+ These settings apply to future /dgs:plan-phase and /dgs:execute-phase runs.
449
+
450
+ Quick commands:
451
+ - /dgs:set-profile <profile> — switch model profile
452
+ - /dgs:plan-phase --research — force research
453
+ - /dgs:plan-phase --skip-research — skip research
454
+ - /dgs:plan-phase --skip-verify — skip plan check
455
+ ```
456
+ </step>
457
+
458
+ </process>
459
+
460
+ <success_criteria>
461
+ - [ ] Current config read
462
+ - [ ] User presented with 9 workflow settings (profile + 6 workflow toggles + git branching + base branch)
463
+ - [ ] User shown review key status (read-only)
464
+ - [ ] Config updated with model_profile, workflow, and git sections
465
+ - [ ] User offered to save as global defaults (~/.dgs/defaults.json)
466
+ - [ ] Changes confirmed to user
467
+ - [ ] User shown workflow discipline toggle with current state
468
+ - [ ] Toggle on creates/updates CLAUDE.md with DGS section delimiters
469
+ - [ ] Toggle off removes DGS section with confirmation, preserving user content
470
+ </success_criteria>