gsd-ag 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/.agent/skills/codebase-mapper/SKILL.md +226 -0
  2. package/.agent/skills/context-compressor/SKILL.md +201 -0
  3. package/.agent/skills/context-fetch/SKILL.md +184 -0
  4. package/.agent/skills/context-health-monitor/SKILL.md +105 -0
  5. package/.agent/skills/debugger/SKILL.md +273 -0
  6. package/.agent/skills/empirical-validation/SKILL.md +97 -0
  7. package/.agent/skills/executor/SKILL.md +465 -0
  8. package/.agent/skills/plan-checker/SKILL.md +283 -0
  9. package/.agent/skills/planner/SKILL.md +485 -0
  10. package/.agent/skills/token-budget/SKILL.md +166 -0
  11. package/.agent/skills/verifier/SKILL.md +421 -0
  12. package/.agent/workflows/add-phase.md +96 -0
  13. package/.agent/workflows/add-todo.md +69 -0
  14. package/.agent/workflows/audit-milestone.md +107 -0
  15. package/.agent/workflows/check-todos.md +80 -0
  16. package/.agent/workflows/complete-milestone.md +135 -0
  17. package/.agent/workflows/debug.md +235 -0
  18. package/.agent/workflows/discuss-phase.md +103 -0
  19. package/.agent/workflows/execute.md +325 -0
  20. package/.agent/workflows/health.md +122 -0
  21. package/.agent/workflows/help.md +96 -0
  22. package/.agent/workflows/insert-phase.md +109 -0
  23. package/.agent/workflows/install.md +152 -0
  24. package/.agent/workflows/list-phase-assumptions.md +82 -0
  25. package/.agent/workflows/map.md +394 -0
  26. package/.agent/workflows/new-milestone.md +126 -0
  27. package/.agent/workflows/new-project.md +368 -0
  28. package/.agent/workflows/pause.md +176 -0
  29. package/.agent/workflows/plan-milestone-gaps.md +116 -0
  30. package/.agent/workflows/plan.md +380 -0
  31. package/.agent/workflows/progress.md +90 -0
  32. package/.agent/workflows/quick.md +128 -0
  33. package/.agent/workflows/remove-phase.md +139 -0
  34. package/.agent/workflows/research-phase.md +160 -0
  35. package/.agent/workflows/resume.md +131 -0
  36. package/.agent/workflows/update.md +203 -0
  37. package/.agent/workflows/verify.md +263 -0
  38. package/.agent/workflows/web-search.md +121 -0
  39. package/.agent/workflows/whats-new.md +80 -0
  40. package/.gemini/GEMINI.md +67 -0
  41. package/.gsd/GSD-STYLE.md +272 -0
  42. package/.gsd/PROJECT_RULES.md +256 -0
  43. package/.gsd/adapters/CLAUDE.md +77 -0
  44. package/.gsd/adapters/GEMINI.md +92 -0
  45. package/.gsd/adapters/GPT_OSS.md +130 -0
  46. package/.gsd/docs/model-selection-playbook.md +128 -0
  47. package/.gsd/docs/runbook.md +296 -0
  48. package/.gsd/docs/token-optimization-guide.md +207 -0
  49. package/.gsd/examples/cross-platform.md +99 -0
  50. package/.gsd/examples/multi-wave-workflow.md +256 -0
  51. package/.gsd/examples/quick-reference.md +73 -0
  52. package/.gsd/examples/workflow-example.md +139 -0
  53. package/.gsd/model_capabilities.yaml +108 -0
  54. package/.gsd/templates/DEBUG.md +123 -0
  55. package/.gsd/templates/PLAN.md +90 -0
  56. package/.gsd/templates/RESEARCH.md +75 -0
  57. package/.gsd/templates/SUMMARY.md +103 -0
  58. package/.gsd/templates/UAT.md +168 -0
  59. package/.gsd/templates/VERIFICATION.md +70 -0
  60. package/.gsd/templates/architecture.md +67 -0
  61. package/.gsd/templates/context.md +91 -0
  62. package/.gsd/templates/decisions.md +37 -0
  63. package/.gsd/templates/discovery.md +122 -0
  64. package/.gsd/templates/journal.md +46 -0
  65. package/.gsd/templates/milestone.md +91 -0
  66. package/.gsd/templates/phase-summary.md +52 -0
  67. package/.gsd/templates/project.md +124 -0
  68. package/.gsd/templates/requirements.md +92 -0
  69. package/.gsd/templates/roadmap.md +103 -0
  70. package/.gsd/templates/spec.md +51 -0
  71. package/.gsd/templates/sprint.md +57 -0
  72. package/.gsd/templates/stack.md +62 -0
  73. package/.gsd/templates/state.md +92 -0
  74. package/.gsd/templates/state_snapshot.md +132 -0
  75. package/.gsd/templates/todo.md +32 -0
  76. package/.gsd/templates/token_report.md +79 -0
  77. package/.gsd/templates/user-setup.md +116 -0
  78. package/LICENSE +21 -0
  79. package/README.md +523 -0
  80. package/bin/init.js +117 -0
  81. package/package.json +35 -0
@@ -0,0 +1,325 @@
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
+ - `--auto` — Auto-advance mode (proceed directly to next logical phase or verify without stopping)
33
+
34
+ **Required files:**
35
+ - `.gsd/ROADMAP.md` — Phase definitions
36
+ - `.gsd/STATE.md` — Current position
37
+ - `.gsd/phases/{phase}/` — Phase directory with PLAN.md files
38
+ </context>
39
+
40
+ <process>
41
+
42
+ ## 1. Validate Environment
43
+
44
+ **PowerShell:**
45
+ ```powershell
46
+ Test-Path ".gsd/ROADMAP.md"
47
+ Test-Path ".gsd/STATE.md"
48
+ ```
49
+
50
+ **Bash:**
51
+ ```bash
52
+ test -f ".gsd/ROADMAP.md"
53
+ test -f ".gsd/STATE.md"
54
+ ```
55
+
56
+ **If not found:** Error — user should run `/plan` first.
57
+
58
+ ---
59
+
60
+ ## 2. Validate Phase Exists
61
+
62
+ **PowerShell:**
63
+ ```powershell
64
+ # Check phase exists in roadmap
65
+ Select-String -Path ".gsd/ROADMAP.md" -Pattern "Phase $PHASE:"
66
+ ```
67
+
68
+ **Bash:**
69
+ ```bash
70
+ # Check phase exists in roadmap
71
+ grep "Phase $PHASE:" ".gsd/ROADMAP.md"
72
+ ```
73
+
74
+ **If not found:** Error with available phases from ROADMAP.md.
75
+
76
+ ---
77
+
78
+ ## 3. Ensure Phase Directory Exists
79
+
80
+ **PowerShell:**
81
+ ```powershell
82
+ $PHASE_DIR = ".gsd/phases/$PHASE"
83
+ if (-not (Test-Path $PHASE_DIR)) {
84
+ New-Item -ItemType Directory -Path $PHASE_DIR
85
+ }
86
+ ```
87
+
88
+ **Bash:**
89
+ ```bash
90
+ PHASE_DIR=".gsd/phases/$PHASE"
91
+ mkdir -p "$PHASE_DIR"
92
+ ```
93
+
94
+ ---
95
+
96
+ ## 4. Discover Plans
97
+
98
+ **PowerShell:**
99
+ ```powershell
100
+ Get-ChildItem "$PHASE_DIR/*-PLAN.md"
101
+ ```
102
+
103
+ **Bash:**
104
+ ```bash
105
+ ls "$PHASE_DIR"/*-PLAN.md 2>/dev/null
106
+ ```
107
+
108
+ **Check for existing summaries** (completed plans):
109
+
110
+ **PowerShell:**
111
+ ```powershell
112
+ Get-ChildItem "$PHASE_DIR/*-SUMMARY.md"
113
+ ```
114
+
115
+ **Bash:**
116
+ ```bash
117
+ ls "$PHASE_DIR"/*-SUMMARY.md 2>/dev/null
118
+ ```
119
+
120
+ **Build list of incomplete plans** (PLAN without matching SUMMARY).
121
+
122
+ **If `--gaps-only`:** Filter to only plans with `gap_closure: true` in frontmatter.
123
+
124
+ **If no incomplete plans found:** Phase already complete, skip to step 8.
125
+
126
+ ---
127
+
128
+ ## 5. Group Plans by Wave
129
+
130
+ Read `wave` field from each plan's frontmatter:
131
+
132
+ ```yaml
133
+ ---
134
+ phase: 1
135
+ plan: 2
136
+ wave: 1
137
+ ---
138
+ ```
139
+
140
+ **Group plans by wave number.** Lower waves execute first.
141
+
142
+ Display wave structure:
143
+ ```
144
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
145
+ GSD ► EXECUTING PHASE {N}
146
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
147
+
148
+ Wave 1: {plan-1}, {plan-2}
149
+ Wave 2: {plan-3}
150
+
151
+ {X} plans across {Y} waves
152
+ ```
153
+
154
+ ---
155
+
156
+ ## 6. Execute Waves
157
+
158
+ For each wave in order:
159
+
160
+ ### 6a. Execute Plans in Wave
161
+ For each plan in the current wave:
162
+
163
+ 1. **Load plan context** — Read only the PLAN.md file
164
+ 2. **Execute tasks** — Follow `<task>` blocks in order
165
+ 3. **Verify each task** — Run `<verify>` commands
166
+ 4. **Commit per task:**
167
+ ```bash
168
+ git add -A
169
+ git commit -m "feat(phase-{N}): {task-name}"
170
+ ```
171
+ 5. **Create SUMMARY.md** — Document what was done
172
+
173
+ ### 6b. Verify Wave Complete
174
+ Check all plans in wave have SUMMARY.md files.
175
+
176
+ ### 6c. Proceed to Next Wave
177
+ Only after current wave fully completes.
178
+
179
+ ---
180
+
181
+ ## 7. Verify Phase Goal
182
+
183
+ After all waves complete:
184
+
185
+ 1. **Read phase goal** from ROADMAP.md
186
+ 2. **Check must-haves** against actual codebase (not SUMMARY claims)
187
+ 3. **Run verification commands** specified in phase
188
+
189
+ **Create VERIFICATION.md:**
190
+ ```markdown
191
+ ## Phase {N} Verification
192
+
193
+ ### Must-Haves
194
+ - [x] Must-have 1 — VERIFIED (evidence: ...)
195
+ - [ ] Must-have 2 — FAILED (reason: ...)
196
+
197
+ ### Verdict: PASS / FAIL
198
+ ```
199
+
200
+ **Route by verdict:**
201
+ - `PASS` → Continue to step 8
202
+ - `FAIL` → Create gap closure plans, offer `/execute {N} --gaps-only`
203
+
204
+ ---
205
+
206
+ ## 8. Update Roadmap and State
207
+
208
+ **Update ROADMAP.md:**
209
+ ```markdown
210
+ ### Phase {N}: {Name}
211
+ **Status**: ✅ Complete
212
+ ```
213
+
214
+ **Update STATE.md:**
215
+ ```markdown
216
+ ## Current Position
217
+ - **Phase**: {N} (completed)
218
+ - **Task**: All tasks complete
219
+ - **Status**: Verified
220
+
221
+ ## Last Session Summary
222
+ Phase {N} executed successfully. {X} plans, {Y} tasks completed.
223
+
224
+ ## Next Steps
225
+ 1. Proceed to Phase {N+1}
226
+ ```
227
+
228
+ ---
229
+
230
+ ## 9. Commit Phase Completion
231
+
232
+ ```bash
233
+ git add .gsd/ROADMAP.md .gsd/STATE.md
234
+ git commit -m "docs(phase-{N}): complete {phase-name}"
235
+ ```
236
+
237
+ ---
238
+
239
+ ## 10. Offer Next Steps
240
+
241
+ </process>
242
+
243
+ <offer_next>
244
+ Output based on status:
245
+
246
+ **Route A: Phase complete, more phases remain**
247
+
248
+ ```
249
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
250
+ GSD ► PHASE {N} COMPLETE ✓
251
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
252
+
253
+ {X} plans executed
254
+ Goal verified ✓
255
+
256
+ ───────────────────────────────────────────────────────
257
+
258
+ ▶ Next Up
259
+ Phase {N+1}: {Name}
260
+
261
+ /plan {N+1} — create execution plans
262
+ /execute {N+1} — execute directly (if plans exist)
263
+
264
+ ───────────────────────────────────────────────────────
265
+ ```
266
+
267
+ **Route B: All phases complete**
268
+
269
+ ```
270
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
271
+ GSD ► MILESTONE COMPLETE 🎉
272
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
273
+
274
+ All phases completed and verified.
275
+
276
+ ───────────────────────────────────────────────────────
277
+ ```
278
+
279
+ **Route C: Gaps found**
280
+
281
+ ```
282
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
283
+ GSD ► PHASE {N} GAPS FOUND ⚠
284
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
285
+
286
+ {X}/{Y} must-haves verified
287
+ Gap closure plans created.
288
+
289
+ /execute {N} --gaps-only — execute fix plans
290
+
291
+ ───────────────────────────────────────────────────────
292
+ ```
293
+
294
+ **If `--auto` flag was set:**
295
+ Do not show the manual output prompts above. Instead:
296
+ - If Route A: Immediately invoke `/plan {N+1} --auto` using your tools.
297
+ - If Route B: Stop and notify user of milestone completion.
298
+ - If Route C: Immediately invoke `/execute {N} --gaps-only` to fix the gaps.
299
+ </offer_next>
300
+
301
+ <context_hygiene>
302
+ **After 3 failed debugging attempts:**
303
+ 1. Stop current approach
304
+ 2. Document to `.gsd/STATE.md` what was tried
305
+ 3. Recommend `/pause` for fresh session
306
+ </context_hygiene>
307
+
308
+ <related>
309
+ ## Related
310
+
311
+ ### Workflows
312
+ | Command | Relationship |
313
+ |---------|--------------|
314
+ | `/plan` | Creates PLAN.md files that /execute runs |
315
+ | `/verify` | Validates work after /execute completes |
316
+ | `/debug` | Use when tasks fail verification |
317
+ | `/pause` | Use after 3 debugging failures |
318
+
319
+ ### Skills
320
+ | Skill | Purpose |
321
+ |-------|---------|
322
+ | `executor` | Detailed execution protocol |
323
+ | `context-health-monitor` | 3-strike rule enforcement |
324
+ | `empirical-validation` | Verification requirements |
325
+ </related>
@@ -0,0 +1,122 @@
1
+ ---
2
+ description: Health Check — Validate directory and state integrity
3
+ argument-hint: "[--repair]"
4
+ ---
5
+
6
+ # /health Workflow
7
+
8
+ <role>
9
+ You are a GSD Health Check orchestrator. Your job is to validate `.gsd/` directory integrity and report actionable issues.
10
+ </role>
11
+
12
+ <objective>
13
+ Check for missing files, invalid configurations, inconsistent state, and orphaned plans. Optionally repair auto-fixable issues.
14
+ </objective>
15
+
16
+ <context>
17
+ **Flags:**
18
+ - `--repair` — Auto-fix repairable issues
19
+
20
+ **Required files to check:**
21
+ - `.gsd/ROADMAP.md`
22
+ - `.gsd/STATE.md`
23
+ - `.gsd/PROJECT_RULES.md`
24
+ - `.gsd/SPEC.md`
25
+ </context>
26
+
27
+ <process>
28
+
29
+ ## 1. Parse Arguments
30
+ Determine if the `--repair` flag is active.
31
+
32
+ ## 2. Validate Core Documents
33
+
34
+ Run checks:
35
+ 1. Does `.agent/workflows/` exist and contain at least 5 standard workflows?
36
+ 2. Does `.gsd/ROADMAP.md` exist?
37
+ 3. Does `.gsd/STATE.md` exist?
38
+ 4. Does `.gsd/SPEC.md` exist?
39
+
40
+ If any missing, note it as an Error [E00X] and set health to **BROKEN**.
41
+
42
+ ## 3. Validate Phase Directories
43
+
44
+ Cross-reference `.gsd/ROADMAP.md` with `.gsd/phases/` directories:
45
+ 1. Parse roadmap for Phase numbers.
46
+ 2. Ensure there's a `.gsd/phases/{N}/` directory for each phase.
47
+ 3. Check Phase naming convention (e.g. `01-setup`, `02-auth`).
48
+ 4. Look for plans `*.PLAN.md` without matching `*.SUMMARY.md` across phases.
49
+
50
+ If discrepancies are found:
51
+ - Warning [W00X] phase directory mismatch.
52
+ - Warning [W00Y] phase on disk but not in roadmap.
53
+ - Info [I00X] Plan without SUMMARY (may be in progress).
54
+
55
+ ## 4. Validate Structural Integrity Using Script
56
+
57
+ Run the validation script to check structural integrity of templates, workflows, and skills:
58
+ ```bash
59
+ bun .gsd/scripts/validate-all.ts
60
+ ```
61
+ If errors occur, parse the output and include in the health check.
62
+
63
+ ## 5. Attempt Repairs (if `--repair`)
64
+
65
+ For issues marked as repairable (e.g., missing `.gsd/STATE.md` but roadmap exists):
66
+ - **STATE.md recovery**: Create fresh `STATE.md` based on roadmap structure.
67
+ - **Phase matching**: Create missing `.gsd/phases/{N}/` directories based on roadmap.
68
+
69
+ Log what repairs were performed.
70
+
71
+ ## 6. Report Status
72
+
73
+ Output the results clearly.
74
+
75
+ ```
76
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
77
+ GSD ► Health Check
78
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
79
+
80
+ Status: HEALTHY | DEGRADED | BROKEN
81
+ Errors: N | Warnings: N | Info: N
82
+ ```
83
+
84
+ **If repairs were performed:**
85
+ ```
86
+ ## Repairs Performed
87
+ - ✓ STATE.md: Regenerated from roadmap
88
+ - ✓ .gsd/phases/01/: Directory created
89
+ ```
90
+
91
+ **If errors exist:**
92
+ ```
93
+ ## Errors
94
+ - [E001] .gsd/ROADMAP.md not found
95
+ Fix: Run /plan to create
96
+ ```
97
+
98
+ **If warnings exist:**
99
+ ```
100
+ ## Warnings
101
+ - [W001] STATE.md references phase 5, but only phases 1-3 exist
102
+ Fix: Run /health --repair to regenerate
103
+ ```
104
+
105
+ **If info exists:**
106
+ ```
107
+ ## Info
108
+ - [I001] phases/02/02-01-PLAN.md has no SUMMARY.md
109
+ Note: May be in progress
110
+ ```
111
+
112
+ **Footer (if repairable issues exist and --repair was NOT used):**
113
+ ```
114
+ ---
115
+ N issues can be auto-repaired. Run: /health --repair
116
+ ```
117
+ </process>
118
+
119
+ <offer_next>
120
+ If repairable issues exist and `--repair` was not used, prompt the user:
121
+ "Would you like to run `/health --repair` to fix these issues automatically?"
122
+ </offer_next>
@@ -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/GSD-STYLE.md, .gsd/examples/
92
+
93
+ ───────────────────────────────────────────────────────
94
+ ```
95
+
96
+ </process>
@@ -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>