gsd-pi 2.23.0 → 2.25.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 (212) hide show
  1. package/README.md +2 -1
  2. package/dist/cli.js +12 -3
  3. package/dist/headless.d.ts +4 -0
  4. package/dist/headless.js +118 -10
  5. package/dist/help-text.js +22 -7
  6. package/dist/models-resolver.d.ts +0 -11
  7. package/dist/models-resolver.js +0 -15
  8. package/dist/resource-loader.d.ts +0 -1
  9. package/dist/resource-loader.js +64 -18
  10. package/dist/resources/GSD-WORKFLOW.md +12 -9
  11. package/dist/resources/extensions/bg-shell/overlay.ts +18 -17
  12. package/dist/resources/extensions/get-secrets-from-user.ts +5 -23
  13. package/dist/resources/extensions/gsd/activity-log.ts +5 -3
  14. package/dist/resources/extensions/gsd/auto-dispatch.ts +51 -2
  15. package/dist/resources/extensions/gsd/auto-prompts.ts +87 -0
  16. package/dist/resources/extensions/gsd/auto-recovery.ts +41 -2
  17. package/dist/resources/extensions/gsd/auto-worktree.ts +134 -4
  18. package/dist/resources/extensions/gsd/auto.ts +307 -77
  19. package/dist/resources/extensions/gsd/cache.ts +3 -1
  20. package/dist/resources/extensions/gsd/commands.ts +176 -10
  21. package/dist/resources/extensions/gsd/complexity.ts +1 -0
  22. package/dist/resources/extensions/gsd/dashboard-overlay.ts +38 -0
  23. package/dist/resources/extensions/gsd/doctor.ts +58 -11
  24. package/dist/resources/extensions/gsd/exit-command.ts +2 -2
  25. package/dist/resources/extensions/gsd/git-service.ts +74 -14
  26. package/dist/resources/extensions/gsd/gitignore.ts +1 -0
  27. package/dist/resources/extensions/gsd/gsd-db.ts +78 -1
  28. package/dist/resources/extensions/gsd/guided-flow.ts +109 -12
  29. package/dist/resources/extensions/gsd/index.ts +48 -2
  30. package/dist/resources/extensions/gsd/memory-extractor.ts +352 -0
  31. package/dist/resources/extensions/gsd/memory-store.ts +441 -0
  32. package/dist/resources/extensions/gsd/migrate/command.ts +2 -2
  33. package/dist/resources/extensions/gsd/parallel-eligibility.ts +233 -0
  34. package/dist/resources/extensions/gsd/parallel-merge.ts +156 -0
  35. package/dist/resources/extensions/gsd/parallel-orchestrator.ts +496 -0
  36. package/dist/resources/extensions/gsd/preferences.ts +65 -1
  37. package/dist/resources/extensions/gsd/prompts/complete-slice.md +1 -1
  38. package/dist/resources/extensions/gsd/prompts/discuss-headless.md +86 -0
  39. package/dist/resources/extensions/gsd/prompts/discuss.md +4 -4
  40. package/dist/resources/extensions/gsd/prompts/execute-task.md +1 -1
  41. package/dist/resources/extensions/gsd/prompts/guided-discuss-milestone.md +1 -1
  42. package/dist/resources/extensions/gsd/prompts/guided-discuss-slice.md +1 -1
  43. package/dist/resources/extensions/gsd/prompts/plan-slice.md +1 -1
  44. package/dist/resources/extensions/gsd/prompts/queue.md +1 -1
  45. package/dist/resources/extensions/gsd/prompts/reassess-roadmap.md +1 -1
  46. package/dist/resources/extensions/gsd/prompts/research-slice.md +1 -1
  47. package/dist/resources/extensions/gsd/prompts/validate-milestone.md +40 -61
  48. package/dist/resources/extensions/gsd/provider-error-pause.ts +29 -2
  49. package/dist/resources/extensions/gsd/session-status-io.ts +197 -0
  50. package/dist/resources/extensions/gsd/state.ts +72 -30
  51. package/dist/resources/extensions/gsd/tests/agent-end-provider-error.test.ts +81 -0
  52. package/dist/resources/extensions/gsd/tests/auto-budget-alerts.test.ts +20 -3
  53. package/dist/resources/extensions/gsd/tests/auto-preflight.test.ts +1 -0
  54. package/dist/resources/extensions/gsd/tests/auto-recovery.test.ts +256 -2
  55. package/dist/resources/extensions/gsd/tests/auto-worktree-milestone-merge.test.ts +34 -0
  56. package/dist/resources/extensions/gsd/tests/auto-worktree.test.ts +58 -0
  57. package/dist/resources/extensions/gsd/tests/complete-milestone.test.ts +8 -1
  58. package/dist/resources/extensions/gsd/tests/derive-state-db.test.ts +9 -15
  59. package/dist/resources/extensions/gsd/tests/derive-state-deps.test.ts +9 -0
  60. package/dist/resources/extensions/gsd/tests/derive-state-draft.test.ts +8 -0
  61. package/dist/resources/extensions/gsd/tests/derive-state.test.ts +14 -0
  62. package/dist/resources/extensions/gsd/tests/git-service.test.ts +70 -4
  63. package/dist/resources/extensions/gsd/tests/gsd-db.test.ts +2 -2
  64. package/dist/resources/extensions/gsd/tests/integration-mixed-milestones.test.ts +8 -0
  65. package/dist/resources/extensions/gsd/tests/md-importer.test.ts +2 -3
  66. package/dist/resources/extensions/gsd/tests/memory-extractor.test.ts +180 -0
  67. package/dist/resources/extensions/gsd/tests/memory-store.test.ts +345 -0
  68. package/dist/resources/extensions/gsd/tests/migrate-writer-integration.test.ts +5 -5
  69. package/dist/resources/extensions/gsd/tests/parallel-orchestration.test.ts +656 -0
  70. package/dist/resources/extensions/gsd/tests/parallel-workers-multi-milestone-e2e.test.ts +354 -0
  71. package/dist/resources/extensions/gsd/tests/queue-reorder-e2e.test.ts +1 -0
  72. package/dist/resources/extensions/gsd/tests/smart-entry-draft.test.ts +1 -1
  73. package/dist/resources/extensions/gsd/tests/validate-milestone.test.ts +316 -0
  74. package/dist/resources/extensions/gsd/tests/visualizer-data.test.ts +147 -2
  75. package/dist/resources/extensions/gsd/tests/visualizer-overlay.test.ts +88 -10
  76. package/dist/resources/extensions/gsd/tests/visualizer-views.test.ts +314 -87
  77. package/dist/resources/extensions/gsd/tests/worker-registry.test.ts +148 -0
  78. package/dist/resources/extensions/gsd/triage-ui.ts +1 -1
  79. package/dist/resources/extensions/gsd/types.ts +15 -1
  80. package/dist/resources/extensions/gsd/visualizer-data.ts +291 -10
  81. package/dist/resources/extensions/gsd/visualizer-overlay.ts +237 -28
  82. package/dist/resources/extensions/gsd/visualizer-views.ts +462 -48
  83. package/dist/resources/extensions/gsd/worktree.ts +9 -2
  84. package/dist/resources/extensions/search-the-web/native-search.ts +15 -5
  85. package/dist/resources/extensions/subagent/index.ts +5 -0
  86. package/dist/resources/extensions/subagent/worker-registry.ts +99 -0
  87. package/dist/update-check.d.ts +9 -0
  88. package/dist/update-check.js +97 -0
  89. package/package.json +6 -1
  90. package/packages/pi-agent-core/dist/agent-loop.js +2 -0
  91. package/packages/pi-agent-core/dist/agent-loop.js.map +1 -1
  92. package/packages/pi-agent-core/src/agent-loop.ts +2 -0
  93. package/packages/pi-ai/dist/providers/anthropic.d.ts.map +1 -1
  94. package/packages/pi-ai/dist/providers/anthropic.js +55 -7
  95. package/packages/pi-ai/dist/providers/anthropic.js.map +1 -1
  96. package/packages/pi-ai/dist/providers/azure-openai-responses.d.ts.map +1 -1
  97. package/packages/pi-ai/dist/providers/azure-openai-responses.js +12 -4
  98. package/packages/pi-ai/dist/providers/azure-openai-responses.js.map +1 -1
  99. package/packages/pi-ai/dist/providers/google-vertex.d.ts.map +1 -1
  100. package/packages/pi-ai/dist/providers/google-vertex.js +21 -9
  101. package/packages/pi-ai/dist/providers/google-vertex.js.map +1 -1
  102. package/packages/pi-ai/dist/providers/mistral.js +3 -0
  103. package/packages/pi-ai/dist/providers/mistral.js.map +1 -1
  104. package/packages/pi-ai/dist/providers/openai-completions.d.ts.map +1 -1
  105. package/packages/pi-ai/dist/providers/openai-completions.js +12 -4
  106. package/packages/pi-ai/dist/providers/openai-completions.js.map +1 -1
  107. package/packages/pi-ai/dist/providers/openai-responses.d.ts.map +1 -1
  108. package/packages/pi-ai/dist/providers/openai-responses.js +12 -4
  109. package/packages/pi-ai/dist/providers/openai-responses.js.map +1 -1
  110. package/packages/pi-ai/dist/types.d.ts +23 -1
  111. package/packages/pi-ai/dist/types.d.ts.map +1 -1
  112. package/packages/pi-ai/dist/types.js.map +1 -1
  113. package/packages/pi-ai/src/providers/anthropic.ts +59 -9
  114. package/packages/pi-ai/src/providers/azure-openai-responses.ts +16 -4
  115. package/packages/pi-ai/src/providers/google-vertex.ts +32 -17
  116. package/packages/pi-ai/src/providers/mistral.ts +3 -0
  117. package/packages/pi-ai/src/providers/openai-completions.ts +16 -4
  118. package/packages/pi-ai/src/providers/openai-responses.ts +16 -4
  119. package/packages/pi-ai/src/types.ts +19 -1
  120. package/packages/pi-coding-agent/dist/core/agent-session.js +1 -1
  121. package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
  122. package/packages/pi-coding-agent/dist/core/settings-manager.js +1 -1
  123. package/packages/pi-coding-agent/dist/core/settings-manager.js.map +1 -1
  124. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  125. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js +17 -0
  126. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -1
  127. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +4 -0
  128. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  129. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +72 -0
  130. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
  131. package/packages/pi-coding-agent/src/core/agent-session.ts +1 -1
  132. package/packages/pi-coding-agent/src/core/settings-manager.ts +2 -2
  133. package/packages/pi-coding-agent/src/modes/interactive/components/tool-execution.ts +18 -0
  134. package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +84 -0
  135. package/scripts/postinstall.js +7 -109
  136. package/src/resources/GSD-WORKFLOW.md +12 -9
  137. package/src/resources/extensions/bg-shell/overlay.ts +18 -17
  138. package/src/resources/extensions/get-secrets-from-user.ts +5 -23
  139. package/src/resources/extensions/gsd/activity-log.ts +5 -3
  140. package/src/resources/extensions/gsd/auto-dispatch.ts +51 -2
  141. package/src/resources/extensions/gsd/auto-prompts.ts +87 -0
  142. package/src/resources/extensions/gsd/auto-recovery.ts +41 -2
  143. package/src/resources/extensions/gsd/auto-worktree.ts +134 -4
  144. package/src/resources/extensions/gsd/auto.ts +307 -77
  145. package/src/resources/extensions/gsd/cache.ts +3 -1
  146. package/src/resources/extensions/gsd/commands.ts +176 -10
  147. package/src/resources/extensions/gsd/complexity.ts +1 -0
  148. package/src/resources/extensions/gsd/dashboard-overlay.ts +38 -0
  149. package/src/resources/extensions/gsd/doctor.ts +58 -11
  150. package/src/resources/extensions/gsd/exit-command.ts +2 -2
  151. package/src/resources/extensions/gsd/git-service.ts +74 -14
  152. package/src/resources/extensions/gsd/gitignore.ts +1 -0
  153. package/src/resources/extensions/gsd/gsd-db.ts +78 -1
  154. package/src/resources/extensions/gsd/guided-flow.ts +109 -12
  155. package/src/resources/extensions/gsd/index.ts +48 -2
  156. package/src/resources/extensions/gsd/memory-extractor.ts +352 -0
  157. package/src/resources/extensions/gsd/memory-store.ts +441 -0
  158. package/src/resources/extensions/gsd/migrate/command.ts +2 -2
  159. package/src/resources/extensions/gsd/parallel-eligibility.ts +233 -0
  160. package/src/resources/extensions/gsd/parallel-merge.ts +156 -0
  161. package/src/resources/extensions/gsd/parallel-orchestrator.ts +496 -0
  162. package/src/resources/extensions/gsd/preferences.ts +65 -1
  163. package/src/resources/extensions/gsd/prompts/complete-slice.md +1 -1
  164. package/src/resources/extensions/gsd/prompts/discuss-headless.md +86 -0
  165. package/src/resources/extensions/gsd/prompts/discuss.md +4 -4
  166. package/src/resources/extensions/gsd/prompts/execute-task.md +1 -1
  167. package/src/resources/extensions/gsd/prompts/guided-discuss-milestone.md +1 -1
  168. package/src/resources/extensions/gsd/prompts/guided-discuss-slice.md +1 -1
  169. package/src/resources/extensions/gsd/prompts/plan-slice.md +1 -1
  170. package/src/resources/extensions/gsd/prompts/queue.md +1 -1
  171. package/src/resources/extensions/gsd/prompts/reassess-roadmap.md +1 -1
  172. package/src/resources/extensions/gsd/prompts/research-slice.md +1 -1
  173. package/src/resources/extensions/gsd/prompts/validate-milestone.md +40 -61
  174. package/src/resources/extensions/gsd/provider-error-pause.ts +29 -2
  175. package/src/resources/extensions/gsd/session-status-io.ts +197 -0
  176. package/src/resources/extensions/gsd/state.ts +72 -30
  177. package/src/resources/extensions/gsd/tests/agent-end-provider-error.test.ts +81 -0
  178. package/src/resources/extensions/gsd/tests/auto-budget-alerts.test.ts +20 -3
  179. package/src/resources/extensions/gsd/tests/auto-preflight.test.ts +1 -0
  180. package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +256 -2
  181. package/src/resources/extensions/gsd/tests/auto-worktree-milestone-merge.test.ts +34 -0
  182. package/src/resources/extensions/gsd/tests/auto-worktree.test.ts +58 -0
  183. package/src/resources/extensions/gsd/tests/complete-milestone.test.ts +8 -1
  184. package/src/resources/extensions/gsd/tests/derive-state-db.test.ts +9 -15
  185. package/src/resources/extensions/gsd/tests/derive-state-deps.test.ts +9 -0
  186. package/src/resources/extensions/gsd/tests/derive-state-draft.test.ts +8 -0
  187. package/src/resources/extensions/gsd/tests/derive-state.test.ts +14 -0
  188. package/src/resources/extensions/gsd/tests/git-service.test.ts +70 -4
  189. package/src/resources/extensions/gsd/tests/gsd-db.test.ts +2 -2
  190. package/src/resources/extensions/gsd/tests/integration-mixed-milestones.test.ts +8 -0
  191. package/src/resources/extensions/gsd/tests/md-importer.test.ts +2 -3
  192. package/src/resources/extensions/gsd/tests/memory-extractor.test.ts +180 -0
  193. package/src/resources/extensions/gsd/tests/memory-store.test.ts +345 -0
  194. package/src/resources/extensions/gsd/tests/migrate-writer-integration.test.ts +5 -5
  195. package/src/resources/extensions/gsd/tests/parallel-orchestration.test.ts +656 -0
  196. package/src/resources/extensions/gsd/tests/parallel-workers-multi-milestone-e2e.test.ts +354 -0
  197. package/src/resources/extensions/gsd/tests/queue-reorder-e2e.test.ts +1 -0
  198. package/src/resources/extensions/gsd/tests/smart-entry-draft.test.ts +1 -1
  199. package/src/resources/extensions/gsd/tests/validate-milestone.test.ts +316 -0
  200. package/src/resources/extensions/gsd/tests/visualizer-data.test.ts +147 -2
  201. package/src/resources/extensions/gsd/tests/visualizer-overlay.test.ts +88 -10
  202. package/src/resources/extensions/gsd/tests/visualizer-views.test.ts +314 -87
  203. package/src/resources/extensions/gsd/tests/worker-registry.test.ts +148 -0
  204. package/src/resources/extensions/gsd/triage-ui.ts +1 -1
  205. package/src/resources/extensions/gsd/types.ts +15 -1
  206. package/src/resources/extensions/gsd/visualizer-data.ts +291 -10
  207. package/src/resources/extensions/gsd/visualizer-overlay.ts +237 -28
  208. package/src/resources/extensions/gsd/visualizer-views.ts +462 -48
  209. package/src/resources/extensions/gsd/worktree.ts +9 -2
  210. package/src/resources/extensions/search-the-web/native-search.ts +15 -5
  211. package/src/resources/extensions/subagent/index.ts +5 -0
  212. package/src/resources/extensions/subagent/worker-registry.ts +99 -0
@@ -75,6 +75,7 @@ const KNOWN_PREFERENCE_KEYS = new Set<string>([
75
75
  "token_profile",
76
76
  "phases",
77
77
  "auto_visualize",
78
+ "parallel",
78
79
  ]);
79
80
 
80
81
  export interface GSDSkillRule {
@@ -171,6 +172,7 @@ export interface GSDPreferences {
171
172
  token_profile?: TokenProfile;
172
173
  phases?: PhaseSkipPreferences;
173
174
  auto_visualize?: boolean;
175
+ parallel?: import("./types.js").ParallelConfig;
174
176
  }
175
177
 
176
178
  export interface LoadedGSDPreferences {
@@ -688,6 +690,7 @@ export function resolveProfileDefaults(profile: TokenProfile): Partial<GSDPrefer
688
690
  skip_research: true,
689
691
  skip_reassess: true,
690
692
  skip_slice_research: true,
693
+ skip_milestone_validation: true,
691
694
  },
692
695
  };
693
696
  case "balanced":
@@ -767,6 +770,9 @@ function mergePreferences(base: GSDPreferences, override: GSDPreferences): GSDPr
767
770
  phases: (base.phases || override.phases)
768
771
  ? { ...(base.phases ?? {}), ...(override.phases ?? {}) }
769
772
  : undefined,
773
+ parallel: (base.parallel || override.parallel)
774
+ ? { ...(base.parallel ?? {}), ...(override.parallel ?? {}) } as import("./types.js").ParallelConfig
775
+ : undefined,
770
776
  };
771
777
  }
772
778
 
@@ -909,8 +915,9 @@ export function validatePreferences(preferences: GSDPreferences): {
909
915
  if (p.skip_research !== undefined) validatedPhases.skip_research = !!p.skip_research;
910
916
  if (p.skip_reassess !== undefined) validatedPhases.skip_reassess = !!p.skip_reassess;
911
917
  if (p.skip_slice_research !== undefined) validatedPhases.skip_slice_research = !!p.skip_slice_research;
918
+ if (p.skip_milestone_validation !== undefined) validatedPhases.skip_milestone_validation = !!p.skip_milestone_validation;
912
919
  // Warn on unknown phase keys
913
- const knownPhaseKeys = new Set(["skip_research", "skip_reassess", "skip_slice_research"]);
920
+ const knownPhaseKeys = new Set(["skip_research", "skip_reassess", "skip_slice_research", "skip_milestone_validation"]);
914
921
  for (const key of Object.keys(p)) {
915
922
  if (!knownPhaseKeys.has(key)) {
916
923
  warnings.push(`unknown phases key "${key}" — ignored`);
@@ -1152,6 +1159,51 @@ export function validatePreferences(preferences: GSDPreferences): {
1152
1159
  }
1153
1160
  }
1154
1161
 
1162
+ // ─── Parallel Config ────────────────────────────────────────────────────
1163
+ if (preferences.parallel && typeof preferences.parallel === "object") {
1164
+ const p = preferences.parallel as unknown as Record<string, unknown>;
1165
+ const parallel: Record<string, unknown> = {};
1166
+
1167
+ if (p.enabled !== undefined) {
1168
+ if (typeof p.enabled === "boolean") parallel.enabled = p.enabled;
1169
+ else errors.push("parallel.enabled must be a boolean");
1170
+ }
1171
+ if (p.max_workers !== undefined) {
1172
+ if (typeof p.max_workers === "number" && p.max_workers >= 1 && p.max_workers <= 4) {
1173
+ parallel.max_workers = Math.floor(p.max_workers);
1174
+ } else {
1175
+ errors.push("parallel.max_workers must be a number between 1 and 4");
1176
+ }
1177
+ }
1178
+ if (p.budget_ceiling !== undefined) {
1179
+ if (typeof p.budget_ceiling === "number" && p.budget_ceiling > 0) {
1180
+ parallel.budget_ceiling = p.budget_ceiling;
1181
+ } else {
1182
+ errors.push("parallel.budget_ceiling must be a positive number");
1183
+ }
1184
+ }
1185
+ if (p.merge_strategy !== undefined) {
1186
+ const validStrategies = new Set(["per-slice", "per-milestone"]);
1187
+ if (typeof p.merge_strategy === "string" && validStrategies.has(p.merge_strategy)) {
1188
+ parallel.merge_strategy = p.merge_strategy;
1189
+ } else {
1190
+ errors.push("parallel.merge_strategy must be one of: per-slice, per-milestone");
1191
+ }
1192
+ }
1193
+ if (p.auto_merge !== undefined) {
1194
+ const validModes = new Set(["auto", "confirm", "manual"]);
1195
+ if (typeof p.auto_merge === "string" && validModes.has(p.auto_merge)) {
1196
+ parallel.auto_merge = p.auto_merge;
1197
+ } else {
1198
+ errors.push("parallel.auto_merge must be one of: auto, confirm, manual");
1199
+ }
1200
+ }
1201
+
1202
+ if (Object.keys(parallel).length > 0) {
1203
+ validated.parallel = parallel as unknown as import("./types.js").ParallelConfig;
1204
+ }
1205
+ }
1206
+
1155
1207
  // ─── Git Preferences ───────────────────────────────────────────────────
1156
1208
  if (preferences.git && typeof preferences.git === "object") {
1157
1209
  const git: Record<string, unknown> = {};
@@ -1369,3 +1421,15 @@ export function updatePreferencesModels(models: GSDModelConfigV2): void {
1369
1421
 
1370
1422
  writeFileSync(prefsPath, content, "utf-8");
1371
1423
  }
1424
+
1425
+ // ─── Parallel Config Resolver ──────────────────────────────────────────────
1426
+
1427
+ export function resolveParallelConfig(prefs: GSDPreferences | undefined): import("./types.js").ParallelConfig {
1428
+ return {
1429
+ enabled: prefs?.parallel?.enabled ?? false,
1430
+ max_workers: Math.max(1, Math.min(4, prefs?.parallel?.max_workers ?? 2)),
1431
+ budget_ceiling: prefs?.parallel?.budget_ceiling,
1432
+ merge_strategy: prefs?.parallel?.merge_strategy ?? "per-milestone",
1433
+ auto_merge: prefs?.parallel?.auto_merge ?? "confirm",
1434
+ };
1435
+ }
@@ -28,7 +28,7 @@ Then:
28
28
  7. Write `{{sliceUatPath}}` — a concrete UAT script with real test cases derived from the slice plan and task summaries. Include preconditions, numbered steps with expected outcomes, and edge cases. This must NOT be a placeholder or generic template — tailor every test case to what this slice actually built.
29
29
  8. Review task summaries for `key_decisions`. Append any significant decisions to `.gsd/DECISIONS.md` if missing.
30
30
  9. Mark {{sliceId}} done in `{{roadmapPath}}` (change `[ ]` to `[x]`)
31
- 10. Do not commit or squash-merge manually — the system auto-commits your changes and handles the merge after this unit succeeds.
31
+ 10. Do not run git commands — the system commits your changes and handles any merge after this unit succeeds.
32
32
  11. Update `.gsd/PROJECT.md` if it exists — refresh current state if needed.
33
33
  12. Update `.gsd/STATE.md`
34
34
 
@@ -0,0 +1,86 @@
1
+ # Headless Milestone Creation
2
+
3
+ You are creating a GSD milestone from a provided specification document. This is a **headless** (non-interactive) flow — do NOT ask the user any questions. Work entirely from the provided specification.
4
+
5
+ ## Provided Specification
6
+
7
+ {{seedContext}}
8
+
9
+ ## Your Task
10
+
11
+ ### Step 1: Reflect
12
+
13
+ Summarize your understanding of the specification concretely:
14
+ - What is being built
15
+ - Major capabilities/features
16
+ - Scope estimate (how many milestones × slices)
17
+ - Any ambiguities or gaps you notice
18
+
19
+ ### Step 2: Investigate
20
+
21
+ Scout the codebase to understand what already exists:
22
+ - `ls` the project root and key directories
23
+ - Search for relevant existing code, patterns, dependencies
24
+ - Check library docs if needed (`resolve_library` / `get_library_docs`)
25
+
26
+ ### Step 3: Make Decisions
27
+
28
+ For any ambiguities or gaps in the specification:
29
+ - Make your best-guess decision based on the spec's intent, codebase patterns, and domain conventions
30
+ - Document each assumption clearly in the Context file
31
+
32
+ ### Step 4: Assess Scope
33
+
34
+ Based on reflection + investigation:
35
+ - Is this a single milestone or multiple milestones?
36
+ - If multi-milestone: plan the full sequence with dependencies
37
+
38
+ ### Step 5: Write Artifacts
39
+
40
+ **Milestone ID**: {{milestoneId}}
41
+
42
+ Use these templates exactly:
43
+
44
+ {{inlinedTemplates}}
45
+
46
+ **For single milestone**, write in this order:
47
+ 1. `mkdir -p .gsd/milestones/{{milestoneId}}/slices`
48
+ 2. Write `.gsd/PROJECT.md` (using Project template)
49
+ 3. Write `.gsd/REQUIREMENTS.md` (using Requirements template)
50
+ 4. Write `{{contextPath}}` (using Context template) — preserve the specification's exact terminology, emphasis, and specific framing. Do not paraphrase domain-specific language into generics. Document assumptions under an "Assumptions" section.
51
+ 5. Write `{{roadmapPath}}` (using Roadmap template) — decompose into demoable vertical slices with checkboxes, risk, depends, demo sentences, proof strategy, verification classes, milestone definition of done, requirement coverage, and a boundary map. If the milestone crosses multiple runtime boundaries, include an explicit final integration slice.
52
+ 6. Seed `.gsd/DECISIONS.md` (using Decisions template)
53
+ 7. Update `.gsd/STATE.md`
54
+ 8. {{commitInstruction}}
55
+ 9. Say exactly: "Milestone {{milestoneId}} ready."
56
+
57
+ **For multi-milestone**, write in this order:
58
+ 1. Create all milestone directories: `mkdir -p .gsd/milestones/{M###}/slices` for each
59
+ 2. Write `.gsd/PROJECT.md` — full vision across ALL milestones (using Project template)
60
+ 3. Write `.gsd/REQUIREMENTS.md` — full capability contract (using Requirements template)
61
+ 4. Seed `.gsd/DECISIONS.md` (using Decisions template)
62
+ 5. Write PRIMARY `{{contextPath}}` — full context with all assumptions documented
63
+ 6. Write PRIMARY `{{roadmapPath}}` — detailed slices for the first milestone only
64
+ 7. For each remaining milestone, write full CONTEXT.md with `depends_on` frontmatter:
65
+ ```yaml
66
+ ---
67
+ depends_on: [M001, M002]
68
+ ---
69
+
70
+ # M003: Title
71
+ ```
72
+ Each context file should be rich enough that a future agent — with no memory of this conversation — can understand the intent, constraints, dependencies, what the milestone unlocks, and what "done" looks like.
73
+ 8. Update `.gsd/STATE.md`
74
+ 9. {{multiMilestoneCommitInstruction}}
75
+ 10. Say exactly: "Milestone {{milestoneId}} ready."
76
+
77
+ ## Critical Rules
78
+
79
+ - **DO NOT ask the user any questions** — this is headless mode
80
+ - **Preserve the specification's terminology** — don't paraphrase domain-specific language
81
+ - **Document assumptions** — when you make a judgment call, note it in CONTEXT.md under "Assumptions"
82
+ - **Investigate before writing** — always scout the codebase first
83
+ - **Use depends_on frontmatter** for multi-milestone sequences (the state machine reads this field to determine execution order)
84
+ - **Anti-reduction rule** — if the spec describes a big vision, plan the big vision. Do not ask "what's the minimum viable version?" or reduce scope. Phase complex/risky work into later milestones — do not cut it.
85
+ - **Naming convention** — directories use bare IDs (`M001/`, `S01/`), files use ID-SUFFIX format (`M001-CONTEXT.md`, `M001-ROADMAP.md`)
86
+ - **End with "Milestone {{milestoneId}} ready."** — this triggers auto-start detection
@@ -201,9 +201,9 @@ When writing context.md, preserve the user's exact terminology, emphasis, and sp
201
201
  5. Write `{{roadmapPath}}` — use the **Roadmap** output template below. Decompose into demoable vertical slices with checkboxes, risk, depends, demo sentences, proof strategy, verification classes, milestone definition of done, requirement coverage, and a boundary map. If the milestone crosses multiple runtime boundaries, include an explicit final integration slice that proves the assembled system works end-to-end in a real environment.
202
202
  6. Seed `.gsd/DECISIONS.md` — use the **Decisions** output template below. Append rows for any architectural or pattern decisions made during discussion.
203
203
  7. Update `.gsd/STATE.md`
204
- 8. Commit: `docs({{milestoneId}}): context, requirements, and roadmap`
204
+ 8. {{commitInstruction}}
205
205
 
206
- After writing the files and committing, say exactly: "Milestone {{milestoneId}} ready." — nothing else. Auto-mode will start automatically.
206
+ After writing the files, say exactly: "Milestone {{milestoneId}} ready." — nothing else. Auto-mode will start automatically.
207
207
 
208
208
  ### Multi-Milestone
209
209
 
@@ -271,8 +271,8 @@ For single-milestone projects, do NOT write this file — it is only for multi-m
271
271
  #### Phase 4: Finalize
272
272
 
273
273
  7. Update `.gsd/STATE.md`
274
- 8. Commit: `docs: project plan — N milestones` (replace N with the actual milestone count)
274
+ 8. {{multiMilestoneCommitInstruction}}
275
275
 
276
- After writing the files and committing, say exactly: "Milestone M001 ready." — nothing else. Auto-mode will start automatically.
276
+ After writing the files, say exactly: "Milestone M001 ready." — nothing else. Auto-mode will start automatically.
277
277
 
278
278
  {{inlinedTemplates}}
@@ -63,7 +63,7 @@ Then:
63
63
  14. Read the template at `~/.gsd/agent/extensions/gsd/templates/task-summary.md`
64
64
  15. Write `{{taskSummaryPath}}`
65
65
  16. Mark {{taskId}} done in `{{planPath}}` (change `[ ]` to `[x]`)
66
- 17. Do not commit manually — the system auto-commits your changes after this unit completes.
66
+ 17. Do not run git commands — the system reads your task summary after completion and creates a meaningful commit from it (type inferred from title, message from your one-liner, key files from frontmatter). Write a clear, specific one-liner in the summary — it becomes the commit message.
67
67
  18. Update `.gsd/STATE.md`
68
68
 
69
69
  All work stays in your working directory: `{{workingDirectory}}`.
@@ -104,5 +104,5 @@ Once the user confirms depth:
104
104
  1. Use the **Context** output template below
105
105
  2. `mkdir -p` the milestone directory if needed
106
106
  3. Write `{{milestoneId}}-CONTEXT.md` — preserve the user's exact terminology, emphasis, and framing. Do not paraphrase nuance into generic summaries. The context file is downstream agents' only window into this conversation.
107
- 4. Commit: `git add {{milestoneId}}-CONTEXT.md && git commit -m "docs({{milestoneId}}): milestone context from discuss"`
107
+ 4. {{commitInstruction}}
108
108
  5. Say exactly: `"{{milestoneId}} context written."` — nothing else.
@@ -55,7 +55,7 @@ Once the user is ready to wrap up:
55
55
  - **Constraints** — anything the user flagged as a hard constraint
56
56
  - **Integration Points** — what this slice consumes and produces
57
57
  - **Open Questions** — anything still unresolved, with current thinking
58
- 4. Commit: `git -C {{projectRoot}} add {{contextPath}} && git -C {{projectRoot}} commit -m "docs({{milestoneId}}/{{sliceId}}): slice context from discuss"`
58
+ 4. {{commitInstruction}}
59
59
  5. Say exactly: `"{{sliceId}} context written."` — nothing else.
60
60
 
61
61
  {{inlinedTemplates}}
@@ -59,7 +59,7 @@ Then:
59
59
  - **Scope sanity:** Target 2–5 steps and 3–8 files per task. 10+ steps or 12+ files — must split. Each task must be completable in a single fresh context window.
60
60
  - **Feature completeness:** Every task produces real, user-facing progress — not just internal scaffolding.
61
61
  9. If planning produced structural decisions, append them to `.gsd/DECISIONS.md`
62
- 10. Commit: `docs({{sliceId}}): add slice plan`
62
+ 10. {{commitInstruction}}
63
63
  11. Update `.gsd/STATE.md`
64
64
 
65
65
  The slice directory and tasks/ subdirectory already exist. Do NOT mkdir. All work stays in your working directory: `{{workingDirectory}}`.
@@ -96,7 +96,7 @@ Then, after all milestone directories and context files are written:
96
96
  4. If `.gsd/REQUIREMENTS.md` exists and the queued work introduces new in-scope capabilities or promotes Deferred items, update it.
97
97
  5. If discussion produced decisions relevant to existing work, append to `.gsd/DECISIONS.md`.
98
98
  6. Append to `.gsd/QUEUE.md`.
99
- 7. Commit: `docs: queue <milestone list>`
99
+ 7. {{commitInstruction}}
100
100
 
101
101
  **Do NOT write roadmaps for queued milestones.**
102
102
  **Do NOT update `.gsd/STATE.md`.**
@@ -57,7 +57,7 @@ Write `{{assessmentPath}}` with a brief confirmation that roadmap coverage still
57
57
  1. Rewrite the remaining (unchecked) slices in `{{roadmapPath}}`. Keep completed slices exactly as they are (`[x]`). Update the boundary map for changed slices. Update the proof strategy if risks changed. Update requirement coverage if ownership or scope changed.
58
58
  2. Write `{{assessmentPath}}` explaining what changed and why — keep it brief and concrete.
59
59
  3. If `.gsd/REQUIREMENTS.md` exists and requirement ownership or status changed, update it.
60
- 4. Commit: `docs({{milestoneId}}): reassess roadmap after {{completedSliceId}}`
60
+ 4. {{commitInstruction}}
61
61
 
62
62
  **You MUST write the file `{{assessmentPath}}` before finishing.**
63
63
 
@@ -46,7 +46,7 @@ Research what this slice needs. Narrate key findings and surprises as you go —
46
46
  2. **Skill Discovery ({{skillDiscoveryMode}}):**{{skillDiscoveryInstructions}}
47
47
  3. Explore relevant code for this slice's scope. For targeted exploration, use `rg`, `find`, and reads. For broad or unfamiliar subsystems, use `scout` to map the relevant area first.
48
48
  4. Use `resolve_library` / `get_library_docs` for unfamiliar libraries — skip this for libraries already used in the codebase
49
- 5. Use the **Research** output template from the inlined context above — include only sections that have real content
49
+ 5. Use the **Research** output template from the inlined context above — include only sections that have real content. The template is already inlined above; do NOT attempt to read any template file from disk (there is no `templates/SLICE-RESEARCH.md` — the correct template is already present in this prompt).
50
50
  6. Write `{{outputPath}}`
51
51
 
52
52
  The slice directory already exists at `{{slicePath}}/`. Do NOT mkdir — just write the file.
@@ -1,6 +1,6 @@
1
1
  You are executing GSD auto-mode.
2
2
 
3
- ## UNIT: Validate Milestone {{milestoneId}} ("{{milestoneTitle}}") — Remediation Round {{remediationRound}}
3
+ ## UNIT: Validate Milestone {{milestoneId}} ("{{milestoneTitle}}")
4
4
 
5
5
  ## Working Directory
6
6
 
@@ -8,84 +8,63 @@ Your working directory is `{{workingDirectory}}`. All file reads, writes, and sh
8
8
 
9
9
  ## Your Role in the Pipeline
10
10
 
11
- All slices are done. Before the **complete-milestone agent** closes this milestone, you reconcile planned work against what was actually delivered. You audit success criteria against evidence, inventory deferred work across all slice summaries and UAT results, and classify gaps. If auto-remediable gaps exist on the first pass, you append remediation slices to the roadmap so the pipeline can execute them before completion. After remediation slices run, you re-validate. The milestone only proceeds to completion once validation passes.
11
+ All slices are done. Before the milestone can be completed, you must validate that the planned work was delivered as specified. Compare the roadmap's success criteria and slice definitions against the actual slice summaries and UAT results. This is a reconciliation gate catch gaps, regressions, or missing deliverables before the milestone is sealed.
12
12
 
13
- This is a gate, not a formality. But most milestones pass bias toward "pass" unless you find concrete evidence of unmet criteria or meaningful gaps.
13
+ This is remediation round {{remediationRound}}. If this is round 0, this is the first validation pass. If > 0, prior validation found issues and remediation slices were added and executed verify those remediation slices resolved the issues.
14
14
 
15
15
  All relevant context has been preloaded below — the roadmap, all slice summaries, UAT results, requirements, decisions, and project context are inlined. Start working immediately without re-reading these files.
16
16
 
17
17
  {{inlinedContext}}
18
18
 
19
- If a `GSD Skill Preferences` block is present in system context, use it to decide which skills to load and follow during validation, without relaxing required verification or artifact rules.
19
+ ## Validation Steps
20
20
 
21
- Then:
21
+ 1. For each **success criterion** in `{{roadmapPath}}`, check whether slice summaries and UAT results provide evidence that it was met. Record pass/fail per criterion.
22
+ 2. For each **slice** in the roadmap, verify its demo/deliverable claim against its summary. Flag any slice whose summary does not substantiate its claimed output.
23
+ 3. Check **cross-slice integration points** — do boundary map entries (produces/consumes) align with what was actually built?
24
+ 4. Check **requirement coverage** — are all active requirements addressed by at least one slice?
25
+ 5. Determine a verdict:
26
+ - `pass` — all criteria met, all slices delivered, no gaps
27
+ - `needs-attention` — minor gaps that do not block completion (document them)
28
+ - `needs-remediation` — material gaps found; add remediation slices to the roadmap
22
29
 
23
- ### Step 1: Audit Success Criteria
30
+ ## Output
24
31
 
25
- Enumerate each success criterion from the roadmap's `## Success Criteria` section. For each criterion, map it to concrete evidence from slice summaries, UAT results, or observable behavior.
32
+ Write `{{validationPath}}` with this structure:
26
33
 
27
- Format each criterion as:
34
+ ```markdown
35
+ ---
36
+ verdict: <pass|needs-attention|needs-remediation>
37
+ remediation_round: {{remediationRound}}
38
+ ---
28
39
 
29
- - `Criterion text` — **MET** — evidence: {{specific slice summary, UAT result, test output, or observable behavior}}
30
- - `Criterion text` — **NOT MET** — gap: {{what's missing and why}}
40
+ # Milestone Validation: {{milestoneId}}
31
41
 
32
- Every criterion must have a definitive verdict. Do not mark a criterion as MET without specific evidence.
42
+ ## Success Criteria Checklist
43
+ - [x] Criterion 1 — evidence: ...
44
+ - [ ] Criterion 2 — gap: ...
33
45
 
34
- ### Step 2: Inventory Deferred Work
46
+ ## Slice Delivery Audit
47
+ | Slice | Claimed | Delivered | Status |
48
+ |-------|---------|-----------|--------|
49
+ | S01 | ... | ... | pass |
35
50
 
36
- Scan ALL slice summaries for:
37
- - `Known Limitations` sections
38
- - `Follow-ups` sections
39
- - `Deviations` sections
51
+ ## Cross-Slice Integration
52
+ (any boundary mismatches)
40
53
 
41
- Scan ALL UAT results for:
42
- - `Not Proven By This UAT` sections
43
- - Any PARTIAL or FAIL verdicts
54
+ ## Requirement Coverage
55
+ (any unaddressed requirements)
44
56
 
45
- Check:
46
- - `.gsd/REQUIREMENTS.md` for Active requirements not yet Validated
47
- - `.gsd/CAPTURES.md` for unresolved deferred captures
57
+ ## Verdict Rationale
58
+ (why this verdict was chosen)
48
59
 
49
- Collect every item into a single inventory. Do not skip items because they seem minor — the classification step handles prioritization.
60
+ ## Remediation Plan
61
+ (only if verdict is needs-remediation — list new slices to add to the roadmap)
62
+ ```
50
63
 
51
- ### Step 3: Classify Each Gap
52
-
53
- For every unmet criterion and every deferred work item, classify it as one of:
54
-
55
- - **auto-remediable** — can be fixed by adding a new slice (missing feature, unfixed bug, untested path, incomplete integration)
56
- - **human-required** — needs Lex's input (design decision, external service dependency, manual verification, judgment call, ambiguous requirement)
57
- - **acceptable** — known limitation that's OK to ship (documented trade-off, explicitly scoped for a future milestone, minor rough edge with no user impact)
58
-
59
- Be conservative with **auto-remediable**. Only classify a gap as auto-remediable if you're confident a slice can resolve it without human judgment. When in doubt, classify as **human-required**.
60
-
61
- ### Step 4: Act on Gaps
62
-
63
- **If this is remediation round 0 AND auto-remediable gaps exist:**
64
-
65
- 1. Define remediation slices to address auto-remediable gaps. Follow the exact roadmap slice format:
66
- `- [ ] **S0X: Title** \`risk:medium\` \`depends:[]\``
67
- Include a brief description of what each slice must accomplish.
68
- 2. Append these slices to `{{roadmapPath}}` after existing slices (do not modify completed slices).
69
- 3. Update the boundary map in the roadmap if the new slices introduce new integration points.
70
- 4. Set verdict to `needs-remediation`.
71
-
72
- **If this is remediation round 1 or higher:**
73
-
74
- Do NOT add more slices. At this point either:
75
- - All remaining gaps are acceptable — set verdict to `pass`
76
- - Remaining gaps need Lex's input — set verdict to `needs-attention`
77
-
78
- Never add remediation slices after round 0. If round 0 remediation didn't close the gaps, escalate.
79
-
80
- **If no auto-remediable gaps exist (any round):**
81
-
82
- - If all criteria are MET and deferred items are acceptable or human-required only — set verdict to `pass` (with human-required items noted)
83
- - If human-required items are blocking — set verdict to `needs-attention`
84
-
85
- ### Step 5: Write Validation Report
86
-
87
- Write `{{validationPath}}` using the milestone-validation template. Fill all frontmatter fields and every section. The report must be a complete record of the validation — a future agent reading only this file should understand what was checked, what passed, and what remains.
64
+ If verdict is `needs-remediation`:
65
+ - Add new slices to `{{roadmapPath}}` with unchecked `[ ]` status
66
+ - These slices will be planned and executed before validation re-runs
88
67
 
89
68
  **You MUST write `{{validationPath}}` before finishing.**
90
69
 
91
- When done, say: "Milestone {{milestoneId}} validated."
70
+ When done, say: "Milestone {{milestoneId}} validation complete — verdict: <verdict>."
@@ -2,11 +2,38 @@ export type ProviderErrorPauseUI = {
2
2
  notify(message: string, level?: "info" | "warning" | "error" | "success"): void;
3
3
  };
4
4
 
5
+ /**
6
+ * Pause auto-mode due to a provider error.
7
+ *
8
+ * For rate-limit errors with a known reset delay, schedules an automatic
9
+ * resume after the delay and shows a countdown notification. For all other
10
+ * errors, pauses indefinitely (user must manually resume).
11
+ */
5
12
  export async function pauseAutoForProviderError(
6
13
  ui: ProviderErrorPauseUI,
7
14
  errorDetail: string,
8
15
  pause: () => Promise<void>,
16
+ options?: {
17
+ isRateLimit?: boolean;
18
+ retryAfterMs?: number;
19
+ resume?: () => void;
20
+ },
9
21
  ): Promise<void> {
10
- ui.notify(`Auto-mode paused due to provider error${errorDetail}`, "warning");
11
- await pause();
22
+ if (options?.isRateLimit && options.retryAfterMs && options.retryAfterMs > 0 && options.resume) {
23
+ const delaySec = Math.ceil(options.retryAfterMs / 1000);
24
+ ui.notify(
25
+ `Rate limited${errorDetail}. Auto-resuming in ${delaySec}s...`,
26
+ "warning",
27
+ );
28
+ await pause();
29
+
30
+ // Schedule auto-resume after the rate limit window
31
+ setTimeout(() => {
32
+ ui.notify("Rate limit window elapsed. Resuming auto-mode.", "info");
33
+ options.resume!();
34
+ }, options.retryAfterMs);
35
+ } else {
36
+ ui.notify(`Auto-mode paused due to provider error${errorDetail}`, "warning");
37
+ await pause();
38
+ }
12
39
  }