@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.
Files changed (99) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +379 -372
  3. package/bin/component-registry.js +250 -0
  4. package/bin/graph-cgc.js +510 -510
  5. package/bin/graph-indexer.js +147 -147
  6. package/bin/graph-overlay.js +195 -195
  7. package/bin/graph-parsers.js +327 -327
  8. package/bin/graph-query.js +453 -452
  9. package/bin/graph-store.js +154 -154
  10. package/bin/qa-calibrator.js +194 -0
  11. package/bin/scan-data-collector.js +153 -153
  12. package/bin/scan-diagrams-generators.js +187 -187
  13. package/bin/scan-diagrams.js +79 -79
  14. package/bin/scan-renderer.js +92 -92
  15. package/bin/scan-report-sections.js +121 -121
  16. package/bin/scan-report.js +184 -184
  17. package/bin/scan-schema-parsers.js +199 -199
  18. package/bin/scan-schema.js +103 -103
  19. package/bin/token-budget.js +246 -0
  20. package/commands/Claude-md.md +10 -10
  21. package/commands/branch.md +15 -15
  22. package/commands/checkin.md +45 -45
  23. package/commands/global-change.md +209 -209
  24. package/commands/gsd-t-audit.md +199 -0
  25. package/commands/gsd-t-backlog-add.md +94 -94
  26. package/commands/gsd-t-backlog-edit.md +111 -111
  27. package/commands/gsd-t-backlog-list.md +63 -63
  28. package/commands/gsd-t-backlog-move.md +94 -94
  29. package/commands/gsd-t-backlog-promote.md +123 -123
  30. package/commands/gsd-t-backlog-remove.md +86 -86
  31. package/commands/gsd-t-backlog-settings.md +158 -158
  32. package/commands/gsd-t-complete-milestone.md +528 -515
  33. package/commands/gsd-t-debug.md +506 -399
  34. package/commands/gsd-t-discuss.md +174 -174
  35. package/commands/gsd-t-execute.md +758 -634
  36. package/commands/gsd-t-feature.md +276 -276
  37. package/commands/gsd-t-health.md +142 -142
  38. package/commands/gsd-t-help.md +465 -457
  39. package/commands/gsd-t-impact.md +302 -302
  40. package/commands/gsd-t-init.md +320 -280
  41. package/commands/gsd-t-integrate.md +365 -249
  42. package/commands/gsd-t-milestone.md +87 -87
  43. package/commands/gsd-t-partition.md +442 -361
  44. package/commands/gsd-t-pause.md +82 -82
  45. package/commands/gsd-t-plan.md +345 -344
  46. package/commands/gsd-t-populate.md +111 -111
  47. package/commands/gsd-t-prd.md +326 -326
  48. package/commands/gsd-t-project.md +211 -211
  49. package/commands/gsd-t-promote-debt.md +123 -123
  50. package/commands/gsd-t-prompt.md +137 -137
  51. package/commands/gsd-t-qa.md +266 -266
  52. package/commands/gsd-t-quick.md +357 -234
  53. package/commands/gsd-t-reflect.md +134 -134
  54. package/commands/gsd-t-resume.md +72 -72
  55. package/commands/gsd-t-scan.md +615 -615
  56. package/commands/gsd-t-setup.md +76 -0
  57. package/commands/gsd-t-status.md +192 -166
  58. package/commands/gsd-t-test-sync.md +381 -381
  59. package/commands/gsd-t-triage-and-merge.md +171 -171
  60. package/commands/gsd-t-verify.md +382 -382
  61. package/commands/gsd-t-visualize.md +118 -118
  62. package/commands/gsd-t-wave.md +401 -378
  63. package/docs/GSD-T-README.md +425 -422
  64. package/docs/architecture.md +385 -369
  65. package/docs/harness-design-analysis.md +371 -0
  66. package/docs/infrastructure.md +205 -205
  67. package/docs/prd-graph-engine.md +398 -398
  68. package/docs/prd-gsd2-hybrid.md +559 -559
  69. package/docs/prd-harness-evolution.md +583 -0
  70. package/docs/requirements.md +14 -0
  71. package/docs/workflows.md +226 -226
  72. package/examples/.gsd-t/domains/example-domain/scope.md +13 -13
  73. package/package.json +40 -40
  74. package/scripts/gsd-t-auto-route.js +39 -39
  75. package/scripts/gsd-t-dashboard-mockup.html +1143 -1143
  76. package/scripts/gsd-t-dashboard-server.js +171 -171
  77. package/scripts/gsd-t-dashboard.html +262 -262
  78. package/scripts/gsd-t-event-writer.js +128 -128
  79. package/scripts/gsd-t-statusline.js +94 -94
  80. package/scripts/gsd-t-tools.js +175 -175
  81. package/templates/CLAUDE-global.md +639 -614
  82. package/templates/CLAUDE-project.md +24 -0
  83. package/templates/backlog-settings.md +18 -18
  84. package/templates/backlog.md +1 -1
  85. package/templates/progress.md +40 -40
  86. package/templates/shared-services-contract.md +60 -60
  87. package/templates/stacks/desktop.ini +2 -2
  88. package/bin/desktop.ini +0 -2
  89. package/commands/desktop.ini +0 -2
  90. package/docs/ci-examples/desktop.ini +0 -2
  91. package/docs/desktop.ini +0 -2
  92. package/examples/.gsd-t/contracts/desktop.ini +0 -2
  93. package/examples/.gsd-t/desktop.ini +0 -2
  94. package/examples/.gsd-t/domains/desktop.ini +0 -2
  95. package/examples/.gsd-t/domains/example-domain/desktop.ini +0 -2
  96. package/examples/desktop.ini +0 -2
  97. package/examples/rules/desktop.ini +0 -2
  98. package/scripts/desktop.ini +0 -2
  99. package/templates/desktop.ini +0 -2
@@ -1,361 +1,442 @@
1
- # GSD-T: Partition Work into Domains
2
-
3
- You are the lead agent in a contract-driven development workflow. Your job is to decompose the current milestone into independent domains with explicit boundaries and contracts.
4
-
5
- ## Step 0.5: Scan Freshness Auto-Refresh
6
-
7
- Before reading scan data, check if scan docs are stale and auto-refresh if needed. This ensures partition decisions are based on current code — no warnings, no user involvement.
8
-
9
- If `.gsd-t/scan/.cache.json` exists:
10
- 1. Read the cache and check `dimensions.quality.scannedAt` and `dimensions.architecture.scannedAt`
11
- 2. Count commits since the scan: `git rev-list --count --after="{scannedAt}" HEAD`
12
- 3. If **>10 commits since scan** OR **scan is older than 14 days**:
13
- - Log: "Auto-refreshing scan docs (stale by {N} commits / {N} days)..."
14
- - Re-run only the stale dimensions by spawning the relevant scan teammates:
15
- - If `quality.md` stale → spawn quality teammate (model: sonnet)
16
- - If `architecture.md` stale → spawn architecture teammate (model: haiku)
17
- - Update `.gsd-t/scan/.cache.json` after refresh
18
- 4. If fresh → proceed silently
19
-
20
- If `.gsd-t/scan/` doesn't exist at all → skip (no scan data to refresh).
21
-
22
- ## Step 1: Understand the Project
23
-
24
- Read these files in order:
25
- 1. `CLAUDE.md` — project conventions and context
26
- 2. `.gsd-t/progress.md` — current state (if exists)
27
- 3. `docs/` — all available documentation (requirements, architecture, schema, design)
28
- 4. `.gsd-t/scan/quality.md` (if exists) — extract the "Consumer Surfaces Detected" and "Shared Service Candidates" tables. These pre-populate Step 1.6 with scan-discovered data and eliminate re-research.
29
- 5. `.gsd-t/contracts/shared-services-contract.md` (if exists) — a SharedCore domain was previously identified. Its listed operations are pre-confirmed shared and carry forward automatically to Step 1.6.2.
30
-
31
- If `.gsd-t/` doesn't exist, create the full directory structure:
32
- ```
33
- .gsd-t/
34
- ├── contracts/
35
- ├── domains/
36
- └── progress.md
37
- ```
38
-
39
- ## Step 1.5: Assumption Audit (MANDATORY — complete before domain work begins)
40
-
41
- Before partitioning, surface and lock down all assumptions baked into the requirements. Unexamined assumptions become architectural decisions no one approved.
42
-
43
- Work through each category below. For every match found, write the explicit disposition into the affected domain's `constraints.md` and into the Decision Log in `.gsd-t/progress.md`.
44
-
45
- ---
46
-
47
- ### Category 1: External Reference Assumptions
48
-
49
- Scan requirements for any external project, file, component, library, or URL mentioned by name or path. For each one found, explicitly confirm which disposition applies — and lock it in the contract before any domain touches it:
50
-
51
- | Disposition | Meaning |
52
- |-------------|---------|
53
- | `USE` | Import and depend on it — treat as a dependency |
54
- | `INSPECT` | Read source for patterns only — do not import or copy code |
55
- | `BUILD` | Build equivalent functionality from scratch — do not read or use it |
56
-
57
- **No external reference survives partition without a locked disposition.**
58
-
59
- Trigger phrases to watch for: "reference X", "like X", "similar to Y", "see W for how it handles Z", any file path or project name, any URL.
60
-
61
- > If Level 3 (Full Auto): state the inferred disposition and reason; lock it unless it's ambiguous.
62
- > If ambiguous (e.g., "reference X" could mean USE or INSPECT): pause and ask the user before proceeding.
63
-
64
- ---
65
-
66
- ### Category 3: Black Box Assumptions
67
-
68
- Any component, module, or library **not written in this milestone** that a domain will call, import, or depend on → the agent that executes that domain must read its source before treating it as correct. This includes internal project modules written in a previous milestone.
69
-
70
- For each such component identified:
71
- 1. Name it explicitly in the domain's `constraints.md` under a `## Must Read Before Using` section
72
- 2. List the specific functions or behaviors the domain depends on
73
- 3. The execute agent is prohibited from treating it as a black box — it must read the listed items before implementing
74
-
75
- ---
76
-
77
- ### Category 4: User Intent Assumptions
78
-
79
- Scan requirements for ambiguous language. Flag every instance where intent could be interpreted more than one way. Common patterns:
80
-
81
- - "like X" / "similar to Y" — does this mean the same UX, the same architecture, or just the same concept?
82
- - "the way X handles it" — inspiration, direct port, or behavioral equivalent?
83
- - "reference Z" — does this mean read it, use it, or replicate it?
84
- - "build something that does W" — from scratch, or using an existing library?
85
- - Any requirement where a reasonable developer could make two different implementation choices
86
-
87
- For each ambiguous item:
88
- 1. State the two (or more) possible interpretations explicitly
89
- 2. State which interpretation you are locking in and why
90
- 3. If genuinely unclear: pause and ask the user — do not infer and proceed
91
-
92
- > **Rule**: Ambiguous intent that reaches execute unresolved becomes a wrong assumption. Resolve it here or pay for it in debug sessions.
93
-
94
- ---
95
-
96
- ## Step 1.55: Graph-Enhanced Boundary Detection (if available)
97
-
98
- If `.gsd-t/graph/meta.json` exists, query the graph to inform domain decomposition:
99
-
100
- 1. **Entity-to-file mapping**: `query('getEntities', { file })` for each source file — understand what functions/classes exist where
101
- 2. **Import graph**: `query('getImports', { file })` — see the dependency structure between files
102
- 3. **Surface consumers**: `query('getSurfaceConsumers', { entity })` — which surfaces already consume each function (auto-populates Step 1.6)
103
- 4. **Domain boundary violations**: `query('getDomainBoundaryViolations', {})` — existing cross-domain access patterns to inform boundaries
104
- 5. **Shared operation detection**: If multiple surfaces consume the same entity, it's a SharedCore candidate
105
-
106
- Use graph results to **propose initial domain boundaries** based on actual code structure, not just file paths. The graph reveals natural boundaries that directory structure may not show (e.g., two files in the same folder that never import each other belong to different domains).
107
-
108
- ## Step 1.6: Consumer Surface Identification (MANDATORY — complete before domain work)
109
-
110
- Before decomposing into domains, identify **every surface that will consume this system**. A surface is any client, app, or integration that calls your backend — web app, mobile app, CLI, external API, admin panel, background job, etc.
111
-
112
- Skipping this step leads to duplicated backend logic when a second consumer is added later.
113
-
114
- ---
115
-
116
- ### 1.6.1 — Enumerate Surfaces
117
-
118
- For each surface that will consume this system, capture:
119
-
120
- ```markdown
121
- ## Consumer Surfaces
122
-
123
- | Surface | Type | Operations Needed |
124
- |---------|------|------------------|
125
- | {Web App} | web | login, list-items, get-item, update-progress, search |
126
- | {Mobile App} | mobile | login, list-items, get-item, update-progress, offline-sync |
127
- | {CLI} | cli | import-data, export-data, list-items |
128
- ```
129
-
130
- **Surface types**: `web`, `mobile`, `cli`, `external-api`, `admin`, `background-worker`, `other`
131
-
132
- **Existing System Check**: This milestone may be adding a NEW surface to a system that already has existing consumer surfaces. Before concluding surface enumeration, scan `.gsd-t/progress.md` completed milestones and look for directories or route files indicating prior client surfaces (`web/`, `mobile/`, `app/`, `cli/`, `client/`, `routes/web.js`, `routes/mobile.js`). Add any discovered existing surfaces to the table above.
133
-
134
- > ⚠️ **New-client signal**: If this milestone adds a consumer surface to a system that already has one or more other consumer surfaces, SharedCore evaluation is MANDATORY regardless of shared operation count.
135
-
136
- If only one surface exists and no prior surfaces were found → mark "Single consumer — SharedCore not needed" and proceed to Step 2.
137
-
138
- ---
139
-
140
- ### 1.6.2 — Identify Shared Operations
141
-
142
- Compare the "Operations Needed" column across all surfaces. Flag every operation that appears in 2 or more surfaces:
143
-
144
- ```markdown
145
- ## Shared Operations (candidates for SharedCore)
146
-
147
- | Operation | Surfaces That Need It | Shared? |
148
- |------------------|-----------------------|---------|
149
- | login | web, mobile | ✅ |
150
- | list-items | web, mobile, cli | ✅ |
151
- | get-item | web, mobile | ✅ |
152
- | update-progress | web, mobile | ✅ |
153
- | offline-sync | mobile only | ❌ |
154
- | export-data | cli only | ❌ |
155
- ```
156
-
157
- ---
158
-
159
- ### 1.6.3 — Auto-Suggest SharedCore Domain
160
-
161
- **If 2 or more shared operations exist, OR if this milestone adds a new consumer surface to a system that already has other surfaces (detected in the Existing System Check above):**
162
-
163
- > ⚠️ **SharedCore recommended** — {N} operations are needed by {M} consumer surfaces.
164
- > A `shared-core` domain will be added to own these functions.
165
- > Surfaces get thin adapter layers that call SharedCore — not duplicate implementations.
166
-
167
- Add `shared-core` to the domain list before running Step 2. The `shared-core` domain:
168
- - Owns: the shared operation implementations
169
- - Consumed by: all surface-specific adapter domains
170
- - Contract: `shared-services-contract.md` (use the template from `templates/shared-services-contract.md`)
171
-
172
- **If only 1 shared operation exists AND this is not a new-client-to-existing-system scenario:**
173
-
174
- > ℹ️ {N} shared operations found. Inline sharing is sufficient — no separate SharedCore domain needed. Document shared functions in the relevant domain's constraints.md.
175
-
176
- ---
177
-
178
- ### 1.6.4 — Write the Shared Services Contract
179
-
180
- If SharedCore was created, populate `.gsd-t/contracts/shared-services-contract.md` using the template from `templates/shared-services-contract.md`.
181
-
182
- ---
183
-
184
- ## Step 2: Identify Domains
185
-
186
- Decompose the milestone into 2-5 independent domains. Each domain should:
187
- - Own a distinct area of functionality
188
- - Have minimal overlap with other domains
189
- - Map to a clear set of files/directories it will own
190
- - Be executable by a single agent without needing another domain's internals
191
-
192
- For each domain, create `.gsd-t/domains/{domain-name}/`:
193
- ```
194
- .gsd-t/domains/{domain-name}/
195
- ├── scope.md — what this domain owns (files, directories, responsibilities)
196
- ├── tasks.md — (empty for now, filled during plan phase)
197
- └── constraints.md — patterns to follow, files NOT to touch, conventions
198
- ```
199
-
200
- ### scope.md format:
201
- ```markdown
202
- # Domain: {name}
203
-
204
- ## Responsibility
205
- {What this domain is responsible for}
206
-
207
- ## Owned Files/Directories
208
- - src/{path}/ — {description}
209
- - src/{path}/ — {description}
210
-
211
- ## NOT Owned (do not modify)
212
- - {files owned by other domains}
213
- ```
214
-
215
- ### constraints.md format:
216
- ```markdown
217
- # Constraints: {domain-name}
218
-
219
- ## Must Follow
220
- - {pattern or convention from CLAUDE.md}
221
- - {specific technical constraint}
222
-
223
- ## Must Not
224
- - Modify files outside owned scope
225
- - Create new database tables (data-layer domain owns schema)
226
- - {other boundaries}
227
-
228
- ## Dependencies
229
- - Depends on: {other domain} for {what}
230
- - Depended on by: {other domain} for {what}
231
- ```
232
-
233
- ## Step 3: Write Contracts
234
-
235
- Contracts define HOW domains interact. Create files in `.gsd-t/contracts/`:
236
-
237
- For each boundary between domains, write a contract:
238
-
239
- ### API contracts (`api-contract.md`):
240
- ```markdown
241
- # API Contract
242
-
243
- ## POST /api/auth/login
244
- Request: { email: string, password: string }
245
- Response: { token: string, user: { id: string, email: string, role: string } }
246
- Errors: 401 { error: "invalid_credentials" }
247
- Owner: auth domain
248
- Consumers: ui domain
249
-
250
- ## GET /api/users/:id
251
- ...
252
- ```
253
-
254
- ### Schema contracts (`schema-contract.md`):
255
- ```markdown
256
- # Schema Contract
257
-
258
- ## Users Table
259
- | Column | Type | Constraints |
260
- |--------|------|------------|
261
- | id | uuid | PK, auto |
262
- | email | varchar(255) | unique, not null |
263
- ...
264
-
265
- Owner: data-layer domain
266
- Consumers: auth domain, ui domain
267
- ```
268
-
269
- ### Component contracts (`component-contract.md`):
270
- ```markdown
271
- # Component Contract
272
-
273
- ## LoginForm
274
- Props: { onSuccess: (user: User) => void, onError: (msg: string) => void }
275
- Events: Calls POST /api/auth/login per api-contract
276
- Owner: ui domain
277
- ```
278
-
279
- ### Integration points (`integration-points.md`):
280
- ```markdown
281
- # Integration Points
282
-
283
- ## Auth → Data Layer
284
- - Auth domain reads Users table (schema-contract.md)
285
- - Auth domain calls data-layer's user lookup function
286
- - Checkpoint: data-layer must complete Task 2 before auth starts Task 3
287
-
288
- ## UI → Auth
289
- - UI calls auth endpoints per api-contract.md
290
- - Checkpoint: auth must complete Task 2 before UI starts Task 4
291
- ```
292
-
293
- ## Step 4: Initialize Progress
294
-
295
- Write `.gsd-t/progress.md`:
296
- ```markdown
297
- # GSD-T Progress
298
-
299
- ## Milestone: {name}
300
- ## Status: PARTITIONED
301
- ## Date: {today}
302
-
303
- ## Domains
304
- | Domain | Status | Tasks | Completed |
305
- |--------|--------|-------|-----------|
306
- | {name} | partitioned | 0 | 0 |
307
-
308
- ## Contracts
309
- - [ ] api-contract.md
310
- - [ ] schema-contract.md
311
- - [x] {any completed ones}
312
-
313
- ## Integration Checkpoints
314
- - [ ] {checkpoint description}blocks {domain} task {N}
315
-
316
- ## Decision Log
317
- - {date}: {decision and rationale}
318
- ```
319
-
320
- ## Step 5: Document Ripple
321
-
322
- After creating domains and contracts, update affected documentation:
323
-
324
- ### Always update:
325
- 1. **`.gsd-t/progress.md`** — Already updated in Step 4, but verify Decision Log includes partition rationale
326
-
327
- ### Check if affected:
328
- 2. **`docs/architecture.md`** — If the partition defines new component boundaries or clarifies the system structure, update it
329
- 3. **`docs/requirements.md`** — If partitioning revealed that requirements need clarification or splitting by domain, update them
330
- 4. **`CLAUDE.md`** — If the partition establishes new file ownership conventions or domain-specific patterns, add them
331
-
332
- ### Skip what's not affected.
333
-
334
- ## Step 6: Test Verification
335
-
336
- Before finalizing the partition:
337
-
338
- 1. **Run existing tests**: Execute the full test suite to confirm codebase is clean before domain work begins
339
- 2. **Verify passing**: If any tests fail, assign them to the appropriate domain as pre-existing issues
340
- 3. **Map tests to domains**: Note which test files belong to which domain — this informs task planning
341
-
342
- ## Step 7: Validate
343
-
344
- Before finishing, verify:
345
- - [ ] Every file in `src/` is owned by exactly one domain
346
- - [ ] No domain scope overlaps with another
347
- - [ ] Every dependency between domains has a contract
348
- - [ ] Every contract has an owner and at least one consumer
349
- - [ ] Integration checkpoints are identified for all cross-domain dependencies
350
-
351
- ### Autonomy Behavior
352
-
353
- **Level 3 (Full Auto)**: Log a brief status line (e.g., "✅ Partition complete — {N} domains defined, {N} contracts written") and auto-advance to the next phase. Do NOT wait for user input.
354
-
355
- **Level 1–2**: Report the partition to the user with a summary of domains, contracts, and any decisions that need input. Wait for confirmation before proceeding.
356
-
357
- $ARGUMENTS
358
-
359
- ## Auto-Clear
360
-
361
- All work is committed to project files. Execute `/clear` to free the context window for the next command.
1
+ # GSD-T: Partition Work into Domains
2
+
3
+ You are the lead agent in a contract-driven development workflow. Your job is to decompose the current milestone into independent domains with explicit boundaries and contracts.
4
+
5
+ ## Step 0.5: Scan Freshness Auto-Refresh
6
+
7
+ Before reading scan data, check if scan docs are stale and auto-refresh if needed. This ensures partition decisions are based on current code — no warnings, no user involvement.
8
+
9
+ If `.gsd-t/scan/.cache.json` exists:
10
+ 1. Read the cache and check `dimensions.quality.scannedAt` and `dimensions.architecture.scannedAt`
11
+ 2. Count commits since the scan: `git rev-list --count --after="{scannedAt}" HEAD`
12
+ 3. If **>10 commits since scan** OR **scan is older than 14 days**:
13
+ - Log: "Auto-refreshing scan docs (stale by {N} commits / {N} days)..."
14
+ - Re-run only the stale dimensions by spawning the relevant scan teammates:
15
+ - If `quality.md` stale → spawn quality teammate (model: sonnet)
16
+ - If `architecture.md` stale → spawn architecture teammate (model: haiku)
17
+ - Update `.gsd-t/scan/.cache.json` after refresh
18
+ 4. If fresh → proceed silently
19
+
20
+ If `.gsd-t/scan/` doesn't exist at all → skip (no scan data to refresh).
21
+
22
+ ## Step 1: Understand the Project
23
+
24
+ Read these files in order:
25
+ 1. `CLAUDE.md` — project conventions and context
26
+ 2. `.gsd-t/progress.md` — current state (if exists)
27
+ 3. `docs/` — all available documentation (requirements, architecture, schema, design)
28
+ 4. `.gsd-t/scan/quality.md` (if exists) — extract the "Consumer Surfaces Detected" and "Shared Service Candidates" tables. These pre-populate Step 1.6 with scan-discovered data and eliminate re-research.
29
+ 5. `.gsd-t/contracts/shared-services-contract.md` (if exists) — a SharedCore domain was previously identified. Its listed operations are pre-confirmed shared and carry forward automatically to Step 1.6.2.
30
+
31
+ If `.gsd-t/` doesn't exist, create the full directory structure:
32
+ ```
33
+ .gsd-t/
34
+ ├── contracts/
35
+ ├── domains/
36
+ └── progress.md
37
+ ```
38
+
39
+ ## Step 1.5: Assumption Audit (MANDATORY — complete before domain work begins)
40
+
41
+ Before partitioning, surface and lock down all assumptions baked into the requirements. Unexamined assumptions become architectural decisions no one approved.
42
+
43
+ Work through each category below. For every match found, write the explicit disposition into the affected domain's `constraints.md` and into the Decision Log in `.gsd-t/progress.md`.
44
+
45
+ ---
46
+
47
+ ### Category 1: External Reference Assumptions
48
+
49
+ Scan requirements for any external project, file, component, library, or URL mentioned by name or path. For each one found, explicitly confirm which disposition applies — and lock it in the contract before any domain touches it:
50
+
51
+ | Disposition | Meaning |
52
+ |-------------|---------|
53
+ | `USE` | Import and depend on it — treat as a dependency |
54
+ | `INSPECT` | Read source for patterns only — do not import or copy code |
55
+ | `BUILD` | Build equivalent functionality from scratch — do not read or use it |
56
+
57
+ **No external reference survives partition without a locked disposition.**
58
+
59
+ Trigger phrases to watch for: "reference X", "like X", "similar to Y", "see W for how it handles Z", any file path or project name, any URL.
60
+
61
+ > If Level 3 (Full Auto): state the inferred disposition and reason; lock it unless it's ambiguous.
62
+ > If ambiguous (e.g., "reference X" could mean USE or INSPECT): pause and ask the user before proceeding.
63
+
64
+ ---
65
+
66
+ ### Category 3: Black Box Assumptions
67
+
68
+ Any component, module, or library **not written in this milestone** that a domain will call, import, or depend on → the agent that executes that domain must read its source before treating it as correct. This includes internal project modules written in a previous milestone.
69
+
70
+ For each such component identified:
71
+ 1. Name it explicitly in the domain's `constraints.md` under a `## Must Read Before Using` section
72
+ 2. List the specific functions or behaviors the domain depends on
73
+ 3. The execute agent is prohibited from treating it as a black box — it must read the listed items before implementing
74
+
75
+ ---
76
+
77
+ ### Category 4: User Intent Assumptions
78
+
79
+ Scan requirements for ambiguous language. Flag every instance where intent could be interpreted more than one way. Common patterns:
80
+
81
+ - "like X" / "similar to Y" — does this mean the same UX, the same architecture, or just the same concept?
82
+ - "the way X handles it" — inspiration, direct port, or behavioral equivalent?
83
+ - "reference Z" — does this mean read it, use it, or replicate it?
84
+ - "build something that does W" — from scratch, or using an existing library?
85
+ - Any requirement where a reasonable developer could make two different implementation choices
86
+
87
+ For each ambiguous item:
88
+ 1. State the two (or more) possible interpretations explicitly
89
+ 2. State which interpretation you are locking in and why
90
+ 3. If genuinely unclear: pause and ask the user — do not infer and proceed
91
+
92
+ > **Rule**: Ambiguous intent that reaches execute unresolved becomes a wrong assumption. Resolve it here or pay for it in debug sessions.
93
+
94
+ ---
95
+
96
+ ## Step 1.55: Graph-Enhanced Boundary Detection (if available)
97
+
98
+ If `.gsd-t/graph/meta.json` exists, query the graph to inform domain decomposition:
99
+
100
+ 1. **Entity-to-file mapping**: `query('getEntities', { file })` for each source file — understand what functions/classes exist where
101
+ 2. **Import graph**: `query('getImports', { file })` — see the dependency structure between files
102
+ 3. **Surface consumers**: `query('getSurfaceConsumers', { entity })` — which surfaces already consume each function (auto-populates Step 1.6)
103
+ 4. **Domain boundary violations**: `query('getDomainBoundaryViolations', {})` — existing cross-domain access patterns to inform boundaries
104
+ 5. **Shared operation detection**: If multiple surfaces consume the same entity, it's a SharedCore candidate
105
+
106
+ Use graph results to **propose initial domain boundaries** based on actual code structure, not just file paths. The graph reveals natural boundaries that directory structure may not show (e.g., two files in the same folder that never import each other belong to different domains).
107
+
108
+ ## Step 1.6: Consumer Surface Identification (MANDATORY — complete before domain work)
109
+
110
+ Before decomposing into domains, identify **every surface that will consume this system**. A surface is any client, app, or integration that calls your backend — web app, mobile app, CLI, external API, admin panel, background job, etc.
111
+
112
+ Skipping this step leads to duplicated backend logic when a second consumer is added later.
113
+
114
+ ---
115
+
116
+ ### 1.6.1 — Enumerate Surfaces
117
+
118
+ For each surface that will consume this system, capture:
119
+
120
+ ```markdown
121
+ ## Consumer Surfaces
122
+
123
+ | Surface | Type | Operations Needed |
124
+ |---------|------|------------------|
125
+ | {Web App} | web | login, list-items, get-item, update-progress, search |
126
+ | {Mobile App} | mobile | login, list-items, get-item, update-progress, offline-sync |
127
+ | {CLI} | cli | import-data, export-data, list-items |
128
+ ```
129
+
130
+ **Surface types**: `web`, `mobile`, `cli`, `external-api`, `admin`, `background-worker`, `other`
131
+
132
+ **Existing System Check**: This milestone may be adding a NEW surface to a system that already has existing consumer surfaces. Before concluding surface enumeration, scan `.gsd-t/progress.md` completed milestones and look for directories or route files indicating prior client surfaces (`web/`, `mobile/`, `app/`, `cli/`, `client/`, `routes/web.js`, `routes/mobile.js`). Add any discovered existing surfaces to the table above.
133
+
134
+ > ⚠️ **New-client signal**: If this milestone adds a consumer surface to a system that already has one or more other consumer surfaces, SharedCore evaluation is MANDATORY regardless of shared operation count.
135
+
136
+ If only one surface exists and no prior surfaces were found → mark "Single consumer — SharedCore not needed" and proceed to Step 2.
137
+
138
+ ---
139
+
140
+ ### 1.6.2 — Identify Shared Operations
141
+
142
+ Compare the "Operations Needed" column across all surfaces. Flag every operation that appears in 2 or more surfaces:
143
+
144
+ ```markdown
145
+ ## Shared Operations (candidates for SharedCore)
146
+
147
+ | Operation | Surfaces That Need It | Shared? |
148
+ |------------------|-----------------------|---------|
149
+ | login | web, mobile | ✅ |
150
+ | list-items | web, mobile, cli | ✅ |
151
+ | get-item | web, mobile | ✅ |
152
+ | update-progress | web, mobile | ✅ |
153
+ | offline-sync | mobile only | ❌ |
154
+ | export-data | cli only | ❌ |
155
+ ```
156
+
157
+ ---
158
+
159
+ ### 1.6.3 — Auto-Suggest SharedCore Domain
160
+
161
+ **If 2 or more shared operations exist, OR if this milestone adds a new consumer surface to a system that already has other surfaces (detected in the Existing System Check above):**
162
+
163
+ > ⚠️ **SharedCore recommended** — {N} operations are needed by {M} consumer surfaces.
164
+ > A `shared-core` domain will be added to own these functions.
165
+ > Surfaces get thin adapter layers that call SharedCore — not duplicate implementations.
166
+
167
+ Add `shared-core` to the domain list before running Step 2. The `shared-core` domain:
168
+ - Owns: the shared operation implementations
169
+ - Consumed by: all surface-specific adapter domains
170
+ - Contract: `shared-services-contract.md` (use the template from `templates/shared-services-contract.md`)
171
+
172
+ **If only 1 shared operation exists AND this is not a new-client-to-existing-system scenario:**
173
+
174
+ > ℹ️ {N} shared operations found. Inline sharing is sufficient — no separate SharedCore domain needed. Document shared functions in the relevant domain's constraints.md.
175
+
176
+ ---
177
+
178
+ ### 1.6.4 — Write the Shared Services Contract
179
+
180
+ If SharedCore was created, populate `.gsd-t/contracts/shared-services-contract.md` using the template from `templates/shared-services-contract.md`.
181
+
182
+ ---
183
+
184
+ ## Step 2: Identify Domains
185
+
186
+ Decompose the milestone into 2-5 independent domains. Each domain should:
187
+ - Own a distinct area of functionality
188
+ - Have minimal overlap with other domains
189
+ - Map to a clear set of files/directories it will own
190
+ - Be executable by a single agent without needing another domain's internals
191
+
192
+ For each domain, create `.gsd-t/domains/{domain-name}/`:
193
+ ```
194
+ .gsd-t/domains/{domain-name}/
195
+ ├── scope.md — what this domain owns (files, directories, responsibilities)
196
+ ├── tasks.md — (empty for now, filled during plan phase)
197
+ └── constraints.md — patterns to follow, files NOT to touch, conventions
198
+ ```
199
+
200
+ ### scope.md format:
201
+ ```markdown
202
+ # Domain: {name}
203
+
204
+ ## Responsibility
205
+ {What this domain is responsible for}
206
+
207
+ ## Owned Files/Directories
208
+ - src/{path}/ — {description}
209
+ - src/{path}/ — {description}
210
+
211
+ ## NOT Owned (do not modify)
212
+ - {files owned by other domains}
213
+ ```
214
+
215
+ ### constraints.md format:
216
+ ```markdown
217
+ # Constraints: {domain-name}
218
+
219
+ ## Must Follow
220
+ - {pattern or convention from CLAUDE.md}
221
+ - {specific technical constraint}
222
+
223
+ ## Must Not
224
+ - Modify files outside owned scope
225
+ - Create new database tables (data-layer domain owns schema)
226
+ - {other boundaries}
227
+
228
+ ## Dependencies
229
+ - Depends on: {other domain} for {what}
230
+ - Depended on by: {other domain} for {what}
231
+ ```
232
+
233
+ ## Step 3: Write Contracts
234
+
235
+ Contracts define HOW domains interact. Create files in `.gsd-t/contracts/`:
236
+
237
+ For each boundary between domains, write a contract:
238
+
239
+ ### API contracts (`api-contract.md`):
240
+ ```markdown
241
+ # API Contract
242
+
243
+ ## POST /api/auth/login
244
+ Request: { email: string, password: string }
245
+ Response: { token: string, user: { id: string, email: string, role: string } }
246
+ Errors: 401 { error: "invalid_credentials" }
247
+ Owner: auth domain
248
+ Consumers: ui domain
249
+
250
+ ## GET /api/users/:id
251
+ ...
252
+ ```
253
+
254
+ ### Schema contracts (`schema-contract.md`):
255
+ ```markdown
256
+ # Schema Contract
257
+
258
+ ## Users Table
259
+ | Column | Type | Constraints |
260
+ |--------|------|------------|
261
+ | id | uuid | PK, auto |
262
+ | email | varchar(255) | unique, not null |
263
+ ...
264
+
265
+ Owner: data-layer domain
266
+ Consumers: auth domain, ui domain
267
+ ```
268
+
269
+ ### Component contracts (`component-contract.md`):
270
+ ```markdown
271
+ # Component Contract
272
+
273
+ ## LoginForm
274
+ Props: { onSuccess: (user: User) => void, onError: (msg: string) => void }
275
+ Events: Calls POST /api/auth/login per api-contract
276
+ Owner: ui domain
277
+ ```
278
+
279
+ ### Integration points (`integration-points.md`):
280
+ ```markdown
281
+ # Integration Points
282
+
283
+ ## Auth → Data Layer
284
+ - Auth domain reads Users table (schema-contract.md)
285
+ - Auth domain calls data-layer's user lookup function
286
+ - Checkpoint: data-layer must complete Task 2 before auth starts Task 3
287
+
288
+ ## UI → Auth
289
+ - UI calls auth endpoints per api-contract.md
290
+ - Checkpoint: auth must complete Task 2 before UI starts Task 4
291
+ ```
292
+
293
+ ## Step 3.5: Design Brief Detection (UI Projects Only)
294
+
295
+ After writing contracts, check for UI/frontend signals. If found, generate `.gsd-t/contracts/design-brief.md` to give all subagents a consistent visual language reference.
296
+
297
+ **Skip this step entirely if no UI signals are detected.**
298
+
299
+ ### Detection — check for ANY of the following
300
+
301
+ | Signal | How to check |
302
+ |--------|-------------|
303
+ | React in stack | `"react"` in `package.json` `dependencies` or `devDependencies` |
304
+ | Vue in stack | `"vue"` in `package.json` dependencies |
305
+ | Svelte in stack | `"svelte"` in `package.json` dependencies |
306
+ | Next.js in stack | `"next"` in `package.json` dependencies |
307
+ | Flutter project | `pubspec.yaml` exists |
308
+ | CSS/SCSS files in scope | `.css`, `.scss`, or `.sass` files present in the codebase |
309
+ | Component files in scope | `.jsx`, `.tsx`, `.svelte`, or `.vue` files present |
310
+ | Tailwind config exists | `tailwind.config.js` or `tailwind.config.ts` exists |
311
+
312
+ If NONE of the above match → skip this step entirely. Log: "Design brief: skipped — no UI signals detected."
313
+
314
+ **If `.gsd-t/contracts/design-brief.md` already exists do NOT overwrite. Log: "Design brief: skipped existing brief preserved." and continue.**
315
+
316
+ ### Generate `.gsd-t/contracts/design-brief.md`
317
+
318
+ Source priority (use first source that provides a value):
319
+ 1. **Tailwind config** (`tailwind.config.js/ts`) — extract `theme.colors`, `theme.fontFamily`, `theme.spacing`
320
+ 2. **Design token files** (`theme.ts`, `tokens.css`, `design-tokens.json`) — extract token values
321
+ 3. **Quality North Star** (read `## Quality North Star` from `CLAUDE.md`) — use for Tone & Voice section (skip gracefully if absent)
322
+ 4. **Defaults** sensible web defaults if no signals found (Tailwind defaults, system fonts, 4px spacing)
323
+
324
+ Generate the file using this format:
325
+
326
+ ```markdown
327
+ # Design Brief
328
+
329
+ ## Project
330
+ {project name}
331
+
332
+ ## Color Palette
333
+ | Role | Value | Usage |
334
+ |------------|---------|------------------------|
335
+ | Primary | #000000 | CTA buttons, links |
336
+ | Secondary | #000000 | Secondary actions |
337
+ | Background | #ffffff | Page background |
338
+ | Surface | #f5f5f5 | Cards, panels |
339
+ | Error | #ef4444 | Error states |
340
+ | Success | #22c55e | Success states |
341
+
342
+ ## Typography
343
+ | Role | Family | Size | Weight |
344
+ |-----------|-----------|----------|--------|
345
+ | Heading 1 | {font} | 2rem | 700 |
346
+ | Heading 2 | {font} | 1.5rem | 600 |
347
+ | Body | {font} | 1rem | 400 |
348
+ | Caption | {font} | 0.875rem | 400 |
349
+ | Code | monospace | 0.875rem | 400 |
350
+
351
+ ## Spacing System
352
+ - Base unit: 4px
353
+ - Scale: 4, 8, 12, 16, 24, 32, 48, 64, 96
354
+
355
+ ## Component Patterns
356
+ - {e.g., "Use shadcn/ui primitives for all interactive elements"}
357
+ - {e.g., "Card pattern: rounded-lg border shadow-sm p-4"}
358
+ - {e.g., "Form pattern: label above input, error below"}
359
+
360
+ ## Layout Principles
361
+ - {e.g., "Max content width: 1280px, centered"}
362
+ - {e.g., "Mobile-first: stack to horizontal at md breakpoint"}
363
+
364
+ ## Interaction Patterns
365
+ - {e.g., "Loading: skeleton screens, not spinners"}
366
+ - {e.g., "Transitions: 150ms ease for state changes"}
367
+
368
+ ## Tone & Voice
369
+ {Derived from Quality North Star or brand voice — e.g., "Professional but approachable. Error messages are friendly and actionable."}
370
+ ```
371
+
372
+ Log in `.gsd-t/progress.md` Decision Log: `- {date}: Design brief generated at .gsd-t/contracts/design-brief.md — UI signals detected: {list of signals}`
373
+
374
+ ## Step 4: Initialize Progress
375
+
376
+ Write `.gsd-t/progress.md`:
377
+ ```markdown
378
+ # GSD-T Progress
379
+
380
+ ## Milestone: {name}
381
+ ## Status: PARTITIONED
382
+ ## Date: {today}
383
+
384
+ ## Domains
385
+ | Domain | Status | Tasks | Completed |
386
+ |--------|--------|-------|-----------|
387
+ | {name} | partitioned | 0 | 0 |
388
+
389
+ ## Contracts
390
+ - [ ] api-contract.md
391
+ - [ ] schema-contract.md
392
+ - [x] {any completed ones}
393
+
394
+ ## Integration Checkpoints
395
+ - [ ] {checkpoint description} — blocks {domain} task {N}
396
+
397
+ ## Decision Log
398
+ - {date}: {decision and rationale}
399
+ ```
400
+
401
+ ## Step 5: Document Ripple
402
+
403
+ After creating domains and contracts, update affected documentation:
404
+
405
+ ### Always update:
406
+ 1. **`.gsd-t/progress.md`** — Already updated in Step 4, but verify Decision Log includes partition rationale
407
+
408
+ ### Check if affected:
409
+ 2. **`docs/architecture.md`** — If the partition defines new component boundaries or clarifies the system structure, update it
410
+ 3. **`docs/requirements.md`** — If partitioning revealed that requirements need clarification or splitting by domain, update them
411
+ 4. **`CLAUDE.md`** — If the partition establishes new file ownership conventions or domain-specific patterns, add them
412
+
413
+ ### Skip what's not affected.
414
+
415
+ ## Step 6: Test Verification
416
+
417
+ Before finalizing the partition:
418
+
419
+ 1. **Run existing tests**: Execute the full test suite to confirm codebase is clean before domain work begins
420
+ 2. **Verify passing**: If any tests fail, assign them to the appropriate domain as pre-existing issues
421
+ 3. **Map tests to domains**: Note which test files belong to which domain — this informs task planning
422
+
423
+ ## Step 7: Validate
424
+
425
+ Before finishing, verify:
426
+ - [ ] Every file in `src/` is owned by exactly one domain
427
+ - [ ] No domain scope overlaps with another
428
+ - [ ] Every dependency between domains has a contract
429
+ - [ ] Every contract has an owner and at least one consumer
430
+ - [ ] Integration checkpoints are identified for all cross-domain dependencies
431
+
432
+ ### Autonomy Behavior
433
+
434
+ **Level 3 (Full Auto)**: Log a brief status line (e.g., "✅ Partition complete — {N} domains defined, {N} contracts written") and auto-advance to the next phase. Do NOT wait for user input.
435
+
436
+ **Level 1–2**: Report the partition to the user with a summary of domains, contracts, and any decisions that need input. Wait for confirmation before proceeding.
437
+
438
+ $ARGUMENTS
439
+
440
+ ## Auto-Clear
441
+
442
+ All work is committed to project files. Execute `/clear` to free the context window for the next command.