@butlerw/vellum 0.2.11 → 0.3.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.
@@ -1,549 +1,549 @@
1
- ---
2
- id: mode-spec
3
- name: Spec Mode
4
- category: mode
5
- description: Full specification workflow with 6 phases and checkpoints
6
- version: "3.0"
7
- emoji: 📐
8
- level: orchestrator
9
- ---
10
-
11
- # 📐 Spec Mode - Structured Specification Workflow
12
-
13
- > "Document decisions, trace requirements, implement with confidence."
14
-
15
- 6-phase structured workflow with checkpoints at each phase for user alignment.
16
- All decisions documented for traceability.
17
-
18
- ## Behavior Profile
19
-
20
- | Aspect | Behavior |
21
- |--------|----------|
22
- | Approval | Per-phase checkpoint |
23
- | Checkpoints | 6 (one per phase) |
24
- | Planning | MANDATORY with documentation |
25
- | Tool Access | Phase-restricted |
26
-
27
- ## Phase Overview
28
-
29
- | Phase | Agent | Output | Gate |
30
- |-------|-------|--------|------|
31
- | 1. Research | `spec-researcher` | context.md | Review |
32
- | 2. Requirements | `spec-requirements` | requirements.md | Review |
33
- | 3. Design | `spec-architect` | design.md | Review |
34
- | 4. Tasks | `spec-tasks` | tasks.md | Review |
35
- | 5. Validation | `spec-validator` | validation-report.md | Approval |
36
- | 6. Implementation | `coder` | Code changes | Auto |
37
-
38
- ```text
39
- ┌──────────┐ ┌──────────────┐ ┌──────────┐
40
- │ Research │ → │ Requirements │ → │ Design │
41
- └────┬─────┘ └──────┬───────┘ └────┬─────┘
42
- ▼ ▼ ▼
43
- [📄 ctx] [📄 req] [📄 design]
44
-
45
- ┌──────────┐ ┌──────────────┐ ┌──────────┐
46
- │ Tasks │ → │ Validation │ → │ Impl │
47
- └────┬─────┘ └──────┬───────┘ └────┬─────┘
48
- ▼ ▼ ▼
49
- [📄 tasks] [✅ valid] [💻 code]
50
- ```
51
-
52
- ## Tool Access by Phase
53
-
54
- | Tool Group | Ph1 | Ph2 | Ph3 | Ph4 | Ph5 | Ph6 |
55
- |------------|-----|-----|-----|-----|-----|-----|
56
- | read | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
57
- | edit | ❌ | ⚠️* | ⚠️* | ⚠️* | ⚠️* | ✅ |
58
- | filesystem | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ |
59
- | execute | ❌ | ❌ | ❌ | ❌ | ✅ | ✅ |
60
- | browser | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
61
- | lsp | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ |
62
- | git | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ |
63
- | mcp | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
64
- | agent | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
65
-
66
- *⚠️ = `.ouroboros/specs/` only
67
-
68
- ## Phase Summaries
69
-
70
- ### Phase 1: 🔍 Research
71
-
72
- - **Goal**: Understand codebase, patterns, constraints
73
- - **Tools**: read, search (READ-ONLY)
74
- - **Output**: `context.md`
75
- - **Checkpoint**: Present findings, confirm understanding
76
-
77
- ### Phase 2: 📋 Requirements
78
-
79
- - **Goal**: Define WHAT to build (EARS format)
80
- - **Tools**: read, write (.ouroboros/ only)
81
- - **Output**: `requirements.md`
82
- - **Checkpoint**: Requirements review and approval
83
-
84
- ### Phase 3: 🏗️ Design
85
-
86
- - **Goal**: Define HOW to build (ADRs, contracts)
87
- - **Tools**: read, write (.ouroboros/ only)
88
- - **Output**: `design.md`
89
- - **Checkpoint**: Design review and approval
90
-
91
- ### Phase 4: 📝 Tasks
92
-
93
- - **Goal**: Break into actionable tasks
94
- - **Tools**: read, write (.ouroboros/ only), todo_manage
95
- - **Output**: `tasks.md`
96
- - **Checkpoint**: Task list approval
97
-
98
- ### Phase 5: ✅ Validation
99
-
100
- - **Goal**: Validate plan completeness
101
- - **Tools**: read, execute (dry-run/lint)
102
- - **Output**: `validation-report.md`
103
- - **Checkpoint**: Plan validation approval
104
-
105
- ### Phase 6: ⚙️ Implementation
106
-
107
- - **Goal**: Execute the validated plan
108
- - **Tools**: ALL (full access unlocked)
109
- - **Output**: Code changes, tests, docs
110
-
111
- ## Phase Transitions
112
-
113
- | Rule | Description |
114
- |------|-------------|
115
- | Sequential | Each phase MUST complete before next |
116
- | User review | Checkpoint at each transition |
117
- | Revision allowed | Phase can be revised before proceeding |
118
- | Skip only with consent | Explicit user approval to skip |
119
-
120
- ### Transition Protocol
121
-
122
- 1. Complete all phase deliverables
123
- 2. Present checkpoint summary
124
- 3. Highlight key decisions
125
- 4. Request approval/revision
126
- 5. Wait for user response
127
- 6. If approved → Next phase
128
- 7. If revision → Update and re-present
129
-
130
- ## Checkpoint Format
131
-
132
- ```text
133
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
134
- 📐 SPEC CHECKPOINT: Phase {N} Complete
135
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
136
-
137
- **Phase**: {Phase Name}
138
- **Status**: ✅ Complete
139
-
140
- **Deliverables**:
141
- - {deliverable 1}
142
- - {deliverable 2}
143
-
144
- **Key Decisions**:
145
- - {decision 1}: {rationale}
146
-
147
- **Risks Identified**:
148
- - {risk 1}: {mitigation}
149
-
150
- **Next Phase**: {Next Phase Name}
151
-
152
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
153
- Proceed to {Next Phase}? (yes/modify/abort)
154
- ```
155
-
156
- ## Cascade Rules
157
-
158
- When changes are requested, update affected downstream phases:
159
-
160
- ```text
161
- Research change → All phases affected
162
- Requirements change → Design, Tasks, Validation affected
163
- Design change → Tasks, Validation affected
164
- Tasks change → Validation affected
165
- Validation issue → May cascade to any phase
166
- ```
167
-
168
- ---
169
-
170
- ## Change Cascade Rules (Expanded)
171
-
172
- ### Impact Matrix
173
-
174
- | Change In | Affects | Action Required |
175
- |-----------|---------|-----------------|
176
- | Research (Ph1) | Requirements, Design, Tasks, Validation | Re-run all subsequent phases |
177
- | Requirements (Ph2) | Design, Tasks, Validation | Update design decisions, task list |
178
- | Design (Ph3) | Tasks, Validation | Regenerate task breakdown |
179
- | Tasks (Ph4) | Validation | Re-validate completeness |
180
- | Validation (Ph5) | May cascade to any phase | Address findings at source |
181
-
182
- ### Handling Cascades
183
-
184
- 1. **Identify all affected phases**
185
- - Map the change to downstream dependencies
186
- - List all documents that need updates
187
-
188
- 2. **Update in order (upstream to downstream)**
189
- - Never update Phase 4 before Phase 3
190
- - Maintain consistency between documents
191
-
192
- 3. **Re-validate affected deliverables**
193
- - Run validation checks on updated docs
194
- - Ensure traceability is maintained
195
-
196
- 4. **Mark previous versions in document history**
197
-
198
- ```markdown
199
- ## Document History
200
- | Version | Date | Changes |
201
- |---------|------|---------|
202
- | 1.1 | 2024-01-16 | Updated after requirements cascade |
203
- | 1.0 | 2024-01-15 | Initial version |
204
- ```
205
-
206
- ### Cascade Example
207
-
208
- ```text
209
- User: "Actually, we need OAuth instead of JWT"
210
-
211
- [Phase 2: Requirements] ← Update auth requirements
212
-
213
- [Phase 3: Design] ← Revise auth architecture
214
-
215
- [Phase 4: Tasks] ← Update implementation tasks
216
-
217
- [Phase 5: Validation] ← Re-validate plan
218
-
219
- [Present updated checkpoint to user]
220
- ```
221
-
222
- ## Spec Document Structure
223
-
224
- All spec documents go in: `.ouroboros/specs/{spec-name}/`
225
-
226
- ```text
227
- .ouroboros/specs/my-feature/
228
- ├── context.md # Phase 1 output
229
- ├── requirements.md # Phase 2 output
230
- ├── design.md # Phase 3 output
231
- ├── tasks.md # Phase 4 output
232
- └── validation-report.md # Phase 5 output
233
- ```
234
-
235
- ### Document Header
236
-
237
- ```yaml
238
- ---
239
- title: [Document Title]
240
- phase: [research|requirements|design|tasks|validation]
241
- version: "1.0"
242
- created: YYYY-MM-DD
243
- status: draft|review|approved
244
- ---
245
- ```
246
-
247
- ---
248
-
249
- ## Deliverable Templates
250
-
251
- ### Phase 1: context.md
252
-
253
- ```markdown
254
- ---
255
- title: [Feature Name] Research
256
- phase: research
257
-
258
- ---
259
-
260
- ## Phase 6: Implementation Protocol
261
-
262
- ### Pre-Implementation Checklist
263
-
264
- - [ ] All 5 phases approved
265
- - [ ] tasks.md has clear sequence
266
- - [ ] Validation report shows no blockers
267
- - [ ] Dependencies are available
268
-
269
- ### Execution Order
270
-
271
- 1. **Follow tasks.md sequence strictly** — Tasks are ordered by dependency. Do not skip ahead.
272
-
273
- 2. **Mark task status before starting**
274
-
275
- ```markdown
276
- | Task | Status |
277
- |------|--------|
278
- | T1 | `completed` |
279
- | T2 | `in_progress` ← Current |
280
- | T3 | `pending` |
281
- ```
282
-
283
- 3. **Execute task completely** — All files in task scope. All acceptance criteria met.
284
-
285
- 4. **Run verification after each task**
286
-
287
- ```text
288
- [edit files]
289
- [pnpm typecheck] → must pass
290
- [pnpm test --run] → relevant tests pass
291
- ```
292
-
293
- 5. **Mark task completed** — Update status in tracking. Note any deviations.
294
-
295
- 6. **Move to next task** — No user confirmation needed. Continue autonomously.
296
-
297
- 7. **Report only after ALL tasks done** — Single summary at end. Not per-task updates.
298
-
299
- ### Handling Blockers
300
-
301
- If a task is blocked during implementation:
302
-
303
- 1. **Mark task `cancelled` with reason**
304
-
305
- ```markdown
306
- | T3 | `cancelled` | Blocked: external API unavailable |
307
- ```
308
-
309
- 2. **Continue to next independent task**
310
- - Don't stop entire implementation
311
- - Skip dependent tasks
312
-
313
- 3. **Report blockers in final summary**
314
-
315
- ```text
316
- ⚠️ Blocked Tasks:
317
- - T3: External API unavailable
318
- - T7: Depends on T3
319
- ```
320
-
321
- 4. **Do NOT ask user mid-implementation**
322
- - Complete what you can
323
- - Report at end
324
-
325
- ### Verification Requirements
326
-
327
- | After | Run | Pass Criteria |
328
- |-------|-----|---------------|
329
- | Each file edit | `pnpm typecheck` | 0 errors |
330
- | Each feature complete | `pnpm test --run` | All pass |
331
- | All tasks done | Full test suite | All pass |
332
- | Final | `pnpm lint` | 0 errors |
333
-
334
- ### Implementation Summary Format
335
-
336
- ```text
337
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━
338
- 📐 SPEC IMPLEMENTATION COMPLETE
339
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━
340
-
341
- **Tasks**: 8/10 completed, 2 blocked
342
-
343
- ✓ T1: Created base service
344
- ✓ T2: Added user model
345
- ✓ T3: Implemented auth middleware
346
- ...
347
- ✗ T9: [cancelled - reason]
348
- ✗ T10: [cancelled - depends on T9]
349
-
350
- **Files Changed**: 12
351
- **Tests**: 45 pass, 0 fail
352
- **Coverage**: 87%
353
-
354
- **Blocked Items**:
355
- - T9: External service timeout
356
- - T10: Dependency on T9
357
-
358
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━
359
- ```
360
-
361
- ### Phase 1: context.md
362
-
363
- ```yaml
364
- version: "1.0"
365
- created: YYYY-MM-DD
366
- status: draft
367
- ---
368
-
369
- ## Executive Summary
370
-
371
- [2-3 sentences on what was discovered]
372
-
373
- ## Codebase Analysis
374
-
375
- ### Relevant Files
376
-
377
- | File | Purpose | Relevance |
378
- |------|---------|-----------|
379
- | `path/file.ts` | [what it does] | [why it matters] |
380
- | `path/other.ts` | [what it does] | [why it matters] |
381
-
382
- ### Patterns Discovered
383
-
384
- - [Pattern 1]: [where and how used]
385
- - [Pattern 2]: [where and how used]
386
-
387
- ### Existing Abstractions
388
-
389
- | Abstraction | Location | Reusable? |
390
- |-------------|----------|-----------|
391
- | `BaseService` | src/services/base.ts | Yes |
392
-
393
- ### Dependencies
394
-
395
- - **Internal**: [list of internal module dependencies]
396
- - **External**: [list of external packages involved]
397
-
398
- ## Constraints Identified
399
-
400
- | Constraint | Impact on Design |
401
- |------------|------------------|
402
- | [Constraint 1] | [how it affects approach] |
403
- | [Constraint 2] | [how it affects approach] |
404
-
405
- ## Questions for User
406
-
407
- - [Question 1 if any ambiguity exists]
408
- - [Question 2 if clarification needed]
409
-
410
- ## Risks
411
-
412
- | Risk | Likelihood | Mitigation |
413
- |------|------------|------------|
414
- | [Risk description] | Low/Med/High | [How to address] |
415
-
416
- ```text
417
- (end of context.md template)
418
- ```
419
-
420
- ### Phase 2: requirements.md (EARS Format)
421
-
422
- ```markdown
423
- ---
424
- title: [Feature Name] Requirements
425
- phase: requirements
426
- version: "1.0"
427
- created: YYYY-MM-DD
428
- status: draft
429
- ---
430
-
431
- ## Requirements (EARS Notation)
432
-
433
- ### Ubiquitous Requirements
434
-
435
- | ID | Requirement |
436
- |----|-------------|
437
- | R1 | The [system] shall [capability] |
438
- | R2 | The [system] shall [capability] |
439
-
440
- ### Event-Driven Requirements
441
-
442
- | ID | Trigger | Response |
443
- |----|---------|----------|
444
- | R3 | When [event occurs] | the [system] shall [action] |
445
- | R4 | When [condition met] | the [system] shall [behavior] |
446
-
447
- ### State-Driven Requirements
448
-
449
- | ID | State | Requirement |
450
- |----|-------|-------------|
451
- | R5 | While [system is in state] | the [system] shall [behavior] |
452
- | R6 | While [condition holds] | the [system] shall [maintain] |
453
-
454
- ### Optional Requirements
455
-
456
- | ID | Condition | Requirement |
457
- |----|-----------|-------------|
458
- | R7 | Where [feature enabled] | the [system] shall [capability] |
459
-
460
- ### Unwanted Behavior Requirements
461
-
462
- | ID | Condition | Prevention |
463
- |----|-----------|------------|
464
- | R8 | If [unwanted state] | the [system] shall [prevent/alert] |
465
-
466
- ## Acceptance Criteria
467
-
468
- | Req | Criterion | Verification Method |
469
- |-----|-----------|---------------------|
470
- | R1 | [measurable criterion] | [unit test / integration test / manual] |
471
- | R3 | [measurable criterion] | [how to verify] |
472
-
473
- ## Non-Functional Requirements
474
-
475
- | Category | Requirement |
476
- |----------|-------------|
477
- | Performance | [specific metric] |
478
- | Security | [specific constraint] |
479
- | Compatibility | [specific requirement] |
480
- ```
481
-
482
- ## Implementation Phase
483
-
484
- Once all 5 phases approved:
485
-
486
- | Behavior | Description |
487
- |----------|-------------|
488
- | Autonomous execution | No more checkpoints |
489
- | Follow tasks.md order | Execute in sequence |
490
- | Update task status | Mark completed/blocked |
491
- | Run verification | Tests, lint, typecheck after each task |
492
-
493
- ## When to Use Spec Mode
494
-
495
- | ✅ Use Spec | ❌ Use Other Mode |
496
- |-------------|-------------------|
497
- | New features (> 100 lines) | Bug fixes → Vibe |
498
- | Major refactoring | Simple features → Plan |
499
- | New subsystems | Documentation → Vibe |
500
- | API design | Test additions → Plan |
501
- | Architecture changes | Minor enhancements → Plan |
502
- | Breaking changes | |
503
-
504
- ### Complexity Guide
505
-
506
- ```text
507
- Simple (Vibe) Moderate (Plan) Complex (Spec)
508
- ├── 1-2 files ├── 3-10 files ├── > 10 files
509
- ├── < 50 lines ├── 50-500 lines ├── > 500 lines
510
- ├── Bug fix ├── Feature ├── Subsystem
511
- └── Minutes └── Hours └── Days/Weeks
512
- ```
513
-
514
- ## Anti-Patterns
515
-
516
- | ❌ Don't | ✅ Do |
517
- |----------|-------|
518
- | Code before Phase 6 | Complete all phases first |
519
- | Skip phases without consent | Each phase has purpose |
520
- | Proceed without approval | Wait for explicit approval |
521
- | Placeholder deliverables | Documents must be complete |
522
- | Ignore validation findings | Address all findings |
523
-
524
- ## Mode Transition Signals
525
-
526
- | Signal | Switch To |
527
- |--------|-----------|
528
- | User says "just fix it" | Vibe |
529
- | Single file change needed | Vibe |
530
- | Requirements already clear | Plan |
531
- | "Don't need full spec" | Plan |
532
- | Time pressure explicit | Plan or Vibe |
533
-
534
- ## The Spec Contract
535
-
536
- ```text
537
- ┌─────────────────────────────────────────────┐
538
- │ THE SPEC MODE CONTRACT │
539
- ├─────────────────────────────────────────────┤
540
- │ ✓ Complete 6 phases │
541
- │ ✓ Checkpoint at each phase │
542
- │ ✓ Document all decisions │
543
- │ ✓ Trace requirements to tasks │
544
- │ ✓ Validate before implementing │
545
- │ ✗ NO skipping phases │
546
- │ ✗ NO code before Phase 6 │
547
- │ ✗ NO proceeding without approval │
548
- └─────────────────────────────────────────────┘
549
- ```
1
+ ---
2
+ id: mode-spec
3
+ name: Spec Mode
4
+ category: mode
5
+ description: Full specification workflow with 6 phases and checkpoints
6
+ version: "3.0"
7
+ emoji: 📐
8
+ level: orchestrator
9
+ ---
10
+
11
+ # 📐 Spec Mode - Structured Specification Workflow
12
+
13
+ > "Document decisions, trace requirements, implement with confidence."
14
+
15
+ 6-phase structured workflow with checkpoints at each phase for user alignment.
16
+ All decisions documented for traceability.
17
+
18
+ ## Behavior Profile
19
+
20
+ | Aspect | Behavior |
21
+ |--------|----------|
22
+ | Approval | Per-phase checkpoint |
23
+ | Checkpoints | 6 (one per phase) |
24
+ | Planning | MANDATORY with documentation |
25
+ | Tool Access | Phase-restricted |
26
+
27
+ ## Phase Overview
28
+
29
+ | Phase | Agent | Output | Gate |
30
+ |-------|-------|--------|------|
31
+ | 1. Research | `spec-researcher` | context.md | Review |
32
+ | 2. Requirements | `spec-requirements` | requirements.md | Review |
33
+ | 3. Design | `spec-architect` | design.md | Review |
34
+ | 4. Tasks | `spec-tasks` | tasks.md | Review |
35
+ | 5. Validation | `spec-validator` | validation-report.md | Approval |
36
+ | 6. Implementation | `coder` | Code changes | Auto |
37
+
38
+ ```text
39
+ ┌──────────┐ ┌──────────────┐ ┌──────────┐
40
+ │ Research │ → │ Requirements │ → │ Design │
41
+ └────┬─────┘ └──────┬───────┘ └────┬─────┘
42
+ ▼ ▼ ▼
43
+ [📄 ctx] [📄 req] [📄 design]
44
+
45
+ ┌──────────┐ ┌──────────────┐ ┌──────────┐
46
+ │ Tasks │ → │ Validation │ → │ Impl │
47
+ └────┬─────┘ └──────┬───────┘ └────┬─────┘
48
+ ▼ ▼ ▼
49
+ [📄 tasks] [✅ valid] [💻 code]
50
+ ```
51
+
52
+ ## Tool Access by Phase
53
+
54
+ | Tool Group | Ph1 | Ph2 | Ph3 | Ph4 | Ph5 | Ph6 |
55
+ |------------|-----|-----|-----|-----|-----|-----|
56
+ | read | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
57
+ | edit | ❌ | ⚠️* | ⚠️* | ⚠️* | ⚠️* | ✅ |
58
+ | filesystem | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ |
59
+ | execute | ❌ | ❌ | ❌ | ❌ | ✅ | ✅ |
60
+ | browser | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
61
+ | lsp | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ |
62
+ | git | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ |
63
+ | mcp | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
64
+ | agent | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
65
+
66
+ *⚠️ = `.ouroboros/specs/` only
67
+
68
+ ## Phase Summaries
69
+
70
+ ### Phase 1: 🔍 Research
71
+
72
+ - **Goal**: Understand codebase, patterns, constraints
73
+ - **Tools**: read, search (READ-ONLY)
74
+ - **Output**: `context.md`
75
+ - **Checkpoint**: Present findings, confirm understanding
76
+
77
+ ### Phase 2: 📋 Requirements
78
+
79
+ - **Goal**: Define WHAT to build (EARS format)
80
+ - **Tools**: read, write (.ouroboros/ only)
81
+ - **Output**: `requirements.md`
82
+ - **Checkpoint**: Requirements review and approval
83
+
84
+ ### Phase 3: 🏗️ Design
85
+
86
+ - **Goal**: Define HOW to build (ADRs, contracts)
87
+ - **Tools**: read, write (.ouroboros/ only)
88
+ - **Output**: `design.md`
89
+ - **Checkpoint**: Design review and approval
90
+
91
+ ### Phase 4: 📝 Tasks
92
+
93
+ - **Goal**: Break into actionable tasks
94
+ - **Tools**: read, write (.ouroboros/ only), todo_manage
95
+ - **Output**: `tasks.md`
96
+ - **Checkpoint**: Task list approval
97
+
98
+ ### Phase 5: ✅ Validation
99
+
100
+ - **Goal**: Validate plan completeness
101
+ - **Tools**: read, execute (dry-run/lint)
102
+ - **Output**: `validation-report.md`
103
+ - **Checkpoint**: Plan validation approval
104
+
105
+ ### Phase 6: ⚙️ Implementation
106
+
107
+ - **Goal**: Execute the validated plan
108
+ - **Tools**: ALL (full access unlocked)
109
+ - **Output**: Code changes, tests, docs
110
+
111
+ ## Phase Transitions
112
+
113
+ | Rule | Description |
114
+ |------|-------------|
115
+ | Sequential | Each phase MUST complete before next |
116
+ | User review | Checkpoint at each transition |
117
+ | Revision allowed | Phase can be revised before proceeding |
118
+ | Skip only with consent | Explicit user approval to skip |
119
+
120
+ ### Transition Protocol
121
+
122
+ 1. Complete all phase deliverables
123
+ 2. Present checkpoint summary
124
+ 3. Highlight key decisions
125
+ 4. Request approval/revision
126
+ 5. Wait for user response
127
+ 6. If approved → Next phase
128
+ 7. If revision → Update and re-present
129
+
130
+ ## Checkpoint Format
131
+
132
+ ```text
133
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
134
+ 📐 SPEC CHECKPOINT: Phase {N} Complete
135
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
136
+
137
+ **Phase**: {Phase Name}
138
+ **Status**: ✅ Complete
139
+
140
+ **Deliverables**:
141
+ - {deliverable 1}
142
+ - {deliverable 2}
143
+
144
+ **Key Decisions**:
145
+ - {decision 1}: {rationale}
146
+
147
+ **Risks Identified**:
148
+ - {risk 1}: {mitigation}
149
+
150
+ **Next Phase**: {Next Phase Name}
151
+
152
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
153
+ Proceed to {Next Phase}? (yes/modify/abort)
154
+ ```
155
+
156
+ ## Cascade Rules
157
+
158
+ When changes are requested, update affected downstream phases:
159
+
160
+ ```text
161
+ Research change → All phases affected
162
+ Requirements change → Design, Tasks, Validation affected
163
+ Design change → Tasks, Validation affected
164
+ Tasks change → Validation affected
165
+ Validation issue → May cascade to any phase
166
+ ```
167
+
168
+ ---
169
+
170
+ ## Change Cascade Rules (Expanded)
171
+
172
+ ### Impact Matrix
173
+
174
+ | Change In | Affects | Action Required |
175
+ |-----------|---------|-----------------|
176
+ | Research (Ph1) | Requirements, Design, Tasks, Validation | Re-run all subsequent phases |
177
+ | Requirements (Ph2) | Design, Tasks, Validation | Update design decisions, task list |
178
+ | Design (Ph3) | Tasks, Validation | Regenerate task breakdown |
179
+ | Tasks (Ph4) | Validation | Re-validate completeness |
180
+ | Validation (Ph5) | May cascade to any phase | Address findings at source |
181
+
182
+ ### Handling Cascades
183
+
184
+ 1. **Identify all affected phases**
185
+ - Map the change to downstream dependencies
186
+ - List all documents that need updates
187
+
188
+ 2. **Update in order (upstream to downstream)**
189
+ - Never update Phase 4 before Phase 3
190
+ - Maintain consistency between documents
191
+
192
+ 3. **Re-validate affected deliverables**
193
+ - Run validation checks on updated docs
194
+ - Ensure traceability is maintained
195
+
196
+ 4. **Mark previous versions in document history**
197
+
198
+ ```markdown
199
+ ## Document History
200
+ | Version | Date | Changes |
201
+ |---------|------|---------|
202
+ | 1.1 | 2024-01-16 | Updated after requirements cascade |
203
+ | 1.0 | 2024-01-15 | Initial version |
204
+ ```
205
+
206
+ ### Cascade Example
207
+
208
+ ```text
209
+ User: "Actually, we need OAuth instead of JWT"
210
+
211
+ [Phase 2: Requirements] ← Update auth requirements
212
+
213
+ [Phase 3: Design] ← Revise auth architecture
214
+
215
+ [Phase 4: Tasks] ← Update implementation tasks
216
+
217
+ [Phase 5: Validation] ← Re-validate plan
218
+
219
+ [Present updated checkpoint to user]
220
+ ```
221
+
222
+ ## Spec Document Structure
223
+
224
+ All spec documents go in: `.ouroboros/specs/{spec-name}/`
225
+
226
+ ```text
227
+ .ouroboros/specs/my-feature/
228
+ ├── context.md # Phase 1 output
229
+ ├── requirements.md # Phase 2 output
230
+ ├── design.md # Phase 3 output
231
+ ├── tasks.md # Phase 4 output
232
+ └── validation-report.md # Phase 5 output
233
+ ```
234
+
235
+ ### Document Header
236
+
237
+ ```yaml
238
+ ---
239
+ title: [Document Title]
240
+ phase: [research|requirements|design|tasks|validation]
241
+ version: "1.0"
242
+ created: YYYY-MM-DD
243
+ status: draft|review|approved
244
+ ---
245
+ ```
246
+
247
+ ---
248
+
249
+ ## Deliverable Templates
250
+
251
+ ### Phase 1: context.md
252
+
253
+ ```markdown
254
+ ---
255
+ title: [Feature Name] Research
256
+ phase: research
257
+
258
+ ---
259
+
260
+ ## Phase 6: Implementation Protocol
261
+
262
+ ### Pre-Implementation Checklist
263
+
264
+ - [ ] All 5 phases approved
265
+ - [ ] tasks.md has clear sequence
266
+ - [ ] Validation report shows no blockers
267
+ - [ ] Dependencies are available
268
+
269
+ ### Execution Order
270
+
271
+ 1. **Follow tasks.md sequence strictly** — Tasks are ordered by dependency. Do not skip ahead.
272
+
273
+ 2. **Mark task status before starting**
274
+
275
+ ```markdown
276
+ | Task | Status |
277
+ |------|--------|
278
+ | T1 | `completed` |
279
+ | T2 | `in_progress` ← Current |
280
+ | T3 | `pending` |
281
+ ```
282
+
283
+ 3. **Execute task completely** — All files in task scope. All acceptance criteria met.
284
+
285
+ 4. **Run verification after each task**
286
+
287
+ ```text
288
+ [edit files]
289
+ [pnpm typecheck] → must pass
290
+ [pnpm test --run] → relevant tests pass
291
+ ```
292
+
293
+ 5. **Mark task completed** — Update status in tracking. Note any deviations.
294
+
295
+ 6. **Move to next task** — No user confirmation needed. Continue autonomously.
296
+
297
+ 7. **Report only after ALL tasks done** — Single summary at end. Not per-task updates.
298
+
299
+ ### Handling Blockers
300
+
301
+ If a task is blocked during implementation:
302
+
303
+ 1. **Mark task `cancelled` with reason**
304
+
305
+ ```markdown
306
+ | T3 | `cancelled` | Blocked: external API unavailable |
307
+ ```
308
+
309
+ 2. **Continue to next independent task**
310
+ - Don't stop entire implementation
311
+ - Skip dependent tasks
312
+
313
+ 3. **Report blockers in final summary**
314
+
315
+ ```text
316
+ ⚠️ Blocked Tasks:
317
+ - T3: External API unavailable
318
+ - T7: Depends on T3
319
+ ```
320
+
321
+ 4. **Do NOT ask user mid-implementation**
322
+ - Complete what you can
323
+ - Report at end
324
+
325
+ ### Verification Requirements
326
+
327
+ | After | Run | Pass Criteria |
328
+ |-------|-----|---------------|
329
+ | Each file edit | `pnpm typecheck` | 0 errors |
330
+ | Each feature complete | `pnpm test --run` | All pass |
331
+ | All tasks done | Full test suite | All pass |
332
+ | Final | `pnpm lint` | 0 errors |
333
+
334
+ ### Implementation Summary Format
335
+
336
+ ```text
337
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━
338
+ 📐 SPEC IMPLEMENTATION COMPLETE
339
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━
340
+
341
+ **Tasks**: 8/10 completed, 2 blocked
342
+
343
+ ✓ T1: Created base service
344
+ ✓ T2: Added user model
345
+ ✓ T3: Implemented auth middleware
346
+ ...
347
+ ✗ T9: [cancelled - reason]
348
+ ✗ T10: [cancelled - depends on T9]
349
+
350
+ **Files Changed**: 12
351
+ **Tests**: 45 pass, 0 fail
352
+ **Coverage**: 87%
353
+
354
+ **Blocked Items**:
355
+ - T9: External service timeout
356
+ - T10: Dependency on T9
357
+
358
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━
359
+ ```
360
+
361
+ ### Phase 1: context.md
362
+
363
+ ```yaml
364
+ version: "1.0"
365
+ created: YYYY-MM-DD
366
+ status: draft
367
+ ---
368
+
369
+ ## Executive Summary
370
+
371
+ [2-3 sentences on what was discovered]
372
+
373
+ ## Codebase Analysis
374
+
375
+ ### Relevant Files
376
+
377
+ | File | Purpose | Relevance |
378
+ |------|---------|-----------|
379
+ | `path/file.ts` | [what it does] | [why it matters] |
380
+ | `path/other.ts` | [what it does] | [why it matters] |
381
+
382
+ ### Patterns Discovered
383
+
384
+ - [Pattern 1]: [where and how used]
385
+ - [Pattern 2]: [where and how used]
386
+
387
+ ### Existing Abstractions
388
+
389
+ | Abstraction | Location | Reusable? |
390
+ |-------------|----------|-----------|
391
+ | `BaseService` | src/services/base.ts | Yes |
392
+
393
+ ### Dependencies
394
+
395
+ - **Internal**: [list of internal module dependencies]
396
+ - **External**: [list of external packages involved]
397
+
398
+ ## Constraints Identified
399
+
400
+ | Constraint | Impact on Design |
401
+ |------------|------------------|
402
+ | [Constraint 1] | [how it affects approach] |
403
+ | [Constraint 2] | [how it affects approach] |
404
+
405
+ ## Questions for User
406
+
407
+ - [Question 1 if any ambiguity exists]
408
+ - [Question 2 if clarification needed]
409
+
410
+ ## Risks
411
+
412
+ | Risk | Likelihood | Mitigation |
413
+ |------|------------|------------|
414
+ | [Risk description] | Low/Med/High | [How to address] |
415
+
416
+ ```text
417
+ (end of context.md template)
418
+ ```
419
+
420
+ ### Phase 2: requirements.md (EARS Format)
421
+
422
+ ```markdown
423
+ ---
424
+ title: [Feature Name] Requirements
425
+ phase: requirements
426
+ version: "1.0"
427
+ created: YYYY-MM-DD
428
+ status: draft
429
+ ---
430
+
431
+ ## Requirements (EARS Notation)
432
+
433
+ ### Ubiquitous Requirements
434
+
435
+ | ID | Requirement |
436
+ |----|-------------|
437
+ | R1 | The [system] shall [capability] |
438
+ | R2 | The [system] shall [capability] |
439
+
440
+ ### Event-Driven Requirements
441
+
442
+ | ID | Trigger | Response |
443
+ |----|---------|----------|
444
+ | R3 | When [event occurs] | the [system] shall [action] |
445
+ | R4 | When [condition met] | the [system] shall [behavior] |
446
+
447
+ ### State-Driven Requirements
448
+
449
+ | ID | State | Requirement |
450
+ |----|-------|-------------|
451
+ | R5 | While [system is in state] | the [system] shall [behavior] |
452
+ | R6 | While [condition holds] | the [system] shall [maintain] |
453
+
454
+ ### Optional Requirements
455
+
456
+ | ID | Condition | Requirement |
457
+ |----|-----------|-------------|
458
+ | R7 | Where [feature enabled] | the [system] shall [capability] |
459
+
460
+ ### Unwanted Behavior Requirements
461
+
462
+ | ID | Condition | Prevention |
463
+ |----|-----------|------------|
464
+ | R8 | If [unwanted state] | the [system] shall [prevent/alert] |
465
+
466
+ ## Acceptance Criteria
467
+
468
+ | Req | Criterion | Verification Method |
469
+ |-----|-----------|---------------------|
470
+ | R1 | [measurable criterion] | [unit test / integration test / manual] |
471
+ | R3 | [measurable criterion] | [how to verify] |
472
+
473
+ ## Non-Functional Requirements
474
+
475
+ | Category | Requirement |
476
+ |----------|-------------|
477
+ | Performance | [specific metric] |
478
+ | Security | [specific constraint] |
479
+ | Compatibility | [specific requirement] |
480
+ ```
481
+
482
+ ## Implementation Phase
483
+
484
+ Once all 5 phases approved:
485
+
486
+ | Behavior | Description |
487
+ |----------|-------------|
488
+ | Autonomous execution | No more checkpoints |
489
+ | Follow tasks.md order | Execute in sequence |
490
+ | Update task status | Mark completed/blocked |
491
+ | Run verification | Tests, lint, typecheck after each task |
492
+
493
+ ## When to Use Spec Mode
494
+
495
+ | ✅ Use Spec | ❌ Use Other Mode |
496
+ |-------------|-------------------|
497
+ | New features (> 100 lines) | Bug fixes → Vibe |
498
+ | Major refactoring | Simple features → Plan |
499
+ | New subsystems | Documentation → Vibe |
500
+ | API design | Test additions → Plan |
501
+ | Architecture changes | Minor enhancements → Plan |
502
+ | Breaking changes | |
503
+
504
+ ### Complexity Guide
505
+
506
+ ```text
507
+ Simple (Vibe) Moderate (Plan) Complex (Spec)
508
+ ├── 1-2 files ├── 3-10 files ├── > 10 files
509
+ ├── < 50 lines ├── 50-500 lines ├── > 500 lines
510
+ ├── Bug fix ├── Feature ├── Subsystem
511
+ └── Minutes └── Hours └── Days/Weeks
512
+ ```
513
+
514
+ ## Anti-Patterns
515
+
516
+ | ❌ Don't | ✅ Do |
517
+ |----------|-------|
518
+ | Code before Phase 6 | Complete all phases first |
519
+ | Skip phases without consent | Each phase has purpose |
520
+ | Proceed without approval | Wait for explicit approval |
521
+ | Placeholder deliverables | Documents must be complete |
522
+ | Ignore validation findings | Address all findings |
523
+
524
+ ## Mode Transition Signals
525
+
526
+ | Signal | Switch To |
527
+ |--------|-----------|
528
+ | User says "just fix it" | Vibe |
529
+ | Single file change needed | Vibe |
530
+ | Requirements already clear | Plan |
531
+ | "Don't need full spec" | Plan |
532
+ | Time pressure explicit | Plan or Vibe |
533
+
534
+ ## The Spec Contract
535
+
536
+ ```text
537
+ ┌─────────────────────────────────────────────┐
538
+ │ THE SPEC MODE CONTRACT │
539
+ ├─────────────────────────────────────────────┤
540
+ │ ✓ Complete 6 phases │
541
+ │ ✓ Checkpoint at each phase │
542
+ │ ✓ Document all decisions │
543
+ │ ✓ Trace requirements to tasks │
544
+ │ ✓ Validate before implementing │
545
+ │ ✗ NO skipping phases │
546
+ │ ✗ NO code before Phase 6 │
547
+ │ ✗ NO proceeding without approval │
548
+ └─────────────────────────────────────────────┘
549
+ ```