@ktpartners/dgs-platform 2.8.0 → 3.0.4

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 (94) hide show
  1. package/CHANGELOG.md +96 -0
  2. package/README.md +41 -13
  3. package/agents/dgs-plan-checker.md +29 -3
  4. package/agents/dgs-planner.md +10 -0
  5. package/commands/dgs/abandon-quick.md +28 -0
  6. package/commands/dgs/add-tests.md +2 -2
  7. package/commands/dgs/audit-milestone.md +2 -2
  8. package/commands/dgs/capture-principle.md +11 -11
  9. package/commands/dgs/cleanup.md +2 -2
  10. package/commands/dgs/complete-milestone.md +11 -11
  11. package/commands/dgs/complete-quick.md +28 -0
  12. package/commands/dgs/create-milestone-job.md +2 -2
  13. package/commands/dgs/debug.md +3 -3
  14. package/commands/dgs/develop-idea.md +1 -1
  15. package/commands/dgs/fast.md +3 -1
  16. package/commands/dgs/health.md +1 -1
  17. package/commands/dgs/map-codebase.md +6 -6
  18. package/commands/dgs/new-milestone.md +5 -5
  19. package/commands/dgs/new-project.md +6 -6
  20. package/commands/dgs/plan-milestone-gaps.md +1 -1
  21. package/commands/dgs/progress.md +3 -3
  22. package/commands/dgs/quick-abandon.md +8 -0
  23. package/commands/dgs/quick-complete.md +8 -0
  24. package/commands/dgs/quick.md +10 -3
  25. package/commands/dgs/research-idea.md +2 -2
  26. package/commands/dgs/research-phase.md +3 -3
  27. package/commands/dgs/switch-project.md +1 -1
  28. package/commands/dgs/write-spec.md +3 -3
  29. package/deliver-great-systems/bin/dgs-tools.cjs +284 -30
  30. package/deliver-great-systems/bin/lib/commands.cjs +316 -31
  31. package/deliver-great-systems/bin/lib/commands.test.cjs +336 -0
  32. package/deliver-great-systems/bin/lib/config.cjs +39 -6
  33. package/deliver-great-systems/bin/lib/context.cjs +120 -0
  34. package/deliver-great-systems/bin/lib/core.cjs +28 -11
  35. package/deliver-great-systems/bin/lib/execution.cjs +49 -17
  36. package/deliver-great-systems/bin/lib/flat-migration.test.cjs +396 -0
  37. package/deliver-great-systems/bin/lib/ideas.cjs +206 -91
  38. package/deliver-great-systems/bin/lib/ideas.test.cjs +244 -1
  39. package/deliver-great-systems/bin/lib/init.cjs +306 -39
  40. package/deliver-great-systems/bin/lib/init.test.cjs +416 -6
  41. package/deliver-great-systems/bin/lib/jobs.cjs +124 -21
  42. package/deliver-great-systems/bin/lib/jobs.test.cjs +193 -74
  43. package/deliver-great-systems/bin/lib/migration.cjs +409 -1
  44. package/deliver-great-systems/bin/lib/migration.test.cjs +158 -1
  45. package/deliver-great-systems/bin/lib/milestone.cjs +54 -29
  46. package/deliver-great-systems/bin/lib/phase.cjs +128 -2
  47. package/deliver-great-systems/bin/lib/phase.test.cjs +420 -0
  48. package/deliver-great-systems/bin/lib/projects.cjs +28 -8
  49. package/deliver-great-systems/bin/lib/projects.test.cjs +86 -0
  50. package/deliver-great-systems/bin/lib/quick.cjs +584 -0
  51. package/deliver-great-systems/bin/lib/quick.test.cjs +596 -0
  52. package/deliver-great-systems/bin/lib/repos.cjs +25 -1
  53. package/deliver-great-systems/bin/lib/roadmap.cjs +34 -13
  54. package/deliver-great-systems/bin/lib/specs.cjs +3 -81
  55. package/deliver-great-systems/bin/lib/state-transition-gate.test.cjs +160 -0
  56. package/deliver-great-systems/bin/lib/state.cjs +142 -54
  57. package/deliver-great-systems/bin/lib/sync.cjs +75 -0
  58. package/deliver-great-systems/bin/lib/verify.cjs +80 -1
  59. package/deliver-great-systems/bin/lib/worktrees.cjs +764 -0
  60. package/deliver-great-systems/bin/lib/worktrees.test.cjs +887 -0
  61. package/deliver-great-systems/templates/claude-md.md +16 -0
  62. package/deliver-great-systems/workflows/abandon-quick.md +89 -0
  63. package/deliver-great-systems/workflows/add-idea.md +3 -3
  64. package/deliver-great-systems/workflows/add-tests.md +14 -0
  65. package/deliver-great-systems/workflows/add-todo.md +1 -0
  66. package/deliver-great-systems/workflows/approve-spec.md +25 -4
  67. package/deliver-great-systems/workflows/audit-phase.md +15 -5
  68. package/deliver-great-systems/workflows/cancel-job.md +1 -1
  69. package/deliver-great-systems/workflows/check-todos.md +2 -3
  70. package/deliver-great-systems/workflows/complete-milestone.md +197 -22
  71. package/deliver-great-systems/workflows/complete-quick.md +68 -0
  72. package/deliver-great-systems/workflows/consolidate-ideas.md +1 -1
  73. package/deliver-great-systems/workflows/create-milestone-job.md +4 -4
  74. package/deliver-great-systems/workflows/develop-idea.md +11 -11
  75. package/deliver-great-systems/workflows/diagnose-issues.md +14 -0
  76. package/deliver-great-systems/workflows/discuss-idea.md +1 -1
  77. package/deliver-great-systems/workflows/execute-phase.md +121 -32
  78. package/deliver-great-systems/workflows/execute-plan.md +12 -21
  79. package/deliver-great-systems/workflows/help.md +33 -29
  80. package/deliver-great-systems/workflows/init-product.md +2 -18
  81. package/deliver-great-systems/workflows/new-milestone.md +40 -24
  82. package/deliver-great-systems/workflows/new-project.md +22 -680
  83. package/deliver-great-systems/workflows/progress-all.md +133 -0
  84. package/deliver-great-systems/workflows/quick-abandon.md +89 -0
  85. package/deliver-great-systems/workflows/quick-complete.md +68 -0
  86. package/deliver-great-systems/workflows/quick.md +152 -23
  87. package/deliver-great-systems/workflows/refine-spec.md +1 -1
  88. package/deliver-great-systems/workflows/research-idea.md +8 -8
  89. package/deliver-great-systems/workflows/resume-project.md +2 -2
  90. package/deliver-great-systems/workflows/run-job.md +8 -8
  91. package/deliver-great-systems/workflows/validate-phase.md +39 -1
  92. package/deliver-great-systems/workflows/verify-work.md +14 -0
  93. package/deliver-great-systems/workflows/write-spec.md +2 -2
  94. package/package.json +1 -1
@@ -0,0 +1,133 @@
1
+ <purpose>
2
+ Render a product-level dashboard spanning all active projects. Read-only summary — no routing or next-action recommendations. To act on a specific project, switch to it first.
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="init_context">
14
+ Load product dashboard context:
15
+
16
+ ```bash
17
+ INIT=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" init progress-all --raw)
18
+ ```
19
+
20
+ Parse the JSON. Extract: `product`, `projects`, `warnings`, `planner_model`, `executor_model`, `sync_push`, `sync_pull`, `needs_pull`, `dgs_mode`, `author`, `planning_root`.
21
+
22
+ If `projects` is empty AND `product.completed_count` is 0:
23
+ Show: "No projects found. Run /dgs:new-project to start one." and exit.
24
+ </step>
25
+
26
+ <step name="render_product_header">
27
+ Render:
28
+
29
+ ```
30
+ # {product.product_name OR "Product Dashboard"}
31
+
32
+ **Active projects:** {product.active_count} | **Completed:** {product.completed_count}
33
+ **Mode:** {dgs_mode} | **Planning root:** {planning_root}
34
+ ```
35
+ </step>
36
+
37
+ <step name="render_active_projects">
38
+ If `projects` is non-empty, render a table:
39
+
40
+ ```
41
+ ## Active Projects
42
+
43
+ | Project | Progress | Current Phase | Milestone | Repos Touched |
44
+ |---------|----------|---------------|-----------|---------------|
45
+ | {name} | {progress}% | {current_phase} | {milestone_version} {milestone_name} | {repos_touched} |
46
+ ```
47
+
48
+ Build a simple progress bar inline if desired (e.g., `[####------] 40%`).
49
+ Skip fields that are null/empty with em-dash ("—").
50
+
51
+ If `projects` is empty, show: "_No active projects._"
52
+ </step>
53
+
54
+ <step name="render_product_backlog">
55
+ ```
56
+ ## Product Backlog
57
+
58
+ - **Todos:** {product.backlog.todos} pending
59
+ - **Ideas:** {product.backlog.ideas} pending
60
+ - **Specs:** {product.backlog.specs} open
61
+ - **Active debug sessions:** {product.backlog.debug_active}
62
+ ```
63
+
64
+ Omit any line with count = 0 to reduce noise, but always show the header.
65
+ </step>
66
+
67
+ <step name="render_recent_quick_tasks">
68
+ If `product.quick_tasks_recent.length > 0`:
69
+
70
+ ```
71
+ ## Recent Quick Tasks (product-level)
72
+
73
+ | # | Description | Date | Commit | Status |
74
+ |---|-------------|------|--------|--------|
75
+ | {id} | {description} | {date} | {commit} | {status} |
76
+ ```
77
+
78
+ Show up to 5 most recent. If empty, show: "_No product-level quick tasks yet._"
79
+ </step>
80
+
81
+ <step name="render_recent_shipments">
82
+ If `product.shipped_milestones_recent.length > 0`:
83
+
84
+ ```
85
+ ## Recent Shipments
86
+
87
+ - **{version}** {name} — shipped {shipped_date}
88
+ ```
89
+
90
+ Show up to 5. If empty, OMIT the entire section (don't show the header).
91
+ </step>
92
+
93
+ <step name="render_per_project_cards">
94
+ For each project in `projects`:
95
+
96
+ ```
97
+ ---
98
+
99
+ ### {name}
100
+
101
+ **Progress:** [{bar}] {progress}%
102
+ **Status:** {status}
103
+ **Current Phase:** {current_phase}
104
+ **Milestone:** {milestone_version} {milestone_name}
105
+ **Repos:** {repos_touched}
106
+ ```
107
+
108
+ Skip the per-project card section entirely if `projects.length <= 3` (the table above is already enough). Otherwise render cards.
109
+ </step>
110
+
111
+ <step name="footer_note">
112
+ Render:
113
+
114
+ ```
115
+ ---
116
+
117
+ _Dashboard is read-only. To act on a project, run `/dgs:switch-project <name>` then `/dgs:progress`._
118
+
119
+ _To see single-project detail now, run `/dgs:progress` (without --all)._
120
+ ```
121
+ </step>
122
+
123
+ </process>
124
+
125
+ <success_criteria>
126
+ - [ ] Product header rendered with counts
127
+ - [ ] Active projects table rendered (or empty-state message)
128
+ - [ ] Backlog counts shown
129
+ - [ ] Recent quick tasks rendered or explicit empty message
130
+ - [ ] Recent shipments rendered (omitted if none)
131
+ - [ ] No routing or next-action recommendations (dashboard is read-only)
132
+ - [ ] Footer note explains how to drill down
133
+ </success_criteria>
@@ -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" quick-abandon --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>
@@ -0,0 +1,68 @@
1
+ <purpose>
2
+ Complete the active product-level quick task: rebase onto base_branch, fast-forward merge, push to remote, and clean up the worktree. Uses the shared rebaseAndMerge() flow from worktrees.cjs.
3
+
4
+ This workflow is only valid for product-level quicks. If the user is working in a milestone context, displays a clear error directing them to complete-milestone instead.
5
+ </purpose>
6
+
7
+ <context_tier>none</context_tier>
8
+
9
+ <process>
10
+
11
+ **Step 1: Validate and execute quick-complete**
12
+
13
+ Call the quick-complete CLI command which validates the active quick and executes the full flow:
14
+
15
+ ```bash
16
+ RESULT=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" quick-complete 2>&1)
17
+ EXIT_CODE=$?
18
+ ```
19
+
20
+ **If exit code is non-zero** (error):
21
+
22
+ Check if error contains "No active product-level quick":
23
+ ```
24
+ ╔══════════════════════════════════════════════════════════════╗
25
+ ║ ERROR ║
26
+ ╚══════════════════════════════════════════════════════════════╝
27
+
28
+ No active product-level quick to complete.
29
+
30
+ If working in a milestone context, changes merge with the milestone.
31
+ Use: /dgs:complete-milestone
32
+
33
+ If you abandoned the quick, the worktree was already removed.
34
+ ```
35
+ End workflow.
36
+
37
+ For other errors (including rebase conflicts), display the error message.
38
+ If the error contains manual resolution instructions, display them verbatim, then:
39
+ ```
40
+ After resolving conflicts manually, re-run:
41
+
42
+ /dgs:quick-complete
43
+ ```
44
+ End workflow.
45
+
46
+ **Step 2: Display success**
47
+
48
+ Parse JSON result from RESULT.
49
+
50
+ ```
51
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
52
+ DGS ► QUICK COMPLETE ✓
53
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
54
+
55
+ Quick '${slug}' merged to main (${commits} commits).
56
+ Worktree cleaned up. Pushed to origin.
57
+ ```
58
+
59
+ </process>
60
+
61
+ <success_criteria>
62
+ - [ ] Active product-level quick validated
63
+ - [ ] Rebase-before-merge flow executed via rebaseAndMerge()
64
+ - [ ] Worktree and branch cleaned up
65
+ - [ ] active_context cleared
66
+ - [ ] Success message includes commit count
67
+ - [ ] Conflict case shows manual resolution instructions
68
+ </success_criteria>
@@ -26,6 +26,8 @@ Parse `$ARGUMENTS` for:
26
26
  - `--dry-run` flag → store as `$DRY_RUN` (true/false)
27
27
  - `--full` flag → store as `$FULL_MODE` (true/false)
28
28
  - `--discuss` flag → store as `$DISCUSS_MODE` (true/false)
29
+ - `--main` flag → store as `$FORCE_MAIN` (true/false)
30
+ - `--debug` flag → store as `$DEBUG_MODE` (true/false)
29
31
  - Remaining text (after stripping all flags) → use as `$DESCRIPTION` if non-empty
30
32
 
31
33
  If `$DESCRIPTION` is empty after parsing, prompt user interactively:
@@ -82,6 +84,108 @@ If `$FULL_MODE` only:
82
84
 
83
85
  ---
84
86
 
87
+ **Step 1.5: Detect quick mode and handle worktree lifecycle**
88
+
89
+ This step runs for BOTH fast and non-fast paths. For `$FAST_MODE`, it performs mode detection ONLY (no worktree creation) so the fast path can route commits correctly based on the active context.
90
+
91
+ Determine the effective mode flag:
92
+ - If `$DEBUG_MODE`: set `$QUICK_MODE_FLAG = 'debug'`
93
+ - If `$FULL_MODE`: set `$QUICK_MODE_FLAG = 'full'`
94
+ - Otherwise: set `$QUICK_MODE_FLAG = null`
95
+
96
+ Detect whether this is a product-level or milestone-context quick:
97
+
98
+ ```bash
99
+ QUICK_DETECT=$(node -e "
100
+ const q = require('$HOME/.claude/deliver-great-systems/bin/lib/quick.cjs');
101
+ const r = q.detectQuickMode(process.cwd(), ${FORCE_MAIN:-false});
102
+ process.stdout.write(JSON.stringify(r));
103
+ ")
104
+ ```
105
+
106
+ Parse `QUICK_DETECT` for `mode` field.
107
+
108
+ **If mode is 'product':**
109
+
110
+ **If NOT `$FAST_MODE`:**
111
+
112
+ Check the one-active-quick guard and create worktree:
113
+
114
+ ```bash
115
+ QUICK_START=$(node -e "
116
+ const q = require('$HOME/.claude/deliver-great-systems/bin/lib/quick.cjs');
117
+ const r = q.startProductQuick(process.cwd(), '${DESCRIPTION}', ${QUICK_MODE_FLAG ? \"'\" + QUICK_MODE_FLAG + \"'\" : 'null'});
118
+ process.stdout.write(JSON.stringify(r));
119
+ ")
120
+ ```
121
+
122
+ Parse `QUICK_START` result.
123
+
124
+ If `success` is false (guard triggered or creation failed):
125
+ ```
126
+ ╔══════════════════════════════════════════════════════════════╗
127
+ ║ ERROR ║
128
+ ╚══════════════════════════════════════════════════════════════╝
129
+
130
+ ${error message from QUICK_START}
131
+ ```
132
+ End workflow.
133
+
134
+ If `success` is true:
135
+ Set `$QUICK_CONTEXT = 'product'`
136
+ Set `$QUICK_SLUG` from result `slug`
137
+ Set `$QUICK_REPOS` from result `repos` (object mapping repoName -> worktreePath, may be empty `{}`)
138
+ Display: `Product-level quick created: ${QUICK_SLUG}`
139
+
140
+ **If `$FAST_MODE`:**
141
+
142
+ Skip worktree creation entirely. Fast in product mode commits directly to `base_branch` in the main checkout.
143
+
144
+ Set `$QUICK_CONTEXT = 'product'`
145
+ Set `$QUICK_REPO_CWD = null` (unset — git ops run in planning-root cwd)
146
+ Display: `Fast: product-level (no milestone) — committing to base_branch in main checkout.`
147
+
148
+ **If mode is 'milestone-context':**
149
+
150
+ Set `$QUICK_CONTEXT = 'milestone-context'`
151
+ Set `$MILESTONE_SLUG` from `activeMilestone` in detect result
152
+
153
+ **If `$FAST_MODE`:** Resolve the milestone worktree directory for the active repo so fast commits land on the milestone branch:
154
+
155
+ ```bash
156
+ QUICK_REPO_CWD=$(node -e "
157
+ const fs = require('fs');
158
+ const path = require('path');
159
+ const localPath = path.join(process.cwd(), 'config.local.json');
160
+ const local = JSON.parse(fs.readFileSync(localPath, 'utf-8'));
161
+ const { loadConfig } = require('$HOME/.claude/deliver-great-systems/bin/lib/core.cjs');
162
+ const cfg = loadConfig(process.cwd());
163
+ const proj = cfg.current_project;
164
+ const wt = (local.projects && local.projects[proj] && local.projects[proj].worktrees && local.projects[proj].worktrees['${MILESTONE_SLUG}']) || {};
165
+ const repos = Object.entries(wt.repos || {});
166
+ if (repos.length === 0) process.exit(1);
167
+ // Multi-repo: prefer the worktree with pending edits. Single-repo: the
168
+ // only entry. Fall back to the first entry if no diffs are detected.
169
+ const { execSync } = require('child_process');
170
+ let pick = repos[0][1];
171
+ for (const [name, dir] of repos) {
172
+ try {
173
+ const diff = execSync('git -C \"' + dir + '\" diff --stat', { encoding: 'utf-8' }).trim();
174
+ if (diff.length > 0) { pick = dir; break; }
175
+ } catch {}
176
+ }
177
+ process.stdout.write(pick);
178
+ ")
179
+ ```
180
+
181
+ Display: `Fast: milestone-context (${MILESTONE_SLUG}) — committing to milestone branch in worktree ${QUICK_REPO_CWD}.`
182
+
183
+ **If NOT `$FAST_MODE`:** Leave `$QUICK_REPO_CWD` unset. Display: `Working in milestone context (${MILESTONE_SLUG}). Changes will be part of the milestone.`
184
+
185
+ No worktree creation. No guard check. Continue to Step 2.
186
+
187
+ ---
188
+
85
189
  **Step 2: Initialize**
86
190
 
87
191
  ```bash
@@ -140,10 +244,12 @@ Then continue from Step 3 as normal quick mode (skip the rest of the fast path).
140
244
 
141
245
  Read the relevant file(s) based on `$DESCRIPTION`, make the requested changes directly using Read/Edit/Write tools. No planner, no executor — the orchestrator acts as the implementer.
142
246
 
247
+ If `$QUICK_CONTEXT` is `'milestone-context'`, relevant files live under `$QUICK_REPO_CWD` (the milestone worktree). Prefix Read/Edit/Write absolute paths with that directory — the main-checkout paths will be on `base_branch` and miss in-progress milestone work.
248
+
143
249
  If `$DRY_RUN`:
144
250
  After making edits but BEFORE committing, show the diff:
145
251
  ```bash
146
- git diff
252
+ git -C "${QUICK_REPO_CWD:-.}" diff
147
253
  ```
148
254
  Then ask:
149
255
  ```
@@ -158,7 +264,7 @@ If `$DRY_RUN`:
158
264
  ```
159
265
  If user chooses "No, discard":
160
266
  ```bash
161
- git checkout -- .
267
+ git -C "${QUICK_REPO_CWD:-.}" checkout -- .
162
268
  ```
163
269
  Display: "Changes discarded."
164
270
  Skip to completion output with message: "Dry run complete — no changes applied."
@@ -166,9 +272,9 @@ If `$DRY_RUN`:
166
272
 
167
273
  **F3. Post-edit scope check**
168
274
 
169
- After edits are made, check actual scope:
275
+ After edits are made, check actual scope (run in the worktree when milestone-context):
170
276
  ```bash
171
- git diff --stat
277
+ git -C "${QUICK_REPO_CWD:-.}" diff --stat
172
278
  ```
173
279
 
174
280
  Parse the output to count:
@@ -207,13 +313,19 @@ Commit message is NOT shown to user before committing — just commit silently.
207
313
 
208
314
  **F5. Commit**
209
315
 
316
+ When `$QUICK_REPO_CWD` is set (milestone-context), route git operations through the worktree via `--repo-cwd`. Config (commit_docs, sync_push, current_project, worktree map) is still loaded from the planning-root cwd.
317
+
210
318
  ```bash
211
- node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" commit "${commit_message}" --push
319
+ if [ -n "$QUICK_REPO_CWD" ]; then
320
+ node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" commit "${commit_message}" --push --repo-cwd "$QUICK_REPO_CWD"
321
+ else
322
+ node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" commit "${commit_message}" --push
323
+ fi
212
324
  ```
213
325
 
214
- Get the short hash:
326
+ Get the short hash (from the same directory the commit landed in):
215
327
  ```bash
216
- git rev-parse --short HEAD
328
+ git -C "${QUICK_REPO_CWD:-.}" rev-parse --short HEAD
217
329
  ```
218
330
 
219
331
  Store as `$COMMIT_HASH`.
@@ -260,17 +372,26 @@ If archival occurred (result contains `"archived": true`), `quick/HISTORY.md` wa
260
372
 
261
373
  **F6c. Commit tracking (fast path only)**
262
374
 
263
- Commit STATE.md and HISTORY.md together so archival data is persisted:
375
+ Commit STATE.md and HISTORY.md together so archival data is persisted. Uses `dgs-tools quick finalize --fast` — a single CLI call that stages both files (HISTORY.md optional) and commits with message `docs(quick-${quick_id}): track fast task`.
264
376
 
265
377
  ```bash
266
- FILE_LIST="${state_path}"
267
- if [ -f "${project_root}/quick/HISTORY.md" ]; then
268
- FILE_LIST="${FILE_LIST} ${project_root}/quick/HISTORY.md"
378
+ if [ -n "$QUICK_REPO_CWD" ]; then
379
+ node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" quick finalize ${quick_id} \
380
+ --quick-dir "${project_root}/quick" \
381
+ --state-path "${state_path}" \
382
+ --fast \
383
+ --push \
384
+ --repo-cwd "$QUICK_REPO_CWD" 2>/dev/null || true
385
+ else
386
+ node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" quick finalize ${quick_id} \
387
+ --quick-dir "${project_root}/quick" \
388
+ --state-path "${state_path}" \
389
+ --fast \
390
+ --push 2>/dev/null || true
269
391
  fi
270
- node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" commit "docs(quick-${quick_id}): track fast task" --push --files ${FILE_LIST} 2>/dev/null || true
271
392
  ```
272
393
 
273
- The `|| true` handles the case where nothing changed (e.g., STATE.md wasn't modified).
394
+ The `|| true` handles the case where nothing changed (e.g., STATE.md wasn't modified) — `quick finalize` returns `commit_reason: 'nothing_to_commit'` cleanly in that scenario.
274
395
 
275
396
  **F7. Output**
276
397
 
@@ -616,6 +737,12 @@ Task(
616
737
  prompt="
617
738
  Execute quick task ${quick_id}.
618
739
 
740
+ ${QUICK_CONTEXT === 'product' && QUICK_REPOS && Object.keys(QUICK_REPOS).length > 0 ? `
741
+ <worktree_context>
742
+ This quick task is executing in a git worktree. Work in these directories — do NOT use the main checkout paths:
743
+ ${Object.entries(QUICK_REPOS).map(([name, dir]) => '- ' + name + ': ' + dir).join('\n')}
744
+ </worktree_context>
745
+ ` : ''}
619
746
  <files_to_read>
620
747
  - ${QUICK_DIR}/${quick_id}-PLAN.md (Plan)
621
748
  - ${state_path} (Project state)
@@ -751,6 +878,10 @@ node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" state archive-quick
751
878
 
752
879
  If archival occurred, `quick/HISTORY.md` was created or updated. Include it in Step 8's commit file list.
753
880
 
881
+ **7c3. Milestone-context quick tracking**
882
+
883
+ If `$QUICK_CONTEXT` is 'milestone-context', note this in the Directory column of the table row. Instead of a directory link, use: `milestone (${MILESTONE_SLUG})`.
884
+
754
885
  **7d. Update "Last activity" line:**
755
886
 
756
887
  Use `date` from init:
@@ -764,20 +895,18 @@ Use Edit tool to make these changes atomically
764
895
 
765
896
  **Step 8: Final commit and completion**
766
897
 
767
- Stage and commit quick task artifacts:
768
-
769
- Build file list:
770
- - `${QUICK_DIR}/${quick_id}-PLAN.md`
771
- - `${QUICK_DIR}/${quick_id}-SUMMARY.md`
772
- - `${state_path}`
773
- - `${project_root}/quick/HISTORY.md` (if it exists — may have been created by archival)
774
- - If `$DISCUSS_MODE` and context file exists: `${QUICK_DIR}/${quick_id}-CONTEXT.md`
775
- - If `$FULL_MODE` and verification file exists: `${QUICK_DIR}/${quick_id}-VERIFICATION.md`
898
+ Commit all quick task artifacts atomically via `dgs-tools quick finalize`. This single CLI call stages and commits PLAN, SUMMARY, STATE, and any optional artifacts present on disk (CONTEXT, VERIFICATION, HISTORY) in one commit no file-list assembly needed.
776
899
 
777
900
  ```bash
778
- node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" commit "docs(quick-${quick_id}): ${DESCRIPTION}" --push --files ${file_list}
901
+ node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" quick finalize ${quick_id} \
902
+ --quick-dir "${project_root}/quick" \
903
+ --state-path "${state_path}" \
904
+ --description "${DESCRIPTION}" \
905
+ --push
779
906
  ```
780
907
 
908
+ Missing optional artifacts are skipped gracefully (no error if CONTEXT.md, VERIFICATION.md, or HISTORY.md do not exist).
909
+
781
910
  Get final commit hash:
782
911
  ```bash
783
912
  commit_hash=$(git rev-parse --short HEAD)
@@ -125,7 +125,7 @@ Context is used to inform the conversation -- for example, when discussing imple
125
125
 
126
126
  3. Load source idea docs:
127
127
  Read the spec's frontmatter to find `source_ideas` (array of idea filenames). For each source idea:
128
- a. Derive the idea docs path (same pattern as write-spec: strip prefix/suffix for slug, check `${project_root}/ideas/pending/{slug}/docs/` or done/rejected paths)
128
+ a. Derive the idea docs path: strip prefix/suffix for slug, check `${project_root}/docs/ideas/{slug}/`
129
129
  b. If docs/ directory exists, read all files using the same pattern above
130
130
  c. Idea docs are loaded first (source material), then spec docs (refinements). If too many, cap spec docs.
131
131
 
@@ -1,7 +1,7 @@
1
1
  <purpose>
2
2
  Subagent-driven research workflow that investigates an idea's feasibility and technical landscape across five adaptive dimensions. Claude acts as an analyst -- purposeful and efficient, adapting depth to what the idea actually needs rather than running a checklist.
3
3
 
4
- Produces a structured research document at `${project_root}/docs/ideas/pending/{slug}-research.md` and appends a Research Log entry to the idea file. Commits both files together and suggests the next step based on findings.
4
+ Produces a structured research document at `${project_root}/docs/ideas/{slug}-research.md` and appends a Research Log entry to the idea file. Commits both files together and suggests the next step based on findings.
5
5
 
6
6
  When re-researching a previously-researched idea, the document is overwritten with a "Changes from Prior Research" section highlighting what shifted. Each re-research appends a fresh Research Log entry.
7
7
  </purpose>
@@ -84,7 +84,7 @@ Also check for prior research document:
84
84
  ```bash
85
85
  # Derive slug from filename (strip id prefix and .md suffix)
86
86
  SLUG=$(echo "${filename}" | sed 's/^[0-9]*-//' | sed 's/\.md$//')
87
- RESEARCH_DOC="${project_root}/docs/ideas/pending/${SLUG}-research.md"
87
+ RESEARCH_DOC="${project_root}/docs/ideas/${SLUG}-research.md"
88
88
  ```
89
89
  If the research document file exists, read it for prior research context.
90
90
 
@@ -98,7 +98,7 @@ IDEA_DOCS_DIR="${IDEA_DIR}/docs"
98
98
 
99
99
  If a flat structure is used (ideas stored as files, not directories), derive from the filename:
100
100
  ```bash
101
- IDEA_DOCS_DIR="${project_root}/docs/ideas/pending/${SLUG}"
101
+ IDEA_DOCS_DIR="${project_root}/docs/ideas/${SLUG}"
102
102
  ```
103
103
 
104
104
  Check both paths. Use whichever exists.
@@ -213,10 +213,10 @@ Create (or overwrite) the research document.
213
213
 
214
214
  Ensure directory exists:
215
215
  ```bash
216
- mkdir -p ${project_root}/docs/ideas/pending
216
+ mkdir -p ${project_root}/docs/ideas
217
217
  ```
218
218
 
219
- Write the research document to `${project_root}/docs/ideas/pending/${SLUG}-research.md` using the Write tool.
219
+ Write the research document to `${project_root}/docs/ideas/${SLUG}-research.md` using the Write tool.
220
220
 
221
221
  **Document structure:**
222
222
  ```markdown
@@ -280,7 +280,7 @@ Build the entry JSON:
280
280
  "summary": "{Actionable summary paragraph -- findings, recommendation, key risks. Enough to act on without opening the full document.}",
281
281
  "keyFindings": "- {finding 1}\n- {finding 2}\n- {finding 3}",
282
282
  "recommendation": "{Strong recommendation or neutral options presentation}",
283
- "documentLink": "${project_root}/docs/ideas/pending/${SLUG}-research.md",
283
+ "documentLink": "${project_root}/docs/ideas/${SLUG}-research.md",
284
284
  "outcome": "{Recommended next step: 'Ready for spec', 'Needs more discussion', 'Not feasible', etc.}"
285
285
  }
286
286
  ```
@@ -296,7 +296,7 @@ Parse the JSON result to confirm success.
296
296
  <step name="git_commit">
297
297
  Commit both the research document and the updated idea file:
298
298
  ```bash
299
- node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs commit "docs: research idea #${id} -- ${title}" --files ${project_root}/docs/ideas/pending/${SLUG}-research.md ${project_root}/ideas/${state}/${filename}
299
+ node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs commit "docs: research idea #${id} -- ${title}" --files ${project_root}/docs/ideas/${SLUG}-research.md ${project_root}/ideas/${filename}
300
300
  ```
301
301
  </step>
302
302
 
@@ -318,7 +318,7 @@ Suggest next step based on outcome:
318
318
  <success_criteria>
319
319
  - [ ] Idea loaded with full context (body, tags, notes, discussion log, research log)
320
320
  - [ ] Research dimensions executed with progress announcements
321
- - [ ] Research document created at `${project_root}/docs/ideas/pending/{slug}-research.md` with frontmatter
321
+ - [ ] Research document created at `${project_root}/docs/ideas/{slug}-research.md` with frontmatter
322
322
  - [ ] Research Log entry saved to idea file via research-save CLI
323
323
  - [ ] Both files committed together
324
324
  - [ ] Key finding + recommendation + next step displayed
@@ -247,7 +247,7 @@ Based on user selection, route to appropriate workflow:
247
247
  ---
248
248
  ```
249
249
  - **Transition** → ./transition.md
250
- - **Check todos** → Read ${project_root}/todos/pending/, present summary
250
+ - **Check todos** → Run `node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" todos list --status pending`, present summary
251
251
  - **Review alignment** → Read PROJECT.md, compare to current state
252
252
  - **Something else** → Ask what they need
253
253
  </step>
@@ -278,7 +278,7 @@ If STATE.md is missing but other artifacts exist:
278
278
  1. Read PROJECT.md → Extract "What This Is" and Core Value
279
279
  2. Read ROADMAP.md → Determine phases, find current position
280
280
  3. Scan \*-SUMMARY.md files → Extract decisions, concerns
281
- 4. Count pending todos in ${project_root}/todos/pending/
281
+ 4. Count pending todos via `node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" todos list --status pending --count`
282
282
  5. Check for .continue-here files → Session continuity
283
283
 
284
284
  Reconstruct and write STATE.md, then proceed normally.