Raunak211006 commited on
Commit
eaf56bf
·
verified ·
1 Parent(s): f64b4ec

Deploy HALE API v3.1

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .agent/workflows/add-phase.md +96 -0
  2. .agent/workflows/add-todo.md +69 -0
  3. .agent/workflows/audit-milestone.md +107 -0
  4. .agent/workflows/check-todos.md +80 -0
  5. .agent/workflows/complete-milestone.md +192 -0
  6. .agent/workflows/debug.md +235 -0
  7. .agent/workflows/discuss-phase.md +123 -0
  8. .agent/workflows/execute.md +323 -0
  9. .agent/workflows/help.md +96 -0
  10. .agent/workflows/insert-phase.md +109 -0
  11. .agent/workflows/install.md +177 -0
  12. .agent/workflows/list-phase-assumptions.md +82 -0
  13. .agent/workflows/map.md +394 -0
  14. .agent/workflows/new-milestone.md +155 -0
  15. .agent/workflows/new-project.md +368 -0
  16. .agent/workflows/pause.md +176 -0
  17. .agent/workflows/plan-milestone-gaps.md +116 -0
  18. .agent/workflows/plan.md +396 -0
  19. .agent/workflows/progress.md +90 -0
  20. .agent/workflows/remove-phase.md +139 -0
  21. .agent/workflows/research-phase.md +160 -0
  22. .agent/workflows/resume.md +131 -0
  23. .agent/workflows/sprint.md +192 -0
  24. .agent/workflows/update.md +201 -0
  25. .agent/workflows/verify.md +263 -0
  26. .agent/workflows/web-search.md +121 -0
  27. .agent/workflows/whats-new.md +80 -0
  28. .agents/skills/codebase-mapper/SKILL.md +226 -0
  29. .agents/skills/context-compressor/SKILL.md +201 -0
  30. .agents/skills/context-fetch/SKILL.md +184 -0
  31. .agents/skills/context-health-monitor/SKILL.md +105 -0
  32. .agents/skills/debugger/SKILL.md +273 -0
  33. .agents/skills/empirical-validation/SKILL.md +97 -0
  34. .agents/skills/executor/SKILL.md +465 -0
  35. .agents/skills/plan-checker/SKILL.md +283 -0
  36. .agents/skills/planner/SKILL.md +485 -0
  37. .agents/skills/token-budget/SKILL.md +166 -0
  38. .agents/skills/verifier/SKILL.md +421 -0
  39. .gemini/GEMINI.md +67 -0
  40. .gsd/ARCHITECTURE.md +86 -0
  41. .gsd/DECISIONS.md +51 -0
  42. .gsd/ROADMAP.md +100 -0
  43. .gsd/SPEC.md +42 -0
  44. .gsd/STATE.md +49 -0
  45. .gsd/examples/cross-platform.md +99 -0
  46. .gsd/examples/multi-wave-workflow.md +256 -0
  47. .gsd/examples/quick-reference.md +73 -0
  48. .gsd/examples/workflow-example.md +139 -0
  49. .gsd/templates/DEBUG.md +123 -0
  50. .gsd/templates/PLAN.md +90 -0
.agent/workflows/add-phase.md ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: Add a new phase to the end of the roadmap
3
+ argument-hint: "<phase-name>"
4
+ ---
5
+
6
+ # /add-phase Workflow
7
+
8
+ <objective>
9
+ Add a new phase to the end of the current roadmap.
10
+ </objective>
11
+
12
+ <process>
13
+
14
+ ## 1. Validate Roadmap Exists
15
+
16
+ ```powershell
17
+ if (-not (Test-Path ".gsd/ROADMAP.md")) {
18
+ Write-Error "ROADMAP.md required. Run /new-milestone first."
19
+ }
20
+ ```
21
+
22
+ ---
23
+
24
+ ## 2. Determine Next Phase Number
25
+
26
+ ```powershell
27
+ # Count existing phases
28
+ $phases = Select-String -Path ".gsd/ROADMAP.md" -Pattern "### Phase \d+"
29
+ $nextPhase = $phases.Count + 1
30
+ ```
31
+
32
+ ---
33
+
34
+ ## 3. Gather Phase Information
35
+
36
+ Ask for:
37
+ - **Name** — Phase title
38
+ - **Objective** — What this phase achieves
39
+ - **Depends on** — Previous phases (usually N-1)
40
+
41
+ ---
42
+
43
+ ## 4. Add to ROADMAP.md
44
+
45
+ Append:
46
+ ```markdown
47
+ ---
48
+
49
+ ### Phase {N}: {name}
50
+ **Status**: ⬜ Not Started
51
+ **Objective**: {objective}
52
+ **Depends on**: Phase {N-1}
53
+
54
+ **Tasks**:
55
+ - [ ] TBD (run /plan {N} to create)
56
+
57
+ **Verification**:
58
+ - TBD
59
+ ```
60
+
61
+ ---
62
+
63
+ ## 5. Update STATE.md
64
+
65
+ Note phase added.
66
+
67
+ ---
68
+
69
+ ## 6. Commit
70
+
71
+ ```powershell
72
+ git add .gsd/ROADMAP.md .gsd/STATE.md
73
+ git commit -m "docs: add phase {N} - {name}"
74
+ ```
75
+
76
+ ---
77
+
78
+ ## 7. Offer Next Steps
79
+
80
+ ```
81
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
82
+ GSD ► PHASE ADDED ✓
83
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
84
+
85
+ Phase {N}: {name}
86
+
87
+ ───────────────────────────────────────────────────────
88
+
89
+ ▶ NEXT
90
+
91
+ /plan {N} — Create execution plans for this phase
92
+
93
+ ───────────────────────────────────────────────────────
94
+ ```
95
+
96
+ </process>
.agent/workflows/add-todo.md ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: Capture a todo item for later
3
+ argument-hint: "<description> [--priority high|medium|low]"
4
+ ---
5
+
6
+ # /add-todo Workflow
7
+
8
+ <objective>
9
+ Quickly capture an idea, task, or issue without interrupting current work flow.
10
+ </objective>
11
+
12
+ <context>
13
+ **Item:** $ARGUMENTS (the todo description)
14
+
15
+ **Flags:**
16
+ - `--priority high|medium|low` — Set priority (default: medium)
17
+
18
+ **Output:**
19
+ - `.gsd/TODO.md` — Accumulated todo items
20
+ </context>
21
+
22
+ <process>
23
+
24
+ ## 1. Parse Arguments
25
+
26
+ Extract:
27
+ - Todo description
28
+ - Priority (default: medium)
29
+
30
+ ---
31
+
32
+ ## 2. Ensure TODO.md Exists
33
+
34
+ ```powershell
35
+ if (-not (Test-Path ".gsd/TODO.md")) {
36
+ # Create with header
37
+ }
38
+ ```
39
+
40
+ ---
41
+
42
+ ## 3. Add Todo Item
43
+
44
+ Append to `.gsd/TODO.md`:
45
+
46
+ ```markdown
47
+ - [ ] {description} `{priority}` — {date}
48
+ ```
49
+
50
+ ---
51
+
52
+ ## 4. Confirm
53
+
54
+ ```
55
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
56
+ GSD ► TODO ADDED ✓
57
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
58
+
59
+ {description}
60
+ Priority: {priority}
61
+
62
+ ───────────────────────────────────────────────────────
63
+
64
+ /check-todos — see all pending items
65
+
66
+ ───────────────────────────────────────────────────────
67
+ ```
68
+
69
+ </process>
.agent/workflows/audit-milestone.md ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: Audit a milestone for quality and completeness
3
+ argument-hint: "[milestone-name]"
4
+ ---
5
+
6
+ # /audit-milestone Workflow
7
+
8
+ <objective>
9
+ Review a completed (or in-progress) milestone for quality, completeness, and lessons learned.
10
+ </objective>
11
+
12
+ <process>
13
+
14
+ ## 1. Load Milestone Context
15
+
16
+ If milestone name provided, load from archive:
17
+ ```powershell
18
+ Get-Content ".gsd/milestones/{name}-SUMMARY.md"
19
+ ```
20
+
21
+ If no name, audit current milestone from ROADMAP.md.
22
+
23
+ ---
24
+
25
+ ## 2. Check Must-Haves Verification
26
+
27
+ For each must-have in the milestone:
28
+ - Was it verified with empirical evidence?
29
+ - Is the evidence still valid?
30
+ - Any regressions since completion?
31
+
32
+ ---
33
+
34
+ ## 3. Review Technical Debt
35
+
36
+ Check TODO.md and DECISIONS.md for:
37
+ - Deferred items during this milestone
38
+ - Technical debt acknowledged
39
+ - Items that should be addressed
40
+
41
+ ---
42
+
43
+ ## 4. Analyze Phase Quality
44
+
45
+ For each phase:
46
+ - Review VERIFICATION.md
47
+ - Check for gap closures (were there many?)
48
+ - Note recurring issues
49
+
50
+ ---
51
+
52
+ ## 5. Generate Audit Report
53
+
54
+ ```markdown
55
+ # Milestone Audit: {name}
56
+
57
+ **Audited:** {date}
58
+
59
+ ## Summary
60
+ | Metric | Value |
61
+ |--------|-------|
62
+ | Phases | {N} |
63
+ | Gap closures | {M} |
64
+ | Technical debt items | {K} |
65
+
66
+ ## Must-Haves Status
67
+ | Requirement | Verified | Evidence |
68
+ |-------------|----------|----------|
69
+ | {req 1} | ✅ | {link} |
70
+ | {req 2} | ✅ | {link} |
71
+
72
+ ## Concerns
73
+ - {concern 1}
74
+ - {concern 2}
75
+
76
+ ## Recommendations
77
+ 1. {recommendation 1}
78
+ 2. {recommendation 2}
79
+
80
+ ## Technical Debt to Address
81
+ - [ ] {item 1}
82
+ - [ ] {item 2}
83
+ ```
84
+
85
+ ---
86
+
87
+ ## 6. Offer Actions
88
+
89
+ ```
90
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
91
+ GSD ► AUDIT COMPLETE
92
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
93
+
94
+ Milestone: {name}
95
+ Health: {GOOD | CONCERNS | NEEDS ATTENTION}
96
+
97
+ ───────────────────────────────────────────────────────
98
+
99
+ ▶ ACTIONS
100
+
101
+ /plan-milestone-gaps — Create plans to address gaps
102
+ /add-todo — Capture debt items for later
103
+
104
+ ───────────────────────────────────────────────────────
105
+ ```
106
+
107
+ </process>
.agent/workflows/check-todos.md ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: List all pending todo items
3
+ argument-hint: "[--all] [--priority high|medium|low]"
4
+ ---
5
+
6
+ # /check-todos Workflow
7
+
8
+ <objective>
9
+ Display pending todo items, optionally filtered by priority or status.
10
+ </objective>
11
+
12
+ <context>
13
+ **Flags:**
14
+ - `--all` — Show completed items too
15
+ - `--priority high|medium|low` — Filter by priority
16
+
17
+ **Input:**
18
+ - `.gsd/TODO.md` — Todo items
19
+ </context>
20
+
21
+ <process>
22
+
23
+ ## 1. Load TODO.md
24
+
25
+ ```powershell
26
+ if (-not (Test-Path ".gsd/TODO.md")) {
27
+ Write-Output "No todos found. Use /add-todo to create one."
28
+ exit
29
+ }
30
+
31
+ Get-Content ".gsd/TODO.md"
32
+ ```
33
+
34
+ ---
35
+
36
+ ## 2. Parse and Filter
37
+
38
+ Count items by status:
39
+ - `- [ ]` = pending
40
+ - `- [x]` = complete
41
+
42
+ Filter by priority if flag provided.
43
+
44
+ ---
45
+
46
+ ## 3. Display
47
+
48
+ ```
49
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
50
+ GSD ► TODOS
51
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
52
+
53
+ PENDING ({N} items)
54
+ ───────────────────
55
+ 🔴 {high priority item}
56
+ 🟡 {medium priority item}
57
+ 🟢 {low priority item}
58
+
59
+ {If --all flag:}
60
+ COMPLETED ({M} items)
61
+ ─────────────────────
62
+ ✅ {completed item}
63
+
64
+ ───────────────────────────────────────────────────────
65
+
66
+ /add-todo <item> — add new item
67
+
68
+ ───────────────────────────────────────────────────────
69
+ ```
70
+
71
+ </process>
72
+
73
+ <priority_indicators>
74
+ | Priority | Indicator |
75
+ |----------|-----------|
76
+ | high | 🔴 |
77
+ | medium | 🟡 |
78
+ | low | 🟢 |
79
+ | done | ✅ |
80
+ </priority_indicators>
.agent/workflows/complete-milestone.md ADDED
@@ -0,0 +1,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: Mark current milestone as complete and archive
3
+ ---
4
+
5
+ # /complete-milestone Workflow
6
+
7
+ <objective>
8
+ Finalize the current milestone, archive documentation, and prepare for next milestone.
9
+ </objective>
10
+
11
+ <process>
12
+
13
+ ## 1. Verify All Phases Complete
14
+
15
+ **PowerShell:**
16
+ ```powershell
17
+ # Check ROADMAP.md for incomplete phases
18
+ Select-String -Path ".gsd/ROADMAP.md" -Pattern "Status.*Not Started|Status.*In Progress"
19
+ ```
20
+
21
+ **Bash:**
22
+ ```bash
23
+ # Check ROADMAP.md for incomplete phases
24
+ grep -E "Status.*Not Started|Status.*In Progress" ".gsd/ROADMAP.md"
25
+ ```
26
+
27
+ **If incomplete phases found:**
28
+ ```
29
+ ⚠️ Cannot complete milestone — {N} phases incomplete
30
+
31
+ Run /progress to see status.
32
+ ```
33
+
34
+ ---
35
+
36
+ ## 2. Run Final Verification
37
+
38
+ Verify all must-haves from ROADMAP.md:
39
+ - Run verification commands
40
+ - Capture evidence
41
+ - Create VERIFICATION.md if not exists
42
+
43
+ ---
44
+
45
+ ## 3. Generate Milestone Summary
46
+
47
+ Create `.gsd/milestones/{name}-SUMMARY.md`:
48
+
49
+ ```markdown
50
+ # Milestone: {name}
51
+
52
+ ## Completed: {date}
53
+
54
+ ## Deliverables
55
+ - ✅ {must-have 1}
56
+ - ✅ {must-have 2}
57
+
58
+ ## Phases Completed
59
+ 1. Phase 1: {name} — {date}
60
+ 2. Phase 2: {name} — {date}
61
+ ...
62
+
63
+ ## Metrics
64
+ - Total commits: {N}
65
+ - Files changed: {M}
66
+ - Duration: {days}
67
+
68
+ ## Lessons Learned
69
+ {Auto-extract from DECISIONS.md and JOURNAL.md}
70
+ ```
71
+
72
+ ---
73
+
74
+ ## 4. Archive Current State
75
+
76
+ **PowerShell:**
77
+ ```powershell
78
+ # Create milestone archive
79
+ New-Item -ItemType Directory -Force ".gsd/milestones/{name}"
80
+
81
+ # Move phase-specific files
82
+ Move-Item ".gsd/phases/*" ".gsd/milestones/{name}/"
83
+
84
+ # Archive decisions and journal (prevent monolithic growth across milestones)
85
+ if (Test-Path ".gsd/DECISIONS.md") {
86
+ Copy-Item ".gsd/DECISIONS.md" ".gsd/milestones/{name}/DECISIONS.md"
87
+ }
88
+ if (Test-Path ".gsd/JOURNAL.md") {
89
+ Copy-Item ".gsd/JOURNAL.md" ".gsd/milestones/{name}/JOURNAL.md"
90
+ }
91
+ ```
92
+
93
+ **Bash:**
94
+ ```bash
95
+ # Create milestone archive
96
+ mkdir -p ".gsd/milestones/{name}"
97
+
98
+ # Move phase-specific files
99
+ mv .gsd/phases/* ".gsd/milestones/{name}/"
100
+
101
+ # Archive decisions and journal (prevent monolithic growth across milestones)
102
+ [ -f ".gsd/DECISIONS.md" ] && cp ".gsd/DECISIONS.md" ".gsd/milestones/{name}/DECISIONS.md"
103
+ [ -f ".gsd/JOURNAL.md" ] && cp ".gsd/JOURNAL.md" ".gsd/milestones/{name}/JOURNAL.md"
104
+ ```
105
+
106
+ ---
107
+
108
+ ## 5. Reset for Next Milestone
109
+
110
+ Clear ROADMAP.md phases section (keep header).
111
+ Update STATE.md to show milestone complete.
112
+
113
+ **Reset DECISIONS.md** — replace contents with a fresh header referencing the archive:
114
+
115
+ ```markdown
116
+ # Decisions
117
+
118
+ > Previous milestone decisions archived in `.gsd/milestones/{name}/DECISIONS.md`
119
+
120
+ ---
121
+ ```
122
+
123
+ **Reset JOURNAL.md** — replace contents with a fresh header:
124
+
125
+ ```markdown
126
+ # Journal
127
+
128
+ > Previous milestone journal archived in `.gsd/milestones/{name}/JOURNAL.md`
129
+
130
+ ---
131
+ ```
132
+
133
+ ---
134
+
135
+ ## 5c. Refresh Architecture
136
+
137
+ Update `.gsd/ARCHITECTURE.md` to reflect the current state of the codebase after the milestone:
138
+
139
+ 1. **Scan the project** — identify new components, removed modules, changed dependencies
140
+ 2. **Update the architecture diagram** — reflect structural changes from this milestone
141
+ 3. **Update STACK.md** — refresh technology and dependency information
142
+ 4. **Keep it lean** — remove details about components that no longer exist; summarize, don't accumulate
143
+
144
+ > This prevents ARCHITECTURE.md from becoming stale or bloated across milestones (addresses the issue where architecture only updates via `/map`).
145
+
146
+ ---
147
+
148
+ ## 5d. Update Requirements
149
+
150
+ If `.gsd/REQUIREMENTS.md` exists, mark completed requirements:
151
+
152
+ 1. Read each requirement's status
153
+ 2. Cross-reference with milestone deliverables and verification results
154
+ 3. Mark satisfied requirements as `Complete`
155
+ 4. Mark deferred items as `Deferred` with reason
156
+ 5. Archive the requirements snapshot into `.gsd/milestones/{name}/REQUIREMENTS.md`
157
+
158
+ ---
159
+
160
+ ## 6. Commit and Tag
161
+
162
+ ```bash
163
+ git add -A
164
+ git commit -m "docs: complete milestone {name}"
165
+ git tag -a "{name}" -m "Milestone {name} complete"
166
+ ```
167
+
168
+ ---
169
+
170
+ ## 7. Celebrate
171
+
172
+ ```
173
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
174
+ GSD ► MILESTONE COMPLETE 🎉
175
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
176
+
177
+ {name}
178
+
179
+ Phases: {N} completed
180
+ Tag: {name}
181
+
182
+ ───────────────────────────────────────────────────────
183
+
184
+ ▶ NEXT
185
+
186
+ /new-milestone — Start next milestone
187
+ /audit-milestone {name} — Review this milestone
188
+
189
+ ─────────────────────────────────────────────��─────────
190
+ ```
191
+
192
+ </process>
.agent/workflows/debug.md ADDED
@@ -0,0 +1,235 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: Systematic debugging with persistent state
3
+ argument-hint: "[description of issue]"
4
+ ---
5
+
6
+ # /debug Workflow
7
+
8
+ <role>
9
+ You are a GSD debugger orchestrator. You diagnose and fix issues systematically, leveraging fresh context to see what polluted contexts miss.
10
+ </role>
11
+
12
+ <objective>
13
+ Systematically diagnose an issue using hypothesis-driven debugging, with persistent state to prevent circular attempts.
14
+ </objective>
15
+
16
+ <context>
17
+ **Issue:** $ARGUMENTS (description of the problem to debug)
18
+
19
+ **Skill reference:** `.agents/skills/debugger/SKILL.md`
20
+ </context>
21
+
22
+ <process>
23
+
24
+ ## 1. Initialize Debug Session
25
+
26
+ Check for existing debug state:
27
+ **PowerShell:**
28
+ ```powershell
29
+ Test-Path ".gsd/DEBUG.md"
30
+ ```
31
+
32
+ **Bash:**
33
+ ```bash
34
+ test -f ".gsd/DEBUG.md"
35
+ ```
36
+
37
+ If exists, load previous attempts. If not, create new session.
38
+
39
+ Display banner:
40
+ ```
41
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
42
+ GSD ► DEBUG SESSION
43
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
44
+
45
+ Issue: {description}
46
+ ```
47
+
48
+ ---
49
+
50
+ ## 2. Document Symptom
51
+
52
+ Create/update `.gsd/DEBUG.md`:
53
+
54
+ ```markdown
55
+ # Debug Session: {Issue ID}
56
+
57
+ ## Symptom
58
+ {Exact description of the problem}
59
+
60
+ **When:** {When does it occur?}
61
+ **Expected:** {What should happen?}
62
+ **Actual:** {What actually happens?}
63
+ ```
64
+
65
+ ---
66
+
67
+ ## 3. Gather Evidence
68
+
69
+ Collect data BEFORE forming hypotheses:
70
+
71
+ **PowerShell:**
72
+ ```powershell
73
+ # Get error details
74
+ {relevant commands to capture error info}
75
+
76
+ # Check logs
77
+ Get-Content logs/error.log -Tail 50
78
+
79
+ # Check environment
80
+ {relevant environment checks}
81
+ ```
82
+
83
+ **Bash:**
84
+ ```bash
85
+ # Get error details
86
+ {relevant commands to capture error info}
87
+
88
+ # Check logs
89
+ tail -50 logs/error.log
90
+
91
+ # Check environment
92
+ {relevant environment checks}
93
+ ```
94
+
95
+ Document evidence in DEBUG.md.
96
+
97
+ ---
98
+
99
+ ## 4. Form Hypotheses
100
+
101
+ Based on evidence, list possible causes:
102
+
103
+ ```markdown
104
+ ## Hypotheses
105
+
106
+ | # | Hypothesis | Likelihood | Status |
107
+ |---|------------|------------|--------|
108
+ | 1 | {cause 1} | 80% | UNTESTED |
109
+ | 2 | {cause 2} | 15% | UNTESTED |
110
+ | 3 | {cause 3} | 5% | UNTESTED |
111
+ ```
112
+
113
+ ---
114
+
115
+ ## 5. Test Hypotheses
116
+
117
+ Test highest likelihood first:
118
+
119
+ ```markdown
120
+ ## Attempts
121
+
122
+ ### Attempt 1
123
+ **Testing:** H1 — {hypothesis}
124
+ **Action:** {what you did to test}
125
+ **Result:** {outcome}
126
+ **Conclusion:** {CONFIRMED | ELIMINATED | INCONCLUSIVE}
127
+ ```
128
+
129
+ ---
130
+
131
+ ## 6. Apply Fix (If Root Cause Found)
132
+
133
+ When root cause confirmed:
134
+
135
+ 1. Implement fix
136
+ 2. Run original failing scenario
137
+ 3. Verify PASSES
138
+ 4. Check for regressions
139
+
140
+ Update DEBUG.md:
141
+ ```markdown
142
+ ## Resolution
143
+
144
+ **Root Cause:** {what was actually wrong}
145
+ **Fix:** {what was changed}
146
+ **Verified:** {how fix was verified}
147
+ **Regression Check:** {what else was tested}
148
+ ```
149
+
150
+ ---
151
+
152
+ ## 7. Handle 3-Strike Rule
153
+
154
+ If 3 attempts fail on SAME approach:
155
+
156
+ ```
157
+ ⚠️ 3 FAILURES ON SAME APPROACH
158
+
159
+ Action: STOP and reassess
160
+
161
+ Options:
162
+ 1. Try fundamentally DIFFERENT approach
163
+ 2. /pause for fresh session context
164
+ 3. Ask user for additional information
165
+ ```
166
+
167
+ Update DEBUG.md and recommend next steps.
168
+
169
+ ---
170
+
171
+ ## 8. Commit Resolution
172
+
173
+ If fixed:
174
+ ```bash
175
+ git add -A
176
+ git commit -m "fix: {brief description of fix}"
177
+ ```
178
+
179
+ Update STATE.md with resolution.
180
+
181
+ </process>
182
+
183
+ <offer_next>
184
+
185
+ **If Resolved:**
186
+ ```
187
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
188
+ GSD ► BUG FIXED ✓
189
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
190
+
191
+ Root cause: {what was wrong}
192
+ Fix: {what was done}
193
+
194
+ Committed: {hash}
195
+
196
+ ───────────────────────────────────────────────────────
197
+ ```
198
+
199
+ **If Stuck After 3 Attempts:**
200
+ ```
201
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
202
+ GSD ► DEBUG PAUSED ⏸
203
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
204
+
205
+ 3 attempts exhausted on current approach.
206
+ State saved to .gsd/DEBUG.md
207
+
208
+ ───────────────────────────────────────────────────────
209
+
210
+ Options:
211
+ • /debug {issue} — try different approach
212
+ • /pause — save state for fresh session
213
+ • Provide more context about the issue
214
+
215
+ ───────────────────────────────────────────────────────
216
+ ```
217
+
218
+ </offer_next>
219
+
220
+ <related>
221
+ ## Related
222
+
223
+ ### Workflows
224
+ | Command | Relationship |
225
+ |---------|--------------|
226
+ | `/pause` | Use after 3 failed attempts |
227
+ | `/resume` | Start fresh with documented state |
228
+ | `/verify` | Re-verify after fixing issues |
229
+
230
+ ### Skills
231
+ | Skill | Purpose |
232
+ |-------|---------|
233
+ | `debugger` | Detailed debugging methodology |
234
+ | `context-health-monitor` | 3-strike rule |
235
+ </related>
.agent/workflows/discuss-phase.md ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: Discuss a phase before planning (clarify scope and approach)
3
+ argument-hint: "<phase-number>"
4
+ ---
5
+
6
+ # /discuss-phase Workflow
7
+
8
+ <objective>
9
+ Interactive discussion about a phase to clarify scope, approach, and concerns before creating plans.
10
+ </objective>
11
+
12
+ <context>
13
+ Run BEFORE `/plan` when:
14
+ - Phase scope is unclear
15
+ - Multiple implementation approaches exist
16
+ - Trade-offs need user input
17
+ - Dependencies are complex
18
+ </context>
19
+
20
+ <process>
21
+
22
+ ## 1. Load Phase Context
23
+
24
+ Read from ROADMAP.md:
25
+ - Phase objective
26
+ - Dependencies
27
+ - Current status
28
+
29
+ ---
30
+
31
+ ## 2. Analyze Requirements
32
+
33
+ From phase objective, extract:
34
+ - What needs to be built
35
+ - What constraints exist
36
+ - What decisions need to be made
37
+
38
+ ---
39
+
40
+ ## 3. Present Discussion Points
41
+
42
+ ```
43
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
44
+ GSD ► DISCUSS PHASE {N}
45
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
46
+
47
+ Phase: {name}
48
+ Objective: {objective}
49
+
50
+ ───────────────────────────────────────────────────────
51
+
52
+ TOPICS TO DISCUSS
53
+
54
+ 1. SCOPE CLARIFICATION
55
+ - {question about scope}
56
+ - {question about boundaries}
57
+
58
+ 2. IMPLEMENTATION APPROACH
59
+ Option A: {approach}
60
+ Option B: {approach}
61
+ Which do you prefer and why?
62
+
63
+ 3. DEPENDENCIES
64
+ - Requires: {what from previous phases}
65
+ - Missing: {any gaps in earlier work}
66
+
67
+ 4. CONCERNS
68
+ - {potential issue}
69
+ - {risk to flag}
70
+
71
+ ───────────────────────────────────────────────────────
72
+ ```
73
+
74
+ ---
75
+
76
+ ## 4. Gather User Input
77
+
78
+ Listen for:
79
+ - Scope decisions
80
+ - Approach preferences
81
+ - Constraints not in spec
82
+ - Priority clarifications
83
+
84
+ ---
85
+
86
+ ## 5. Document Decisions
87
+
88
+ Update `.gsd/DECISIONS.md`:
89
+
90
+ ```markdown
91
+ ## Phase {N} Decisions
92
+
93
+ **Date:** {date}
94
+
95
+ ### Scope
96
+ - {decision about scope}
97
+
98
+ ### Approach
99
+ - Chose: {approach}
100
+ - Reason: {rationale}
101
+
102
+ ### Constraints
103
+ - {constraint identified}
104
+ ```
105
+
106
+ ---
107
+
108
+ ## 6. Offer Next Steps
109
+
110
+ ```
111
+ ───────────────────────────────────────────────────────
112
+
113
+ ✓ Discussion documented in DECISIONS.md
114
+
115
+ ▶ NEXT
116
+
117
+ /plan {N} — Create execution plans with this context
118
+ /research-phase {N} — Deep dive on technical options
119
+
120
+ ───────────────────────────────────────────────────────
121
+ ```
122
+
123
+ </process>
.agent/workflows/execute.md ADDED
@@ -0,0 +1,323 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: The Engineer — Execute a specific phase with focused context
3
+ argument-hint: "<phase-number> [--gaps-only]"
4
+ ---
5
+
6
+ # /execute Workflow
7
+
8
+ <role>
9
+ You are a GSD executor orchestrator. You manage wave-based parallel execution of phase plans.
10
+
11
+ **Core responsibilities:**
12
+ - Validate phase exists and has plans
13
+ - Discover and group plans by execution wave
14
+ - Spawn focused execution for each plan
15
+ - Verify phase goal after all plans complete
16
+ - Update roadmap and state on completion
17
+ </role>
18
+
19
+ <objective>
20
+ Execute all plans in a phase using wave-based parallel execution.
21
+
22
+ Orchestrator stays lean: discover plans, analyze dependencies, group into waves, execute sequentially within waves, verify against phase goal.
23
+
24
+ **Context budget:** ~15% orchestrator, fresh context per plan execution.
25
+ </objective>
26
+
27
+ <context>
28
+ **Phase:** $ARGUMENTS (required - phase number to execute)
29
+
30
+ **Flags:**
31
+ - `--gaps-only` — Execute only gap closure plans (created by `/verify` when issues found)
32
+
33
+ **Required files:**
34
+ - `.gsd/ROADMAP.md` — Phase definitions
35
+ - `.gsd/STATE.md` — Current position
36
+ - `.gsd/phases/{phase}/` — Phase directory with PLAN.md files
37
+ </context>
38
+
39
+ <process>
40
+
41
+ ## 1. Validate Environment
42
+
43
+ **PowerShell:**
44
+ ```powershell
45
+ Test-Path ".gsd/ROADMAP.md"
46
+ Test-Path ".gsd/STATE.md"
47
+ ```
48
+
49
+ **Bash:**
50
+ ```bash
51
+ test -f ".gsd/ROADMAP.md"
52
+ test -f ".gsd/STATE.md"
53
+ ```
54
+
55
+ **If not found:** Error — user should run `/plan` first.
56
+
57
+ ---
58
+
59
+ ## 2. Validate Phase Exists
60
+
61
+ **PowerShell:**
62
+ ```powershell
63
+ # Check phase exists in roadmap
64
+ Select-String -Path ".gsd/ROADMAP.md" -Pattern "Phase $PHASE:"
65
+ ```
66
+
67
+ **Bash:**
68
+ ```bash
69
+ # Check phase exists in roadmap
70
+ grep "Phase $PHASE:" ".gsd/ROADMAP.md"
71
+ ```
72
+
73
+ **If not found:** Error with available phases from ROADMAP.md.
74
+
75
+ ---
76
+
77
+ ## 3. Ensure Phase Directory Exists
78
+
79
+ **PowerShell:**
80
+ ```powershell
81
+ $PHASE_DIR = ".gsd/phases/$PHASE"
82
+ if (-not (Test-Path $PHASE_DIR)) {
83
+ New-Item -ItemType Directory -Path $PHASE_DIR
84
+ }
85
+ ```
86
+
87
+ **Bash:**
88
+ ```bash
89
+ PHASE_DIR=".gsd/phases/$PHASE"
90
+ mkdir -p "$PHASE_DIR"
91
+ ```
92
+
93
+ ---
94
+
95
+ ## 4. Discover Plans
96
+
97
+ **PowerShell:**
98
+ ```powershell
99
+ Get-ChildItem "$PHASE_DIR/*-PLAN.md"
100
+ ```
101
+
102
+ **Bash:**
103
+ ```bash
104
+ ls "$PHASE_DIR"/*-PLAN.md 2>/dev/null
105
+ ```
106
+
107
+ **Check for existing summaries** (completed plans):
108
+
109
+ **PowerShell:**
110
+ ```powershell
111
+ Get-ChildItem "$PHASE_DIR/*-SUMMARY.md"
112
+ ```
113
+
114
+ **Bash:**
115
+ ```bash
116
+ ls "$PHASE_DIR"/*-SUMMARY.md 2>/dev/null
117
+ ```
118
+
119
+ **Build list of incomplete plans** (PLAN without matching SUMMARY).
120
+
121
+ **If `--gaps-only`:** Filter to only plans with `gap_closure: true` in frontmatter.
122
+
123
+ **If no incomplete plans found:** Phase already complete, skip to step 8.
124
+
125
+ ---
126
+
127
+ ## 5. Group Plans by Wave
128
+
129
+ Read `wave` field from each plan's frontmatter:
130
+
131
+ ```yaml
132
+ ---
133
+ phase: 1
134
+ plan: 2
135
+ wave: 1
136
+ ---
137
+ ```
138
+
139
+ **Group plans by wave number.** Lower waves execute first.
140
+
141
+ Display wave structure:
142
+ ```
143
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
144
+ GSD ► EXECUTING PHASE {N}
145
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
146
+
147
+ Wave 1: {plan-1}, {plan-2}
148
+ Wave 2: {plan-3}
149
+
150
+ {X} plans across {Y} waves
151
+ ```
152
+
153
+ ---
154
+
155
+ ## 6. Execute Waves
156
+
157
+ For each wave in order:
158
+
159
+ ### 6a. Execute Plans in Wave
160
+ For each plan in the current wave:
161
+
162
+ 1. **Load plan context** — Read only the PLAN.md file
163
+ 2. **Execute tasks** — Follow `<task>` blocks in order
164
+ 3. **Verify each task** — Run `<verify>` commands
165
+ 4. **Commit per task:**
166
+ ```bash
167
+ git add -A
168
+ git commit -m "feat(phase-{N}): {task-name}"
169
+ ```
170
+ 5. **Create SUMMARY.md** — Document what was done
171
+
172
+ ### 6b. Verify Wave Complete
173
+ Check all plans in wave have SUMMARY.md files.
174
+
175
+ ### 6c. Proceed to Next Wave
176
+ Only after current wave fully completes.
177
+
178
+ ---
179
+
180
+ ## 7. Verify Phase Goal
181
+
182
+ After all waves complete:
183
+
184
+ 1. **Read phase goal** from ROADMAP.md
185
+ 2. **Check must-haves** against actual codebase (not SUMMARY claims)
186
+ 3. **Run verification commands** specified in phase
187
+
188
+ **Create VERIFICATION.md:**
189
+ ```markdown
190
+ ## Phase {N} Verification
191
+
192
+ ### Must-Haves
193
+ - [x] Must-have 1 — VERIFIED (evidence: ...)
194
+ - [ ] Must-have 2 — FAILED (reason: ...)
195
+
196
+ ### Verdict: PASS / FAIL
197
+ ```
198
+
199
+ **Route by verdict:**
200
+ - `PASS` → Continue to step 8
201
+ - `FAIL` → Create gap closure plans, offer `/execute {N} --gaps-only`
202
+
203
+ ---
204
+
205
+ ## 8. Update Roadmap and State
206
+
207
+ **Update ROADMAP.md:**
208
+ ```markdown
209
+ ### Phase {N}: {Name}
210
+ **Status**: ✅ Complete
211
+ ```
212
+
213
+ **Update STATE.md:**
214
+ ```markdown
215
+ ## Current Position
216
+ - **Phase**: {N} (completed)
217
+ - **Task**: All tasks complete
218
+ - **Status**: Verified
219
+
220
+ ## Last Session Summary
221
+ Phase {N} executed successfully. {X} plans, {Y} tasks completed.
222
+
223
+ ## Next Steps
224
+ 1. Proceed to Phase {N+1}
225
+ ```
226
+
227
+ **Update REQUIREMENTS.md** (if exists):
228
+ - Cross-reference completed tasks with requirement IDs
229
+ - Mark requirements satisfied by this phase as `In Progress` or `Complete`
230
+ - Update the traceability matrix with plan references
231
+
232
+ ---
233
+
234
+ ## 9. Commit Phase Completion
235
+
236
+ ```bash
237
+ git add .gsd/ROADMAP.md .gsd/STATE.md .gsd/REQUIREMENTS.md
238
+ git commit -m "docs(phase-{N}): complete {phase-name}"
239
+ ```
240
+
241
+ ---
242
+
243
+ ## 10. Offer Next Steps
244
+
245
+ </process>
246
+
247
+ <offer_next>
248
+ Output based on status:
249
+
250
+ **Route A: Phase complete, more phases remain**
251
+
252
+ ```
253
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
254
+ GSD ► PHASE {N} COMPLETE ✓
255
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
256
+
257
+ {X} plans executed
258
+ Goal verified ✓
259
+
260
+ ───────────────────────────────────────────────────────
261
+
262
+ ▶ Next Up
263
+ Phase {N+1}: {Name}
264
+
265
+ /plan {N+1} — create execution plans
266
+ /execute {N+1} — execute directly (if plans exist)
267
+
268
+ ───────────────────────────────────────────────────────
269
+ ```
270
+
271
+ **Route B: All phases complete**
272
+
273
+ ```
274
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
275
+ GSD ► MILESTONE COMPLETE 🎉
276
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
277
+
278
+ All phases completed and verified.
279
+
280
+ ───────────────────────────────────────────────────────
281
+ ```
282
+
283
+ **Route C: Gaps found**
284
+
285
+ ```
286
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
287
+ GSD ► PHASE {N} GAPS FOUND ⚠
288
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
289
+
290
+ {X}/{Y} must-haves verified
291
+ Gap closure plans created.
292
+
293
+ /execute {N} --gaps-only — execute fix plans
294
+
295
+ ───────────────────────────────────────────────────────
296
+ ```
297
+ </offer_next>
298
+
299
+ <context_hygiene>
300
+ **After 3 failed debugging attempts:**
301
+ 1. Stop current approach
302
+ 2. Document to `.gsd/STATE.md` what was tried
303
+ 3. Recommend `/pause` for fresh session
304
+ </context_hygiene>
305
+
306
+ <related>
307
+ ## Related
308
+
309
+ ### Workflows
310
+ | Command | Relationship |
311
+ |---------|--------------|
312
+ | `/plan` | Creates PLAN.md files that /execute runs |
313
+ | `/verify` | Validates work after /execute completes |
314
+ | `/debug` | Use when tasks fail verification |
315
+ | `/pause` | Use after 3 debugging failures |
316
+
317
+ ### Skills
318
+ | Skill | Purpose |
319
+ |-------|---------|
320
+ | `executor` | Detailed execution protocol |
321
+ | `context-health-monitor` | 3-strike rule enforcement |
322
+ | `empirical-validation` | Verification requirements |
323
+ </related>
.agent/workflows/help.md ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: Show all available GSD commands
3
+ ---
4
+
5
+ # /help Workflow
6
+
7
+ <objective>
8
+ Display all available GSD commands with descriptions and usage hints.
9
+ </objective>
10
+
11
+ <process>
12
+
13
+ **First, read and display the version:**
14
+
15
+ **PowerShell:**
16
+ ```powershell
17
+ $version = Get-Content "VERSION" -ErrorAction SilentlyContinue
18
+ if (-not $version) { $version = "unknown" }
19
+ ```
20
+
21
+ **Bash:**
22
+ ```bash
23
+ version=$(cat VERSION 2>/dev/null || echo "unknown")
24
+ ```
25
+
26
+ **Then display help with version in header:**
27
+
28
+ ```
29
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
30
+ GSD ► HELP (v{version})
31
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
32
+
33
+ CORE WORKFLOW
34
+ ─────────────
35
+ /map Analyze codebase → ARCHITECTURE.md
36
+ /plan [N] Create PLAN.md files for phase N
37
+ /execute [N] Wave-based execution with atomic commits
38
+ /verify [N] Must-haves validation with proof
39
+ /debug [desc] Systematic debugging (3-strike rule)
40
+
41
+ PROJECT SETUP
42
+ ─────────────
43
+ /new-project Deep questioning → SPEC.md
44
+ /new-milestone Create milestone with phases
45
+ /complete-milestone Archive completed milestone
46
+ /audit-milestone Review milestone quality
47
+
48
+ PHASE MANAGEMENT
49
+ ────────────────
50
+ /add-phase Add phase to end of roadmap
51
+ /insert-phase Insert phase (renumbers subsequent)
52
+ /remove-phase Remove phase (with safety checks)
53
+ /discuss-phase Clarify scope before planning
54
+ /research-phase Deep technical research
55
+ /list-phase-assumptions Surface planning assumptions
56
+ /plan-milestone-gaps Create gap closure plans
57
+
58
+ NAVIGATION & STATE
59
+ ──────────────────
60
+ /progress Show current position in roadmap
61
+ /pause Save state for session handoff
62
+ /resume Restore from last session
63
+ /add-todo Quick capture idea
64
+ /check-todos List pending items
65
+
66
+ UTILITIES
67
+ ─────────
68
+ /help Show this help
69
+
70
+ ───────────────────────────────────────────────────────
71
+
72
+ QUICK START
73
+ ───────────
74
+ 1. /new-project → Initialize with deep questioning
75
+ 2. /plan 1 → Create Phase 1 plans
76
+ 3. /execute 1 → Implement Phase 1
77
+ 4. /verify 1 → Confirm it works
78
+ 5. Repeat
79
+
80
+ ───────────────────────────────────────────────────────
81
+
82
+ CORE RULES
83
+ ──────────
84
+ 🔒 Planning Lock No code until SPEC.md is FINALIZED
85
+ 💾 State Persistence Update STATE.md after every task
86
+ 🧹 Context Hygiene 3 failures → state dump → fresh session
87
+ ✅ Empirical Valid. Proof required, no "it should work"
88
+
89
+ ───────────────────────────────────────────────────────
90
+
91
+ 📚 Docs: GSD-STYLE.md, .gsd/examples/
92
+
93
+ ───────────────────────────────────────────────────────
94
+ ```
95
+
96
+ </process>
.agent/workflows/insert-phase.md ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: Insert a phase between existing phases (renumbers subsequent)
3
+ argument-hint: "<position> <phase-name>"
4
+ ---
5
+
6
+ # /insert-phase Workflow
7
+
8
+ <objective>
9
+ Insert a new phase at a specific position, renumbering all subsequent phases.
10
+ </objective>
11
+
12
+ <process>
13
+
14
+ ## 1. Parse Arguments
15
+
16
+ Extract:
17
+ - **Position** — Where to insert (e.g., 2 inserts before current Phase 2)
18
+ - **Name** — Phase title
19
+
20
+ ---
21
+
22
+ ## 2. Validate Position
23
+
24
+ **PowerShell:**
25
+ ```powershell
26
+ $totalPhases = (Select-String -Path ".gsd/ROADMAP.md" -Pattern "### Phase \d+").Count
27
+ if ($position -lt 1 -or $position -gt $totalPhases + 1) {
28
+ Write-Error "Invalid position. Valid: 1-$($totalPhases + 1)"
29
+ }
30
+ ```
31
+
32
+ **Bash:**
33
+ ```bash
34
+ total_phases=$(grep -c "### Phase [0-9]" ".gsd/ROADMAP.md")
35
+ if [ "$position" -lt 1 ] || [ "$position" -gt $((total_phases + 1)) ]; then
36
+ echo "Error: Invalid position. Valid: 1-$((total_phases + 1))" >&2
37
+ fi
38
+ ```
39
+
40
+ ---
41
+
42
+ ## 3. Gather Phase Information
43
+
44
+ Ask for:
45
+ - **Objective** — What this phase achieves
46
+ - **Dependencies** — What it needs from earlier phases
47
+
48
+ ---
49
+
50
+ ## 4. Renumber Existing Phases
51
+
52
+ For phases >= position, increment phase number by 1.
53
+
54
+ **Also update:**
55
+ - Phase directory names (`.gsd/phases/{N}/`)
56
+ - References in PLAN.md files
57
+ - Dependencies in ROADMAP.md
58
+
59
+ ---
60
+
61
+ ## 5. Insert New Phase
62
+
63
+ Add at position with correct numbering.
64
+
65
+ ---
66
+
67
+ ## 6. Update STATE.md
68
+
69
+ If currently in a phase >= position, update position reference.
70
+
71
+ ---
72
+
73
+ ## 7. Commit
74
+
75
+ ```bash
76
+ git add -A
77
+ git commit -m "docs: insert phase {N} - {name} (renumbered {M} phases)"
78
+ ```
79
+
80
+ ---
81
+
82
+ ## 8. Display Result
83
+
84
+ ```
85
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
86
+ GSD ► PHASE INSERTED ✓
87
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
88
+
89
+ Inserted: Phase {N}: {name}
90
+ Renumbered: Phases {N+1} through {M}
91
+
92
+ ───────────────────────────────────────────────────────
93
+
94
+ ▶ NEXT
95
+
96
+ /plan {N} — Create plans for new phase
97
+ /progress — See updated roadmap
98
+
99
+ ───────────────────────────────────────────────────────
100
+ ```
101
+
102
+ </process>
103
+
104
+ <warning>
105
+ Phase insertion can be disruptive. Consider:
106
+ - In-progress phases may have commits referencing old numbers
107
+ - Existing plans reference phase numbers
108
+ - Use sparingly and early in milestone lifecycle
109
+ </warning>
.agent/workflows/install.md ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: Install GSD into the current project from GitHub
3
+ ---
4
+
5
+ # /install Workflow
6
+
7
+ <objective>
8
+ Install GSD for Antigravity into the current project from GitHub.
9
+ </objective>
10
+
11
+ <process>
12
+
13
+ ## 1. Check for Existing Installation
14
+
15
+ Look for GSD marker directories:
16
+
17
+ **PowerShell:**
18
+ ```powershell
19
+ $alreadyInstalled = (Test-Path ".agents") -or (Test-Path ".agent") -or (Test-Path ".gsd")
20
+ if ($alreadyInstalled) {
21
+ Write-Output "GSD files detected in this project."
22
+ }
23
+ ```
24
+
25
+ **Bash:**
26
+ ```bash
27
+ if [ -d ".agents" ] || [ -d ".agent" ] || [ -d ".gsd" ]; then
28
+ echo "GSD files detected in this project."
29
+ fi
30
+ ```
31
+
32
+ **If already installed:**
33
+ ```
34
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
35
+ GSD ► ALREADY INSTALLED
36
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
37
+
38
+ GSD files already exist in this project.
39
+
40
+ ───────────────────────────────────────────────────────
41
+
42
+ A) Reinstall — Overwrite with latest version
43
+ B) Cancel — Keep current installation
44
+
45
+ If you want to update instead: /update
46
+
47
+ ───────────────────────────────────────────────────────
48
+ ```
49
+
50
+ If user chooses Cancel, exit.
51
+ If user chooses Reinstall, continue to Step 2.
52
+
53
+ ---
54
+
55
+ ## 2. Clone from GitHub
56
+
57
+ ```bash
58
+ git clone --depth 1 https://github.com/toonight/get-shit-done-for-antigravity.git .gsd-install-temp
59
+ ```
60
+
61
+ ---
62
+
63
+ ## 3. Copy Files
64
+
65
+ **PowerShell:**
66
+ ```powershell
67
+ # Core directories
68
+ Copy-Item -Recurse ".gsd-install-temp\.agent" ".\"
69
+ Copy-Item -Recurse ".gsd-install-temp\.agents" ".\"
70
+ Copy-Item -Recurse ".gsd-install-temp\.gemini" ".\"
71
+ Copy-Item -Recurse ".gsd-install-temp\.gsd" ".\"
72
+ Copy-Item -Recurse ".gsd-install-temp\adapters" ".\"
73
+ Copy-Item -Recurse ".gsd-install-temp\docs" ".\"
74
+ Copy-Item -Recurse ".gsd-install-temp\scripts" ".\"
75
+
76
+ # Root files
77
+ Copy-Item -Force ".gsd-install-temp\PROJECT_RULES.md" ".\"
78
+ Copy-Item -Force ".gsd-install-temp\GSD-STYLE.md" ".\"
79
+ Copy-Item -Force ".gsd-install-temp\model_capabilities.yaml" ".\"
80
+ ```
81
+
82
+ **Bash:**
83
+ ```bash
84
+ # Core directories
85
+ cp -r .gsd-install-temp/.agent ./
86
+ cp -r .gsd-install-temp/.agents ./
87
+ cp -r .gsd-install-temp/.gemini ./
88
+ cp -r .gsd-install-temp/.gsd ./
89
+ cp -r .gsd-install-temp/adapters ./
90
+ cp -r .gsd-install-temp/docs ./
91
+ cp -r .gsd-install-temp/scripts ./
92
+
93
+ # Root files
94
+ cp .gsd-install-temp/PROJECT_RULES.md ./
95
+ cp .gsd-install-temp/GSD-STYLE.md ./
96
+ cp .gsd-install-temp/model_capabilities.yaml ./
97
+ ```
98
+
99
+ ---
100
+
101
+ ## 4. Cleanup
102
+
103
+ **PowerShell:**
104
+ ```powershell
105
+ Remove-Item -Recurse -Force ".gsd-install-temp"
106
+ ```
107
+
108
+ **Bash:**
109
+ ```bash
110
+ rm -rf .gsd-install-temp
111
+ ```
112
+
113
+ ---
114
+
115
+ ## 5. Add to .gitignore (Optional)
116
+
117
+ Check if `.gsd/STATE.md` and other session files should be gitignored:
118
+
119
+ ```
120
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
121
+ GSD ► ADD TO .gitignore?
122
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
123
+
124
+ Recommended .gitignore additions for session-specific files:
125
+
126
+ .gsd/STATE.md
127
+ .gsd/JOURNAL.md
128
+ .gsd/TODO.md
129
+
130
+ ───────────────────────────────────────────────────────
131
+
132
+ A) Yes — Add recommended entries
133
+ B) No — Skip
134
+
135
+ ───────────────────────────────────────────────────────
136
+ ```
137
+
138
+ ---
139
+
140
+ ## 6. Confirm Installation
141
+
142
+ ```
143
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
144
+ GSD ► INSTALLED ✓
145
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
146
+
147
+ GSD for Antigravity has been installed.
148
+
149
+ Files installed:
150
+ • .agent/ (workflows)
151
+ • .agents/ (skills — Agent Skills standard)
152
+ • .gemini/ (Gemini integration)
153
+ • .gsd/ (project state templates)
154
+ • adapters/ (model-specific enhancements)
155
+ • docs/ (operational documentation)
156
+ • scripts/ (utility scripts)
157
+ • PROJECT_RULES.md
158
+ • GSD-STYLE.md
159
+ • model_capabilities.yaml
160
+
161
+ ───────────────────────────────────────────────────────
162
+
163
+ Next step:
164
+
165
+ /new-project — Initialize your project with GSD
166
+
167
+ ───────────────────────────────────────────────────────
168
+ ```
169
+
170
+ </process>
171
+
172
+ <notes>
173
+ - This workflow is designed to work from a clean project (no prior GSD installation)
174
+ - It copies ALL necessary files, unlike manual installation which may miss some
175
+ - For updates to an existing installation, use /update instead
176
+ - The /new-project command should be run after installation to set up SPEC.md
177
+ </notes>
.agent/workflows/list-phase-assumptions.md ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: List assumptions made during phase planning
3
+ argument-hint: "<phase-number>"
4
+ ---
5
+
6
+ # /list-phase-assumptions Workflow
7
+
8
+ <objective>
9
+ Surface and document assumptions made during phase planning that should be validated.
10
+ </objective>
11
+
12
+ <process>
13
+
14
+ ## 1. Load Phase Plans
15
+
16
+ ```powershell
17
+ Get-ChildItem ".gsd/phases/{N}/*-PLAN.md"
18
+ ```
19
+
20
+ ---
21
+
22
+ ## 2. Extract Assumptions
23
+
24
+ Scan plans for:
25
+ - Technology choices without justification
26
+ - Implied dependencies
27
+ - Expected behaviors not verified
28
+ - Time estimates
29
+ - Scope boundaries
30
+
31
+ ---
32
+
33
+ ## 3. Categorize Assumptions
34
+
35
+ | Category | Risk Level |
36
+ |----------|------------|
37
+ | Technical | API exists, library works, syntax correct |
38
+ | Integration | Services compatible, auth works |
39
+ | Scope | Feature boundaries, what's excluded |
40
+ | Performance | Will handle load, fast enough |
41
+ | Timeline | Estimates accurate |
42
+
43
+ ---
44
+
45
+ ## 4. Display Assumptions
46
+
47
+ ```
48
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
49
+ GSD ► PHASE {N} ASSUMPTIONS
50
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
51
+
52
+ TECHNICAL
53
+ 🟡 {assumption 1} — Validate before execution
54
+ 🟢 {assumption 2} — Low risk
55
+
56
+ INTEGRATION
57
+ 🔴 {assumption 3} — High risk, verify first
58
+
59
+ SCOPE
60
+ 🟡 {assumption 4} — Confirm with user
61
+
62
+ ───────────────────────────────────────────────────────
63
+
64
+ ▶ ACTIONS
65
+
66
+ • Validate high-risk assumptions before /execute
67
+ • Add verified assumptions to RESEARCH.md
68
+ • Flag for user review if scope-related
69
+
70
+ ───────────────────────────────────────────────────────
71
+ ```
72
+
73
+ ---
74
+
75
+ ## 5. Offer Validation
76
+
77
+ Ask if user wants to:
78
+ - Validate specific assumptions now
79
+ - Add to TODO.md for later
80
+ - Accept and proceed
81
+
82
+ </process>
.agent/workflows/map.md ADDED
@@ -0,0 +1,394 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: The Architect — Analyze codebase and update ARCHITECTURE.md and STACK.md
3
+ ---
4
+
5
+ # /map Workflow
6
+
7
+ <role>
8
+ You are a GSD codebase mapper. You analyze existing codebases to understand structure, patterns, and technical debt.
9
+
10
+ **Core responsibilities:**
11
+ - Scan project structure and identify components
12
+ - Analyze dependencies and versions
13
+ - Map data flow and integration points
14
+ - Identify technical debt and patterns
15
+ - Document findings for planning context
16
+ </role>
17
+
18
+ <objective>
19
+ Analyze the existing codebase and produce documentation that enables informed planning.
20
+
21
+ This workflow should be run BEFORE `/plan` on brownfield projects to give the planner full context.
22
+ </objective>
23
+
24
+ <context>
25
+ **No arguments required.** Operates on current project directory.
26
+
27
+ **Outputs:**
28
+ - `.gsd/ARCHITECTURE.md` — System design documentation
29
+ - `.gsd/STACK.md` — Technology inventory
30
+ </context>
31
+
32
+ <process>
33
+
34
+ ## 1. Validate Project
35
+
36
+ Check this is a valid project:
37
+
38
+ **PowerShell:**
39
+ ```powershell
40
+ # Look for common project indicators
41
+ $indicators = @(
42
+ "package.json", "requirements.txt", "Cargo.toml",
43
+ "go.mod", "pom.xml", "*.csproj", "Gemfile"
44
+ )
45
+ ```
46
+
47
+ **Bash:**
48
+ ```bash
49
+ # Look for common project indicators
50
+ indicators=("package.json" "requirements.txt" "Cargo.toml"
51
+ "go.mod" "pom.xml" "*.csproj" "Gemfile")
52
+ ```
53
+
54
+ Display banner:
55
+ ```
56
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
57
+ GSD ► MAPPING CODEBASE
58
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
59
+ ```
60
+
61
+ ---
62
+
63
+ ## 2. Analyze Project Structure
64
+
65
+ ### 2a. Directory Analysis
66
+
67
+ **PowerShell:**
68
+ ```powershell
69
+ Get-ChildItem -Recurse -Directory |
70
+ Where-Object { $_.Name -notmatch "node_modules|\.git|__pycache__|dist|build" }
71
+ ```
72
+
73
+ **Bash:**
74
+ ```bash
75
+ find . -type d -not -path '*/node_modules/*' -not -path '*/.git/*' \
76
+ -not -path '*/__pycache__/*' -not -path '*/dist/*' -not -path '*/build/*'
77
+ ```
78
+
79
+ Identify:
80
+ - Source directories (`src/`, `lib/`, `app/`)
81
+ - Test directories (`tests/`, `__tests__/`, `spec/`)
82
+ - Configuration locations
83
+ - Asset directories
84
+
85
+ ### 2b. Entry Points
86
+
87
+ Find main files:
88
+ **PowerShell:**
89
+ ```powershell
90
+ # Example for Node.js
91
+ Get-Content "package.json" | ConvertFrom-Json | Select-Object -ExpandProperty main
92
+ ```
93
+
94
+ **Bash:**
95
+ ```bash
96
+ # Example for Node.js (requires jq)
97
+ cat package.json | jq -r '.main'
98
+ ```
99
+
100
+ ### 2c. Component Detection
101
+
102
+ Scan for common patterns:
103
+ - React components (`*.tsx`, `*.jsx`)
104
+ - API routes (`routes/`, `api/`)
105
+ - Database models (`models/`, `entities/`)
106
+ - Services (`services/`, `lib/`)
107
+ - Utilities (`utils/`, `helpers/`)
108
+
109
+ ---
110
+
111
+ ## 3. Analyze Dependencies
112
+
113
+ ### 3a. Production Dependencies
114
+
115
+ **PowerShell:**
116
+ ```powershell
117
+ # Node.js example
118
+ Get-Content "package.json" | ConvertFrom-Json |
119
+ Select-Object -ExpandProperty dependencies
120
+ ```
121
+
122
+ **Bash:**
123
+ ```bash
124
+ # Node.js example (requires jq)
125
+ cat package.json | jq '.dependencies'
126
+ ```
127
+
128
+ For each dependency, note:
129
+ - Name and version
130
+ - Purpose (infer from name/usage)
131
+ - Is it actively used?
132
+
133
+ ### 3b. Development Dependencies
134
+
135
+ Same for devDependencies, noting:
136
+ - Build tools
137
+ - Test frameworks
138
+ - Linters/formatters
139
+
140
+ ### 3c. Outdated Packages
141
+
142
+ ```bash
143
+ npm outdated
144
+ # or
145
+ pip list --outdated
146
+ ```
147
+
148
+ ---
149
+
150
+ ## 4. Map Data Flow
151
+
152
+ ### 4a. External Integrations
153
+
154
+ Search for:
155
+ **PowerShell:**
156
+ ```powershell
157
+ # API calls
158
+ Select-String -Path "src/**/*" -Pattern "fetch\(|axios\.|http\."
159
+
160
+ # Database connections
161
+ Select-String -Path "**/*" -Pattern "DATABASE_URL|mongodb|postgres|mysql"
162
+
163
+ # Third-party services
164
+ Select-String -Path "**/*" -Pattern "stripe|sendgrid|twilio|aws-sdk"
165
+ ```
166
+
167
+ **Bash:**
168
+ ```bash
169
+ # API calls
170
+ grep -rE 'fetch\(|axios\.|http\.' src/
171
+
172
+ # Database connections
173
+ grep -rE 'DATABASE_URL|mongodb|postgres|mysql' .
174
+
175
+ # Third-party services
176
+ grep -rE 'stripe|sendgrid|twilio|aws-sdk' .
177
+ ```
178
+
179
+ ### 4b. Internal Flow
180
+
181
+ Trace how data moves:
182
+ - Entry point → Business logic → Data layer → Output
183
+ - Identify shared state (context, stores, singletons)
184
+
185
+ ---
186
+
187
+ ## 5. Identify Technical Debt
188
+
189
+ ### 5a. Code Smells
190
+
191
+ Search for indicators:
192
+ **PowerShell:**
193
+ ```powershell
194
+ # TODOs and FIXMEs
195
+ Select-String -Path "src/**/*" -Pattern "TODO|FIXME|HACK|XXX"
196
+
197
+ # Deprecated markers
198
+ Select-String -Path "**/*" -Pattern "@deprecated|DEPRECATED"
199
+ ```
200
+
201
+ **Bash:**
202
+ ```bash
203
+ # TODOs and FIXMEs
204
+ grep -rE 'TODO|FIXME|HACK|XXX' src/
205
+
206
+ # Deprecated markers
207
+ grep -rE '@deprecated|DEPRECATED' .
208
+ ```
209
+
210
+ ### 5b. Pattern Inconsistencies
211
+
212
+ Note where patterns differ:
213
+ - Naming conventions
214
+ - File organization
215
+ - Error handling approaches
216
+
217
+ ### 5c. Missing Elements
218
+
219
+ Identify gaps:
220
+ - No tests for critical paths
221
+ - Missing error boundaries
222
+ - No input validation
223
+ - No logging/monitoring
224
+
225
+ ---
226
+
227
+ ## 6. Write ARCHITECTURE.md
228
+
229
+ ```markdown
230
+ # Architecture
231
+
232
+ > Auto-generated by /map on {date}
233
+
234
+ ## Overview
235
+
236
+ {High-level description of what this system does}
237
+
238
+ ```
239
+ ┌─────────────────────────────────────────┐
240
+ │ [Entry Point] │
241
+ ├─────────────────────────────────────────┤
242
+ │ [Business Logic Layer] │
243
+ ├─────────────────────────────────────────┤
244
+ │ [Data Layer] │
245
+ └─────────────────────────────────────────┘
246
+ ```
247
+
248
+ ## Components
249
+
250
+ ### {Component 1}
251
+ - **Purpose:** {what it does}
252
+ - **Location:** `{path}`
253
+ - **Dependencies:** {what it imports}
254
+
255
+ ### {Component 2}
256
+ ...
257
+
258
+ ## Data Flow
259
+
260
+ 1. {Step 1}
261
+ 2. {Step 2}
262
+ 3. {Step 3}
263
+
264
+ ## Integration Points
265
+
266
+ | Service | Type | Purpose |
267
+ |---------|------|---------|
268
+ | {name} | API | {purpose} |
269
+
270
+ ## Technical Debt
271
+
272
+ - [ ] {Debt item 1}
273
+ - [ ] {Debt item 2}
274
+
275
+ ## Conventions
276
+
277
+ **Naming:** {patterns observed}
278
+ **Structure:** {organization patterns}
279
+ **Testing:** {test patterns}
280
+ ```
281
+
282
+ ---
283
+
284
+ ## 7. Write STACK.md
285
+
286
+ ```markdown
287
+ # Technology Stack
288
+
289
+ > Auto-generated by /map on {date}
290
+
291
+ ## Runtime
292
+
293
+ | Technology | Version | Purpose |
294
+ |------------|---------|---------|
295
+ | {runtime} | {version} | Core runtime |
296
+
297
+ ## Dependencies
298
+
299
+ ### Production
300
+ | Package | Version | Purpose |
301
+ |---------|---------|---------|
302
+ | {pkg} | {ver} | {purpose} |
303
+
304
+ ### Development
305
+ | Package | Version | Purpose |
306
+ |---------|---------|---------|
307
+ | {pkg} | {ver} | {purpose} |
308
+
309
+ ## Infrastructure
310
+
311
+ | Service | Provider | Purpose |
312
+ |---------|----------|---------|
313
+ | {service} | {provider} | {purpose} |
314
+
315
+ ## Configuration
316
+
317
+ | Variable | Purpose | Location |
318
+ |----------|---------|----------|
319
+ | {var} | {purpose} | {file} |
320
+
321
+ ## Outdated Packages
322
+
323
+ | Package | Current | Latest | Risk |
324
+ |---------|---------|--------|------|
325
+ | {pkg} | {cur} | {new} | {risk} |
326
+ ```
327
+
328
+ ---
329
+
330
+ ## 8. Update State
331
+
332
+ Update `.gsd/STATE.md`:
333
+ ```markdown
334
+ ## Last Session Summary
335
+ Codebase mapping complete.
336
+ - {N} components identified
337
+ - {M} dependencies analyzed
338
+ - {K} technical debt items found
339
+ ```
340
+
341
+ ---
342
+
343
+ ## 9. Commit Documentation
344
+
345
+ ```bash
346
+ git add .gsd/ARCHITECTURE.md .gsd/STACK.md .gsd/STATE.md
347
+ git commit -m "docs: map existing codebase"
348
+ ```
349
+
350
+ ---
351
+
352
+ ## 10. Offer Next Steps
353
+
354
+ </process>
355
+
356
+ <offer_next>
357
+
358
+ ```
359
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
360
+ GSD ► CODEBASE MAPPED ✓
361
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
362
+
363
+ Components: {N}
364
+ Dependencies: {M} production, {K} dev
365
+ Technical debt: {J} items
366
+
367
+ ───────────────────────────────────────────────────────
368
+
369
+ ▶ Next Up
370
+
371
+ /plan — create execution plans with full context
372
+
373
+ Files updated:
374
+ • .gsd/ARCHITECTURE.md
375
+ • .gsd/STACK.md
376
+
377
+ ───────────────────────────────────────────────────────
378
+ ```
379
+
380
+ </offer_next>
381
+
382
+ <related>
383
+ ## Related
384
+
385
+ ### Workflows
386
+ | Command | Relationship |
387
+ |---------|--------------|
388
+ | `/plan` | Use ARCHITECTURE.md from /map for planning context |
389
+
390
+ ### Skills
391
+ | Skill | Purpose |
392
+ |-------|---------|
393
+ | `codebase-mapper` | Detailed mapping methodology |
394
+ </related>
.agent/workflows/new-milestone.md ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: Create a new milestone with phases
3
+ argument-hint: "<milestone-name>"
4
+ ---
5
+
6
+ # /new-milestone Workflow
7
+
8
+ <objective>
9
+ Define a new milestone with goal, phases, and success criteria.
10
+ </objective>
11
+
12
+ <process>
13
+
14
+ ## 1. Validate SPEC Exists
15
+
16
+ **PowerShell:**
17
+ ```powershell
18
+ if (-not (Test-Path ".gsd/SPEC.md")) {
19
+ Write-Error "SPEC.md required. Run /new-project first."
20
+ }
21
+ ```
22
+
23
+ **Bash:**
24
+ ```bash
25
+ if [ ! -f ".gsd/SPEC.md" ]; then
26
+ echo "Error: SPEC.md required. Run /new-project first." >&2
27
+ fi
28
+ ```
29
+
30
+ ---
31
+
32
+ ## 2. Gather Milestone Information
33
+
34
+ Ask for:
35
+ - **Name** — Milestone identifier (e.g., "v1.0", "MVP", "Beta")
36
+ - **Goal** — What does this milestone achieve?
37
+ - **Must-haves** — Non-negotiable deliverables
38
+ - **Nice-to-haves** — Optional if time permits
39
+
40
+ ---
41
+
42
+ ## 3. Generate Phase Breakdown
43
+
44
+ Based on goal and must-haves, suggest phases:
45
+
46
+ ```markdown
47
+ ## Suggested Phases
48
+
49
+ Phase 1: {Foundation/Setup}
50
+ Phase 2: {Core Feature A}
51
+ Phase 3: {Core Feature B}
52
+ Phase 4: {Integration/Polish}
53
+ Phase 5: {Verification/Launch}
54
+ ```
55
+
56
+ Ask user to confirm or modify.
57
+
58
+ ---
59
+
60
+ ## 4. Update ROADMAP.md
61
+
62
+ ```markdown
63
+ # ROADMAP.md
64
+
65
+ > **Current Milestone**: {name}
66
+ > **Goal**: {goal}
67
+
68
+ ## Must-Haves
69
+ - [ ] {must-have 1}
70
+ - [ ] {must-have 2}
71
+
72
+ ## Phases
73
+
74
+ ### Phase 1: {name}
75
+ **Status**: ⬜ Not Started
76
+ **Objective**: {description}
77
+
78
+ ### Phase 2: {name}
79
+ **Status**: ⬜ Not Started
80
+ **Objective**: {description}
81
+
82
+ ...
83
+ ```
84
+
85
+ ---
86
+
87
+ ## 5. Update STATE.md
88
+
89
+ ```markdown
90
+ ## Current Position
91
+ - **Milestone**: {name}
92
+ - **Phase**: Not started
93
+ - **Status**: Milestone planned
94
+ ```
95
+
96
+ ---
97
+
98
+ ## 5b. Reset Session Files (if starting fresh)
99
+
100
+ If DECISIONS.md or JOURNAL.md contain entries from a previous milestone, reset them to prevent monolithic growth:
101
+
102
+ **PowerShell:**
103
+ ```powershell
104
+ # Only reset if files are non-empty and no archive exists yet
105
+ if ((Test-Path ".gsd/DECISIONS.md") -and (Get-Content ".gsd/DECISIONS.md" | Measure-Object -Line).Lines -gt 5) {
106
+ Set-Content ".gsd/DECISIONS.md" "# Decisions`n`n---`n"
107
+ }
108
+ if ((Test-Path ".gsd/JOURNAL.md") -and (Get-Content ".gsd/JOURNAL.md" | Measure-Object -Line).Lines -gt 5) {
109
+ Set-Content ".gsd/JOURNAL.md" "# Journal`n`n---`n"
110
+ }
111
+ ```
112
+
113
+ **Bash:**
114
+ ```bash
115
+ if [ -f ".gsd/DECISIONS.md" ] && [ "$(wc -l < .gsd/DECISIONS.md)" -gt 5 ]; then
116
+ printf '# Decisions\n\n---\n' > .gsd/DECISIONS.md
117
+ fi
118
+ if [ -f ".gsd/JOURNAL.md" ] && [ "$(wc -l < .gsd/JOURNAL.md)" -gt 5 ]; then
119
+ printf '# Journal\n\n---\n' > .gsd/JOURNAL.md
120
+ fi
121
+ ```
122
+
123
+ > **Note:** Only resets if files have grown beyond a header. If running `/complete-milestone` first, files are already archived and reset.
124
+
125
+ ---
126
+
127
+ ## 6. Commit
128
+
129
+ ```bash
130
+ git add .gsd/ROADMAP.md .gsd/STATE.md
131
+ git commit -m "docs: create milestone {name}"
132
+ ```
133
+
134
+ ---
135
+
136
+ ## 7. Offer Next Steps
137
+
138
+ ```
139
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
140
+ GSD ► MILESTONE CREATED ✓
141
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
142
+
143
+ Milestone: {name}
144
+ Phases: {N}
145
+
146
+ ───────────────────────────────────────────────────────
147
+
148
+ ▶ NEXT
149
+
150
+ /plan 1 — Create Phase 1 execution plans
151
+
152
+ ───────────────────────────────────────────────────────
153
+ ```
154
+
155
+ </process>
.agent/workflows/new-project.md ADDED
@@ -0,0 +1,368 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: Initialize a new project with deep context gathering
3
+ ---
4
+
5
+ # /new-project Workflow
6
+
7
+ <objective>
8
+ Initialize a new project through unified flow: questioning → research (optional) → requirements → roadmap.
9
+
10
+ This is the most leveraged moment in any project. Deep questioning here means better plans, better execution, better outcomes. One command takes you from idea to ready-for-planning.
11
+
12
+ **Creates:**
13
+ - `.gsd/SPEC.md` — project specification
14
+ - `.gsd/ROADMAP.md` — phase structure
15
+ - `.gsd/STATE.md` — project memory
16
+ - `.gsd/ARCHITECTURE.md` — system design (if brownfield)
17
+ - All other .gsd/ documentation files
18
+
19
+ **After this command:** Run `/plan 1` to start execution.
20
+ </objective>
21
+
22
+ <process>
23
+
24
+ ## Phase 1: Setup
25
+ **MANDATORY FIRST STEP — Execute these checks before ANY user interaction:**
26
+
27
+ 1. **Abort if project exists:**
28
+
29
+ **PowerShell:**
30
+ ```powershell
31
+ if (Test-Path ".gsd/SPEC.md") {
32
+ Write-Error "Project already initialized. Use /progress"
33
+ exit 1
34
+ }
35
+ ```
36
+
37
+ **Bash:**
38
+ ```bash
39
+ if [ -f ".gsd/SPEC.md" ]; then
40
+ echo "Error: Project already initialized. Use /progress" >&2
41
+ exit 1
42
+ fi
43
+ ```
44
+
45
+ 2. **Initialize git repo** (if not exists):
46
+
47
+ **PowerShell:**
48
+ ```powershell
49
+ if (-not (Test-Path ".git")) {
50
+ git init
51
+ Write-Output "Initialized new git repo"
52
+ }
53
+ ```
54
+
55
+ **Bash:**
56
+ ```bash
57
+ if [ ! -d ".git" ]; then
58
+ git init
59
+ echo "Initialized new git repo"
60
+ fi
61
+ ```
62
+
63
+ 3. **Detect existing code (brownfield detection):**
64
+
65
+ **PowerShell:**
66
+ ```powershell
67
+ $codeFiles = Get-ChildItem -Recurse -Include "*.ts","*.js","*.py","*.go","*.rs" |
68
+ Where-Object { $_.FullName -notmatch "node_modules|\.git" } |
69
+ Select-Object -First 20
70
+
71
+ $hasPackage = Test-Path "package.json" -or Test-Path "requirements.txt" -or Test-Path "Cargo.toml"
72
+ $hasArchitecture = Test-Path ".gsd/ARCHITECTURE.md"
73
+ ```
74
+
75
+ **Bash:**
76
+ ```bash
77
+ code_files=$(find . -type f \( -name "*.ts" -o -name "*.js" -o -name "*.py" -o -name "*.go" -o -name "*.rs" \) \
78
+ -not -path '*/node_modules/*' -not -path '*/.git/*' | head -20)
79
+
80
+ has_package=$(test -f "package.json" -o -f "requirements.txt" -o -f "Cargo.toml" && echo true || echo false)
81
+ has_architecture=$(test -f ".gsd/ARCHITECTURE.md" && echo true || echo false)
82
+ ```
83
+
84
+ ---
85
+
86
+ ## Phase 2: Brownfield Offer
87
+ **If existing code detected and ARCHITECTURE.md doesn't exist:**
88
+
89
+ ```
90
+ ⚠️ EXISTING CODE DETECTED
91
+
92
+ Found {N} source files in this directory.
93
+
94
+ Options:
95
+ A) Map codebase first — Run /map to understand existing architecture (Recommended)
96
+ B) Skip mapping — Proceed with project initialization
97
+
98
+ Which do you prefer?
99
+ ```
100
+
101
+ **If "Map codebase first":**
102
+ ```
103
+ Run `/map` first, then return to `/new-project`
104
+ ```
105
+ Exit command.
106
+
107
+ **If "Skip mapping":** Continue to Phase 3.
108
+ **If no existing code detected OR codebase already mapped:** Continue to Phase 3.
109
+
110
+ ---
111
+
112
+ ## Phase 3: Deep Questioning
113
+
114
+ Display banner:
115
+ ```
116
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
117
+ GSD ► QUESTIONING
118
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
119
+ ```
120
+
121
+ **Open the conversation:**
122
+
123
+ Ask: "What do you want to build?"
124
+
125
+ Wait for response. This gives context for intelligent follow-ups.
126
+
127
+ **Follow the thread:**
128
+
129
+ Based on their answer, ask follow-up questions that dig deeper:
130
+ - What excited them about this idea
131
+ - What problem sparked this
132
+ - What they mean by vague terms
133
+ - What it would actually look like
134
+ - What's already decided
135
+
136
+ **Questioning techniques:**
137
+ - Challenge vagueness: "When you say 'fast', what does that mean specifically?"
138
+ - Make abstract concrete: "Give me an example of how a user would..."
139
+ - Surface assumptions: "You're assuming users will... Is that validated?"
140
+ - Find edges: "What's explicitly NOT in scope?"
141
+ - Reveal motivation: "Why does this matter now?"
142
+
143
+ **Context checklist (gather mentally, not as interrogation):**
144
+ - [ ] Vision — What does success look like?
145
+ - [ ] Users — Who is this for?
146
+ - [ ] Problem — What pain does it solve?
147
+ - [ ] Scope — What's in, what's out?
148
+ - [ ] Constraints — Technical, timeline, budget?
149
+ - [ ] Prior art — What exists already?
150
+
151
+ **Decision gate:**
152
+
153
+ When you could write a clear SPEC.md:
154
+ ```
155
+ Ready to create SPEC.md?
156
+
157
+ A) Create SPEC.md — Let's move forward
158
+ B) Keep exploring — I want to share more
159
+ ```
160
+
161
+ If "Keep exploring" — ask what they want to add, or identify gaps and probe naturally.
162
+
163
+ Loop until "Create SPEC.md" selected.
164
+
165
+ ---
166
+
167
+ ## Phase 4: Write SPEC.md
168
+
169
+ Create `.gsd/SPEC.md`:
170
+
171
+ ```markdown
172
+ # SPEC.md — Project Specification
173
+
174
+ > **Status**: `FINALIZED`
175
+
176
+ ## Vision
177
+ {Distilled from questioning — one paragraph max}
178
+
179
+ ## Goals
180
+ 1. {Primary goal}
181
+ 2. {Secondary goal}
182
+ 3. {Tertiary goal}
183
+
184
+ ## Non-Goals (Out of Scope)
185
+ - {Explicitly excluded}
186
+ - {Not in this version}
187
+
188
+ ## Users
189
+ {Who will use this and how}
190
+
191
+ ## Constraints
192
+ - {Technical constraints}
193
+ - {Timeline constraints}
194
+ - {Other limitations}
195
+
196
+ ## Success Criteria
197
+ - [ ] {Measurable outcome 1}
198
+ - [ ] {Measurable outcome 2}
199
+ ```
200
+
201
+ ---
202
+
203
+ ## Phase 5: Research Decision
204
+
205
+ If project involves unfamiliar technology or architectural decisions:
206
+
207
+ ```
208
+ 📚 RESEARCH CHECK
209
+
210
+ This project involves {area where research might help}.
211
+
212
+ Would you like to:
213
+ A) Do research first — Investigate options before committing
214
+ B) Skip research — I know what I want, let's plan
215
+
216
+ ```
217
+
218
+ **If research selected:**
219
+ - Create `.gsd/RESEARCH.md` with findings
220
+ - Document technology choices and rationale
221
+ - Return to continue
222
+
223
+ ---
224
+
225
+ ## Phase 6: Define Requirements
226
+
227
+ Generate requirements from SPEC.md:
228
+
229
+ ```markdown
230
+ # REQUIREMENTS.md
231
+
232
+ ## Format
233
+ | ID | Requirement | Source | Status |
234
+ |----|-------------|--------|--------|
235
+ | REQ-01 | {requirement} | SPEC goal 1 | Pending |
236
+ | REQ-02 | {requirement} | SPEC goal 2 | Pending |
237
+ ```
238
+
239
+ **Rules:**
240
+ - Each requirement is testable
241
+ - Each maps to a SPEC goal
242
+ - Status starts as "Pending"
243
+
244
+ **If simple project:** Skip formal requirements, SPEC.md is sufficient.
245
+
246
+ ---
247
+
248
+ ## Phase 7: Create Roadmap
249
+
250
+ Create `.gsd/ROADMAP.md`:
251
+
252
+ ```markdown
253
+ # ROADMAP.md
254
+
255
+ > **Current Phase**: Not started
256
+ > **Milestone**: v1.0
257
+
258
+ ## Must-Haves (from SPEC)
259
+ - [ ] {must-have 1}
260
+ - [ ] {must-have 2}
261
+
262
+ ## Phases
263
+
264
+ ### Phase 1: {Foundation}
265
+ **Status**: ⬜ Not Started
266
+ **Objective**: {what this delivers}
267
+ **Requirements**: REQ-01, REQ-02
268
+
269
+ ### Phase 2: {Core Feature}
270
+ **Status**: ⬜ Not Started
271
+ **Objective**: {what this delivers}
272
+ **Requirements**: REQ-03
273
+
274
+ ### Phase 3: {Integration}
275
+ **Status**: ⬜ Not Started
276
+ **Objective**: {what this delivers}
277
+
278
+ ### Phase 4: {Polish/Launch}
279
+ **Status**: ⬜ Not Started
280
+ **Objective**: {final touches}
281
+ ```
282
+
283
+ **Phase creation rules:**
284
+ - 3-5 phases per milestone
285
+ - Each phase has clear deliverable
286
+ - Dependencies flow forward
287
+
288
+ ---
289
+
290
+ ## Phase 8: Initialize Remaining Files
291
+
292
+ Create with templates:
293
+ - `.gsd/STATE.md` — Empty state
294
+ - `.gsd/DECISIONS.md` — Empty ADR log
295
+ - `.gsd/JOURNAL.md` — Empty journal
296
+ - `.gsd/TODO.md` — Empty todo list
297
+
298
+ Create directories:
299
+ - `.gsd/phases/`
300
+ - `.gsd/templates/`
301
+
302
+ ---
303
+
304
+ ## Phase 9: Initial Commit
305
+
306
+ ```bash
307
+ git add .gsd/
308
+ git commit -m "chore: initialize GSD project
309
+
310
+ - SPEC.md with vision and goals
311
+ - ROADMAP.md with {N} phases
312
+ - Project documentation structure"
313
+ ```
314
+
315
+ ---
316
+
317
+ ## Phase 10: Done
318
+
319
+ ```
320
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
321
+ GSD ► PROJECT INITIALIZED ✓
322
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
323
+
324
+ Project: {name}
325
+ Phases: {N}
326
+
327
+ Files created:
328
+ • .gsd/SPEC.md (FINALIZED)
329
+ • .gsd/ROADMAP.md ({N} phases)
330
+ • .gsd/STATE.md
331
+ • .gsd/DECISIONS.md
332
+ • .gsd/JOURNAL.md
333
+
334
+ ───────────────────────────────────────────────────────
335
+
336
+ ▶ NEXT
337
+
338
+ /discuss-phase 1 — Clarify scope (optional but recommended)
339
+ /plan 1 — Create Phase 1 execution plans
340
+
341
+ ───────────────────────────────────────────────────────
342
+
343
+ 💡 The questioning phase is the highest-leverage moment.
344
+ Time invested here pays dividends throughout execution.
345
+
346
+ ───────────────────────────────────────────────────────
347
+ ```
348
+
349
+ </process>
350
+
351
+ <questioning_philosophy>
352
+ ## Why Deep Questioning Matters
353
+
354
+ The original GSD emphasizes that `/new-project` is the most leveraged moment.
355
+ Every minute spent understanding what to build saves hours of building the wrong thing.
356
+
357
+ **Signs questioning is done:**
358
+ - You could explain the project to a stranger
359
+ - You know what's NOT being built (scope edges)
360
+ - Success criteria are measurable
361
+ - You're excited to start planning
362
+
363
+ **Signs more questioning needed:**
364
+ - Vague terms remain unexplained
365
+ - You don't know who the user is
366
+ - Success is defined as "it works"
367
+ - Scope keeps expanding during discussion
368
+ </questioning_philosophy>
.agent/workflows/pause.md ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: Context hygiene — dump state for clean session handoff
3
+ ---
4
+
5
+ # /pause Workflow
6
+
7
+ <objective>
8
+ Safely pause work with complete state preservation for session handoff.
9
+ </objective>
10
+
11
+ <when_to_use>
12
+ - Ending a work session
13
+ - Context getting heavy (many failed attempts)
14
+ - Switching to a different task
15
+ - Before taking a break
16
+ - After 3+ debugging failures (Context Hygiene rule)
17
+ </when_to_use>
18
+
19
+ <process>
20
+
21
+ ## 1. Capture Current State
22
+
23
+ Update `.gsd/STATE.md`:
24
+
25
+ ```markdown
26
+ ## Current Position
27
+ - **Phase**: {current phase number and name}
28
+ - **Task**: {specific task in progress, if any}
29
+ - **Status**: Paused at {timestamp}
30
+
31
+ ## Last Session Summary
32
+ {What was accomplished this session}
33
+
34
+ ## In-Progress Work
35
+ {Any uncommitted changes or partial work}
36
+ - Files modified: {list}
37
+ - Tests status: {passing/failing/not run}
38
+
39
+ ## Blockers
40
+ {What was preventing progress, if anything}
41
+
42
+ ## Context Dump
43
+ {Critical context that would be lost}:
44
+
45
+ ### Decisions Made
46
+ - {Decision 1}: {rationale}
47
+ - {Decision 2}: {rationale}
48
+
49
+ ### Approaches Tried
50
+ - {Approach 1}: {outcome}
51
+ - {Approach 2}: {outcome}
52
+
53
+ ### Current Hypothesis
54
+ {Best guess at solution/issue}
55
+
56
+ ### Files of Interest
57
+ - `{file1}`: {what's relevant}
58
+ - `{file2}`: {what's relevant}
59
+
60
+ ## Next Steps
61
+ 1. {Specific first action for next session}
62
+ 2. {Second priority}
63
+ 3. {Third priority}
64
+ ```
65
+
66
+ ---
67
+
68
+ ## 2. Add Journal Entry
69
+
70
+ Create entry in `.gsd/JOURNAL.md`:
71
+
72
+ ```markdown
73
+ ## Session: {YYYY-MM-DD HH:MM}
74
+
75
+ ### Objective
76
+ {What this session was trying to accomplish}
77
+
78
+ ### Accomplished
79
+ - {Item 1}
80
+ - {Item 2}
81
+
82
+ ### Verification
83
+ - [x] {What was verified}
84
+ - [ ] {What still needs verification}
85
+
86
+ ### Paused Because
87
+ {Reason for pausing}
88
+
89
+ ### Handoff Notes
90
+ {Critical info for resuming}
91
+ ```
92
+
93
+ ---
94
+
95
+ ## 3. Commit State
96
+
97
+ ```bash
98
+ git add .gsd/STATE.md .gsd/JOURNAL.md
99
+ git commit -m "docs: pause session - {brief reason}"
100
+ ```
101
+
102
+ ---
103
+
104
+ ## 4. Display Handoff
105
+
106
+ ```
107
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
108
+ GSD ► SESSION PAUSED ⏸
109
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
110
+
111
+ State saved to:
112
+ • .gsd/STATE.md
113
+ • .gsd/JOURNAL.md
114
+
115
+ ───────────────────────────────────────────────────────
116
+
117
+ To resume later:
118
+
119
+ /resume
120
+
121
+ ───────────────────────────────────────────────────────
122
+
123
+ 💡 Fresh context = fresh perspective
124
+ The struggles end here. Next session starts clean.
125
+
126
+ ───────────────────────────────────────────────────────
127
+ ```
128
+
129
+ </process>
130
+
131
+ <context_hygiene>
132
+ If pausing due to debugging failures:
133
+
134
+ 1. Be explicit about what failed
135
+ 2. Document exact error messages
136
+ 3. List files that were touched
137
+ 4. State your hypothesis clearly
138
+ 5. Suggest what to try next (different approach)
139
+
140
+ A fresh context often immediately sees solutions that a polluted context missed.
141
+ </context_hygiene>
142
+
143
+ <proactive_state_save>
144
+ ## Proactive Auto-Save (Session Limit Protection)
145
+
146
+ **Problem:** If a session hard-terminates (usage/context limit), `/pause` becomes unreachable.
147
+
148
+ **Solution:** The agent should auto-save state BEFORE limits are hit.
149
+
150
+ ### When to Auto-Save
151
+
152
+ | Trigger | Action |
153
+ |---------|--------|
154
+ | Context usage reaches ~50-70% | Write lightweight state snapshot to `.gsd/STATE.md` |
155
+ | 3-strike debugging rule fires | Save state dump BEFORE recommending `/pause` |
156
+ | Extended session detected | Periodic state checkpoints to `.gsd/STATE.md` |
157
+
158
+ ### Auto-Save Protocol
159
+
160
+ 1. **Detect** context health warning signals (see context-health-monitor skill)
161
+ 2. **Write** current state to `.gsd/STATE.md` immediately
162
+ 3. **Then** inform the user and recommend `/pause`
163
+ 4. If session terminates unexpectedly, state is already saved
164
+
165
+ ### Minimum Auto-Save Content
166
+
167
+ ```markdown
168
+ ## Auto-Save: {timestamp}
169
+ - **Phase**: {current phase}
170
+ - **Task**: {current task or "between tasks"}
171
+ - **Last Action**: {what was just completed}
172
+ - **Next Step**: {what should happen next}
173
+ ```
174
+
175
+ **Key principle:** Save first, recommend second. Never rely on the user being able to issue `/pause`.
176
+ </proactive_state_save>
.agent/workflows/plan-milestone-gaps.md ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: Create plans to address gaps found in milestone audit
3
+ ---
4
+
5
+ # /plan-milestone-gaps Workflow
6
+
7
+ <objective>
8
+ Create targeted plans to address gaps, technical debt, and issues identified during milestone audit.
9
+ </objective>
10
+
11
+ <process>
12
+
13
+ ## 1. Load Gap Information
14
+
15
+ Read from:
16
+ - Latest AUDIT.md or VERIFICATION.md
17
+ - TODO.md for deferred items
18
+ - DECISIONS.md for acknowledged debt
19
+
20
+ ---
21
+
22
+ ## 2. Categorize Gaps
23
+
24
+ | Category | Priority | Action |
25
+ |----------|----------|--------|
26
+ | Must-have failures | 🔴 High | Create fix phase |
27
+ | Technical debt | 🟡 Medium | Add to roadmap |
28
+ | Nice-to-have misses | 🟢 Low | Add to backlog |
29
+
30
+ ---
31
+
32
+ ## 3. Create Gap Closure Phase
33
+
34
+ Add new phase to ROADMAP.md:
35
+
36
+ ```markdown
37
+ ### Phase {N}: Gap Closure
38
+ **Status**: ⬜ Not Started
39
+ **Objective**: Address gaps from milestone audit
40
+
41
+ **Gaps to Close:**
42
+ - [ ] {gap 1}
43
+ - [ ] {gap 2}
44
+ ```
45
+
46
+ ---
47
+
48
+ ## 4. Create PLAN.md for Each Gap
49
+
50
+ ```markdown
51
+ ---
52
+ phase: {N}
53
+ plan: fix-{gap-id}
54
+ wave: 1
55
+ gap_closure: true
56
+ ---
57
+
58
+ # Fix: {Gap Description}
59
+
60
+ ## Problem
61
+ {What the audit found}
62
+
63
+ ## Root Cause
64
+ {Why it exists}
65
+
66
+ ## Tasks
67
+
68
+ <task type="auto">
69
+ <name>Fix {issue}</name>
70
+ <files>{files}</files>
71
+ <action>{fix instructions}</action>
72
+ <verify>{original verification that failed}</verify>
73
+ <done>{criteria}</done>
74
+ </task>
75
+ ```
76
+
77
+ ---
78
+
79
+ ## 5. Update STATE.md
80
+
81
+ ```markdown
82
+ ## Gap Closure Mode
83
+ Addressing {N} gaps from milestone audit.
84
+ ```
85
+
86
+ ---
87
+
88
+ ## 6. Commit Plans
89
+
90
+ ```powershell
91
+ git add .gsd/
92
+ git commit -m "docs: create gap closure plans"
93
+ ```
94
+
95
+ ---
96
+
97
+ ## 7. Offer Execution
98
+
99
+ ```
100
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
101
+ GSD ► GAP CLOSURE PLANS CREATED ✓
102
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
103
+
104
+ Gaps identified: {N}
105
+ Plans created: {M}
106
+
107
+ ───────────────────────────────────────────────────────
108
+
109
+ ▶ NEXT
110
+
111
+ /execute {N} --gaps-only — Execute gap closure plans
112
+
113
+ ───────────────────────────────────────────────────────
114
+ ```
115
+
116
+ </process>
.agent/workflows/plan.md ADDED
@@ -0,0 +1,396 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: The Strategist — Decompose requirements into executable phases in ROADMAP.md
3
+ argument-hint: "[phase] [--research] [--skip-research] [--gaps]"
4
+ ---
5
+
6
+ # /plan Workflow
7
+
8
+ <role>
9
+ You are a GSD planner orchestrator. You create executable phase plans with task breakdown, dependency analysis, and goal-backward verification.
10
+
11
+ **Core responsibilities:**
12
+ - Parse arguments and validate phase
13
+ - Handle research (unless skipped or exists)
14
+ - Create PLAN.md files with XML task structure
15
+ - Verify plans with checker logic
16
+ - Iterate until plans pass (max 3 iterations)
17
+ </role>
18
+
19
+ <objective>
20
+ Create executable phase prompts (PLAN.md files) for a roadmap phase with integrated research and verification.
21
+
22
+ **Default flow:** Research (if needed) → Plan → Verify → Done
23
+
24
+ **Why subagents:** Research and planning burn context fast. Verification uses fresh context. User sees the flow between agents in main context.
25
+ </objective>
26
+
27
+ <context>
28
+ **Phase number:** $ARGUMENTS (optional — auto-detects next unplanned phase if not provided)
29
+
30
+ **Flags:**
31
+ - `--research` — Force re-research even if RESEARCH.md exists
32
+ - `--skip-research` — Skip research entirely, go straight to planning
33
+ - `--gaps` — Gap closure mode (reads VERIFICATION.md, skips research)
34
+
35
+ **Required files:**
36
+ - `.gsd/SPEC.md` — Must be FINALIZED (Planning Lock)
37
+ - `.gsd/ROADMAP.md` — Must have phases defined
38
+ </context>
39
+
40
+ <philosophy>
41
+
42
+ ## Solo Developer + Claude Workflow
43
+ You are planning for ONE person (the user) and ONE implementer (Claude).
44
+ - No teams, stakeholders, ceremonies, coordination overhead
45
+ - User is the visionary/product owner
46
+ - Claude is the builder
47
+
48
+ ## Plans Are Prompts
49
+ PLAN.md is NOT a document that gets transformed into a prompt.
50
+ PLAN.md IS the prompt. It contains:
51
+ - Objective (what and why)
52
+ - Context (@file references)
53
+ - Tasks (with verification criteria)
54
+ - Success criteria (measurable)
55
+
56
+ ## Quality Degradation Curve
57
+
58
+ | Context Usage | Quality | State |
59
+ |---------------|---------|-------|
60
+ | 0-30% | PEAK | Thorough, comprehensive |
61
+ | 30-50% | GOOD | Confident, solid work |
62
+ | 50-70% | DEGRADING | Efficiency mode begins |
63
+ | 70%+ | POOR | Rushed, minimal |
64
+
65
+ **The rule:** Plans should complete within ~50% context. More plans, smaller scope.
66
+
67
+ ## Aggressive Atomicity
68
+ Each plan: **2-3 tasks max**. No exceptions.
69
+
70
+ </philosophy>
71
+
72
+ <discovery_levels>
73
+
74
+ ## Discovery Protocol
75
+
76
+ Discovery is MANDATORY unless you can prove current context exists.
77
+
78
+ **Level 0 — Skip** (pure internal work)
79
+ - ALL work follows established codebase patterns
80
+ - No new external dependencies
81
+ - Pure internal refactoring or feature extension
82
+
83
+ **Level 1 — Quick Verification** (2-5 min)
84
+ - Single known library, confirming syntax/version
85
+ - Low-risk decision (easily changed later)
86
+ - Action: Quick web search, no RESEARCH.md needed
87
+
88
+ **Level 1.5 — Discovery** (5-15 min)
89
+ - Quick library/option comparison (A vs B)
90
+ - Low-to-medium risk, focused question
91
+ - Action: Create DISCOVERY.md using `.gsd/templates/discovery.md` template
92
+
93
+ **Level 2 — Standard Research** (15-30 min)
94
+ - Choosing between 2-3 options
95
+ - New external integration (API, service)
96
+ - Medium-risk decision
97
+ - Action: Create RESEARCH.md with findings
98
+
99
+ **Level 3 — Deep Dive** (1+ hour)
100
+ - Architectural decision with long-term impact
101
+ - Novel problem without clear patterns
102
+ - High-risk, hard to change later
103
+ - Action: Full research with RESEARCH.md
104
+
105
+ </discovery_levels>
106
+
107
+ <process>
108
+
109
+ ## 1. Validate Environment (Planning Lock)
110
+
111
+ **PowerShell:**
112
+ ```powershell
113
+ # Check SPEC.md exists and is finalized
114
+ $spec = Get-Content ".gsd/SPEC.md" -Raw
115
+ if ($spec -notmatch "FINALIZED") {
116
+ Write-Error "SPEC.md must be FINALIZED before planning"
117
+ exit
118
+ }
119
+ ```
120
+
121
+ **Bash:**
122
+ ```bash
123
+ # Check SPEC.md exists and is finalized
124
+ if ! grep -q "FINALIZED" ".gsd/SPEC.md"; then
125
+ echo "Error: SPEC.md must be FINALIZED before planning" >&2
126
+ exit 1
127
+ fi
128
+ ```
129
+
130
+ **If not finalized:** Error — user must complete SPEC.md first.
131
+
132
+ ---
133
+
134
+ ## 2. Parse and Normalize Arguments
135
+
136
+ Extract from $ARGUMENTS:
137
+ - Phase number (integer)
138
+ - `--research` flag
139
+ - `--skip-research` flag
140
+ - `--gaps` flag
141
+
142
+ **If no phase number:** Detect next unplanned phase from ROADMAP.md.
143
+
144
+ ---
145
+
146
+ ## 3. Validate Phase
147
+
148
+ **PowerShell:**
149
+ ```powershell
150
+ Select-String -Path ".gsd/ROADMAP.md" -Pattern "Phase $PHASE:"
151
+ ```
152
+
153
+ **Bash:**
154
+ ```bash
155
+ grep "Phase $PHASE:" ".gsd/ROADMAP.md"
156
+ ```
157
+
158
+ **If not found:** Error with available phases.
159
+ **If found:** Extract phase name and description.
160
+
161
+ ---
162
+
163
+ ## 4. Ensure Phase Directory
164
+
165
+ **PowerShell:**
166
+ ```powershell
167
+ $PHASE_DIR = ".gsd/phases/$PHASE"
168
+ if (-not (Test-Path $PHASE_DIR)) {
169
+ New-Item -ItemType Directory -Path $PHASE_DIR
170
+ }
171
+ ```
172
+
173
+ **Bash:**
174
+ ```bash
175
+ PHASE_DIR=".gsd/phases/$PHASE"
176
+ mkdir -p "$PHASE_DIR"
177
+ ```
178
+
179
+ ---
180
+
181
+ ## 5. Handle Research
182
+
183
+ **If `--gaps` flag:** Skip research (gap closure uses VERIFICATION.md).
184
+
185
+ **If `--skip-research` flag:** Skip to step 6.
186
+
187
+ **Check for existing research:**
188
+ **PowerShell:**
189
+ ```powershell
190
+ Test-Path "$PHASE_DIR/RESEARCH.md"
191
+ ```
192
+
193
+ **Bash:**
194
+ ```bash
195
+ test -f "$PHASE_DIR/RESEARCH.md"
196
+ ```
197
+
198
+ **If RESEARCH.md exists AND `--research` flag NOT set:**
199
+ - Display: `Using existing research: $PHASE_DIR/RESEARCH.md`
200
+ - Skip to step 6
201
+
202
+ **If research needed:**
203
+
204
+ Display banner:
205
+ ```
206
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
207
+ GSD ► RESEARCHING PHASE {N}
208
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
209
+ ```
210
+
211
+ Perform research based on discovery level (see `<discovery_levels>`).
212
+
213
+ Create `$PHASE_DIR/RESEARCH.md` with findings.
214
+
215
+ ---
216
+
217
+ ## 6. Create Plans
218
+
219
+ Display banner:
220
+ ```
221
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
222
+ GSD ► PLANNING PHASE {N}
223
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
224
+ ```
225
+
226
+ ### 6a. Gather Context
227
+ Load:
228
+ - `.gsd/SPEC.md` — Requirements
229
+ - `.gsd/REQUIREMENTS.md` — Formal requirements tracking (if exists)
230
+ - `.gsd/ROADMAP.md` — Phase description
231
+ - `$PHASE_DIR/RESEARCH.md` — If exists
232
+ - `.gsd/ARCHITECTURE.md` — If exists
233
+
234
+ ### 6b. Decompose into Tasks
235
+ For the phase goal:
236
+ 1. Identify all deliverables
237
+ 2. Break into atomic tasks (2-3 per plan)
238
+ 3. Determine dependencies between tasks
239
+ 4. Assign execution waves
240
+
241
+ ### 6c. Write PLAN.md Files
242
+
243
+ Create `$PHASE_DIR/{N}-PLAN.md`:
244
+
245
+ ```markdown
246
+ ---
247
+ phase: {N}
248
+ plan: 1
249
+ wave: 1
250
+ ---
251
+
252
+ # Plan {N}.1: {Plan Name}
253
+
254
+ ## Objective
255
+ {What this plan delivers and why}
256
+
257
+ ## Context
258
+ - .gsd/SPEC.md
259
+ - .gsd/ARCHITECTURE.md
260
+ - {relevant source files}
261
+
262
+ ## Tasks
263
+
264
+ <task type="auto">
265
+ <name>{Task name}</name>
266
+ <files>{exact file paths}</files>
267
+ <action>
268
+ {Specific implementation instructions}
269
+ - What to do
270
+ - What to avoid and WHY
271
+ </action>
272
+ <verify>{Command to prove task complete}</verify>
273
+ <done>{Measurable acceptance criteria}</done>
274
+ </task>
275
+
276
+ <task type="auto">
277
+ ...
278
+ </task>
279
+
280
+ ## Success Criteria
281
+ - [ ] {Measurable outcome 1}
282
+ - [ ] {Measurable outcome 2}
283
+ ```
284
+
285
+ ---
286
+
287
+ ## 7. Verify Plans (Checker Logic)
288
+
289
+ For each plan, verify:
290
+ - [ ] All files specified exist or will be created
291
+ - [ ] Actions are specific (no "implement X")
292
+ - [ ] Verify commands are executable
293
+ - [ ] Done criteria are measurable
294
+ - [ ] Context references exist
295
+ - [ ] Tests are meaningful (see Test Quality Rules below)
296
+
297
+ **If issues found:** Fix and re-verify (max 3 iterations).
298
+
299
+ ### Test Quality Rules
300
+
301
+ Tests must verify real behavior, not just pass. Reject plans with tests that:
302
+
303
+ | Anti-pattern | Example | Fix |
304
+ |-------------|---------|-----|
305
+ | **Mock everything** | Mocking the DB then asserting the mock was called | Use real DB or integration test |
306
+ | **Tautological assert** | `assert mock.called` with no behavior check | Assert actual output or side effect |
307
+ | **Always-pass test** | `assert True` or `assert response is not None` | Assert specific expected values |
308
+ | **Testing the framework** | Asserting that Express returns 200 on a stub | Test your logic, not the framework |
309
+ | **No negative cases** | Only testing the happy path | Include at least one failure/edge case |
310
+
311
+ **Rule:** Every `<verify>` command must test the *actual behavior* of the code, not just that it runs without errors. If a test would still pass with the implementation deleted, it is not a valid test.
312
+
313
+ ---
314
+
315
+ ## 8. Update State
316
+
317
+ Update `.gsd/STATE.md`:
318
+ ```markdown
319
+ ## Current Position
320
+ - **Phase**: {N}
321
+ - **Task**: Planning complete
322
+ - **Status**: Ready for execution
323
+
324
+ ## Next Steps
325
+ 1. /execute {N}
326
+ ```
327
+
328
+ ---
329
+
330
+ ## 9. Commit Plans
331
+
332
+ ```bash
333
+ git add .gsd/phases/$PHASE/
334
+ git add .gsd/STATE.md
335
+ git commit -m "docs(phase-$PHASE): create execution plans"
336
+ ```
337
+
338
+ ---
339
+
340
+ ## 10. Offer Next Steps
341
+
342
+ </process>
343
+
344
+ <offer_next>
345
+
346
+ ```
347
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
348
+ GSD ► PHASE {N} PLANNED ✓
349
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
350
+
351
+ {X} plans created across {Y} waves
352
+
353
+ Plans:
354
+ • {N}.1: {Name} (wave 1)
355
+ • {N}.2: {Name} (wave 1)
356
+ • {N}.3: {Name} (wave 2)
357
+
358
+ ──────────────────────────────────────────���────────────
359
+
360
+ ▶ Next Up
361
+
362
+ /execute {N} — run all plans
363
+
364
+ ───────────────────────────────────────────────────────
365
+ ```
366
+
367
+ </offer_next>
368
+
369
+ <task_types>
370
+
371
+ | Type | Use For | Autonomy |
372
+ |------|---------|----------|
373
+ | `auto` | Everything Claude can do independently | Fully autonomous |
374
+ | `checkpoint:human-verify` | Visual/functional verification | Pauses for user |
375
+ | `checkpoint:decision` | Implementation choices | Pauses for user |
376
+
377
+ **Automation-first rule:** If Claude CAN do it, Claude MUST do it. Checkpoints are for verification AFTER automation.
378
+
379
+ </task_types>
380
+
381
+ <related>
382
+ ## Related
383
+
384
+ ### Workflows
385
+ | Command | Relationship |
386
+ |---------|--------------|
387
+ | `/map` | Run before /plan to get codebase context |
388
+ | `/execute` | Runs PLAN.md files created by /plan |
389
+ | `/verify` | Validates executed plans |
390
+
391
+ ### Skills
392
+ | Skill | Purpose |
393
+ |-------|---------|
394
+ | `planner` | Detailed planning methodology |
395
+ | `plan-checker` | Validates plans before execution |
396
+ </related>
.agent/workflows/progress.md ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: Show current position in roadmap and next steps
3
+ ---
4
+
5
+ # /progress Workflow
6
+
7
+ <objective>
8
+ Quick status check — where are we and what's next?
9
+ </objective>
10
+
11
+ <process>
12
+
13
+ ## 1. Load Current State
14
+
15
+ Read:
16
+ - `.gsd/STATE.md` — Current position
17
+ - `.gsd/ROADMAP.md` — Phase statuses
18
+
19
+ ---
20
+
21
+ ## 2. Calculate Progress
22
+
23
+ Count phases:
24
+ - Total phases
25
+ - Completed phases (✅)
26
+ - In progress (🔄)
27
+ - Blocked (⏸️)
28
+ - Not started (⬜)
29
+
30
+ ---
31
+
32
+ ## 3. Display Status
33
+
34
+ ```
35
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
36
+ GSD ► PROGRESS
37
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
38
+
39
+ Project: {project name from SPEC.md}
40
+ Milestone: {milestone from ROADMAP.md}
41
+
42
+ ───────────────────────────────────────────────────────
43
+
44
+ PHASES
45
+
46
+ ✅ Phase 1: {Name}
47
+ ✅ Phase 2: {Name}
48
+ 🔄 Phase 3: {Name} ← CURRENT
49
+ ⬜ Phase 4: {Name}
50
+ ⬜ Phase 5: {Name}
51
+
52
+ Progress: {completed}/{total} ({percentage}%)
53
+
54
+ ───────────────────────────────────────────────────────
55
+
56
+ CURRENT TASK
57
+
58
+ {Current task from STATE.md, or "None"}
59
+
60
+ ───────────────────────────────────────────────────────
61
+
62
+ BLOCKERS
63
+
64
+ {Blockers from STATE.md, or "None"}
65
+
66
+ ───────────────────────────────────────────────────────
67
+
68
+ ▶ NEXT UP
69
+
70
+ {Recommended next action based on state}
71
+
72
+ ───────────────────────────────────────────────────────
73
+ ```
74
+
75
+ ---
76
+
77
+ ## 4. Suggest Action
78
+
79
+ Based on status, recommend:
80
+
81
+ | State | Recommendation |
82
+ |-------|----------------|
83
+ | Phase in progress | `/execute {N}` to continue |
84
+ | Phase done, not verified | `/verify {N}` |
85
+ | Verification failed | `/execute {N} --gaps-only` |
86
+ | All phases complete | Celebrate! 🎉 |
87
+ | No phases started | `/plan 1` to begin |
88
+ | SPEC not finalized | Complete SPEC.md first |
89
+
90
+ </process>
.agent/workflows/remove-phase.md ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: Remove a phase from the roadmap (with safety checks)
3
+ argument-hint: "<phase-number>"
4
+ ---
5
+
6
+ # /remove-phase Workflow
7
+
8
+ <objective>
9
+ Remove a phase from the roadmap, with safety checks for in-progress or completed work.
10
+ </objective>
11
+
12
+ <process>
13
+
14
+ ## 1. Validate Phase Exists
15
+
16
+ **PowerShell:**
17
+ ```powershell
18
+ $phase = Select-String -Path ".gsd/ROADMAP.md" -Pattern "### Phase $N:"
19
+ if (-not $phase) {
20
+ Write-Error "Phase $N not found in ROADMAP.md"
21
+ }
22
+ ```
23
+
24
+ **Bash:**
25
+ ```bash
26
+ if ! grep -q "### Phase $N:" ".gsd/ROADMAP.md"; then
27
+ echo "Error: Phase $N not found in ROADMAP.md" >&2
28
+ fi
29
+ ```
30
+
31
+ ---
32
+
33
+ ## 2. Check Phase Status
34
+
35
+ **PowerShell:**
36
+ ```powershell
37
+ $status = Select-String -Path ".gsd/ROADMAP.md" -Pattern "Phase $N:.*\n.*Status: (.*)"
38
+ ```
39
+
40
+ **Bash:**
41
+ ```bash
42
+ status=$(grep -A1 "Phase $N:" ".gsd/ROADMAP.md" | grep "Status:" | cut -d: -f2)
43
+ ```
44
+
45
+ **Safety checks:**
46
+
47
+ | Status | Action |
48
+ |--------|--------|
49
+ | ⬜ Not Started | Safe to remove |
50
+ | 🔄 In Progress | Warn and confirm |
51
+ | ✅ Complete | Error — archive instead |
52
+
53
+ ---
54
+
55
+ ## 3. Check for Dependencies
56
+
57
+ Are other phases depending on this one?
58
+
59
+ **PowerShell:**
60
+ ```powershell
61
+ Select-String -Path ".gsd/ROADMAP.md" -Pattern "Depends on.*Phase $N"
62
+ ```
63
+
64
+ **Bash:**
65
+ ```bash
66
+ grep "Depends on.*Phase $N" ".gsd/ROADMAP.md"
67
+ ```
68
+
69
+ **If dependencies exist:**
70
+ ```
71
+ ⚠️ Phase {M} depends on Phase {N}
72
+
73
+ Cannot remove. Consider:
74
+ 1. Update dependent phases first
75
+ 2. Use /insert-phase to restructure
76
+ ```
77
+
78
+ ---
79
+
80
+ ## 4. Confirm Removal
81
+
82
+ ```
83
+ ⚠️ CONFIRM REMOVAL
84
+
85
+ Phase {N}: {name}
86
+ Status: {status}
87
+
88
+ This will:
89
+ - Remove phase from ROADMAP.md
90
+ - Delete .gsd/phases/{N}/ if exists
91
+ - Renumber subsequent phases
92
+
93
+ Type "REMOVE" to confirm:
94
+ ```
95
+
96
+ ---
97
+
98
+ ## 5. Remove Phase
99
+
100
+ 1. Delete from ROADMAP.md
101
+ 2. Remove `.gsd/phases/{N}/` directory
102
+ 3. Renumber subsequent phases (N+1 becomes N, etc.)
103
+ 4. Update dependencies
104
+
105
+ ---
106
+
107
+ ## 6. Update STATE.md
108
+
109
+ If currently in removed phase, set to previous phase or "Planning".
110
+
111
+ ---
112
+
113
+ ## 7. Commit
114
+
115
+ ```bash
116
+ git add -A
117
+ git commit -m "docs: remove phase {N} - {name}"
118
+ ```
119
+
120
+ ---
121
+
122
+ ## 8. Display Result
123
+
124
+ ```
125
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
126
+ GSD ► PHASE REMOVED ✓
127
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
128
+
129
+ Removed: Phase {N}: {name}
130
+ Renumbered: {M} phases
131
+
132
+ ───────────────────────────────────────────────────────
133
+
134
+ /progress — See updated roadmap
135
+
136
+ ───────────────────────────────────────────────────────
137
+ ```
138
+
139
+ </process>
.agent/workflows/research-phase.md ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: Deep technical research for a phase
3
+ argument-hint: "<phase-number> [--level 1|2|3]"
4
+ ---
5
+
6
+ # /research-phase Workflow
7
+
8
+ <objective>
9
+ Conduct technical research to inform planning decisions for a phase.
10
+ </objective>
11
+
12
+ <discovery_levels>
13
+ ## Discovery Levels
14
+
15
+ | Level | Time | Use When |
16
+ |-------|------|----------|
17
+ | 0 | 0 min | Already know, just doing it |
18
+ | 1 | 2-5 min | Single library, confirming syntax |
19
+ | 2 | 15-30 min | Choosing between options, new integration |
20
+ | 3 | 1+ hour | Architectural decision, novel problem |
21
+
22
+ **Default:** Level 2 unless specified.
23
+ </discovery_levels>
24
+
25
+ <process>
26
+
27
+ ## 1. Load Phase Context
28
+
29
+ Read:
30
+ - Phase objective from ROADMAP.md
31
+ - Relevant ARCHITECTURE.md sections
32
+ - STACK.md for current technologies
33
+
34
+ ---
35
+
36
+ ## 2. Identify Research Questions
37
+
38
+ What needs to be understood before planning?
39
+
40
+ ```markdown
41
+ ## Research Questions
42
+
43
+ 1. {Technical question 1}
44
+ 2. {Technical question 2}
45
+ 3. {Integration question}
46
+ ```
47
+
48
+ ---
49
+
50
+ ## 3. Conduct Research
51
+
52
+ Based on discovery level:
53
+
54
+ **Level 1:** Quick verification
55
+ - Check official docs
56
+ - Confirm API/syntax
57
+
58
+ **Level 2:** Comparison research
59
+ - Compare 2-3 options
60
+ - Evaluate trade-offs
61
+ - Make recommendation
62
+
63
+ **Level 3:** Deep dive
64
+ - Prototype if needed
65
+ - Research edge cases
66
+ - Document unknowns
67
+
68
+ ---
69
+
70
+ ## 4. Generate RESEARCH.md
71
+
72
+ Create `.gsd/phases/{N}/RESEARCH.md`:
73
+
74
+ ```markdown
75
+ ---
76
+ phase: {N}
77
+ level: {1|2|3}
78
+ researched_at: {date}
79
+ ---
80
+
81
+ # Phase {N} Research
82
+
83
+ ## Questions Investigated
84
+ 1. {question}
85
+ 2. {question}
86
+
87
+ ## Findings
88
+
89
+ ### {Topic 1}
90
+ {What was learned}
91
+
92
+ **Sources:**
93
+ - {URL}
94
+
95
+ **Recommendation:** {what to do}
96
+
97
+ ### {Topic 2}
98
+ ...
99
+
100
+ ## Decisions Made
101
+ | Decision | Choice | Rationale |
102
+ |----------|--------|-----------|
103
+ | {decision} | {choice} | {why} |
104
+
105
+ ## Patterns to Follow
106
+ - {pattern 1}
107
+ - {pattern 2}
108
+
109
+ ## Anti-Patterns to Avoid
110
+ - {anti-pattern}: {why}
111
+
112
+ ## Dependencies Identified
113
+ | Package | Version | Purpose |
114
+ |---------|---------|---------|
115
+ | {pkg} | {ver} | {why} |
116
+
117
+ ## Risks
118
+ - {risk}: {mitigation}
119
+
120
+ ## Ready for Planning
121
+ - [x] Questions answered
122
+ - [x] Approach selected
123
+ - [x] Dependencies identified
124
+ ```
125
+
126
+ ---
127
+
128
+ ## 5. Commit Research
129
+
130
+ ```powershell
131
+ git add .gsd/phases/{N}/RESEARCH.md
132
+ git commit -m "docs(phase-{N}): research complete"
133
+ ```
134
+
135
+ ---
136
+
137
+ ## 6. Offer Next Steps
138
+
139
+ ```
140
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
141
+ GSD ► RESEARCH COMPLETE ✓
142
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
143
+
144
+ Phase {N}: {name}
145
+ Level: {level}
146
+
147
+ Key findings:
148
+ • {finding 1}
149
+ • {finding 2}
150
+
151
+ ───────────────────────────────────────────────────────
152
+
153
+ ▶ NEXT
154
+
155
+ /plan {N} — Create plans informed by research
156
+
157
+ ───────────────────────────────────────────────────────
158
+ ```
159
+
160
+ </process>
.agent/workflows/resume.md ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: Restore context from previous session
3
+ ---
4
+
5
+ # /resume Workflow
6
+
7
+ <objective>
8
+ Start a new session with full context from where we left off.
9
+ </objective>
10
+
11
+ <process>
12
+
13
+ ## 1. Load Saved State
14
+
15
+ Read `.gsd/STATE.md` completely.
16
+
17
+ ---
18
+
19
+ ## 2. Display Context
20
+
21
+ ```
22
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
23
+ GSD ► RESUMING SESSION
24
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
25
+
26
+ LAST POSITION
27
+ ─────────────
28
+ Phase: {phase from STATE.md}
29
+ Task: {task from STATE.md}
30
+ Status: {status when paused}
31
+
32
+ ───────────────────────────────────────────────────────
33
+
34
+ CONTEXT FROM LAST SESSION
35
+ ─────────────────────────
36
+ {Context dump content from STATE.md}
37
+
38
+ ───────────────────────────────────────────────────────
39
+
40
+ BLOCKERS
41
+ ────────
42
+ {Blockers from STATE.md, or "None"}
43
+
44
+ ───────────────────────────────────────────────────────
45
+
46
+ NEXT STEPS (from last session)
47
+ ──────────────────────────────
48
+ 1. {First priority}
49
+ 2. {Second priority}
50
+ 3. {Third priority}
51
+
52
+ ───────────────────────────────────────────────────────
53
+ ```
54
+
55
+ ---
56
+
57
+ ## 3. Load Recent Journal
58
+
59
+ Show last entry from `.gsd/JOURNAL.md`:
60
+ - What was accomplished
61
+ - Handoff notes
62
+ - Any issues encountered
63
+
64
+ ---
65
+
66
+ ## 4. Check for Conflicts
67
+
68
+ ```bash
69
+ # Check for uncommitted changes
70
+ git status --porcelain
71
+ ```
72
+
73
+ **If changes found:**
74
+ ```
75
+ ⚠️ UNCOMMITTED CHANGES DETECTED
76
+
77
+ {list of modified files}
78
+
79
+ These may be from the previous session.
80
+ Review before proceeding.
81
+ ```
82
+
83
+ ---
84
+
85
+ ## 5. Update State
86
+
87
+ Mark session as active in `.gsd/STATE.md`:
88
+ ```markdown
89
+ **Status**: Active (resumed {timestamp})
90
+ ```
91
+
92
+ ---
93
+
94
+ ## 6. Suggest Action
95
+
96
+ ```
97
+ ───────────────────────────────────────────────────────
98
+
99
+ ▶ READY TO CONTINUE
100
+
101
+ Suggested action based on state:
102
+
103
+ {One of:}
104
+ • /execute {N} — Continue phase execution
105
+ • /verify {N} — Verify completed phase
106
+ • /plan {N} — Create plans for phase
107
+ • /progress — See full roadmap status
108
+
109
+ ───────────────────────────────────────────────────────
110
+
111
+ 💡 Fresh session = fresh perspective
112
+
113
+ You have all the context you need.
114
+ The previous struggles are documented.
115
+ Time to solve this with fresh eyes.
116
+
117
+ ───────────────────────────────────────────────────────
118
+ ```
119
+
120
+ </process>
121
+
122
+ <fresh_context_advantage>
123
+ A resumed session has advantages:
124
+
125
+ 1. **No accumulated confusion** — You see the problem clearly
126
+ 2. **Documented failures** — You know what NOT to try
127
+ 3. **Hypothesis preserved** — Pick up where logic left off
128
+ 4. **Full context budget** — 200k tokens of fresh capacity
129
+
130
+ Often the first thing a fresh context sees is the obvious solution that a tired context missed.
131
+ </fresh_context_advantage>
.agent/workflows/sprint.md ADDED
@@ -0,0 +1,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: Create and manage a time-boxed sprint for quick focused work
3
+ argument-hint: "[new|status|close] [sprint-name]"
4
+ ---
5
+
6
+ # /sprint Workflow
7
+
8
+ <objective>
9
+ Manage time-boxed sprints for quick, focused work outside the full milestone/phase cycle.
10
+ Sprints are ideal for bug fixes, small features, or exploratory work that doesn't warrant a full planning cycle.
11
+ </objective>
12
+
13
+ <process>
14
+
15
+ ## 1. Parse Arguments
16
+
17
+ Extract from $ARGUMENTS:
18
+ - **Action**: `new` (default), `status`, or `close`
19
+ - **Sprint name**: identifier for the sprint
20
+
21
+ **If no arguments:** Default to `new` and ask for sprint details.
22
+
23
+ ---
24
+
25
+ ## 2a. Action: New Sprint
26
+
27
+ ### Gather Sprint Information
28
+
29
+ Ask for:
30
+ - **Name** — Sprint identifier (e.g., "bugfix-auth", "spike-caching")
31
+ - **Goal** — One sentence describing the sprint goal
32
+ - **Duration** — Timeframe (e.g., "2 days", "1 week")
33
+ - **Scope** — Tasks included and explicitly excluded
34
+
35
+ ### Create Sprint File
36
+
37
+ Create `.gsd/SPRINT.md` using the template from `.gsd/templates/sprint.md`:
38
+
39
+ ```markdown
40
+ # Sprint {N} — {Sprint Name}
41
+
42
+ > **Duration**: {start-date} to {end-date}
43
+ > **Status**: In Progress
44
+
45
+ ## Goal
46
+ {One sentence goal}
47
+
48
+ ## Scope
49
+
50
+ ### Included
51
+ - {Task 1}
52
+ - {Task 2}
53
+
54
+ ### Explicitly Excluded
55
+ - {Out of scope item}
56
+
57
+ ## Tasks
58
+
59
+ | Task | Assignee | Status | Est. Hours |
60
+ |------|----------|--------|------------|
61
+ | {Task 1} | Claude | ⬜ Todo | — |
62
+ | {Task 2} | Claude | ⬜ Todo | — |
63
+
64
+ ## Daily Log
65
+
66
+ ### {today's date}
67
+ - Sprint created
68
+ ```
69
+
70
+ ### Update STATE.md
71
+
72
+ ```markdown
73
+ ## Current Position
74
+ - **Sprint**: {name}
75
+ - **Status**: Sprint in progress
76
+ - **Milestone**: (paused if active)
77
+ ```
78
+
79
+ ### Commit
80
+
81
+ ```bash
82
+ git add .gsd/SPRINT.md .gsd/STATE.md
83
+ git commit -m "docs: create sprint {name}"
84
+ ```
85
+
86
+ ---
87
+
88
+ ## 2b. Action: Status
89
+
90
+ Read `.gsd/SPRINT.md` and display:
91
+
92
+ ```
93
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
94
+ GSD ► SPRINT STATUS
95
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
96
+
97
+ Sprint: {name}
98
+ Duration: {start} to {end}
99
+ Tasks: {done}/{total} complete
100
+
101
+ {task table}
102
+
103
+ ───────────────────────────────────────────────────────
104
+ ```
105
+
106
+ ---
107
+
108
+ ## 2c. Action: Close
109
+
110
+ ### Verify Sprint Complete
111
+
112
+ Check all tasks are done or explicitly deferred.
113
+
114
+ ### Generate Retrospective
115
+
116
+ Append to `.gsd/SPRINT.md`:
117
+
118
+ ```markdown
119
+ ## Retrospective ({date})
120
+
121
+ ### What Went Well
122
+ - {auto-extract from daily log}
123
+
124
+ ### What Could Improve
125
+ - {identify blockers or friction}
126
+
127
+ ### Action Items
128
+ - [ ] {carry-forward items}
129
+ ```
130
+
131
+ ### Archive Sprint
132
+
133
+ **PowerShell:**
134
+ ```powershell
135
+ New-Item -ItemType Directory -Force ".gsd/sprints"
136
+ Move-Item ".gsd/SPRINT.md" ".gsd/sprints/{name}-SPRINT.md"
137
+ ```
138
+
139
+ **Bash:**
140
+ ```bash
141
+ mkdir -p .gsd/sprints
142
+ mv .gsd/SPRINT.md ".gsd/sprints/{name}-SPRINT.md"
143
+ ```
144
+
145
+ ### Update STATE.md
146
+
147
+ Restore previous milestone position or mark as idle.
148
+
149
+ ### Commit
150
+
151
+ ```bash
152
+ git add .gsd/sprints/ .gsd/STATE.md
153
+ git commit -m "docs: close sprint {name}"
154
+ ```
155
+
156
+ ### Display Result
157
+
158
+ ```
159
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
160
+ GSD ► SPRINT CLOSED ✓
161
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
162
+
163
+ Sprint: {name}
164
+ Tasks completed: {N}/{total}
165
+
166
+ ───────────────────────────────────────────────────────
167
+
168
+ ▶ NEXT
169
+
170
+ /resume — Return to milestone work
171
+ /sprint new — Start another sprint
172
+
173
+ ───────────────────────────────────────────────────────
174
+ ```
175
+
176
+ </process>
177
+
178
+ <related>
179
+ ## Related
180
+
181
+ ### Workflows
182
+ | Command | Relationship |
183
+ |---------|--------------|
184
+ | `/plan` | Full planning cycle (use for milestone work) |
185
+ | `/execute` | Full execution cycle (use for milestone work) |
186
+ | `/pause` | Pause current work for handoff |
187
+
188
+ ### Templates
189
+ | Template | Purpose |
190
+ |----------|---------|
191
+ | `sprint.md` | Sprint document structure |
192
+ </related>
.agent/workflows/update.md ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: Update GSD to the latest version from GitHub
3
+ ---
4
+
5
+ # /update Workflow
6
+
7
+ <objective>
8
+ Update GSD for Antigravity to the latest version from GitHub.
9
+ </objective>
10
+
11
+ <process>
12
+
13
+ ## 1. Check Current Version
14
+
15
+ **PowerShell:**
16
+ ```powershell
17
+ if (Test-Path "CHANGELOG.md") {
18
+ $version = Select-String -Path "CHANGELOG.md" -Pattern "## \[(\d+\.\d+\.\d+)\]" |
19
+ Select-Object -First 1
20
+ Write-Output "Current version: $($version.Matches.Groups[1].Value)"
21
+ }
22
+ ```
23
+
24
+ **Bash:**
25
+ ```bash
26
+ if [ -f "CHANGELOG.md" ]; then
27
+ version=$(grep -oP '## \[\K[0-9]+\.[0-9]+\.[0-9]+' CHANGELOG.md | head -1)
28
+ echo "Current version: $version"
29
+ fi
30
+ ```
31
+
32
+ ---
33
+
34
+ ## 2. Fetch Latest from GitHub
35
+
36
+ ```bash
37
+ # Clone latest to temp directory
38
+ git clone --depth 1 https://github.com/toonight/get-shit-done-for-antigravity.git .gsd-update-temp
39
+ ```
40
+
41
+ ---
42
+
43
+ ## 3. Compare Versions
44
+
45
+ **PowerShell:**
46
+ ```powershell
47
+ $remoteVersion = Select-String -Path ".gsd-update-temp/CHANGELOG.md" -Pattern "## \[(\d+\.\d+\.\d+)\]" |
48
+ Select-Object -First 1
49
+
50
+ Write-Output "Remote version: $($remoteVersion.Matches.Groups[1].Value)"
51
+ ```
52
+
53
+ **Bash:**
54
+ ```bash
55
+ remote_version=$(grep -oP '## \[\K[0-9]+\.[0-9]+\.[0-9]+' .gsd-update-temp/CHANGELOG.md | head -1)
56
+ echo "Remote version: $remote_version"
57
+ ```
58
+
59
+ **If same version:**
60
+ ```
61
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
62
+ GSD ► ALREADY UP TO DATE ✓
63
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
64
+
65
+ Version: {version}
66
+
67
+ No updates available.
68
+
69
+ ───────────────────────────────────────────────────────
70
+ ```
71
+ Exit after cleanup.
72
+
73
+ ---
74
+
75
+ ## 4. Show Changes
76
+
77
+ ```
78
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
79
+ GSD ► UPDATE AVAILABLE
80
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
81
+
82
+ Current: {current-version}
83
+ Latest: {remote-version}
84
+
85
+ Changes:
86
+ {Extract from CHANGELOG.md}
87
+
88
+ ───────────────────────────────────────────────────────
89
+
90
+ Update now?
91
+ A) Yes — Apply updates
92
+ B) No — Cancel
93
+
94
+ ───────────────────────────────────────────────────────
95
+ ```
96
+
97
+ ---
98
+
99
+ ## 5. Apply Updates
100
+
101
+ **If user confirms:**
102
+
103
+ **PowerShell:**
104
+ ```powershell
105
+ # Backup current
106
+ Copy-Item -Recurse ".agent" ".agent.backup"
107
+ Copy-Item -Recurse ".agents" ".agents.backup"
108
+ Copy-Item -Recurse ".gsd/templates" ".gsd/templates.backup"
109
+
110
+ # Update workflows (preserve user's .gsd docs)
111
+ Copy-Item -Recurse -Force ".gsd-update-temp/.agent/*" ".agent/"
112
+
113
+ # Update skills (Agent Skills standard)
114
+ Copy-Item -Recurse -Force ".gsd-update-temp/.agents/*" ".agents/"
115
+
116
+ # Update templates only
117
+ Copy-Item -Recurse -Force ".gsd-update-temp/.gsd/templates/*" ".gsd/templates/"
118
+
119
+ # Update root files
120
+ Copy-Item -Force ".gsd-update-temp/GSD-STYLE.md" "./"
121
+ Copy-Item -Force ".gsd-update-temp/CHANGELOG.md" "./"
122
+ Copy-Item -Force ".gsd-update-temp/PROJECT_RULES.md" "./"
123
+ Copy-Item -Force ".gsd-update-temp/VERSION" "./"
124
+ ```
125
+
126
+ **Bash:**
127
+ ```bash
128
+ # Backup current
129
+ cp -r .agent .agent.backup
130
+ cp -r .agents .agents.backup
131
+ cp -r .gsd/templates .gsd/templates.backup
132
+
133
+ # Update workflows (preserve user's .gsd docs)
134
+ cp -r .gsd-update-temp/.agent/* .agent/
135
+
136
+ # Update skills (Agent Skills standard)
137
+ cp -r .gsd-update-temp/.agents/* .agents/
138
+
139
+ # Update templates only
140
+ cp -r .gsd-update-temp/.gsd/templates/* .gsd/templates/
141
+
142
+ # Update root files
143
+ cp .gsd-update-temp/GSD-STYLE.md ./
144
+ cp .gsd-update-temp/CHANGELOG.md ./
145
+ cp .gsd-update-temp/PROJECT_RULES.md ./
146
+ cp .gsd-update-temp/VERSION ./
147
+ ```
148
+
149
+ ---
150
+
151
+ ## 6. Cleanup
152
+
153
+ **PowerShell:**
154
+ ```powershell
155
+ Remove-Item -Recurse -Force ".gsd-update-temp"
156
+ Remove-Item -Recurse -Force ".agent.backup"
157
+ Remove-Item -Recurse -Force ".agents.backup"
158
+ Remove-Item -Recurse -Force ".gsd/templates.backup"
159
+ ```
160
+
161
+ **Bash:**
162
+ ```bash
163
+ rm -rf .gsd-update-temp
164
+ rm -rf .agent.backup
165
+ rm -rf .agents.backup
166
+ rm -rf .gsd/templates.backup
167
+ ```
168
+
169
+ ---
170
+
171
+ ## 7. Confirm
172
+
173
+ ```
174
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
175
+ GSD ► UPDATED ✓
176
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
177
+
178
+ Updated to version {remote-version}
179
+
180
+ ───────────────────────────────────────────────────────
181
+
182
+ /whats-new — See what changed
183
+
184
+ ───────────────────────────────────────────────────────
185
+ ```
186
+
187
+ </process>
188
+
189
+ <preserved_files>
190
+ These user files are NEVER overwritten:
191
+ - .gsd/SPEC.md
192
+ - .gsd/ROADMAP.md
193
+ - .gsd/STATE.md
194
+ - .gsd/ARCHITECTURE.md
195
+ - .gsd/STACK.md
196
+ - .gsd/DECISIONS.md
197
+ - .gsd/JOURNAL.md
198
+ - .gsd/TODO.md
199
+ - .gsd/phases/*
200
+ - .gemini/GEMINI.md
201
+ </preserved_files>
.agent/workflows/verify.md ADDED
@@ -0,0 +1,263 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: The Auditor — Validate work against spec with empirical evidence
3
+ argument-hint: "<phase-number>"
4
+ ---
5
+
6
+ # /verify Workflow
7
+
8
+ <role>
9
+ You are a GSD verifier. You validate implemented work against spec requirements using empirical evidence.
10
+
11
+ **Core principle:** No "trust me, it works." Every verification produces proof.
12
+
13
+ **Core responsibilities:**
14
+ - Extract testable deliverables from phase
15
+ - Walk through each requirement
16
+ - Collect empirical evidence (commands, screenshots)
17
+ - Create verification report
18
+ - Generate fix plans if issues found
19
+ </role>
20
+
21
+ <objective>
22
+ Confirm that implemented work meets spec requirements with documented proof.
23
+
24
+ The verifier checks the CODEBASE, not SUMMARY claims.
25
+ </objective>
26
+
27
+ <context>
28
+ **Phase:** $ARGUMENTS (required — phase number to verify)
29
+
30
+ **Required files:**
31
+ - `.gsd/SPEC.md` — Original requirements
32
+ - `.gsd/ROADMAP.md` — Phase definition with must-haves
33
+ - `.gsd/phases/{phase}/*-SUMMARY.md` — What was implemented
34
+ </context>
35
+
36
+ <process>
37
+
38
+ ## 1. Load Verification Context
39
+
40
+ Read:
41
+ - Phase definition from `.gsd/ROADMAP.md`
42
+ - Original requirements from `.gsd/SPEC.md`
43
+ - All SUMMARY.md files from `.gsd/phases/{phase}/`
44
+
45
+ ---
46
+
47
+ ## 2. Extract Must-Haves
48
+
49
+ From the phase definition, identify **must-haves** — requirements that MUST be true for the phase to be complete.
50
+
51
+ ```markdown
52
+ ### Must-Haves for Phase {N}
53
+ 1. {Requirement 1} — How to verify
54
+ 2. {Requirement 2} — How to verify
55
+ 3. {Requirement 3} — How to verify
56
+ ```
57
+
58
+ ---
59
+
60
+ ## 3. Verify Each Must-Have
61
+
62
+ For each must-have:
63
+
64
+ ### 3a. Determine Verification Method
65
+
66
+ | Type | Method | Evidence |
67
+ |------|--------|----------|
68
+ | API/Backend | Run curl or test command | Command output |
69
+ | UI | Use browser tool | Screenshot |
70
+ | Build | Run build command | Success output |
71
+ | Tests | Run test suite | Test results |
72
+ | File exists | Check filesystem | File listing |
73
+ | Code behavior | Run specific scenario | Output |
74
+
75
+ ### 3b. Execute Verification
76
+
77
+ Run the verification command/action.
78
+
79
+ // turbo
80
+ ```bash
81
+ # Example: Run tests
82
+ npm test
83
+ ```
84
+
85
+ ### 3c. Record Evidence
86
+
87
+ For each must-have, record:
88
+ - **Status:** PASS / FAIL
89
+ - **Evidence:** Command output, screenshot path, etc.
90
+ - **Notes:** Any observations
91
+
92
+ ---
93
+
94
+ ## 4. Create Verification Report
95
+
96
+ Write `.gsd/phases/{phase}/VERIFICATION.md`:
97
+
98
+ ```markdown
99
+ ---
100
+ phase: {N}
101
+ verified_at: {timestamp}
102
+ verdict: PASS | FAIL | PARTIAL
103
+ ---
104
+
105
+ # Phase {N} Verification Report
106
+
107
+ ## Summary
108
+ {X}/{Y} must-haves verified
109
+
110
+ ## Must-Haves
111
+
112
+ ### ✅ {Must-have 1}
113
+ **Status:** PASS
114
+ **Evidence:**
115
+ ```
116
+ {command output or description}
117
+ ```
118
+
119
+ ### ❌ {Must-have 2}
120
+ **Status:** FAIL
121
+ **Reason:** {why it failed}
122
+ **Expected:** {what should happen}
123
+ **Actual:** {what happened}
124
+
125
+ ## Verdict
126
+ {PASS | FAIL | PARTIAL}
127
+
128
+ ## Gap Closure Required
129
+ {If FAIL, list what needs to be fixed}
130
+ ```
131
+
132
+ ---
133
+
134
+ ## 5. Handle Results
135
+
136
+ ### If PASS (all must-haves verified):
137
+
138
+ Update `.gsd/STATE.md`:
139
+ ```markdown
140
+ ## Current Position
141
+ - **Phase**: {N} (verified)
142
+ - **Status**: ✅ Complete and verified
143
+ ```
144
+
145
+ Output:
146
+ ```
147
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
148
+ GSD ► PHASE {N} VERIFIED ✓
149
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
150
+
151
+ {X}/{X} must-haves verified
152
+
153
+ All requirements satisfied.
154
+
155
+ ───────────────────────────────────────────────────────
156
+
157
+ ▶ Next Up
158
+
159
+ /execute {N+1} — proceed to next phase
160
+
161
+ ───────────────────────────────────────────────────────
162
+ ```
163
+
164
+ ### If FAIL (some must-haves failed):
165
+
166
+ **Create gap closure plans:**
167
+
168
+ For each failed must-have, create a fix plan in `.gsd/phases/{phase}/`:
169
+
170
+ ```markdown
171
+ ---
172
+ phase: {N}
173
+ plan: fix-{issue}
174
+ wave: 1
175
+ gap_closure: true
176
+ ---
177
+
178
+ # Fix Plan: {Issue Name}
179
+
180
+ ## Problem
181
+ {What failed and why}
182
+
183
+ ## Tasks
184
+
185
+ <task type="auto">
186
+ <name>Fix {issue}</name>
187
+ <files>{files to modify}</files>
188
+ <action>{specific fix instructions}</action>
189
+ <verify>{how to verify the fix}</verify>
190
+ <done>{acceptance criteria}</done>
191
+ </task>
192
+ ```
193
+
194
+ Output:
195
+ ```
196
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
197
+ GSD ► PHASE {N} GAPS FOUND ⚠
198
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
199
+
200
+ {X}/{Y} must-haves verified
201
+ {Z} issues require fixes
202
+
203
+ Gap closure plans created.
204
+
205
+ ───────────────────────────────────────────────────────
206
+
207
+ ▶ Next Up
208
+
209
+ /execute {N} --gaps-only — run fix plans
210
+
211
+ ───────────────────────────────────────────────────────
212
+ ```
213
+
214
+ ---
215
+
216
+ ## 6. Commit Verification
217
+
218
+ ```bash
219
+ git add .gsd/phases/{phase}/VERIFICATION.md
220
+ git commit -m "docs(phase-{N}): verification report"
221
+ ```
222
+
223
+ </process>
224
+
225
+ <evidence_requirements>
226
+
227
+ ## Forbidden Phrases
228
+
229
+ Never accept these as verification:
230
+ - "This should work"
231
+ - "The code looks correct"
232
+ - "I've made similar changes before"
233
+ - "Based on my understanding"
234
+ - "It follows the pattern"
235
+
236
+ ## Required Evidence
237
+
238
+ | Claim | Required Proof |
239
+ |-------|----------------|
240
+ | "Tests pass" | Actual test output |
241
+ | "API works" | Curl command + response |
242
+ | "UI renders" | Screenshot |
243
+ | "Build succeeds" | Build output |
244
+ | "File created" | `ls` or `dir` output |
245
+
246
+ </evidence_requirements>
247
+
248
+ <related>
249
+ ## Related
250
+
251
+ ### Workflows
252
+ | Command | Relationship |
253
+ |---------|--------------|
254
+ | `/execute` | Run before /verify to implement work |
255
+ | `/execute --gaps-only` | Fix issues found by /verify |
256
+ | `/debug` | Diagnose verification failures |
257
+
258
+ ### Skills
259
+ | Skill | Purpose |
260
+ |-------|---------|
261
+ | `verifier` | Detailed verification methodology |
262
+ | `empirical-validation` | Evidence requirements |
263
+ </related>
.agent/workflows/web-search.md ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: Search the web for information to inform decisions
3
+ argument-hint: "<query> [--domain <site>]"
4
+ ---
5
+
6
+ # /web-search Workflow
7
+
8
+ <objective>
9
+ Search the web to gather information for technical decisions, API documentation, library comparisons, or any research need.
10
+ </objective>
11
+
12
+ <when_to_use>
13
+ - Evaluating libraries or frameworks
14
+ - Finding API documentation
15
+ - Checking current best practices
16
+ - Researching error messages
17
+ - Comparing implementation approaches
18
+ - Getting up-to-date information on tools/services
19
+ </when_to_use>
20
+
21
+ <process>
22
+
23
+ ## 1. Formulate Query
24
+
25
+ Parse the user's request into a focused search query.
26
+
27
+ **Good queries:**
28
+ - Specific: "Next.js 14 app router authentication best practices"
29
+ - Targeted: "Prisma vs Drizzle ORM comparison 2024"
30
+ - Actionable: "how to fix CORS error Express.js"
31
+
32
+ **Bad queries:**
33
+ - Too broad: "how to code"
34
+ - Too vague: "best database"
35
+
36
+ ---
37
+
38
+ ## 2. Execute Search
39
+
40
+ Use the `search_web` tool with:
41
+ - Query: The formulated search query
42
+ - Domain (optional): Prioritize specific site (e.g., `docs.python.org`)
43
+
44
+ ---
45
+
46
+ ## 3. Analyze Results
47
+
48
+ From the search results:
49
+ 1. **Extract key information** relevant to the user's need
50
+ 2. **Note sources** for citations
51
+ 3. **Identify patterns** across multiple results
52
+ 4. **Flag contradictions** or outdated information
53
+
54
+ ---
55
+
56
+ ## 4. Summarize Findings
57
+
58
+ Present findings clearly:
59
+
60
+ ```
61
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
62
+ GSD ► WEB SEARCH RESULTS
63
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
64
+
65
+ Query: {query}
66
+
67
+ ───────────────────────────────────────────────────────
68
+
69
+ KEY FINDINGS
70
+ ────────────
71
+ • {finding 1}
72
+ • {finding 2}
73
+ • {finding 3}
74
+
75
+ RECOMMENDATION
76
+ ──────────────
77
+ {actionable recommendation based on findings}
78
+
79
+ SOURCES
80
+ ───────
81
+ • {source 1}
82
+ • {source 2}
83
+
84
+ ───────────────────────────────────────────────────────
85
+ ```
86
+
87
+ ---
88
+
89
+ ## 5. Offer Next Steps
90
+
91
+ Based on findings:
92
+ - Suggest follow-up searches if needed
93
+ - Recommend adding to RESEARCH.md for project context
94
+ - Offer to implement based on findings
95
+
96
+ </process>
97
+
98
+ <integration>
99
+ ## Integration with GSD
100
+
101
+ **During /research-phase:**
102
+ Use `/web-search` to gather information for RESEARCH.md.
103
+
104
+ **During /plan:**
105
+ Use `/web-search` when discovery level 1-3 indicates research needed.
106
+
107
+ **During /debug:**
108
+ Use `/web-search` to find solutions to error messages.
109
+ </integration>
110
+
111
+ <related>
112
+ ## Related
113
+
114
+ ### Workflows
115
+ | Command | Relationship |
116
+ |---------|--------------|
117
+ | `/research-phase` | Uses web-search for phase research |
118
+ | `/plan` | May trigger web-search for discovery |
119
+ | `/debug` | Search for error solutions |
120
+
121
+ </related>
.agent/workflows/whats-new.md ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: Show recent GSD changes and new features
3
+ ---
4
+
5
+ # /whats-new Workflow
6
+
7
+ <objective>
8
+ Display recent changes, new features, and improvements to GSD for Antigravity.
9
+ </objective>
10
+
11
+ <process>
12
+
13
+ ## 1. Read CHANGELOG.md
14
+
15
+ ```bash
16
+ # Read the latest version section from CHANGELOG.md
17
+ head -50 CHANGELOG.md
18
+ ```
19
+
20
+ ## 2. Display Recent Changes
21
+
22
+ Display the latest version(s) from CHANGELOG.md:
23
+
24
+ ```
25
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
26
+ GSD ► WHAT'S NEW
27
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
28
+
29
+ VERSION 1.2.0 — 2026-01-17
30
+ ══════════════════════════
31
+
32
+ 🌍 CROSS-PLATFORM SUPPORT
33
+
34
+ • All 16 workflow files now have Bash equivalents
35
+ • README with dual-syntax Getting Started
36
+ • /web-search workflow for research
37
+
38
+ ───────────────────────────────────────────────────────
39
+
40
+ VERSION 1.1.0 — 2026-01-17
41
+ ══════════════════════════
42
+
43
+ 📚 TEMPLATE PARITY & EXAMPLES
44
+
45
+ • 14 new templates (DEBUG.md, UAT.md, etc.)
46
+ • Examples directory with walkthroughs
47
+ • /add-todo and /check-todos workflows
48
+ • Cross-references between workflows
49
+
50
+ ───────────────────────────────────────────────────────
51
+
52
+ VERSION 1.0.0 — 2026-01-17
53
+ ══════════════════════════
54
+
55
+ 🎉 INITIAL RELEASE
56
+
57
+ Full port of GSD methodology to Google Antigravity.
58
+ • 24 workflows, 8 skills, 14 templates
59
+ • 4 core rules: Planning Lock, State Persistence,
60
+ Context Hygiene, Empirical Validation
61
+
62
+ ───────────────────────────────────────────────────────
63
+
64
+ 📚 Full changelog: CHANGELOG.md
65
+
66
+ ───────────────────────────────────────────────────────
67
+ ```
68
+
69
+ </process>
70
+
71
+ <related>
72
+ ## Related
73
+
74
+ ### Workflows
75
+ | Command | Relationship |
76
+ |---------|--------------|
77
+ | `/update` | Update GSD to latest version |
78
+ | `/help` | List all commands |
79
+
80
+ </related>
.agents/skills/codebase-mapper/SKILL.md ADDED
@@ -0,0 +1,226 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: codebase-mapper
3
+ description: Analyzes existing codebases to understand structure, patterns, and technical debt
4
+ ---
5
+
6
+ # GSD Codebase Mapper Agent
7
+
8
+ <role>
9
+ You are a GSD codebase mapper. You analyze existing codebases to produce documentation that enables informed planning.
10
+
11
+ **Core responsibilities:**
12
+ - Scan and understand project structure
13
+ - Identify patterns and conventions
14
+ - Map dependencies and integrations
15
+ - Surface technical debt
16
+ - Produce ARCHITECTURE.md and STACK.md
17
+ </role>
18
+
19
+ ## Analysis Domains
20
+
21
+ ### 1. Structure Analysis
22
+ Understand how the project is organized:
23
+ - Source directories and their purposes
24
+ - Entry points (main files, index files)
25
+ - Test locations and patterns
26
+ - Configuration locations
27
+ - Asset directories
28
+
29
+ ### 2. Dependency Analysis
30
+ Map what the project depends on:
31
+ - Runtime dependencies (production)
32
+ - Development dependencies
33
+ - Peer dependencies
34
+ - Outdated packages
35
+ - Security vulnerabilities
36
+
37
+ ### 3. Pattern Analysis
38
+ Identify how code is written:
39
+ - Naming conventions
40
+ - File organization patterns
41
+ - Error handling approaches
42
+ - State management patterns
43
+ - API patterns
44
+
45
+ ### 4. Integration Analysis
46
+ Map external connections:
47
+ - APIs consumed
48
+ - Databases used
49
+ - Third-party services
50
+ - Environment dependencies
51
+
52
+ ### 5. Technical Debt Analysis
53
+ Surface issues to address:
54
+ - TODOs and FIXMEs
55
+ - Deprecated code
56
+ - Missing tests
57
+ - Inconsistent patterns
58
+ - Known vulnerabilities
59
+
60
+ ---
61
+
62
+ ## Scanning Process
63
+
64
+ ### Phase 1: Project Type Detection
65
+
66
+ Identify project type from markers:
67
+ ```powershell
68
+ # Node.js/JavaScript
69
+ Test-Path "package.json"
70
+
71
+ # Python
72
+ Test-Path "requirements.txt" -or Test-Path "pyproject.toml"
73
+
74
+ # Rust
75
+ Test-Path "Cargo.toml"
76
+
77
+ # Go
78
+ Test-Path "go.mod"
79
+
80
+ # .NET
81
+ Get-ChildItem "*.csproj"
82
+ ```
83
+
84
+ ### Phase 2: Structure Scan
85
+
86
+ ```powershell
87
+ # Get directory structure
88
+ Get-ChildItem -Recurse -Directory |
89
+ Where-Object { $_.Name -notmatch "node_modules|\.git|__pycache__|dist|build|\.next" } |
90
+ Select-Object FullName
91
+ ```
92
+
93
+ ### Phase 3: Dependency Extraction
94
+
95
+ For each ecosystem:
96
+
97
+ **Node.js:**
98
+ ```powershell
99
+ $pkg = Get-Content "package.json" | ConvertFrom-Json
100
+ $pkg.dependencies
101
+ $pkg.devDependencies
102
+ ```
103
+
104
+ **Python:**
105
+ ```powershell
106
+ Get-Content "requirements.txt"
107
+ ```
108
+
109
+ ### Phase 4: Pattern Discovery
110
+
111
+ Search for common patterns:
112
+ ```powershell
113
+ # Components
114
+ Get-ChildItem -Recurse -Include "*.tsx","*.jsx" | Select-Object Name
115
+
116
+ # API routes
117
+ Get-ChildItem -Recurse -Path "**/api/**" -Include "*.ts","*.js"
118
+
119
+ # Models/schemas
120
+ Select-String -Path "**/*.ts" -Pattern "interface|type|schema"
121
+ ```
122
+
123
+ ### Phase 5: Debt Discovery
124
+
125
+ ```powershell
126
+ # TODOs
127
+ Select-String -Path "src/**/*" -Pattern "TODO|FIXME|HACK|XXX"
128
+
129
+ # Deprecated
130
+ Select-String -Path "**/*" -Pattern "@deprecated|DEPRECATED"
131
+
132
+ # Console statements (often debug leftovers)
133
+ Select-String -Path "src/**/*" -Pattern "console\.(log|debug|warn)"
134
+ ```
135
+
136
+ ---
137
+
138
+ ## Output Format
139
+
140
+ ### ARCHITECTURE.md
141
+
142
+ ```markdown
143
+ # Architecture
144
+
145
+ > Generated by /map on {date}
146
+
147
+ ## Overview
148
+ {High-level system description}
149
+
150
+ ## System Diagram
151
+ ```
152
+ {ASCII or description of component relationships}
153
+ ```
154
+
155
+ ## Components
156
+
157
+ ### {Component Name}
158
+ - **Purpose:** {what it does}
159
+ - **Location:** `{path}`
160
+ - **Dependencies:** {what it imports}
161
+ - **Dependents:** {what imports it}
162
+
163
+ ## Data Flow
164
+ {How data moves through the system}
165
+
166
+ ## Integration Points
167
+ | External Service | Type | Purpose |
168
+ |------------------|------|---------|
169
+ | {service} | {API/DB/etc} | {purpose} |
170
+
171
+ ## Conventions
172
+ - **Naming:** {patterns}
173
+ - **Structure:** {organization}
174
+ - **Testing:** {approach}
175
+
176
+ ## Technical Debt
177
+ - [ ] {Debt item with location}
178
+ ```
179
+
180
+ ### STACK.md
181
+
182
+ ```markdown
183
+ # Technology Stack
184
+
185
+ > Generated by /map on {date}
186
+
187
+ ## Runtime
188
+ | Technology | Version | Purpose |
189
+ |------------|---------|---------|
190
+ | {tech} | {version} | {purpose} |
191
+
192
+ ## Production Dependencies
193
+ | Package | Version | Purpose |
194
+ |---------|---------|---------|
195
+ | {pkg} | {version} | {purpose} |
196
+
197
+ ## Development Dependencies
198
+ | Package | Version | Purpose |
199
+ |---------|---------|---------|
200
+ | {pkg} | {version} | {purpose} |
201
+
202
+ ## Infrastructure
203
+ | Service | Provider | Purpose |
204
+ |---------|----------|---------|
205
+ | {svc} | {provider} | {purpose} |
206
+
207
+ ## Configuration
208
+ | Variable | Purpose | Required |
209
+ |----------|---------|----------|
210
+ | {var} | {purpose} | {yes/no} |
211
+ ```
212
+
213
+ ---
214
+
215
+ ## Checklist
216
+
217
+ Before Completing Map:
218
+ - [ ] Project type identified
219
+ - [ ] All source directories documented
220
+ - [ ] Entry points found
221
+ - [ ] Dependencies extracted and categorized
222
+ - [ ] Key patterns identified
223
+ - [ ] Integrations mapped
224
+ - [ ] Technical debt surfaced
225
+ - [ ] ARCHITECTURE.md created
226
+ - [ ] STACK.md created
.agents/skills/context-compressor/SKILL.md ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: context-compressor
3
+ description: Strategies for compressing context to maximize token efficiency
4
+ ---
5
+
6
+ # Context Compressor Skill
7
+
8
+ <role>
9
+ You are a context compression specialist. Your job is to maintain rich understanding while using minimal tokens.
10
+
11
+ **Core principle:** Compress aggressively, decompress only when needed.
12
+ </role>
13
+
14
+ ---
15
+
16
+ ## Compression Strategies
17
+
18
+ ### Strategy 1: Summary Mode
19
+
20
+ **When:** You've fully understood a file and may need to reference it later.
21
+
22
+ **How:**
23
+ ```markdown
24
+ ## File Summary: src/auth/login.ts
25
+
26
+ **Purpose:** Handles user login via email/password
27
+ **Key functions:**
28
+ - handleLogin(req, res) → Validates credentials, returns JWT
29
+ - validateCredentials(email, password) → Checks against DB
30
+ **Dependencies:** bcrypt, jose, database
31
+ **Tokens saved:** ~400 (95 lines not reloaded)
32
+ ```
33
+
34
+ **Use instead of:** Re-reading the full file
35
+
36
+ ---
37
+
38
+ ### Strategy 2: Outline Mode
39
+
40
+ **When:** You need to understand a file's structure but not implementation details.
41
+
42
+ **How:**
43
+ ```markdown
44
+ ## Outline: src/services/payment.ts (127 lines)
45
+
46
+ - L1-15: Imports and types
47
+ - L17-35: PaymentService class
48
+ - L20: constructor(config)
49
+ - L25: processPayment(amount, method)
50
+ - L45: refund(transactionId)
51
+ - L67: getHistory(userId)
52
+ - L90-127: Helper functions
53
+ ```
54
+
55
+ **Tokens:** ~50 vs ~500 for full file
56
+
57
+ ---
58
+
59
+ ### Strategy 3: Diff-Only Mode
60
+
61
+ **When:** You've already seen a file and need to understand changes.
62
+
63
+ **How:**
64
+ ```markdown
65
+ ## Changes to: src/config.ts
66
+
67
+ Added:
68
+ - L45: TOKEN_BUDGET_THRESHOLD = 0.5
69
+ - L46: COMPRESSION_ENABLED = true
70
+
71
+ Modified:
72
+ - L12: MAX_CONTEXT → increased from 100000 to 150000
73
+ ```
74
+
75
+ **Use for:** Reviewing modifications, understanding updates
76
+
77
+ ---
78
+
79
+ ### Strategy 4: Reference Mode
80
+
81
+ **When:** You need to track a file without loading it.
82
+
83
+ **How:**
84
+ ```markdown
85
+ ## References
86
+
87
+ | File | Last Seen | Summary | Load If |
88
+ |------|-----------|---------|---------|
89
+ | auth.ts | Task 2 | Login handling | Auth bugs |
90
+ | db.ts | Task 1 | Postgres client | DB errors |
91
+ | utils.ts | Never | Utility funcs | Helper needed |
92
+ ```
93
+
94
+ **Cost:** ~10 tokens vs ~200+ per file
95
+
96
+ ---
97
+
98
+ ### Strategy 5: Progressive Disclosure
99
+
100
+ **When:** Unsure how much detail is needed.
101
+
102
+ **Process:**
103
+ 1. Start with outline (Level 1)
104
+ 2. If insufficient, load key functions (Level 2)
105
+ 3. If still stuck, load related code (Level 3)
106
+ 4. Full file only as last resort (Level 4)
107
+
108
+ ```
109
+ L1: Outline → "I see handleLogin at L25"
110
+ L2: Function → "handleLogin validates then calls createToken"
111
+ L3: Related → "createToken uses jose.sign with HS256"
112
+ L4: Full → Only for complex debugging
113
+ ```
114
+
115
+ ---
116
+
117
+ ## Compression Triggers
118
+
119
+ ### Automatic Compression Points
120
+
121
+ | Trigger | Action |
122
+ |---------|--------|
123
+ | After understanding a file | Create summary |
124
+ | Switching tasks | Compress previous context |
125
+ | Budget at 50% | Aggressive outline mode |
126
+ | Budget at 70% | Summary-only mode |
127
+ | End of wave | Full compression pass |
128
+
129
+ ---
130
+
131
+ ## Decompression Protocol
132
+
133
+ When you need details from compressed context:
134
+
135
+ 1. **Check summary first** — Often sufficient
136
+ 2. **Load specific section** — If summary incomplete
137
+ 3. **Full load as last resort** — And re-compress after
138
+
139
+ ```markdown
140
+ ## Decompression Log
141
+
142
+ | File | Reason | Level | Tokens |
143
+ |------|--------|-------|--------|
144
+ | auth.ts | Debug login | L2 (func) | +150 |
145
+ | db.ts | Check query | L3 (snippet) | +50 |
146
+ ```
147
+
148
+ ---
149
+
150
+ ## Compression Format Templates
151
+
152
+ ### Summary Template
153
+
154
+ ```markdown
155
+ ## 📦 [filename]
156
+ **Purpose:** [one line]
157
+ **Key exports:** [list]
158
+ **Dependencies:** [list]
159
+ **Patterns:** [notable patterns used]
160
+ **Watch for:** [gotchas or edge cases]
161
+ ```
162
+
163
+ ### Outline Template
164
+
165
+ ```markdown
166
+ ## 📋 [filename] (N lines)
167
+ - L[start]-[end]: [section name]
168
+ - L[n]: [key item]
169
+ - L[n]: [key item]
170
+ ```
171
+
172
+ ### Diff Template
173
+
174
+ ```markdown
175
+ ## Δ [filename]
176
+ **+** [additions]
177
+ **-** [removals]
178
+ **~** [modifications]
179
+ ```
180
+
181
+ ---
182
+
183
+ ## Integration
184
+
185
+ Works with:
186
+ - `token-budget` — Triggers compression at thresholds
187
+ - `context-fetch` — Provides input for compression
188
+ - `context-health-monitor` — Monitors compression effectiveness
189
+
190
+ ---
191
+
192
+ ## Anti-Patterns
193
+
194
+ ❌ **Keeping full files in mental context** — Compress after understanding
195
+ ❌ **Re-reading instead of referencing** — Use summaries
196
+ ❌ **Loading full file for one function** — Use outline + target
197
+ ❌ **Skipping compression "to save time"** — Costs more later
198
+
199
+ ---
200
+
201
+ *Part of GSD v1.6 Token Optimization. See docs/token-optimization-guide.md for examples.*
.agents/skills/context-fetch/SKILL.md ADDED
@@ -0,0 +1,184 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: context-fetch
3
+ description: Search-first skill to reduce unnecessary file reads by searching before loading
4
+ ---
5
+
6
+ # Context Fetch Skill
7
+
8
+ <role>
9
+ You are a context-efficient agent. Your job is to find relevant code with minimal file reads.
10
+
11
+ **Core principle:** Search first, read targeted sections, never load full files blindly.
12
+ </role>
13
+
14
+ ---
15
+
16
+ ## When to Use
17
+
18
+ Activate this skill **before**:
19
+ - Starting any coding task
20
+ - Beginning a refactor
21
+ - Investigating a bug
22
+ - Understanding unfamiliar code
23
+
24
+ ---
25
+
26
+ ## Process
27
+
28
+ ### Step 1: Define the Question
29
+
30
+ What are you trying to find or understand?
31
+
32
+ Examples:
33
+ - "Where is the login endpoint defined?"
34
+ - "How does the caching layer work?"
35
+ - "What calls the `processPayment` function?"
36
+
37
+ ### Step 2: Identify Keywords
38
+
39
+ Extract searchable terms:
40
+
41
+ | Question | Keywords |
42
+ |----------|----------|
43
+ | Login endpoint | `login`, `auth`, `POST.*login` |
44
+ | Caching layer | `cache`, `redis`, `memoize` |
45
+ | Payment calls | `processPayment`, `payment` |
46
+
47
+ ### Step 3: Search Before Reading
48
+
49
+ **PowerShell:**
50
+ ```powershell
51
+ # Simple pattern search
52
+ Select-String -Path "src/**/*.ts" -Pattern "login" -Recurse
53
+
54
+ # With ripgrep (if available)
55
+ rg "login" --type ts
56
+ ```
57
+
58
+ **Bash:**
59
+ ```bash
60
+ # With ripgrep (recommended)
61
+ rg "login" --type ts
62
+
63
+ # With grep
64
+ grep -r "login" src/ --include="*.ts"
65
+ ```
66
+
67
+ ### Step 4: Evaluate Results
68
+
69
+ From search results, identify:
70
+
71
+ 1. **Primary candidates** — Files directly matching your question
72
+ 2. **Secondary candidates** — Files that reference primary candidates
73
+ 3. **Ignore list** — Files with keyword but unrelated context
74
+
75
+ ### Step 5: Targeted Reading
76
+
77
+ Only read what's justified:
78
+
79
+ ```powershell
80
+ # Read specific line range (PowerShell)
81
+ Get-Content "src/auth/login.ts" | Select-Object -Skip 49 -First 30
82
+
83
+ # Read specific function (with view_code_item tool)
84
+ # view_code_item: src/auth/login.ts -> handleLogin
85
+ ```
86
+
87
+ ---
88
+
89
+ ## Inputs
90
+
91
+ When invoking this skill, provide:
92
+
93
+ | Input | Description | Example |
94
+ |-------|-------------|---------|
95
+ | **Question** | What you're trying to find | "Where is user validation?" |
96
+ | **Scope** | Directory or file pattern | `src/`, `*.service.ts` |
97
+ | **Keywords** | Terms to search for | `validate`, `user`, `schema` |
98
+
99
+ ---
100
+
101
+ ## Outputs
102
+
103
+ After executing this skill, report:
104
+
105
+ 1. **Candidate files** — Ranked by relevance
106
+ 2. **Relevant extracts** — Key snippets found
107
+ 3. **Next reads** — Specific files/line-ranges to read next
108
+ 4. **Skip list** — Files searched but not relevant
109
+
110
+ ---
111
+
112
+ ## Anti-Patterns
113
+
114
+ ### ❌ Loading Everything First
115
+
116
+ ```
117
+ # BAD: Reading 5 full files to "understand context"
118
+ Read: src/auth/login.ts (500 lines)
119
+ Read: src/auth/register.ts (400 lines)
120
+ Read: src/auth/types.ts (200 lines)
121
+ ```
122
+
123
+ ### ✅ Search Then Target
124
+
125
+ ```
126
+ # GOOD: Search first, read only what's needed
127
+ Search: "validatePassword" in src/auth/
128
+ Found: login.ts:45, register.ts:78
129
+ Read: login.ts lines 40-60
130
+ ```
131
+
132
+ ### ❌ Broad Searches
133
+
134
+ ```
135
+ # BAD: Searching for common terms
136
+ Search: "function" → 10,000 results
137
+ ```
138
+
139
+ ### ✅ Specific Searches
140
+
141
+ ```
142
+ # GOOD: Searching for specific identifiers
143
+ Search: "validateUserCredentials" → 3 results
144
+ ```
145
+
146
+ ---
147
+
148
+ ## Context Efficiency Metrics
149
+
150
+ Track your efficiency:
151
+
152
+ | Metric | Good | Poor |
153
+ |--------|------|------|
154
+ | Files searched | 10+ | <5 |
155
+ | Files fully read | <3 | 10+ |
156
+ | Lines read | <200 | 1000+ |
157
+ | Targeted sections | Yes | No |
158
+
159
+ ---
160
+
161
+ ## Integration with GSD
162
+
163
+ This skill supports GSD's context management:
164
+
165
+ - **Prevents context pollution** — Less irrelevant code loaded
166
+ - **Supports wave execution** — Each wave starts with minimal context
167
+ - **Enables model switching** — Less context = easier handoff
168
+
169
+ ---
170
+
171
+ ## Quick Reference
172
+
173
+ ```
174
+ 1. Define question → What am I looking for?
175
+ 2. Extract keywords → What terms to search?
176
+ 3. Search codebase → rg/grep/Select-String
177
+ 4. Evaluate results → Which files matter?
178
+ 5. Read targeted → Specific lines only
179
+ 6. Report findings → Candidates + extracts
180
+ ```
181
+
182
+ ---
183
+
184
+ *Part of GSD methodology. See PROJECT_RULES.md for search-first discipline rules.*
.agents/skills/context-health-monitor/SKILL.md ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: context-health-monitor
3
+ description: Monitors context complexity and triggers state dumps before quality degrades
4
+ ---
5
+
6
+ # Context Health Monitor
7
+
8
+ ## Purpose
9
+
10
+ Prevent "Context Rot" — the quality degradation that occurs as the agent processes more information in a single session.
11
+
12
+ ## When This Skill Activates
13
+
14
+ The agent should self-monitor for these warning signs:
15
+
16
+ ### Warning Signs
17
+
18
+ | Signal | Threshold | Action |
19
+ |--------|-----------|--------|
20
+ | Repeated debugging | 3+ failed attempts | Trigger state dump |
21
+ | Going in circles | Same approach tried twice | Stop and reassess |
22
+ | Confusion indicators | "I'm not sure", backtracking | Document uncertainty |
23
+ | Session length | Extended back-and-forth | Recommend `/pause` |
24
+
25
+ ## Behavior Rules
26
+
27
+ ### Rule 1: The 3-Strike Rule
28
+
29
+ If debugging the same issue fails 3 times:
30
+
31
+ 1. **STOP** attempting fixes
32
+ 2. **Document** in `.gsd/STATE.md`:
33
+ - What was tried
34
+ - What errors occurred
35
+ - Current hypothesis
36
+ 3. **Recommend** user start fresh session
37
+ 4. **Do NOT** continue with more attempts
38
+
39
+ ### Rule 2: Circular Detection
40
+
41
+ If the same approach is being tried again:
42
+
43
+ 1. **Acknowledge** the repetition
44
+ 2. **List** what has already been tried
45
+ 3. **Propose** a fundamentally different approach
46
+ 4. **Or** recommend `/pause` for fresh perspective
47
+
48
+ ### Rule 3: Uncertainty Logging
49
+
50
+ When uncertain about an approach:
51
+
52
+ 1. **State** the uncertainty clearly
53
+ 2. **Document** in `.gsd/DECISIONS.md`:
54
+ - The uncertain decision
55
+ - Why it's uncertain
56
+ - Alternatives considered
57
+ 3. **Ask** user for guidance rather than guessing
58
+
59
+ ## State Dump Format
60
+
61
+ When triggered, write to `.gsd/STATE.md`:
62
+
63
+ ```markdown
64
+ ## Context Health: State Dump
65
+
66
+ **Triggered**: [date/time]
67
+ **Reason**: [3 failures / circular / uncertainty]
68
+
69
+ ### What Was Attempted
70
+ 1. [Approach 1] — Result: [outcome]
71
+ 2. [Approach 2] — Result: [outcome]
72
+ 3. [Approach 3] — Result: [outcome]
73
+
74
+ ### Current Hypothesis
75
+ [Best guess at root cause]
76
+
77
+ ### Recommended Next Steps
78
+ 1. [Fresh perspective action]
79
+ 2. [Alternative approach to try]
80
+
81
+ ### Files Involved
82
+ - [file1.ext] — [what state it's in]
83
+ - [file2.ext] — [what state it's in]
84
+ ```
85
+
86
+ ## Auto-Save Protocol
87
+
88
+ **Critical:** When any warning signal triggers, the agent must save state BEFORE recommending `/pause` to the user. This ensures state persists even if the session hard-terminates.
89
+
90
+ ### Steps
91
+
92
+ 1. **Write** a state snapshot to `.gsd/STATE.md` immediately when a threshold is hit
93
+ 2. **Include** at minimum: current phase, current task, last action, next step
94
+ 3. **Then** inform the user of the situation and recommend `/pause`
95
+
96
+ ### Why
97
+
98
+ Sessions can terminate abruptly (usage limits, context limits, network errors). If the agent waits for the user to type `/pause`, it may never get the chance. By saving first and recommending second, state is always preserved.
99
+
100
+ ## Integration
101
+
102
+ This skill integrates with:
103
+ - `/pause` — Triggers proper session handoff (includes proactive auto-save)
104
+ - `/resume` — Loads the state dump context
105
+ - Rule 3 in `GEMINI.md` — Context Hygiene enforcement
.agents/skills/debugger/SKILL.md ADDED
@@ -0,0 +1,273 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: debugger
3
+ description: Systematic debugging with persistent state and fresh context advantages
4
+ ---
5
+
6
+ # GSD Debugger Agent
7
+
8
+ <role>
9
+ You are a GSD debugger. You systematically diagnose bugs using hypothesis testing, evidence gathering, and persistent state tracking.
10
+
11
+ Your job: Find the root cause, not just make symptoms disappear.
12
+ </role>
13
+
14
+ ---
15
+
16
+ ## Core Philosophy
17
+
18
+ ### User = Reporter, AI = Investigator
19
+
20
+ **User knows:**
21
+ - What they expected to happen
22
+ - What actually happened
23
+ - Error messages they saw
24
+ - When it started / if it ever worked
25
+
26
+ **User does NOT know (don't ask):**
27
+ - What's causing the bug
28
+ - Which file has the problem
29
+ - What the fix should be
30
+
31
+ Ask about experience. Investigate the cause yourself.
32
+
33
+ ### Meta-Debugging: Your Own Code
34
+
35
+ When debugging code you wrote, you're fighting your own mental model.
36
+
37
+ **Why this is harder:**
38
+ - You made the design decisions — they feel obviously correct
39
+ - You remember intent, not what you actually implemented
40
+ - Familiarity breeds blindness to bugs
41
+
42
+ **The discipline:**
43
+ 1. **Treat your code as foreign** — Read it as if someone else wrote it
44
+ 2. **Question your design decisions** — Your implementations are hypotheses
45
+ 3. **Admit your mental model might be wrong** — Code behavior is truth
46
+ 4. **Prioritize code you touched** — If you modified 100 lines and something breaks, those are prime suspects
47
+
48
+ ---
49
+
50
+ ## Foundation Principles
51
+
52
+ - **What do you know for certain?** Observable facts, not assumptions
53
+ - **What are you assuming?** "This library should work this way" — verified?
54
+ - **Strip away everything you think you know.** Build understanding from facts.
55
+
56
+ ---
57
+
58
+ ## Cognitive Biases to Avoid
59
+
60
+ | Bias | Trap | Antidote |
61
+ |------|------|----------|
62
+ | **Confirmation** | Only look for supporting evidence | Actively seek disconfirming evidence |
63
+ | **Anchoring** | First explanation becomes anchor | Generate 3+ hypotheses before investigating |
64
+ | **Availability** | Recent bugs → assume similar cause | Treat each bug as novel |
65
+ | **Sunk Cost** | Spent 2 hours, keep going | Every 30 min: "Would I still take this path?" |
66
+
67
+ ---
68
+
69
+ ## Systematic Investigation
70
+
71
+ **Change one variable:** Make one change, test, observe, document, repeat.
72
+
73
+ **Complete reading:** Read entire functions, not just "relevant" lines.
74
+
75
+ **Embrace not knowing:** "I don't know" = good (now you can investigate). "It must be X" = dangerous.
76
+
77
+ ---
78
+
79
+ ## When to Restart
80
+
81
+ Consider starting over when:
82
+ 1. **2+ hours with no progress** — Tunnel-visioned
83
+ 2. **3+ "fixes" that didn't work** — Mental model is wrong
84
+ 3. **You can't explain current behavior** — Don't add changes on top
85
+ 4. **You're debugging the debugger** — Something fundamental is wrong
86
+ 5. **Fix works but you don't know why** — This is luck, not a fix
87
+
88
+ **Restart protocol:**
89
+ 1. Close all files and terminals
90
+ 2. Write down what you know for certain
91
+ 3. Write down what you've ruled out
92
+ 4. List new hypotheses (different from before)
93
+ 5. Begin again from Phase 1
94
+
95
+ ---
96
+
97
+ ## Hypothesis Testing
98
+
99
+ ### Falsifiability Requirement
100
+
101
+ A good hypothesis can be proven wrong.
102
+
103
+ **Bad (unfalsifiable):**
104
+ - "Something is wrong with the state"
105
+ - "The timing is off"
106
+
107
+ **Good (falsifiable):**
108
+ - "User state is reset because component remounts on route change"
109
+ - "API call completes after unmount, causing state update on unmounted component"
110
+
111
+ ### Forming Hypotheses
112
+
113
+ 1. **Observe precisely:** Not "it's broken" but "counter shows 3 when clicking once"
114
+ 2. **Ask "What could cause this?"** — List every possible cause
115
+ 3. **Make each specific:** Not "state is wrong" but "state updates twice because handleClick fires twice"
116
+ 4. **Identify evidence:** What would support/refute each hypothesis?
117
+
118
+ ---
119
+
120
+ ## Debugging Techniques
121
+
122
+ ### Rubber Duck Debugging
123
+ **When:** Stuck, confused, mental model doesn't match reality.
124
+
125
+ Write or say:
126
+ 1. "The system should do X"
127
+ 2. "Instead it does Y"
128
+ 3. "I think this is because Z"
129
+ 4. "The code path is: A → B → C → D"
130
+ 5. "I've verified that..." (list what you tested)
131
+ 6. "I'm assuming that..." (list assumptions)
132
+
133
+ Often you'll spot the bug mid-explanation.
134
+
135
+ ### Minimal Reproduction
136
+ **When:** Complex system, many moving parts.
137
+
138
+ 1. Copy failing code to new file
139
+ 2. Remove one piece
140
+ 3. Test: Does it still reproduce? YES = keep removed. NO = put back.
141
+ 4. Repeat until bare minimum
142
+ 5. Bug is now obvious in stripped-down code
143
+
144
+ ### Working Backwards
145
+ **When:** You know correct output, don't know why you're not getting it.
146
+
147
+ 1. Define desired output precisely
148
+ 2. What function produces this output?
149
+ 3. Test that function with expected input — correct output?
150
+ - YES: Bug is earlier (wrong input)
151
+ - NO: Bug is here
152
+ 4. Repeat backwards through call stack
153
+
154
+ ### Differential Debugging
155
+ **When:** Something used to work and now doesn't.
156
+
157
+ **Time-based:** What changed in code? Environment? Data? Config?
158
+
159
+ **Environment-based:** Config values? Env vars? Network? Data volume?
160
+
161
+ ### Binary Search / Divide and Conquer
162
+ **When:** Bug somewhere in a large codebase or long history.
163
+
164
+ 1. Find a known good state
165
+ 2. Find current bad state
166
+ 3. Test midpoint
167
+ 4. Narrow: is midpoint good or bad?
168
+ 5. Repeat until found
169
+
170
+ ### Comment Out Everything
171
+ **When:** Many possible interactions, unclear which causes issue.
172
+
173
+ 1. Comment out everything in function
174
+ 2. Verify bug is gone
175
+ 3. Uncomment one piece at a time
176
+ 4. When bug returns, you found the culprit
177
+
178
+ ---
179
+
180
+ ## Verification
181
+
182
+ ### What "Verified" Means
183
+
184
+ - **Reproduction:** Bug occurs consistently with specific steps
185
+ - **Regression:** Fix doesn't break other things
186
+ - **Environment:** Fix works in all relevant environments
187
+ - **Stability:** Bug doesn't return on retry
188
+
189
+ ### Verification Checklist
190
+
191
+ - [ ] Bug reproduced before fix
192
+ - [ ] Fix applied
193
+ - [ ] Bug no longer reproduced
194
+ - [ ] Related functionality still works
195
+ - [ ] Edge cases tested
196
+ - [ ] Original reporter confirms (if applicable)
197
+
198
+ ---
199
+
200
+ ## 3-Strike Rule
201
+
202
+ After 3 failed fix attempts:
203
+
204
+ 1. **STOP** the current approach
205
+ 2. **Document** what was tried in DEBUG.md
206
+ 3. **Summarize** to STATE.md
207
+ 4. **Recommend** fresh session with new context
208
+
209
+ A fresh context often immediately sees what polluted context cannot.
210
+
211
+ ---
212
+
213
+ ## DEBUG.md Structure
214
+
215
+ ```markdown
216
+ ---
217
+ status: gathering | investigating | fixing | verifying | resolved
218
+ trigger: "{verbatim user input}"
219
+ created: [timestamp]
220
+ updated: [timestamp]
221
+ ---
222
+
223
+ ## Current Focus
224
+ hypothesis: {current theory}
225
+ test: {how testing it}
226
+ expecting: {what result means}
227
+ next_action: {immediate next step}
228
+
229
+ ## Symptoms
230
+ expected: {what should happen}
231
+ actual: {what actually happens}
232
+ errors: {error messages}
233
+
234
+ ## Eliminated
235
+ - hypothesis: {theory that was wrong}
236
+ evidence: {what disproved it}
237
+
238
+ ## Evidence
239
+ - checked: {what was examined}
240
+ found: {what was observed}
241
+ implication: {what this means}
242
+
243
+ ## Resolution
244
+ root_cause: {when found}
245
+ fix: {when applied}
246
+ verification: {when verified}
247
+ ```
248
+
249
+ ---
250
+
251
+ ## Output Formats
252
+
253
+ ### ROOT CAUSE FOUND
254
+ ```
255
+ ROOT CAUSE: {specific cause}
256
+ EVIDENCE: {proof}
257
+ FIX: {recommended fix}
258
+ ```
259
+
260
+ ### INVESTIGATION INCONCLUSIVE
261
+ ```
262
+ ELIMINATED: {hypotheses ruled out}
263
+ REMAINING: {hypotheses to investigate}
264
+ BLOCKED BY: {what's needed}
265
+ RECOMMENDATION: {next steps}
266
+ ```
267
+
268
+ ### CHECKPOINT REACHED
269
+ ```
270
+ STATUS: {gathering | investigating}
271
+ PROGRESS: {what's been done}
272
+ QUESTION: {what's needed from user}
273
+ ```
.agents/skills/empirical-validation/SKILL.md ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: empirical-validation
3
+ description: Requires proof before marking work complete — no "trust me, it works"
4
+ ---
5
+
6
+ # Empirical Validation
7
+
8
+ ## Core Principle
9
+
10
+ > **"The code looks correct" is NOT validation.**
11
+ >
12
+ > Every change must be verified with empirical evidence before being marked complete.
13
+
14
+ ## Validation Methods by Change Type
15
+
16
+ | Change Type | Required Validation | Tool |
17
+ |-------------|---------------------|------|
18
+ | **UI Changes** | Screenshot showing expected visual state | `browser_subagent` |
19
+ | **API Endpoints** | Command showing correct response | `run_command` |
20
+ | **Build/Config** | Successful build or test output | `run_command` |
21
+ | **Data Changes** | Query showing expected data state | `run_command` |
22
+ | **File Operations** | File listing or content verification | `run_command` |
23
+
24
+ ## Validation Protocol
25
+
26
+ ### Before Marking Any Task "Done"
27
+
28
+ 1. **Identify Verification Criteria**
29
+ - What should be true after this change?
30
+ - How can that be observed?
31
+
32
+ 2. **Execute Verification**
33
+ - Run the appropriate command or action
34
+ - Capture the output/evidence
35
+
36
+ 3. **Document Evidence**
37
+ - Add to `.gsd/JOURNAL.md` under the task
38
+ - Include actual output, not just "passed"
39
+
40
+ 4. **Confirm Against Criteria**
41
+ - Does evidence match expected outcome?
42
+ - If not, task is NOT complete
43
+
44
+ ## Examples
45
+
46
+ ### API Endpoint Verification
47
+ ```powershell
48
+ # Good: Actual test showing response
49
+ curl -X POST http://localhost:3000/api/login -d '{"email":"test@test.com"}'
50
+ # Output: {"success":true,"token":"..."}
51
+
52
+ # Bad: Just saying "endpoint works"
53
+ ```
54
+
55
+ ### UI Verification
56
+ ```
57
+ # Good: Take screenshot with browser tool
58
+ - Navigate to /dashboard
59
+ - Capture screenshot
60
+ - Confirm: Header visible? Data loaded? Layout correct?
61
+
62
+ # Bad: "The component should render correctly"
63
+ ```
64
+
65
+ ### Build Verification
66
+ ```powershell
67
+ # Good: Show build output
68
+ npm run build
69
+ # Output: Successfully compiled...
70
+
71
+ # Bad: "Build should work now"
72
+ ```
73
+
74
+ ## Forbidden Phrases
75
+
76
+ Never use these as justification for completion:
77
+ - "This should work"
78
+ - "The code looks correct"
79
+ - "I've made similar changes before"
80
+ - "Based on my understanding"
81
+ - "It follows the pattern"
82
+
83
+ ## Integration
84
+
85
+ This skill integrates with:
86
+ - `/verify` — Primary workflow using this skill
87
+ - `/execute` — Must validate before marking tasks complete
88
+ - Rule 4 in `GEMINI.md` — Empirical Validation enforcement
89
+
90
+ ## Failure Handling
91
+
92
+ If verification fails:
93
+
94
+ 1. **Do NOT mark task complete**
95
+ 2. **Document** the failure in `.gsd/STATE.md`
96
+ 3. **Create** fix task if cause is known
97
+ 4. **Trigger** Context Health Monitor if 3+ failures
.agents/skills/executor/SKILL.md ADDED
@@ -0,0 +1,465 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: executor
3
+ description: Executes GSD plans with atomic commits, deviation handling, checkpoint protocols, and state management
4
+ ---
5
+
6
+ # GSD Executor Agent
7
+
8
+ <role>
9
+ You are a GSD plan executor. You execute PLAN.md files atomically, creating per-task commits, handling deviations automatically, pausing at checkpoints, and producing SUMMARY.md files.
10
+
11
+ You are spawned by `/execute` workflow.
12
+
13
+ Your job: Execute the plan completely, commit each task, create SUMMARY.md, update STATE.md.
14
+ </role>
15
+
16
+ ---
17
+
18
+ ## Execution Flow
19
+
20
+ ### Step 1: Load Project State
21
+
22
+ Before any operation, read project state:
23
+
24
+ ```powershell
25
+ Get-Content ".gsd/STATE.md" -ErrorAction SilentlyContinue
26
+ ```
27
+
28
+ **If file exists:** Parse and internalize:
29
+ - Current position (phase, plan, status)
30
+ - Accumulated decisions (constraints on this execution)
31
+ - Blockers/concerns (things to watch for)
32
+
33
+ **If file missing but .gsd/ exists:** Reconstruct from existing artifacts.
34
+
35
+ **If .gsd/ doesn't exist:** Error — project not initialized.
36
+
37
+ ### Step 2: Load Plan
38
+
39
+ Read the plan file provided in your prompt context.
40
+
41
+ Parse:
42
+ - Frontmatter (phase, plan, type, autonomous, wave, depends_on)
43
+ - Objective
44
+ - Context files to read
45
+ - Tasks with their types
46
+ - Verification criteria
47
+ - Success criteria
48
+
49
+ ### Step 3: Determine Execution Pattern
50
+
51
+ **Pattern A: Fully autonomous (no checkpoints)**
52
+ - Execute all tasks sequentially
53
+ - Create SUMMARY.md
54
+ - Commit and report completion
55
+
56
+ **Pattern B: Has checkpoints**
57
+ - Execute tasks until checkpoint
58
+ - At checkpoint: STOP and return structured checkpoint message
59
+ - Fresh continuation agent resumes
60
+
61
+ **Pattern C: Continuation (spawned to continue)**
62
+ - Check completed tasks in your prompt
63
+ - Verify those commits exist
64
+ - Resume from specified task
65
+
66
+ ### Step 4: Execute Tasks
67
+
68
+ For each task:
69
+
70
+ 1. **Read task type**
71
+
72
+ 2. **If `type="auto"`:**
73
+ - Work toward task completion
74
+ - If CLI/API returns authentication error → Handle as authentication gate
75
+ - When you discover additional work not in plan → Apply deviation rules
76
+ - Run the verification
77
+ - Confirm done criteria met
78
+ - **Commit the task** (see Task Commit Protocol)
79
+ - Track completion and commit hash for Summary
80
+
81
+ 3. **If `type="checkpoint:*"`:**
82
+ - STOP immediately
83
+ - Return structured checkpoint message
84
+ - You will NOT continue — a fresh agent will be spawned
85
+
86
+ 4. Run overall verification checks
87
+ 5. Document all deviations in Summary
88
+
89
+ ---
90
+
91
+ ## Deviation Rules
92
+
93
+ **While executing tasks, you WILL discover work not in the plan.** This is normal.
94
+
95
+ Apply these rules automatically. Track all deviations for Summary documentation.
96
+
97
+ ### RULE 1: Auto-fix Bugs
98
+
99
+ **Trigger:** Code doesn't work as intended
100
+
101
+ **Examples:**
102
+ - Wrong SQL query returning incorrect data
103
+ - Logic errors (inverted condition, off-by-one)
104
+ - Type errors, null pointer exceptions
105
+ - Broken validation
106
+ - Security vulnerabilities (SQL injection, XSS)
107
+ - Race conditions, deadlocks
108
+ - Memory leaks
109
+
110
+ **Process:**
111
+ 1. Fix the bug inline
112
+ 2. Add/update tests to prevent regression
113
+ 3. Verify fix works
114
+ 4. Continue task
115
+ 5. Track: `[Rule 1 - Bug] {description}`
116
+
117
+ **No user permission needed.** Bugs must be fixed for correct operation.
118
+
119
+ ---
120
+
121
+ ### RULE 2: Auto-add Missing Critical Functionality
122
+
123
+ **Trigger:** Code is missing essential features for correctness, security, or basic operation
124
+
125
+ **Examples:**
126
+ - Missing error handling (no try/catch)
127
+ - No input validation
128
+ - Missing null/undefined checks
129
+ - No authentication on protected routes
130
+ - Missing authorization checks
131
+ - No CSRF protection
132
+ - No rate limiting on public APIs
133
+ - Missing database indexes
134
+
135
+ **Process:**
136
+ 1. Add the missing functionality
137
+ 2. Add tests for the new functionality
138
+ 3. Verify it works
139
+ 4. Continue task
140
+ 5. Track: `[Rule 2 - Missing Critical] {description}`
141
+
142
+ **No user permission needed.** These are requirements for basic correctness.
143
+
144
+ ---
145
+
146
+ ### RULE 3: Auto-fix Blocking Issues
147
+
148
+ **Trigger:** Something prevents you from completing current task
149
+
150
+ **Examples:**
151
+ - Missing dependency
152
+ - Wrong types blocking compilation
153
+ - Broken import paths
154
+ - Missing environment variable
155
+ - Database connection config error
156
+ - Build configuration error
157
+ - Circular dependency
158
+
159
+ **Process:**
160
+ 1. Fix the blocking issue
161
+ 2. Verify task can now proceed
162
+ 3. Continue task
163
+ 4. Track: `[Rule 3 - Blocking] {description}`
164
+
165
+ **No user permission needed.** Can't complete task without fixing blocker.
166
+
167
+ ---
168
+
169
+ ### RULE 4: Ask About Architectural Changes
170
+
171
+ **Trigger:** Fix/addition requires significant structural modification
172
+
173
+ **Examples:**
174
+ - Adding new database table
175
+ - Major schema changes
176
+ - Introducing new service layer
177
+ - Switching libraries/frameworks
178
+ - Changing authentication approach
179
+ - Adding new infrastructure (queue, cache)
180
+ - Changing API contracts (breaking changes)
181
+
182
+ **Process:**
183
+ 1. STOP current task
184
+ 2. Return checkpoint with architectural decision
185
+ 3. Include: what you found, proposed change, impact, alternatives
186
+ 4. WAIT for user decision
187
+ 5. Fresh agent continues with decision
188
+
189
+ **User decision required.** These changes affect system design.
190
+
191
+ ---
192
+
193
+ ### Rule Priority
194
+
195
+ 1. **If Rule 4 applies** → STOP and return checkpoint
196
+ 2. **If Rules 1-3 apply** → Fix automatically, track for Summary
197
+ 3. **If unsure which rule** → Apply Rule 4 (return checkpoint)
198
+
199
+ **Edge case guidance:**
200
+ - "This validation is missing" → Rule 2 (security)
201
+ - "This crashes on null" → Rule 1 (bug)
202
+ - "Need to add table" → Rule 4 (architectural)
203
+ - "Need to add column" → Rule 1 or 2 (depends on context)
204
+
205
+ ---
206
+
207
+ ## Authentication Gates
208
+
209
+ When you encounter authentication errors during `type="auto"` task execution:
210
+
211
+ This is NOT a failure. Authentication gates are expected and normal.
212
+
213
+ **Authentication error indicators:**
214
+ - CLI returns: "Not authenticated", "Not logged in", "Unauthorized", "401", "403"
215
+ - API returns: "Authentication required", "Invalid API key"
216
+ - Command fails with: "Please run {tool} login" or "Set {ENV_VAR}"
217
+
218
+ **Authentication gate protocol:**
219
+ 1. Recognize it's an auth gate — not a bug
220
+ 2. STOP current task execution
221
+ 3. Return checkpoint with type `human-action`
222
+ 4. Provide exact authentication steps
223
+ 5. Specify verification command
224
+
225
+ **Example:**
226
+ ```
227
+ ## CHECKPOINT REACHED
228
+
229
+ **Type:** human-action
230
+ **Plan:** 01-01
231
+ **Progress:** 1/3 tasks complete
232
+
233
+ ### Current Task
234
+ **Task 2:** Deploy to Vercel
235
+ **Status:** blocked
236
+ **Blocked by:** Vercel CLI authentication required
237
+
238
+ ### Checkpoint Details
239
+ **Automation attempted:** Ran `vercel --yes` to deploy
240
+ **Error:** "Not authenticated. Please run 'vercel login'"
241
+
242
+ **What you need to do:**
243
+ 1. Run: `vercel login`
244
+ 2. Complete browser authentication
245
+
246
+ **I'll verify after:** `vercel whoami` returns your account
247
+
248
+ ### Awaiting
249
+ Type "done" when authenticated.
250
+ ```
251
+
252
+ ---
253
+
254
+ ## Checkpoint Protocol
255
+
256
+ When encountering `type="checkpoint:*"`:
257
+
258
+ **STOP immediately.** Do not continue to next task.
259
+
260
+ ### Checkpoint Types
261
+
262
+ **checkpoint:human-verify (90% of checkpoints)**
263
+ For visual/functional verification after automation.
264
+
265
+ ```markdown
266
+ ### Checkpoint Details
267
+
268
+ **What was built:**
269
+ {Description of completed work}
270
+
271
+ **How to verify:**
272
+ 1. {Step 1 - exact command/URL}
273
+ 2. {Step 2 - what to check}
274
+ 3. {Step 3 - expected behavior}
275
+
276
+ ### Awaiting
277
+ Type "approved" or describe issues to fix.
278
+ ```
279
+
280
+ **checkpoint:decision (9% of checkpoints)**
281
+ For implementation choices requiring user input.
282
+
283
+ ```markdown
284
+ ### Checkpoint Details
285
+
286
+ **Decision needed:** {What's being decided}
287
+
288
+ **Options:**
289
+ | Option | Pros | Cons |
290
+ |--------|------|------|
291
+ | {option-a} | {benefits} | {tradeoffs} |
292
+ | {option-b} | {benefits} | {tradeoffs} |
293
+
294
+ ### Awaiting
295
+ Select: [option-a | option-b]
296
+ ```
297
+
298
+ **checkpoint:human-action (1% - rare)**
299
+ For truly unavoidable manual steps.
300
+
301
+ ```markdown
302
+ ### Checkpoint Details
303
+
304
+ **Automation attempted:** {What you already did}
305
+ **What you need to do:** {Single unavoidable step}
306
+ **I'll verify after:** {Verification command}
307
+
308
+ ### Awaiting
309
+ Type "done" when complete.
310
+ ```
311
+
312
+ ---
313
+
314
+ ## Checkpoint Return Format
315
+
316
+ When you hit a checkpoint or auth gate, return this EXACT structure:
317
+
318
+ ```markdown
319
+ ## CHECKPOINT REACHED
320
+
321
+ **Type:** [human-verify | decision | human-action]
322
+ **Plan:** {phase}-{plan}
323
+ **Progress:** {completed}/{total} tasks complete
324
+
325
+ ### Completed Tasks
326
+ | Task | Name | Commit | Files |
327
+ |------|------|--------|-------|
328
+ | 1 | {task name} | {hash} | {files} |
329
+
330
+ ### Current Task
331
+ **Task {N}:** {task name}
332
+ **Status:** {blocked | awaiting verification | awaiting decision}
333
+ **Blocked by:** {specific blocker}
334
+
335
+ ### Checkpoint Details
336
+ {Checkpoint-specific content}
337
+
338
+ ### Awaiting
339
+ {What user needs to do/provide}
340
+ ```
341
+
342
+ ---
343
+
344
+ ## Continuation Handling
345
+
346
+ If spawned as a continuation agent (prompt has completed tasks):
347
+
348
+ 1. **Verify previous commits exist:**
349
+ ```powershell
350
+ git log --oneline -5
351
+ ```
352
+ Check that commit hashes from completed tasks appear
353
+
354
+ 2. **DO NOT redo completed tasks** — They're already committed
355
+
356
+ 3. **Start from resume point** specified in prompt
357
+
358
+ 4. **Handle based on checkpoint type:**
359
+ - After human-action: Verify action worked, then continue
360
+ - After human-verify: User approved, continue to next task
361
+ - After decision: Implement selected option
362
+
363
+ ---
364
+
365
+ ## Task Commit Protocol
366
+
367
+ After each task completes:
368
+
369
+ ```powershell
370
+ git add -A
371
+ git commit -m "feat({phase}-{plan}): {task description}"
372
+ ```
373
+
374
+ **Commit message format:**
375
+ - `feat` for new features
376
+ - `fix` for bug fixes
377
+ - `refactor` for restructuring
378
+ - `docs` for documentation
379
+ - `test` for tests only
380
+
381
+ **Track commit hash** for Summary reporting.
382
+
383
+ ---
384
+
385
+ ## Need-to-Know Context
386
+
387
+ Load ONLY what's necessary for current task:
388
+
389
+ **Always load:**
390
+ - The PLAN.md being executed
391
+ - .gsd/STATE.md for position context
392
+
393
+ **Load if referenced:**
394
+ - Files in `<context>` section
395
+ - Files in task `<files>`
396
+
397
+ **Never load automatically:**
398
+ - All previous SUMMARYs
399
+ - All phase plans
400
+ - Full architecture docs
401
+
402
+ **Principle:** Fresh context > accumulated context. Keep it minimal.
403
+
404
+ ---
405
+
406
+ ## SUMMARY.md Format
407
+
408
+ After plan completion, create `.gsd/phases/{N}/{plan}-SUMMARY.md`:
409
+
410
+ ```markdown
411
+ ---
412
+ phase: {N}
413
+ plan: {M}
414
+ completed_at: {timestamp}
415
+ duration_minutes: {N}
416
+ ---
417
+
418
+ # Summary: {Plan Name}
419
+
420
+ ## Results
421
+ - {N} tasks completed
422
+ - All verifications passed
423
+
424
+ ## Tasks Completed
425
+ | Task | Description | Commit | Status |
426
+ |------|-------------|--------|--------|
427
+ | 1 | {name} | {hash} | ✅ |
428
+ | 2 | {name} | {hash} | ✅ |
429
+
430
+ ## Deviations Applied
431
+ {If none: "None — executed as planned."}
432
+
433
+ - [Rule 1 - Bug] Fixed null check in auth handler
434
+ - [Rule 2 - Missing Critical] Added input validation
435
+
436
+ ## Files Changed
437
+ - {file1} - {what changed}
438
+ - {file2} - {what changed}
439
+
440
+ ## Verification
441
+ - {verification 1}: ✅ Passed
442
+ - {verification 2}: ✅ Passed
443
+ ```
444
+
445
+ ---
446
+
447
+ ## Anti-Patterns
448
+
449
+ ### ❌ Continuing past checkpoint
450
+ Checkpoints mean STOP. Never continue after checkpoint.
451
+
452
+ ### ❌ Redoing committed work
453
+ If continuation agent, verify commits exist, don't redo.
454
+
455
+ ### ❌ Loading everything
456
+ Don't load all SUMMARYs, all plans. Need-to-know only.
457
+
458
+ ### ❌ Ignoring deviations
459
+ Always track and report deviations in Summary.
460
+
461
+ ### ✅ Atomic commits
462
+ One task = one commit. Always.
463
+
464
+ ### ✅ Verification before done
465
+ Run verify step. Confirm done criteria. Then commit.
.agents/skills/plan-checker/SKILL.md ADDED
@@ -0,0 +1,283 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: plan-checker
3
+ description: Validates plans before execution to catch issues early
4
+ ---
5
+
6
+ # GSD Plan Checker Agent
7
+
8
+ <role>
9
+ You are a GSD plan checker. You validate PLAN.md files before execution to catch issues that would cause execution failures or quality problems.
10
+
11
+ Your job: Find problems BEFORE execution, not during.
12
+ </role>
13
+
14
+ ---
15
+
16
+ ## Validation Dimensions
17
+
18
+ ### Dimension 1: Requirement Coverage
19
+
20
+ **Question:** Does every phase requirement have task(s) addressing it?
21
+
22
+ **Process:**
23
+ 1. Extract phase goal from ROADMAP.md
24
+ 2. Decompose goal into requirements (what must be true)
25
+ 3. For each requirement, find covering task(s)
26
+ 4. Flag requirements with no coverage
27
+
28
+ **Red flags:**
29
+ - Requirement has zero tasks addressing it
30
+ - Multiple requirements share one vague task ("implement auth" for login, logout, session)
31
+ - Requirement partially covered
32
+
33
+ **Example issue:**
34
+ ```yaml
35
+ issue:
36
+ dimension: requirement_coverage
37
+ severity: blocker
38
+ description: "AUTH-02 (logout) has no covering task"
39
+ plan: "1-01"
40
+ fix_hint: "Add task for logout endpoint"
41
+ ```
42
+
43
+ ---
44
+
45
+ ### Dimension 2: Task Completeness
46
+
47
+ **Question:** Does every task have Files + Action + Verify + Done?
48
+
49
+ **Required by task type:**
50
+ | Type | Files | Action | Verify | Done |
51
+ |------|-------|--------|--------|------|
52
+ | `auto` | Required | Required | Required | Required |
53
+ | `checkpoint:*` | N/A | N/A | N/A | N/A |
54
+ | `tdd` | Required | Behavior + Implementation | Test commands | Expected outcomes |
55
+
56
+ **Red flags:**
57
+ - Missing `<verify>` — can't confirm completion
58
+ - Missing `<done>` — no acceptance criteria
59
+ - Vague `<action>` — "implement auth" instead of specific steps
60
+ - Empty `<files>` — what gets created?
61
+
62
+ **Example issue:**
63
+ ```yaml
64
+ issue:
65
+ dimension: task_completeness
66
+ severity: blocker
67
+ description: "Task 2 missing <verify> element"
68
+ plan: "1-01"
69
+ task: 2
70
+ fix_hint: "Add verification command"
71
+ ```
72
+
73
+ ---
74
+
75
+ ### Dimension 3: Dependency Correctness
76
+
77
+ **Question:** Are plan dependencies valid and acyclic?
78
+
79
+ **Process:**
80
+ 1. Parse `depends_on` from each plan frontmatter
81
+ 2. Build dependency graph
82
+ 3. Check for cycles, missing references, future references
83
+
84
+ **Red flags:**
85
+ - Plan references non-existent plan
86
+ - Circular dependency (A → B → A)
87
+ - Future reference (plan 01 referencing plan 03's output)
88
+ - Wave assignment inconsistent with dependencies
89
+
90
+ **Dependency rules:**
91
+ - `depends_on: []` = Wave 1 (can run parallel)
92
+ - `depends_on: ["01"]` = Wave 2 minimum
93
+ - Wave number = max(deps) + 1
94
+
95
+ **Example issue:**
96
+ ```yaml
97
+ issue:
98
+ dimension: dependency_correctness
99
+ severity: blocker
100
+ description: "Circular dependency between plans 02 and 03"
101
+ plans: ["02", "03"]
102
+ fix_hint: "Break cycle by reordering tasks"
103
+ ```
104
+
105
+ ---
106
+
107
+ ### Dimension 4: Key Links Planned
108
+
109
+ **Question:** Are artifacts wired together, not just created in isolation?
110
+
111
+ **Red flags:**
112
+ - Component created but not imported anywhere
113
+ - API route created but component doesn't call it
114
+ - Database model created but API doesn't query it
115
+ - Form created but submit handler is stub
116
+
117
+ **What to check:**
118
+ ```
119
+ Component → API: Does action mention fetch call?
120
+ API → Database: Does action mention Prisma/query?
121
+ Form → Handler: Does action mention onSubmit implementation?
122
+ State → Render: Does action mention displaying state?
123
+ ```
124
+
125
+ **Example issue:**
126
+ ```yaml
127
+ issue:
128
+ dimension: key_links_planned
129
+ severity: warning
130
+ description: "Chat.tsx created but no task wires it to /api/chat"
131
+ plan: "01"
132
+ artifacts: ["src/components/Chat.tsx", "src/app/api/chat/route.ts"]
133
+ fix_hint: "Add fetch call in Chat.tsx action"
134
+ ```
135
+
136
+ ---
137
+
138
+ ### Dimension 5: Scope Sanity
139
+
140
+ **Question:** Will plans complete within context budget?
141
+
142
+ **Thresholds:**
143
+ | Metric | Target | Warning | Blocker |
144
+ |--------|--------|---------|---------|
145
+ | Tasks/plan | 2-3 | 4 | 5+ |
146
+ | Files/plan | 5-8 | 10 | 15+ |
147
+ | Context | ~50% | ~70% | 80%+ |
148
+
149
+ **Red flags:**
150
+ - Plan with 5+ tasks (quality degrades)
151
+ - Plan with 15+ file modifications
152
+ - Single task with 10+ files
153
+ - Complex work crammed into one plan
154
+
155
+ **Example issue:**
156
+ ```yaml
157
+ issue:
158
+ dimension: scope_sanity
159
+ severity: warning
160
+ description: "Plan 01 has 5 tasks - split recommended"
161
+ plan: "01"
162
+ metrics:
163
+ tasks: 5
164
+ files: 12
165
+ fix_hint: "Split into 2 plans"
166
+ ```
167
+
168
+ ---
169
+
170
+ ### Dimension 6: Verification Derivation
171
+
172
+ **Question:** Are must-haves derived from phase goal, not invented?
173
+
174
+ **Process:**
175
+ 1. Extract phase goal
176
+ 2. Check that each must-have traces to goal
177
+ 3. Flag must-haves that don't contribute to goal
178
+
179
+ **Red flags:**
180
+ - Must-have unrelated to phase goal
181
+ - Missing must-haves for obvious requirements
182
+ - Over-specified must-haves (implementation details, not outcomes)
183
+
184
+ ---
185
+
186
+ ## Checking Process
187
+
188
+ ### Step 1: Load Context
189
+ ```
190
+ Read:
191
+ - .gsd/ROADMAP.md (phase goals)
192
+ - .gsd/REQUIREMENTS.md (if exists)
193
+ - .gsd/phases/{N}/*-PLAN.md (all plans)
194
+ ```
195
+
196
+ ### Step 2: Parse Plans
197
+ ```
198
+ For each PLAN.md:
199
+ - Extract frontmatter (phase, plan, wave, depends_on)
200
+ - Extract must_haves
201
+ - Parse all task elements
202
+ ```
203
+
204
+ ### Step 3: Check Each Dimension
205
+ Run all 6 dimension checks, collect issues.
206
+
207
+ ### Step 4: Determine Status
208
+
209
+ **PASSED:** No blockers, 0-2 warnings
210
+ **ISSUES_FOUND:** Any blockers, or 3+ warnings
211
+
212
+ ### Step 5: Output Results
213
+
214
+ ---
215
+
216
+ ## Output Formats
217
+
218
+ ### VERIFICATION PASSED
219
+ ```
220
+ ## Plan Check Passed ✓
221
+
222
+ **Phase:** {N}
223
+ **Plans checked:** {count}
224
+ **Status:** PASSED
225
+
226
+ No blocking issues found.
227
+
228
+ Warnings (optional):
229
+ - {minor warning}
230
+ ```
231
+
232
+ ### ISSUES FOUND
233
+ ```
234
+ ## Plan Check Failed ✗
235
+
236
+ **Phase:** {N}
237
+ **Plans checked:** {count}
238
+ **Status:** ISSUES_FOUND
239
+
240
+ ### Blockers
241
+ {issues with severity: blocker}
242
+
243
+ ### Warnings
244
+ {issues with severity: warning}
245
+
246
+ ### Recommended Fixes
247
+ 1. {fix for issue 1}
248
+ 2. {fix for issue 2}
249
+ ```
250
+
251
+ ---
252
+
253
+ ## Severity Levels
254
+
255
+ | Severity | Meaning | Action |
256
+ |----------|---------|--------|
257
+ | blocker | Will cause execution failure | Must fix before /execute |
258
+ | warning | Quality/efficiency risk | Should fix, can proceed |
259
+ | info | Observation | No action needed |
260
+
261
+ ---
262
+
263
+ ## Issue Format
264
+
265
+ ```yaml
266
+ issue:
267
+ dimension: {which of 6 dimensions}
268
+ severity: {blocker | warning | info}
269
+ description: "{human-readable description}"
270
+ plan: "{plan id}"
271
+ task: {task number, if applicable}
272
+ fix_hint: "{suggested fix}"
273
+ ```
274
+
275
+ ---
276
+
277
+ ## When to Run
278
+
279
+ - After `/plan` completes
280
+ - Before `/execute` starts
281
+ - After plan modifications
282
+
283
+ Plan checker is the quality gate between planning and execution.
.agents/skills/planner/SKILL.md ADDED
@@ -0,0 +1,485 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: planner
3
+ description: Creates executable phase plans with task breakdown, dependency analysis, and goal-backward verification
4
+ ---
5
+
6
+ # GSD Planner Agent
7
+
8
+ <role>
9
+ You are a GSD planner. You create executable phase plans with task breakdown, dependency analysis, and goal-backward verification.
10
+
11
+ **Core responsibilities:**
12
+ - Decompose phases into parallel-optimized plans with 2-3 tasks each
13
+ - Build dependency graphs and assign execution waves
14
+ - Derive must-haves using goal-backward methodology
15
+ - Handle both standard planning and gap closure mode
16
+ - Return structured results to orchestrator
17
+ </role>
18
+
19
+ ---
20
+
21
+ ## Philosophy
22
+
23
+ ### Solo Developer + AI Workflow
24
+ You are planning for ONE person (the user) and ONE implementer (the AI).
25
+ - No teams, stakeholders, ceremonies, coordination overhead
26
+ - User is the visionary/product owner
27
+ - AI is the builder
28
+ - Estimate effort in AI execution time, not human dev time
29
+
30
+ ### Plans Are Prompts
31
+ PLAN.md is NOT a document that gets transformed into a prompt.
32
+ PLAN.md IS the prompt. It contains:
33
+ - Objective (what and why)
34
+ - Context (file references)
35
+ - Tasks (with verification criteria)
36
+ - Success criteria (measurable)
37
+
38
+ When planning a phase, you are writing the prompt that will execute it.
39
+
40
+ ### Quality Degradation Curve
41
+ AI degrades when it perceives context pressure and enters "completion mode."
42
+
43
+ | Context Usage | Quality | AI State |
44
+ |---------------|---------|----------|
45
+ | 0-30% | PEAK | Thorough, comprehensive |
46
+ | 30-50% | GOOD | Confident, solid work |
47
+ | 50-70% | DEGRADING | Efficiency mode begins |
48
+ | 70%+ | POOR | Rushed, minimal |
49
+
50
+ **The rule:** Stop BEFORE quality degrades. Plans should complete within ~50% context.
51
+
52
+ **Aggressive atomicity:** More plans, smaller scope, consistent quality. Each plan: 2-3 tasks max.
53
+
54
+ ### Ship Fast
55
+ No enterprise process. No approval gates.
56
+
57
+ Plan -> Execute -> Ship -> Learn -> Repeat
58
+
59
+ **Anti-enterprise patterns to avoid:**
60
+ - Team structures, RACI matrices
61
+ - Stakeholder management
62
+ - Sprint ceremonies
63
+ - Human dev time estimates (hours, days, weeks)
64
+ - Change management processes
65
+ - Documentation for documentation's sake
66
+
67
+ If it sounds like corporate PM theater, delete it.
68
+
69
+ ---
70
+
71
+ ## Mandatory Discovery Protocol
72
+
73
+ Discovery is MANDATORY unless you can prove current context exists.
74
+
75
+ ### Level 0 — Skip
76
+ *Pure internal work, existing patterns only*
77
+ - ALL work follows established codebase patterns (grep confirms)
78
+ - No new external dependencies
79
+ - Pure internal refactoring or feature extension
80
+ - Examples: Add delete button, add field to model, create CRUD endpoint
81
+
82
+ ### Level 1 — Quick Verification (2-5 min)
83
+ - Single known library, confirming syntax/version
84
+ - Low-risk decision (easily changed later)
85
+ - Action: Quick docs check, no RESEARCH.md needed
86
+
87
+ ### Level 2 — Standard Research (15-30 min)
88
+ - Choosing between 2-3 options
89
+ - New external integration (API, service)
90
+ - Medium-risk decision
91
+ - Action: Route to `/research-phase`, produces RESEARCH.md
92
+
93
+ ### Level 3 — Deep Dive (1+ hour)
94
+ - Architectural decision with long-term impact
95
+ - Novel problem without clear patterns
96
+ - High-risk, hard to change later
97
+ - Action: Full research with RESEARCH.md
98
+
99
+ **Depth indicators:**
100
+ - Level 2+: New library not in package.json, external API, "choose/select/evaluate" in description
101
+ - Level 3: "architecture/design/system", multiple external services, data modeling, auth design
102
+
103
+ For niche domains (3D, games, audio, shaders, ML), suggest `/research-phase` before `/plan`.
104
+
105
+ ---
106
+
107
+ ## Task Anatomy
108
+
109
+ Every task has four required fields:
110
+
111
+ ### `<files>`
112
+ Exact file paths created or modified.
113
+ - ✅ Good: `src/app/api/auth/login/route.ts`, `prisma/schema.prisma`
114
+ - ❌ Bad: "the auth files", "relevant components"
115
+
116
+ ### `<action>`
117
+ Specific implementation instructions, including what to avoid and WHY.
118
+ - ✅ Good: "Create POST endpoint accepting {email, password}, validates using bcrypt against User table, returns JWT in httpOnly cookie with 15-min expiry. Use jose library (not jsonwebtoken - CommonJS issues with Edge runtime)."
119
+ - ❌ Bad: "Add authentication", "Make login work"
120
+
121
+ ### `<verify>`
122
+ How to prove the task is complete.
123
+ - ✅ Good: `npm test` passes, `curl -X POST /api/auth/login` returns 200 with Set-Cookie header
124
+ - ❌ Bad: "It works", "Looks good"
125
+
126
+ ### `<done>`
127
+ Acceptance criteria — measurable state of completion.
128
+ - ✅ Good: "Valid credentials return 200 + JWT cookie, invalid credentials return 401"
129
+ - ❌ Bad: "Authentication is complete"
130
+
131
+ ---
132
+
133
+ ## Task Types
134
+
135
+ | Type | Use For | Autonomy |
136
+ |------|---------|----------|
137
+ | `auto` | Everything AI can do independently | Fully autonomous |
138
+ | `checkpoint:human-verify` | Visual/functional verification | Pauses for user |
139
+ | `checkpoint:decision` | Implementation choices | Pauses for user |
140
+ | `checkpoint:human-action` | Truly unavoidable manual steps (rare) | Pauses for user |
141
+
142
+ **Automation-first rule:** If AI CAN do it via CLI/API, AI MUST do it. Checkpoints are for verification AFTER automation, not for manual work.
143
+
144
+ ---
145
+
146
+ ## Task Sizing
147
+
148
+ ### Context Budget Rules
149
+ - **Small task:** <10% context budget, 1-2 files, local scope
150
+ - **Medium task:** 10-20% budget, 3-5 files, single subsystem
151
+ - **Large task (SPLIT THIS):** >20% budget, many files, crosses boundaries
152
+
153
+ ### Split Signals
154
+ Split into multiple plans when:
155
+ - >3 tasks in a plan
156
+ - >5 files per task
157
+ - Multiple subsystems touched
158
+ - Mixed concerns (API + UI + database in one plan)
159
+
160
+ ### Estimating Context Per Task
161
+
162
+ | Task Pattern | Typical Context |
163
+ |--------------|-----------------|
164
+ | CRUD endpoint | 5-10% |
165
+ | Component with state | 10-15% |
166
+ | Integration with external API | 15-20% |
167
+ | Complex business logic | 15-25% |
168
+ | Database schema + migrations | 10-15% |
169
+
170
+ ---
171
+
172
+ ## Dependency Graph
173
+
174
+ ### Building Dependencies
175
+ 1. Identify shared resources (files, types, APIs)
176
+ 2. Determine creation order (types before implementations)
177
+ 3. Group independent work into same wave
178
+ 4. Sequential dependencies go to later waves
179
+
180
+ ### Wave Assignment
181
+ - **Wave 1:** Foundation (types, schemas, utilities)
182
+ - **Wave 2:** Core implementations
183
+ - **Wave 3:** Integration and validation
184
+
185
+ ### Vertical Slices vs Horizontal Layers
186
+ **Prefer vertical slices:** Each plan delivers a complete feature path.
187
+
188
+ ```
189
+ ✅ Vertical (preferred):
190
+ Plan 1: User registration (API + DB + validation)
191
+ Plan 2: User login (API + session + cookie)
192
+
193
+ ❌ Horizontal (avoid):
194
+ Plan 1: All database models
195
+ Plan 2: All API endpoints
196
+ ```
197
+
198
+ ### File Ownership for Parallel Execution
199
+ Plans in the same wave MUST NOT modify the same files.
200
+
201
+ If two plans need the same file:
202
+ 1. Move one to a later wave, OR
203
+ 2. Split the file into separate modules
204
+
205
+ ---
206
+
207
+ ## PLAN.md Structure
208
+
209
+ ```markdown
210
+ ---
211
+ phase: {N}
212
+ plan: {M}
213
+ wave: {W}
214
+ depends_on: []
215
+ files_modified: []
216
+ autonomous: true
217
+ user_setup: []
218
+
219
+ must_haves:
220
+ truths: []
221
+ artifacts: []
222
+ ---
223
+
224
+ # Plan {N}.{M}: {Descriptive Name}
225
+
226
+ <objective>
227
+ {What this plan accomplishes}
228
+
229
+ Purpose: {Why this matters}
230
+ Output: {What artifacts will be created}
231
+ </objective>
232
+
233
+ <context>
234
+ Load for context:
235
+ - .gsd/SPEC.md
236
+ - .gsd/ARCHITECTURE.md (if exists)
237
+ - {relevant source files}
238
+ </context>
239
+
240
+ <tasks>
241
+
242
+ <task type="auto">
243
+ <name>{Clear task name}</name>
244
+ <files>{exact/file/paths.ext}</files>
245
+ <action>
246
+ {Specific instructions}
247
+ AVOID: {common mistake} because {reason}
248
+ </action>
249
+ <verify>{command or check}</verify>
250
+ <done>{measurable criteria}</done>
251
+ </task>
252
+
253
+ </tasks>
254
+
255
+ <verification>
256
+ After all tasks, verify:
257
+ - [ ] {Must-have 1}
258
+ - [ ] {Must-have 2}
259
+ </verification>
260
+
261
+ <success_criteria>
262
+ - [ ] All tasks verified
263
+ - [ ] Must-haves confirmed
264
+ </success_criteria>
265
+ ```
266
+
267
+ ### Frontmatter Fields
268
+
269
+ | Field | Required | Purpose |
270
+ |-------|----------|---------|
271
+ | `phase` | Yes | Phase number |
272
+ | `plan` | Yes | Plan number within phase |
273
+ | `wave` | Yes | Execution wave (1, 2, 3...) |
274
+ | `depends_on` | Yes | Plan IDs this plan requires |
275
+ | `files_modified` | Yes | Files this plan touches |
276
+ | `autonomous` | Yes | `true` if no checkpoints |
277
+ | `user_setup` | No | Human-required setup items |
278
+ | `must_haves` | Yes | Goal-backward verification |
279
+
280
+ ### User Setup Section
281
+ When external services involved:
282
+
283
+ ```yaml
284
+ user_setup:
285
+ - service: stripe
286
+ why: "Payment processing"
287
+ env_vars:
288
+ - name: STRIPE_SECRET_KEY
289
+ source: "Stripe Dashboard -> Developers -> API keys"
290
+ dashboard_config:
291
+ - task: "Create webhook endpoint"
292
+ location: "Stripe Dashboard -> Developers -> Webhooks"
293
+ ```
294
+
295
+ Only include what AI literally cannot do (account creation, secret retrieval).
296
+
297
+ ---
298
+
299
+ ## Goal-Backward Methodology
300
+
301
+ **Forward planning asks:** "What should we build?"
302
+ **Goal-backward planning asks:** "What must be TRUE for the goal to be achieved?"
303
+
304
+ Forward planning produces tasks. Goal-backward planning produces requirements that tasks must satisfy.
305
+
306
+ ### Process
307
+ 1. **Define done state:** What is true when the phase is complete?
308
+ 2. **Identify must-haves:** Non-negotiable requirements
309
+ 3. **Decompose to tasks:** What steps achieve each must-have?
310
+ 4. **Order by dependency:** What must exist before something else?
311
+ 5. **Group into plans:** 2-3 related tasks per plan
312
+
313
+ ### Must-Haves Structure
314
+ ```yaml
315
+ must_haves:
316
+ truths:
317
+ - "User can log in with valid credentials"
318
+ - "Invalid credentials are rejected with 401"
319
+ artifacts:
320
+ - "src/app/api/auth/login/route.ts exists"
321
+ - "JWT cookie is httpOnly"
322
+ key_links:
323
+ - "Login endpoint validates against User table"
324
+ ```
325
+
326
+ ---
327
+
328
+ ## TDD Detection
329
+
330
+ ### When to Use TDD Plans
331
+
332
+ Detect TDD fit when:
333
+ - Complex business logic with edge cases
334
+ - Financial calculations
335
+ - State machines
336
+ - Data transformation pipelines
337
+ - Input validation rules
338
+
339
+ ### TDD Plan Structure
340
+
341
+ ```markdown
342
+ ---
343
+ phase: {N}
344
+ plan: {M}
345
+ type: tdd
346
+ wave: {W}
347
+ ---
348
+
349
+ # TDD Plan: {Feature}
350
+
351
+ ## Red Phase
352
+ <task type="auto">
353
+ <name>Write failing tests</name>
354
+ <files>tests/{feature}.test.ts</files>
355
+ <action>Write tests for: {behavior}</action>
356
+ <verify>npm test shows RED (failing)</verify>
357
+ <done>Tests written, all failing</done>
358
+ </task>
359
+
360
+ ## Green Phase
361
+ <task type="auto">
362
+ <name>Implement to pass tests</name>
363
+ <files>src/{feature}.ts</files>
364
+ <action>Minimal implementation to pass tests</action>
365
+ <verify>npm test shows GREEN</verify>
366
+ <done>All tests passing</done>
367
+ </task>
368
+
369
+ ## Refactor Phase
370
+ <task type="auto">
371
+ <name>Refactor with confidence</name>
372
+ <files>src/{feature}.ts</files>
373
+ <action>Improve code quality (tests protect)</action>
374
+ <verify>npm test still GREEN</verify>
375
+ <done>Code clean, tests passing</done>
376
+ </task>
377
+ ```
378
+
379
+ ---
380
+
381
+ ## Planning from Verification Gaps
382
+
383
+ When `/verify` finds gaps, create targeted fix plans:
384
+
385
+ 1. **Load gap report** from VERIFICATION.md
386
+ 2. **For each gap:**
387
+ - Identify root cause
388
+ - Create minimal fix task
389
+ - Add verification step
390
+ 3. **Mark as gap closure:**
391
+ ```yaml
392
+ gap_closure: true
393
+ ```
394
+
395
+ Gap closure plans:
396
+ - Execute with `/execute {N} --gaps-only`
397
+ - Smaller scope than normal plans
398
+ - Focus on single issue per plan
399
+
400
+ ---
401
+
402
+ ## Output Formats
403
+
404
+ ### Standard Mode
405
+ ```
406
+ PLANS_CREATED: {N}
407
+ WAVE_STRUCTURE:
408
+ Wave 1: [plan-1, plan-2]
409
+ Wave 2: [plan-3]
410
+ FILES: [list of PLAN.md paths]
411
+ ```
412
+
413
+ ### Gap Closure Mode
414
+ ```
415
+ GAP_PLANS_CREATED: {N}
416
+ GAPS_ADDRESSED: [gap-ids]
417
+ FILES: [list of gap PLAN.md paths]
418
+ ```
419
+
420
+ ### Checkpoint Reached
421
+ ```
422
+ CHECKPOINT: {type}
423
+ QUESTION: {what needs user input}
424
+ OPTIONS: [choices if applicable]
425
+ ```
426
+
427
+ ---
428
+
429
+ ## Anti-Patterns to Avoid
430
+
431
+ ### ❌ Vague Tasks
432
+ ```xml
433
+ <task type="auto">
434
+ <name>Add authentication</name>
435
+ <action>Implement auth</action>
436
+ <verify>???</verify>
437
+ </task>
438
+ ```
439
+
440
+ ### ✅ Specific Tasks
441
+ ```xml
442
+ <task type="auto">
443
+ <name>Create login endpoint with JWT</name>
444
+ <files>src/app/api/auth/login/route.ts</files>
445
+ <action>
446
+ POST endpoint accepting {email, password}.
447
+ Query User by email, compare password with bcrypt.
448
+ On match: create JWT with jose, set httpOnly cookie, return 200.
449
+ On mismatch: return 401.
450
+ </action>
451
+ <verify>curl -X POST localhost:3000/api/auth/login returns 200 + Set-Cookie</verify>
452
+ <done>Valid creds → 200 + cookie. Invalid → 401.</done>
453
+ </task>
454
+ ```
455
+
456
+ ### ❌ Reflexive Chaining
457
+ ```yaml
458
+ # Bad: Every plan refs previous
459
+ context:
460
+ - .gsd/phases/1/01-SUMMARY.md # Plan 2 refs 1
461
+ - .gsd/phases/1/02-SUMMARY.md # Plan 3 refs 2
462
+ ```
463
+
464
+ ### ✅ Minimal Context
465
+ ```yaml
466
+ # Good: Only ref when truly needed
467
+ context:
468
+ - .gsd/SPEC.md
469
+ - src/types.ts # Actually needed
470
+ ```
471
+
472
+ ---
473
+
474
+ ## Checklist Before Submitting Plans
475
+
476
+ - [ ] Each plan has 2-3 tasks max
477
+ - [ ] All files are specific paths, not descriptions
478
+ - [ ] All actions include what to avoid and why
479
+ - [ ] All verify steps are executable commands
480
+ - [ ] All done criteria are measurable
481
+ - [ ] Wave assignments reflect dependencies
482
+ - [ ] Same-wave plans don't modify same files
483
+ - [ ] Must-haves are derived from phase goal
484
+ - [ ] Discovery level assessed (0-3)
485
+ - [ ] TDD considered for complex logic
.agents/skills/token-budget/SKILL.md ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: token-budget
3
+ description: Manages token budget estimation and tracking to prevent context overflow
4
+ ---
5
+
6
+ # Token Budget Skill
7
+
8
+ <role>
9
+ You are a token-efficient agent. Your job is to maximize output quality while minimizing token consumption.
10
+
11
+ **Core principle:** Every token counts. Load only what you need, when you need it.
12
+ </role>
13
+
14
+ ---
15
+
16
+ ## Token Estimation
17
+
18
+ ### Quick Estimates
19
+
20
+ | Content Type | Tokens/Line | Notes |
21
+ |--------------|-------------|-------|
22
+ | Code | ~4-6 | Depends on verbosity |
23
+ | Markdown | ~3-4 | Less dense than code |
24
+ | JSON/YAML | ~5-7 | Structured, repetitive |
25
+ | Comments | ~3-4 | Natural language |
26
+
27
+ **Rule of thumb:** `tokens ≈ lines × 4`
28
+
29
+ ### File Size Categories
30
+
31
+ | Category | Lines | Est. Tokens | Action |
32
+ |----------|-------|-------------|--------|
33
+ | Small | <50 | <200 | Load freely |
34
+ | Medium | 50-200 | 200-800 | Consider outline first |
35
+ | Large | 200-500 | 800-2000 | Use search + snippets |
36
+ | Huge | 500+ | 2000+ | Never load fully |
37
+
38
+ ---
39
+
40
+ ## Budget Thresholds
41
+
42
+ Based on PROJECT_RULES.md context quality thresholds:
43
+
44
+ | Usage | Quality | Budget Status |
45
+ |-------|---------|---------------|
46
+ | 0-30% | PEAK | ✅ Proceed freely |
47
+ | 30-50% | GOOD | ⚠️ Be selective |
48
+ | 50-70% | DEGRADING | 🔶 Compress & summarize |
49
+ | 70%+ | POOR | 🛑 State dump required |
50
+
51
+ ---
52
+
53
+ ## Budget Tracking Protocol
54
+
55
+ ### Before Each Task
56
+
57
+ 1. **Estimate current usage:**
58
+ - Count files in context
59
+ - Estimate tokens per file
60
+ - Calculate approximate %
61
+
62
+ 2. **Check budget status:**
63
+ ```
64
+ Current: ~X,000 tokens (~Y%)
65
+ Budget: [PEAK|GOOD|DEGRADING|POOR]
66
+ ```
67
+
68
+ 3. **Adjust strategy:**
69
+ - PEAK: Proceed normally
70
+ - GOOD: Prefer search-first
71
+ - DEGRADING: Use outlines only
72
+ - POOR: Trigger state dump
73
+
74
+ ### During Execution
75
+
76
+ Track cumulative context:
77
+
78
+ ```markdown
79
+ ## Token Tracker
80
+
81
+ | Phase | Files Loaded | Est. Tokens | Cumulative |
82
+ |-------|--------------|-------------|------------|
83
+ | Start | 0 | 0 | 0 |
84
+ | Task 1 | 2 | ~400 | ~400 |
85
+ | Task 2 | 3 | ~600 | ~1000 |
86
+ ```
87
+
88
+ ---
89
+
90
+ ## Optimization Strategies
91
+
92
+ ### 1. Progressive Loading
93
+
94
+ ```
95
+ Level 1: Outline only (function signatures)
96
+ Level 2: + Key functions (based on task)
97
+ Level 3: + Related code (if needed)
98
+ Level 4: Full file (only if essential)
99
+ ```
100
+
101
+ ### 2. Just-In-Time Loading
102
+
103
+ - Load file only when task requires it
104
+ - Unload mentally after task complete
105
+ - Don't preload "just in case"
106
+
107
+ ### 3. Search Before Load
108
+
109
+ Always use context-fetch skill first:
110
+ 1. Search for relevant terms
111
+ 2. Identify candidate files
112
+ 3. Load only needed sections
113
+
114
+ ### 4. Summarize & Compress
115
+
116
+ After understanding a file:
117
+ - Document key insights in STATE.md
118
+ - Reference summary instead of re-reading
119
+ - Use "I've analyzed X, it does Y" pattern
120
+
121
+ ---
122
+
123
+ ## Budget Alerts
124
+
125
+ ### At 50% Budget
126
+
127
+ ```
128
+ ⚠️ TOKEN BUDGET: 50%
129
+ Switching to efficiency mode:
130
+ - Outlines only for new files
131
+ - Summarizing instead of loading
132
+ - Recommending compression
133
+ ```
134
+
135
+ ### At 70% Budget
136
+
137
+ ```
138
+ 🛑 TOKEN BUDGET: 70%
139
+ Quality degradation likely. Recommend:
140
+ 1. Create state snapshot
141
+ 2. Run /pause
142
+ 3. Continue in fresh session
143
+ ```
144
+
145
+ ---
146
+
147
+ ## Integration
148
+
149
+ This skill integrates with:
150
+ - `context-fetch` — Search before loading
151
+ - `context-health-monitor` — Quality tracking
152
+ - `context-compressor` — Compression strategies
153
+ - `/pause` and `/resume` — Session handoff
154
+
155
+ ---
156
+
157
+ ## Anti-Patterns
158
+
159
+ ❌ **Loading files "for context"** — Search first
160
+ ❌ **Re-reading same file** — Summarize once
161
+ ❌ **Full file when snippet suffices** — Target load
162
+ ❌ **Ignoring budget warnings** — Quality will degrade
163
+
164
+ ---
165
+
166
+ *Part of GSD v1.6 Token Optimization. See PROJECT_RULES.md for efficiency rules.*
.agents/skills/verifier/SKILL.md ADDED
@@ -0,0 +1,421 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: verifier
3
+ description: Validates implemented work against spec requirements with empirical evidence
4
+ ---
5
+
6
+ # GSD Verifier Agent
7
+
8
+ <role>
9
+ You are a GSD verifier. You validate that implemented work achieves the stated phase goal through empirical evidence, not claims.
10
+
11
+ Your job: Verify must-haves, detect stubs, identify gaps, and produce VERIFICATION.md with structured findings.
12
+ </role>
13
+
14
+ ---
15
+
16
+ ## Core Principle
17
+
18
+ **Trust nothing. Verify everything.**
19
+
20
+ - SUMMARY.md says "completed" → Verify it actually works
21
+ - Code exists → Verify it's substantive, not a stub
22
+ - Function is called → Verify the wiring actually connects
23
+ - Tests pass → Verify they test the right things
24
+
25
+ ---
26
+
27
+ ## Verification Process
28
+
29
+ ### Step 0: Check for Previous Verification
30
+
31
+ Before starting fresh, check if a previous VERIFICATION.md exists:
32
+
33
+ ```powershell
34
+ Get-ChildItem ".gsd/phases/{N}/*-VERIFICATION.md" -ErrorAction SilentlyContinue
35
+ ```
36
+
37
+ **If previous verification exists with gaps → RE-VERIFICATION MODE:**
38
+ 1. Parse previous VERIFICATION.md
39
+ 2. Extract must-haves (truths, artifacts, key_links)
40
+ 3. Extract gaps (items that failed)
41
+ 4. Set `is_re_verification = true`
42
+ 5. **Skip to Step 3** with optimization:
43
+ - **Failed items:** Full 3-level verification
44
+ - **Passed items:** Quick regression check only
45
+
46
+ **If no previous verification → INITIAL MODE:**
47
+ Set `is_re_verification = false`, proceed with Step 1.
48
+
49
+ ---
50
+
51
+ ### Step 1: Load Context (Initial Mode Only)
52
+
53
+ Gather verification context:
54
+
55
+ ```powershell
56
+ # Phase PLANs and SUMMARYs
57
+ Get-ChildItem ".gsd/phases/{N}/*-PLAN.md"
58
+ Get-ChildItem ".gsd/phases/{N}/*-SUMMARY.md"
59
+
60
+ # Phase goal from ROADMAP
61
+ Select-String -Path ".gsd/ROADMAP.md" -Pattern "Phase {N}"
62
+ ```
63
+
64
+ Extract phase goal from ROADMAP.md. This is the outcome to verify, not the tasks.
65
+
66
+ ---
67
+
68
+ ### Step 2: Establish Must-Haves (Initial Mode Only)
69
+
70
+ **Option A: Must-haves in PLAN frontmatter**
71
+
72
+ ```yaml
73
+ must_haves:
74
+ truths:
75
+ - "User can see existing messages"
76
+ - "User can send a message"
77
+ artifacts:
78
+ - path: "src/components/Chat.tsx"
79
+ provides: "Message list rendering"
80
+ key_links:
81
+ - from: "Chat.tsx"
82
+ to: "api/chat"
83
+ via: "fetch in useEffect"
84
+ ```
85
+
86
+ **Option B: Derive from phase goal**
87
+
88
+ 1. **State the goal:** Take phase goal from ROADMAP.md
89
+ 2. **Derive truths:** "What must be TRUE for this goal?"
90
+ - List 3-7 observable behaviors from user perspective
91
+ - Each truth should be testable
92
+ 3. **Derive artifacts:** "What must EXIST?"
93
+ - Map truths to concrete files
94
+ - Be specific: `src/components/Chat.tsx`, not "chat component"
95
+ 4. **Derive key links:** "What must be CONNECTED?"
96
+ - Identify critical wiring (component → API → DB)
97
+ - These are where stubs hide
98
+
99
+ ---
100
+
101
+ ### Step 3: Verify Observable Truths
102
+
103
+ For each truth, determine if codebase enables it.
104
+
105
+ **Verification status:**
106
+ - ✓ VERIFIED: All supporting artifacts pass all checks
107
+ - ✗ FAILED: Artifacts missing, stub, or unwired
108
+ - ? UNCERTAIN: Can't verify programmatically (needs human)
109
+
110
+ For each truth:
111
+ 1. Identify supporting artifacts
112
+ 2. Check artifact status (Step 4)
113
+ 3. Check wiring status (Step 5)
114
+ 4. Determine truth status
115
+
116
+ ---
117
+
118
+ ### Step 4: Verify Artifacts (Three Levels)
119
+
120
+ For each required artifact, verify three levels:
121
+
122
+ #### Level 1: Existence
123
+ ```powershell
124
+ Test-Path "src/components/Chat.tsx"
125
+ ```
126
+ - File exists at expected path
127
+ - **If missing:** FAILED at Level 1
128
+
129
+ #### Level 2: Substantive
130
+ ```powershell
131
+ Get-Content "src/components/Chat.tsx" | Select-String -Pattern "TODO|placeholder|stub"
132
+ ```
133
+ - File contains real implementation
134
+ - Not a stub, placeholder, or minimal scaffold
135
+ - **If stub detected:** FAILED at Level 2
136
+
137
+ #### Level 3: Wired
138
+ - Imports are used, not just present
139
+ - Exports are consumed by other files
140
+ - Functions are called with correct arguments
141
+ - **If unwired:** FAILED at Level 3
142
+
143
+ ---
144
+
145
+ ### Step 5: Verify Key Links (Wiring)
146
+
147
+ For each key link, verify the connection exists:
148
+
149
+ **Pattern: Component → API**
150
+ ```powershell
151
+ # Check Chat.tsx calls /api/chat
152
+ Select-String -Path "src/components/Chat.tsx" -Pattern "fetch.*api/chat"
153
+ ```
154
+
155
+ **Pattern: API → Database**
156
+ ```powershell
157
+ # Check route calls prisma
158
+ Select-String -Path "src/app/api/chat/route.ts" -Pattern "prisma\."
159
+ ```
160
+
161
+ **Pattern: Form → Handler**
162
+ ```powershell
163
+ # Check onSubmit has implementation
164
+ Select-String -Path "src/components/Form.tsx" -Pattern "onSubmit" -Context 0,5
165
+ ```
166
+
167
+ **Pattern: State → Render**
168
+ ```powershell
169
+ # Check state is used in JSX
170
+ Select-String -Path "src/components/Chat.tsx" -Pattern "messages\.map"
171
+ ```
172
+
173
+ ---
174
+
175
+ ### Step 6: Check Requirements Coverage
176
+
177
+ If REQUIREMENTS.md exists:
178
+
179
+ ```powershell
180
+ Select-String -Path ".gsd/REQUIREMENTS.md" -Pattern "Phase {N}"
181
+ ```
182
+
183
+ For each requirement:
184
+ 1. Identify which truths/artifacts support it
185
+ 2. Determine status based on supporting infrastructure
186
+
187
+ **Requirement status:**
188
+ - ✓ SATISFIED: All supporting truths verified
189
+ - ✗ BLOCKED: Supporting truths failed
190
+ - ? NEEDS HUMAN: Can't verify programmatically
191
+
192
+ ---
193
+
194
+ ### Step 7: Scan for Anti-Patterns
195
+
196
+ Run anti-pattern detection on modified files:
197
+
198
+ ```powershell
199
+ # TODO/FIXME comments
200
+ Select-String -Path "src/**/*.ts" -Pattern "TODO|FIXME|XXX|HACK"
201
+
202
+ # Placeholder content
203
+ Select-String -Path "src/**/*.tsx" -Pattern "placeholder|coming soon"
204
+
205
+ # Empty implementations
206
+ Select-String -Path "src/**/*.ts" -Pattern "return null|return \{\}|return \[\]"
207
+
208
+ # Console.log only
209
+ Select-String -Path "src/**/*.ts" -Pattern "console\.log" -Context 2
210
+ ```
211
+
212
+ **Categorize findings:**
213
+ - 🛑 Blocker: Prevents goal achievement
214
+ - ⚠️ Warning: Indicates incomplete work
215
+ - ℹ️ Info: Notable but not problematic
216
+
217
+ ---
218
+
219
+ ### Step 8: Identify Human Verification Needs
220
+
221
+ Some things can't be verified programmatically:
222
+
223
+ **Always needs human:**
224
+ - Visual appearance (does it look right?)
225
+ - User flow completion
226
+ - Real-time behavior (WebSocket, SSE)
227
+ - External service integration
228
+ - Performance feel
229
+ - Error message clarity
230
+
231
+ **Format:**
232
+ ```markdown
233
+ ### 1. {Test Name}
234
+ **Test:** {What to do}
235
+ **Expected:** {What should happen}
236
+ **Why human:** {Why can't verify programmatically}
237
+ ```
238
+
239
+ ---
240
+
241
+ ### Step 9: Determine Overall Status
242
+
243
+ **Status: passed**
244
+ - All truths VERIFIED
245
+ - All artifacts pass levels 1-3
246
+ - All key links WIRED
247
+ - No blocker anti-patterns
248
+
249
+ **Status: gaps_found**
250
+ - One or more truths FAILED
251
+ - OR artifacts MISSING/STUB
252
+ - OR key links NOT_WIRED
253
+ - OR blocker anti-patterns found
254
+
255
+ **Status: human_needed**
256
+ - All automated checks pass
257
+ - BUT items flagged for human verification
258
+
259
+ **Calculate score:**
260
+ ```
261
+ score = verified_truths / total_truths
262
+ ```
263
+
264
+ ---
265
+
266
+ ### Step 10: Structure Gap Output
267
+
268
+ When gaps found, structure for `/plan --gaps`:
269
+
270
+ ```yaml
271
+ ---
272
+ phase: {N}
273
+ verified: {timestamp}
274
+ status: gaps_found
275
+ score: {N}/{M} must-haves verified
276
+ gaps:
277
+ - truth: "User can see existing messages"
278
+ status: failed
279
+ reason: "Chat.tsx doesn't fetch from API"
280
+ artifacts:
281
+ - path: "src/components/Chat.tsx"
282
+ issue: "No useEffect with fetch call"
283
+ missing:
284
+ - "API call in useEffect to /api/chat"
285
+ - "State for storing fetched messages"
286
+ - "Render messages array in JSX"
287
+ ---
288
+ ```
289
+
290
+ ---
291
+
292
+ ## Stub Detection Patterns
293
+
294
+ ### Universal Stub Patterns
295
+ ```powershell
296
+ # Comment-based stubs
297
+ Select-String -Pattern "TODO|FIXME|XXX|HACK|PLACEHOLDER"
298
+
299
+ # Placeholder text
300
+ Select-String -Pattern "placeholder|lorem ipsum|coming soon"
301
+
302
+ # Empty implementations
303
+ Select-String -Pattern "return null|return undefined|return \{\}|return \[\]"
304
+ ```
305
+
306
+ ### React Component Stubs
307
+ ```javascript
308
+ // RED FLAGS:
309
+ return <div>Component</div>
310
+ return <div>Placeholder</div>
311
+ return <div>{/* TODO */}</div>
312
+ return null
313
+ return <></>
314
+
315
+ // Empty handlers:
316
+ onClick={() => {}}
317
+ onChange={() => console.log('clicked')}
318
+ onSubmit={(e) => e.preventDefault()} // Only prevents default
319
+ ```
320
+
321
+ ### API Route Stubs
322
+ ```typescript
323
+ // RED FLAGS:
324
+ export async function POST() {
325
+ return Response.json({ message: "Not implemented" });
326
+ }
327
+
328
+ export async function GET() {
329
+ return Response.json([]); // Empty array, no DB query
330
+ }
331
+
332
+ // Console log only:
333
+ export async function POST(req) {
334
+ console.log(await req.json());
335
+ return Response.json({ ok: true });
336
+ }
337
+ ```
338
+
339
+ ### Wiring Red Flags
340
+ ```typescript
341
+ // Fetch exists but response ignored:
342
+ fetch('/api/messages') // No await, no .then
343
+
344
+ // Query exists but result not returned:
345
+ await prisma.message.findMany()
346
+ return Response.json({ ok: true }) // Returns static, not query
347
+
348
+ // Handler only prevents default:
349
+ onSubmit={(e) => e.preventDefault()}
350
+
351
+ // State exists but not rendered:
352
+ const [messages, setMessages] = useState([])
353
+ return <div>No messages</div> // Always shows static
354
+ ```
355
+
356
+ ---
357
+
358
+ ## VERIFICATION.md Format
359
+
360
+ ```markdown
361
+ ---
362
+ phase: {N}
363
+ verified: {timestamp}
364
+ status: {passed | gaps_found | human_needed}
365
+ score: {N}/{M} must-haves verified
366
+ is_re_verification: {true | false}
367
+ gaps: [...] # If gaps_found
368
+ ---
369
+
370
+ # Phase {N} Verification
371
+
372
+ ## Must-Haves
373
+
374
+ ### Truths
375
+ | Truth | Status | Evidence |
376
+ |-------|--------|----------|
377
+ | {truth 1} | ✓ VERIFIED | {how verified} |
378
+ | {truth 2} | ✗ FAILED | {what's missing} |
379
+
380
+ ### Artifacts
381
+ | Path | Exists | Substantive | Wired |
382
+ |------|--------|-------------|-------|
383
+ | src/components/Chat.tsx | ✓ | ✓ | ✗ |
384
+
385
+ ### Key Links
386
+ | From | To | Via | Status |
387
+ |------|-----|-----|--------|
388
+ | Chat.tsx | api/chat | fetch | ✗ NOT_WIRED |
389
+
390
+ ## Anti-Patterns Found
391
+ - 🛑 {blocker}
392
+ - ⚠️ {warning}
393
+
394
+ ## Human Verification Needed
395
+ ### 1. Visual Review
396
+ **Test:** Open http://localhost:3000/chat
397
+ **Expected:** Message list renders with real data
398
+ **Why human:** Visual layout verification
399
+
400
+ ## Gaps (if any)
401
+ {Structured gap analysis for planner}
402
+
403
+ ## Verdict
404
+ {Status explanation}
405
+ ```
406
+
407
+ ---
408
+
409
+ ## Success Criteria
410
+
411
+ - [ ] Previous VERIFICATION.md checked
412
+ - [ ] Must-haves established (from frontmatter or derived)
413
+ - [ ] All truths verified with status and evidence
414
+ - [ ] All artifacts checked at 3 levels (exists, substantive, wired)
415
+ - [ ] All key links verified
416
+ - [ ] Anti-patterns scanned and categorized
417
+ - [ ] Human verification items identified
418
+ - [ ] Overall status determined
419
+ - [ ] Gaps structured in YAML (if gaps_found)
420
+ - [ ] VERIFICATION.md created
421
+ - [ ] Results returned to orchestrator
.gemini/GEMINI.md ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GSD Methodology — Mission Control Rules
2
+
3
+ > **Get Shit Done**: A spec-driven, context-engineered development methodology.
4
+ >
5
+ > These rules enforce disciplined, high-quality autonomous development.
6
+
7
+ ---
8
+
9
+ ## Canonical Rules
10
+
11
+ **All canonical rules are in [PROJECT_RULES.md](../PROJECT_RULES.md).**
12
+
13
+ This file provides Gemini-specific integration. For the complete methodology, see PROJECT_RULES.md.
14
+
15
+ ---
16
+
17
+ ## Core Principles
18
+
19
+ 1. **Plan Before You Build** — No code without specification
20
+ 2. **State Is Sacred** — Every action updates persistent memory
21
+ 3. **Context Is Limited** — Prevent degradation through hygiene
22
+ 4. **Verify Empirically** — No "trust me, it works"
23
+
24
+ ---
25
+
26
+ ## Quick Reference
27
+
28
+ ```
29
+ Before coding → Check SPEC.md is FINALIZED
30
+ Before file read → Search first, then targeted read
31
+ After each task → Update STATE.md
32
+ After 3 failures → State dump + fresh session
33
+ Before "Done" → Empirical proof captured
34
+ ```
35
+
36
+ ---
37
+
38
+ ## Workflow Integration
39
+
40
+ These rules integrate with the GSD workflows:
41
+
42
+ | Workflow | Rules Enforced |
43
+ |----------|----------------|
44
+ | `/map` | Updates ARCHITECTURE.md, STACK.md |
45
+ | `/plan` | Enforces Planning Lock, creates ROADMAP |
46
+ | `/execute` | Enforces State Persistence after each task |
47
+ | `/verify` | Enforces Empirical Validation |
48
+ | `/pause` | Triggers Context Hygiene state dump |
49
+ | `/resume` | Loads state from STATE.md |
50
+
51
+ ---
52
+
53
+ ## Gemini-Specific Tips
54
+
55
+ For Gemini-specific enhancements, see [adapters/GEMINI.md](../adapters/GEMINI.md).
56
+
57
+ Key recommendations:
58
+ - **Flash** for quick iterations and simple edits
59
+ - **Pro** for complex planning and analysis
60
+ - Large context is available but **search-first** still applies
61
+
62
+ ---
63
+
64
+ *GSD Methodology adapted for Google Antigravity*
65
+ *Canonical rules: [PROJECT_RULES.md](../PROJECT_RULES.md)*
66
+ *Source: https://github.com/glittercowboy/get-shit-done*
67
+
.gsd/ARCHITECTURE.md ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ARCHITECTURE.md — System Overview
2
+
3
+ > Generated: 2026-06-21 | Status: Current
4
+
5
+ ## System Overview
6
+
7
+ **HALE** (Adaptive Learning Engine) is a FastAPI-based backend serving an AI-powered personal learning coach. It uses a Contextual Multi-Armed Bandit RL engine (`rl_engine.py`) to recommend daily learning intensities, a Gemini-powered planner to generate daily task sequences, and a PostgreSQL database (SQLite in dev) to persist user state and progress.
8
+
9
+ ## Tech Stack
10
+
11
+ | Layer | Technology |
12
+ |-------|-----------|
13
+ | API Framework | FastAPI 0.115+ |
14
+ | ASGI Server | Uvicorn (2 workers in prod) |
15
+ | Database | PostgreSQL 16 (prod) / SQLite (dev) |
16
+ | ORM | SQLAlchemy 2.0 |
17
+ | Migrations | Alembic |
18
+ | Auth | python-jose JWT + bcrypt |
19
+ | AI/LLM | Google Gemini (multi-key failover) |
20
+ | Caching / State | Redis 7 (optional in dev) |
21
+ | Rate Limiting | slowapi |
22
+ | Scheduling | APScheduler (cron at 2 AM IST) |
23
+ | Observability | Sentry SDK (optional) |
24
+ | Containerization | Docker + docker-compose |
25
+
26
+ ## Directory Structure
27
+
28
+ ```
29
+ app/
30
+ ├── main.py # App factory, middleware, scheduler, health endpoints
31
+ ├── core/
32
+ │ ├── config.py # Pydantic Settings (env-based)
33
+ │ ├── database.py # SQLAlchemy engine, SessionLocal, Base, init_db
34
+ │ ├── security.py # JWT creation/validation, bcrypt, blacklist, versioning
35
+ │ ├── exceptions.py # Global exception handlers
36
+ │ └── redis_client.py # [PLANNED] Redis connection pool with fallback
37
+ ├── api/
38
+ │ ├── auth.py # /register, /login, /refresh, /logout, /profile
39
+ │ ├── goals.py # /api/goals CRUD
40
+ │ ├── plans.py # /api/plan, /api/complete, /api/skip, /api/stats
41
+ │ └── schedule.py # /api/schedule, /api/timetable
42
+ ├── models/
43
+ │ ├── user.py # User model (RL state, bandit params, streaks, XP)
44
+ │ ├── goal.py # Goal model (plan JSON, completion %)
45
+ │ ├── progress.py # Progress model (daily tasks, mood, RL signals)
46
+ │ └── session.py # UserSession model (refresh token selector-verifier)
47
+ ├── schemas/
48
+ │ ├── auth.py # RegisterRequest, LoginRequest, TokenResponse, etc.
49
+ │ └── goals.py # SetGoalRequest, DailyPlanResponse, etc.
50
+ └── services/
51
+ ├── rl_engine.py # Contextual Bandit (Thompson Sampling), behavior signals
52
+ ├── planner.py # Daily plan generation, timetable, spaced repetition, XP
53
+ ├── llm_service.py # Gemini API calls, plan generation, lesson content
54
+ ├── day_closer.py # Auto-close daily tasks, RL reward dispatch
55
+ └── notifications.py # Streak risk, level-up, re-engagement signals
56
+
57
+ alembic/ # Database migration scripts
58
+ tests/ # pytest test suite
59
+ ```
60
+
61
+ ## Key Data Flows
62
+
63
+ ### Daily Plan Request (GET /api/plan)
64
+ 1. JWT auth → load User
65
+ 2. `rl_engine.get_stable_signal()` → cached RL decision (or fresh compute)
66
+ 3. `planner.generate_unified_daily_plan()` → queries Progress, builds tasks
67
+ 4. Coach message via Gemini (`generate_coach_message`)
68
+ 5. Notifications appended, response returned
69
+
70
+ ### Task Completion (POST /api/complete)
71
+ 1. JWT auth → load User + Progress row
72
+ 2. Mark `completed=True`, store actual duration, satisfaction
73
+ 3. `rl_engine.update_reward()` → update bandit alpha/beta
74
+ 4. `planner.award_xp()` + `update_streak()` → update User
75
+ 5. `reset_daily_state()` → clear cached RL decision
76
+
77
+ ## Current Limitations (to be fixed)
78
+
79
+ | Issue | Location | Impact |
80
+ |-------|----------|--------|
81
+ | In-memory token blacklist | `security.py` `_blacklist` | Logout doesn't propagate across workers |
82
+ | In-memory user versions | `security.py` `_user_versions` | Session invalidation broken in multi-worker |
83
+ | In-memory coach cache | `planner.py` `_coach_cache` | Cache doesn't share between workers; can grow unbounded |
84
+ | No lesson cache | `llm_service.py` | Every lesson call hits Gemini API |
85
+ | No distributed lock on scheduler | `main.py` | Auto-close runs N times with N workers |
86
+ | Rate limiter per-worker | `main.py` | Rate limits multiplied by worker count |
.gsd/DECISIONS.md ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DECISIONS.md — Architecture Decision Records
2
+
3
+ ## ADR-001: Redis Fallback Strategy
4
+
5
+ **Date:** 2026-06-21
6
+ **Status:** Accepted
7
+
8
+ **Context:** The system must support both local development (no Redis) and production (Redis required).
9
+
10
+ **Decision:** The `redis_client.py` module will expose a wrapper that falls back to in-memory Python structures when `REDIS_URL` is not configured. This is implemented via a simple flag check so that no code in the callers needs to change.
11
+
12
+ **Consequences:** Development experience is preserved. Security warning: running production without Redis silently degrades to in-memory state — we will log a WARNING if `APP_ENV=production` and `REDIS_URL` is unset.
13
+
14
+ ---
15
+
16
+ ## ADR-002: Distributed Scheduler Lock via Redis SET NX
17
+
18
+ **Date:** 2026-06-21
19
+ **Status:** Accepted
20
+
21
+ **Context:** APScheduler runs inside the Uvicorn process. With `--workers 2`, both worker processes will independently trigger the 2 AM cron job, causing double XP/reward updates and double-closing of tasks.
22
+
23
+ **Decision:** Use a Redis `SET NX EX` (set-if-not-exists with expiry) lock before running the job body. Only the worker that acquires the lock proceeds; the other silently skips. Lock TTL is set to 300 seconds (5 minutes) to ensure auto-release in case of a crash.
24
+
25
+ **Alternatives Rejected:** Celery Beat in a separate container — too much infrastructure overhead for this milestone.
26
+
27
+ ---
28
+
29
+ ## ADR-003: slowapi Redis Storage Backend
30
+
31
+ **Date:** 2026-06-21
32
+ **Status:** Accepted
33
+
34
+ **Context:** `slowapi` defaults to in-memory storage. With multiple workers, each maintains its own counter — a user can effectively multiply their allowed request count by the number of workers.
35
+
36
+ **Decision:** Configure `slowapi.Limiter` with `storage_uri=settings.REDIS_URL` when Redis is available. This unifies the rate limit counters globally.
37
+
38
+ **Consequences:** Rate limiting is now consistent and accurate. If Redis is unavailable, the limiter falls back to in-memory (same as current behavior) and logs a WARNING.
39
+
40
+ ---
41
+
42
+ ## ADR-004: Token Blacklist TTL = ACCESS_TOKEN_EXPIRE_MINUTES
43
+
44
+ **Date:** 2026-06-21
45
+ **Status:** Accepted
46
+
47
+ **Context:** JWTs are blacklisted on logout. Storing them forever in Redis is wasteful.
48
+
49
+ **Decision:** Set the Redis key TTL for each blacklisted `jti` to exactly `ACCESS_TOKEN_EXPIRE_MINUTES * 60` seconds. After that, the token would have expired anyway, so the blacklist entry is no longer needed.
50
+
51
+ **Consequences:** Redis memory usage is bounded and proportional to `ACCESS_TOKEN_EXPIRE_MINUTES` × active logout rate.
.gsd/ROADMAP.md ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ milestone: Production Backend Hardening
3
+ version: 1.0.0
4
+ updated: 2026-06-21T10:43:00Z
5
+ ---
6
+
7
+ # Roadmap
8
+
9
+ > **Current Phase:** 1 - Foundation (Redis Client & Config)
10
+ > **Status:** planning
11
+
12
+ ## Must-Haves (from SPEC)
13
+
14
+ - [ ] Multi-worker safe token blacklist and session invalidation via Redis
15
+ - [ ] APScheduler day-close job runs exactly once per cron tick, even with multiple workers
16
+ - [ ] Distributed rate limits apply globally across all FastAPI workers
17
+ - [ ] PostgreSQL connection pooling correctly tuned for production
18
+ - [ ] SECRET_KEY validation raises on production startup if default is used
19
+
20
+ ---
21
+
22
+ ## Phases
23
+
24
+ ### Phase 1: Foundation — Redis Client & Config Hardening
25
+ **Status:** ⬜ Not Started
26
+ **Objective:** Introduce a centralized Redis connection helper and harden the config/database layers for production.
27
+ **Files:**
28
+ - `app/core/config.py` — Add production SECRET_KEY guard
29
+ - `app/core/database.py` — Apply PG connection pooling
30
+ - `app/core/redis_client.py` — [NEW] Singleton Redis client with graceful memory fallback
31
+
32
+ **Plans:**
33
+ - [ ] Plan 1.1: Create `redis_client.py` with connection pool and in-memory fallback
34
+ - [ ] Plan 1.2: Harden `config.py` with production SECRET_KEY validation
35
+ - [ ] Plan 1.3: Configure PostgreSQL pool size in `database.py`
36
+
37
+ ---
38
+
39
+ ### Phase 2: Distributed Security — Token Blacklist & Session Invalidation
40
+ **Status:** ⬜ Not Started
41
+ **Objective:** Replace in-memory `_blacklist` (set) and `_user_versions` (dict) in `security.py` with Redis-backed storage.
42
+ **Depends on:** Phase 1
43
+ **Files:**
44
+ - `app/core/security.py` — Refactor blacklist and user version lookups
45
+
46
+ **Plans:**
47
+ - [ ] Plan 2.1: Migrate `_blacklist` to Redis with TTL matching access token expiry
48
+ - [ ] Plan 2.2: Migrate `_user_versions` to Redis hash with `HSET/HGET`
49
+
50
+ ---
51
+
52
+ ### Phase 3: Distributed Rate Limiting & Caches
53
+ **Status:** ⬜ Not Started
54
+ **Objective:** Move the `slowapi` rate limiter and in-memory coach message cache to Redis.
55
+ **Depends on:** Phase 1
56
+ **Files:**
57
+ - `app/core/limiter.py` — [NEW] Centralized limiter with Redis storage backend
58
+ - `app/api/auth.py` — Update limiter import
59
+ - `app/main.py` — Update limiter import and add TrustedHostMiddleware
60
+ - `app/services/planner.py` — Replace `_coach_cache` dict with Redis
61
+
62
+ **Plans:**
63
+ - [ ] Plan 3.1: Create `limiter.py` with Redis storage, update auth.py and main.py imports
64
+ - [ ] Plan 3.2: Replace `_coach_cache` in `planner.py` with Redis calls (TTL = 24h)
65
+
66
+ ---
67
+
68
+ ### Phase 4: Lesson Cache & Scheduler Lock
69
+ **Status:** ⬜ Not Started
70
+ **Objective:** Cache LLM-generated lesson content and prevent duplicate APScheduler job execution across workers.
71
+ **Depends on:** Phase 1
72
+ **Files:**
73
+ - `app/services/llm_service.py` — Add Redis lesson cache
74
+ - `app/main.py` — Add Redis-based distributed lock to APScheduler job
75
+
76
+ **Plans:**
77
+ - [ ] Plan 4.1: Cache `generate_lesson_text` results in Redis (TTL = 7 days)
78
+ - [ ] Plan 4.2: Wrap APScheduler `_auto_close_job` with Redis `SET NX` distributed lock
79
+
80
+ ---
81
+
82
+ ## Progress Summary
83
+
84
+ | Phase | Status | Plans | Complete |
85
+ |-------|--------|-------|----------|
86
+ | 1 | ⬜ | 0/3 | — |
87
+ | 2 | ⬜ | 0/2 | — |
88
+ | 3 | ⬜ | 0/2 | — |
89
+ | 4 | ⬜ | 0/2 | — |
90
+
91
+ ---
92
+
93
+ ## Timeline
94
+
95
+ | Phase | Started | Completed | Duration |
96
+ |-------|---------|-----------|----------|
97
+ | 1 | — | — | — |
98
+ | 2 | — | — | — |
99
+ | 3 | — | — | — |
100
+ | 4 | — | — | — |
.gsd/SPEC.md ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SPEC.md — Project Specification
2
+
3
+ > **Status**: `FINALIZED`
4
+ >
5
+ > ⚠️ **Planning Lock**: No code may be written until this spec is marked `FINALIZED`.
6
+
7
+ ## Vision
8
+ This project aims to refactor the HALE backend from a single-worker, in-memory state system into a robust, multi-node, production-ready backend. The primary driver is leveraging Redis for global state (caches, sessions, scheduler locks, rate limits) to safely allow horizontal scaling across multiple FastAPI workers and containers.
9
+
10
+ ## Goals
11
+ 1. **Shared Redis State** — Migrate `_coach_cache`, `_user_versions`, and `_blacklist` to Redis to prevent memory leaks and synchronize state across workers.
12
+ 2. **Distributed Job Locks** — Prevent the `apscheduler` daily cron job from running multiple times concurrently when `--workers 2` is used.
13
+ 3. **Distributed Rate Limiting** — Connect the `slowapi` limiter to Redis so that API rate limits apply globally instead of per worker.
14
+ 4. **Production Configuration** — Enforce PostgreSQL connection pooling and validate `SECRET_KEY` in production environments.
15
+ 5. **Lesson Caching** — Cache generated lesson content from Gemini to save tokens, speed up responses, and reduce API load.
16
+
17
+ ## Non-Goals (Out of Scope)
18
+ - Complete rewrite of the frontend or AI logic.
19
+ - Migration away from FastAPI or SQLAlchemy.
20
+ - Removing SQLite entirely (it must remain supported for local development).
21
+
22
+ ## Constraints
23
+ - Must remain compatible with the existing `docker-compose.yml` which defines a `redis` and `db` service.
24
+ - The transition to Redis must degrade gracefully to memory in development if `REDIS_URL` is not set.
25
+
26
+ ## Success Criteria
27
+ - [ ] Multiple FastAPI workers can boot and share the revoked token blacklist.
28
+ - [ ] The `day_closer` auto-close job executes exactly once per scheduled time, regardless of worker count.
29
+ - [ ] Rate limits successfully trigger based on aggregate requests across all workers.
30
+ - [ ] Repeated calls for the same lesson topic load instantly from cache.
31
+
32
+ ## Technical Requirements (Optional)
33
+
34
+ | Requirement | Priority | Notes |
35
+ |-------------|----------|-------|
36
+ | Redis integration | Must-have | The core of the production refactor |
37
+ | Connection Pooling | Must-have | For PostgreSQL reliability |
38
+ | Trusted Hosts | Should-have | Security best practice |
39
+
40
+ ---
41
+
42
+ *Last updated: 2026-06-21*
.gsd/STATE.md ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ updated: 2026-06-21T10:51:00Z
3
+ ---
4
+
5
+ # Project State
6
+
7
+ ## Current Position
8
+
9
+ **Milestone:** Production Backend Hardening
10
+ **Phase:** ALL PHASES COMPLETE
11
+ **Status:** verifying
12
+ **Plan:** —
13
+
14
+ ## Last Action
15
+
16
+ Executed all 4 phases of the production hardening plan:
17
+ - Phase 1: Created `redis_client.py`, hardened `config.py`, tuned DB pool
18
+ - Phase 2: Centralized Redis import in `security.py`
19
+ - Phase 3: Created `limiter.py`, updated `main.py` + `auth.py`, coach cache → Redis
20
+ - Phase 4: Lesson cache in `llm_service.py` (7d TTL), scheduler distributed lock in `main.py`
21
+
22
+ ## Next Steps
23
+
24
+ 1. Run `pytest` to verify no regressions
25
+ 2. Spin up `docker-compose up --build` to verify multi-worker boot
26
+ 3. Run `/verify` to audit work against SPEC must-haves
27
+
28
+ ## Active Decisions
29
+
30
+ | Decision | Choice | Made | Affects |
31
+ |----------|--------|------|---------|
32
+ | Redis fallback | Use in-memory fallback in dev when `REDIS_URL` not set | 2026-06-21 | All phases |
33
+ | Scheduler strategy | Redis `SET NX` lock (keep single container) | 2026-06-21 | Phase 4 |
34
+ | Lesson cache TTL | 7 days | 2026-06-21 | Phase 4 |
35
+ | Coach message TTL | 24 hours | 2026-06-21 | Phase 3 |
36
+ | Blacklist TTL | Match `ACCESS_TOKEN_EXPIRE_MINUTES` | 2026-06-21 | Phase 2 |
37
+
38
+ ## Blockers
39
+
40
+ None
41
+
42
+ ## Concerns
43
+
44
+ - APScheduler runs inside the Uvicorn process; a fully separate Celery worker would be cleaner but is out of scope for this milestone.
45
+ - `secrets.token_hex` SECRET_KEY validation must not block startup in local dev.
46
+
47
+ ## Session Context
48
+
49
+ Full backend audit completed. All in-memory state identified: `_blacklist` (set in security.py), `_user_versions` (dict in security.py), `_coach_cache` (dict in planner.py), and lesson text (not cached at all). Redis client will be the foundation (Phase 1) that unblocks all subsequent phases.
.gsd/examples/cross-platform.md ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Cross-Platform Commands Reference
2
+
3
+ > PowerShell ↔ Bash equivalents for GSD workflows
4
+
5
+ ## Common Operations
6
+
7
+ | Operation | PowerShell | Bash |
8
+ |-----------|------------|------|
9
+ | **Test file exists** | `Test-Path "file.md"` | `test -f "file.md"` |
10
+ | **Test directory exists** | `Test-Path "dir" -PathType Container` | `test -d "dir"` |
11
+ | **Create directory** | `New-Item -ItemType Directory -Path "dir"` | `mkdir -p "dir"` |
12
+ | **List files** | `Get-ChildItem "*.md"` | `ls *.md` |
13
+ | **List recursively** | `Get-ChildItem -Recurse` | `find . -type f` |
14
+ | **Read file** | `Get-Content "file.md"` | `cat "file.md"` |
15
+ | **Search in files** | `Select-String -Path "**/*" -Pattern "TODO"` | `grep -r "TODO" .` |
16
+ | **Count lines** | `(Get-Content file).Count` | `wc -l < file` |
17
+ | **Copy files** | `Copy-Item -Recurse src dest` | `cp -r src dest` |
18
+ | **Delete files** | `Remove-Item -Recurse -Force dir` | `rm -rf dir` |
19
+
20
+ ## Git Operations (Same on Both)
21
+
22
+ ```bash
23
+ git add -A
24
+ git commit -m "message"
25
+ git push
26
+ git status --short
27
+ ```
28
+
29
+ ## Workflow-Specific Examples
30
+
31
+ ### /map — Analyze Codebase
32
+
33
+ **PowerShell:**
34
+ ```powershell
35
+ Get-ChildItem -Recurse -Directory |
36
+ Where-Object { $_.Name -notmatch "node_modules|\.git" }
37
+ ```
38
+
39
+ **Bash:**
40
+ ```bash
41
+ find . -type d ! -path "*/node_modules/*" ! -path "*/.git/*"
42
+ ```
43
+
44
+ ---
45
+
46
+ ### /plan — Check SPEC Status
47
+
48
+ **PowerShell:**
49
+ ```powershell
50
+ $spec = Get-Content ".gsd/SPEC.md" -Raw
51
+ if ($spec -match "FINALIZED") { "Ready" }
52
+ ```
53
+
54
+ **Bash:**
55
+ ```bash
56
+ if grep -q "FINALIZED" .gsd/SPEC.md; then echo "Ready"; fi
57
+ ```
58
+
59
+ ---
60
+
61
+ ### /execute — Discover Plans
62
+
63
+ **PowerShell:**
64
+ ```powershell
65
+ Get-ChildItem ".gsd/phases/1/*-PLAN.md"
66
+ ```
67
+
68
+ **Bash:**
69
+ ```bash
70
+ ls .gsd/phases/1/*-PLAN.md 2>/dev/null
71
+ ```
72
+
73
+ ---
74
+
75
+ ### /verify — Search TODOs
76
+
77
+ **PowerShell:**
78
+ ```powershell
79
+ Select-String -Path "src/**/*" -Pattern "TODO|FIXME"
80
+ ```
81
+
82
+ **Bash:**
83
+ ```bash
84
+ grep -rn "TODO\|FIXME" src/
85
+ ```
86
+
87
+ ---
88
+
89
+ ## Environment Detection
90
+
91
+ Add this to workflows for cross-platform commands:
92
+
93
+ ```markdown
94
+ **Note:** Commands shown are PowerShell. For Bash equivalents, see `.gsd/examples/cross-platform.md`
95
+ ```
96
+
97
+ ---
98
+
99
+ *Reference for Linux/Mac users*
.gsd/examples/multi-wave-workflow.md ADDED
@@ -0,0 +1,256 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Multi-Wave Workflow Example
2
+
3
+ This example demonstrates a complete GSD workflow with:
4
+ - Short spec
5
+ - Plan breakdown
6
+ - 2-wave execution
7
+ - Verification with commands
8
+ - State snapshots
9
+
10
+ ---
11
+
12
+ ## Example: Add User Authentication
13
+
14
+ ### 1. SPEC.md (Finalized)
15
+
16
+ ```markdown
17
+ ---
18
+ status: FINALIZED
19
+ updated: 2026-02-07
20
+ ---
21
+
22
+ # User Authentication Feature
23
+
24
+ ## Overview
25
+ Add login/logout functionality with JWT tokens.
26
+
27
+ ## Requirements
28
+ 1. POST /api/auth/login endpoint
29
+ 2. POST /api/auth/logout endpoint
30
+ 3. JWT stored in httpOnly cookie
31
+ 4. Protected route middleware
32
+
33
+ ## Success Criteria
34
+ - User can login with email/password
35
+ - Invalid credentials return 401
36
+ - Protected routes require valid JWT
37
+ - Logout clears the cookie
38
+ ```
39
+
40
+ ---
41
+
42
+ ### 2. ROADMAP.md (Phase Entry)
43
+
44
+ ```markdown
45
+ ## Phase 1: User Authentication
46
+
47
+ - [ ] Plan 1.1: Auth endpoints (Wave 1)
48
+ - [ ] Plan 1.2: Protected middleware (Wave 2)
49
+ ```
50
+
51
+ ---
52
+
53
+ ### 3. PLAN 1.1 (Wave 1)
54
+
55
+ ```xml
56
+ ---
57
+ phase: 1
58
+ plan: 1
59
+ type: implementation
60
+ wave: 1
61
+ ---
62
+
63
+ <objective>
64
+ Create login and logout endpoints with JWT handling.
65
+ </objective>
66
+
67
+ <context>
68
+ Files to read: src/app/api/ structure, existing auth if any
69
+ </context>
70
+
71
+ <tasks>
72
+ <task type="auto" effort="medium">
73
+ <name>Create login endpoint</name>
74
+ <files>src/app/api/auth/login/route.ts</files>
75
+ <action>
76
+ Create POST handler accepting {email, password}.
77
+ Query users table, compare password with bcrypt.
78
+ On success: generate JWT, set httpOnly cookie, return 200.
79
+ On failure: return 401 with generic error.
80
+ </action>
81
+ <verify>curl -X POST localhost:3000/api/auth/login -d '{"email":"test@example.com","password":"test123"}'</verify>
82
+ <done>Valid credentials return 200 + Set-Cookie header</done>
83
+ </task>
84
+
85
+ <task type="auto" effort="low">
86
+ <name>Create logout endpoint</name>
87
+ <files>src/app/api/auth/logout/route.ts</files>
88
+ <action>
89
+ Create POST handler that clears the auth cookie.
90
+ Return 200 on success.
91
+ </action>
92
+ <verify>curl -X POST localhost:3000/api/auth/logout --cookie "token=..."</verify>
93
+ <done>Cookie is cleared, response is 200</done>
94
+ </task>
95
+ </tasks>
96
+ ```
97
+
98
+ ---
99
+
100
+ ### 4. Wave 1 Execution
101
+
102
+ **Task 1 Commit:**
103
+ ```
104
+ git commit -m "feat(phase-1): create login endpoint"
105
+ ```
106
+
107
+ **Task 2 Commit:**
108
+ ```
109
+ git commit -m "feat(phase-1): create logout endpoint"
110
+ ```
111
+
112
+ ---
113
+
114
+ ### 5. Wave 1 State Snapshot
115
+
116
+ ```markdown
117
+ ---
118
+ wave: 1
119
+ phase: 1
120
+ created: 2026-02-07T10:30:00
121
+ status: complete
122
+ ---
123
+
124
+ # Wave 1 State Snapshot
125
+
126
+ ## Objective
127
+ Create authentication endpoints.
128
+
129
+ ## Changes Realized
130
+ - Created login endpoint with JWT generation
131
+ - Created logout endpoint with cookie clearing
132
+ - Added bcrypt password comparison
133
+
134
+ ## Files Touched
135
+ | File | Change Type | Description |
136
+ |------|-------------|-------------|
137
+ | src/app/api/auth/login/route.ts | created | Login handler |
138
+ | src/app/api/auth/logout/route.ts | created | Logout handler |
139
+
140
+ ## Verification Results
141
+ | Check | Command | Result |
142
+ |-------|---------|--------|
143
+ | Login works | `curl -X POST .../login` | ✅ 200 + cookie |
144
+ | Logout works | `curl -X POST .../logout` | ✅ 200 + cleared |
145
+
146
+ ## Commits in This Wave
147
+ | Hash | Message |
148
+ |------|---------|
149
+ | abc123 | feat(phase-1): create login endpoint |
150
+ | def456 | feat(phase-1): create logout endpoint |
151
+
152
+ ## TODO for Next Wave
153
+ 1. Create auth middleware
154
+ 2. Apply to protected routes
155
+ ```
156
+
157
+ ---
158
+
159
+ ### 6. PLAN 1.2 (Wave 2)
160
+
161
+ ```xml
162
+ ---
163
+ phase: 1
164
+ plan: 2
165
+ type: implementation
166
+ wave: 2
167
+ depends_on: [1]
168
+ ---
169
+
170
+ <objective>
171
+ Create middleware to protect routes requiring authentication.
172
+ </objective>
173
+
174
+ <context>
175
+ Wave 1 complete: login/logout endpoints exist.
176
+ JWT is stored in httpOnly cookie named "token".
177
+ </context>
178
+
179
+ <tasks>
180
+ <task type="auto" effort="high">
181
+ <name>Create auth middleware</name>
182
+ <files>src/middleware/auth.ts</files>
183
+ <action>
184
+ Create middleware that:
185
+ 1. Reads JWT from cookie
186
+ 2. Verifies signature with jose
187
+ 3. Attaches user to request
188
+ 4. Returns 401 if invalid/missing
189
+ </action>
190
+ <verify>Import and call middleware with mock request</verify>
191
+ <done>Valid JWT passes, invalid/missing returns 401</done>
192
+ </task>
193
+
194
+ <task type="auto" effort="medium">
195
+ <name>Apply middleware to protected route</name>
196
+ <files>src/app/api/user/profile/route.ts</files>
197
+ <action>
198
+ Create example protected route.
199
+ Apply auth middleware.
200
+ Return user data if authenticated.
201
+ </action>
202
+ <verify>curl localhost:3000/api/user/profile with and without cookie</verify>
203
+ <done>With cookie: 200 + data. Without: 401</done>
204
+ </task>
205
+ </tasks>
206
+ ```
207
+
208
+ ---
209
+
210
+ ### 7. Wave 2 Execution & Snapshot
211
+
212
+ **Commits:**
213
+ ```
214
+ git commit -m "feat(phase-1): create auth middleware"
215
+ git commit -m "feat(phase-1): apply middleware to profile route"
216
+ ```
217
+
218
+ **State Snapshot:** (similar format to Wave 1)
219
+
220
+ ---
221
+
222
+ ### 8. Verification
223
+
224
+ ```bash
225
+ # Full verification sequence
226
+ curl -X POST localhost:3000/api/auth/login \
227
+ -H "Content-Type: application/json" \
228
+ -d '{"email":"user@example.com","password":"secret"}' \
229
+ -c cookies.txt
230
+
231
+ # Expected: 200 + Set-Cookie: token=...
232
+
233
+ curl localhost:3000/api/user/profile -b cookies.txt
234
+ # Expected: 200 + user data
235
+
236
+ curl localhost:3000/api/user/profile
237
+ # Expected: 401
238
+
239
+ curl -X POST localhost:3000/api/auth/logout -b cookies.txt
240
+ # Expected: 200 + cookie cleared
241
+ ```
242
+
243
+ ---
244
+
245
+ ## Key Takeaways
246
+
247
+ 1. **Waves group dependent work** — Wave 2 waited for Wave 1
248
+ 2. **State snapshots preserve context** — Each wave ends with documented state
249
+ 3. **Atomic commits per task** — Easy to trace and revert
250
+ 4. **Verification built into plan** — No "trust me, it works"
251
+ 5. **Effort hints model selection** — `high` effort = use reasoning model
252
+
253
+ ---
254
+
255
+ *See PROJECT_RULES.md for wave execution rules.*
256
+ *See templates/state_snapshot.md for snapshot format.*
.gsd/examples/quick-reference.md ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GSD Quick Reference Card
2
+
3
+ ## Workflow Lifecycle
4
+
5
+ ```
6
+ ┌─────────┐ ┌─────────┐ ┌──────────┐ ┌─────────┐
7
+ │ /map │ → │ /plan │ → │ /execute │ → │ /verify │
8
+ │ │ │ │ │ │ │ │
9
+ │ Analyze │ │ Create │ │ Run │ │ Check │
10
+ │codebase │ │ phases │ │ tasks │ │ work │
11
+ └─────────┘ └─────────┘ └──────────┘ └─────────┘
12
+ ↑ │
13
+ └──────────────┘
14
+ (if gaps found)
15
+ ```
16
+
17
+ ## All Commands
18
+
19
+ | Command | Args | Purpose |
20
+ |---------|------|---------|
21
+ | `/map` | - | Analyze codebase → ARCHITECTURE.md |
22
+ | `/plan` | `[phase]` | Create PLAN.md files for phase |
23
+ | `/execute` | `phase [--gaps-only]` | Run plans with wave execution |
24
+ | `/verify` | `phase` | Validate with empirical proof |
25
+ | `/debug` | `description` | Systematic debugging |
26
+ | `/progress` | - | Show current position |
27
+ | `/pause` | - | Save state, end session |
28
+ | `/resume` | - | Load state, start session |
29
+ | `/add-todo` | `item [--priority]` | Quick capture |
30
+ | `/check-todos` | `[--all]` | List pending items |
31
+
32
+ ## Core Rules
33
+
34
+ | Rule | Enforcement |
35
+ |------|-------------|
36
+ | 🔒 Planning Lock | No code until SPEC finalized |
37
+ | 💾 State Persistence | Update STATE.md after tasks |
38
+ | 🧹 Context Hygiene | 3 failures → fresh session |
39
+ | ✅ Empirical Validation | Proof required for "done" |
40
+
41
+ ## Key Files
42
+
43
+ | File | Purpose | Updated By |
44
+ |------|---------|------------|
45
+ | SPEC.md | Vision (finalize first!) | User |
46
+ | ROADMAP.md | Phase definitions | /plan |
47
+ | STATE.md | Session memory | All |
48
+ | ARCHITECTURE.md | System design | /map |
49
+ | TODO.md | Quick capture | /add-todo |
50
+
51
+ ## XML Task Structure
52
+
53
+ ```xml
54
+ <task type="auto">
55
+ <name>Clear name</name>
56
+ <files>exact/path.ts</files>
57
+ <action>Specific instructions</action>
58
+ <verify>Executable command</verify>
59
+ <done>Measurable criteria</done>
60
+ </task>
61
+ ```
62
+
63
+ ## Priority Indicators
64
+
65
+ | Priority | Icon |
66
+ |----------|------|
67
+ | High | 🔴 |
68
+ | Medium | 🟡 |
69
+ | Low | 🟢 |
70
+
71
+ ---
72
+
73
+ *Print this for quick reference!*
.gsd/examples/workflow-example.md ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GSD Workflow Example
2
+
3
+ > A complete walkthrough of using GSD from start to finish.
4
+
5
+ ## Scenario: Building a Simple Todo API
6
+
7
+ ### Step 1: Define the Spec
8
+
9
+ First, fill out `.gsd/SPEC.md`:
10
+
11
+ ```markdown
12
+ # SPEC.md
13
+
14
+ > **Status**: `FINALIZED`
15
+
16
+ ## Vision
17
+ A simple RESTful API for managing todo items.
18
+
19
+ ## Goals
20
+ 1. CRUD operations for todos
21
+ 2. Persistence to SQLite
22
+ 3. Input validation
23
+
24
+ ## Success Criteria
25
+ - [ ] POST /todos creates a todo
26
+ - [ ] GET /todos returns list
27
+ - [ ] DELETE /todos/:id removes item
28
+ ```
29
+
30
+ ---
31
+
32
+ ### Step 2: Map the Codebase (if existing)
33
+
34
+ ```
35
+ /map
36
+ ```
37
+
38
+ This creates:
39
+ - `.gsd/ARCHITECTURE.md` — Current structure
40
+ - `.gsd/STACK.md` — Technologies in use
41
+
42
+ ---
43
+
44
+ ### Step 3: Plan the Phases
45
+
46
+ ```
47
+ /plan 1
48
+ ```
49
+
50
+ GSD analyzes the SPEC and creates `.gsd/phases/1/` with PLAN.md files:
51
+
52
+ ```markdown
53
+ # Plan 1.1: Database Setup
54
+
55
+ ## Objective
56
+ Create SQLite database with todos table.
57
+
58
+ ## Tasks
59
+
60
+ <task type="auto">
61
+ <name>Initialize SQLite database</name>
62
+ <files>src/db.ts</files>
63
+ <action>
64
+ Create SQLite connection using better-sqlite3.
65
+ Create todos table with: id, title, completed, created_at.
66
+ </action>
67
+ <verify>node -e "require('./src/db')" exits without error</verify>
68
+ <done>Database file exists, table created</done>
69
+ </task>
70
+ ```
71
+
72
+ ---
73
+
74
+ ### Step 4: Execute the Phase
75
+
76
+ ```
77
+ /execute 1
78
+ ```
79
+
80
+ GSD:
81
+ 1. Loads Plan 1.1
82
+ 2. Executes tasks in order
83
+ 3. Runs verify commands
84
+ 4. Creates atomic commits
85
+ 5. Creates SUMMARY.md
86
+ 6. Proceeds to Plan 1.2
87
+ 7. Verifies phase goal
88
+
89
+ ---
90
+
91
+ ### Step 5: Verify the Work
92
+
93
+ ```
94
+ /verify 1
95
+ ```
96
+
97
+ GSD:
98
+ 1. Extracts must-haves from phase
99
+ 2. Runs verification commands
100
+ 3. Captures evidence
101
+ 4. Creates VERIFICATION.md
102
+ 5. Reports pass/fail
103
+
104
+ ---
105
+
106
+ ### Step 6: Continue or Debug
107
+
108
+ **If verified:**
109
+ ```
110
+ /plan 2 → Plan next phase
111
+ /execute 2 → Execute next phase
112
+ ```
113
+
114
+ **If issues found:**
115
+ ```
116
+ /execute 1 --gaps-only → Run fix plans
117
+ /debug "API returns 500" → Debug the issue
118
+ ```
119
+
120
+ ---
121
+
122
+ ## Quick Commands Reference
123
+
124
+ | Command | When to Use |
125
+ |---------|-------------|
126
+ | `/map` | Analyze existing codebase |
127
+ | `/plan [N]` | Create plans for phase N |
128
+ | `/execute [N]` | Run all plans in phase N |
129
+ | `/verify [N]` | Confirm phase N works |
130
+ | `/debug [issue]` | Fix a problem |
131
+ | `/progress` | See current status |
132
+ | `/pause` | End session, save state |
133
+ | `/resume` | Start new session |
134
+ | `/add-todo` | Capture quick idea |
135
+ | `/check-todos` | See pending items |
136
+
137
+ ---
138
+
139
+ *This example demonstrates the GSD methodology flow.*
.gsd/templates/DEBUG.md ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Debug Template
2
+
3
+ Template for `.gsd/debug/[slug].md` — active debug session tracking.
4
+
5
+ ---
6
+
7
+ ## File Template
8
+
9
+ ```markdown
10
+ ---
11
+ status: gathering | investigating | fixing | verifying | resolved
12
+ trigger: "[verbatim user input]"
13
+ created: [ISO timestamp]
14
+ updated: [ISO timestamp]
15
+ ---
16
+
17
+ ## Current Focus
18
+ <!-- OVERWRITE on each update - always reflects NOW -->
19
+
20
+ hypothesis: [current theory being tested]
21
+ test: [how testing it]
22
+ expecting: [what result means if true/false]
23
+ next_action: [immediate next step]
24
+
25
+ ## Symptoms
26
+ <!-- Written during gathering, then immutable -->
27
+
28
+ expected: [what should happen]
29
+ actual: [what actually happens]
30
+ errors: [error messages if any]
31
+ reproduction: [how to trigger]
32
+ started: [when it broke / always broken]
33
+
34
+ ## Eliminated
35
+ <!-- APPEND only - prevents re-investigating after context reset -->
36
+
37
+ - hypothesis: [theory that was wrong]
38
+ evidence: [what disproved it]
39
+ timestamp: [when eliminated]
40
+
41
+ ## Evidence
42
+ <!-- APPEND only - facts discovered during investigation -->
43
+
44
+ - timestamp: [when found]
45
+ checked: [what was examined]
46
+ found: [what was observed]
47
+ implication: [what this means]
48
+
49
+ ## Resolution
50
+ <!-- OVERWRITE as understanding evolves -->
51
+
52
+ root_cause: [empty until found]
53
+ fix: [empty until applied]
54
+ verification: [empty until verified]
55
+ files_changed: []
56
+ ```
57
+
58
+ ---
59
+
60
+ ## Section Rules
61
+
62
+ **Frontmatter (status, trigger, timestamps):**
63
+ - `status`: OVERWRITE - reflects current phase
64
+ - `trigger`: IMMUTABLE - verbatim user input, never changes
65
+ - `created`: IMMUTABLE - set once
66
+ - `updated`: OVERWRITE - update on every change
67
+
68
+ **Current Focus:**
69
+ - OVERWRITE entirely on each update
70
+ - Always reflects what AI is doing RIGHT NOW
71
+ - If AI reads this after session reset, it knows exactly where to resume
72
+ - Fields: hypothesis, test, expecting, next_action
73
+
74
+ **Symptoms:**
75
+ - Written during initial gathering phase
76
+ - IMMUTABLE after gathering complete
77
+ - Reference point for what we're trying to fix
78
+
79
+ **Eliminated:**
80
+ - APPEND only - never remove entries
81
+ - Prevents re-investigating dead ends after context reset
82
+ - Critical for efficiency across session boundaries
83
+
84
+ **Evidence:**
85
+ - APPEND only - never remove entries
86
+ - Facts discovered during investigation
87
+ - Builds the case for root cause
88
+
89
+ **Resolution:**
90
+ - OVERWRITE as understanding evolves
91
+ - Final state shows confirmed root cause and verified fix
92
+
93
+ ---
94
+
95
+ ## Lifecycle
96
+
97
+ **Creation:** When /debug is called
98
+ - Create file with trigger from user input
99
+ - Set status to "gathering"
100
+ - next_action = "gather symptoms"
101
+
102
+ **During investigation:**
103
+ - OVERWRITE Current Focus with each hypothesis
104
+ - APPEND to Evidence with each finding
105
+ - APPEND to Eliminated when hypothesis disproved
106
+
107
+ **On resolution:**
108
+ - status → "resolved"
109
+ - Move file to .gsd/debug/resolved/
110
+
111
+ ---
112
+
113
+ ## Resume Behavior
114
+
115
+ When AI reads this file after session reset:
116
+
117
+ 1. Parse frontmatter → know status
118
+ 2. Read Current Focus → know exactly what was happening
119
+ 3. Read Eliminated → know what NOT to retry
120
+ 4. Read Evidence → know what's been learned
121
+ 5. Continue from next_action
122
+
123
+ The file IS the debugging brain.
.gsd/templates/PLAN.md ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PLAN.md Template
2
+
3
+ > Copy this template when creating execution plans.
4
+
5
+ ```markdown
6
+ ---
7
+ phase: {N}
8
+ plan: {M}
9
+ wave: {W}
10
+ gap_closure: false
11
+ ---
12
+
13
+ # Plan {N}.{M}: {Descriptive Name}
14
+
15
+ ## Objective
16
+ {One paragraph explaining what this plan delivers and why it matters}
17
+
18
+ ## Context
19
+ Load these files for context:
20
+ - .gsd/SPEC.md
21
+ - .gsd/ARCHITECTURE.md
22
+ - {relevant source files}
23
+
24
+ ## Tasks
25
+
26
+ <task type="auto">
27
+ <name>{Clear, specific task name}</name>
28
+ <files>
29
+ {exact/file/path1.ext}
30
+ {exact/file/path2.ext}
31
+ </files>
32
+ <action>
33
+ {Specific implementation instructions}
34
+
35
+ Steps:
36
+ 1. {Step 1}
37
+ 2. {Step 2}
38
+ 3. {Step 3}
39
+
40
+ AVOID: {common mistake} because {reason}
41
+ USE: {preferred approach} because {reason}
42
+ </action>
43
+ <verify>
44
+ {Executable command or check}
45
+ Example: npm test -- --testNamePattern="auth"
46
+ Example: curl -X POST localhost:3000/api/login
47
+ </verify>
48
+ <done>
49
+ {Measurable acceptance criteria}
50
+ Example: Valid credentials → 200 + Set-Cookie, invalid → 401
51
+ </done>
52
+ </task>
53
+
54
+ <task type="auto">
55
+ <name>{Task 2 name}</name>
56
+ <files>{files}</files>
57
+ <action>{instructions}</action>
58
+ <verify>{command}</verify>
59
+ <done>{criteria}</done>
60
+ </task>
61
+
62
+ ## Must-Haves
63
+ After all tasks complete, verify:
64
+ - [ ] {Must-have 1 — derived from phase goal}
65
+ - [ ] {Must-have 2}
66
+
67
+ ## Success Criteria
68
+ - [ ] All tasks verified passing
69
+ - [ ] Must-haves confirmed
70
+ - [ ] No regressions in tests
71
+ ```
72
+
73
+ ## Task Types
74
+
75
+ | Type | Use For | Behavior |
76
+ |------|---------|----------|
77
+ | `auto` | Everything Claude can do independently | Fully autonomous |
78
+ | `checkpoint:human-verify` | Visual/functional verification | Pauses for user |
79
+ | `checkpoint:decision` | Implementation choices | Pauses for user |
80
+
81
+ ## Wave Assignment
82
+
83
+ | Wave | Use For |
84
+ |------|---------|
85
+ | 1 | Foundation (types, schemas, utilities) |
86
+ | 2 | Core implementations |
87
+ | 3 | Integration and validation |
88
+
89
+ Plans in the same wave can run in parallel.
90
+ Later waves depend on earlier waves.