Spaces:
Sleeping
Sleeping
File size: 5,128 Bytes
cc38116 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | # GSD Runbook
> Operational procedures for debugging, validation, and recovery.
---
## Quick Commands
### Status Check
**PowerShell:**
```powershell
# Current git status
git status
# Recent commits
git log --oneline -10
# Current branch
git branch --show-current
```
**Bash:**
```bash
# Current git status
git status
# Recent commits
git log --oneline -10
# Current branch
git branch --show-current
```
---
## Wave Validation
### Verify Wave Completion
**Before marking a wave complete:**
1. All tasks have commits:
```powershell
git log --oneline -N # N = number of tasks in wave
```
2. All verifications passed (documented in SUMMARY.md)
3. STATE.md updated with current position
4. State snapshot created
### Wave Rollback
**If a wave needs to be reverted:**
```powershell
# Find commit before wave started
git log --oneline -20
# Reset to that commit (keeps changes staged)
git reset --soft <commit-hash>
# Or hard reset (discards changes)
git reset --hard <commit-hash>
```
---
## Debugging Procedures
### 3-Strike Rule
After 3 consecutive failed debug attempts:
1. **Stop** — Don't try a 4th approach in same session
2. **Document** in STATE.md:
```markdown
## Debug Session
**Problem:** {description}
**Attempts:**
1. {approach 1} → {result}
2. {approach 2} → {result}
3. {approach 3} → {result}
**Hypothesis:** {current theory}
**Recommended next:** {suggested approach}
```
3. **Fresh session** — Start new conversation with documented context
### Log Inspection
**Find relevant logs:**
```powershell
# Search for error patterns
Select-String -Path "*.log" -Pattern "error|exception|failed" -CaseSensitive:$false
```
```bash
# Search for error patterns
grep -ri "error\|exception\|failed" *.log
```
---
## Verification Commands
### Build Verification
```powershell
# Node.js
npm run build
if ($LASTEXITCODE -eq 0) { Write-Host "✅ Build passed" }
# Python
python -m py_compile src/**/*.py
```
### Test Verification
```powershell
# Node.js
npm test
# Python
pytest -v
# Go
go test ./...
```
### Lint Verification
```powershell
# Node.js
npm run lint
# Python
ruff check .
# Go
golangci-lint run
```
---
## State Recovery
### From STATE.md
When resuming work:
1. Read STATE.md for current position
2. Check "Last Action" for context
3. Follow "Next Steps" to continue
4. Verify recent commits match documented progress
### From Git History
If STATE.md is outdated:
```powershell
# See recent work
git log --oneline -20
# Check specific commit details
git show <commit-hash> --stat
# View file at specific commit
git show <commit-hash>:path/to/file
```
### Context Pollution Recovery
If quality is degrading mid-session:
1. Create state snapshot immediately
2. Update STATE.md with full context
3. Commit any pending work
4. Start fresh session
5. Run `/resume` to reload context
---
## Search Commands
### Find in Codebase
**PowerShell:**
```powershell
# Find pattern in files
Select-String -Path "src/**/*.ts" -Pattern "TODO" -Recurse
# Find files by name
Get-ChildItem -Recurse -Filter "*.config.*"
```
**Bash:**
```bash
# Find pattern in files (with ripgrep)
rg "TODO" --type ts
# Find pattern in files (with grep)
grep -r "TODO" src/
# Find files by name
find . -name "*.config.*"
```
### Search-First Workflow
Before reading any file:
1. Search for relevant terms:
```powershell
Select-String -Path "**/*.md" -Pattern "architecture" -Recurse
```
2. Identify candidate files from results
3. Read only relevant sections:
```powershell
Get-Content file.md | Select-Object -Skip 49 -First 20 # Lines 50-70
```
---
## Common Issues
### "SPEC.md not FINALIZED"
**Cause:** Planning lock prevents implementation
**Fix:**
1. Open `.gsd/SPEC.md`
2. Complete all required sections
3. Change status to `Status: FINALIZED`
4. Retry command
### "Context degrading"
**Symptoms:** Shorter responses, skipped steps, inconsistency
**Fix:**
1. Create state snapshot
2. Commit current work
3. Start fresh session
4. Run `/resume`
### "Commit failed"
**Causes:** Staged conflicts, hook failures
**Debug:**
```powershell
git status
git diff --staged
```
---
## Checklist Templates
### Pre-Execution Checklist
- [ ] SPEC.md is FINALIZED
- [ ] ROADMAP.md has current phase
- [ ] STATE.md loaded and understood
- [ ] Previous wave verified complete
### Post-Wave Checklist
- [ ] All tasks committed
- [ ] Verifications documented
- [ ] STATE.md updated
- [ ] State snapshot created
- [ ] No uncommitted changes
### Session End Checklist
- [ ] Current work committed
- [ ] STATE.md has "Next Steps"
- [ ] JOURNAL.md updated (if milestone)
- [ ] No loose ends
---
*See PROJECT_RULES.md for canonical rules.*
*See docs/model-selection-playbook.md for model guidance.*
|