|
| 1 | +# File Schemas Reference |
| 2 | + |
| 3 | +<purpose> |
| 4 | +Canonical schemas for all GSD-generated files. |
| 5 | +Use this when creating or validating STATE.md, config.json, SUMMARY.md, or PLAN.md files. |
| 6 | +</purpose> |
| 7 | + |
| 8 | +<schemas> |
| 9 | + |
| 10 | +## STATE.md |
| 11 | + |
| 12 | +The living memory file that persists across sessions. |
| 13 | + |
| 14 | +```markdown |
| 15 | +# State |
| 16 | + |
| 17 | +## Current Position |
| 18 | +- **Milestone:** v1.0 (MVP) |
| 19 | +- **Phase:** 03 - API Endpoints |
| 20 | +- **Plan:** 03-02 |
| 21 | +- **Status:** executing | planning | paused | blocked |
| 22 | + |
| 23 | +## Decisions |
| 24 | +<!-- Append-only log. Never delete entries. --> |
| 25 | +| # | Decision | Rationale | Phase | |
| 26 | +|---|----------|-----------|-------| |
| 27 | +| 1 | Use jose over jsonwebtoken | CommonJS compatibility in Next.js | 02 | |
| 28 | +| 2 | PostgreSQL over SQLite | Multi-user concurrency required | 01 | |
| 29 | + |
| 30 | +## Deferred Issues |
| 31 | +<!-- Track non-blocking issues for later. --> |
| 32 | +| # | Issue | Severity | Discovered | Phase | |
| 33 | +|---|-------|----------|------------|-------| |
| 34 | +| 1 | Rate limiting not implemented | medium | Phase 03 | 03 | |
| 35 | + |
| 36 | +## Blockers |
| 37 | +<!-- Active blockers preventing progress. Remove when resolved. --> |
| 38 | +_None_ |
| 39 | + |
| 40 | +## Session Notes |
| 41 | +<!-- Updated each session. Overwrite freely. --> |
| 42 | +- Last worked: 2026-03-15 |
| 43 | +- Next step: Execute 03-02-PLAN.md |
| 44 | +- Context: Auth middleware complete, starting API routes |
| 45 | + |
| 46 | +## Metrics |
| 47 | +- Plans completed: 8 |
| 48 | +- Plans remaining: 4 |
| 49 | +- Avg plan time: 3.2 min |
| 50 | +``` |
| 51 | + |
| 52 | +### Rules |
| 53 | +- **Current Position**: Always reflects actual state. Updated by every GSD command. |
| 54 | +- **Decisions**: Append-only. Never edit or remove past decisions. |
| 55 | +- **Deferred Issues**: Move to ISSUES.md at milestone completion. |
| 56 | +- **Session Notes**: Overwritten each session — ephemeral context only. |
| 57 | +- **Metrics**: Auto-updated by `/gsd:progress`. |
| 58 | + |
| 59 | +--- |
| 60 | + |
| 61 | +## config.json |
| 62 | + |
| 63 | +Project configuration. Created by `/gsd:new-project`, editable via `/gsd:settings`. |
| 64 | + |
| 65 | +```json |
| 66 | +{ |
| 67 | + "version": "1.24.0", |
| 68 | + "mode": "interactive", |
| 69 | + "granularity": "standard", |
| 70 | + "model_profile": "balanced", |
| 71 | + "model_routing": { |
| 72 | + "enabled": true, |
| 73 | + "default_model": "sonnet", |
| 74 | + "routing": { |
| 75 | + "validation": "haiku", |
| 76 | + "file_ops": "haiku", |
| 77 | + "execution": "sonnet", |
| 78 | + "planning": "sonnet", |
| 79 | + "complex_planning": "opus", |
| 80 | + "decisions": "opus", |
| 81 | + "research": "opus" |
| 82 | + }, |
| 83 | + "escalation": { |
| 84 | + "haiku_retry_limit": 2, |
| 85 | + "auto_escalate": true |
| 86 | + }, |
| 87 | + "overrides": { |
| 88 | + "always_opus": ["new-project", "discuss-milestone"], |
| 89 | + "always_sonnet": ["execute-plan"], |
| 90 | + "prefer_haiku": ["progress", "help"] |
| 91 | + } |
| 92 | + }, |
| 93 | + "adaptive_context": { |
| 94 | + "enabled": true |
| 95 | + }, |
| 96 | + "checkpoints": { |
| 97 | + "enabled": true |
| 98 | + }, |
| 99 | + "workflow": { |
| 100 | + "research": true, |
| 101 | + "plan_check": true, |
| 102 | + "verifier": true, |
| 103 | + "auto_advance": false, |
| 104 | + "node_repair": true, |
| 105 | + "node_repair_budget": 2 |
| 106 | + }, |
| 107 | + "parallelization": { |
| 108 | + "enabled": true |
| 109 | + }, |
| 110 | + "planning": { |
| 111 | + "commit_docs": true |
| 112 | + }, |
| 113 | + "git": { |
| 114 | + "branching_strategy": "none", |
| 115 | + "phase_branch_template": "gsd/phase-{phase}-{slug}", |
| 116 | + "milestone_branch_template": "gsd/{milestone}-{slug}" |
| 117 | + } |
| 118 | +} |
| 119 | +``` |
| 120 | + |
| 121 | +### Field Reference |
| 122 | + |
| 123 | +| Field | Type | Default | Description | |
| 124 | +|-------|------|---------|-------------| |
| 125 | +| `version` | string | — | GSD version that created this config | |
| 126 | +| `mode` | enum | `"interactive"` | `"yolo"` auto-approves, `"interactive"` confirms | |
| 127 | +| `granularity` | enum | `"standard"` | `"coarse"` / `"standard"` / `"fine"` — controls phase splitting | |
| 128 | +| `model_profile` | enum | `"balanced"` | `"quality"` / `"balanced"` / `"budget"` / `"inherit"` | |
| 129 | +| `model_routing.enabled` | bool | `true` | Enable multi-model routing | |
| 130 | +| `adaptive_context.enabled` | bool | `true` | Enable tiered context loading | |
| 131 | +| `checkpoints.enabled` | bool | `true` | Enable git checkpoint tags | |
| 132 | +| `workflow.research` | bool | `true` | Spawn research agent before planning | |
| 133 | +| `workflow.plan_check` | bool | `true` | Verify plans before execution | |
| 134 | +| `workflow.verifier` | bool | `true` | Verify output after execution | |
| 135 | +| `workflow.auto_advance` | bool | `false` | Chain discuss → plan → execute | |
| 136 | +| `workflow.node_repair` | bool | `true` | Auto-fix failed task verification | |
| 137 | +| `workflow.node_repair_budget` | int | `2` | Max repair attempts per task | |
| 138 | + |
| 139 | +### Defaults |
| 140 | +All fields are optional. Missing fields use defaults shown above. |
| 141 | +The file itself is optional — GSD works without it using all defaults. |
| 142 | + |
| 143 | +--- |
| 144 | + |
| 145 | +## SUMMARY.md Frontmatter |
| 146 | + |
| 147 | +Created after each plan execution. Frontmatter enables the dependency graph. |
| 148 | + |
| 149 | +```yaml |
| 150 | +--- |
| 151 | +phase: 03 |
| 152 | +plan: 03-02 |
| 153 | +title: API Endpoints - User Routes |
| 154 | +status: complete |
| 155 | +subsystem: api, auth |
| 156 | +requires: |
| 157 | + - phase: 02 |
| 158 | + provides: [JWT middleware, User model] |
| 159 | + - phase: 01 |
| 160 | + provides: [Database schema, Prisma client] |
| 161 | +provides: [User CRUD endpoints, Auth routes] |
| 162 | +affects: [frontend, tests] |
| 163 | +tech-stack: [Next.js, Prisma, jose] |
| 164 | +key-files: |
| 165 | + - src/app/api/users/route.ts |
| 166 | + - src/app/api/auth/login/route.ts |
| 167 | +--- |
| 168 | +``` |
| 169 | + |
| 170 | +### Frontmatter Fields |
| 171 | + |
| 172 | +| Field | Required | Type | Description | |
| 173 | +|-------|----------|------|-------------| |
| 174 | +| `phase` | yes | int | Phase number | |
| 175 | +| `plan` | yes | string | Plan ID (e.g., "03-02") | |
| 176 | +| `title` | yes | string | Human-readable plan title | |
| 177 | +| `status` | yes | enum | `complete` / `partial` / `failed` | |
| 178 | +| `subsystem` | no | string | Comma-separated subsystem tags | |
| 179 | +| `requires` | no | list | Phases this plan depends on | |
| 180 | +| `requires[].phase` | — | int | Required phase number | |
| 181 | +| `requires[].provides` | — | list | What that phase provides | |
| 182 | +| `provides` | no | list | What this plan makes available | |
| 183 | +| `affects` | no | list | Subsystems impacted | |
| 184 | +| `tech-stack` | no | list | Technologies used | |
| 185 | +| `key-files` | no | list | Important files created/modified | |
| 186 | + |
| 187 | +### How It's Used |
| 188 | +1. **Context loader** reads frontmatter to build dependency graph |
| 189 | +2. **Plan-phase** uses `requires` to load only relevant prior summaries |
| 190 | +3. **Progress** uses `status` to track completion |
| 191 | +4. **Subsystem detection** uses `subsystem` and `affects` for smart loading |
| 192 | + |
| 193 | +### Body Format |
| 194 | + |
| 195 | +```markdown |
| 196 | +## What Was Done |
| 197 | +- Bullet list of completed work |
| 198 | + |
| 199 | +## Key Decisions |
| 200 | +- Decision and rationale (also logged in STATE.md) |
| 201 | + |
| 202 | +## Files Changed |
| 203 | +- `path/to/file.ts` — what changed and why |
| 204 | + |
| 205 | +## Deviations |
| 206 | +- Any deviations from the plan and why |
| 207 | + |
| 208 | +## Issues Discovered |
| 209 | +- Non-blocking issues found (tracked in STATE.md deferred issues) |
| 210 | +``` |
| 211 | + |
| 212 | +--- |
| 213 | + |
| 214 | +## PLAN.md Task Format |
| 215 | + |
| 216 | +```xml |
| 217 | +<plan> |
| 218 | + <meta> |
| 219 | + <phase>03</phase> |
| 220 | + <plan_id>03-02</plan_id> |
| 221 | + <title>User API Routes</title> |
| 222 | + <files_to_read> |
| 223 | + src/lib/db.ts |
| 224 | + src/middleware/auth.ts |
| 225 | + </files_to_read> |
| 226 | + </meta> |
| 227 | + |
| 228 | + <tasks> |
| 229 | + <task type="auto"> |
| 230 | + <name>Create user CRUD endpoints</name> |
| 231 | + <files>src/app/api/users/route.ts, src/app/api/users/[id]/route.ts</files> |
| 232 | + <action> |
| 233 | + Implement GET (list/single), POST (create), PUT (update), DELETE. |
| 234 | + Use Prisma client from src/lib/db.ts. |
| 235 | + Apply auth middleware to all routes. |
| 236 | + </action> |
| 237 | + <verify> |
| 238 | + curl localhost:3000/api/users returns 200 with user list. |
| 239 | + curl -X POST with valid body returns 201. |
| 240 | + </verify> |
| 241 | + <done>All CRUD operations work with auth required</done> |
| 242 | + </task> |
| 243 | + |
| 244 | + <task type="checkpoint:human-verify"> |
| 245 | + <name>Verify API responses match frontend expectations</name> |
| 246 | + <criteria> |
| 247 | + Response shape matches TypeScript interfaces in src/types/ |
| 248 | + </criteria> |
| 249 | + </task> |
| 250 | + </tasks> |
| 251 | + |
| 252 | + <acceptance_criteria> |
| 253 | + All user endpoints operational with authentication. |
| 254 | + Error responses follow consistent format. |
| 255 | + </acceptance_criteria> |
| 256 | +</plan> |
| 257 | +``` |
| 258 | + |
| 259 | +### Task Types |
| 260 | + |
| 261 | +| Type | Frequency | Description | |
| 262 | +|------|-----------|-------------| |
| 263 | +| `auto` | ~90% | Fully automated — execute + verify | |
| 264 | +| `checkpoint:human-verify` | ~9% | Pause for user confirmation | |
| 265 | +| `checkpoint:decision` | ~0.9% | Present options, user chooses | |
| 266 | +| `checkpoint:human-action` | ~0.1% | User must do something external | |
| 267 | + |
| 268 | +</schemas> |
0 commit comments