Skip to content

Commit 0193908

Browse files
feat(openspec): add spec artifact to my-workflow schema
Introduce the `spec` artifact to the workflow pipeline, positioned between delta and proposal phases. The spec combines interface boundaries, test contract, and TDD tasks into a single executable XML document. Changes: - Updated workflow description to reflect new phase: delta → spec | proposal - Added spec artifact definition with template and construction rules - Created specification.md template with XML structure for boundaries, test contract, and tasks - Added evidence-linking rules for spec artifacts in openspec/config.yaml The spec artifact bridges analysis (delta) and implementation (tasks) by defining interface contracts and test expectations in structured XML format.
1 parent 924fd30 commit 0193908

3 files changed

Lines changed: 95 additions & 1 deletion

File tree

openspec/config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ context: |
4343
- Action-based file organization: files named by transformation verb
4444
4545
rules:
46+
spec:
47+
- "Trace claims to evidence: key assertions (context, decisions, risk mitigations) should include inline markdown links to their source in dependency artifacts or prior documents. A reader should be able to click any major claim and land on the evidence."
48+
- "Always link to a specific header or block anchor, not bare files. jact extracts content at anchors for context — a bare file link does not guarantee extraction. Use #Header%20Name (raw with %20 for spaces, NOT #header-name kebab-case) or #^block-anchor for Obsidian block references."
49+
- "Link naturally in prose, not as footnotes. The link text IS the claim: '[shallow page copies](../evidence.md#Root%20Cause)' not 'shallow page copies [1]'."
4650
proposal:
4751

4852
- "Trace claims to evidence: key assertions (context, decisions, risk mitigations) should include inline markdown links to their source in dependency artifacts or prior documents. A reader should be able to click any major claim and land on the evidence."

openspec/schemas/my-workflow/schema.yaml

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: my-workflow
22
version: 2
3-
description: OpenSpec workflow - whiteboard → baseline → ideal → delta → proposal → specs → design → tasks
3+
description: OpenSpec workflow - whiteboard → baseline → ideal → delta → spec | proposal → specs → design → tasks
44
artifacts:
55
- id: whiteboard
66
generates: whiteboard.md
@@ -225,6 +225,56 @@ artifacts:
225225
- baseline
226226
- ideal
227227

228+
- id: spec
229+
generates: spec.md
230+
description: Structured XML specification with interface boundaries, test contract, and TDD tasks
231+
template: specification.md
232+
instruction: >
233+
Create a structured XML specification that combines interface boundaries,
234+
test contract, and TDD tasks into a single executable document.
235+
236+
237+
Before writing, read these context files from the change directory:
238+
239+
- delta.md (required — defines scope via ADD/CHANGE rows)
240+
241+
- baseline.md (required — current system traces and measurements)
242+
243+
- ideal.md (required — target system state)
244+
245+
246+
Reference the spec glossary at design-docs/workflows/spec-glossary.md
247+
for vocabulary and element definitions.
248+
249+
250+
Construction rules:
251+
252+
1. Map each ADD/CHANGE row in delta → one <boundary> in
253+
<interface_boundaries>. Each boundary defines: name, inputs, outputs,
254+
constraints, and location in the codebase.
255+
256+
2. Derive <test_contract> assertions from boundaries. Each boundary
257+
should have at least one positive assertion. Add negative assertions
258+
for guard conditions (empty input, unchanged state, error paths).
259+
260+
3. Scale tasks to delta scope:
261+
- Single-file change (patch): 1 dev task + 1 review task
262+
- Multi-file change (feature): N dev tasks + N review tasks
263+
- Each dev task follows TDD phases: RED → GREEN → COMMIT
264+
- Review tasks have checklist + verdict (APPROVED | FIX_REQUIRED)
265+
266+
4. The <artifacts> section lists the primary target file(s) and links
267+
back to context files (baseline, ideal, delta).
268+
269+
5. The <success_criteria> section defines pass/fail conditions derived
270+
from the test contract assertions and reviewer verdict.
271+
272+
273+
Output format: Markdown file containing a single XML code block with
274+
root element <specification>. Follow the template structure exactly.
275+
requires:
276+
- delta
277+
228278
- id: proposal
229279
generates: proposal.md
230280
description: Initial proposal document outlining the change
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
```xml
2+
<specification>
3+
<name>{{change-name}}</name>
4+
<overview>...</overview>
5+
<artifacts>
6+
<target>...</target>
7+
<context>
8+
<file role="baseline_trace">../baseline.md</file>
9+
<file role="ideal_trace">../ideal.md</file>
10+
<file role="delta">../delta.md</file>
11+
</context>
12+
</artifacts>
13+
<interface_boundaries>
14+
<boundary id="B1" type="" location="">
15+
<name/> <in/> <out/> <constraints/>
16+
</boundary>
17+
</interface_boundaries>
18+
<test_contract>
19+
<fixtures>...</fixtures>
20+
<assertions>...</assertions>
21+
<negative_assertions>...</negative_assertions>
22+
</test_contract>
23+
<!-- Scale tasks to match scope:
24+
Patch: 1 dev task + 1 review task
25+
Feature: N dev tasks + N review tasks -->
26+
<task id="1" name="" agent="dev_agent">
27+
<step number="1" phase="RED">...</step>
28+
<step number="2" phase="GREEN">...</step>
29+
<step number="3" phase="COMMIT">...</step>
30+
</task>
31+
<task id="2" name="" agent="reviewer" blocked_by="1">
32+
<checklist>...</checklist>
33+
<verdict>APPROVED | FIX_REQUIRED</verdict>
34+
</task>
35+
<success_criteria>
36+
<pass>...</pass>
37+
<fail>...</fail>
38+
</success_criteria>
39+
</specification>
40+
```

0 commit comments

Comments
 (0)