gsd-pi 2.70.1-dev.ec24142 → 2.71.0-dev.06b86c6

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 (161) hide show
  1. package/README.md +24 -17
  2. package/dist/cli.js +12 -3
  3. package/dist/mcp-server.js +6 -6
  4. package/dist/provider-migrations.d.ts +10 -0
  5. package/dist/provider-migrations.js +12 -0
  6. package/dist/resource-loader.js +136 -13
  7. package/dist/resources/GSD-WORKFLOW.md +1 -1
  8. package/dist/resources/extensions/gsd/auto-start.js +1 -1
  9. package/dist/resources/extensions/gsd/auto-tool-tracking.js +1 -1
  10. package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +2 -0
  11. package/dist/resources/extensions/gsd/bootstrap/system-context.js +6 -0
  12. package/dist/resources/extensions/gsd/commands/context.js +15 -6
  13. package/dist/resources/extensions/gsd/commands/dispatcher.js +12 -2
  14. package/dist/resources/extensions/gsd/custom-workflow-engine.js +16 -12
  15. package/dist/resources/extensions/gsd/dispatch-guard.js +18 -1
  16. package/dist/resources/extensions/gsd/error-classifier.js +1 -1
  17. package/dist/resources/extensions/gsd/file-lock.js +60 -0
  18. package/dist/resources/extensions/gsd/notification-store.js +21 -1
  19. package/dist/resources/extensions/gsd/notification-widget.js +1 -1
  20. package/dist/resources/extensions/gsd/pre-execution-checks.js +35 -2
  21. package/dist/resources/extensions/gsd/prompts/complete-slice.md +2 -2
  22. package/dist/resources/extensions/gsd/prompts/discuss.md +2 -0
  23. package/dist/resources/extensions/gsd/prompts/execute-task.md +20 -19
  24. package/dist/resources/extensions/gsd/prompts/guided-discuss-milestone.md +2 -0
  25. package/dist/resources/extensions/gsd/prompts/guided-discuss-slice.md +2 -0
  26. package/dist/resources/extensions/gsd/prompts/guided-resume-task.md +1 -1
  27. package/dist/resources/extensions/gsd/prompts/queue.md +3 -2
  28. package/dist/resources/extensions/gsd/prompts/system.md +1 -0
  29. package/dist/resources/extensions/gsd/prompts/validate-milestone.md +2 -1
  30. package/dist/resources/extensions/gsd/state.js +234 -332
  31. package/dist/resources/extensions/gsd/workflow-events.js +25 -13
  32. package/dist/resources/skills/create-skill/SKILL.md +2 -0
  33. package/dist/web/standalone/.next/BUILD_ID +1 -1
  34. package/dist/web/standalone/.next/app-path-routes-manifest.json +7 -7
  35. package/dist/web/standalone/.next/build-manifest.json +2 -2
  36. package/dist/web/standalone/.next/prerender-manifest.json +3 -3
  37. package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
  38. package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
  39. package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  40. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  41. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  42. package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  43. package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  44. package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  45. package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
  46. package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
  47. package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  48. package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  49. package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  50. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  51. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  52. package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  53. package/dist/web/standalone/.next/server/app/index.html +1 -1
  54. package/dist/web/standalone/.next/server/app/index.rsc +1 -1
  55. package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  56. package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
  57. package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  58. package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
  59. package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  60. package/dist/web/standalone/.next/server/app-paths-manifest.json +7 -7
  61. package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
  62. package/dist/web/standalone/.next/server/pages/404.html +1 -1
  63. package/dist/web/standalone/.next/server/pages/500.html +1 -1
  64. package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
  65. package/package.json +1 -1
  66. package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
  67. package/packages/mcp-server/dist/workflow-tools.js +21 -11
  68. package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
  69. package/packages/mcp-server/src/workflow-tools.test.ts +110 -0
  70. package/packages/mcp-server/src/workflow-tools.ts +31 -11
  71. package/packages/pi-ai/dist/providers/amazon-bedrock.js +11 -2
  72. package/packages/pi-ai/dist/providers/amazon-bedrock.js.map +1 -1
  73. package/packages/pi-ai/dist/providers/anthropic-shared.d.ts +4 -1
  74. package/packages/pi-ai/dist/providers/anthropic-shared.d.ts.map +1 -1
  75. package/packages/pi-ai/dist/providers/anthropic-shared.js +8 -3
  76. package/packages/pi-ai/dist/providers/anthropic-shared.js.map +1 -1
  77. package/packages/pi-ai/dist/providers/anthropic-shared.test.js +44 -1
  78. package/packages/pi-ai/dist/providers/anthropic-shared.test.js.map +1 -1
  79. package/packages/pi-ai/dist/providers/openai-completions.d.ts.map +1 -1
  80. package/packages/pi-ai/dist/providers/openai-completions.js +11 -0
  81. package/packages/pi-ai/dist/providers/openai-completions.js.map +1 -1
  82. package/packages/pi-ai/src/providers/amazon-bedrock.ts +13 -1
  83. package/packages/pi-ai/src/providers/anthropic-shared.test.ts +55 -1
  84. package/packages/pi-ai/src/providers/anthropic-shared.ts +14 -3
  85. package/packages/pi-ai/src/providers/openai-completions.ts +14 -0
  86. package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js +202 -1
  87. package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js.map +1 -1
  88. package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.d.ts +19 -2
  89. package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -1
  90. package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.js +50 -1
  91. package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.js.map +1 -1
  92. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -1
  93. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js +90 -2
  94. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
  95. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-state.d.ts +1 -0
  96. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-state.d.ts.map +1 -1
  97. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-state.js.map +1 -1
  98. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +6 -0
  99. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  100. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +57 -1
  101. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
  102. package/packages/pi-coding-agent/package.json +1 -1
  103. package/packages/pi-coding-agent/src/core/chat-controller-ordering.test.ts +249 -1
  104. package/packages/pi-coding-agent/src/modes/interactive/components/dynamic-border.ts +58 -2
  105. package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.ts +96 -2
  106. package/packages/pi-coding-agent/src/modes/interactive/interactive-mode-state.ts +1 -0
  107. package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +65 -1
  108. package/packages/pi-tui/dist/components/__tests__/markdown-maxlines.test.d.ts +2 -0
  109. package/packages/pi-tui/dist/components/__tests__/markdown-maxlines.test.d.ts.map +1 -0
  110. package/packages/pi-tui/dist/components/__tests__/markdown-maxlines.test.js +66 -0
  111. package/packages/pi-tui/dist/components/__tests__/markdown-maxlines.test.js.map +1 -0
  112. package/packages/pi-tui/dist/components/markdown.d.ts +3 -0
  113. package/packages/pi-tui/dist/components/markdown.d.ts.map +1 -1
  114. package/packages/pi-tui/dist/components/markdown.js +17 -1
  115. package/packages/pi-tui/dist/components/markdown.js.map +1 -1
  116. package/packages/pi-tui/src/components/__tests__/markdown-maxlines.test.ts +75 -0
  117. package/packages/pi-tui/src/components/markdown.ts +22 -1
  118. package/pkg/package.json +1 -1
  119. package/src/resources/GSD-WORKFLOW.md +1 -1
  120. package/src/resources/extensions/gsd/auto-start.ts +1 -1
  121. package/src/resources/extensions/gsd/auto-tool-tracking.ts +1 -1
  122. package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +2 -0
  123. package/src/resources/extensions/gsd/bootstrap/system-context.ts +7 -0
  124. package/src/resources/extensions/gsd/commands/context.ts +16 -5
  125. package/src/resources/extensions/gsd/commands/dispatcher.ts +14 -2
  126. package/src/resources/extensions/gsd/custom-workflow-engine.ts +19 -14
  127. package/src/resources/extensions/gsd/dispatch-guard.ts +18 -1
  128. package/src/resources/extensions/gsd/error-classifier.ts +1 -1
  129. package/src/resources/extensions/gsd/file-lock.ts +59 -0
  130. package/src/resources/extensions/gsd/notification-store.ts +19 -1
  131. package/src/resources/extensions/gsd/notification-widget.ts +1 -1
  132. package/src/resources/extensions/gsd/pre-execution-checks.ts +39 -2
  133. package/src/resources/extensions/gsd/prompts/complete-slice.md +2 -2
  134. package/src/resources/extensions/gsd/prompts/discuss.md +2 -0
  135. package/src/resources/extensions/gsd/prompts/execute-task.md +20 -19
  136. package/src/resources/extensions/gsd/prompts/guided-discuss-milestone.md +2 -0
  137. package/src/resources/extensions/gsd/prompts/guided-discuss-slice.md +2 -0
  138. package/src/resources/extensions/gsd/prompts/guided-resume-task.md +1 -1
  139. package/src/resources/extensions/gsd/prompts/queue.md +3 -2
  140. package/src/resources/extensions/gsd/prompts/system.md +1 -0
  141. package/src/resources/extensions/gsd/prompts/validate-milestone.md +2 -1
  142. package/src/resources/extensions/gsd/state.ts +274 -344
  143. package/src/resources/extensions/gsd/tests/auto-start-worktree-db-path.test.ts +28 -0
  144. package/src/resources/extensions/gsd/tests/bootstrap-derive-state-db-open.test.ts +39 -0
  145. package/src/resources/extensions/gsd/tests/complete-slice-prompt-task-summary-layout.test.ts +18 -0
  146. package/src/resources/extensions/gsd/tests/derive-state-helpers.test.ts +436 -0
  147. package/src/resources/extensions/gsd/tests/dispatch-guard.test.ts +27 -0
  148. package/src/resources/extensions/gsd/tests/execute-task-prompt-existing-artifact-guard.test.ts +33 -0
  149. package/src/resources/extensions/gsd/tests/file-lock.test.ts +103 -0
  150. package/src/resources/extensions/gsd/tests/gsd-no-project-error.test.ts +73 -0
  151. package/src/resources/extensions/gsd/tests/notification-store.test.ts +17 -0
  152. package/src/resources/extensions/gsd/tests/notification-widget.test.ts +25 -0
  153. package/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts +49 -0
  154. package/src/resources/extensions/gsd/tests/prompt-contracts.test.ts +19 -0
  155. package/src/resources/extensions/gsd/tests/provider-errors.test.ts +7 -0
  156. package/src/resources/extensions/gsd/tests/tool-invocation-error-loop-break.test.ts +7 -0
  157. package/src/resources/extensions/gsd/tests/validate-milestone-prompt-verification-classes.test.ts +18 -0
  158. package/src/resources/extensions/gsd/workflow-events.ts +34 -25
  159. package/src/resources/skills/create-skill/SKILL.md +2 -0
  160. /package/dist/web/standalone/.next/static/{20e8bFnNjxQJflHNodEve → dYVdRaunb2ZSEA8fjkT-V}/_buildManifest.js +0 -0
  161. /package/dist/web/standalone/.next/static/{20e8bFnNjxQJflHNodEve → dYVdRaunb2ZSEA8fjkT-V}/_ssgManifest.js +0 -0
@@ -9,16 +9,22 @@ import { randomUUID } from "node:crypto";
9
9
  const MAX_ENTRIES = 500;
10
10
  const FILENAME = "notifications.jsonl";
11
11
  const LOCKFILE = "notifications.lock";
12
+ const DEDUP_WINDOW_MS = 30_000;
13
+ const DEDUP_PRUNE_THRESHOLD = 200;
12
14
  // ─── Module State ───────────────────────────────────────────────────────
13
15
  let _basePath = null;
14
16
  let _lineCount = 0; // Hint for rotation — not authoritative for public API
15
17
  let _suppressCount = 0;
18
+ let _recentMessageTimestamps = new Map();
16
19
  // ─── Public API ─────────────────────────────────────────────────────────
17
20
  /**
18
21
  * Initialize the notification store. Call once at session start with the
19
22
  * project root. Seeds in-memory counters from the existing file on disk.
20
23
  */
21
24
  export function initNotificationStore(basePath) {
25
+ if (_basePath !== basePath) {
26
+ _recentMessageTimestamps.clear();
27
+ }
22
28
  _basePath = basePath;
23
29
  // Seed line count hint for rotation — public counters read from disk
24
30
  _lineCount = _readEntriesFromDisk(basePath).length;
@@ -32,11 +38,24 @@ export function appendNotification(message, severity, source = "notify") {
32
38
  return;
33
39
  if (_suppressCount > 0)
34
40
  return;
41
+ const persistedMessage = message.length > 500 ? message.slice(0, 500) + "…" : message;
42
+ const dedupKey = `${_basePath}:${severity}:${source}:${persistedMessage}`;
43
+ const now = Date.now();
44
+ const lastSeen = _recentMessageTimestamps.get(dedupKey);
45
+ if (lastSeen !== undefined && now - lastSeen < DEDUP_WINDOW_MS)
46
+ return;
47
+ _recentMessageTimestamps.set(dedupKey, now);
48
+ if (_recentMessageTimestamps.size > DEDUP_PRUNE_THRESHOLD) {
49
+ for (const [key, ts] of _recentMessageTimestamps) {
50
+ if (now - ts > DEDUP_WINDOW_MS)
51
+ _recentMessageTimestamps.delete(key);
52
+ }
53
+ }
35
54
  const entry = {
36
55
  id: randomUUID(),
37
56
  ts: new Date().toISOString(),
38
57
  severity,
39
- message: message.length > 500 ? message.slice(0, 500) + "…" : message,
58
+ message: persistedMessage,
40
59
  source,
41
60
  read: false,
42
61
  };
@@ -154,6 +173,7 @@ export function _resetNotificationStore() {
154
173
  _basePath = null;
155
174
  _lineCount = 0;
156
175
  _suppressCount = 0;
176
+ _recentMessageTimestamps = new Map();
157
177
  }
158
178
  // ─── Internal ───────────────────────────────────────────────────────────
159
179
  function _readEntriesFromDisk(basePath) {
@@ -19,7 +19,7 @@ export function buildNotificationWidgetLines() {
19
19
  const truncated = latest.message.length > msgMax
20
20
  ? latest.message.slice(0, msgMax - 1) + "…"
21
21
  : latest.message;
22
- return [` ${icon} [${badge}] ${truncated} (${formatShortcut("Ctrl+Alt+N")} to view)`];
22
+ return [` ${icon} [${badge}] ${truncated} (${formatShortcut("Ctrl+Alt+N")} or /gsd notifications)`];
23
23
  }
24
24
  // ─── Widget init ────────────────────────────────────────────────────────
25
25
  const REFRESH_INTERVAL_MS = 5_000;
@@ -229,6 +229,33 @@ function extractPathFromAnnotation(raw) {
229
229
  // Fall back to the original behavior for already-plain paths.
230
230
  return trimmed.replace(/`/g, "");
231
231
  }
232
+ /**
233
+ * Planning units sometimes use task.inputs for prose like "Current enum shape"
234
+ * instead of concrete file paths. Those entries should not fail path checks.
235
+ * Keep validation for anything that still looks like a real file reference:
236
+ * explicit backticks, globs, separators, dot-paths, or single-token basenames
237
+ * like Dockerfile.
238
+ */
239
+ function shouldValidateInputAsPath(raw) {
240
+ const trimmed = raw.trim();
241
+ if (!trimmed)
242
+ return false;
243
+ if (/^`+[^`]+`+/.test(trimmed)) {
244
+ return true;
245
+ }
246
+ const candidate = extractPathFromAnnotation(trimmed);
247
+ if (!candidate)
248
+ return false;
249
+ if (!/\s/.test(candidate)) {
250
+ return true;
251
+ }
252
+ return (candidate.startsWith("/") ||
253
+ candidate.startsWith("./") ||
254
+ candidate.startsWith("../") ||
255
+ candidate.startsWith("~/") ||
256
+ /[\\/]/.test(candidate) ||
257
+ /[*?[\]{}]/.test(candidate));
258
+ }
232
259
  /**
233
260
  * Build a set of files that will be created by tasks up to (but not including) taskIndex.
234
261
  * All paths are normalized for consistent comparison.
@@ -262,6 +289,8 @@ export function checkFilePathConsistency(tasks, basePath) {
262
289
  // Skip empty strings
263
290
  if (!file.trim())
264
291
  continue;
292
+ if (!shouldValidateInputAsPath(file))
293
+ continue;
265
294
  // Normalize path for consistent comparison
266
295
  const normalizedFile = normalizeFilePath(file);
267
296
  // Check if file exists on disk
@@ -289,7 +318,7 @@ export function checkFilePathConsistency(tasks, basePath) {
289
318
  *
290
319
  * All paths are normalized before comparison to ensure ./src/a.ts matches src/a.ts.
291
320
  */
292
- export function checkTaskOrdering(tasks, _basePath) {
321
+ export function checkTaskOrdering(tasks, basePath) {
293
322
  const results = [];
294
323
  // Build map: normalized file → task index that creates it
295
324
  const fileCreators = new Map();
@@ -309,9 +338,13 @@ export function checkTaskOrdering(tasks, _basePath) {
309
338
  const task = tasks[i];
310
339
  const filesToCheck = [...task.inputs];
311
340
  for (const file of filesToCheck) {
341
+ if (!shouldValidateInputAsPath(file))
342
+ continue;
312
343
  const normalizedFile = normalizeFilePath(file);
313
344
  const creator = fileCreators.get(normalizedFile);
314
- if (creator && creator.index > i) {
345
+ const absolutePath = resolve(basePath, normalizedFile);
346
+ const existsOnDisk = existsSync(absolutePath);
347
+ if (creator && creator.index > i && !existsOnDisk) {
315
348
  // Task reads file that is created later — impossible ordering
316
349
  results.push({
317
350
  category: "file",
@@ -21,7 +21,7 @@ All relevant context has been preloaded below — the slice plan, all task summa
21
21
  Then:
22
22
  1. Use the **Slice Summary** and **UAT** output templates from the inlined context above
23
23
  2. {{skillActivation}}
24
- 3. Run all slice-level verification checks defined in the slice plan. All must pass before marking the slice done. If any fail, fix them first.
24
+ 3. Run all slice-level verification checks defined in the slice plan. All must pass before marking the slice done. If any fail, fix them first. Task artifacts use a **flat file layout** directly inside `tasks/` (for example `T01-SUMMARY.md`, `T02-SUMMARY.md`) rather than per-task subdirectories. If you need to count or re-read task summaries during verification, use `find .gsd/milestones/{{milestoneId}}/slices/{{sliceId}}/tasks -name "*-SUMMARY.md"` or `ls .gsd/milestones/{{milestoneId}}/slices/{{sliceId}}/tasks/*-SUMMARY.md`. Never use `tasks/*/SUMMARY.md` — that glob expects subdirectories that do not exist.
25
25
  4. If the slice plan includes observability/diagnostic surfaces, confirm they work. Skip this for simple slices that don't have observability sections.
26
26
  5. If the slice involved runtime behavior, fill the **Operational Readiness** section (Q8) in the slice summary: health signal, failure signal, recovery procedure, and monitoring gaps. Omit entirely for simple slices with no runtime concerns.
27
27
  6. If this slice produced evidence that a requirement changed status (Active → Validated, Active → Deferred, etc.), call `gsd_requirement_update` with the requirement ID, updated `status`, and `validation` evidence. Do NOT write `.gsd/REQUIREMENTS.md` directly — the engine renders it from the database.
@@ -35,7 +35,7 @@ Then:
35
35
 
36
36
  **Autonomous execution:** Do not call `ask_user_questions` or `secure_env_collect`. You are running in auto-mode — there is no human available to answer questions. Make reasonable assumptions and document them in the slice summary. If a decision genuinely requires human input, note it in the summary and proceed with the best available option.
37
37
 
38
- **File system safety:** Task summaries are preloaded in the inlined context above. If you need to re-read any of them, use `find .gsd/milestones/{{milestoneId}}/slices/{{sliceId}}/tasks -name "*-SUMMARY.md"` to list file paths first never pass `{{slicePath}}` or any other directory path directly to the `read` tool. The `read` tool only accepts file paths, not directories.
38
+ **File system safety:** Task summaries are preloaded in the inlined context above. Task artifacts use a **flat file layout** — files such as `T01-SUMMARY.md` and `T02-SUMMARY.md` live directly inside the `tasks/` directory, not inside per-task subdirectories like `tasks/T01/SUMMARY.md`. If you need to re-read any of them, use `find .gsd/milestones/{{milestoneId}}/slices/{{sliceId}}/tasks -name "*-SUMMARY.md"` to list file paths first. Never use `tasks/*/SUMMARY.md`, and never pass `{{slicePath}}` or any other directory path directly to the `read` tool. The `read` tool only accepts file paths, not directories.
39
39
 
40
40
  **You MUST call `gsd_complete_slice` with the slice summary and UAT content before finishing. The tool persists to both DB and disk and renders `{{sliceSummaryPath}}` and `{{sliceUatPath}}` automatically.**
41
41
 
@@ -73,6 +73,8 @@ After each round of answers, decide whether you already have enough depth to wri
73
73
 
74
74
  You are a thinking partner, not an interviewer.
75
75
 
76
+ **Turn-taking contract (non-bypassable).** Never fabricate, simulate, or role-play user responses. Never generate fake transcript markers like `[User]`, `[Human]`, or `User:` to invent input. Ask one question round (1-3 questions) per turn, then stop and wait for the user's actual response before continuing. If you use `ask_user_questions`, call it at most once per turn and treat its returned response as the only valid structured user input for that round.
77
+
76
78
  **Start open, follow energy.** Let the user's enthusiasm guide where you dig deeper. If they light up about a particular aspect, explore it. If they're vague about something, that's where you probe.
77
79
 
78
80
  **Challenge vagueness, make abstract concrete.** When the user says something abstract ("it should be smart" / "it needs to handle edge cases" / "good UX"), push for specifics. What does "smart" mean in practice? Which edge cases? What does good UX look like for this specific interaction?
@@ -32,29 +32,30 @@ Then:
32
32
  0. Narrate step transitions, key implementation decisions, and verification outcomes as you work. Keep it terse — one line between tool-call clusters, not between every call — but write complete sentences in user-facing prose, not shorthand notes or scratchpad fragments.
33
33
  1. {{skillActivation}} Follow any activated skills before writing code. If no skills match this task, skip this step.
34
34
  2. Execute the steps in the inlined task plan, adapting minor local mismatches when the surrounding code differs from the planner's snapshot
35
- 3. Build the real thing. If the task plan says "create login endpoint", build an endpoint that actually authenticates against a real store, not one that returns a hardcoded success response. If the task plan says "create dashboard page", build a page that renders real data from the API, not a component with hardcoded props. Stubs and mocks are for tests, not for the shipped feature.
36
- 4. Write or update tests as part of execution tests are verification, not an afterthought. If the slice plan defines test files in its Verification section and this is the first task, create them (they should initially fail).
37
- 5. When implementing non-trivial runtime behavior (async flows, API boundaries, background processes, error paths), add or preserve agent-usable observability. Skip this for simple changes where it doesn't apply.
35
+ 3. Before any `Write` that creates an artifact or output file, check whether that path already exists. If it does, read it first and decide whether the work is already done, should be extended, or truly needs replacement. "Create" in the plan does **not** mean the file is missing a prior session may already have started it.
36
+ 4. Build the real thing. If the task plan says "create login endpoint", build an endpoint that actually authenticates against a real store, not one that returns a hardcoded success response. If the task plan says "create dashboard page", build a page that renders real data from the API, not a component with hardcoded props. Stubs and mocks are for tests, not for the shipped feature.
37
+ 5. Write or update tests as part of execution tests are verification, not an afterthought. If the slice plan defines test files in its Verification section and this is the first task, create them (they should initially fail).
38
+ 6. When implementing non-trivial runtime behavior (async flows, API boundaries, background processes, error paths), add or preserve agent-usable observability. Skip this for simple changes where it doesn't apply.
38
39
 
39
40
  **Background process rule:** Never use bare `command &` to run background processes. The shell's `&` operator leaves stdout/stderr attached to the parent, which causes the Bash tool to hang indefinitely waiting for those streams to close. Always redirect output before backgrounding:
40
41
  - Correct: `command > /dev/null 2>&1 &` or `nohup command > /dev/null 2>&1 &`
41
42
  - Example: `python -m http.server 8080 > /dev/null 2>&1 &` (NOT `python -m http.server 8080 &`)
42
43
  - Preferred: use the `bg_shell` tool if available — it manages process lifecycle correctly without stream-inheritance issues
43
- 6. If the task plan includes a **Failure Modes** section (Q5), implement the error/timeout/malformed handling specified. Verify each dependency's failure path is handled. Skip if the section is absent.
44
- 7. If the task plan includes a **Load Profile** section (Q6), implement protections for the identified 10x breakpoint (connection pooling, rate limiting, pagination, etc.). Skip if absent.
45
- 8. If the task plan includes a **Negative Tests** section (Q7), write the specified negative test cases alongside the happy-path tests — malformed inputs, error paths, and boundary conditions. Skip if absent.
46
- 9. Verify must-haves are met by running concrete checks (tests, commands, observable behaviors)
47
- 10. Run the slice-level verification checks defined in the slice plan's Verification section. Track which pass. On the final task of the slice, all must pass before marking done. On intermediate tasks, partial passes are expected — note which ones pass in the summary.
48
- 11. After the verification gate runs (you'll see gate results in stderr/notify output), populate the `## Verification Evidence` table in your task summary with the check results. Use the `formatEvidenceTable` format: one row per check with command, exit code, verdict (✅ pass / ❌ fail), and duration. If no verification commands were discovered, note that in the section.
49
- 12. If the task touches UI, browser flows, DOM behavior, or user-visible web state:
44
+ 7. If the task plan includes a **Failure Modes** section (Q5), implement the error/timeout/malformed handling specified. Verify each dependency's failure path is handled. Skip if the section is absent.
45
+ 8. If the task plan includes a **Load Profile** section (Q6), implement protections for the identified 10x breakpoint (connection pooling, rate limiting, pagination, etc.). Skip if absent.
46
+ 9. If the task plan includes a **Negative Tests** section (Q7), write the specified negative test cases alongside the happy-path tests — malformed inputs, error paths, and boundary conditions. Skip if absent.
47
+ 10. Verify must-haves are met by running concrete checks (tests, commands, observable behaviors)
48
+ 11. Run the slice-level verification checks defined in the slice plan's Verification section. Track which pass. On the final task of the slice, all must pass before marking done. On intermediate tasks, partial passes are expected — note which ones pass in the summary.
49
+ 12. After the verification gate runs (you'll see gate results in stderr/notify output), populate the `## Verification Evidence` table in your task summary with the check results. Use the `formatEvidenceTable` format: one row per check with command, exit code, verdict (✅ pass / ❌ fail), and duration. If no verification commands were discovered, note that in the section.
50
+ 13. If the task touches UI, browser flows, DOM behavior, or user-visible web state:
50
51
  - exercise the real flow in the browser
51
52
  - prefer `browser_batch` when the next few actions are obvious and sequential
52
53
  - prefer `browser_assert` for explicit pass/fail verification of the intended outcome
53
54
  - use `browser_diff` when an action's effect is ambiguous
54
55
  - use console/network/dialog diagnostics when validating async, stateful, or failure-prone UI
55
56
  - record verification in terms of explicit checks passed/failed, not only prose interpretation
56
- 13. If the task plan includes an Observability Impact section, verify those signals directly. Skip this step if the task plan omits the section.
57
- 14. **If execution is running long or verification fails:**
57
+ 14. If the task plan includes an Observability Impact section, verify those signals directly. Skip this step if the task plan omits the section.
58
+ 15. **If execution is running long or verification fails:**
58
59
 
59
60
  **Context budget:** You have approximately **{{verificationBudget}}** reserved for verification context. If you've used most of your context and haven't finished all steps, stop implementing and prioritize writing the task summary with clear notes on what's done and what remains. A partial summary that enables clean resumption is more valuable than one more half-finished step with no documentation. Never sacrifice summary quality for one more implementation step.
60
61
 
@@ -65,13 +66,13 @@ Then:
65
66
  - Distinguish "I know" from "I assume." Observable facts (the error says X) are strong evidence. Assumptions (this library should work this way) need verification.
66
67
  - Know when to stop. If you've tried 3+ fixes without progress, your mental model is probably wrong. Stop. List what you know for certain. List what you've ruled out. Form fresh hypotheses from there.
67
68
  - Don't fix symptoms. Understand *why* something fails before changing code. A test that passes after a change you don't understand is luck, not a fix.
68
- 15. **Blocker discovery:** If execution reveals that the remaining slice plan is fundamentally invalid — not just a bug or minor deviation, but a plan-invalidating finding like a wrong API, missing capability, or architectural mismatch — set `blocker_discovered: true` in the task summary frontmatter and describe the blocker clearly in the summary narrative. Do NOT set `blocker_discovered: true` for ordinary debugging, minor deviations, or issues that can be fixed within the current task or the remaining plan. This flag triggers an automatic replan of the slice.
69
- 16. If you made an architectural, pattern, library, or observability decision during this task that downstream work should know about, append it to `.gsd/DECISIONS.md` (read the template at `~/.gsd/agent/extensions/gsd/templates/decisions.md` if the file doesn't exist yet). Not every task produces decisions — only append when a meaningful choice was made.
70
- 17. If you discover a non-obvious rule, recurring gotcha, or useful pattern during execution, append it to `.gsd/KNOWLEDGE.md`. Only add entries that would save future agents from repeating your investigation. Don't add obvious things.
71
- 18. Read the template at `~/.gsd/agent/extensions/gsd/templates/task-summary.md`
72
- 19. Use that template to prepare the completion content you will pass to `gsd_complete_task` using the camelCase fields `milestoneId`, `sliceId`, `taskId`, `oneLiner`, `narrative`, `verification`, and `verificationEvidence`. Do **not** manually write `{{taskSummaryPath}}` — the DB-backed tool is the canonical write path and renders the summary file for you.
73
- 20. Call `gsd_complete_task` with milestoneId, sliceId, taskId, and the completion fields derived from the template. This is your final required step — do NOT manually edit PLAN.md checkboxes. The tool marks the task complete, updates the DB, renders `{{taskSummaryPath}}`, and updates PLAN.md automatically.
74
- 21. 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.
69
+ 16. **Blocker discovery:** If execution reveals that the remaining slice plan is fundamentally invalid — not just a bug or minor deviation, but a plan-invalidating finding like a wrong API, missing capability, or architectural mismatch — set `blocker_discovered: true` in the task summary frontmatter and describe the blocker clearly in the summary narrative. Do NOT set `blocker_discovered: true` for ordinary debugging, minor deviations, or issues that can be fixed within the current task or the remaining plan. This flag triggers an automatic replan of the slice.
70
+ 17. If you made an architectural, pattern, library, or observability decision during this task that downstream work should know about, append it to `.gsd/DECISIONS.md` (read the template at `~/.gsd/agent/extensions/gsd/templates/decisions.md` if the file doesn't exist yet). Not every task produces decisions — only append when a meaningful choice was made.
71
+ 18. If you discover a non-obvious rule, recurring gotcha, or useful pattern during execution, append it to `.gsd/KNOWLEDGE.md`. Only add entries that would save future agents from repeating your investigation. Don't add obvious things.
72
+ 19. Read the template at `~/.gsd/agent/extensions/gsd/templates/task-summary.md`
73
+ 20. Use that template to prepare the completion content you will pass to `gsd_complete_task` using the camelCase fields `milestoneId`, `sliceId`, `taskId`, `oneLiner`, `narrative`, `verification`, and `verificationEvidence`. Do **not** manually write `{{taskSummaryPath}}` — the DB-backed tool is the canonical write path and renders the summary file for you.
74
+ 21. Call `gsd_complete_task` with milestoneId, sliceId, taskId, and the completion fields derived from the template. This is your final required step — do NOT manually edit PLAN.md checkboxes. The tool marks the task complete, updates the DB, renders `{{taskSummaryPath}}`, and updates PLAN.md automatically.
75
+ 22. 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.
75
76
 
76
77
  All work stays in your working directory: `{{workingDirectory}}`.
77
78
 
@@ -32,6 +32,8 @@ Ask **1–3 questions per round**. Keep each question focused on one of:
32
32
  - **The biggest technical unknowns / risks** — what could fail, what hasn't been proven
33
33
  - **What external systems/services this touches** — APIs, databases, third-party services
34
34
 
35
+ **Never fabricate or simulate user input.** Never generate fake transcript markers like `[User]`, `[Human]`, or `User:`. Ask one question round, then wait for the user's actual response before continuing.
36
+
35
37
  **If `{{structuredQuestionsAvailable}}` is `true`:** use `ask_user_questions` for each round. 1–3 questions per call, each as a separate question object. Keep option labels short (3–5 words). Always include a freeform "Other / let me explain" option. When the user picks that option or writes a long freeform answer, switch to plain text follow-up for that thread before resuming structured questions. **IMPORTANT: Call `ask_user_questions` exactly once per turn. Never make multiple calls with the same or overlapping questions — wait for the user's response before asking the next round.**
36
38
 
37
39
  **If `{{structuredQuestionsAvailable}}` is `false`:** ask questions in plain text. Keep each round to 1–3 focused questions. Wait for answers before asking the next round.
@@ -22,6 +22,8 @@ Do **not** go deep — just enough that your questions reflect what's actually t
22
22
 
23
23
  ### Question rounds
24
24
 
25
+ **Never fabricate or simulate user input.** Never generate fake transcript markers like `[User]`, `[Human]`, or `User:`. Ask one question round, then wait for the user's actual response before continuing.
26
+
25
27
  **If `{{structuredQuestionsAvailable}}` is `true`:** Ask **1–3 questions per round** using `ask_user_questions`. **Call `ask_user_questions` exactly once per turn — never make multiple calls with the same or overlapping questions. Wait for the user's response before asking the next round.**
26
28
  **If `{{structuredQuestionsAvailable}}` is `false`:** Ask **1–3 questions per round** in plain text. Number them and wait for the user's response before asking the next round.
27
29
  Keep each question focused on one of:
@@ -1 +1 @@
1
- Resume interrupted work. Find the continue file (`{{sliceId}}-CONTINUE.md` or `continue.md`) in slice {{sliceId}} of milestone {{milestoneId}}, read it, and use it as the recovery contract for where to pick up. Do **not** delete the continue file immediately. Keep it until the task is successfully completed or you have written a newer summary/continue artifact that clearly supersedes it. If the resumed attempt fails again, update or replace the continue file so no recovery context is lost. {{skillActivation}}
1
+ Resume interrupted work. Find the continue file (`{{sliceId}}-CONTINUE.md` or `continue.md`) in slice {{sliceId}} of milestone {{milestoneId}}, read it, and use it as the recovery contract for where to pick up. Before you create any expected artifact or output file, check whether it already exists and read it first — a prior session may already have started or completed that work. Do **not** delete the continue file immediately. Keep it until the task is successfully completed or you have written a newer summary/continue artifact that clearly supersedes it. If the resumed attempt fails again, update or replace the continue file so no recovery context is lost. {{skillActivation}}
@@ -18,6 +18,7 @@ Say exactly: "What do you want to add?" — nothing else. Wait for the user's an
18
18
  ## Discussion Phase
19
19
 
20
20
  After they describe it, your job is to understand the new work deeply enough to create context files that a future planning session can use.
21
+ Never fabricate or simulate user input during this discussion. Never generate fake transcript markers like `[User]`, `[Human]`, or `User:`. Ask one question round, then wait for the user's actual response before continuing.
21
22
 
22
23
  **If the user provides a file path or pastes a large document** (spec, design doc, product plan, chat export), read it fully before asking questions. Use it as the starting point — don't ask them to re-explain what's already in the document. Your questions should fill gaps and resolve ambiguities the document doesn't cover.
23
24
 
@@ -36,11 +37,11 @@ Don't go deep — just enough that your next question reflects what's actually t
36
37
  - How the new work relates to existing milestones — overlap, dependencies, prerequisites
37
38
  - If `.gsd/REQUIREMENTS.md` exists: which unmet Active or Deferred requirements this queued work advances
38
39
 
39
- **Then use ask_user_questions** to dig into gray areas — scope boundaries, proof expectations, integration choices, tech preferences when they materially matter, and what's in vs out. 1-3 questions per round.
40
+ **Then use ask_user_questions** to dig into gray areas — scope boundaries, proof expectations, integration choices, tech preferences when they materially matter, and what's in vs out. Ask 1-3 questions per round, then wait for the user's response before asking the next round.
40
41
 
41
42
  If a `GSD Skill Preferences` block is present in system context, use it to decide which skills to load and follow during discuss/planning work, but do not let it override the required discuss flow or artifact requirements.
42
43
 
43
- **Self-regulate:** Do **not** ask a meta "ready to queue?" question after every round. Keep going until you have enough depth to write the context well, then use a single wrap-up prompt if needed. If the user clearly keeps adding detail instead of objecting, treat that as permission to continue.
44
+ **Self-regulate:** Do **not** ask a meta "ready to queue?" question after every round. Keep going until you have enough depth to write the context well, then use a single wrap-up prompt if needed. Do not infer permission to continue from silence or from partial prior answers each new round requires an actual user response.
44
45
 
45
46
  ## Existing Milestone Awareness
46
47
 
@@ -35,6 +35,7 @@ GSD ships with bundled skills. Load the relevant skill file with the `read` tool
35
35
  - Read before edit.
36
36
  - Reproduce before fix when possible.
37
37
  - Work is not done until the relevant verification has passed.
38
+ - **Never fabricate, simulate, or role-play user responses.** Never generate markers like `[User]`, `[Human]`, `User:`, or similar to represent user input inside your own output. Ask one question round (1-3 questions), then stop and wait for the user's actual response before continuing. If `ask_user_questions` is available, treat its returned response as the only valid structured user input for that round.
38
39
  - Never print, echo, log, or restate secrets or credentials. Report only key names and applied/skipped status.
39
40
  - Never ask the user to edit `.env` files or set secrets manually. Use `secure_env_collect`.
40
41
  - In enduring files, write current state only unless the file is explicitly historical.
@@ -31,7 +31,7 @@ Prompt: "Review milestone {{milestoneId}} requirements coverage. Working directo
31
31
  Prompt: "Review milestone {{milestoneId}} cross-slice integration. Working directory: {{workingDirectory}}. Read `{{roadmapPath}}` and find the boundary map (produces/consumes contracts). For each boundary, check that the producing slice's SUMMARY confirms it produced the artifact, and the consuming slice's SUMMARY confirms it consumed it. Output a markdown table: Boundary | Producer Summary | Consumer Summary | Status. End with a one-line verdict: PASS if all boundaries honored, NEEDS-ATTENTION if any gaps."
32
32
 
33
33
  **Reviewer C — Assessment & Acceptance Criteria**
34
- Prompt: "Review milestone {{milestoneId}} assessment evidence and acceptance criteria. Working directory: {{workingDirectory}}. Read `.gsd/{{milestoneId}}/CONTEXT.md` for acceptance criteria. Check for ASSESSMENT files in each slice directory. Verify each acceptance criterion maps to either a passing assessment result or clear SUMMARY evidence. Output a checklist: [ ] Criterion | Evidence. End with a one-line verdict: PASS if all criteria met, NEEDS-ATTENTION if gaps exist."
34
+ Prompt: "Review milestone {{milestoneId}} assessment evidence and acceptance criteria. Working directory: {{workingDirectory}}. Read `.gsd/{{milestoneId}}/CONTEXT.md` for acceptance criteria. Check for ASSESSMENT files in each slice directory. Verify each acceptance criterion maps to either a passing assessment result or clear SUMMARY evidence. Then review the inlined milestone verification classes from planning. For each non-empty planned class, output a markdown table: Class | Planned Check | Evidence | Verdict. Use the exact class names `Contract`, `Integration`, `Operational`, and `UAT` whenever those classes are present. If no verification classes were planned, say that explicitly. Output two sections: `Acceptance Criteria` with a checklist `[ ] Criterion | Evidence`, and `Verification Classes` with the table. End with a one-line verdict: PASS if all criteria and verification classes are covered, NEEDS-ATTENTION if gaps exist."
35
35
 
36
36
  ### Step 2 — Synthesize Findings
37
37
 
@@ -70,6 +70,7 @@ reviewers: 3
70
70
  ```
71
71
 
72
72
  Call `gsd_validate_milestone` with the camelCase fields `milestoneId`, `verdict`, `remediationRound`, `successCriteriaChecklist`, `sliceDeliveryAudit`, `crossSliceIntegration`, `requirementCoverage`, `verdictRationale`, and `remediationPlan` when needed. If you include verification-class analysis, pass it in `verificationClasses`.
73
+ Extract the `Verification Classes` subsection from Reviewer C and pass it verbatim in `verificationClasses` so the persisted validation output uses the canonical class names `Contract`, `Integration`, `Operational`, and `UAT`.
73
74
 
74
75
  **DB access safety:** Do NOT query `.gsd/gsd.db` directly via `sqlite3` or `node -e require('better-sqlite3')` — the engine owns the WAL connection. Use `gsd_milestone_status` to read milestone and slice state. All data you need is already inlined in the context above or accessible via the `gsd_*` tools. Direct DB access corrupts the WAL and bypasses tool-level validation.
75
76