@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
@@ -1,186 +1,22 @@
1
1
  # PROJECT.md Template
2
2
 
3
- Template for `PROJECT.md` (in planning root) the living project context document.
4
-
5
- > **Layout-agnostic:** Workflows access PROJECT.md via `${project_path}` from init output. Works in both standard and root layouts.
3
+ Thin skeleton for `PROJECT.md` (in `${project_path}`). Projects are holders
4
+ product-level vision lives in `docs/product/PRODUCT-SUMMARY.md` (Tier 1), and
5
+ product architecture lives in `docs/product/ARCHITECTURE.md` (Tier 2).
6
6
 
7
7
  <template>
8
8
 
9
9
  ```markdown
10
10
  # [Project Name]
11
11
 
12
- ## What This Is
13
-
14
- [Current accurate description — 2-3 sentences. What does this product do and who is it for?
15
- Use the user's language and framing. Update whenever reality drifts from this description.]
16
-
17
- ## Core Value
18
-
19
- [The ONE thing that matters most. If everything else fails, this must work.
20
- One sentence that drives prioritization when tradeoffs arise.]
21
-
22
- ## Requirements
23
-
24
- ### Validated
25
-
26
- <!-- Shipped and confirmed valuable. -->
27
-
28
- (None yet — ship to validate)
29
-
30
- ### Active
31
-
32
- <!-- Current scope. Building toward these. -->
33
-
34
- - [ ] [Requirement 1]
35
- - [ ] [Requirement 2]
36
- - [ ] [Requirement 3]
37
-
38
- ### Out of Scope
39
-
40
- <!-- Explicit boundaries. Includes reasoning to prevent re-adding. -->
41
-
42
- - [Exclusion 1] — [why]
43
- - [Exclusion 2] — [why]
44
-
45
- ## Context
46
-
47
- [Background information that informs implementation:
48
- - Technical environment or ecosystem
49
- - Relevant prior work or experience
50
- - User research or feedback themes
51
- - Known issues to address]
52
-
53
- ## Constraints
54
-
55
- - **[Type]**: [What] — [Why]
56
- - **[Type]**: [What] — [Why]
57
-
58
- Common types: Tech stack, Timeline, Budget, Dependencies, Compatibility, Performance, Security
59
-
60
- ## Key Decisions
61
-
62
- <!-- Decisions that constrain future work. Add throughout project lifecycle. -->
63
-
64
- | Decision | Rationale | Outcome |
65
- |----------|-----------|---------|
66
- | [Choice] | [Why] | [✓ Good / ⚠️ Revisit / — Pending] |
67
-
68
- ---
69
- *Last updated: [date] after [trigger]*
12
+ <One-line purpose fill in to anchor this project.>
70
13
  ```
71
14
 
72
15
  </template>
73
16
 
74
- <guidelines>
75
-
76
- **What This Is:**
77
- - Current accurate description of the product
78
- - 2-3 sentences capturing what it does and who it's for
79
- - Use the user's words and framing
80
- - Update when the product evolves beyond this description
81
-
82
- **Core Value:**
83
- - The single most important thing
84
- - Everything else can fail; this cannot
85
- - Drives prioritization when tradeoffs arise
86
- - Rarely changes; if it does, it's a significant pivot
87
-
88
- **Requirements — Validated:**
89
- - Requirements that shipped and proved valuable
90
- - Format: `- ✓ [Requirement] — [version/phase]`
91
- - These are locked — changing them requires explicit discussion
92
-
93
- **Requirements — Active:**
94
- - Current scope being built toward
95
- - These are hypotheses until shipped and validated
96
- - Move to Validated when shipped, Out of Scope if invalidated
97
-
98
- **Requirements — Out of Scope:**
99
- - Explicit boundaries on what we're not building
100
- - Always include reasoning (prevents re-adding later)
101
- - Includes: considered and rejected, deferred to future, explicitly excluded
102
-
103
- **Context:**
104
- - Background that informs implementation decisions
105
- - Technical environment, prior work, user feedback
106
- - Known issues or technical debt to address
107
- - Update as new context emerges
108
-
109
- **Constraints:**
110
- - Hard limits on implementation choices
111
- - Tech stack, timeline, budget, compatibility, dependencies
112
- - Include the "why" — constraints without rationale get questioned
113
-
114
- **Key Decisions:**
115
- - Significant choices that affect future work
116
- - Add decisions as they're made throughout the project
117
- - Track outcome when known:
118
- - ✓ Good — decision proved correct
119
- - ⚠️ Revisit — decision may need reconsideration
120
- - — Pending — too early to evaluate
121
-
122
- **Last Updated:**
123
- - Always note when and why the document was updated
124
- - Format: `after Phase 2` or `after v1.0 milestone`
125
- - Triggers review of whether content is still accurate
126
-
127
- </guidelines>
128
-
129
- <evolution>
130
-
131
- PROJECT.md evolves throughout the project lifecycle.
132
-
133
- **After each phase transition:**
134
- 1. Requirements invalidated? → Move to Out of Scope with reason
135
- 2. Requirements validated? → Move to Validated with phase reference
136
- 3. New requirements emerged? → Add to Active
137
- 4. Decisions to log? → Add to Key Decisions
138
- 5. "What This Is" still accurate? → Update if drifted
139
-
140
- **After each milestone:**
141
- 1. Full review of all sections
142
- 2. Core Value check — still the right priority?
143
- 3. Audit Out of Scope — reasons still valid?
144
- 4. Update Context with current state (users, feedback, metrics)
145
-
146
- </evolution>
147
-
148
- <brownfield>
149
-
150
- For existing codebases:
151
-
152
- 1. **Map codebase first** via `/dgs:map-codebase`
153
-
154
- 2. **Infer Validated requirements** from existing code:
155
- - What does the codebase actually do?
156
- - What patterns are established?
157
- - What's clearly working and relied upon?
158
-
159
- 3. **Gather Active requirements** from user:
160
- - Present inferred current state
161
- - Ask what they want to build next
162
-
163
- 4. **Initialize:**
164
- - Validated = inferred from existing code
165
- - Active = user's goals for this work
166
- - Out of Scope = boundaries user specifies
167
- - Context = includes current codebase state
168
-
169
- </brownfield>
170
-
171
17
  <state_reference>
172
18
 
173
- STATE.md references PROJECT.md:
174
-
175
- ```markdown
176
- ## Project Reference
177
-
178
- See: PROJECT.md (updated [date])
179
-
180
- **Core value:** [One-liner from Core Value section]
181
- **Current focus:** [Current phase name]
182
- ```
183
-
184
- This ensures Claude reads current PROJECT.md context.
19
+ STATE.md references PROJECT.md by path; the thin skeleton still satisfies
20
+ `dgs-tools health` Check 2 (file exists + top-level heading).
185
21
 
186
22
  </state_reference>
@@ -40,7 +40,9 @@ patterns-established:
40
40
  - "Pattern 1: description"
41
41
  - "Pattern 2: description"
42
42
 
43
- requirements-completed: [] # REQUIRED — Copy ALL requirement IDs from this plan's `requirements` frontmatter field.
43
+ requirements_completed: [] # MANDATORY — Copy ALL requirement IDs from this plan's `requirements` frontmatter field VERBATIM. Empty array allowed only when PLAN's `requirements:` is also empty. Pre-commit precondition (REL-08) aborts the executor with `summary-frontmatter-mismatch` if non-empty PLAN paired with empty `requirements_completed`.
44
+ # Canonical key: `requirements_completed` (underscore — pinned by Phase 157 / 157-Q2-FINDINGS.md).
45
+ # The legacy hyphen variant is still readable by `cmdSummaryExtract` for backwards-compat with archived v23.1 SUMMARYs (REL-10 dual-read), but MUST NOT be used for new SUMMARYs.
44
46
 
45
47
  # Metrics
46
48
  duration: Xmin
@@ -0,0 +1,89 @@
1
+ <purpose>
2
+ Abandon the active product-level quick task: remove worktree and branch without merging. All committed and uncommitted changes in the worktree are discarded.
3
+
4
+ Requires explicit confirmation before proceeding. This is destructive and cannot be undone.
5
+ </purpose>
6
+
7
+ <context_tier>none</context_tier>
8
+
9
+ <process>
10
+
11
+ **Step 1: Validate active quick**
12
+
13
+ Check for active product-level quick:
14
+ ```bash
15
+ ACTIVE=$(node -e "
16
+ const q = require('$HOME/.claude/deliver-great-systems/bin/lib/quick.cjs');
17
+ const a = q.getActiveQuick(process.cwd());
18
+ process.stdout.write(JSON.stringify(a || { none: true }));
19
+ ")
20
+ ```
21
+
22
+ Parse result. If `none` is true:
23
+ ```
24
+ ╔══════════════════════════════════════════════════════════════╗
25
+ ║ ERROR ║
26
+ ╚══════════════════════════════════════════════════════════════╝
27
+
28
+ No active product-level quick to abandon.
29
+
30
+ If working in a milestone context, changes are part of the milestone.
31
+ ```
32
+ End workflow.
33
+
34
+ Extract `$SLUG` from result.
35
+
36
+ **Step 2: Confirm abandonment**
37
+
38
+ ```
39
+ AskUserQuestion(
40
+ header: "Abandon Quick",
41
+ question: "Abandon quick '${SLUG}'? All uncommitted and committed changes will be lost.",
42
+ options: [
43
+ { label: "Yes, abandon", description: "Remove worktree and branch — changes are lost" },
44
+ { label: "No, keep", description: "Cancel — quick remains active" }
45
+ ]
46
+ )
47
+ ```
48
+
49
+ If "No, keep": Display `Quick '${SLUG}' remains active.` End workflow.
50
+
51
+ **Step 3: Execute abandonment**
52
+
53
+ ```
54
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
55
+ DGS ► ABANDONING QUICK
56
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
57
+
58
+ ◆ Removing worktree and branch...
59
+ ```
60
+
61
+ ```bash
62
+ RESULT=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" abandon-quick --confirmed 2>&1)
63
+ EXIT_CODE=$?
64
+ ```
65
+
66
+ **Step 4: Display result**
67
+
68
+ **If exit code is 0 (success):**
69
+ ```
70
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
71
+ DGS ► QUICK ABANDONED ✓
72
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
73
+
74
+ Quick '${SLUG}' abandoned. Worktree removed.
75
+ No changes merged to main.
76
+ ```
77
+
78
+ **If error:**
79
+ Display the error message from RESULT.
80
+
81
+ </process>
82
+
83
+ <success_criteria>
84
+ - [ ] Active product-level quick validated
85
+ - [ ] Confirmation required before abandonment
86
+ - [ ] Worktree and branch removed without merging
87
+ - [ ] active_context cleared
88
+ - [ ] No commits from quick branch appear on base_branch
89
+ </success_criteria>
@@ -33,7 +33,7 @@ Use `TIER_FILES` JSON `files` array for project context (PROJECT.md, STATE.md, c
33
33
 
34
34
  <step name="ensure_directories">
35
35
  ```bash
36
- mkdir -p ${project_root}/ideas/pending ${project_root}/ideas/done ${project_root}/ideas/rejected
36
+ mkdir -p ${project_root}/ideas
37
37
  ```
38
38
  </step>
39
39
 
@@ -72,7 +72,7 @@ Parse the JSON result to get `id`, `filename`, `path`.
72
72
 
73
73
  <step name="git_commit">
74
74
  ```bash
75
- node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs commit "ideas: add #${id} - ${title}" --push --files ${project_root}/ideas/pending/${filename} ${project_root}/ideas/manifest.json
75
+ node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs commit "ideas: add #${id} - ${title}" --push --files ${project_root}/ideas/${filename} ${project_root}/ideas/manifest.json
76
76
  ```
77
77
  </step>
78
78
 
@@ -89,7 +89,7 @@ Nothing else -- no file path, no tags display, no next steps.
89
89
  </process>
90
90
 
91
91
  <success_criteria>
92
- - [ ] Idea file exists in `ideas/pending/` with correct frontmatter
92
+ - [ ] Idea file exists in `ideas/` with correct frontmatter
93
93
  - [ ] Manifest updated with incremented next_id
94
94
  - [ ] Git commit created
95
95
  - [ ] Minimal confirmation displayed
@@ -76,6 +76,11 @@ Update STATE.md to reflect the new phase:
76
76
  ```
77
77
 
78
78
  If "Roadmap Evolution" section doesn't exist, create it.
79
+
80
+ 3. Commit both ROADMAP.md and STATE.md:
81
+ ```bash
82
+ node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" commit "docs: add phase {N} to roadmap" --push --files ${roadmap_path} ${state_path}
83
+ ```
79
84
  </step>
80
85
 
81
86
  <step name="completion">
@@ -66,6 +66,20 @@ This command works on completed phases. Run /dgs:execute-phase first.
66
66
  ```
67
67
  Exit.
68
68
 
69
+ **Worktree-aware code directory resolution (resolveCodeContext):**
70
+
71
+ For each registered code repo, resolve the correct working directory. When a milestone or quick worktree is active, test generation must target the worktree directory, not the main checkout, so generated test files land in the correct location.
72
+
73
+ ```javascript
74
+ // In the agent's execution context, use resolveCodeContext to determine the code directory:
75
+ const { resolveCodeContext } = require('./bin/lib/context.cjs');
76
+ const ctx = resolveCodeContext(planningRoot, repoName);
77
+ // ctx.type: 'main' | 'milestone' | 'quick'
78
+ // ctx.directory: absolute path to the correct working directory
79
+ ```
80
+
81
+ Use `ctx.directory` for all file operations within code repos.
82
+
69
83
  Present banner:
70
84
  ```
71
85
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -95,6 +95,7 @@ Write to `${pending_dir}/${date}-${slug}.md`:
95
95
 
96
96
  ```markdown
97
97
  ---
98
+ status: pending
98
99
  created: [timestamp]
99
100
  title: [title]
100
101
  area: [area]
@@ -143,16 +143,36 @@ Perform the approval state transition and audit trail update.
143
143
  node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs specs set-status --id "$SPEC_SLUG" --status final
144
144
  ```
145
145
 
146
- 2. Run `add-log-entry` to record the approval in the Refinement Log:
146
+ 2. Mark source ideas as done (if any):
147
+ Read the spec file to extract `source_ideas` from frontmatter (array of idea filenames).
148
+ If `source_ideas` exists and is non-empty:
149
+ ```bash
150
+ # For each source idea in the array:
151
+ for IDEA_FILE in ${SOURCE_IDEAS[@]}; do
152
+ node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs ideas set-status --id "$IDEA_FILE" --status done 2>/dev/null || true
153
+ done
154
+ ```
155
+ The `|| true` ensures silent skip if an idea is already done, consolidated, or not found (idempotent).
156
+ Track the idea file paths for inclusion in the commit.
157
+
158
+ 3. Run `add-log-entry` to record the approval in the Refinement Log:
147
159
  ```bash
148
160
  node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs specs add-log-entry --id "$SPEC_SLUG" --date "$(date +%Y-%m-%d)" --version "$VERSION" --action Approved --summary "Spec approved after completeness validation"
149
161
  ```
150
162
 
151
- 3. Determine the spec filename from the validate output or Read step.
163
+ 4. Determine the spec filename from the validate output or Read step.
152
164
 
153
- 4. Commit the changes:
165
+ 5. Commit the changes (include modified idea files):
154
166
  ```bash
155
- node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs commit "specs: approve $SPEC_ID v$VERSION" --push --files "$SPEC_FILE_PATH"
167
+ # Build files list: spec + any modified idea files
168
+ COMMIT_FILES="$SPEC_FILE_PATH"
169
+ if [ -n "$SOURCE_IDEAS" ]; then
170
+ for IDEA_FILE in ${SOURCE_IDEAS[@]}; do
171
+ IDEA_PATH=$(node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs ideas find --id "$IDEA_FILE" --raw 2>/dev/null | jq -r '.path // empty')
172
+ [ -n "$IDEA_PATH" ] && COMMIT_FILES="$COMMIT_FILES ${project_root}/${IDEA_PATH}"
173
+ done
174
+ fi
175
+ node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs commit "specs: approve $SPEC_ID v$VERSION" --push --files $COMMIT_FILES
156
176
  ```
157
177
  </step>
158
178
 
@@ -180,5 +200,6 @@ Next steps:
180
200
  - [ ] Validation errors block approval with clear messages
181
201
  - [ ] Validation warnings allow user confirmation before proceeding
182
202
  - [ ] Blocking open questions are detected and treated as errors
203
+ - [ ] Source ideas marked as done when spec has source_ideas in frontmatter
183
204
  - [ ] Changes committed to git
184
205
  </success_criteria>
@@ -45,6 +45,19 @@ node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" phases list
45
45
  - Extract milestone definition of done from ROADMAP.md
46
46
  - Extract requirements mapped to this milestone from REQUIREMENTS.md
47
47
 
48
+ ### Parse `--strict-audit` flag (REL-10)
49
+
50
+ ```bash
51
+ STRICT_AUDIT=$(echo "$ARGUMENTS" | grep -oE -- '--strict-audit' | head -1)
52
+ if [ -n "$STRICT_AUDIT" ]; then
53
+ STRICT_AUDIT=true
54
+ else
55
+ STRICT_AUDIT=false
56
+ fi
57
+ ```
58
+
59
+ When `STRICT_AUDIT=true`, the cross-reference matrix in Section 5d preserves the OLD strict behaviour: empty `requirements_completed` → `partial` regardless of VERIFICATION state. When `STRICT_AUDIT=false` (default), Section 5d applies the soft-tolerance via `bin/lib/audit-tolerance.cjs::applyMatrix` and logs the `summary-frontmatter-empty-but-verified` warning under a separate channel (`soft_warnings`) — distinct from real partials.
60
+
48
61
  ## 2. Read All Phase Verifications
49
62
 
50
63
  For each phase directory, read the VERIFICATION.md:
@@ -143,21 +156,30 @@ done
143
156
 
144
157
  ### 5d. Status Determination Matrix
145
158
 
146
- For each REQ-ID, determine status using all three sources:
159
+ For each REQ-ID, determine status using all three sources, routed through `bin/lib/audit-tolerance.cjs::applyMatrix(input)` (REL-10):
160
+
161
+ | VERIFICATION.md Status | SUMMARY Frontmatter | requirements_claimed in VERIFICATION | --strict-audit | → Final Status |
162
+ |------------------------|---------------------|--------------------------------------|----------------|----------------|
163
+ | passed | listed | any | any | **satisfied** |
164
+ | passed | empty | lists ID | false (default) | **satisfied** + soft-warning `summary-frontmatter-empty-but-verified` |
165
+ | passed | empty | lists ID | true | **partial** (preserves old strict behaviour; opt-in via `--strict-audit`) |
166
+ | passed | empty | does NOT list ID | any | **partial** (real partial — tolerance must NOT mask this) |
167
+ | gaps_found | any | any | any | **unsatisfied** |
168
+ | missing | listed | any | any | **partial** (verification gap) |
169
+ | missing | missing | any | any | **unsatisfied** |
170
+
171
+ **Soft-warning channel:** Entries with status `satisfied` AND `softWarning: 'summary-frontmatter-empty-but-verified'` are collected in a SEPARATE list under `soft_warnings.summary_frontmatter_empty_but_verified` in the audit JSON output. They are NOT included under `gaps.requirements` — that channel is reserved for real `unsatisfied` and real `partial`. The soft-warning channel is shown as an info-level note in the markdown report.
147
172
 
148
- | VERIFICATION.md Status | SUMMARY Frontmatter | REQUIREMENTS.md | Final Status |
149
- |------------------------|---------------------|-----------------|----------------|
150
- | passed | listed | `[x]` | **satisfied** |
151
- | passed | listed | `[ ]` | **satisfied** (update checkbox) |
152
- | passed | missing | any | **partial** (verify manually) |
153
- | gaps_found | any | any | **unsatisfied** |
154
- | missing | listed | any | **partial** (verification gap) |
155
- | missing | missing | any | **unsatisfied** |
173
+ **Implementation:** Section 5d invokes `applyMatrix({ verificationStatus, requirementsClaimed, summaryRequirementsCompleted, reqId, strictAudit })` for each REQ-ID. The output `{ status, softWarning }` populates the per-requirement row.
174
+
175
+ **Removal trigger (REL-10 band-aid):** When 3 consecutive milestones ship with zero `summary-frontmatter-empty-but-verified` warnings, this row should be removed from the matrix and the strict behaviour restored as default.
156
176
 
157
177
  ### 5e. FAIL Gate and Orphan Detection
158
178
 
159
179
  **REQUIRED:** Any `unsatisfied` requirement MUST force `gaps_found` status on the milestone audit.
160
180
 
181
+ **Soft-warning entries (`softWarning: 'summary-frontmatter-empty-but-verified'`) MUST NOT force `gaps_found`** — they are `satisfied` with a recoverable provenance gap. They surface in `soft_warnings.summary_frontmatter_empty_but_verified` and in the markdown info-level notes only.
182
+
161
183
  **Orphan detection:** Requirements present in REQUIREMENTS.md traceability table but absent from ALL phase VERIFICATION.md files MUST be flagged as orphaned. Orphaned requirements are treated as `unsatisfied` — they were assigned but never verified by any phase.
162
184
 
163
185
  ## 5.5. Nyquist Compliance Discovery
@@ -207,6 +229,11 @@ gaps: # Critical blockers
207
229
  completed_by_plans: ["{plan files whose SUMMARY marks it complete}"]
208
230
  verification_status: "passed | gaps_found | missing | orphaned"
209
231
  evidence: "{specific evidence or lack thereof}"
232
+ soft_warnings: # REL-10: recoverable provenance issues — NOT blockers
233
+ summary_frontmatter_empty_but_verified:
234
+ - id: "{REQ-ID}"
235
+ phase: "{phase}"
236
+ reason: "VERIFICATION.md status: passed and requirements_claimed lists ID; SUMMARY.md requirements_completed is empty"
210
237
  integration: [...]
211
238
  flows: [...]
212
239
  tech_debt: # Non-critical, deferred
@@ -227,7 +254,35 @@ Plus full markdown report with tables for requirements, phases, integration, tec
227
254
  - `gaps_found` — critical blockers exist
228
255
  - `tech_debt` — no blockers but accumulated deferred items need review
229
256
 
230
- ## 7. Present Results
257
+ ## 7. Generate REVIEW.md
258
+
259
+ After audit scoring completes, generate the milestone review report so it is available before reviewers run complete-milestone.
260
+
261
+ ```bash
262
+ # Generate REVIEW.md using the CLI command — always regenerates even if prior version exists
263
+ REVIEW_RESULT=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" jobs generate-review "${milestone_version}" --raw 2>&1)
264
+ REVIEW_EXIT=$?
265
+ ```
266
+
267
+ **If generation succeeds** (`REVIEW_EXIT` is 0):
268
+
269
+ Parse the JSON output to get the file path:
270
+ ```bash
271
+ REVIEW_PATH=$(echo "$REVIEW_RESULT" | node -e "const d=require('fs').readFileSync('/dev/stdin','utf-8');try{const j=JSON.parse(d);console.log(j.relativePath||'')}catch{console.log('')}")
272
+ ```
273
+
274
+ Display: `Review report: ${REVIEW_PATH}`
275
+
276
+ **If generation fails** (`REVIEW_EXIT` is non-zero):
277
+
278
+ Log warning and continue — do NOT block the audit:
279
+ ```
280
+ Warning: Review generation failed: ${REVIEW_RESULT}
281
+ ```
282
+
283
+ The audit report is complete regardless of review generation status. The review report is supplementary context for four-eyes reviewers.
284
+
285
+ ## 8. Present Results
231
286
 
232
287
  Route by status (see `<offer_next>`).
233
288
 
@@ -360,5 +415,6 @@ All requirements met. No critical blockers. Accumulated tech debt needs review.
360
415
  - [ ] FAIL gate enforced — any unsatisfied requirement forces gaps_found status
361
416
  - [ ] Nyquist compliance scanned for all milestone phases (if enabled)
362
417
  - [ ] Missing VALIDATION.md phases flagged with validate-phase suggestion
418
+ - [ ] REVIEW.md generated as final step (or warning logged on failure)
363
419
  - [ ] Results presented with actionable next steps
364
420
  </success_criteria>
@@ -51,15 +51,25 @@ REPOS_MD=$(node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs repos list --r
51
51
 
52
52
  Parse JSON for the list of registered repos with paths.
53
53
 
54
- **Resolve test execution directory (v2 only):**
54
+ **Resolve test execution directory with resolveCodeContext (v2 only):**
55
55
 
56
56
  If `dgs_mode` is `v2` and repos were detected from REPOS_MD:
57
57
 
58
58
  1. Parse REPOS_MD JSON for the list of repos (each has `name` and `path`)
59
- 2. If exactly 1 repo registered: use its `path` as `TEST_CWD`
60
- 3. If multiple repos: check PLAN.md files in the phase for `<repos>` tags. Use the first repo name found, look up its path from REPOS_MD. If no `<repos>` tag found, use the first registered repo's path.
61
- 4. Resolve `TEST_CWD` to an absolute path: if the repo path is relative (starts with `../`), resolve it relative to `process.cwd()` / the current working directory.
62
- 5. Set `CWD_FLAG` to `--cwd "${TEST_CWD}"` if TEST_CWD was determined, otherwise set to empty string.
59
+ 2. Determine the target repo name:
60
+ - If exactly 1 repo registered: use its name
61
+ - If multiple repos: check PLAN.md files in the phase for `<repos>` tags. Use the first repo name found. If no `<repos>` tag found, use the first registered repo's name.
62
+ 3. **Resolve code context (worktree-aware):** Use resolveCodeContext to determine the correct working directory. When a milestone or quick worktree is active, the audit must examine code in the worktree directory, not the main checkout.
63
+ ```javascript
64
+ const { resolveCodeContext } = require('./bin/lib/context.cjs');
65
+ const ctx = resolveCodeContext(planningRoot, repoName);
66
+ // ctx.type: 'main' | 'milestone' | 'quick'
67
+ // ctx.directory: absolute path to the correct working directory
68
+ ```
69
+ Use `ctx.directory` as `TEST_CWD`.
70
+ 4. If resolveCodeContext returns main type, fall back to resolving the repo path from REPOS_MD as before.
71
+ 5. Resolve `TEST_CWD` to an absolute path: if the repo path is relative (starts with `../`), resolve it relative to `process.cwd()` / the current working directory.
72
+ 6. Set `CWD_FLAG` to `--cwd "${TEST_CWD}"` if TEST_CWD was determined, otherwise set to empty string.
63
73
 
64
74
  If `dgs_mode` is NOT `v2` or no repos detected: set `CWD_FLAG` to empty string (single-repo, no override needed).
65
75
 
@@ -46,7 +46,7 @@ Parse the JSON result. The response contains:
46
46
  "cancelled": true,
47
47
  "version": "v6.0",
48
48
  "steps_reset": 2,
49
- "path": "jobs/pending/milestone-v6.0.md"
49
+ "path": "jobs/milestone-v6.0.md"
50
50
  }
51
51
  ```
52
52
 
@@ -65,7 +65,7 @@ Display the result based on the response:
65
65
 
66
66
  **If `cancelled: true`:**
67
67
  ```
68
- Job {version} cancelled. {steps_reset} in-progress step(s) reset. Job moved to pending/ -- re-run with /dgs:run-job {version}
68
+ Job {version} cancelled. {steps_reset} in-progress step(s) reset. Job status set to pending -- re-run with /dgs:run-job {version}
69
69
  ```
70
70
 
71
71
  **If `reason: 'not_found'`:**
@@ -130,7 +130,7 @@ Use AskUserQuestion:
130
130
  <step name="execute_action">
131
131
  **Work on it now:**
132
132
  ```bash
133
- mv "${pending_dir}/[filename]" "${project_root}/todos/done/"
133
+ node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" todos set-status --id "[filename]" --status done
134
134
  ```
135
135
  Update STATE.md todo count. Present problem/solution context. Begin work or ask how to proceed.
136
136
 
@@ -158,8 +158,7 @@ Re-run `init todos` to get updated count, then update STATE.md "### Pending Todo
158
158
  If todo was moved to done/, commit the change:
159
159
 
160
160
  ```bash
161
- git rm --cached ${pending_dir}/[filename] 2>/dev/null || true
162
- node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" commit "docs: start work on todo - [title]" --files ${project_root}/todos/done/[filename] ${state_path}
161
+ node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" commit "docs: start work on todo - [title]" --files ${project_root}/todos/[filename] ${state_path}
163
162
  ```
164
163
 
165
164
  Tool respects `commit_docs` config and gitignore automatically.