Repository navigation
Expand file tree
/
Copy pathschema.yaml
More file actions
311 lines (202 loc) · 11 KB
/
Copy pathschema.yaml
File metadata and controls
311 lines (202 loc) · 11 KB
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
298
299
300
301
302
303
304
305
306
307
308
309
310
311
name: intent-driven
version: 1
description: Intent-driven OpenSpec workflow - proposal -> Gherkin-style specs -> design -> adr -> tasks
artifacts:
- id: proposal
generates: proposal.md
description: Initial proposal document outlining the change
template: proposal.md
instruction: >
Create the proposal document that establishes WHY this change is needed.
Sections:
- **Why**: 1-2 sentences on the problem or opportunity. What problem does
this solve? Why now?
- **What Changes**: Bullet list of changes. Be specific about new
capabilities, modifications, or removals. Mark breaking changes with
**BREAKING**.
- **Capabilities**: Identify which behaviour specs will be created or modified:
- **New Capabilities**: List capabilities being introduced. Each becomes a new `specs/<name>/spec.md`. Use kebab-case names (e.g., `user-auth`, `data-export`).
- **Modified Capabilities**: List existing capabilities whose behaviour is changing. Only include if spec-level behaviour changes, not just implementation details. Each needs an OpenSpec Markdown delta file at `specs/<name>/spec.md`. Check `openspec/specs/` for existing spec names. Leave empty if no behaviour changes.
- **Impact**: Affected code, APIs, dependencies, or systems.
IMPORTANT: The Capabilities section is critical. It creates the contract
between proposal and specs phases. Research existing specs before filling
this in. Each capability listed here will need a corresponding spec file.
Durable architectural decisions worth carrying across changes are
distilled into ADR files at <repo>/adr/ by a later step after design.
Keep it concise (1-2 pages). Focus on the "why" not the "how" -
implementation details belong in design.md.
This is the foundation - specs, design, adr, and tasks all build on this.
requires: []
- id: specs
generates: specs/**/*.md
description: Detailed specifications for the change
template: spec.md
instruction: >
Create specification files that define WHAT the system should do.
Create one spec file per capability listed in the proposal's Capabilities
section.
- New capabilities: use the exact kebab-case name from the proposal
(specs/<capability>/spec.md).
- Modified capabilities: use the existing spec folder name from
openspec/specs/<capability>/ when creating the delta spec at
specs/<capability>/spec.md.
Delta operations (use ## headers):
- **ADDED Requirements**: New capabilities
- **MODIFIED Requirements**: Changed behavior - MUST include full updated
content
- **REMOVED Requirements**: Deprecated features - MUST include **Reason**
and **Migration**
- **RENAMED Requirements**: Name changes only - use FROM:/TO: format
Format requirements:
- Each requirement: `### Requirement: <name>` followed by description
- Use SHALL/MUST for normative requirements (avoid should/may)
- Each scenario: `#### Scenario: <name>` with WHEN/THEN format
- **CRITICAL**: Scenarios MUST use exactly 4 hashtags (`####`). Using 3
hashtags or bullets will fail silently.
- Every requirement MUST have at least one scenario.
MODIFIED requirements workflow:
1. Locate the existing requirement in openspec/specs/<capability>/spec.md
2. Copy the ENTIRE requirement block (from `### Requirement:` through all
scenarios)
3. Paste under `## MODIFIED Requirements` and edit to reflect new behavior
4. Ensure header text matches exactly (whitespace-insensitive)
Common pitfall: Using MODIFIED with partial content loses detail at
archive time.
If adding new concerns without changing existing behavior, use ADDED
instead.
Example:
```
## ADDED Requirements
### Requirement: User can export data
The system SHALL allow users to export their data in CSV format.
#### Scenario: Successful export
- **WHEN** user clicks "Export" button
- **THEN** system downloads a CSV file with all user data
## REMOVED Requirements
### Requirement: Legacy export
**Reason**: Replaced by new export system
**Migration**: Use new export endpoint at /api/v2/export
```
Specs should be testable - each scenario is a potential test case.
requires:
- proposal
- id: design
generates: design.md
description: Technical design document with implementation details
template: design.md
instruction: >
Create the design document that explains HOW to implement the change.
When to include design.md (create only if any apply):
- Cross-cutting change (multiple services/modules) or new architectural
pattern
- New external dependency or significant data model changes
- Security, performance, or migration complexity
- Ambiguity that benefits from technical decisions before coding
Prior decisions (read existing ADRs first):
Before writing, list every file in <repo>/adr/. Build the supersession
graph from each ADR's Supersedes field - an ADR is no longer in force if
a later ADR's Supersedes points at it. Only the currently-in-force ADRs
(accepted, not superseded) constrain this design. Older superseded ADRs
are historical context only and MUST NOT be treated as live commitments.
New design choices MUST be coherent with the in-force set. If a current
ADR needs to be revisited, do not propose modifying it; flag it under
Open Questions and let the adr step record a new superseding ADR.
Sections:
- **Context**: Background, current state, constraints, stakeholders
- **Goals / Non-Goals**: What this design achieves and explicitly excludes
- **Decisions**: Key technical choices with rationale (why X over Y?).
Include alternatives considered for each decision.
- **Risks / Trade-offs**: Known limitations, things that could go wrong.
Format: [Risk] -> Mitigation
- **Migration Plan**: Steps to deploy, rollback strategy (if applicable)
- **Open Questions**: Outstanding decisions or unknowns to resolve.
Include any in-force ADRs that this design suggests revisiting; the adr
step will record the supersession.
Focus on architecture and approach, not line-by-line implementation.
Reference the proposal for motivation and specs for requirements.
Good design docs explain the "why" behind technical decisions.
requires:
- proposal
- id: adr
generates: adr.md
description: Per-change ADR review manifest and durable decision handoff
template: adr.md
instruction: >
Complete ADR review for this change by writing a concise manifest at
openspec/changes/<change>/adr.md. This change-local file is the artifact
completion marker for the adr step. Existing files under <repo>/adr/ are
required context for the review, but they MUST NOT satisfy completion for
a new change.
If the change introduces a major durable architectural decision, also
create an Architecture Decision Record under <repo>/adr/. The path
<repo>/adr/ means the target repository's top-level adr/ folder beside
openspec/, not any folder inside openspec/. Repository-level ADR files
persist across changes and MUST be written outside openspec/.
IRON RULE - ADRs are immutable once accepted. You MUST NOT edit a prior
ADR file under any circumstance, not its Status, not its body, not its
date. To change a previously accepted decision, record a NEW ADR whose
Status is "accepted, supersedes ADR-NNNN" and whose `Supersedes:` field
names the prior one. Design consumers derive what is currently in force
by walking Supersedes links across the folder. The prior ADR's contents
stay frozen as a historical record.
Process:
1. Read every existing ADR in <repo>/adr/. Build the supersession graph
from each ADR's Supersedes field. Note the highest sequence number in
use.
2. Re-read design.md. Identify decisions that meet ALL of these:
- Establish a long-term architectural commitment (pattern, technology,
boundary, contract) - not a tactical implementation detail.
- Will affect future changes beyond this one.
- Either aren't already captured by a currently-in-force ADR, OR
intentionally diverge from one. If diverging, the new ADR supersedes the
prior.
3. For each qualifying decision, create a NEW repository-level file at
<repo>/adr/NNNN-kebab-title.md, where NNNN is a 4-digit sequence one
greater than the highest existing. Include title, Status, Date, optional
Supersedes, and MADR-short sections: Context, Decision, and
Consequences. If this decision replaces a prior in-force ADR, set Status to
"accepted, supersedes ADR-NNNN", populate the `Supersedes:` field, and
explain in Context why the prior decision is being revisited. Do NOT
touch the prior ADR's file.
4. Write openspec/changes/<change>/adr.md using the template. The
manifest MUST state that ADR review completed for this change, list the
in-force ADR context reviewed, and reference every repository-level ADR
file created for this change. It MUST NOT duplicate full Context,
Decision, or Consequences content from repository-level ADR files.
5. If nothing meets the bar, do not invent ADRs. The manifest MUST
explicitly state that no major durable architectural decisions were
introduced and no new repository-level ADR files were created.
Filename convention: NNNN-kebab-title.md (e.g.,
0042-use-postgres-for-catalog.md). Sequence is monotonic across the
whole repo and never reused.
requires:
- design
- id: tasks
generates: tasks.md
description: Implementation checklist with trackable tasks
template: tasks.md
instruction: >
Create the task list that breaks down the implementation work.
**IMPORTANT: Follow the template below exactly.** The apply phase parses
checkbox format to track progress. Tasks not using `- [ ]` won't be
tracked.
Guidelines:
- Group related tasks under ## numbered headings.
- Each task MUST be a checkbox: `- [ ] X.Y Task description`.
- Tasks should be small enough to complete in one session.
- Order tasks by dependency (what must be done first?).
- If implementation changes behaviour specs, include a task to run
`openspec validate <change> --type change --strict` before archive.
Reference specs for what to build, design for how to build it, and
<repo>/adr/ for durable architectural commitments to honor.
Each task should be verifiable - you know when it's done.
requires:
- specs
- adr
apply:
requires:
- tasks
tracks: tasks.md
instruction: |
Read context files, work through pending tasks, mark complete as you go.
Pause if you hit blockers or need clarification.