@tekyzinc/gsd-t 2.50.12 → 2.53.10
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/CHANGELOG.md +24 -0
- package/README.md +379 -372
- package/bin/component-registry.js +250 -0
- package/bin/graph-cgc.js +510 -510
- package/bin/graph-indexer.js +147 -147
- package/bin/graph-overlay.js +195 -195
- package/bin/graph-parsers.js +327 -327
- package/bin/graph-query.js +453 -452
- package/bin/graph-store.js +154 -154
- package/bin/qa-calibrator.js +194 -0
- package/bin/scan-data-collector.js +153 -153
- package/bin/scan-diagrams-generators.js +187 -187
- package/bin/scan-diagrams.js +79 -79
- package/bin/scan-renderer.js +92 -92
- package/bin/scan-report-sections.js +121 -121
- package/bin/scan-report.js +184 -184
- package/bin/scan-schema-parsers.js +199 -199
- package/bin/scan-schema.js +103 -103
- package/bin/token-budget.js +246 -0
- package/commands/Claude-md.md +10 -10
- package/commands/branch.md +15 -15
- package/commands/checkin.md +45 -45
- package/commands/global-change.md +209 -209
- package/commands/gsd-t-audit.md +199 -0
- package/commands/gsd-t-backlog-add.md +94 -94
- package/commands/gsd-t-backlog-edit.md +111 -111
- package/commands/gsd-t-backlog-list.md +63 -63
- package/commands/gsd-t-backlog-move.md +94 -94
- package/commands/gsd-t-backlog-promote.md +123 -123
- package/commands/gsd-t-backlog-remove.md +86 -86
- package/commands/gsd-t-backlog-settings.md +158 -158
- package/commands/gsd-t-complete-milestone.md +528 -515
- package/commands/gsd-t-debug.md +506 -399
- package/commands/gsd-t-discuss.md +174 -174
- package/commands/gsd-t-execute.md +758 -634
- package/commands/gsd-t-feature.md +276 -276
- package/commands/gsd-t-health.md +142 -142
- package/commands/gsd-t-help.md +465 -457
- package/commands/gsd-t-impact.md +302 -302
- package/commands/gsd-t-init.md +320 -280
- package/commands/gsd-t-integrate.md +365 -249
- package/commands/gsd-t-milestone.md +87 -87
- package/commands/gsd-t-partition.md +442 -361
- package/commands/gsd-t-pause.md +82 -82
- package/commands/gsd-t-plan.md +345 -344
- package/commands/gsd-t-populate.md +111 -111
- package/commands/gsd-t-prd.md +326 -326
- package/commands/gsd-t-project.md +211 -211
- package/commands/gsd-t-promote-debt.md +123 -123
- package/commands/gsd-t-prompt.md +137 -137
- package/commands/gsd-t-qa.md +266 -266
- package/commands/gsd-t-quick.md +357 -234
- package/commands/gsd-t-reflect.md +134 -134
- package/commands/gsd-t-resume.md +72 -72
- package/commands/gsd-t-scan.md +615 -615
- package/commands/gsd-t-setup.md +76 -0
- package/commands/gsd-t-status.md +192 -166
- package/commands/gsd-t-test-sync.md +381 -381
- package/commands/gsd-t-triage-and-merge.md +171 -171
- package/commands/gsd-t-verify.md +382 -382
- package/commands/gsd-t-visualize.md +118 -118
- package/commands/gsd-t-wave.md +401 -378
- package/docs/GSD-T-README.md +425 -422
- package/docs/architecture.md +385 -369
- package/docs/harness-design-analysis.md +371 -0
- package/docs/infrastructure.md +205 -205
- package/docs/prd-graph-engine.md +398 -398
- package/docs/prd-gsd2-hybrid.md +559 -559
- package/docs/prd-harness-evolution.md +583 -0
- package/docs/requirements.md +14 -0
- package/docs/workflows.md +226 -226
- package/examples/.gsd-t/domains/example-domain/scope.md +13 -13
- package/package.json +40 -40
- package/scripts/gsd-t-auto-route.js +39 -39
- package/scripts/gsd-t-dashboard-mockup.html +1143 -1143
- package/scripts/gsd-t-dashboard-server.js +171 -171
- package/scripts/gsd-t-dashboard.html +262 -262
- package/scripts/gsd-t-event-writer.js +128 -128
- package/scripts/gsd-t-statusline.js +94 -94
- package/scripts/gsd-t-tools.js +175 -175
- package/templates/CLAUDE-global.md +639 -614
- package/templates/CLAUDE-project.md +24 -0
- package/templates/backlog-settings.md +18 -18
- package/templates/backlog.md +1 -1
- package/templates/progress.md +40 -40
- package/templates/shared-services-contract.md +60 -60
- package/templates/stacks/desktop.ini +2 -2
- package/bin/desktop.ini +0 -2
- package/commands/desktop.ini +0 -2
- package/docs/ci-examples/desktop.ini +0 -2
- package/docs/desktop.ini +0 -2
- package/examples/.gsd-t/contracts/desktop.ini +0 -2
- package/examples/.gsd-t/desktop.ini +0 -2
- package/examples/.gsd-t/domains/desktop.ini +0 -2
- package/examples/.gsd-t/domains/example-domain/desktop.ini +0 -2
- package/examples/desktop.ini +0 -2
- package/examples/rules/desktop.ini +0 -2
- package/scripts/desktop.ini +0 -2
- package/templates/desktop.ini +0 -2
|
@@ -1,634 +1,758 @@
|
|
|
1
|
-
# GSD-T: Execute — Run Domain Tasks (Solo or Parallel)
|
|
2
|
-
|
|
3
|
-
You are the lead agent coordinating task execution across domains. Choose solo or team mode based on the plan.
|
|
4
|
-
|
|
5
|
-
## Step 1: Load State
|
|
6
|
-
|
|
7
|
-
Read:
|
|
8
|
-
1. `CLAUDE.md` — check for **Branch Guard** (`Expected branch` field)
|
|
9
|
-
2. `.gsd-t/progress.md`
|
|
10
|
-
3. `.gsd-t/contracts/` — all contracts
|
|
11
|
-
4. `.gsd-t/contracts/integration-points.md` — dependency graph
|
|
12
|
-
5. `.gsd-t/domains/*/tasks.md` — all task lists
|
|
13
|
-
|
|
14
|
-
**Branch check (before any work):**
|
|
15
|
-
Run `git branch --show-current`. If CLAUDE.md declares an expected branch and you're on a different branch, STOP and warn the user. Do NOT execute tasks on the wrong branch.
|
|
16
|
-
|
|
17
|
-
Identify:
|
|
18
|
-
- Which tasks are already complete (check progress.md)
|
|
19
|
-
- Which tasks are unblocked (no pending dependencies)
|
|
20
|
-
- Which tasks are blocked (waiting on checkpoints)
|
|
21
|
-
|
|
22
|
-
## Step 1.5: Graph-Enhanced Domain Isolation Check (if available)
|
|
23
|
-
|
|
24
|
-
If `.gsd-t/graph/meta.json` exists, run graph queries before execution begins:
|
|
25
|
-
|
|
26
|
-
1. **Reindex** (if stale): `query('reindex', { force: false })` — ensure graph reflects current code
|
|
27
|
-
2. **Domain boundary check**: For each domain about to execute, `query('getEntitiesByDomain', { domain })` — verify the domain's entities match its scope.md
|
|
28
|
-
3. **Pre-execution snapshot**: Record entity counts per domain — after execution, compare to detect scope creep (domain agent modified entities outside its domain)
|
|
29
|
-
4. **Cross-domain dependencies**: `query('getDomainBoundaryViolations', {})` — flag existing violations before work begins so they aren't confused with new violations introduced during execution
|
|
30
|
-
|
|
31
|
-
After each domain completes, re-run `getDomainBoundaryViolations` and diff against pre-execution snapshot. If new violations appear, flag them immediately before proceeding to the next domain.
|
|
32
|
-
|
|
33
|
-
## Step 2: QA Subagent
|
|
34
|
-
|
|
35
|
-
In solo mode, QA runs inside each domain subagent (see Step 3). In team mode, the lead spawns QA subagents at each domain checkpoint using the pattern below.
|
|
36
|
-
|
|
37
|
-
**QA
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
-
|
|
74
|
-
|
|
75
|
-
**
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
-
|
|
295
|
-
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
-
|
|
317
|
-
-
|
|
318
|
-
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
-
|
|
385
|
-
- **
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
**
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
**
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
-
|
|
425
|
-
|
|
426
|
-
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
```
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
After
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
2.
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
1.
|
|
569
|
-
2.
|
|
570
|
-
3.
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
1
|
+
# GSD-T: Execute — Run Domain Tasks (Solo or Parallel)
|
|
2
|
+
|
|
3
|
+
You are the lead agent coordinating task execution across domains. Choose solo or team mode based on the plan.
|
|
4
|
+
|
|
5
|
+
## Step 1: Load State
|
|
6
|
+
|
|
7
|
+
Read:
|
|
8
|
+
1. `CLAUDE.md` — check for **Branch Guard** (`Expected branch` field)
|
|
9
|
+
2. `.gsd-t/progress.md`
|
|
10
|
+
3. `.gsd-t/contracts/` — all contracts
|
|
11
|
+
4. `.gsd-t/contracts/integration-points.md` — dependency graph
|
|
12
|
+
5. `.gsd-t/domains/*/tasks.md` — all task lists
|
|
13
|
+
|
|
14
|
+
**Branch check (before any work):**
|
|
15
|
+
Run `git branch --show-current`. If CLAUDE.md declares an expected branch and you're on a different branch, STOP and warn the user. Do NOT execute tasks on the wrong branch.
|
|
16
|
+
|
|
17
|
+
Identify:
|
|
18
|
+
- Which tasks are already complete (check progress.md)
|
|
19
|
+
- Which tasks are unblocked (no pending dependencies)
|
|
20
|
+
- Which tasks are blocked (waiting on checkpoints)
|
|
21
|
+
|
|
22
|
+
## Step 1.5: Graph-Enhanced Domain Isolation Check (if available)
|
|
23
|
+
|
|
24
|
+
If `.gsd-t/graph/meta.json` exists, run graph queries before execution begins:
|
|
25
|
+
|
|
26
|
+
1. **Reindex** (if stale): `query('reindex', { force: false })` — ensure graph reflects current code
|
|
27
|
+
2. **Domain boundary check**: For each domain about to execute, `query('getEntitiesByDomain', { domain })` — verify the domain's entities match its scope.md
|
|
28
|
+
3. **Pre-execution snapshot**: Record entity counts per domain — after execution, compare to detect scope creep (domain agent modified entities outside its domain)
|
|
29
|
+
4. **Cross-domain dependencies**: `query('getDomainBoundaryViolations', {})` — flag existing violations before work begins so they aren't confused with new violations introduced during execution
|
|
30
|
+
|
|
31
|
+
After each domain completes, re-run `getDomainBoundaryViolations` and diff against pre-execution snapshot. If new violations appear, flag them immediately before proceeding to the next domain.
|
|
32
|
+
|
|
33
|
+
## Step 2: QA Subagent
|
|
34
|
+
|
|
35
|
+
In solo mode, QA runs inside each domain subagent (see Step 3). In team mode, the lead spawns QA subagents at each domain checkpoint using the pattern below.
|
|
36
|
+
|
|
37
|
+
**QA Calibration Injection** — Before spawning QA, check for known weak spots:
|
|
38
|
+
|
|
39
|
+
Run via Bash:
|
|
40
|
+
`node -e "const qc = require('./bin/qa-calibrator.js'); const inj = qc.generateQAInjection('.'); if(inj) process.stdout.write(inj);" 2>/dev/null`
|
|
41
|
+
|
|
42
|
+
If the command produces output (non-empty), store it as `QA_INJECTION` and prepend it to the QA subagent prompt below. If the file doesn't exist or produces no output, skip silently and proceed normally.
|
|
43
|
+
|
|
44
|
+
**QA subagent prompt:**
|
|
45
|
+
```
|
|
46
|
+
Task subagent (general-purpose, model: sonnet):
|
|
47
|
+
"{QA_INJECTION — if non-empty, insert here as a preamble section before the instructions below}
|
|
48
|
+
Run the full test suite for this project and report pass/fail counts.
|
|
49
|
+
Read .gsd-t/contracts/ for contract definitions.
|
|
50
|
+
Write edge case tests for any new code paths in this task: {task description}.
|
|
51
|
+
Report: test pass/fail status and any coverage gaps found."
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
If QA found issues, append each to `.gsd-t/qa-issues.md` (create with header `| Date | Command | Step | Model | Duration(s) | Severity | Finding |` if missing):
|
|
55
|
+
`| {DT_START} | gsd-t-execute | Step 2 | haiku | {DURATION}s | {severity} | {finding} |`
|
|
56
|
+
|
|
57
|
+
## Step 3: Choose Execution Mode
|
|
58
|
+
|
|
59
|
+
### Wave Scheduling (read first)
|
|
60
|
+
|
|
61
|
+
Before choosing solo or team mode, read the `## Wave Execution Groups` section in `.gsd-t/contracts/integration-points.md` (added by the plan phase).
|
|
62
|
+
|
|
63
|
+
**If wave groups are present**:
|
|
64
|
+
- Execute wave-by-wave: complete all tasks in Wave 1 before starting Wave 2
|
|
65
|
+
- Within each wave, tasks marked as parallel-safe can run concurrently (team mode) or be interleaved (solo mode)
|
|
66
|
+
- At each wave boundary: run the CHECKPOINT — verify contract compliance — before proceeding
|
|
67
|
+
- File conflict detection: if two tasks in the same wave list the same file in their `scope.md` ownership, move one to the next wave
|
|
68
|
+
|
|
69
|
+
**If no wave groups are defined** (older plans): fall back to the `Execution Order` list.
|
|
70
|
+
|
|
71
|
+
### Solo Mode (default) — Domain Task-Dispatcher Pattern
|
|
72
|
+
|
|
73
|
+
Each domain's work runs via a lightweight domain task-dispatcher. The dispatcher spawns one Task subagent PER TASK within that domain, giving each task a completely fresh context window with only the minimum required context. The orchestrator (this agent) stays lightweight — it only spawns dispatchers, collects summaries, verifies checkpoints, and updates progress.
|
|
74
|
+
|
|
75
|
+
**Context provided to each task subagent (fresh-dispatch-contract.md payload):**
|
|
76
|
+
- `scope.md` for the domain
|
|
77
|
+
- Relevant contracts (only those referenced by the task)
|
|
78
|
+
- The single task from `tasks.md`
|
|
79
|
+
- Graph context for the task's files (if available)
|
|
80
|
+
- Up to 5 prior task summaries (10-20 lines each, most recent first)
|
|
81
|
+
- Past failure/learning entries for this domain (max 5 lines)
|
|
82
|
+
|
|
83
|
+
**OBSERVABILITY LOGGING (MANDATORY) — repeat for every task subagent spawn:**
|
|
84
|
+
|
|
85
|
+
Before spawning — run via Bash:
|
|
86
|
+
`T_START=$(date +%s) && DT_START=$(date +"%Y-%m-%d %H:%M") && TOK_START=${CLAUDE_CONTEXT_TOKENS_USED:-0} && TOK_MAX=${CLAUDE_CONTEXT_TOKENS_MAX:-200000}`
|
|
87
|
+
|
|
88
|
+
After subagent returns — run via Bash:
|
|
89
|
+
`T_END=$(date +%s) && DT_END=$(date +"%Y-%m-%d %H:%M") && TOK_END=${CLAUDE_CONTEXT_TOKENS_USED:-0} && DURATION=$((T_END-T_START))`
|
|
90
|
+
|
|
91
|
+
Compute tokens and compaction:
|
|
92
|
+
- No compaction (TOK_END >= TOK_START): `TOKENS=$((TOK_END-TOK_START))`, COMPACTED=null
|
|
93
|
+
- Compaction detected (TOK_END < TOK_START): `TOKENS=$(((TOK_MAX-TOK_START)+TOK_END))`, COMPACTED=$DT_END
|
|
94
|
+
|
|
95
|
+
Compute context utilization — run via Bash:
|
|
96
|
+
`if [ "${CLAUDE_CONTEXT_TOKENS_MAX:-0}" -gt 0 ]; then CTX_PCT=$(echo "scale=1; ${CLAUDE_CONTEXT_TOKENS_USED:-0} * 100 / ${CLAUDE_CONTEXT_TOKENS_MAX}" | bc); else CTX_PCT="N/A"; fi`
|
|
97
|
+
|
|
98
|
+
Alert on context thresholds (display to user inline):
|
|
99
|
+
- If CTX_PCT is a number and >= 85: `echo "🔴 CRITICAL: Context at ${CTX_PCT}% — compaction likely. Task MUST be split."`
|
|
100
|
+
- If CTX_PCT is a number and >= 70: `echo "⚠️ WARNING: Context at ${CTX_PCT}% — approaching compaction threshold. Consider splitting in plan."`
|
|
101
|
+
|
|
102
|
+
Append to `.gsd-t/token-log.md` (create with header `| Datetime-start | Datetime-end | Command | Step | Model | Duration(s) | Notes | Tokens | Compacted | Domain | Task | Ctx% |` if missing):
|
|
103
|
+
`| {DT_START} | {DT_END} | gsd-t-execute | task:{task-id} | sonnet | {DURATION}s | {pass/fail} | {TOKENS} | {COMPACTED} | {domain-name} | task-{task-id} | {CTX_PCT} |`
|
|
104
|
+
|
|
105
|
+
**For each domain (in wave order), run the domain task-dispatcher:**
|
|
106
|
+
|
|
107
|
+
**Token Budget Check (before dispatching each domain's tasks):**
|
|
108
|
+
|
|
109
|
+
Run via Bash:
|
|
110
|
+
`node -e "const tb = require('./bin/token-budget.js'); const s = tb.getSessionStatus('.'); const d = tb.getDegradationActions(s.threshold, '.'); process.stdout.write(JSON.stringify({threshold: s.threshold, actions: d}));" 2>/dev/null`
|
|
111
|
+
|
|
112
|
+
Apply the result:
|
|
113
|
+
- `threshold: 'normal'` or file missing → skip silently, proceed with standard model assignments
|
|
114
|
+
- `threshold: 'downgrade'` → apply model overrides from `actions.modelOverride` (e.g., downgrade opus tasks to sonnet)
|
|
115
|
+
- `threshold: 'conserve'` → checkpoint progress to `.gsd-t/progress.md` and skip non-essential operations (Red Team, doc-ripple) for this domain
|
|
116
|
+
- `threshold: 'stop'` → checkpoint all progress, output: "Token budget exhausted — progress saved. Resume after session reset.", and halt execution for remaining domains
|
|
117
|
+
|
|
118
|
+
**Pre-dispatch experience retrieval (before dispatching each domain's tasks):**
|
|
119
|
+
Run via Bash:
|
|
120
|
+
`grep -i "\[failure\]\|\[learning\]" .gsd-t/progress.md | grep -i "{domain-name}" | tail -5`
|
|
121
|
+
|
|
122
|
+
If results found:
|
|
123
|
+
- Store as `PAST_FAILURES` — prepend to each task subagent prompt (max 5 lines)
|
|
124
|
+
- Write event via Bash: `node ~/.claude/scripts/gsd-t-event-writer.js --type experience_retrieval --command gsd-t-execute --reasoning "{N past failures found for {domain-name}}" --outcome null || true`
|
|
125
|
+
|
|
126
|
+
If no results found: proceed normally (no warning block, no event write).
|
|
127
|
+
|
|
128
|
+
**Pre-flight intelligence check (before dispatching each domain's tasks):**
|
|
129
|
+
Run via Bash:
|
|
130
|
+
`node -e "const m = require('./bin/metrics-collector.js'); const w = m.getPreFlightWarnings('{domain-name}'); if(w.length) w.forEach(x => console.log('⚠️ ' + x));" 2>/dev/null || true`
|
|
131
|
+
|
|
132
|
+
Display any warnings inline (non-blocking — execution proceeds regardless).
|
|
133
|
+
|
|
134
|
+
**Active Rule Injection (before dispatching each domain's tasks):**
|
|
135
|
+
Run via Bash:
|
|
136
|
+
`node -e "const re = require('./bin/rule-engine.js'); const m = re.evaluateRules('{domain-name}', { projectDir: '.' }); if(m.length) m.forEach(x => console.log('RULE: ' + x.rule.name + ' — ' + x.rule.description + ' [' + x.severity + ']')); else console.log('No active rules for {domain-name}');" 2>/dev/null || true`
|
|
137
|
+
|
|
138
|
+
If rules fire: inject up to 10 lines of rule warnings into each task subagent prompt (concise format: `RULE: {name} — {description}`). These inform the subagent of known patterns — non-blocking.
|
|
139
|
+
If no rules fire: log "No active rules for {domain-name}" and continue.
|
|
140
|
+
|
|
141
|
+
**Stack Rules Detection (before spawning subagent):**
|
|
142
|
+
|
|
143
|
+
Run via Bash to detect project stack and collect matching rules. Local overrides in `.gsd-t/stacks/` take precedence over global templates — if a project has `.gsd-t/stacks/react.md`, it replaces the global `react.md` for that project.
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
GSD_T_DIR=$(npm root -g 2>/dev/null)/@tekyzinc/gsd-t
|
|
147
|
+
STACKS_DIR="$GSD_T_DIR/templates/stacks"
|
|
148
|
+
LOCAL_STACKS=".gsd-t/stacks"
|
|
149
|
+
STACK_RULES=""
|
|
150
|
+
|
|
151
|
+
# Helper: read local override if exists, else global
|
|
152
|
+
_sf() { local n=$(basename "$1"); [ -f "$LOCAL_STACKS/$n" ] && cat "$LOCAL_STACKS/$n" || cat "$1"; }
|
|
153
|
+
|
|
154
|
+
# Helper: append a stack file to STACK_RULES
|
|
155
|
+
_add() { [ -f "$STACKS_DIR/$1" ] && STACK_RULES="${STACK_RULES}$(_sf "$STACKS_DIR/$1")"$'\n\n'; }
|
|
156
|
+
|
|
157
|
+
if [ -d "$STACKS_DIR" ]; then
|
|
158
|
+
# Universal rules (_ prefix — always injected)
|
|
159
|
+
for f in "$STACKS_DIR"/_*.md; do [ -f "$f" ] && STACK_RULES="${STACK_RULES}$(_sf "$f")"$'\n\n'; done
|
|
160
|
+
|
|
161
|
+
# Package.json-based detection
|
|
162
|
+
if [ -f "package.json" ]; then
|
|
163
|
+
grep -q '"react-native"' package.json 2>/dev/null && _add react-native.md
|
|
164
|
+
grep -q '"react"' package.json 2>/dev/null && ! grep -q '"react-native"' package.json 2>/dev/null && _add react.md
|
|
165
|
+
grep -q '"next"' package.json 2>/dev/null && _add nextjs.md
|
|
166
|
+
grep -q '"vue"' package.json 2>/dev/null && _add vue.md
|
|
167
|
+
(grep -q '"typescript"' package.json 2>/dev/null || [ -f "tsconfig.json" ]) && _add typescript.md
|
|
168
|
+
grep -qE '"(express|fastify|hono|koa)"' package.json 2>/dev/null && _add node-api.md && _add rest-api.md
|
|
169
|
+
grep -q '"tailwindcss"' package.json 2>/dev/null && _add tailwind.md
|
|
170
|
+
grep -q '"vite"' package.json 2>/dev/null && _add vite.md
|
|
171
|
+
grep -q '"@supabase/supabase-js"' package.json 2>/dev/null && _add supabase.md
|
|
172
|
+
grep -q '"firebase"' package.json 2>/dev/null && _add firebase.md
|
|
173
|
+
grep -qE '"(graphql|@apollo/client|urql)"' package.json 2>/dev/null && _add graphql.md
|
|
174
|
+
grep -q '"zustand"' package.json 2>/dev/null && _add zustand.md
|
|
175
|
+
grep -q '"@reduxjs/toolkit"' package.json 2>/dev/null && _add redux.md
|
|
176
|
+
grep -q '"neo4j-driver"' package.json 2>/dev/null && _add neo4j.md
|
|
177
|
+
grep -qE '"(pg|prisma|drizzle-orm|knex)"' package.json 2>/dev/null && _add postgresql.md
|
|
178
|
+
grep -qE '"(prisma|@prisma/client)"' package.json 2>/dev/null && _add prisma.md
|
|
179
|
+
grep -qE '"(bullmq|bull|amqplib|@aws-sdk/client-sqs|bee-queue|agenda)"' package.json 2>/dev/null && _add queues.md
|
|
180
|
+
grep -qE '"(openai|anthropic|@anthropic-ai/sdk|langchain|llama-index|@google/generative-ai)"' package.json 2>/dev/null && _add llm.md
|
|
181
|
+
fi
|
|
182
|
+
|
|
183
|
+
# File-based detection (no package.json needed)
|
|
184
|
+
([ -f "requirements.txt" ] || [ -f "pyproject.toml" ] || [ -f "Pipfile" ]) && _add python.md
|
|
185
|
+
([ -f "requirements.txt" ] && grep -q "psycopg" requirements.txt 2>/dev/null || [ -f "pyproject.toml" ] && grep -q "psycopg" pyproject.toml 2>/dev/null) && _add postgresql.md
|
|
186
|
+
([ -f "requirements.txt" ] && grep -q "neo4j" requirements.txt 2>/dev/null) && _add neo4j.md
|
|
187
|
+
([ -f "requirements.txt" ] && grep -q "fastapi" requirements.txt 2>/dev/null || [ -f "pyproject.toml" ] && grep -q "fastapi" pyproject.toml 2>/dev/null) && _add fastapi.md
|
|
188
|
+
([ -f "requirements.txt" ] && grep -qE "(celery|dramatiq|rq|arq)" requirements.txt 2>/dev/null || [ -f "pyproject.toml" ] && grep -qE "(celery|dramatiq|rq|arq)" pyproject.toml 2>/dev/null) && _add queues.md
|
|
189
|
+
([ -f "requirements.txt" ] && grep -qE "(openai|anthropic|langchain|llama.index)" requirements.txt 2>/dev/null || [ -f "pyproject.toml" ] && grep -qE "(openai|anthropic|langchain|llama.index)" pyproject.toml 2>/dev/null) && _add llm.md
|
|
190
|
+
[ -f "pubspec.yaml" ] && _add flutter.md
|
|
191
|
+
[ -f "Dockerfile" ] && _add docker.md
|
|
192
|
+
[ -d ".github/workflows" ] && _add github-actions.md
|
|
193
|
+
([ -f "playwright.config.ts" ] || [ -f "playwright.config.js" ]) && _add playwright.md
|
|
194
|
+
[ -f "go.mod" ] && _add go.md
|
|
195
|
+
[ -f "Cargo.toml" ] && _add rust.md
|
|
196
|
+
fi
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
If STACK_RULES is non-empty, append to the subagent prompt:
|
|
200
|
+
```
|
|
201
|
+
## Stack Rules (MANDATORY — violations fail this task)
|
|
202
|
+
|
|
203
|
+
{STACK_RULES}
|
|
204
|
+
|
|
205
|
+
These standards have the same enforcement weight as contract compliance.
|
|
206
|
+
Violations are task failures, not warnings.
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
If STACK_RULES is empty (no templates/stacks/ dir or no matches), skip silently.
|
|
210
|
+
|
|
211
|
+
**Domain task-dispatcher (lightweight — sequences tasks, passes summaries):**
|
|
212
|
+
|
|
213
|
+
For each task in `.gsd-t/domains/{domain-name}/tasks.md` (in order, skip completed):
|
|
214
|
+
|
|
215
|
+
1. Load prior summaries: Read up to 5 most recent `.gsd-t/domains/{domain-name}/task-*-summary.md` files (10-20 lines each)
|
|
216
|
+
2. Load graph context (if `.gsd-t/graph/meta.json` exists): query task's files for relevant graph context
|
|
217
|
+
3. Display: `⚙ [sonnet] gsd-t-execute → domain: {domain-name}, task-{task-id}`
|
|
218
|
+
4. Run observability Bash (T_START / DT_START / TOK_START / TOK_MAX)
|
|
219
|
+
5. Spawn task subagent:
|
|
220
|
+
|
|
221
|
+
```
|
|
222
|
+
Task subagent (general-purpose, model: sonnet, mode: bypassPermissions):
|
|
223
|
+
"You are executing a single task for the {domain-name} domain.
|
|
224
|
+
|
|
225
|
+
{PAST_FAILURES block if any — ## ⚠️ Past Failures (read before acting)\n{lines}}
|
|
226
|
+
|
|
227
|
+
## Your Task
|
|
228
|
+
{full task block from tasks.md — id, description, files, contract refs, dependencies, acceptance criteria}
|
|
229
|
+
|
|
230
|
+
## Domain Scope
|
|
231
|
+
{contents of .gsd-t/domains/{domain-name}/scope.md}
|
|
232
|
+
|
|
233
|
+
## Relevant Contracts
|
|
234
|
+
{contents of each contract file referenced by this task}
|
|
235
|
+
|
|
236
|
+
## Graph Context (if available)
|
|
237
|
+
{graph query results for this task's files — omit section if unavailable}
|
|
238
|
+
|
|
239
|
+
## Prior Task Summaries (most recent first, max 5)
|
|
240
|
+
{contents of task-{N}-summary.md files — 10-20 lines each}
|
|
241
|
+
|
|
242
|
+
## Stack Rules
|
|
243
|
+
{STACK_RULES if non-empty — omit entire section if empty}
|
|
244
|
+
|
|
245
|
+
## Instructions
|
|
246
|
+
|
|
247
|
+
Execute the task above:
|
|
248
|
+
1. Read the task description, files list, and contract refs carefully
|
|
249
|
+
2. Read relevant contracts — implement EXACTLY what they specify
|
|
250
|
+
3. Destructive Action Guard: if the task involves DROP TABLE, schema changes that lose
|
|
251
|
+
data, removing working modules, or replacing architecture patterns → write a
|
|
252
|
+
NEEDS-APPROVAL entry to .gsd-t/deferred-items.md, skip the task, stop here
|
|
253
|
+
4. Implement the task
|
|
254
|
+
5. Verify acceptance criteria are met
|
|
255
|
+
6. Write comprehensive tests (MANDATORY — no feature code without test code):
|
|
256
|
+
- Unit/integration: happy path + edge cases + error cases for every new/changed function
|
|
257
|
+
- Playwright E2E (if UI/routes/flows changed): new specs for new features, cover
|
|
258
|
+
all modes, form validation, empty/loading/error states, common edge cases
|
|
259
|
+
- If no test framework exists: set one up as part of this task
|
|
260
|
+
- If the project has a UI but no Playwright E2E specs exist for the features being
|
|
261
|
+
touched: WRITE THEM. A placeholder spec is not sufficient — write real E2E tests
|
|
262
|
+
that exercise the actual UI functionality being built or changed.
|
|
263
|
+
- **FUNCTIONAL E2E TESTS — NOT LAYOUT TESTS (MANDATORY)**:
|
|
264
|
+
E2E tests that only check element existence (isVisible, isEnabled, toBeAttached)
|
|
265
|
+
are LAYOUT tests, not functional tests. Layout tests pass even when every feature
|
|
266
|
+
is broken. Every Playwright spec MUST verify functional behavior:
|
|
267
|
+
a. **State changes**: After an action (click, type, submit), assert the app STATE
|
|
268
|
+
changed — not just that the button was clickable. Example: clicking a tab must
|
|
269
|
+
load different content; verify the content changed, not just that the tab exists.
|
|
270
|
+
b. **Data flow**: Form submissions must verify data arrived (API call made, response
|
|
271
|
+
rendered, list updated). Don't just assert the form rendered.
|
|
272
|
+
c. **Navigation/routing**: Tab/page switches must verify the NEW content loaded.
|
|
273
|
+
Assert on content unique to the destination, not the navigation element itself.
|
|
274
|
+
d. **Interactive widgets**: Terminals must accept input and produce output. Editors
|
|
275
|
+
must save changes. Panels must load their functional content after opening.
|
|
276
|
+
e. **Network integration**: If a feature requires WebSocket/API connection, verify
|
|
277
|
+
the connection status changes (e.g., "Disconnected" → "Connected") and that
|
|
278
|
+
messages flow through the connection.
|
|
279
|
+
f. **Error recovery**: Don't just check error messages render — verify the app
|
|
280
|
+
recovers (retry button works, form can be resubmitted, etc.).
|
|
281
|
+
A test that would pass on an empty HTML page with the right element IDs is useless.
|
|
282
|
+
Every assertion must prove the FEATURE WORKS, not that the ELEMENT EXISTS.
|
|
283
|
+
7. Run ALL test suites — this is NOT optional, not conditional, not "if applicable":
|
|
284
|
+
a. Detect configured test runners: check for vitest/jest config, playwright.config.*, cypress.config.*
|
|
285
|
+
b. Run EVERY detected suite. Unit tests alone are NEVER sufficient when E2E exists.
|
|
286
|
+
c. If `playwright.config.*` exists → run `npx playwright test` (full suite, not just affected specs)
|
|
287
|
+
d. If E2E tests fail → fix (up to 2 attempts) before proceeding
|
|
288
|
+
e. Report ALL suite results: "Unit: X/Y pass | E2E: X/Y pass" — never report just one
|
|
289
|
+
8. Run Pre-Commit Gate checklist from CLAUDE.md — update all affected docs BEFORE committing
|
|
290
|
+
9. Commit immediately: feat({domain-name}/task-{task-id}): {description}
|
|
291
|
+
10. Update .gsd-t/progress.md — mark this task complete; prefix the Decision Log entry:
|
|
292
|
+
- Completed successfully on first attempt → prefix `[success]`
|
|
293
|
+
- Completed after a fix → prefix `[learning]`
|
|
294
|
+
- Deferred to .gsd-t/deferred-items.md → prefix `[deferred]`
|
|
295
|
+
- Failed after 3 attempts → prefix `[failure]`
|
|
296
|
+
11. Spawn QA subagent (model: sonnet) after completing the task:
|
|
297
|
+
'Run ALL configured test suites — detect and run every one:
|
|
298
|
+
a. Unit tests (vitest/jest/mocha): run the full suite, report pass/fail counts
|
|
299
|
+
b. E2E tests: check for playwright.config.* or cypress.config.* — if found, run the FULL E2E suite
|
|
300
|
+
c. NEVER skip E2E when a config file exists. Running only unit tests is a QA FAILURE.
|
|
301
|
+
d. Read .gsd-t/contracts/ for contract definitions. Check contract compliance.
|
|
302
|
+
e. AUDIT E2E test quality: Review each Playwright spec — if any test only checks
|
|
303
|
+
element existence (isVisible, toBeAttached, toBeEnabled) without verifying functional
|
|
304
|
+
behavior (state changes, data loaded, content updated after actions), flag it as
|
|
305
|
+
"SHALLOW TEST — needs functional assertions" in the gap report. A test suite where
|
|
306
|
+
every spec passes but no feature actually works is a QA FAILURE.
|
|
307
|
+
Report format: "Unit: X/Y pass | E2E: X/Y pass (or N/A if no config) | Contract: compliant/violations | Shallow tests: N (list) | Stack rules: compliant/N violations"
|
|
308
|
+
f. Validate compliance with Stack Rules (if injected in the work subagent's prompt).
|
|
309
|
+
Stack rule violations have the same severity as contract violations — report as failures, not warnings.
|
|
310
|
+
|
|
311
|
+
## Exploratory Testing (if Playwright MCP available)
|
|
312
|
+
|
|
313
|
+
After all scripted tests pass:
|
|
314
|
+
1. Check if Playwright MCP is registered in Claude Code settings (look for "playwright" in mcpServers)
|
|
315
|
+
2. If available: spend 3 minutes on interactive exploration using Playwright MCP
|
|
316
|
+
- Try variations of happy paths with unexpected inputs
|
|
317
|
+
- Probe for race conditions, double-submits, empty states
|
|
318
|
+
- Test accessibility (keyboard navigation, screen reader flow)
|
|
319
|
+
3. Tag all findings [EXPLORATORY] in your report and append to .gsd-t/qa-issues.md with [EXPLORATORY] prefix
|
|
320
|
+
4. If Playwright MCP is not available: skip this section silently
|
|
321
|
+
Note: Exploratory findings do NOT count against the scripted test pass/fail ratio.'
|
|
322
|
+
If QA fails OR shallow tests are found, fix before proceeding. Append issues to .gsd-t/qa-issues.md.
|
|
323
|
+
12. Write task summary to .gsd-t/domains/{domain-name}/task-{task-id}-summary.md:
|
|
324
|
+
## Task {task-id} Summary — {domain-name}
|
|
325
|
+
- **Status**: PASS | FAIL
|
|
326
|
+
- **Files modified**: {list}
|
|
327
|
+
- **Constraints discovered**: {any new constraints or surprises}
|
|
328
|
+
- **Tests**: {pass/fail count}
|
|
329
|
+
- **Notes**: {10-20 lines max — key decisions, patterns, warnings}
|
|
330
|
+
|
|
331
|
+
Deviation rules:
|
|
332
|
+
- Bug blocking progress → fix, max 3 attempts; after fix attempt 2 fails:
|
|
333
|
+
1. Write current failure context to .gsd-t/debug-state.jsonl via appendEntry
|
|
334
|
+
2. Log: "Delegating to headless debug-loop (2 in-context attempts exhausted)"
|
|
335
|
+
3. Run: `gsd-t headless --debug-loop --max-iterations 15`
|
|
336
|
+
4. Check exit code:
|
|
337
|
+
- 0: Tests pass, continue with task
|
|
338
|
+
- 1/4: Log to .gsd-t/deferred-items.md and stop (report FAIL in summary)
|
|
339
|
+
- 3: Report error, stop
|
|
340
|
+
If still blocked after debug-loop, log to .gsd-t/deferred-items.md and stop (report FAIL in summary)
|
|
341
|
+
- Missing dependency → add minimum needed, document in commit message
|
|
342
|
+
- Non-trivial blocker → log to .gsd-t/deferred-items.md
|
|
343
|
+
- Architectural change required → write NEEDS-APPROVAL to .gsd-t/deferred-items.md,
|
|
344
|
+
skip the task, stop here — never self-approve structural changes
|
|
345
|
+
|
|
346
|
+
Report back:
|
|
347
|
+
- Task: {task-id}
|
|
348
|
+
- Status: PASS | FAIL
|
|
349
|
+
- Files modified: {list}
|
|
350
|
+
- Tests: {pass/fail count}
|
|
351
|
+
- Commit: {hash}
|
|
352
|
+
- Deferred items (if any)"
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
6. After task subagent returns:
|
|
356
|
+
- Run observability Bash (T_END / TOK_END / DURATION / CTX_PCT)
|
|
357
|
+
- Append to token-log.md (per-task row)
|
|
358
|
+
- Alert on CTX_PCT thresholds (display to user inline)
|
|
359
|
+
- **Emit task-metrics record** — run via Bash:
|
|
360
|
+
`node bin/metrics-collector.js --milestone {milestone} --domain {domain-name} --task task-{task-id} --command execute --duration_s $DURATION --tokens_used $TOKENS --context_pct ${CTX_PCT:-0} --pass {true|false} --fix_cycles {0|N} --signal_type {pass-through|fix-cycle} --notes "{brief outcome}" 2>/dev/null || true`
|
|
361
|
+
Signal type: `pass-through` if task passed on first attempt; `fix-cycle` if rework was needed.
|
|
362
|
+
- **Emit task_complete event** — run via Bash:
|
|
363
|
+
`node ~/.claude/scripts/gsd-t-event-writer.js --type task_complete --command gsd-t-execute --reasoning "signal_type={signal_type}, domain={domain-name}" --outcome {success|failure} || true`
|
|
364
|
+
- Check `.gsd-t/deferred-items.md` for `NEEDS-APPROVAL` — if found, STOP and present to user before proceeding to the next task
|
|
365
|
+
- Read the task summary from `.gsd-t/domains/{domain-name}/task-{task-id}-summary.md` to use as prior summary for the next task
|
|
366
|
+
|
|
367
|
+
**After all tasks in a domain complete (orchestrator responsibilities):**
|
|
368
|
+
1. Check `.gsd-t/deferred-items.md` for any `NEEDS-APPROVAL` entries — if found, STOP and present to user before spawning the next domain
|
|
369
|
+
2. If a CHECKPOINT is reached per `integration-points.md`, verify contract compliance (see Step 4) before proceeding to the next wave/domain
|
|
370
|
+
3. Update `.gsd-t/progress.md` with domain completion status
|
|
371
|
+
4. **Adaptive Replan Check** (per `adaptive-replan-contract.md`) — run after EVERY domain completes, before dispatching the next domain:
|
|
372
|
+
|
|
373
|
+
a. **Read domain summaries**: Read all `.gsd-t/domains/{completed-domain}/task-*-summary.md` files. Extract every `**Constraints discovered**:` field. If ALL are empty or "none", skip to the next domain (fast path — no replan needed).
|
|
374
|
+
|
|
375
|
+
b. **Assess affected domains** — two modes:
|
|
376
|
+
- **Graph available** (`.gsd-t/graph/meta.json` exists): For each changed module mentioned in the constraints, run `query('getImporters', { file })` to find which remaining domains import it. Also run `query('getDomainBoundaryViolations', {})` to check if constraint changes affect domain boundaries. Scope replan to ONLY those domains.
|
|
377
|
+
- **Graph unavailable** (fallback): Check ALL remaining unexecuted domains' `tasks.md` files — less precise but functional.
|
|
378
|
+
|
|
379
|
+
c. **Check for invalidated assumptions**: Read each affected remaining domain's `.gsd-t/domains/{domain}/tasks.md`. For each task, check whether any assumption is invalidated by the discovered constraints (e.g., wrong column name, deprecated API, wrong library, missing prerequisite, throughput limits).
|
|
380
|
+
|
|
381
|
+
d. **If invalidated assumptions found**: Revise the affected domain's `tasks.md` on disk. Append a Revision block at the end of the file (do NOT overwrite existing tasks — append only):
|
|
382
|
+
```markdown
|
|
383
|
+
## Revision (Replan Cycle {N})
|
|
384
|
+
- **Trigger**: {completed-domain} — constraint discovered during execution
|
|
385
|
+
- **Constraint**: {exact constraint text from summary}
|
|
386
|
+
- **Changes**: {what was revised in this domain's tasks — list specific task IDs and what changed}
|
|
387
|
+
- **Rationale**: {why this revision is needed — what would break without it}
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
e. **Increment replan cycle counter** (track as `REPLAN_CYCLES` in orchestrator state, starting at 0).
|
|
391
|
+
|
|
392
|
+
f. **Cycle guard**: If `REPLAN_CYCLES > 2`, STOP and pause for user input:
|
|
393
|
+
"Replan cycle limit (2) exceeded. {N} constraints are still propagating. Please review `.gsd-t/domains/*/tasks.md` and resolve manually, then re-run execute."
|
|
394
|
+
|
|
395
|
+
g. **Log to Decision Log** in `.gsd-t/progress.md`: `- {date}: [replan] Cycle {N} — {completed-domain} constraint propagated to {list of affected domains}: {brief constraint summary}`
|
|
396
|
+
|
|
397
|
+
h. The revised `tasks.md` files are now on disk — the next domain's dispatcher will read the updated version automatically (disk-based handoff, no in-memory state sharing needed).
|
|
398
|
+
|
|
399
|
+
### Team Mode (when agent teams are enabled)
|
|
400
|
+
Spawn teammates for domains within the same wave. Only domains in the same wave can run in parallel — do not spawn teammates for domains in different waves simultaneously. Each teammate uses the **domain task-dispatcher pattern** — one subagent per task within their domain (same as solo mode).
|
|
401
|
+
|
|
402
|
+
```
|
|
403
|
+
Create an agent team for execution:
|
|
404
|
+
|
|
405
|
+
ALL TEAMMATES must read before starting:
|
|
406
|
+
1. CLAUDE.md — project conventions (CRITICAL)
|
|
407
|
+
2. Your domain's scope.md — what you own
|
|
408
|
+
3. Your domain's constraints.md — what you must/must not do
|
|
409
|
+
4. ALL files in .gsd-t/contracts/ — your interfaces
|
|
410
|
+
5. Your domain's tasks.md — your work
|
|
411
|
+
|
|
412
|
+
RULES FOR ALL TEAMMATES:
|
|
413
|
+
- **Destructive Action Guard**: NEVER drop tables, remove columns, delete data, replace architecture patterns, or remove working modules without messaging the lead first. The lead must get user approval before any destructive action proceeds.
|
|
414
|
+
- Only modify files listed in your domain's scope.md
|
|
415
|
+
- Implement interfaces EXACTLY as specified in contracts
|
|
416
|
+
- **Write comprehensive FUNCTIONAL tests with every task** — no feature code without test code:
|
|
417
|
+
- Unit/integration tests: happy path + edge cases + error cases for every new/changed function
|
|
418
|
+
- Playwright E2E specs (if UI/routes/flows/modes changed): new specs for new features, cover all modes/flags, form validation, empty/loading/error states, common edge cases
|
|
419
|
+
- Tests are part of the deliverable, not a follow-up
|
|
420
|
+
- **E2E tests MUST be functional, not layout tests**: Every assertion must verify an action produced the correct outcome (state changed, data loaded, content updated) — NOT just that an element is visible/clickable. A test that passes on an empty HTML shell with correct IDs is worthless. See the Functional E2E Test Requirements in the solo mode instructions above.
|
|
421
|
+
- If a task is marked BLOCKED, message the lead and wait
|
|
422
|
+
- Run the Pre-Commit Gate checklist from CLAUDE.md BEFORE every commit — update all affected docs
|
|
423
|
+
- **Commit immediately after each task**: `feat({domain}/task-{N}): {description}` — do NOT batch commits
|
|
424
|
+
- **Deviation Rules**: (1) Bug blocking progress → fix, 3 attempts max; (2) Missing dependency → add minimum needed; (3) Blocker → fix and log to deferred-items.md; (4) Architectural change → STOP, message lead, never self-approve
|
|
425
|
+
|
|
426
|
+
**Task-dispatcher pattern per teammate:**
|
|
427
|
+
For each task in your domain's tasks.md (in order, skip completed):
|
|
428
|
+
1. Load prior summaries: read up to 5 most recent `.gsd-t/domains/{your-domain}/task-*-summary.md` files
|
|
429
|
+
2. Load graph context for task's files (if .gsd-t/graph/meta.json exists)
|
|
430
|
+
3. Spawn one Task subagent (model: sonnet) with ONLY:
|
|
431
|
+
- scope.md, relevant contracts, the single task, graph context, prior summaries
|
|
432
|
+
- Instruction to write task summary to `.gsd-t/domains/{domain}/task-{id}-summary.md`
|
|
433
|
+
(format per fresh-dispatch-contract.md Task Summary Format)
|
|
434
|
+
4. After task subagent returns, read the summary and pass it as prior context to the next task
|
|
435
|
+
5. After completing each task, message the lead with:
|
|
436
|
+
"DONE: {domain} Task {N} - {summary of what was created/modified}"
|
|
437
|
+
6. If you need to deviate from a contract, STOP and message the lead
|
|
438
|
+
|
|
439
|
+
Teammate assignments:
|
|
440
|
+
- Teammate "{domain-1}": Execute .gsd-t/domains/{domain-1}/tasks.md (task-dispatcher pattern, isolated worktree)
|
|
441
|
+
- Teammate "{domain-2}": Execute .gsd-t/domains/{domain-2}/tasks.md (task-dispatcher pattern, isolated worktree)
|
|
442
|
+
- Teammate "{domain-3}": Execute .gsd-t/domains/{domain-3}/tasks.md (task-dispatcher pattern, isolated worktree)
|
|
443
|
+
|
|
444
|
+
**Worktree isolation (per domain teammate):**
|
|
445
|
+
Each domain teammate MUST be spawned with `isolation: "worktree"` on the Agent tool:
|
|
446
|
+
```
|
|
447
|
+
Agent({
|
|
448
|
+
prompt: "{domain execution prompt — include: 'You are working in an isolated git worktree. All your changes are isolated to this worktree branch. Do not push; the lead will merge your branch after all domains complete.'}",
|
|
449
|
+
isolation: "worktree"
|
|
450
|
+
})
|
|
451
|
+
```
|
|
452
|
+
Each teammate works in its own isolated copy of the repository. Changes from one domain do not affect another domain's working tree. This is required for parallel safety — see `.gsd-t/contracts/worktree-isolation-contract.md`.
|
|
453
|
+
|
|
454
|
+
Lead responsibilities (QA is handled via Task subagent — spawn one after each domain checkpoint):
|
|
455
|
+
- Use delegate mode (Shift+Tab)
|
|
456
|
+
- Track completions from teammate messages
|
|
457
|
+
- When a CHECKPOINT is reached:
|
|
458
|
+
1. Pause blocked teammates
|
|
459
|
+
2. Verify the gate condition (check contract compliance)
|
|
460
|
+
3. Unblock waiting teammates
|
|
461
|
+
- Update .gsd-t/progress.md after each completion
|
|
462
|
+
- Resolve any contract conflicts immediately
|
|
463
|
+
|
|
464
|
+
**Sequential Merge Protocol (lead runs after ALL domain agents complete):**
|
|
465
|
+
|
|
466
|
+
Once all domain teammates report completion, the lead performs sequential atomic merges. This is the critical integration step — see `.gsd-t/contracts/worktree-isolation-contract.md` for the full merge protocol.
|
|
467
|
+
|
|
468
|
+
1. **Determine merge order**: Read `.gsd-t/contracts/integration-points.md` — use the dependency graph to sort domains. Domains with no upstream dependencies merge first. Example: if domain-A has no deps and domain-B depends on domain-A's output, merge order is [domain-A, domain-B].
|
|
469
|
+
|
|
470
|
+
2. **For each domain (in dependency order)**:
|
|
471
|
+
|
|
472
|
+
a. **File ownership validation (pre-merge)**: Check files the domain agent modified against the domain's `.gsd-t/domains/{domain}/scope.md`:
|
|
473
|
+
- If `.gsd-t/graph/meta.json` exists: run `query('getDomainBoundaryViolations', { domain })` — flag any files modified outside the domain's declared ownership
|
|
474
|
+
- If graph unavailable: list files changed in the worktree branch via `git diff --name-only` and compare against scope.md manually
|
|
475
|
+
- If violations found: log them in `.gsd-t/progress.md` as `[violation] {domain}: modified {file} outside scope`, but do NOT block merge — flag for immediate review after merge
|
|
476
|
+
|
|
477
|
+
b. **Merge the domain's worktree branch**:
|
|
478
|
+
```bash
|
|
479
|
+
# The worktree branch name is returned by the Agent tool when isolation: "worktree" is used
|
|
480
|
+
git merge --no-ff {domain-worktree-branch} -m "integrate({domain}): merge worktree branch"
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
c. **Contract validation (post-merge)**: Read each contract in `.gsd-t/contracts/` — verify the merged code still satisfies all contract shapes (API shapes, schemas, interfaces). If a contract is violated, log it immediately.
|
|
484
|
+
|
|
485
|
+
d. **Run integration tests**:
|
|
486
|
+
```bash
|
|
487
|
+
node --test test/
|
|
488
|
+
# or project's test command from package.json
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
e. **If tests PASS**: Continue to the next domain in merge order.
|
|
492
|
+
|
|
493
|
+
f. **If tests FAIL**: Roll back this domain's merge:
|
|
494
|
+
```bash
|
|
495
|
+
git reset --hard HEAD~1
|
|
496
|
+
# or: git revert HEAD --no-edit
|
|
497
|
+
```
|
|
498
|
+
Log failure: `[rollback] {domain}: merge rolled back — integration tests failed after merge`
|
|
499
|
+
Record in `.gsd-t/progress.md` Decision Log.
|
|
500
|
+
Continue with remaining domains (other domains' merges are not affected).
|
|
501
|
+
|
|
502
|
+
3. **Post-merge ownership report**: After all merges complete (successful or rolled back), log a summary in `.gsd-t/progress.md`:
|
|
503
|
+
```
|
|
504
|
+
## Worktree Merge Summary — {date}
|
|
505
|
+
- {domain-1}: MERGED | tests: PASS | violations: {N}
|
|
506
|
+
- {domain-2}: ROLLED BACK | reason: integration tests failed
|
|
507
|
+
- {domain-3}: MERGED | tests: PASS | violations: 0
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
**Worktree Cleanup (MANDATORY — run after merge protocol, success or failure):**
|
|
511
|
+
|
|
512
|
+
After all merges complete (whether all passed, some rolled back, or errors occurred):
|
|
513
|
+
|
|
514
|
+
1. List all worktree branches created during this execution run:
|
|
515
|
+
```bash
|
|
516
|
+
git worktree list
|
|
517
|
+
git branch --list "gsd-t-worktree-*"
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
2. Remove each domain worktree:
|
|
521
|
+
```bash
|
|
522
|
+
git worktree remove --force {worktree-path}
|
|
523
|
+
git branch -D {worktree-branch}
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
3. **Orphaned worktree detection**: If any worktrees remain after cleanup (can happen if an agent crashed):
|
|
527
|
+
```bash
|
|
528
|
+
git worktree prune
|
|
529
|
+
```
|
|
530
|
+
Log: `[cleanup] Pruned {N} orphaned worktrees via git worktree prune`
|
|
531
|
+
|
|
532
|
+
4. Verify no worktrees remain except the main working tree:
|
|
533
|
+
```bash
|
|
534
|
+
git worktree list
|
|
535
|
+
# should show only: {main-path} {commit} [branch]
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
Cleanup is not optional — orphaned worktrees waste disk space and can confuse subsequent executions. Always run cleanup, even if earlier steps failed.
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
## Step 3.5: Orchestrator Context Self-Check (MANDATORY)
|
|
542
|
+
|
|
543
|
+
After EVERY domain completes (and after every checkpoint), the orchestrator MUST check its own context utilization:
|
|
544
|
+
|
|
545
|
+
Run via Bash:
|
|
546
|
+
`if [ "${CLAUDE_CONTEXT_TOKENS_MAX:-0}" -gt 0 ]; then CTX_PCT=$(echo "scale=1; ${CLAUDE_CONTEXT_TOKENS_USED:-0} * 100 / ${CLAUDE_CONTEXT_TOKENS_MAX}" | bc); else CTX_PCT="N/A"; fi && echo "Orchestrator context: ${CTX_PCT}%"`
|
|
547
|
+
|
|
548
|
+
**If CTX_PCT >= 70:**
|
|
549
|
+
1. **Save checkpoint to disk** — update `.gsd-t/progress.md` with:
|
|
550
|
+
- Which domains are complete, which remain
|
|
551
|
+
- Current wave, next domain to execute
|
|
552
|
+
- Any checkpoint results
|
|
553
|
+
2. **Instruct user**: Output exactly:
|
|
554
|
+
```
|
|
555
|
+
⚠️ Orchestrator context at {CTX_PCT}% — approaching limit.
|
|
556
|
+
Progress saved. Run `/clear` then `/user:gsd-t-execute` to continue from the next domain.
|
|
557
|
+
```
|
|
558
|
+
3. **STOP execution.** Do NOT spawn another domain subagent. The next session will resume from saved state.
|
|
559
|
+
|
|
560
|
+
**If CTX_PCT < 70:** Continue normally to the next domain/wave.
|
|
561
|
+
|
|
562
|
+
This prevents the orchestrator from running out of context mid-milestone, which causes session breaks and summary-based recovery.
|
|
563
|
+
|
|
564
|
+
## Step 4: Checkpoint Handling
|
|
565
|
+
|
|
566
|
+
When a checkpoint is reached (solo or team):
|
|
567
|
+
|
|
568
|
+
1. **Stop** execution of blocked tasks
|
|
569
|
+
2. **Read** the relevant contract
|
|
570
|
+
3. **Verify** the implemented code matches the contract:
|
|
571
|
+
- API response shapes match?
|
|
572
|
+
- Schema matches?
|
|
573
|
+
- Component interfaces match?
|
|
574
|
+
- Error handling matches?
|
|
575
|
+
4. **If mismatch**: Fix the implementation to match the contract, OR update the contract and notify affected domains
|
|
576
|
+
5. **Log** in progress.md: `CHECKPOINT {name}: PASSED/FAILED — {details}`
|
|
577
|
+
6. **Unblock** downstream tasks
|
|
578
|
+
|
|
579
|
+
## Step 5: Error Handling
|
|
580
|
+
|
|
581
|
+
### Contract Violation
|
|
582
|
+
A teammate implements something that doesn't match a contract:
|
|
583
|
+
1. Stop the teammate
|
|
584
|
+
2. Identify the deviation
|
|
585
|
+
3. Decide: fix implementation or update contract?
|
|
586
|
+
4. If updating contract, message ALL affected teammates with the change
|
|
587
|
+
5. Log the decision
|
|
588
|
+
|
|
589
|
+
### Merge Conflict / File Conflict
|
|
590
|
+
Two teammates modified the same file (shouldn't happen with good partitioning):
|
|
591
|
+
1. Stop both teammates
|
|
592
|
+
2. Identify which domain owns the file (check scope.md)
|
|
593
|
+
3. Non-owner reverts their changes
|
|
594
|
+
4. Determine if the contract needs updating to prevent recurrence
|
|
595
|
+
5. Log the incident
|
|
596
|
+
|
|
597
|
+
### Blocked Teammate Idle
|
|
598
|
+
A teammate finishes independent tasks and is waiting on a checkpoint:
|
|
599
|
+
1. Check if checkpoint can be expedited
|
|
600
|
+
2. If not, have the teammate work on documentation, tests, or code cleanup within their domain
|
|
601
|
+
3. Or shut down the teammate and respawn when unblocked
|
|
602
|
+
|
|
603
|
+
## Step 5.5: Red Team — Adversarial QA (MANDATORY)
|
|
604
|
+
|
|
605
|
+
After all domain tasks pass their tests, spawn an adversarial Red Team agent. This agent's sole purpose is to BREAK the code that was just built. It operates with inverted incentives — its success is measured by bugs found, not tests passed.
|
|
606
|
+
|
|
607
|
+
⚙ [{model}] Red Team → adversarial validation of executed domains
|
|
608
|
+
|
|
609
|
+
**OBSERVABILITY LOGGING (MANDATORY):**
|
|
610
|
+
Before spawning — run via Bash:
|
|
611
|
+
`T_START=$(date +%s) && DT_START=$(date +"%Y-%m-%d %H:%M") && TOK_START=${CLAUDE_CONTEXT_TOKENS_USED:-0} && TOK_MAX=${CLAUDE_CONTEXT_TOKENS_MAX:-200000}`
|
|
612
|
+
|
|
613
|
+
```
|
|
614
|
+
Task subagent (general-purpose, model: opus):
|
|
615
|
+
"You are a Red Team QA adversary. Your job is to BREAK the code that was just written.
|
|
616
|
+
|
|
617
|
+
Your value is measured by REAL bugs found. More bugs = more value.
|
|
618
|
+
If you find zero bugs, you must prove you were thorough — list every
|
|
619
|
+
attack vector you tried and why it didn't break. A short list means
|
|
620
|
+
you didn't try hard enough.
|
|
621
|
+
|
|
622
|
+
Rules:
|
|
623
|
+
- False positives DESTROY your credibility. If you report something
|
|
624
|
+
as a bug and it's actually correct behavior, that's worse than
|
|
625
|
+
missing a real bug. Never report something you haven't reproduced.
|
|
626
|
+
- Style opinions are not bugs. Theoretical concerns are not bugs.
|
|
627
|
+
A bug is: 'I did X, expected Y, got Z.' With proof.
|
|
628
|
+
- You are done ONLY when you have exhausted every category below
|
|
629
|
+
and either found a bug or documented exactly what you tried.
|
|
630
|
+
|
|
631
|
+
## Attack Categories (exhaust ALL of these)
|
|
632
|
+
|
|
633
|
+
1. **Contract Violations**: Read .gsd-t/contracts/. Does the code EXACTLY
|
|
634
|
+
match every contract? Test each endpoint/interface/schema shape.
|
|
635
|
+
2. **Boundary Inputs**: Empty strings, null, undefined, huge payloads,
|
|
636
|
+
special characters, SQL injection attempts, XSS payloads, path traversal.
|
|
637
|
+
3. **State Transitions**: What happens when actions are performed out of
|
|
638
|
+
order? Double-submit? Concurrent access? Refresh mid-flow?
|
|
639
|
+
4. **Error Paths**: Remove env vars. Kill the database. Send malformed
|
|
640
|
+
requests. Does the code handle failures gracefully or crash?
|
|
641
|
+
5. **Missing Flows**: Read docs/requirements.md. Are there user flows that
|
|
642
|
+
exist in requirements but have NO test coverage? Write tests for them.
|
|
643
|
+
6. **Regression**: Run the FULL test suite. Did any existing tests break?
|
|
644
|
+
7. **E2E Functional Gaps**: Review ALL Playwright specs. Do they test actual
|
|
645
|
+
behavior (state changes, data loaded, navigation works) or just check
|
|
646
|
+
that elements exist? Flag and rewrite any shallow/layout tests.
|
|
647
|
+
|
|
648
|
+
## Exploratory Testing (if Playwright MCP available)
|
|
649
|
+
|
|
650
|
+
After all scripted tests pass:
|
|
651
|
+
1. Check if Playwright MCP is registered in Claude Code settings (look for "playwright" in mcpServers)
|
|
652
|
+
2. If available: spend 5 minutes on adversarial interactive exploration using Playwright MCP
|
|
653
|
+
- Attempt race conditions, double-submits, concurrent access patterns
|
|
654
|
+
- Try unexpected input sequences, boundary values, rapid state transitions
|
|
655
|
+
- Probe error recovery: does the app recover after failures or get stuck?
|
|
656
|
+
3. Tag all findings [EXPLORATORY] in your report
|
|
657
|
+
4. If Playwright MCP is not available: skip this section silently
|
|
658
|
+
Note: Exploratory findings are additive — they do not replace scripted test results.
|
|
659
|
+
|
|
660
|
+
## Report Format
|
|
661
|
+
|
|
662
|
+
For each bug found:
|
|
663
|
+
- **BUG-{N}**: {severity: CRITICAL/HIGH/MEDIUM/LOW}
|
|
664
|
+
- **Reproduction**: {exact steps to reproduce}
|
|
665
|
+
- **Expected**: {what should happen}
|
|
666
|
+
- **Actual**: {what actually happens}
|
|
667
|
+
- **Proof**: {test file or command that demonstrates the bug}
|
|
668
|
+
|
|
669
|
+
Summary:
|
|
670
|
+
- BUGS FOUND: {count} (with severity breakdown)
|
|
671
|
+
- COVERAGE GAPS: {untested flows from requirements}
|
|
672
|
+
- SHALLOW TESTS REWRITTEN: {count}
|
|
673
|
+
- CONTRACTS VERIFIED: {N}/{total}
|
|
674
|
+
- ATTACK VECTORS TRIED: {list every category attempted and results}
|
|
675
|
+
- VERDICT: FAIL ({N} bugs found) | GRUDGING PASS (exhaustive search, nothing found)
|
|
676
|
+
|
|
677
|
+
Write all findings to .gsd-t/red-team-report.md.
|
|
678
|
+
If bugs found, also append to .gsd-t/qa-issues.md."
|
|
679
|
+
```
|
|
680
|
+
|
|
681
|
+
After subagent returns — run via Bash:
|
|
682
|
+
`T_END=$(date +%s) && DT_END=$(date +"%Y-%m-%d %H:%M") && TOK_END=${CLAUDE_CONTEXT_TOKENS_USED:-0} && DURATION=$((T_END-T_START))`
|
|
683
|
+
Compute tokens and compaction:
|
|
684
|
+
- No compaction (TOK_END >= TOK_START): `TOKENS=$((TOK_END-TOK_START))`, COMPACTED=null
|
|
685
|
+
- Compaction detected (TOK_END < TOK_START): `TOKENS=$(((TOK_MAX-TOK_START)+TOK_END))`, COMPACTED=$DT_END
|
|
686
|
+
Append to `.gsd-t/token-log.md`:
|
|
687
|
+
`| {DT_START} | {DT_END} | gsd-t-execute | Red Team | sonnet | {DURATION}s | {VERDICT} — {N} bugs found | {TOKENS} | {COMPACTED} | | | {CTX_PCT} |`
|
|
688
|
+
|
|
689
|
+
**If Red Team VERDICT is FAIL:**
|
|
690
|
+
1. Fix all CRITICAL and HIGH bugs immediately (up to 2 fix attempts per bug)
|
|
691
|
+
2. Re-run Red Team after fixes
|
|
692
|
+
3. If bugs persist after 2 fix cycles, log to `.gsd-t/deferred-items.md` and present to user
|
|
693
|
+
|
|
694
|
+
**If Red Team VERDICT is GRUDGING PASS:** Proceed to completion.
|
|
695
|
+
|
|
696
|
+
## Step 6: Completion
|
|
697
|
+
|
|
698
|
+
When all tasks in all domains are complete:
|
|
699
|
+
1. Update `.gsd-t/progress.md` — all tasks marked complete
|
|
700
|
+
2. Set status to `EXECUTED`
|
|
701
|
+
3. List any contract deviations or decisions made during execution
|
|
702
|
+
|
|
703
|
+
### Autonomy Behavior
|
|
704
|
+
|
|
705
|
+
**Level 3 (Full Auto)**: Log a brief status line (e.g., "✅ Execute complete — {N}/{N} tasks done") and auto-advance to the next phase. Do NOT wait for user input.
|
|
706
|
+
|
|
707
|
+
**Level 1–2**: Report completion summary and recommend proceeding to integrate phase. Wait for confirmation.
|
|
708
|
+
|
|
709
|
+
## Step 7: Doc-Ripple (Automated)
|
|
710
|
+
|
|
711
|
+
After all work is committed but before reporting completion:
|
|
712
|
+
|
|
713
|
+
1. Run threshold check — read `git diff --name-only HEAD~1` and evaluate against doc-ripple-contract.md trigger conditions
|
|
714
|
+
2. If SKIP: log "Doc-ripple: SKIP — {reason}" and proceed to completion
|
|
715
|
+
3. If FIRE: spawn doc-ripple agent:
|
|
716
|
+
|
|
717
|
+
⚙ [{model}] gsd-t-doc-ripple → blast radius analysis + parallel updates
|
|
718
|
+
|
|
719
|
+
Task subagent (general-purpose, model: sonnet):
|
|
720
|
+
"Execute the doc-ripple workflow per commands/gsd-t-doc-ripple.md.
|
|
721
|
+
Git diff context: {files changed list}
|
|
722
|
+
Command that triggered: execute
|
|
723
|
+
Produce manifest at .gsd-t/doc-ripple-manifest.md.
|
|
724
|
+
Update all affected documents.
|
|
725
|
+
Report: 'Doc-ripple: {N} checked, {N} updated, {N} skipped'"
|
|
726
|
+
|
|
727
|
+
4. After doc-ripple returns, verify manifest exists and report summary inline
|
|
728
|
+
|
|
729
|
+
## Document Ripple
|
|
730
|
+
|
|
731
|
+
Execute modifies source code, so the Pre-Commit Gate (referenced in Step 9) covers document updates. For clarity, the key documents affected by execution:
|
|
732
|
+
|
|
733
|
+
### Always update:
|
|
734
|
+
1. **`.gsd-t/progress.md`** — Mark tasks complete, update domain status, log execution summary
|
|
735
|
+
|
|
736
|
+
### Check if affected (per task):
|
|
737
|
+
2. **`.gsd-t/contracts/`** — Did a task change an API endpoint, schema, or component interface? Update the contract
|
|
738
|
+
3. **`docs/requirements.md`** — Did a task implement or change a requirement? Mark it complete or revise
|
|
739
|
+
4. **`docs/architecture.md`** — Did a task add/change a component or data flow? Update it
|
|
740
|
+
5. **`.gsd-t/techdebt.md`** — Did a task resolve a debt item? Mark it done. Did it reveal new debt? Add it
|
|
741
|
+
|
|
742
|
+
### Scan Doc Micro-Update (if `.gsd-t/scan/` exists):
|
|
743
|
+
After all tasks complete, patch structural metadata in scan docs so they stay fresh between full scans. This is near-zero cost — no LLM re-analysis, just updating counts and lists from code.
|
|
744
|
+
|
|
745
|
+
For each scan doc that exists, apply only the relevant patches:
|
|
746
|
+
- **`.gsd-t/scan/architecture.md`** — Update file/directory counts, add new files/modules created during execution
|
|
747
|
+
- **`.gsd-t/scan/quality.md`** — Mark resolved TODOs/FIXMEs, update test counts (run `grep -rc "test\|it\|describe" tests/` or equivalent), append new files to Consumer Surfaces table if applicable
|
|
748
|
+
- **`.gsd-t/scan/security.md`** — If a security finding was fixed during execution, mark it `[RESOLVED]`
|
|
749
|
+
- **`.gsd-t/scan/business-rules.md`** — Append any new validation/auth/workflow rules added during execution
|
|
750
|
+
- **`.gsd-t/scan/contract-drift.md`** — If contracts were updated, mark resolved drift items
|
|
751
|
+
|
|
752
|
+
Skip any scan doc that wasn't affected by the executed tasks. Skip analytical sections (assessments, recommendations) — those require a full scan to update.
|
|
753
|
+
|
|
754
|
+
$ARGUMENTS
|
|
755
|
+
|
|
756
|
+
## Auto-Clear
|
|
757
|
+
|
|
758
|
+
All work is committed to project files. Execute `/clear` to free the context window for the next command.
|