gsd-pi 2.45.0-dev.fdcf73c → 2.46.0-dev.cc9d310
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.
- package/dist/resources/extensions/gsd/auto/phases.js +14 -35
- package/dist/resources/extensions/gsd/auto/session.js +0 -11
- package/dist/resources/extensions/gsd/auto-artifact-paths.js +112 -0
- package/dist/resources/extensions/gsd/auto-post-unit.js +25 -96
- package/dist/resources/extensions/gsd/auto-start.js +2 -3
- package/dist/resources/extensions/gsd/auto.js +8 -52
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +18 -0
- package/dist/resources/extensions/gsd/commands/context.js +0 -4
- package/dist/resources/extensions/gsd/commands/handlers/parallel.js +1 -1
- package/dist/resources/extensions/gsd/crash-recovery.js +2 -4
- package/dist/resources/extensions/gsd/dashboard-overlay.js +0 -44
- package/dist/resources/extensions/gsd/doctor-checks.js +166 -1
- package/dist/resources/extensions/gsd/doctor.js +3 -1
- package/dist/resources/extensions/gsd/gsd-db.js +11 -2
- package/dist/resources/extensions/gsd/guided-flow.js +1 -2
- package/dist/resources/extensions/gsd/parallel-merge.js +1 -1
- package/dist/resources/extensions/gsd/parallel-orchestrator.js +5 -18
- package/dist/resources/extensions/gsd/prompts/complete-milestone.md +1 -1
- package/dist/resources/extensions/gsd/prompts/complete-slice.md +10 -23
- package/dist/resources/extensions/gsd/prompts/discuss.md +2 -2
- package/dist/resources/extensions/gsd/prompts/execute-task.md +5 -15
- package/dist/resources/extensions/gsd/prompts/guided-discuss-milestone.md +1 -1
- package/dist/resources/extensions/gsd/prompts/guided-discuss-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/guided-plan-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/guided-research-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/plan-milestone.md +1 -1
- package/dist/resources/extensions/gsd/prompts/plan-slice.md +4 -2
- package/dist/resources/extensions/gsd/prompts/queue.md +2 -2
- package/dist/resources/extensions/gsd/prompts/quick-task.md +2 -0
- package/dist/resources/extensions/gsd/prompts/reactive-execute.md +1 -1
- package/dist/resources/extensions/gsd/prompts/research-slice.md +3 -3
- package/dist/resources/extensions/gsd/prompts/rethink.md +7 -2
- package/dist/resources/extensions/gsd/prompts/system.md +1 -1
- package/dist/resources/extensions/gsd/session-lock.js +1 -3
- package/dist/resources/extensions/gsd/state.js +7 -0
- package/dist/resources/extensions/gsd/sync-lock.js +89 -0
- package/dist/resources/extensions/gsd/tools/complete-milestone.js +58 -12
- package/dist/resources/extensions/gsd/tools/complete-slice.js +56 -11
- package/dist/resources/extensions/gsd/tools/complete-task.js +50 -2
- package/dist/resources/extensions/gsd/tools/plan-milestone.js +37 -1
- package/dist/resources/extensions/gsd/tools/plan-slice.js +30 -1
- package/dist/resources/extensions/gsd/tools/plan-task.js +27 -1
- package/dist/resources/extensions/gsd/tools/reassess-roadmap.js +32 -2
- package/dist/resources/extensions/gsd/tools/reopen-slice.js +86 -0
- package/dist/resources/extensions/gsd/tools/reopen-task.js +90 -0
- package/dist/resources/extensions/gsd/tools/replan-slice.js +32 -2
- package/dist/resources/extensions/gsd/unit-ownership.js +85 -0
- package/dist/resources/extensions/gsd/workflow-events.js +102 -0
- package/dist/resources/extensions/gsd/workflow-logger.js +56 -1
- package/dist/resources/extensions/gsd/workflow-manifest.js +244 -0
- package/dist/resources/extensions/gsd/workflow-migration.js +280 -0
- package/dist/resources/extensions/gsd/workflow-projections.js +373 -0
- package/dist/resources/extensions/gsd/workflow-reconcile.js +411 -0
- package/dist/resources/extensions/gsd/write-intercept.js +84 -0
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +17 -17
- package/dist/web/standalone/.next/build-manifest.json +2 -2
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/server/app/_global-error.html +2 -2
- package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +17 -17
- package/dist/web/standalone/.next/server/pages/404.html +1 -1
- package/dist/web/standalone/.next/server/pages/500.html +2 -2
- package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
- package/package.json +1 -1
- package/packages/pi-coding-agent/package.json +1 -1
- package/pkg/package.json +1 -1
- package/src/resources/extensions/gsd/auto/loop-deps.ts +0 -19
- package/src/resources/extensions/gsd/auto/phases.ts +11 -35
- package/src/resources/extensions/gsd/auto/session.ts +0 -18
- package/src/resources/extensions/gsd/auto-artifact-paths.ts +131 -0
- package/src/resources/extensions/gsd/auto-dashboard.ts +0 -1
- package/src/resources/extensions/gsd/auto-post-unit.ts +25 -106
- package/src/resources/extensions/gsd/auto-start.ts +1 -3
- package/src/resources/extensions/gsd/auto.ts +4 -80
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +22 -0
- package/src/resources/extensions/gsd/commands/context.ts +0 -5
- package/src/resources/extensions/gsd/commands/handlers/parallel.ts +1 -1
- package/src/resources/extensions/gsd/crash-recovery.ts +1 -5
- package/src/resources/extensions/gsd/dashboard-overlay.ts +0 -50
- package/src/resources/extensions/gsd/doctor-checks.ts +179 -1
- package/src/resources/extensions/gsd/doctor-types.ts +7 -1
- package/src/resources/extensions/gsd/doctor.ts +4 -1
- package/src/resources/extensions/gsd/gsd-db.ts +11 -2
- package/src/resources/extensions/gsd/guided-flow.ts +1 -2
- package/src/resources/extensions/gsd/parallel-merge.ts +1 -1
- package/src/resources/extensions/gsd/parallel-orchestrator.ts +5 -21
- package/src/resources/extensions/gsd/prompts/complete-milestone.md +1 -1
- package/src/resources/extensions/gsd/prompts/complete-slice.md +10 -23
- package/src/resources/extensions/gsd/prompts/discuss.md +2 -2
- package/src/resources/extensions/gsd/prompts/execute-task.md +5 -15
- package/src/resources/extensions/gsd/prompts/guided-discuss-milestone.md +1 -1
- package/src/resources/extensions/gsd/prompts/guided-discuss-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/guided-plan-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/guided-research-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/plan-milestone.md +1 -1
- package/src/resources/extensions/gsd/prompts/plan-slice.md +4 -2
- package/src/resources/extensions/gsd/prompts/queue.md +2 -2
- package/src/resources/extensions/gsd/prompts/quick-task.md +2 -0
- package/src/resources/extensions/gsd/prompts/reactive-execute.md +1 -1
- package/src/resources/extensions/gsd/prompts/research-slice.md +3 -3
- package/src/resources/extensions/gsd/prompts/rethink.md +7 -2
- package/src/resources/extensions/gsd/prompts/system.md +1 -1
- package/src/resources/extensions/gsd/session-lock.ts +0 -4
- package/src/resources/extensions/gsd/state.ts +8 -0
- package/src/resources/extensions/gsd/sync-lock.ts +94 -0
- package/src/resources/extensions/gsd/tests/auto-lock-creation.test.ts +5 -13
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +6 -10
- package/src/resources/extensions/gsd/tests/complete-slice.test.ts +264 -228
- package/src/resources/extensions/gsd/tests/complete-task.test.ts +317 -250
- package/src/resources/extensions/gsd/tests/crash-recovery.test.ts +2 -8
- package/src/resources/extensions/gsd/tests/custom-engine-loop-integration.test.ts +0 -3
- package/src/resources/extensions/gsd/tests/gsd-db.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/idle-recovery.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/integration-proof.test.ts +15 -24
- package/src/resources/extensions/gsd/tests/journal-integration.test.ts +0 -3
- package/src/resources/extensions/gsd/tests/md-importer.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/memory-store.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/milestone-transition-state-rebuild.test.ts +8 -9
- package/src/resources/extensions/gsd/tests/parallel-budget-atomicity.test.ts +0 -1
- package/src/resources/extensions/gsd/tests/parallel-crash-recovery.test.ts +0 -7
- package/src/resources/extensions/gsd/tests/parallel-merge.test.ts +7 -8
- package/src/resources/extensions/gsd/tests/parallel-orchestration.test.ts +20 -24
- package/src/resources/extensions/gsd/tests/parallel-worker-monitoring.test.ts +0 -2
- package/src/resources/extensions/gsd/tests/plan-milestone.test.ts +9 -6
- package/src/resources/extensions/gsd/tests/post-mutation-hook.test.ts +171 -0
- package/src/resources/extensions/gsd/tests/projection-regression.test.ts +174 -0
- package/src/resources/extensions/gsd/tests/prompt-contracts.test.ts +15 -14
- package/src/resources/extensions/gsd/tests/reopen-slice.test.ts +155 -0
- package/src/resources/extensions/gsd/tests/reopen-task.test.ts +165 -0
- package/src/resources/extensions/gsd/tests/session-lock-regression.test.ts +1 -4
- package/src/resources/extensions/gsd/tests/stop-auto-remote.test.ts +2 -3
- package/src/resources/extensions/gsd/tests/sync-lock.test.ts +122 -0
- package/src/resources/extensions/gsd/tests/unit-ownership.test.ts +175 -0
- package/src/resources/extensions/gsd/tests/workflow-events.test.ts +205 -0
- package/src/resources/extensions/gsd/tests/workflow-manifest.test.ts +186 -0
- package/src/resources/extensions/gsd/tests/workflow-projections.test.ts +171 -0
- package/src/resources/extensions/gsd/tests/write-intercept.test.ts +76 -0
- package/src/resources/extensions/gsd/tools/complete-milestone.ts +70 -13
- package/src/resources/extensions/gsd/tools/complete-slice.ts +68 -11
- package/src/resources/extensions/gsd/tools/complete-task.ts +63 -1
- package/src/resources/extensions/gsd/tools/plan-milestone.ts +45 -0
- package/src/resources/extensions/gsd/tools/plan-slice.ts +38 -0
- package/src/resources/extensions/gsd/tools/plan-task.ts +35 -1
- package/src/resources/extensions/gsd/tools/reassess-roadmap.ts +39 -1
- package/src/resources/extensions/gsd/tools/reopen-slice.ts +125 -0
- package/src/resources/extensions/gsd/tools/reopen-task.ts +129 -0
- package/src/resources/extensions/gsd/tools/replan-slice.ts +38 -1
- package/src/resources/extensions/gsd/types.ts +8 -0
- package/src/resources/extensions/gsd/unit-ownership.ts +104 -0
- package/src/resources/extensions/gsd/workflow-events.ts +154 -0
- package/src/resources/extensions/gsd/workflow-logger.ts +51 -1
- package/src/resources/extensions/gsd/workflow-manifest.ts +334 -0
- package/src/resources/extensions/gsd/workflow-migration.ts +345 -0
- package/src/resources/extensions/gsd/workflow-projections.ts +425 -0
- package/src/resources/extensions/gsd/workflow-reconcile.ts +503 -0
- package/src/resources/extensions/gsd/write-intercept.ts +90 -0
- /package/dist/web/standalone/.next/static/{zWYDSwB-terOjfhmWzqk1 → ZIDqryyYDroh_8AnaAOSG}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{zWYDSwB-terOjfhmWzqk1 → ZIDqryyYDroh_8AnaAOSG}/_ssgManifest.js +0 -0
|
@@ -5,7 +5,7 @@ import type { DoctorIssue, DoctorIssueCode } from "./doctor-types.js";
|
|
|
5
5
|
import { readRepoMeta, externalProjectsRoot, cleanNumberedGsdVariants } from "./repo-identity.js";
|
|
6
6
|
import { loadFile } from "./files.js";
|
|
7
7
|
import { parseRoadmap as parseLegacyRoadmap } from "./parsers-legacy.js";
|
|
8
|
-
import { isDbAvailable, getMilestoneSlices } from "./gsd-db.js";
|
|
8
|
+
import { isDbAvailable, _getAdapter, getMilestoneSlices } from "./gsd-db.js";
|
|
9
9
|
import { resolveMilestoneFile, milestonesDir, gsdRoot, resolveGsdRootFile, relGsdRootFile } from "./paths.js";
|
|
10
10
|
import { deriveState, isMilestoneComplete } from "./state.js";
|
|
11
11
|
import { saveFile } from "./files.js";
|
|
@@ -19,6 +19,8 @@ import { getAllWorktreeHealth } from "./worktree-health.js";
|
|
|
19
19
|
import { readAllSessionStatuses, isSessionStale, removeSessionStatus } from "./session-status-io.js";
|
|
20
20
|
import { recoverFailedMigration } from "./migrate-external.js";
|
|
21
21
|
import { loadEffectiveGSDPreferences } from "./preferences.js";
|
|
22
|
+
import { readEvents } from "./workflow-events.js";
|
|
23
|
+
import { renderAllProjections } from "./workflow-projections.js";
|
|
22
24
|
|
|
23
25
|
export async function checkGitHealth(
|
|
24
26
|
basePath: string,
|
|
@@ -1111,3 +1113,179 @@ export async function checkGlobalHealth(
|
|
|
1111
1113
|
// Non-fatal — global health check must not block per-project doctor
|
|
1112
1114
|
}
|
|
1113
1115
|
}
|
|
1116
|
+
|
|
1117
|
+
// ── Engine Health Checks ────────────────────────────────────────────────────
|
|
1118
|
+
// DB constraint violation detection and projection drift checks.
|
|
1119
|
+
|
|
1120
|
+
export async function checkEngineHealth(
|
|
1121
|
+
basePath: string,
|
|
1122
|
+
issues: DoctorIssue[],
|
|
1123
|
+
fixesApplied: string[],
|
|
1124
|
+
): Promise<void> {
|
|
1125
|
+
// ── DB constraint violation detection (full doctor only, not pre-dispatch per D-10) ──
|
|
1126
|
+
try {
|
|
1127
|
+
if (isDbAvailable()) {
|
|
1128
|
+
const adapter = _getAdapter()!;
|
|
1129
|
+
|
|
1130
|
+
// a. Orphaned tasks (task.slice_id points to non-existent slice)
|
|
1131
|
+
try {
|
|
1132
|
+
const orphanedTasks = adapter
|
|
1133
|
+
.prepare(
|
|
1134
|
+
`SELECT t.id, t.slice_id, t.milestone_id
|
|
1135
|
+
FROM tasks t
|
|
1136
|
+
LEFT JOIN slices s ON t.milestone_id = s.milestone_id AND t.slice_id = s.id
|
|
1137
|
+
WHERE s.id IS NULL`,
|
|
1138
|
+
)
|
|
1139
|
+
.all() as Array<{ id: string; slice_id: string; milestone_id: string }>;
|
|
1140
|
+
|
|
1141
|
+
for (const row of orphanedTasks) {
|
|
1142
|
+
issues.push({
|
|
1143
|
+
severity: "error",
|
|
1144
|
+
code: "db_orphaned_task",
|
|
1145
|
+
scope: "task",
|
|
1146
|
+
unitId: `${row.milestone_id}/${row.slice_id}/${row.id}`,
|
|
1147
|
+
message: `Task ${row.id} references slice ${row.slice_id} in milestone ${row.milestone_id} but no such slice exists in the database`,
|
|
1148
|
+
fixable: false,
|
|
1149
|
+
});
|
|
1150
|
+
}
|
|
1151
|
+
} catch {
|
|
1152
|
+
// Non-fatal — orphaned task check failed
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
// b. Orphaned slices (slice.milestone_id points to non-existent milestone)
|
|
1156
|
+
try {
|
|
1157
|
+
const orphanedSlices = adapter
|
|
1158
|
+
.prepare(
|
|
1159
|
+
`SELECT s.id, s.milestone_id
|
|
1160
|
+
FROM slices s
|
|
1161
|
+
LEFT JOIN milestones m ON s.milestone_id = m.id
|
|
1162
|
+
WHERE m.id IS NULL`,
|
|
1163
|
+
)
|
|
1164
|
+
.all() as Array<{ id: string; milestone_id: string }>;
|
|
1165
|
+
|
|
1166
|
+
for (const row of orphanedSlices) {
|
|
1167
|
+
issues.push({
|
|
1168
|
+
severity: "error",
|
|
1169
|
+
code: "db_orphaned_slice",
|
|
1170
|
+
scope: "slice",
|
|
1171
|
+
unitId: `${row.milestone_id}/${row.id}`,
|
|
1172
|
+
message: `Slice ${row.id} references milestone ${row.milestone_id} but no such milestone exists in the database`,
|
|
1173
|
+
fixable: false,
|
|
1174
|
+
});
|
|
1175
|
+
}
|
|
1176
|
+
} catch {
|
|
1177
|
+
// Non-fatal — orphaned slice check failed
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
// c. Tasks marked complete without summaries
|
|
1181
|
+
try {
|
|
1182
|
+
const doneTasks = adapter
|
|
1183
|
+
.prepare(
|
|
1184
|
+
`SELECT id, slice_id, milestone_id FROM tasks
|
|
1185
|
+
WHERE status = 'done' AND (summary IS NULL OR summary = '')`,
|
|
1186
|
+
)
|
|
1187
|
+
.all() as Array<{ id: string; slice_id: string; milestone_id: string }>;
|
|
1188
|
+
|
|
1189
|
+
for (const row of doneTasks) {
|
|
1190
|
+
issues.push({
|
|
1191
|
+
severity: "warning",
|
|
1192
|
+
code: "db_done_task_no_summary",
|
|
1193
|
+
scope: "task",
|
|
1194
|
+
unitId: `${row.milestone_id}/${row.slice_id}/${row.id}`,
|
|
1195
|
+
message: `Task ${row.id} is marked done but has no summary in the database`,
|
|
1196
|
+
fixable: false,
|
|
1197
|
+
});
|
|
1198
|
+
}
|
|
1199
|
+
} catch {
|
|
1200
|
+
// Non-fatal — done-task-no-summary check failed
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
// d. Duplicate entity IDs (safety check)
|
|
1204
|
+
try {
|
|
1205
|
+
const dupMilestones = adapter
|
|
1206
|
+
.prepare("SELECT id, COUNT(*) as cnt FROM milestones GROUP BY id HAVING cnt > 1")
|
|
1207
|
+
.all() as Array<{ id: string; cnt: number }>;
|
|
1208
|
+
for (const row of dupMilestones) {
|
|
1209
|
+
issues.push({
|
|
1210
|
+
severity: "error",
|
|
1211
|
+
code: "db_duplicate_id",
|
|
1212
|
+
scope: "milestone",
|
|
1213
|
+
unitId: row.id,
|
|
1214
|
+
message: `Duplicate milestone ID "${row.id}" appears ${row.cnt} times in the database`,
|
|
1215
|
+
fixable: false,
|
|
1216
|
+
});
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
const dupSlices = adapter
|
|
1220
|
+
.prepare("SELECT id, milestone_id, COUNT(*) as cnt FROM slices GROUP BY id, milestone_id HAVING cnt > 1")
|
|
1221
|
+
.all() as Array<{ id: string; milestone_id: string; cnt: number }>;
|
|
1222
|
+
for (const row of dupSlices) {
|
|
1223
|
+
issues.push({
|
|
1224
|
+
severity: "error",
|
|
1225
|
+
code: "db_duplicate_id",
|
|
1226
|
+
scope: "slice",
|
|
1227
|
+
unitId: `${row.milestone_id}/${row.id}`,
|
|
1228
|
+
message: `Duplicate slice ID "${row.id}" in milestone ${row.milestone_id} appears ${row.cnt} times`,
|
|
1229
|
+
fixable: false,
|
|
1230
|
+
});
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
const dupTasks = adapter
|
|
1234
|
+
.prepare("SELECT id, slice_id, milestone_id, COUNT(*) as cnt FROM tasks GROUP BY id, slice_id, milestone_id HAVING cnt > 1")
|
|
1235
|
+
.all() as Array<{ id: string; slice_id: string; milestone_id: string; cnt: number }>;
|
|
1236
|
+
for (const row of dupTasks) {
|
|
1237
|
+
issues.push({
|
|
1238
|
+
severity: "error",
|
|
1239
|
+
code: "db_duplicate_id",
|
|
1240
|
+
scope: "task",
|
|
1241
|
+
unitId: `${row.milestone_id}/${row.slice_id}/${row.id}`,
|
|
1242
|
+
message: `Duplicate task ID "${row.id}" in slice ${row.slice_id} appears ${row.cnt} times`,
|
|
1243
|
+
fixable: false,
|
|
1244
|
+
});
|
|
1245
|
+
}
|
|
1246
|
+
} catch {
|
|
1247
|
+
// Non-fatal — duplicate ID check failed
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
} catch {
|
|
1251
|
+
// Non-fatal — DB constraint checks failed entirely
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
// ── Projection drift detection ──────────────────────────────────────────
|
|
1255
|
+
// If the DB is available, check whether markdown projections are stale
|
|
1256
|
+
// relative to the event log and re-render them.
|
|
1257
|
+
try {
|
|
1258
|
+
if (isDbAvailable()) {
|
|
1259
|
+
const eventLogPath = join(basePath, ".gsd", "event-log.jsonl");
|
|
1260
|
+
const events = readEvents(eventLogPath);
|
|
1261
|
+
if (events.length > 0) {
|
|
1262
|
+
const lastEventTs = new Date(events[events.length - 1]!.ts).getTime();
|
|
1263
|
+
const state = await deriveState(basePath);
|
|
1264
|
+
for (const milestone of state.registry) {
|
|
1265
|
+
if (milestone.status === "complete") continue;
|
|
1266
|
+
const roadmapPath = resolveMilestoneFile(basePath, milestone.id, "ROADMAP");
|
|
1267
|
+
if (!roadmapPath || !existsSync(roadmapPath)) {
|
|
1268
|
+
try {
|
|
1269
|
+
await renderAllProjections(basePath, milestone.id);
|
|
1270
|
+
fixesApplied.push(`re-rendered missing projections for ${milestone.id}`);
|
|
1271
|
+
} catch {
|
|
1272
|
+
// Non-fatal — projection re-render failed
|
|
1273
|
+
}
|
|
1274
|
+
continue;
|
|
1275
|
+
}
|
|
1276
|
+
const projectionMtime = statSync(roadmapPath).mtimeMs;
|
|
1277
|
+
if (lastEventTs > projectionMtime) {
|
|
1278
|
+
try {
|
|
1279
|
+
await renderAllProjections(basePath, milestone.id);
|
|
1280
|
+
fixesApplied.push(`re-rendered stale projections for ${milestone.id}`);
|
|
1281
|
+
} catch {
|
|
1282
|
+
// Non-fatal — projection re-render failed
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
} catch {
|
|
1289
|
+
// Non-fatal — projection drift check must never block doctor
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
@@ -70,7 +70,13 @@ export type DoctorIssueCode =
|
|
|
70
70
|
| "large_planning_file"
|
|
71
71
|
// Slow environment checks (opt-in via --build / --test flags)
|
|
72
72
|
| "env_build"
|
|
73
|
-
| "env_test"
|
|
73
|
+
| "env_test"
|
|
74
|
+
// Engine health checks (Phase 4)
|
|
75
|
+
| "db_orphaned_task"
|
|
76
|
+
| "db_orphaned_slice"
|
|
77
|
+
| "db_done_task_no_summary"
|
|
78
|
+
| "db_duplicate_id"
|
|
79
|
+
| "projection_drift";
|
|
74
80
|
|
|
75
81
|
/**
|
|
76
82
|
* Issue codes that represent global or completion-critical state.
|
|
@@ -12,7 +12,7 @@ import { loadEffectiveGSDPreferences, type GSDPreferences } from "./preferences.
|
|
|
12
12
|
import type { DoctorIssue, DoctorIssueCode, DoctorReport } from "./doctor-types.js";
|
|
13
13
|
import { GLOBAL_STATE_CODES } from "./doctor-types.js";
|
|
14
14
|
import type { RoadmapSliceEntry } from "./types.js";
|
|
15
|
-
import { checkGitHealth, checkRuntimeHealth, checkGlobalHealth } from "./doctor-checks.js";
|
|
15
|
+
import { checkGitHealth, checkRuntimeHealth, checkGlobalHealth, checkEngineHealth } from "./doctor-checks.js";
|
|
16
16
|
import { checkEnvironmentHealth } from "./doctor-environment.js";
|
|
17
17
|
import { runProviderChecks } from "./doctor-providers.js";
|
|
18
18
|
|
|
@@ -382,6 +382,9 @@ export async function runGSDDoctor(basePath: string, options?: { fix?: boolean;
|
|
|
382
382
|
});
|
|
383
383
|
const envMs = Date.now() - t0env;
|
|
384
384
|
|
|
385
|
+
// Engine health checks — DB constraints and projection drift
|
|
386
|
+
await checkEngineHealth(basePath, issues, fixesApplied);
|
|
387
|
+
|
|
385
388
|
const milestonesPath = milestonesDir(basePath);
|
|
386
389
|
if (!existsSync(milestonesPath)) {
|
|
387
390
|
const report: DoctorReport = { ok: issues.every(i => i.severity !== "error"), basePath, issues, fixesApplied, timing: { git: gitMs, runtime: runtimeMs, environment: envMs, gsdState: 0 } };
|
|
@@ -149,7 +149,7 @@ function openRawDb(path: string): unknown {
|
|
|
149
149
|
return new Database(path);
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
const SCHEMA_VERSION =
|
|
152
|
+
const SCHEMA_VERSION = 11;
|
|
153
153
|
|
|
154
154
|
function initSchema(db: DbAdapter, fileBacked: boolean): void {
|
|
155
155
|
if (fileBacked) db.exec("PRAGMA journal_mode=WAL");
|
|
@@ -623,6 +623,13 @@ function migrateSchema(db: DbAdapter): void {
|
|
|
623
623
|
|
|
624
624
|
if (currentVersion < 11) {
|
|
625
625
|
ensureColumn(db, "tasks", "full_plan_md", `ALTER TABLE tasks ADD COLUMN full_plan_md TEXT NOT NULL DEFAULT ''`);
|
|
626
|
+
// Add unique constraint to replan_history for idempotency:
|
|
627
|
+
// one replan record per blocker task per slice per milestone.
|
|
628
|
+
db.exec(`
|
|
629
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_replan_history_unique
|
|
630
|
+
ON replan_history(milestone_id, slice_id, task_id)
|
|
631
|
+
WHERE slice_id IS NOT NULL AND task_id IS NOT NULL
|
|
632
|
+
`);
|
|
626
633
|
|
|
627
634
|
db.prepare("INSERT INTO schema_version (version, applied_at) VALUES (:version, :applied_at)").run({
|
|
628
635
|
":version": 11,
|
|
@@ -1606,8 +1613,10 @@ export function insertReplanHistory(entry: {
|
|
|
1606
1613
|
replacementArtifactPath?: string | null;
|
|
1607
1614
|
}): void {
|
|
1608
1615
|
if (!currentDb) throw new GSDError(GSD_STALE_STATE, "gsd-db: No database open");
|
|
1616
|
+
// INSERT OR REPLACE: idempotent on (milestone_id, slice_id, task_id) via schema v11 unique index.
|
|
1617
|
+
// Retrying the same replan silently updates summary instead of accumulating duplicate rows.
|
|
1609
1618
|
currentDb.prepare(
|
|
1610
|
-
`INSERT INTO replan_history (milestone_id, slice_id, task_id, summary, previous_artifact_path, replacement_artifact_path, created_at)
|
|
1619
|
+
`INSERT OR REPLACE INTO replan_history (milestone_id, slice_id, task_id, summary, previous_artifact_path, replacement_artifact_path, created_at)
|
|
1611
1620
|
VALUES (:milestone_id, :slice_id, :task_id, :summary, :previous_artifact_path, :replacement_artifact_path, :created_at)`,
|
|
1612
1621
|
).run({
|
|
1613
1622
|
":milestone_id": entry.milestoneId,
|
|
@@ -910,8 +910,7 @@ export async function showSmartEntry(
|
|
|
910
910
|
// when the user exits during init wizard or discuss phase before any
|
|
911
911
|
// real auto-mode work begins.
|
|
912
912
|
const isBootstrapCrash = crashLock.unitType === "starting"
|
|
913
|
-
&& crashLock.unitId === "bootstrap"
|
|
914
|
-
&& crashLock.completedUnits === 0;
|
|
913
|
+
&& crashLock.unitId === "bootstrap";
|
|
915
914
|
|
|
916
915
|
if (!isBootstrapCrash) {
|
|
917
916
|
const resume = await showNextAction(ctx, {
|
|
@@ -37,7 +37,7 @@ export function determineMergeOrder(
|
|
|
37
37
|
workers: WorkerInfo[],
|
|
38
38
|
order: MergeOrder = "sequential",
|
|
39
39
|
): string[] {
|
|
40
|
-
const completed = workers.filter(w => w.state === "stopped"
|
|
40
|
+
const completed = workers.filter(w => w.state === "stopped");
|
|
41
41
|
if (order === "by-completion") {
|
|
42
42
|
return completed
|
|
43
43
|
.sort((a, b) => a.startedAt - b.startedAt) // earliest first
|
|
@@ -52,7 +52,6 @@ export interface WorkerInfo {
|
|
|
52
52
|
worktreePath: string;
|
|
53
53
|
startedAt: number;
|
|
54
54
|
state: "running" | "paused" | "stopped" | "error";
|
|
55
|
-
completedUnits: number;
|
|
56
55
|
cost: number;
|
|
57
56
|
cleanup?: () => void;
|
|
58
57
|
}
|
|
@@ -83,7 +82,6 @@ export interface PersistedState {
|
|
|
83
82
|
worktreePath: string;
|
|
84
83
|
startedAt: number;
|
|
85
84
|
state: "running" | "paused" | "stopped" | "error";
|
|
86
|
-
completedUnits: number;
|
|
87
85
|
cost: number;
|
|
88
86
|
}>;
|
|
89
87
|
totalCost: number;
|
|
@@ -114,7 +112,6 @@ export function persistState(basePath: string): void {
|
|
|
114
112
|
worktreePath: w.worktreePath,
|
|
115
113
|
startedAt: w.startedAt,
|
|
116
114
|
state: w.state,
|
|
117
|
-
completedUnits: w.completedUnits,
|
|
118
115
|
cost: w.cost,
|
|
119
116
|
})),
|
|
120
117
|
totalCost: state.totalCost,
|
|
@@ -226,7 +223,6 @@ function restoreRuntimeState(basePath: string): boolean {
|
|
|
226
223
|
worktreePath: diskStatus?.worktreePath ?? w.worktreePath,
|
|
227
224
|
startedAt: w.startedAt,
|
|
228
225
|
state: diskStatus?.state ?? w.state,
|
|
229
|
-
completedUnits: diskStatus?.completedUnits ?? w.completedUnits,
|
|
230
226
|
cost: diskStatus?.cost ?? w.cost,
|
|
231
227
|
});
|
|
232
228
|
}
|
|
@@ -261,7 +257,6 @@ function restoreRuntimeState(basePath: string): boolean {
|
|
|
261
257
|
worktreePath: status.worktreePath,
|
|
262
258
|
startedAt: status.startedAt,
|
|
263
259
|
state: status.state,
|
|
264
|
-
completedUnits: status.completedUnits,
|
|
265
260
|
cost: status.cost,
|
|
266
261
|
});
|
|
267
262
|
state.totalCost += status.cost;
|
|
@@ -389,7 +384,6 @@ export async function startParallel(
|
|
|
389
384
|
worktreePath: w.worktreePath,
|
|
390
385
|
startedAt: w.startedAt,
|
|
391
386
|
state: "running",
|
|
392
|
-
completedUnits: w.completedUnits,
|
|
393
387
|
cost: w.cost,
|
|
394
388
|
});
|
|
395
389
|
adopted.push(w.milestoneId);
|
|
@@ -440,7 +434,6 @@ export async function startParallel(
|
|
|
440
434
|
worktreePath: wtPath,
|
|
441
435
|
startedAt: now,
|
|
442
436
|
state: "running",
|
|
443
|
-
completedUnits: 0,
|
|
444
437
|
cost: 0,
|
|
445
438
|
};
|
|
446
439
|
|
|
@@ -602,7 +595,7 @@ export function spawnWorker(
|
|
|
602
595
|
pid: worker.pid,
|
|
603
596
|
state: "running",
|
|
604
597
|
currentUnit: null,
|
|
605
|
-
completedUnits:
|
|
598
|
+
completedUnits: 0,
|
|
606
599
|
cost: worker.cost,
|
|
607
600
|
lastHeartbeat: Date.now(),
|
|
608
601
|
startedAt: worker.startedAt,
|
|
@@ -645,7 +638,7 @@ export function spawnWorker(
|
|
|
645
638
|
pid: w.pid,
|
|
646
639
|
state: w.state,
|
|
647
640
|
currentUnit: null,
|
|
648
|
-
completedUnits:
|
|
641
|
+
completedUnits: 0,
|
|
649
642
|
cost: w.cost,
|
|
650
643
|
lastHeartbeat: Date.now(),
|
|
651
644
|
startedAt: w.startedAt,
|
|
@@ -727,14 +720,6 @@ function processWorkerLine(basePath: string, milestoneId: string, line: string):
|
|
|
727
720
|
}
|
|
728
721
|
}
|
|
729
722
|
|
|
730
|
-
// Track completed units (each message_end from assistant = progress)
|
|
731
|
-
if (msg.role === "assistant") {
|
|
732
|
-
const worker = state.workers.get(milestoneId);
|
|
733
|
-
if (worker) {
|
|
734
|
-
worker.completedUnits++;
|
|
735
|
-
}
|
|
736
|
-
}
|
|
737
|
-
|
|
738
723
|
// Update session status file so dashboard sees live cost
|
|
739
724
|
const worker = state.workers.get(milestoneId);
|
|
740
725
|
if (worker) {
|
|
@@ -743,7 +728,7 @@ function processWorkerLine(basePath: string, milestoneId: string, line: string):
|
|
|
743
728
|
pid: worker.pid,
|
|
744
729
|
state: worker.state,
|
|
745
730
|
currentUnit: null,
|
|
746
|
-
completedUnits:
|
|
731
|
+
completedUnits: 0,
|
|
747
732
|
cost: worker.cost,
|
|
748
733
|
lastHeartbeat: Date.now(),
|
|
749
734
|
startedAt: worker.startedAt,
|
|
@@ -762,7 +747,7 @@ function processWorkerLine(basePath: string, milestoneId: string, line: string):
|
|
|
762
747
|
pid: worker.pid,
|
|
763
748
|
state: worker.state,
|
|
764
749
|
currentUnit: null,
|
|
765
|
-
completedUnits:
|
|
750
|
+
completedUnits: 0,
|
|
766
751
|
cost: worker.cost,
|
|
767
752
|
lastHeartbeat: Date.now(),
|
|
768
753
|
startedAt: worker.startedAt,
|
|
@@ -930,14 +915,13 @@ export function refreshWorkerStatuses(
|
|
|
930
915
|
if (!isPidAlive(worker.pid)) {
|
|
931
916
|
worker.cleanup?.();
|
|
932
917
|
worker.cleanup = undefined;
|
|
933
|
-
worker.state =
|
|
918
|
+
worker.state = "error";
|
|
934
919
|
worker.process = null;
|
|
935
920
|
}
|
|
936
921
|
continue;
|
|
937
922
|
}
|
|
938
923
|
|
|
939
924
|
worker.state = diskStatus.state;
|
|
940
|
-
worker.completedUnits = diskStatus.completedUnits;
|
|
941
925
|
worker.cost = diskStatus.cost;
|
|
942
926
|
worker.pid = diskStatus.pid;
|
|
943
927
|
}
|
|
@@ -36,7 +36,7 @@ Then:
|
|
|
36
36
|
**Success path** (all verifications passed — continue with steps 7–11):
|
|
37
37
|
|
|
38
38
|
7. **Persist completion through `gsd_complete_milestone`.** Call it with: `milestoneId`, `title`, `oneLiner`, `narrative`, `successCriteriaResults`, `definitionOfDoneResults`, `requirementOutcomes`, `keyDecisions`, `keyFiles`, `lessonsLearned`, `followUps`, `deviations`, `verificationPassed: true`. The tool updates the milestone status in the DB, renders `{{milestoneSummaryPath}}`, and validates all slices are complete before proceeding.
|
|
39
|
-
8.
|
|
39
|
+
8. For each requirement whose status changed in step 6, call `gsd_requirement_update` with the requirement ID and updated `status` and `validation` fields — the tool regenerates `.gsd/REQUIREMENTS.md` automatically.
|
|
40
40
|
9. Update `.gsd/PROJECT.md` to reflect milestone completion and current project state.
|
|
41
41
|
10. Review all slice summaries for cross-cutting lessons, patterns, or gotchas that emerged during this milestone. Append any non-obvious, reusable insights to `.gsd/KNOWLEDGE.md`.
|
|
42
42
|
11. Do not commit manually — the system auto-commits your changes after this unit completes.
|
|
@@ -23,28 +23,15 @@ Then:
|
|
|
23
23
|
2. {{skillActivation}}
|
|
24
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.
|
|
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
|
-
5. If
|
|
27
|
-
6.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
**Patterns & decisions:** `keyDecisions` (array of decision strings), `patternsEstablished` (array), `observabilitySurfaces` (array)
|
|
38
|
-
|
|
39
|
-
**Dependencies:** `provides` (what this slice provides downstream), `affects` (downstream slice IDs affected), `requires` (array of `{slice, provides}` for upstream dependencies consumed), `drillDownPaths` (paths to task summaries)
|
|
40
|
-
|
|
41
|
-
**UAT content:** `uatContent` — the UAT markdown body. This must be 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. The tool writes it to `{{sliceUatPath}}`.
|
|
42
|
-
|
|
43
|
-
7. Review task summaries for `key_decisions`. Append any significant decisions to `.gsd/DECISIONS.md` if missing.
|
|
44
|
-
8. Review task summaries for patterns, gotchas, or non-obvious lessons learned. If any would save future agents from repeating investigation or hitting the same issues, append them to `.gsd/KNOWLEDGE.md`. Only add entries that are genuinely useful — don't pad with obvious observations.
|
|
45
|
-
9. Do not run git commands — the system commits your changes and handles any merge after this unit succeeds.
|
|
46
|
-
10. Update `.gsd/PROJECT.md` if it exists — refresh current state if needed.
|
|
47
|
-
|
|
48
|
-
**You MUST call `gsd_slice_complete` before finishing.** The tool handles writing `{{sliceSummaryPath}}`, `{{sliceUatPath}}`, and updating `{{roadmapPath}}` atomically. You must still review decisions and knowledge manually (steps 7-8).
|
|
26
|
+
5. If this slice produced evidence that a requirement changed status (Active → Validated, Active → Deferred, etc.), call `gsd_save_decision` with scope="requirement", decision="{requirement-id}", choice="{new-status}", rationale="{evidence}". Do NOT write `.gsd/REQUIREMENTS.md` directly — the engine renders it from the database.
|
|
27
|
+
6. Write `{{sliceSummaryPath}}` (compress all task summaries).
|
|
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
|
+
8. Review task summaries for `key_decisions`. Append any significant decisions to `.gsd/DECISIONS.md` if missing.
|
|
30
|
+
9. Review task summaries for patterns, gotchas, or non-obvious lessons learned. If any would save future agents from repeating investigation or hitting the same issues, append them to `.gsd/KNOWLEDGE.md`. Only add entries that are genuinely useful — don't pad with obvious observations.
|
|
31
|
+
10. Call `gsd_complete_slice` with milestone_id, slice_id, the slice summary, and the UAT result. Do NOT manually mark the roadmap checkbox — the tool writes to the DB and renders the ROADMAP.md projection automatically.
|
|
32
|
+
11. Do not run git commands — the system commits your changes and handles any merge after this unit succeeds.
|
|
33
|
+
12. Update `.gsd/PROJECT.md` if it exists — refresh current state if needed.
|
|
34
|
+
|
|
35
|
+
**You MUST do ALL THREE before finishing: (1) write `{{sliceSummaryPath}}`, (2) write `{{sliceUatPath}}`, (3) call `gsd_complete_slice`. The unit will not be marked complete if any of these are missing.**
|
|
49
36
|
|
|
50
37
|
When done, say: "Slice {{sliceId}} complete."
|
|
@@ -203,7 +203,7 @@ When writing context.md, preserve the user's exact terminology, emphasis, and sp
|
|
|
203
203
|
|
|
204
204
|
4. Write `{{contextPath}}` — use the **Context** output template below. Preserve key risks, unknowns, existing codebase constraints, integration points, and relevant requirements surfaced during discussion.
|
|
205
205
|
5. Call `gsd_plan_milestone` to create the roadmap. Decompose into demoable vertical slices with 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. Use the **Roadmap** output template below to structure the tool call parameters.
|
|
206
|
-
6.
|
|
206
|
+
6. For each architectural or pattern decision made during discussion, call `gsd_decision_save` — the tool auto-assigns IDs and regenerates `.gsd/DECISIONS.md` automatically.
|
|
207
207
|
7. {{commitInstruction}}
|
|
208
208
|
|
|
209
209
|
After writing the files, say exactly: "Milestone {{milestoneId}} ready." — nothing else. Auto-mode will start automatically.
|
|
@@ -217,7 +217,7 @@ Once the user confirms the milestone split:
|
|
|
217
217
|
1. For each milestone, call `gsd_milestone_generate_id` to get its ID — never invent milestone IDs manually. Then `mkdir -p .gsd/milestones/<ID>/slices`.
|
|
218
218
|
2. Write `.gsd/PROJECT.md` — use the **Project** output template below.
|
|
219
219
|
3. Write `.gsd/REQUIREMENTS.md` — use the **Requirements** output template below. Capture Active, Deferred, Out of Scope, and any already Validated requirements. Later milestones may have provisional ownership where slice plans do not exist yet.
|
|
220
|
-
4.
|
|
220
|
+
4. For any architectural or pattern decisions made during discussion, call `gsd_decision_save` — the tool auto-assigns IDs and regenerates `.gsd/DECISIONS.md` automatically.
|
|
221
221
|
|
|
222
222
|
#### Phase 2: Primary milestone
|
|
223
223
|
|
|
@@ -63,23 +63,13 @@ Then:
|
|
|
63
63
|
11. **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.
|
|
64
64
|
12. 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.
|
|
65
65
|
13. 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.
|
|
66
|
-
14.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
- `oneLiner`: One-line summary of what was accomplished (becomes the commit message)
|
|
71
|
-
- `narrative`: Detailed narrative of what happened during the task
|
|
72
|
-
- `verification`: What was verified and how — commands run, tests passed, behavior confirmed
|
|
73
|
-
- `deviations`: Deviations from the task plan, or "None."
|
|
74
|
-
- `knownIssues`: Known issues discovered but not fixed, or "None."
|
|
75
|
-
- `keyFiles`: Array of key files created or modified
|
|
76
|
-
- `keyDecisions`: Array of key decisions made during this task
|
|
77
|
-
- `blockerDiscovered`: Whether a plan-invalidating blocker was discovered (boolean)
|
|
78
|
-
- `verificationEvidence`: Array of `{ command, exitCode, verdict, durationMs }` objects from the verification gate
|
|
79
|
-
15. 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.
|
|
66
|
+
14. Read the template at `~/.gsd/agent/extensions/gsd/templates/task-summary.md`
|
|
67
|
+
15. Write `{{taskSummaryPath}}`
|
|
68
|
+
16. Call `gsd_complete_task` with milestone_id, slice_id, task_id, and a summary of what was accomplished. This is your final required step — do NOT manually edit PLAN.md checkboxes. The tool marks the task complete, updates the DB, and renders PLAN.md automatically.
|
|
69
|
+
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.
|
|
80
70
|
|
|
81
71
|
All work stays in your working directory: `{{workingDirectory}}`.
|
|
82
72
|
|
|
83
|
-
**You MUST call `
|
|
73
|
+
**You MUST call `gsd_complete_task` AND write `{{taskSummaryPath}}` before finishing.**
|
|
84
74
|
|
|
85
75
|
When done, say: "Task {{taskId}} complete."
|
|
@@ -105,6 +105,6 @@ Once the user confirms depth:
|
|
|
105
105
|
|
|
106
106
|
1. Use the **Context** output template below
|
|
107
107
|
2. `mkdir -p` the milestone directory if needed
|
|
108
|
-
3.
|
|
108
|
+
3. Call `gsd_summary_save` with `milestone_id: {{milestoneId}}`, `artifact_type: "CONTEXT"`, and the full context markdown as `content` — the tool writes the file to disk and persists to DB. Preserve the user's exact terminology, emphasis, and framing in the content. Do not paraphrase nuance into generic summaries. The context file is downstream agents' only window into this conversation.
|
|
109
109
|
4. {{commitInstruction}}
|
|
110
110
|
5. Say exactly: `"{{milestoneId}} context written."` — nothing else.
|
|
@@ -48,7 +48,7 @@ Once the user is ready to wrap up:
|
|
|
48
48
|
|
|
49
49
|
1. Use the **Slice Context** output template below
|
|
50
50
|
2. `mkdir -p {{sliceDirPath}}`
|
|
51
|
-
3.
|
|
51
|
+
3. Call `gsd_summary_save` with `milestone_id: {{milestoneId}}`, `slice_id: {{sliceId}}`, `artifact_type: "CONTEXT"`, and the context as `content` — the tool writes the file to disk and persists to DB. Use the template structure, filling in:
|
|
52
52
|
- **Goal** — one sentence: what this slice delivers
|
|
53
53
|
- **Why this Slice** — why now, what it unblocks
|
|
54
54
|
- **Scope / In Scope** — what was confirmed in scope during the interview
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
Plan slice {{sliceId}} ("{{sliceTitle}}") of milestone {{milestoneId}}. Read `.gsd/DECISIONS.md` if it exists — respect existing decisions. Read `.gsd/REQUIREMENTS.md` if it exists — identify which Active requirements the roadmap says this slice owns or supports, and ensure the plan delivers them. Read the roadmap boundary map, any existing context/research files, and dependency summaries. Use the **Slice Plan** and **Task Plan** output templates below. Decompose into tasks with must-haves. Fill the `Proof Level` and `Integration Closure` sections truthfully so the plan says what class of proof this slice really delivers and what end-to-end wiring still remains.
|
|
1
|
+
Plan slice {{sliceId}} ("{{sliceTitle}}") of milestone {{milestoneId}}. Read `.gsd/DECISIONS.md` if it exists — respect existing decisions. Read `.gsd/REQUIREMENTS.md` if it exists — identify which Active requirements the roadmap says this slice owns or supports, and ensure the plan delivers them. Read the roadmap boundary map, any existing context/research files, and dependency summaries. Use the **Slice Plan** and **Task Plan** output templates below. Decompose into tasks with must-haves. Fill the `Proof Level` and `Integration Closure` sections truthfully so the plan says what class of proof this slice really delivers and what end-to-end wiring still remains. Call `gsd_plan_slice` to persist the slice plan — the tool writes `{{sliceId}}-PLAN.md` and individual `T##-PLAN.md` files to disk and persists to DB. Do **not** write plan files manually — use the DB-backed tool so state stays consistent. If planning produces structural decisions, call `gsd_decision_save` for each — the tool auto-assigns IDs and regenerates `.gsd/DECISIONS.md` automatically. {{skillActivation}} Before finishing, self-audit the plan: every must-have maps to at least one task, every task has complete sections (steps, must-haves, verification, observability impact, inputs, and expected output), task ordering is consistent with no circular references, every pair of artifacts that must connect has an explicit wiring step, task scope targets 2–5 steps and 3–8 files (6–8 steps or 8–10 files — consider splitting; 10+ steps or 12+ files — must split), the plan honors locked decisions from context/research/decisions artifacts, the proof-level wording does not overclaim live integration if only fixture/contract proof is planned, every Active requirement this slice owns has at least one task with verification that proves it is met, and every task produces real user-facing progress — if the slice has a UI surface at least one task builds the real UI, if it has an API at least one task connects it to a real data source, and showing the completed result to a non-technical stakeholder would demonstrate real product progress rather than developer artifacts.
|
|
2
2
|
|
|
3
3
|
{{inlinedTemplates}}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Research slice {{sliceId}} ("{{sliceTitle}}") of milestone {{milestoneId}}. Read `.gsd/DECISIONS.md` if it exists — respect existing decisions, don't contradict them. Read `.gsd/REQUIREMENTS.md` if it exists — identify which Active requirements this slice owns or supports and target research toward risks, unknowns, and constraints that could affect delivery of those requirements. {{skillActivation}} Explore the relevant code — use `rg`/`find` for targeted reads, or `scout` if the area is broad or unfamiliar. Check libraries with `resolve_library`/`get_library_docs` — skip this for libraries already used in the codebase. Use the **Research** output template below.
|
|
1
|
+
Research slice {{sliceId}} ("{{sliceTitle}}") of milestone {{milestoneId}}. Read `.gsd/DECISIONS.md` if it exists — respect existing decisions, don't contradict them. Read `.gsd/REQUIREMENTS.md` if it exists — identify which Active requirements this slice owns or supports and target research toward risks, unknowns, and constraints that could affect delivery of those requirements. {{skillActivation}} Explore the relevant code — use `rg`/`find` for targeted reads, or `scout` if the area is broad or unfamiliar. Check libraries with `resolve_library`/`get_library_docs` — skip this for libraries already used in the codebase. Use the **Research** output template below. Call `gsd_summary_save` with `milestone_id: {{milestoneId}}`, `slice_id: {{sliceId}}`, `artifact_type: "RESEARCH"`, and the research content — the tool writes the file to disk and persists to DB.
|
|
2
2
|
|
|
3
3
|
**You are the scout.** A planner agent reads your output in a fresh context to decompose this slice into tasks. Write for the planner — surface key files, where the work divides naturally, what to build first, and how to verify. If the research doc is vague, the planner re-explores code you already read. If it's precise, the planner decomposes immediately.
|
|
4
4
|
|
|
@@ -48,7 +48,7 @@ Then:
|
|
|
48
48
|
3. Create the roadmap: decompose into demoable vertical slices — as many as the work genuinely needs, no more. A simple feature might be 1 slice. Don't decompose for decomposition's sake.
|
|
49
49
|
4. Order by risk (high-risk first)
|
|
50
50
|
5. Call `gsd_plan_milestone` to persist the milestone planning fields and slice rows in the DB-backed planning path. Do **not** write `{{outputPath}}`, `ROADMAP.md`, or other planning artifacts manually — the planning tool owns roadmap rendering and persistence.
|
|
51
|
-
6. If planning produced structural decisions (e.g. slice ordering rationale, technology choices, scope exclusions),
|
|
51
|
+
6. If planning produced structural decisions (e.g. slice ordering rationale, technology choices, scope exclusions), call `gsd_decision_save` for each decision — the tool auto-assigns IDs and regenerates `.gsd/DECISIONS.md` automatically.
|
|
52
52
|
|
|
53
53
|
## Requirement Mapping Rules
|
|
54
54
|
|
|
@@ -72,9 +72,11 @@ Then:
|
|
|
72
72
|
- **Key links planned:** For every pair of artifacts that must connect, there is an explicit step that wires them.
|
|
73
73
|
- **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.
|
|
74
74
|
- **Feature completeness:** Every task produces real, user-facing progress — not just internal scaffolding.
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
10. If planning produced structural decisions, append them to `.gsd/DECISIONS.md`
|
|
76
|
+
11. {{commitInstruction}}
|
|
77
77
|
|
|
78
78
|
The slice directory and tasks/ subdirectory already exist. Do NOT mkdir. All work stays in your working directory: `{{workingDirectory}}`.
|
|
79
79
|
|
|
80
|
+
**You MUST write the file `{{outputPath}}` before finishing.**
|
|
81
|
+
|
|
80
82
|
When done, say: "Slice {{sliceId}} planned."
|
|
@@ -8,7 +8,7 @@ Before asking "What do you want to add?", check the existing milestones context
|
|
|
8
8
|
|
|
9
9
|
1. Tell the user which milestones have draft contexts and briefly summarize what each draft contains (read the draft file).
|
|
10
10
|
2. Use `ask_user_questions` to ask per-draft milestone:
|
|
11
|
-
- **"Discuss now"** — Treat this draft as the primary topic. Read the draft content, use it as seed material, and conduct a focused discussion following the standard discussion flow (reflection → investigation → questioning → depth verification → requirements → roadmap). After the discussion, write the full
|
|
11
|
+
- **"Discuss now"** — Treat this draft as the primary topic. Read the draft content, use it as seed material, and conduct a focused discussion following the standard discussion flow (reflection → investigation → questioning → depth verification → requirements → roadmap). After the discussion, call `gsd_summary_save` with the milestone ID and `artifact_type: "CONTEXT"` to write the full context — then delete the `CONTEXT-DRAFT.md` file. The milestone is then ready for auto-planning.
|
|
12
12
|
- **"Leave for later"** — Keep the draft as-is. The user will discuss it in a future session. Auto-mode will continue to pause when it reaches this milestone.
|
|
13
13
|
3. Handle all draft discussions before proceeding to new queue work.
|
|
14
14
|
4. If no drafts exist in the context, skip this section entirely and proceed to "What do you want to add?"
|
|
@@ -108,7 +108,7 @@ The user confirms or corrects before you write. One depth verification per miles
|
|
|
108
108
|
Once the user is satisfied, in a single pass for **each** new milestone:
|
|
109
109
|
|
|
110
110
|
1. Call `gsd_milestone_generate_id` to get the milestone ID — never invent milestone IDs manually. Then `mkdir -p .gsd/milestones/<ID>/slices`.
|
|
111
|
-
2.
|
|
111
|
+
2. Call `gsd_summary_save` with `milestone_id: <ID>`, `artifact_type: "CONTEXT"`, and the full context markdown as `content` — the tool computes the file path and persists to both DB and disk. Capture intent, scope, risks, constraints, integration points, and relevant requirements in the content. Mark the status as "Queued — pending auto-mode execution." **If this milestone depends on other milestones, include YAML frontmatter with `depends_on` in the content:**
|
|
112
112
|
```yaml
|
|
113
113
|
---
|
|
114
114
|
depends_on: [M001, M002]
|
|
@@ -21,7 +21,9 @@ You are executing a GSD quick task — a lightweight, focused unit of work outsi
|
|
|
21
21
|
- Use conventional commit messages (feat:, fix:, refactor:, etc.)
|
|
22
22
|
- Stage only relevant files — never commit secrets or runtime files.
|
|
23
23
|
- Commit logical units separately if the task involves distinct changes.
|
|
24
|
+
- Quick tasks run outside the auto-mode lifecycle — there is no system auto-commit, so commit directly here.
|
|
24
25
|
7. Write a brief summary to `{{summaryPath}}`:
|
|
26
|
+
- Quick tasks operate outside the milestone/slice/task DB structure, so `gsd_summary_save` (which requires a `milestone_id`) cannot be used here. Write the file directly.
|
|
25
27
|
|
|
26
28
|
```markdown
|
|
27
29
|
# Quick Task: {{description}}
|