@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
@@ -12,14 +12,14 @@ Display the complete DGS command reference. Output ONLY the reference content. D
12
12
  ## Quick Start
13
13
 
14
14
  **Single-project (v1):**
15
- 1. `/dgs:new-project` - Create project (questioning + PROJECT.md)
15
+ 1. `/dgs:new-project [<name>]` - Create project (thin skeleton)
16
16
  2. `/dgs:new-milestone` - First milestone (research, requirements, roadmap)
17
17
  3. `/dgs:plan-phase 1` - Create detailed plan for first phase
18
18
  4. `/dgs:execute-phase 1` - Execute the phase
19
19
 
20
20
  **Multi-project / multi-repo (v2):**
21
21
  1. `/dgs:init-product` - Set up product folder and register repos
22
- 2. `/dgs:new-project` - Create a project (questioning + PROJECT.md)
22
+ 2. `/dgs:new-project [<name>]` - Create a project (thin skeleton)
23
23
  3. `/dgs:new-milestone` - First milestone (research, requirements, roadmap)
24
24
  4. `/dgs:plan-phase 1` - Plan first phase (repos tracked per task)
25
25
  5. `/dgs:execute-phase 1` - Execute (commits per-repo automatically)
@@ -73,22 +73,20 @@ Usage: `/dgs:init-product`
73
73
 
74
74
  ### Project Initialization
75
75
 
76
- **`/dgs:new-project`**
77
- Initialize new project through deep questioning. *(Tier 2: planning)*
76
+ **`/dgs:new-project [<name>]`**
77
+ Initialize a new project as a thin skeleton. *(Tier 2: planning)*
78
78
 
79
- One command takes you from idea to project identity:
80
- - Deep questioning to understand what you're building
81
- - Optional brownfield mapping for existing codebases
82
- - PROJECT.md creation with vision, requirements hypotheses, and key decisions
79
+ - Creates `projects/<slug>/PROJECT.md` with title + one-line placeholder
80
+ - Optional brownfield codebase mapping offer for existing code
81
+ - No deep questioning, no `--auto` flag
83
82
 
84
- Creates project artifacts:
85
- - `PROJECT.md` vision and requirements
83
+ Projects are holders. Vision and principles live in `docs/product/PRODUCT-SUMMARY.md`
84
+ (loaded via Tier 1). Specs live at the milestone level.
86
85
 
87
- **v2 additions:** Prompts for project name (used as folder slug), prompts for which repos this project touches (from REPOS.md). Artifacts are created under `projects/<project-slug>/`.
86
+ **Next:** `/dgs:write-spec` to capture what you're building, then
87
+ `/dgs:new-milestone --auto <spec-id>` to start the first milestone.
88
88
 
89
- After completion, run `/dgs:new-milestone` to start your first milestone.
90
-
91
- Usage: `/dgs:new-project`
89
+ Usage: `/dgs:new-project [<name>]`
92
90
 
93
91
  **`/dgs:map-codebase [<repo-name>]`**
94
92
  Map registered repos with parallel agents to produce structured codebase documentation. *(Tier 2: planning)*
@@ -384,7 +382,7 @@ Usage: `/dgs:debug` (resume active session)
384
382
  Capture idea or task as todo from current conversation. *(Tier 1: lite)*
385
383
 
386
384
  - Extracts context from conversation (or uses provided description)
387
- - Creates structured todo file in the project's todos/pending/ directory
385
+ - Creates structured todo file in the project's todos/ directory
388
386
  - Infers area from file paths for grouping
389
387
  - Checks for duplicates before creating
390
388
  - Updates STATE.md todo count
@@ -406,7 +404,7 @@ Usage: `/dgs:check-todos api`
406
404
 
407
405
  ### Ideas & Specs
408
406
 
409
- `capture ideas → develop idea → write spec → new-project --auto → new-milestone --auto`
407
+ `capture ideas → develop idea → write spec → new-project → new-milestone --auto`
410
408
 
411
409
  #### Ideas
412
410
 
@@ -468,7 +466,7 @@ Usage: `/dgs:discuss-idea` (shows picker)
468
466
  Research an idea's feasibility and technical landscape. *(Tier 2: planning)*
469
467
 
470
468
  - Five dimensions: web search, codebase analysis, landscape survey, approaches, feasibility
471
- - Creates research document at `docs/ideas/pending/{slug}-research.md` (relative to planning root)
469
+ - Creates research document at `docs/ideas/{slug}-research.md` (relative to planning root)
472
470
  - Appends Research Log to idea file (Summary, Document link, Key Finding, Recommendation)
473
471
  - Can run multiple times; each run appends a new entry
474
472
 
@@ -658,6 +656,41 @@ Create phases to close gaps identified by audit. *(Tier 2: planning)*
658
656
  Usage: `/dgs:plan-milestone-gaps`
659
657
  Usage: `/dgs:plan-milestone-gaps --auto` (non-interactive gap closure)
660
658
 
659
+ **`/dgs:diff-report [version|--quick slug] [--detailed]`**
660
+ Generate a diff report (REVIEW.md) on demand. *(Tier 4: verification)*
661
+
662
+ - Auto-detects context: active quick task or current milestone
663
+ - Explicit target: version for milestones, `--quick slug` for quick tasks
664
+ - `--detailed` flag invokes LLM-powered per-file analysis
665
+ - Delegates to existing CLI commands (`jobs generate-review` / `quick generate-review`)
666
+
667
+ Usage: `/dgs:diff-report`, `/dgs:diff-report v21.0`, `/dgs:diff-report --quick my-task --detailed`
668
+
669
+ ### Testing & Dependency Scanning
670
+
671
+ **`/dgs:package-scan [flags]`**
672
+ Scan every registered repo + product root for dependency vulnerabilities and licence issues. *(Tier 0: none — no STATE.md/ROADMAP.md auto-inject)*
673
+
674
+ - **Tool cascade:** Snyk → OSV-Scanner → ecosystem-native (`npm audit`, `pip-audit`, `govulncheck`, `bundler-audit`)
675
+ - **Ecosystems:** Node.js, Python, Go, Ruby, Java (Maven; Gradle treated as single-module, PKG-41 deferred)
676
+ - **Monorepo-aware:** npm/pnpm/Yarn workspaces, Maven multi-module, Go workspaces
677
+ - **Report placement:** active phase dir → active milestone dir → timestamped project-root file
678
+ - **Findings in canonical shape** (forward-compatible with `/dgs:plan-test-gaps`)
679
+
680
+ **Flags:**
681
+ - `--threshold critical|high|medium|low` — filter by severity
682
+ - `--repo <name>` — scan a single registered repo
683
+ - `--json` — emit machine-readable JSON alongside the markdown report
684
+ - `--include-dev-deps` / `--no-include-dev-deps` — toggle devDependencies scanning
685
+
686
+ **Config keys:** `testing.packages.tool`, `testing.packages.severity_threshold`, `testing.packages.include_dev_dependencies`, `testing.packages.timeout_seconds` (all in `config.json`). `testing.packages.snyk_token` goes to `config.local.json` only.
687
+
688
+ **Reference doc:** `~/.claude/deliver-great-systems/references/package-scan-config.md` — tool installation steps, Snyk-auth priority, report placement cascade.
689
+
690
+ Usage: `/dgs:package-scan`
691
+ Usage: `/dgs:package-scan --threshold high --repo api`
692
+ Usage: `/dgs:package-scan --json` (pipe to jq, feed CI, etc.)
693
+
661
694
  ### Milestone Jobs
662
695
 
663
696
  | Command | What it does | When to use |
@@ -866,7 +899,7 @@ Example config:
866
899
  **Starting a new project (v1):**
867
900
 
868
901
  ```
869
- /dgs:new-project # Questioning -> PROJECT.md
902
+ /dgs:new-project # Thin skeleton PROJECT.md
870
903
  /clear
871
904
  /dgs:new-milestone # Research -> requirements -> roadmap
872
905
  /clear
@@ -879,7 +912,7 @@ Example config:
879
912
 
880
913
  ```
881
914
  /dgs:init-product # One-time: register repos, create product structure
882
- /dgs:new-project # Questioning -> PROJECT.md
915
+ /dgs:new-project # Thin skeleton PROJECT.md
883
916
  /clear
884
917
  /dgs:new-milestone # Research -> requirements -> roadmap
885
918
  /clear
@@ -944,7 +977,7 @@ Example config:
944
977
  # /dgs:research-idea # Investigate feasibility
945
978
  /dgs:write-spec # Turn ideas into structured spec
946
979
  /clear
947
- /dgs:new-project --auto @spec.md # Create project from spec
980
+ /dgs:new-project <name> # Create project holder
948
981
  /clear
949
982
  /dgs:new-milestone --auto <spec-id> # First milestone from spec
950
983
  ```
@@ -201,6 +201,60 @@ This is the core AI conversion step. Restructure `SOURCE_CONTENT` into a 9-secti
201
201
  Store the full converted PRD as `CONVERTED_PRD`.
202
202
  </step>
203
203
 
204
+ <step name="run_cross_llm_review">
205
+ Run cross-LLM review on the converted PRD before presenting to the user. This matches the review pattern from write-spec.
206
+
207
+ Load the review loop reference for detailed API call mechanics:
208
+ @~/.claude/deliver-great-systems/references/spec-review-loop.md
209
+
210
+ **1. Load review config:**
211
+
212
+ ```bash
213
+ node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs review-config
214
+ ```
215
+
216
+ Parse JSON result. If `has_any_key = false`: warn "No review API keys configured. Edit review-keys.json in your planning root to add OpenAI or Gemini keys. Skipping review." and proceed directly to `present_and_review`.
217
+
218
+ **2. Initialize tracking:**
219
+
220
+ - `round = 0`
221
+ - `total_tokens = { openai: { prompt: 0, completion: 0 }, gemini: { prompt: 0, completion: 0 } }`
222
+ - `rejected_items_history = []`
223
+ - `REVIEW_HISTORY = ""`
224
+
225
+ **3. Loop** (while round < max_rounds):
226
+
227
+ a. Increment round.
228
+ b. Send `CONVERTED_PRD` to available reviewers in parallel using the API call patterns from the reference doc. Issue both curl commands via parallel Bash tool calls.
229
+ c. Handle failures per reference doc error handling rules (retry once, then mark failed).
230
+ d. Parse feedback items from each reviewer's response. Each item: section, severity, feedback text, reviewer name.
231
+ e. **Auto-reject Non-Goal contradictions:** read the `## Non-Goals` section of `CONVERTED_PRD`, reject any feedback that suggests adding something explicitly listed as a Non-Goal. Disposition: `rejected-non-goal`.
232
+ f. **Check convergence:** compare rejected items against `rejected_items_history`. If an item (or substantially similar item) was rejected in the previous round too, move the concern to `## Open Questions` tagged as "From review: [concern]". Disposition: `moved-to-open-questions`.
233
+ g. **Apply accepted feedback:** Claude reads each remaining item and decides whether to apply it by modifying `CONVERTED_PRD`. Disposition: `accepted` (with change description) or `no-action` (with reason).
234
+ h. Build round history entry with all dispositions in the review history table format.
235
+ i. Append round history to `REVIEW_HISTORY` string.
236
+ j. Update token totals from response usage metadata.
237
+ k. **Check exit conditions:**
238
+ - No changes applied (all items rejected, no-action, or moved-to-open-questions) -> EXIT
239
+ - Green-only (all reviewers responded "LGTM" or no actionable feedback) -> EXIT
240
+ - Max rounds reached -> EXIT
241
+ If none met: continue to next round.
242
+
243
+ **4. Display token/cost summary:**
244
+
245
+ ```
246
+ Review complete (N rounds).
247
+ Tokens: OpenAI [X prompt + Y completion] | Gemini [X prompt + Y completion]
248
+ Estimated cost: ~$X.XX
249
+ ```
250
+
251
+ **5. Append review history to CONVERTED_PRD:**
252
+
253
+ If `REVIEW_HISTORY` is non-empty, append it to `CONVERTED_PRD` as a `## Review History` section at the end. This ensures the review history is included when the spec is saved.
254
+
255
+ **Note:** Unlike write-spec, there is no spec file on disk yet. The review operates entirely on the in-memory `CONVERTED_PRD` string. The review history is appended to the content and persisted when the user chooses "save" in the next step.
256
+ </step>
257
+
204
258
  <step name="present_and_review">
205
259
  Present the converted PRD for user review and handle the review loop.
206
260
 
@@ -217,7 +271,7 @@ Present the converted PRD for user review and handle the review loop.
217
271
  {CONVERTED_PRD}
218
272
 
219
273
  ---
220
- Original: will be saved to ${project_root}/{attachment_path}
274
+ Original: will be saved to {attachment_path} (relative to planning root)
221
275
  {If IDEA_IDS is non-empty: "Linking to: " followed by comma-separated IDEA_DISPLAY entries, e.g., "Linking to: IDEA-1 (Phase 0 Foundation Infrastructure), IDEA-3 (Other Idea)"}
222
276
 
223
277
  **Review options:**
@@ -233,7 +287,7 @@ Original: will be saved to ${project_root}/{attachment_path}
233
287
 
234
288
  **If "save":**
235
289
  1. Generate the slug from `SPEC_TITLE` (lowercase, replace non-alphanumeric with hyphens, trim leading/trailing hyphens).
236
- 2. Check if `${project_root}/specs/spec-{slug}.md` already exists. If it does, use AskUserQuestion to prompt: `A spec with slug '{slug}' already exists. Enter a new title:` -- then regenerate the slug from the new title and re-check. Loop until no conflict.
290
+ 2. Check if `specs/spec-{slug}.md` (relative to planning root) already exists. If it does, use AskUserQuestion to prompt: `A spec with slug '{slug}' already exists. Enter a new title:` -- then regenerate the slug from the new title and re-check. Loop until no conflict.
237
291
  3. Compute the slugified source filename: take `SOURCE_FILENAME`, lowercase it, replace non-alphanumeric chars (except dots) with hyphens, trim leading/trailing hyphens, preserve file extension. This matches `docs.slugifyFilename()` behaviour.
238
292
  4. Compute the attachment path: `specs/spec-{slug}/docs/{slugified-source-filename}` (relative to the planning root).
239
293
  5. Call specs create (with --source-ideas when ideas are linked):
@@ -264,7 +318,7 @@ Original: will be saved to ${project_root}/{attachment_path}
264
318
 
265
319
  **Execute the commit:**
266
320
  ```bash
267
- node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs commit "specs: import {id} - {title} (from {original-filename})" --push --files ${project_root}/specs/spec-{slug}.md ${project_root}/{attachment_path} ${project_root}/specs/spec-{slug}/docs/INDEX.md ${project_root}/specs/spec-{slug}/docs/.names.json
321
+ node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs commit "specs: import {id} - {title} (from {original-filename})" --push --files specs/spec-{slug}.md {attachment_path} specs/spec-{slug}/docs/INDEX.md specs/spec-{slug}/docs/.names.json
268
322
  ```
269
323
  The `dgs-tools.cjs commit` helper with `--files` stages only the specified files and commits them. This ensures other unstaged/uncommitted changes in the working tree are not included. The `.names.json` file is included because `docs add` creates it as internal metadata for INDEX rebuilds.
270
324
 
@@ -283,8 +337,8 @@ Original: will be saved to ${project_root}/{attachment_path}
283
337
  ID: {id}
284
338
  Title: {SPEC_TITLE}
285
339
  Status: draft
286
- File: ${project_root}/{filename path from specs create result}
287
- Source: ${project_root}/{attachment_path}
340
+ File: {filename path from specs create result} (relative to planning root)
341
+ Source: {attachment_path} (relative to planning root)
288
342
  Committed: specs: import {id} - {title} (from {original-filename})
289
343
  {If IDEA_IDS is non-empty: "Linked ideas: IDEA-1, IDEA-3 (unchanged state)"}
290
344
 
@@ -298,8 +352,8 @@ Original: will be saved to ${project_root}/{attachment_path}
298
352
  ID: {id}
299
353
  Title: {SPEC_TITLE}
300
354
  Status: draft
301
- File: ${project_root}/{filename path from specs create result}
302
- Source: ${project_root}/{attachment_path}
355
+ File: {filename path from specs create result} (relative to planning root)
356
+ Source: {attachment_path} (relative to planning root)
303
357
  {If IDEA_IDS is non-empty: "Linked ideas: IDEA-1, IDEA-3 (unchanged state)"}
304
358
 
305
359
  Next steps:
@@ -360,6 +414,10 @@ Stop execution.
360
414
  - [ ] Requirements use explicit language signal mapping (must/critical -> P0, should/important -> P1, could/nice-to-have -> P2) with P1 default
361
415
  - [ ] Requirements preserve original identifiers if numbered in source
362
416
  - [ ] Implementation Notes reference real files and patterns when codebase context available
417
+ - [ ] Cross-LLM review runs after conversion (when review keys configured)
418
+ - [ ] Review feedback applied to CONVERTED_PRD in-memory before user presentation
419
+ - [ ] Review history appended to spec content and persisted on save
420
+ - [ ] Missing review keys skip review with warning (non-blocking)
363
421
  - [ ] Spec title is auto-generated from source content
364
422
  - [ ] Full converted PRD is displayed for review with attachment path shown
365
423
  - [ ] Linked ideas displayed in review when --ideas provided
@@ -88,51 +88,15 @@ Created:
88
88
  - .gitignore
89
89
  ```
90
90
 
91
- **b2. Configure Base Branch:**
91
+ **b2. Configure Workflow Discipline (non-interactive):**
92
92
 
93
- Prompt the user for their code repo base branch:
94
-
95
- ```
96
- AskUserQuestion([{
97
- question: "What is the base branch for your code repos? (e.g., main, develop, dev)",
98
- header: "Git Configuration",
99
- multiSelect: false,
100
- freeform: true,
101
- placeholder: ""
102
- }])
103
- ```
104
-
105
- Always ask — no auto-detection, no default pre-fill. The user types the branch name explicitly.
106
-
107
- After receiving the answer, write to config:
108
- ```bash
109
- node /Users/adrian/.claude/deliver-great-systems/bin/dgs-tools.cjs config-set git.base_branch "$USER_ANSWER"
110
- ```
111
-
112
- If the user provides an empty answer or skips, do NOT write anything — the default `main` from config-ensure-section already provides the fallback.
113
-
114
- **b3. Configure Workflow Discipline:**
93
+ Workflow discipline is always enabled by default — it adds a CLAUDE.md file that routes code changes through `/dgs:*` commands for traceability and atomic commits. Read-only operations (searching, tests, git log) stay unrestricted. Users can disable later via `/dgs:settings`.
115
94
 
116
95
  Read the CLAUDE.md template:
117
96
  ```bash
118
97
  CLAUDE_TEMPLATE=$(cat /Users/adrian/.claude/deliver-great-systems/templates/claude-md.md)
119
98
  ```
120
99
 
121
- Use AskUserQuestion:
122
- ```
123
- AskUserQuestion([{
124
- question: "Enable workflow discipline? This adds a CLAUDE.md file that routes code changes through /dgs:* commands for traceability and atomic commits. Read-only operations (searching, tests, git log) stay unrestricted.",
125
- header: "Workflow Discipline",
126
- multiSelect: false,
127
- options: [
128
- { label: "Yes (Recommended)", description: "Creates CLAUDE.md with DGS command routing rules" },
129
- { label: "No", description: "Skip — no CLAUDE.md created" }
130
- ]
131
- }])
132
- ```
133
-
134
- **If "Yes":**
135
-
136
100
  Check if `./CLAUDE.md` already exists in the project root (cwd):
137
101
 
138
102
  - **If CLAUDE.md does NOT exist:** Create `./CLAUDE.md` with DGS section delimiters wrapping the template content:
@@ -162,158 +126,72 @@ node /Users/adrian/.claude/deliver-great-systems/bin/dgs-tools.cjs config-set wo
162
126
 
163
127
  Display: `Workflow discipline enabled — CLAUDE.md added.`
164
128
 
165
- Add `CLAUDE.md` to the commit file list for the init commit that follows (the `dgs-tools.cjs commit` call at the end of the flow).
129
+ CLAUDE.md is always included in the init commit file list (b4 below).
166
130
 
167
- **If "No":**
131
+ **b3. Apply Recommended Defaults (non-interactive):**
132
+
133
+ All other recommended defaults (`model_profile=balanced`, `commit_docs=true`, `workflow.research=true`, `workflow.plan_check=true`, `workflow.verifier=true`, `git.base_branch=main`) are already applied by `repos init-product` in step 2 — they live in `config.cjs`'s hardcoded defaults and are merged with any per-user overrides from `~/.dgs/defaults.json` (saved via `/dgs:settings save-as-defaults`). The three keys below are the only ones the underlying init does not pre-populate, so they are set explicitly here:
168
134
 
169
- Set config:
170
135
  ```bash
171
- node /Users/adrian/.claude/deliver-great-systems/bin/dgs-tools.cjs config-set workflow.discipline false
136
+ node /Users/adrian/.claude/deliver-great-systems/bin/dgs-tools.cjs config-set mode yolo
137
+ node /Users/adrian/.claude/deliver-great-systems/bin/dgs-tools.cjs config-set granularity standard
138
+ node /Users/adrian/.claude/deliver-great-systems/bin/dgs-tools.cjs config-set workflow.codereview true
172
139
  ```
173
140
 
174
- Display: `Skipped.`
141
+ Commit the applied defaults:
142
+ ```bash
143
+ node /Users/adrian/.claude/deliver-great-systems/bin/dgs-tools.cjs commit "chore: apply recommended defaults" --files ${config_path}
144
+ ```
175
145
 
176
- Do NOT create or modify CLAUDE.md. Do NOT add CLAUDE.md to any commit.
146
+ **b4. Commit initialized files:**
177
147
 
178
- **b4. Configure Workflow Preferences (Round 1Core settings):**
148
+ Extract the `scaffolded_files` array from the init response (`RESULT` captured in step 2) and pass those paths to the commit step alongside the explicitly-named files. The `scaffolded_files` array is the AGENT-13 contract field it lists every path `cmdReposInitProduct` guaranteed on disk that the caller MUST commit (today the array contains the per-directory keep-files written under `specs/`, `docs/product/`, and `quick/`; future scaffold additions automatically flow through without workflow edits):
179
149
 
180
- ```
181
- AskUserQuestion([
182
- {
183
- header: "Mode",
184
- question: "How do you want to work?",
185
- multiSelect: false,
186
- options: [
187
- { label: "YOLO (Recommended)", description: "Auto-approve, just execute" },
188
- { label: "Interactive", description: "Confirm at each step" }
189
- ]
190
- },
191
- {
192
- header: "Depth",
193
- question: "How thorough should planning be?",
194
- multiSelect: false,
195
- options: [
196
- { label: "Quick", description: "Ship fast (3-5 phases, 1-3 plans each)" },
197
- { label: "Standard", description: "Balanced scope and speed (5-8 phases, 3-5 plans each)" },
198
- { label: "Comprehensive", description: "Thorough coverage (8-12 phases, 5-10 plans each)" }
199
- ]
200
- },
201
- {
202
- header: "Git Tracking",
203
- question: "Commit planning docs to git?",
204
- multiSelect: false,
205
- options: [
206
- { label: "Yes (Recommended)", description: "Planning docs tracked in version control" },
207
- { label: "No", description: "Keep planning docs local-only (add to .gitignore)" }
208
- ]
209
- },
210
- {
211
- header: "Branching",
212
- question: "Git branching strategy?",
213
- multiSelect: false,
214
- options: [
215
- { label: "None (Recommended)", description: "Commit to current branch (fine for single projects)" },
216
- { label: "Per Phase", description: "Branch per phase, review before merging" },
217
- { label: "Per Milestone", description: "Branch per project, merge all at end (for parallel projects)" }
218
- ]
219
- }
220
- ])
150
+ ```bash
151
+ # AGENT-13: consume scaffolded_files from cmdReposInitProduct (per references/workflow-conventions.md)
152
+ SCAFFOLDED=$(printf '%s' "$RESULT" | jq -r '.scaffolded_files[]?' | tr '\n' ' ')
153
+ node /Users/adrian/.claude/deliver-great-systems/bin/dgs-tools.cjs commit "docs: initialize product ${product_name}" --files REPOS.md PROJECTS.md config.json .gitignore CLAUDE.md ${SCAFFOLDED}
221
154
  ```
222
155
 
223
- **b5. Configure Workflow Preferences (Round 2Agents):**
156
+ CLAUDE.md is always included (workflow discipline is now always enabled by default see b2). The `${SCAFFOLDED}` token is unquoted intentionally so word-splitting expands the multiple paths into separate `--files` arguments.
224
157
 
225
- ```
226
- AskUserQuestion([
227
- {
228
- header: "AI Models",
229
- question: "Which AI models for planning agents?",
230
- multiSelect: false,
231
- options: [
232
- { label: "Balanced (Recommended)", description: "Sonnet for most agents — good quality/cost ratio" },
233
- { label: "Quality", description: "Opus for research/roadmap — higher cost, deeper analysis" },
234
- { label: "Budget", description: "Haiku where possible — fastest, lowest cost" }
235
- ]
236
- },
237
- {
238
- header: "Research",
239
- question: "Research before planning each phase? (adds tokens/time)",
240
- multiSelect: false,
241
- options: [
242
- { label: "Yes (Recommended)", description: "Investigate domain, find patterns, surface gotchas" },
243
- { label: "No", description: "Plan directly from requirements" }
244
- ]
245
- },
246
- {
247
- header: "Plan Check",
248
- question: "Verify plans will achieve their goals? (adds tokens/time)",
249
- multiSelect: false,
250
- options: [
251
- { label: "Yes (Recommended)", description: "Catch gaps before execution starts" },
252
- { label: "No", description: "Execute plans without verification" }
253
- ]
254
- },
255
- {
256
- header: "Verifier",
257
- question: "Verify work satisfies requirements after each phase? (adds tokens/time)",
258
- multiSelect: false,
259
- options: [
260
- { label: "Yes (Recommended)", description: "Confirm deliverables match phase goals" },
261
- { label: "No", description: "Trust execution, skip verification" }
262
- ]
263
- }
264
- ])
265
- ```
158
+ **b5. Display Defaults Summary:**
159
+
160
+ After commits land, print a summary block listing every applied setting and the recommended next step:
266
161
 
267
- **b6. Write config.json** with all values collected above:
268
-
269
- ```json
270
- {
271
- "mode": "yolo|interactive",
272
- "depth": "quick|standard|comprehensive",
273
- "parallelization": true,
274
- "commit_docs": true|false,
275
- "model_profile": "quality|balanced|budget",
276
- "workflow": {
277
- "research": true|false,
278
- "plan_check": true|false,
279
- "verifier": true|false,
280
- "nyquist_validation": true,
281
- "auto_advance": false,
282
- "discipline": true|false
283
- },
284
- "git": {
285
- "branching_strategy": "none|phase|milestone",
286
- "base_branch": "[from earlier question]",
287
- "sync_push": "prompt",
288
- "sync_pull": "prompt"
289
- }
290
- }
291
162
  ```
163
+ ───────────────────────────────────────────────────────────────
292
164
 
293
- Smart defaults (not asked): `parallelization: true`, `auto_advance: false`, `nyquist_validation: true`.
165
+ ## Defaults Applied
294
166
 
295
- **If commit_docs = No:** Add the planning root directory to `.gitignore`.
167
+ The following recommended settings were applied automatically:
296
168
 
297
- **Commit config:**
169
+ | Setting | Value |
170
+ |----------------------------|------------|
171
+ | mode | yolo |
172
+ | granularity | standard |
173
+ | commit_docs | true |
174
+ | model_profile | balanced |
175
+ | workflow.research | true |
176
+ | workflow.plan_check | true |
177
+ | workflow.verifier | true |
178
+ | workflow.codereview | true |
179
+ | workflow.discipline | true |
180
+ | git.base_branch | main |
298
181
 
299
- ```bash
300
- node /Users/adrian/.claude/deliver-great-systems/bin/dgs-tools.cjs commit "chore: add product config" --files ${config_path}
301
- ```
182
+ Change any of them with `/dgs:settings`.
302
183
 
303
- **Branch name preview:** If `branching_strategy` is not `"none"`, show:
304
- ```
305
- Branch names will look like: dgs/{project-slug}/phase-03-auth
306
- ```
184
+ ## Recommended Next Step Upload Product-Context Docs
307
185
 
308
- **b7. Commit initialized files:**
186
+ `/dgs:add-doc PRODUCT-SUMMARY.md` *what the product is, who it serves, key constraints*
187
+ `/dgs:add-doc ARCHITECTURE.md` *module boundaries, data flow, tech choices, security model*
309
188
 
310
- Use the `files_created` array from the init response to build the commit file list:
189
+ Drop the file path, or paste/attach the file when prompted. These give every downstream workflow (research, planning, review) the context to do its job.
311
190
 
312
- ```bash
313
- node /Users/adrian/.claude/deliver-great-systems/bin/dgs-tools.cjs commit "docs: initialize product ${product_name}" --files REPOS.md PROJECTS.md config.json .gitignore CLAUDE.md
191
+ Don't have these docs yet? Skip for now — you can run `/dgs:add-doc` anytime later. (A guided "answer questions to generate" path is on the roadmap.)
314
192
  ```
315
193
 
316
- Only include CLAUDE.md in the --files list if workflow discipline was enabled (user answered Yes).
194
+ The summary is informational only no commits, no config writes.
317
195
 
318
196
  **c. Route to next step:**
319
197