@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,209 +1,209 @@
1
- ---
2
- argument-hint: <copy|insert|update|delete> <relative-path/filename> [content]
3
- ---
4
-
5
- # GSD-T: Global Change — Apply Changes Across All GSD-T Projects
6
-
7
- You are applying a file-level change to every GSD-T project registered in `.claude/.gsd-t-projects`. This is a **global** slash command (installed to `~/.claude/commands/`) that enables bulk updates to project configuration, CLAUDE.md files, templates, and any other files that need to stay consistent across the GSD-T ecosystem.
8
-
9
- ## Syntax
10
-
11
- ```
12
- /global-change <operation> <relative-path/filename> [arguments]
13
- ```
14
-
15
- ### Operations
16
-
17
- | Operation | Arguments | Description |
18
- |-----------|-----------|-------------|
19
- | `copy` | `<relative-path/filename>` | Copy file from the GSD-T package directory to the same relative path in all projects |
20
- | `insert` | `<relative-path/filename> <content>` | Append content to the specified file in all projects |
21
- | `update` | `<relative-path/filename> <old_content> %%REPLACE_WITH%% <new_content>` | Find `old_content` in the file and replace it with `new_content` in all projects |
22
- | `delete` | `<relative-path/filename>` | Delete the specified file from all projects |
23
-
24
- ### Examples
25
-
26
- ```
27
- /global-change copy .gsd-t/templates/contract.md
28
-
29
- /global-change insert .gsd-t/config.json {"newSetting": true}
30
-
31
- /global-change update CLAUDE.md
32
- - `model: haiku` — mechanical tasks
33
- - `model: sonnet` (default) — reasoning tasks
34
- %%REPLACE_WITH%%
35
- - `model: haiku` — mechanical tasks (same as now)
36
- - `model: sonnet` — mid-tier reasoning: routine code changes, standard refactors, test writing, straightforward synthesis
37
- - `model: opus` — high-stakes reasoning: architecture decisions, security analysis, complex debugging, cross-module refactors, quality judgment on critical paths
38
-
39
- /global-change delete .gsd-t/deprecated-template.md
40
- ```
41
-
42
- ## Step 1: Load the Project Registry
43
-
44
- Read `~/.claude/.gsd-t-projects`. This file contains one absolute project path per line.
45
-
46
- ```
47
- # Example .gsd-t-projects
48
- C:/Users/david/MyNextListen
49
- C:/Users/david/TimeTracking
50
- C:/Users/david/tekyz-ai-copilot
51
- ```
52
-
53
- If the file does not exist or is empty:
54
- - STOP. Tell the user: "No GSD-T projects registered. Register projects by adding their absolute paths (one per line) to `~/.claude/.gsd-t-projects`."
55
- - Do NOT proceed.
56
-
57
- Parse the file:
58
- - Skip blank lines
59
- - Skip lines starting with `#` (comments)
60
- - Trim whitespace from each path
61
- - Store as `PROJECT_PATHS[]`
62
-
63
- ## Step 2: Parse Arguments
64
-
65
- Extract from $ARGUMENTS:
66
- 1. **operation** — first word: `copy`, `insert`, `update`, or `delete`
67
- 2. **relative-path/filename** — second token: the file path relative to each project root (e.g., `CLAUDE.md`, `.gsd-t/config.json`, `docs/architecture.md`)
68
- 3. **Remaining arguments** depend on the operation:
69
- - `copy` — no additional arguments
70
- - `insert` — everything after the filename is the content to append
71
- - `update` — everything after the filename is split by the `%%REPLACE_WITH%%` delimiter into **old_content** (before) and **new_content** (after)
72
- - `delete` — no additional arguments
73
-
74
- ### Parsing the `update` Delimiter
75
-
76
- For `update` operations, the content portion (everything after the filename) MUST contain the literal string `%%REPLACE_WITH%%` on its own line. Split on this delimiter:
77
- - **old_content** = trimmed text before `%%REPLACE_WITH%%` — the exact text to find in the target file
78
- - **new_content** = trimmed text after `%%REPLACE_WITH%%` — the replacement text
79
-
80
- If the delimiter is missing, STOP and show the user the correct syntax:
81
- ```
82
- Usage: /global-change update <file> <old content> %%REPLACE_WITH%% <new content>
83
- ```
84
-
85
- ### Validation Rules
86
-
87
- - If operation is missing or not one of `copy|insert|update|delete` → STOP, show usage syntax
88
- - If relative-path/filename is missing → STOP, show usage syntax
89
- - If operation is `insert` and no content is provided → STOP, tell the user content is required
90
- - If operation is `update` and `%%REPLACE_WITH%%` delimiter is missing → STOP, show correct syntax
91
- - If operation is `update` and either old_content or new_content is empty → STOP, both sides of the delimiter are required
92
- - If operation is `copy` and the source file does not exist in the GSD-T package directory → STOP, tell the user the source file was not found
93
-
94
- ### Determine GSD-T Package Directory
95
-
96
- The source directory for `copy` operations is the installed GSD-T package location. Resolve it by checking (in order):
97
- 1. The directory containing this command file (walk up to the package root)
98
- 2. `node_modules/@tekyz/gsd-t/` relative to the global npm prefix
99
- 3. Ask the user if neither resolves
100
-
101
- ## Step 3: Dry Run — Scan All Projects First
102
-
103
- Before making any changes, scan every project to preview what will happen. For each project in `PROJECT_PATHS[]`:
104
-
105
- ### For `copy`:
106
- - Check if the target file already exists → note "will overwrite" or "will create"
107
-
108
- ### For `insert`:
109
- - Check if the target file exists → note "will append to existing" or "will create new file"
110
-
111
- ### For `update`:
112
- - Read the target file
113
- - Search for `old_content` in the file contents
114
- - If found → note "match found — will replace"
115
- - If NOT found → note "⚠ NO MATCH — will skip" (do NOT modify files where the old content isn't found)
116
- - If found multiple times → note "⚠ MULTIPLE MATCHES ([count]) — will replace all occurrences"
117
-
118
- ### For `delete`:
119
- - Check if the target file exists → note "will delete" or "will skip (not found)"
120
-
121
- ### Display the dry run summary:
122
-
123
- ```
124
- Global Change — Pre-flight Summary
125
- Operation: [operation]
126
- Target: [relative-path/filename]
127
- Projects: [N] registered
128
-
129
- [For update — show old/new content preview]
130
-
131
- Dry run results:
132
- [status] [project-name] — [description]
133
- [status] [project-name] — [description]
134
- ```
135
-
136
- **Level 3 (Full Auto)**: If ALL projects show clean matches (no warnings), auto-proceed to Step 4 without asking. If ANY project shows a warning (no match, multiple matches), pause and ask.
137
-
138
- **Level 1-2**: Always pause and ask for confirmation.
139
-
140
- ## Step 4: Execute Changes
141
-
142
- For each project that passed the dry run:
143
-
144
- ### `copy`
145
- 1. Determine the target: `{PROJECT_PATH}/{relative-path/filename}`
146
- 2. If the target directory does not exist → create it (including intermediate directories)
147
- 3. Copy the source file to the target, overwriting if it exists
148
-
149
- ### `insert`
150
- 1. Determine the target: `{PROJECT_PATH}/{relative-path/filename}`
151
- 2. If the target directory does not exist → create it (including intermediate directories)
152
- 3. If the target file does not exist → create it with the provided content
153
- 4. If the target file exists → append a newline + the provided content to the end
154
-
155
- ### `update`
156
- 1. Determine the target: `{PROJECT_PATH}/{relative-path/filename}`
157
- 2. If the file does not exist → skip
158
- 3. Read the file contents
159
- 4. Search for `old_content` (exact string match, whitespace-sensitive)
160
- 5. If NOT found → skip
161
- 6. If found → replace ALL occurrences of `old_content` with `new_content`
162
- 7. Write the modified contents back to the file
163
-
164
- ### `delete`
165
- 1. Determine the target: `{PROJECT_PATH}/{relative-path/filename}`
166
- 2. If the target file does not exist → skip
167
- 3. If the target file exists → delete it
168
- 4. Do NOT delete the parent directory even if empty
169
-
170
- ### Error Handling
171
- - On failure, record: `FAILED: {error message}`
172
- - Never abort the entire run because one project failed — continue to the next
173
-
174
- ## Step 5: Report Results
175
-
176
- Display the final summary:
177
-
178
- ```
179
- Global Change — Results
180
- Operation: [operation] [relative-path/filename]
181
- Succeeded: [N] / [total] projects
182
- Failed: [N]
183
- Skipped: [N]
184
-
185
- [status] [project-name] — [result]
186
- [status] [project-name] — [result]
187
- ```
188
-
189
- Status icons:
190
- - `✓` — success
191
- - `⊘` — skipped (file not found, no match, etc.)
192
- - `✗` — failed with error
193
-
194
- If there were failures, list them with actionable error messages.
195
-
196
- ## Notes
197
-
198
- - **Relative paths use forward slashes** regardless of OS
199
- - **No glob patterns** — operates on a single file per invocation
200
- - **Content for `insert`** can be provided inline or pasted in the user's message
201
- - **Content for `update`** uses the `%%REPLACE_WITH%%` delimiter — old_content match is exact and whitespace-sensitive
202
- - **Project names in logs** are derived from the last segment of the project path
203
- - **The `.gsd-t-projects` file** is maintained by `gsd-t init` (auto-registers) and `gsd-t update-all` (reads)
204
-
205
- $ARGUMENTS
206
-
207
- ## Auto-Clear
208
-
209
- All work is committed to project files. Execute `/clear` to free the context window for the next command.
1
+ ---
2
+ argument-hint: <copy|insert|update|delete> <relative-path/filename> [content]
3
+ ---
4
+
5
+ # GSD-T: Global Change — Apply Changes Across All GSD-T Projects
6
+
7
+ You are applying a file-level change to every GSD-T project registered in `.claude/.gsd-t-projects`. This is a **global** slash command (installed to `~/.claude/commands/`) that enables bulk updates to project configuration, CLAUDE.md files, templates, and any other files that need to stay consistent across the GSD-T ecosystem.
8
+
9
+ ## Syntax
10
+
11
+ ```
12
+ /global-change <operation> <relative-path/filename> [arguments]
13
+ ```
14
+
15
+ ### Operations
16
+
17
+ | Operation | Arguments | Description |
18
+ |-----------|-----------|-------------|
19
+ | `copy` | `<relative-path/filename>` | Copy file from the GSD-T package directory to the same relative path in all projects |
20
+ | `insert` | `<relative-path/filename> <content>` | Append content to the specified file in all projects |
21
+ | `update` | `<relative-path/filename> <old_content> %%REPLACE_WITH%% <new_content>` | Find `old_content` in the file and replace it with `new_content` in all projects |
22
+ | `delete` | `<relative-path/filename>` | Delete the specified file from all projects |
23
+
24
+ ### Examples
25
+
26
+ ```
27
+ /global-change copy .gsd-t/templates/contract.md
28
+
29
+ /global-change insert .gsd-t/config.json {"newSetting": true}
30
+
31
+ /global-change update CLAUDE.md
32
+ - `model: haiku` — mechanical tasks
33
+ - `model: sonnet` (default) — reasoning tasks
34
+ %%REPLACE_WITH%%
35
+ - `model: haiku` — mechanical tasks (same as now)
36
+ - `model: sonnet` — mid-tier reasoning: routine code changes, standard refactors, test writing, straightforward synthesis
37
+ - `model: opus` — high-stakes reasoning: architecture decisions, security analysis, complex debugging, cross-module refactors, quality judgment on critical paths
38
+
39
+ /global-change delete .gsd-t/deprecated-template.md
40
+ ```
41
+
42
+ ## Step 1: Load the Project Registry
43
+
44
+ Read `~/.claude/.gsd-t-projects`. This file contains one absolute project path per line.
45
+
46
+ ```
47
+ # Example .gsd-t-projects
48
+ C:/Users/david/MyNextListen
49
+ C:/Users/david/TimeTracking
50
+ C:/Users/david/tekyz-ai-copilot
51
+ ```
52
+
53
+ If the file does not exist or is empty:
54
+ - STOP. Tell the user: "No GSD-T projects registered. Register projects by adding their absolute paths (one per line) to `~/.claude/.gsd-t-projects`."
55
+ - Do NOT proceed.
56
+
57
+ Parse the file:
58
+ - Skip blank lines
59
+ - Skip lines starting with `#` (comments)
60
+ - Trim whitespace from each path
61
+ - Store as `PROJECT_PATHS[]`
62
+
63
+ ## Step 2: Parse Arguments
64
+
65
+ Extract from $ARGUMENTS:
66
+ 1. **operation** — first word: `copy`, `insert`, `update`, or `delete`
67
+ 2. **relative-path/filename** — second token: the file path relative to each project root (e.g., `CLAUDE.md`, `.gsd-t/config.json`, `docs/architecture.md`)
68
+ 3. **Remaining arguments** depend on the operation:
69
+ - `copy` — no additional arguments
70
+ - `insert` — everything after the filename is the content to append
71
+ - `update` — everything after the filename is split by the `%%REPLACE_WITH%%` delimiter into **old_content** (before) and **new_content** (after)
72
+ - `delete` — no additional arguments
73
+
74
+ ### Parsing the `update` Delimiter
75
+
76
+ For `update` operations, the content portion (everything after the filename) MUST contain the literal string `%%REPLACE_WITH%%` on its own line. Split on this delimiter:
77
+ - **old_content** = trimmed text before `%%REPLACE_WITH%%` — the exact text to find in the target file
78
+ - **new_content** = trimmed text after `%%REPLACE_WITH%%` — the replacement text
79
+
80
+ If the delimiter is missing, STOP and show the user the correct syntax:
81
+ ```
82
+ Usage: /global-change update <file> <old content> %%REPLACE_WITH%% <new content>
83
+ ```
84
+
85
+ ### Validation Rules
86
+
87
+ - If operation is missing or not one of `copy|insert|update|delete` → STOP, show usage syntax
88
+ - If relative-path/filename is missing → STOP, show usage syntax
89
+ - If operation is `insert` and no content is provided → STOP, tell the user content is required
90
+ - If operation is `update` and `%%REPLACE_WITH%%` delimiter is missing → STOP, show correct syntax
91
+ - If operation is `update` and either old_content or new_content is empty → STOP, both sides of the delimiter are required
92
+ - If operation is `copy` and the source file does not exist in the GSD-T package directory → STOP, tell the user the source file was not found
93
+
94
+ ### Determine GSD-T Package Directory
95
+
96
+ The source directory for `copy` operations is the installed GSD-T package location. Resolve it by checking (in order):
97
+ 1. The directory containing this command file (walk up to the package root)
98
+ 2. `node_modules/@tekyz/gsd-t/` relative to the global npm prefix
99
+ 3. Ask the user if neither resolves
100
+
101
+ ## Step 3: Dry Run — Scan All Projects First
102
+
103
+ Before making any changes, scan every project to preview what will happen. For each project in `PROJECT_PATHS[]`:
104
+
105
+ ### For `copy`:
106
+ - Check if the target file already exists → note "will overwrite" or "will create"
107
+
108
+ ### For `insert`:
109
+ - Check if the target file exists → note "will append to existing" or "will create new file"
110
+
111
+ ### For `update`:
112
+ - Read the target file
113
+ - Search for `old_content` in the file contents
114
+ - If found → note "match found — will replace"
115
+ - If NOT found → note "⚠ NO MATCH — will skip" (do NOT modify files where the old content isn't found)
116
+ - If found multiple times → note "⚠ MULTIPLE MATCHES ([count]) — will replace all occurrences"
117
+
118
+ ### For `delete`:
119
+ - Check if the target file exists → note "will delete" or "will skip (not found)"
120
+
121
+ ### Display the dry run summary:
122
+
123
+ ```
124
+ Global Change — Pre-flight Summary
125
+ Operation: [operation]
126
+ Target: [relative-path/filename]
127
+ Projects: [N] registered
128
+
129
+ [For update — show old/new content preview]
130
+
131
+ Dry run results:
132
+ [status] [project-name] — [description]
133
+ [status] [project-name] — [description]
134
+ ```
135
+
136
+ **Level 3 (Full Auto)**: If ALL projects show clean matches (no warnings), auto-proceed to Step 4 without asking. If ANY project shows a warning (no match, multiple matches), pause and ask.
137
+
138
+ **Level 1-2**: Always pause and ask for confirmation.
139
+
140
+ ## Step 4: Execute Changes
141
+
142
+ For each project that passed the dry run:
143
+
144
+ ### `copy`
145
+ 1. Determine the target: `{PROJECT_PATH}/{relative-path/filename}`
146
+ 2. If the target directory does not exist → create it (including intermediate directories)
147
+ 3. Copy the source file to the target, overwriting if it exists
148
+
149
+ ### `insert`
150
+ 1. Determine the target: `{PROJECT_PATH}/{relative-path/filename}`
151
+ 2. If the target directory does not exist → create it (including intermediate directories)
152
+ 3. If the target file does not exist → create it with the provided content
153
+ 4. If the target file exists → append a newline + the provided content to the end
154
+
155
+ ### `update`
156
+ 1. Determine the target: `{PROJECT_PATH}/{relative-path/filename}`
157
+ 2. If the file does not exist → skip
158
+ 3. Read the file contents
159
+ 4. Search for `old_content` (exact string match, whitespace-sensitive)
160
+ 5. If NOT found → skip
161
+ 6. If found → replace ALL occurrences of `old_content` with `new_content`
162
+ 7. Write the modified contents back to the file
163
+
164
+ ### `delete`
165
+ 1. Determine the target: `{PROJECT_PATH}/{relative-path/filename}`
166
+ 2. If the target file does not exist → skip
167
+ 3. If the target file exists → delete it
168
+ 4. Do NOT delete the parent directory even if empty
169
+
170
+ ### Error Handling
171
+ - On failure, record: `FAILED: {error message}`
172
+ - Never abort the entire run because one project failed — continue to the next
173
+
174
+ ## Step 5: Report Results
175
+
176
+ Display the final summary:
177
+
178
+ ```
179
+ Global Change — Results
180
+ Operation: [operation] [relative-path/filename]
181
+ Succeeded: [N] / [total] projects
182
+ Failed: [N]
183
+ Skipped: [N]
184
+
185
+ [status] [project-name] — [result]
186
+ [status] [project-name] — [result]
187
+ ```
188
+
189
+ Status icons:
190
+ - `✓` — success
191
+ - `⊘` — skipped (file not found, no match, etc.)
192
+ - `✗` — failed with error
193
+
194
+ If there were failures, list them with actionable error messages.
195
+
196
+ ## Notes
197
+
198
+ - **Relative paths use forward slashes** regardless of OS
199
+ - **No glob patterns** — operates on a single file per invocation
200
+ - **Content for `insert`** can be provided inline or pasted in the user's message
201
+ - **Content for `update`** uses the `%%REPLACE_WITH%%` delimiter — old_content match is exact and whitespace-sensitive
202
+ - **Project names in logs** are derived from the last segment of the project path
203
+ - **The `.gsd-t-projects` file** is maintained by `gsd-t init` (auto-registers) and `gsd-t update-all` (reads)
204
+
205
+ $ARGUMENTS
206
+
207
+ ## Auto-Clear
208
+
209
+ All work is committed to project files. Execute `/clear` to free the context window for the next command.
@@ -0,0 +1,199 @@
1
+ # GSD-T: Audit — Component Cost/Benefit Analysis and Shadow Testing
2
+
3
+ You are running a harness self-audit — analyzing the cost and benefit of GSD-T enforcement components, with optional shadow mode testing.
4
+
5
+ ## Step 0: Launch via Subagent
6
+
7
+ To keep the main conversation context lean, run audit via a Task subagent.
8
+
9
+ **If you are the orchestrating agent** (you received the slash command directly):
10
+
11
+ **OBSERVABILITY LOGGING (MANDATORY):**
12
+ Before spawning — run via Bash:
13
+ `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}`
14
+
15
+ Spawn a fresh subagent using the Task tool:
16
+ ```
17
+ subagent_type: general-purpose
18
+ model: sonnet
19
+ prompt: "You are running gsd-t-audit with arguments: {$ARGUMENTS}
20
+ Working directory: {current project root}
21
+ Read CLAUDE.md and .gsd-t/progress.md for project context, then execute gsd-t-audit starting at Step 1."
22
+ ```
23
+
24
+ After subagent returns — run via Bash:
25
+ `T_END=$(date +%s) && DT_END=$(date +"%Y-%m-%d %H:%M") && TOK_END=${CLAUDE_CONTEXT_TOKENS_USED:-0} && DURATION=$((T_END-T_START))`
26
+ Compute tokens and compaction:
27
+ - No compaction (TOK_END >= TOK_START): `TOKENS=$((TOK_END-TOK_START))`, COMPACTED=null
28
+ - Compaction detected (TOK_END < TOK_START): `TOKENS=$(((TOK_MAX-TOK_START)+TOK_END))`, COMPACTED=$DT_END
29
+ Append to `.gsd-t/token-log.md` (create with header if missing):
30
+ `| {DT_START} | {DT_END} | gsd-t-audit | Step 0 | sonnet | {DURATION}s | audit: {args summary} | {TOKENS} | {COMPACTED} | | | {CTX_PCT} |`
31
+
32
+ Relay the subagent's summary to the user. **Do not execute Steps 1–5 yourself.**
33
+
34
+ **If you are the spawned subagent** (your prompt says "starting at Step 1"):
35
+ Continue to Step 1 below.
36
+
37
+ ## Step 1: Load Context
38
+
39
+ Parse $ARGUMENTS for flags:
40
+ - `--component=<id>` → target a specific component ID
41
+ - `--shadow` → run in shadow mode (log results, don't enforce)
42
+ - `--report-only` → show current cost/benefit ledger without running tasks
43
+
44
+ Read:
45
+ 1. `.gsd-t/progress.md` — current milestone
46
+ 2. `.gsd-t/component-registry.jsonl` — all registered components
47
+ 3. `.gsd-t/metrics/component-impact.jsonl` — cost/benefit history
48
+
49
+ If component registry is missing or empty, run:
50
+ ```
51
+ node bin/component-registry.js --seed
52
+ ```
53
+ or call `seedRegistry()` from `bin/component-registry.js`.
54
+
55
+ ## Step 2: Route by Mode
56
+
57
+ ### Mode: --report-only
58
+
59
+ Skip to Step 3 (Report).
60
+
61
+ ### Mode: --shadow [--component=<id>]
62
+
63
+ Skip to Step 4 (Shadow Run).
64
+
65
+ ### Mode: --component=<id> (no shadow, no report-only)
66
+
67
+ Run A/B test: disable the target component for the next task run and compare outcomes. Skip to Step 5 (A/B Test).
68
+
69
+ ### Mode: no flags
70
+
71
+ Generate a full cost/benefit report for all components. Go to Step 3 (Report).
72
+
73
+ ## Step 3: Cost/Benefit Report
74
+
75
+ Read all records from `.gsd-t/metrics/component-impact.jsonl`.
76
+
77
+ For each component in the registry, compute:
78
+ - **Total token cost**: sum of `token_cost` across all milestones
79
+ - **Total bugs prevented**: sum of `bugs_prevented`
80
+ - **Total false positives**: sum of `false_positives`
81
+ - **Verdict distribution**: count positive / neutral / negative verdicts
82
+ - **Consecutive negative**: latest `consecutive_negative` value
83
+ - **Status**: current status from registry (active / flagged / deprecated)
84
+
85
+ Display a summary table:
86
+
87
+ ```
88
+ ## Component Cost/Benefit Report — {date}
89
+
90
+ | Component | Status | Milestones | Tokens | Bugs Prevented | False Positives | Positive | Neutral | Negative | Consec- |
91
+ |---------------------|----------|------------|----------|----------------|-----------------|----------|---------|----------|---------|
92
+ | Red Team Adv. QA | active | N | N | N | N | N | N | N | N |
93
+ | QA Agent | active | N | N | N | N | N | N | N | N |
94
+ | ... | | | | | | | | | |
95
+
96
+ Flagged for review (consecutive_negative >= 3):
97
+ - {component name} (comp-id) — {N} consecutive negative verdicts
98
+ ```
99
+
100
+ If no impact data exists, show:
101
+ ```
102
+ No impact data recorded yet. Impact is recorded during complete-milestone via recordImpact().
103
+ ```
104
+
105
+ Write the report to `.gsd-t/audit-report.md`.
106
+
107
+ ## Step 4: Shadow Run
108
+
109
+ Shadow mode: the target component runs normally but its enforcement actions are logged instead of applied.
110
+
111
+ 1. Identify the target component (from `--component=<id>` or all `shadow_capable: true` components if no ID)
112
+ 2. For each target component, check `shadow_capable: true` in registry — skip any that cannot shadow
113
+ 3. Log shadow run to `.gsd-t/audit-report.md`:
114
+
115
+ ```
116
+ ## Shadow Run — {component name} — {date}
117
+
118
+ Component: {id}
119
+ Shadow capable: {yes/no}
120
+ Mode: logging only (enforcement skipped)
121
+
122
+ Results:
123
+ - Would have fired: {yes/no}
124
+ - Findings that would have been enforced: {list or "none"}
125
+ - Token cost (estimated): {N}
126
+
127
+ Verdict: {what the component would have concluded}
128
+ ```
129
+
130
+ 4. Append impact record with verdict `neutral` (shadow runs don't count as real verdicts):
131
+ ```javascript
132
+ recordImpact(componentId, milestone, { token_cost: estimated, bugs_prevented: 0, false_positives: 0, context_pct: 0, verdict: "neutral" })
133
+ ```
134
+
135
+ ## Step 5: A/B Test (Component Disabled)
136
+
137
+ A/B test mode: disable the target component for the current task run and compare against baseline.
138
+
139
+ 1. Verify the component has `can_disable: true` — if not, abort with:
140
+ "Component {id} cannot be cleanly disabled (can_disable: false). Use --shadow instead."
141
+
142
+ 2. Note current state:
143
+ - Read last 3 milestones of impact history for this component
144
+ - Establish baseline: avg `bugs_prevented`, avg `token_cost`, avg verdict
145
+
146
+ 3. Run the current task WITHOUT the component:
147
+ - Log to audit report that the component was disabled for this run
148
+ - Document any quality differences observed (bugs missed, regressions, etc.)
149
+
150
+ 4. Compare results and write to `.gsd-t/audit-report.md`:
151
+
152
+ ```
153
+ ## A/B Test — {component name} — {date}
154
+
155
+ Component: {id}
156
+ Test milestone: {current milestone}
157
+ Baseline (last 3 milestones): avg {N} bugs prevented, avg {N} tokens
158
+
159
+ With component DISABLED:
160
+ - Bugs caught by other mechanisms: {N}
161
+ - Bugs missed: {N} (estimated)
162
+ - Token savings: {N}
163
+ - Quality delta: {positive/neutral/negative}
164
+
165
+ Recommendation: {keep / deprecate / shadow-only}
166
+ ```
167
+
168
+ 5. Record the impact with verdict based on quality delta.
169
+
170
+ ## Step 6: Update Progress
171
+
172
+ Append to `.gsd-t/progress.md` Decision Log:
173
+ `- {date}: gsd-t-audit ran in {mode} mode — {brief summary of findings}`
174
+
175
+ ## Step 7: Report to User
176
+
177
+ Present a concise summary:
178
+
179
+ ```
180
+ ## Audit Complete
181
+
182
+ Mode: {report-only | shadow | a/b test | full report}
183
+ Components analyzed: {N}
184
+ Flagged for deprecation: {N}
185
+ Report written to: .gsd-t/audit-report.md
186
+
187
+ Key findings:
188
+ - {finding 1}
189
+ - {finding 2}
190
+ ```
191
+
192
+ If any components have `consecutive_negative >= 3` (flagged status), add:
193
+ ```
194
+ ⚠ FLAGGED COMPONENTS — recommend patch lifecycle review:
195
+ - {name} ({id}): {N} consecutive negative milestones
196
+ Run: /user:gsd-t-backlog-add to create a deprecation task
197
+ ```
198
+
199
+ $ARGUMENTS