@@ -52,8 +52,8 @@ Schemas can vary across multiple dimensions:
5252Schemas follow the XDG Base Directory Specification with a 2-level resolution:
5353
5454```
55- 1. ${XDG_DATA_HOME}/openspec/schemas/<name>.yaml # Global user override
56- 2. <package>/schemas/<name>.yaml # Built-in defaults
55+ 1. ${XDG_DATA_HOME}/openspec/schemas/<name>/schema .yaml # Global user override
56+ 2. <package>/schemas/<name>/schema .yaml # Built-in defaults
5757```
5858
5959** Platform-specific paths:**
@@ -69,25 +69,23 @@ Schemas follow the XDG Base Directory Specification with a 2-level resolution:
6969
7070### Template Inheritance (2 Levels Max)
7171
72- Templates also use 2-level resolution (to be implemented in Slice 3) :
72+ Templates are co-located with schemas in a ` templates/ ` subdirectory :
7373
7474```
75- 1. ${XDG_DATA_HOME}/openspec/schemas/<schema>/templates/<artifact>.md # Schema-specific
76- 2. ${XDG_DATA_HOME}/openspec/templates/<artifact>.md # Shared
77- 3. <package>/templates/<artifact>.md # Built-in fallback
75+ 1. ${XDG_DATA_HOME}/openspec/schemas/<schema>/templates/<artifact>.md # User override
76+ 2. <package>/schemas/<schema>/templates/<artifact>.md # Built-in
7877```
7978
8079** Rules:**
81- - Schema-specific templates override shared templates
82- - Shared templates override package built-ins
80+ - User overrides take precedence over package built-ins
8381- A CLI command shows resolved paths (no guessing)
8482- No inheritance between schemas (copy if you need to diverge)
85- - Max 2 levels - no deeper inheritance chains
83+ - Templates are always co-located with their schema
8684
8785** Why this matters:**
8886- Avoids "where does this come from?" debugging
8987- No implicit magic that works until it doesn't
90- - Clear boundaries between shared and specific
88+ - Schema + templates form a cohesive unit
9189
9290---
9391
@@ -333,21 +331,19 @@ This separation means:
333331### 3. XDG-Compliant Schema Resolution
334332
335333```
336- ${XDG_DATA_HOME}/openspec/schemas/<name>.yaml # User override
334+ ${XDG_DATA_HOME}/openspec/schemas/<name>/schema .yaml # User override
337335 ↓ (not found)
338- <package>/schemas/<name>.yaml # Built-in
336+ <package>/schemas/<name>/schema .yaml # Built-in
339337 ↓ (not found)
340338Error (schema not found)
341339```
342340
343- ### 4. Two-Level Template Fallback (Slice 3)
341+ ### 4. Two-Level Template Fallback
344342
345343```
346- ${XDG_DATA_HOME}/openspec/schemas/<schema>/templates/<artifact>.md # Schema-specific
344+ ${XDG_DATA_HOME}/openspec/schemas/<schema>/templates/<artifact>.md # User override
347345 ↓ (not found)
348- ${XDG_DATA_HOME}/openspec/templates/<artifact>.md # Shared
349- ↓ (not found)
350- <package>/templates/<artifact>.md # Built-in
346+ <package>/schemas/<schema>/templates/<artifact>.md # Built-in
351347 ↓ (not found)
352348Error (no silent fallback to avoid confusion)
353349```
@@ -487,21 +483,29 @@ Structured as **vertical slices** - each slice is independently testable.
487483# Global (XDG paths - user overrides)
488484~/.local/share/openspec/ # Unix/macOS ($XDG_DATA_HOME/openspec/)
489485%LOCALAPPDATA%/openspec/ # Windows
490- ├── schemas/ # Schema overrides
491- │ └── custom-workflow.yaml # User-defined schema
492- └── templates/ # Template overrides (Slice 3)
493- └── proposal.md # Custom proposal template
486+ └── schemas/ # Schema overrides
487+ └── custom-workflow/ # User-defined schema directory
488+ ├── schema.yaml # Schema definition
489+ └── templates/ # Co-located templates
490+ └── proposal.md
494491
495492# Package (built-in defaults)
496493<package>/
497- ├── schemas/ # Built-in schema definitions
498- │ ├── spec-driven.yaml # Default: proposal → specs → design → tasks
499- │ └── tdd.yaml # TDD: tests → implementation → docs
500- └── templates/ # Built-in templates (Slice 3)
501- ├── proposal.md
502- ├── design.md
503- ├── specs.md
504- └── tasks.md
494+ └── schemas/ # Built-in schema definitions
495+ ├── spec-driven/ # Default: proposal → specs → design → tasks
496+ │ ├── schema.yaml
497+ │ └── templates/
498+ │ ├── proposal.md
499+ │ ├── design.md
500+ │ ├── spec.md
501+ │ └── tasks.md
502+ └── tdd/ # TDD: tests → implementation → docs
503+ ├── schema.yaml
504+ └── templates/
505+ ├── test.md
506+ ├── implementation.md
507+ ├── spec.md
508+ └── docs.md
505509
506510# Project (change instances)
507511openspec/
@@ -528,8 +532,8 @@ openspec/
528532## Schema YAML Format
529533
530534``` yaml
531- # Built-in: <package>/schemas/spec-driven.yaml
532- # Or user override: ~/.local/share/openspec/schemas/spec-driven.yaml
535+ # Built-in: <package>/schemas/spec-driven/schema .yaml
536+ # Or user override: ~/.local/share/openspec/schemas/spec-driven/schema .yaml
533537name : spec-driven
534538version : 1
535539description : Specification-driven development
@@ -538,7 +542,7 @@ artifacts:
538542 - id : proposal
539543 generates : " proposal.md"
540544 description : " Create project proposal document"
541- template : " proposal.md" # resolves via 2-level fallback (Slice 3)
545+ template : " proposal.md" # resolves from co-located templates/ directory
542546 requires : []
543547
544548 - id : specs
0 commit comments