@ifrankwang/openspec-agents 0.133.2 → 0.135.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.
- package/.mcp-server/cli.mjs +764 -462
- package/README.md +16 -1
- package/assets/agents/openspec-main.md +1 -0
- package/assets/skills/openspec-standard/SKILL.md +28 -0
- package/assets/skills/openspec-standard/templates/openspec/config.yaml +39 -0
- package/assets/skills/openspec-standard/templates/schemas/spec-driven-standard/README.md +78 -0
- package/assets/skills/openspec-standard/templates/schemas/spec-driven-standard/schema.yaml +466 -0
- package/assets/skills/openspec-standard/templates/schemas/spec-driven-standard/templates/clarify.md +54 -0
- package/assets/skills/openspec-standard/templates/schemas/spec-driven-standard/templates/design.md +31 -0
- package/assets/skills/openspec-standard/templates/schemas/spec-driven-standard/templates/proposal.md +32 -0
- package/assets/skills/openspec-standard/templates/schemas/spec-driven-standard/templates/spec.md +8 -0
- package/assets/skills/openspec-standard/templates/schemas/spec-driven-standard/templates/tasks.md +41 -0
- package/assets/skills/orchestrator/SKILL.md +4 -3
- package/assets/workflows/task-simple.yaml +1 -0
- package/assets/workflows/task.yaml +1 -0
- package/package.json +1 -1
- package/src/adapters/mcp-common/server.ts +1 -1
- package/src/core/git.ts +143 -20
- package/src/core/tools/lifecycle.ts +3 -12
- package/src/core/views.ts +19 -0
- package/src/core/workflow/engine.ts +12 -0
- package/src/core/workflow/status.ts +41 -4
|
@@ -0,0 +1,466 @@
|
|
|
1
|
+
name: spec-driven-standard
|
|
2
|
+
version: 1
|
|
3
|
+
description: Spec-driven workflow with clarify gate, related-surface survey, tiered authoring (orchestrator or single subagent) and review loop - clarify → proposal → specs → design → tasks
|
|
4
|
+
artifacts:
|
|
5
|
+
- id: clarify
|
|
6
|
+
generates: clarify.md
|
|
7
|
+
description: Requirement and architecture clarification record
|
|
8
|
+
template: clarify.md
|
|
9
|
+
instruction: |
|
|
10
|
+
**Orchestration contract (addressed to YOU, the orchestrating agent)**:
|
|
11
|
+
Duties are split into three phases. You personally run Phase 1 and
|
|
12
|
+
Phase 3. Phase 2 is TIERED by change complexity: for SIMPLE changes
|
|
13
|
+
you write proposal/specs/design/tasks yourself; for COMPLEX changes a
|
|
14
|
+
single fresh generation subagent writes them. No subagent ever writes
|
|
15
|
+
clarify.md - you write it yourself as the interview record.
|
|
16
|
+
|
|
17
|
+
Phase 1 - Interview (you): investigate the codebase and existing
|
|
18
|
+
openspec/specs/ first, then interview the user in rounds over a
|
|
19
|
+
decision tree using the frontier mechanics (methodology below),
|
|
20
|
+
recording questions and answers directly into <changeRoot>/clarify.md
|
|
21
|
+
as you go (sections below) - there is no separate interview file.
|
|
22
|
+
HARD-GATE: the interview is over only when every branch of the decision
|
|
23
|
+
tree has been visited, no doubt is left open, nothing is silently
|
|
24
|
+
assumed; then first present a simple, direct plan summary to the user
|
|
25
|
+
and get an explicit confirmation of the direction - do NOT start
|
|
26
|
+
Phase 2 (authoring) until the user has confirmed it (details in
|
|
27
|
+
methodology below).
|
|
28
|
+
|
|
29
|
+
Phase 2 - Authoring (TIERED): only after the user has explicitly
|
|
30
|
+
confirmed the plan summary (HARD-GATE above), decide the tier using
|
|
31
|
+
the complexity criteria below, record the decision and one-line
|
|
32
|
+
rationale in clarify.md, then
|
|
33
|
+
follow the matching mode:
|
|
34
|
+
- SIMPLE tier: you personally produce the remaining artifacts
|
|
35
|
+
(proposal → specs → design → tasks) in dependency order. For each
|
|
36
|
+
artifact run `openspec instructions <artifact-id> --change
|
|
37
|
+
"<name>" --json` yourself, read the project's AGENTS.md and
|
|
38
|
+
openspec/config.yaml rules plus the dependency artifacts (starting
|
|
39
|
+
from the clarify.md you wrote), and write to the resolved output
|
|
40
|
+
path. Do not dispatch any subagent for authoring.
|
|
41
|
+
- COMPLEX tier: dispatch a single fresh general-purpose subagent
|
|
42
|
+
with the change name. It produces the remaining artifacts in one
|
|
43
|
+
session: for each it runs
|
|
44
|
+
`openspec instructions <artifact-id> --change "<name>" --json`
|
|
45
|
+
itself, reads the project's AGENTS.md and openspec/config.yaml
|
|
46
|
+
rules plus the dependency artifacts, and writes to the resolved
|
|
47
|
+
output path. It may only read/write inside the change directory
|
|
48
|
+
(openspec/changes/<name>/). It must not dispatch further
|
|
49
|
+
subagents, and its final report MUST end by telling you to start
|
|
50
|
+
Phase 3.
|
|
51
|
+
|
|
52
|
+
Complexity criteria - COMPLEX if ANY applies, otherwise SIMPLE:
|
|
53
|
+
- touches 2+ capabilities or 2+ task groups with cross-group
|
|
54
|
+
dependencies;
|
|
55
|
+
- significant data-model change (new tables, many columns, or any
|
|
56
|
+
data migration);
|
|
57
|
+
- new external dependency, new architectural pattern, or notable
|
|
58
|
+
security/performance/migration complexity;
|
|
59
|
+
- expected total artifact size would push your context near the
|
|
60
|
+
window limit if you wrote them yourself (large DDL, long task
|
|
61
|
+
lists, multi-spec changes).
|
|
62
|
+
When in doubt, choose COMPLEX: it keeps the orchestrating agent's
|
|
63
|
+
context lean and is the safer default.
|
|
64
|
+
|
|
65
|
+
Phase 3 - Review loop (you, once authoring is complete):
|
|
66
|
+
1. Dispatch an independent review subagent (fresh general-purpose
|
|
67
|
+
session — never reuse the generation subagent). It must:
|
|
68
|
+
- run `openspec validate "<name>" --strict` for structural checks
|
|
69
|
+
(note: validate takes the change name as a positional argument,
|
|
70
|
+
no --change flag);
|
|
71
|
+
- check every artifact against the openspec/config.yaml rules for
|
|
72
|
+
its stage, the schema templates/instructions, and cross-document
|
|
73
|
+
consistency (clarify direction ↔ proposal capabilities ↔ specs
|
|
74
|
+
requirements ↔ design decisions ↔ tasks with [spec:...]
|
|
75
|
+
traceability tags);
|
|
76
|
+
- read openspec/specs/ main specs (read-only) and cross-check:
|
|
77
|
+
proposal capabilities actually exist there, and delta
|
|
78
|
+
requirements/contracts (e.g. error codes, rate-limit semantics,
|
|
79
|
+
existing implementations) do not conflict with what the main
|
|
80
|
+
specs already establish;
|
|
81
|
+
- write findings to <changeRoot>/.review/issues.md, one block per
|
|
82
|
+
issue with fields: severity | file | problem | suggested fix;
|
|
83
|
+
write "PASS" when clean. The .review/ directory exists only for
|
|
84
|
+
this working file during the loop - never use it to record
|
|
85
|
+
anything else.
|
|
86
|
+
2. If issues.md is not "PASS", YOU fix every issue yourself
|
|
87
|
+
(change-directory documents only; you must not modify issues.md
|
|
88
|
+
itself, and you must not delegate fixes to a subagent — fixing
|
|
89
|
+
in your own context is the token-saving design).
|
|
90
|
+
3. Re-dispatch the review subagent for a fresh full review; loop
|
|
91
|
+
until "PASS" or 3 review rounds. After 3 rounds with remaining
|
|
92
|
+
issues, stop and present the leftover issues to the user.
|
|
93
|
+
4. On "PASS", delete the .review/ directory.
|
|
94
|
+
|
|
95
|
+
Do NOT hand over to the apply workflow before Phase 3 ends with
|
|
96
|
+
"PASS" (or with leftover issues explicitly accepted by the user).
|
|
97
|
+
|
|
98
|
+
Create the clarify document that records the requirement clarification and
|
|
99
|
+
architecture direction exploration BEFORE any proposal is written. This
|
|
100
|
+
artifact is MANDATORY for every change - it captures the think-before-build
|
|
101
|
+
phase, grounded in the actual codebase and existing specs.
|
|
102
|
+
|
|
103
|
+
Methodology:
|
|
104
|
+
- Investigate the codebase and existing openspec/specs/ first. Ground every
|
|
105
|
+
question in real code; do not theorize without reading the relevant modules.
|
|
106
|
+
- Surface unknowns across these dimensions and resolve them with the
|
|
107
|
+
user by interviewing in rounds over a decision tree (every decision
|
|
108
|
+
branches into the decisions that hang off it):
|
|
109
|
+
* Problem & intent: what problem is being solved? what is the success criteria?
|
|
110
|
+
* Scope: what is in/out of bounds? is the change decomposable into sub-changes?
|
|
111
|
+
* Related-surface survey (关联场景清点): enumerate every consumer of the
|
|
112
|
+
capability being changed, grounded in real code — functional entry points
|
|
113
|
+
(API endpoints, import/export entries, scheduled jobs, message consumers,
|
|
114
|
+
frontend calls), shared processing logic reused by multiple entry points,
|
|
115
|
+
and downstream data consumers (readers/writers of the tables, fields,
|
|
116
|
+
events, or export artifacts involved). Record each finding with code
|
|
117
|
+
evidence (file/class/method) in clarify.md's Related-Surface Survey
|
|
118
|
+
section. When shared processing logic changes, every consuming entry
|
|
119
|
+
point must be adapted within the SAME change; splitting into separate
|
|
120
|
+
changes requires an explicit boundary rationale confirmed by the user.
|
|
121
|
+
* Data model: which entities/tables/fields are involved? any new tables or columns?
|
|
122
|
+
* Business rules: which are deterministic vs non-deterministic, per the
|
|
123
|
+
project's conventions (see AGENTS.md)?
|
|
124
|
+
* Integration boundaries: external systems, APIs, ports/adapters?
|
|
125
|
+
* Architecture direction: propose 2-3 approaches with tradeoffs and a recommendation.
|
|
126
|
+
- Round mechanics: each round asks every question whose prerequisites
|
|
127
|
+
are already settled (the whole frontier at once) via the question
|
|
128
|
+
tool, numbered, each with your recommended answer; then wait for
|
|
129
|
+
the user's answers before the next round. A question whose answer
|
|
130
|
+
depends on one still open in this round belongs to a later round.
|
|
131
|
+
Facts are yours to find (codebase, specs, tools) - never ask the
|
|
132
|
+
user for anything you can look up yourself; the decisions are the
|
|
133
|
+
user's. Rounds continue until the frontier is empty: every branch
|
|
134
|
+
visited, no doubt left unresolved, nothing silently assumed.
|
|
135
|
+
- Challenge assumptions (yours and the user's). Reframe the problem when needed.
|
|
136
|
+
- Plan confirmation gate (HARD-GATE): once the interview rounds have
|
|
137
|
+
exhausted every open doubt (frontier empty) and before starting
|
|
138
|
+
Phase 2 (authoring — whether by you or
|
|
139
|
+
by a generation subagent), present a simple, direct plan summary to
|
|
140
|
+
the user and stop for confirmation. The summary must state: what the
|
|
141
|
+
change does in one sentence; whether it touches contracts (API
|
|
142
|
+
parameters or DDL); the chosen approach and its key trade-offs
|
|
143
|
+
versus the alternatives; the capabilities affected. Interview
|
|
144
|
+
answers do NOT count as confirmation — the confirmation must be a
|
|
145
|
+
direct user response to this summary. If the user requests changes,
|
|
146
|
+
revise the summary and re-present; loop until the user explicitly
|
|
147
|
+
confirms. Record the confirmed summary in clarify.md's Architecture
|
|
148
|
+
Direction section. "Too simple to need clarification" is not a
|
|
149
|
+
valid reason to skip; the clarify record may be short but must
|
|
150
|
+
exist, and this confirmation step is still mandatory.
|
|
151
|
+
|
|
152
|
+
Sections (see template):
|
|
153
|
+
- **Open Questions**: the unknowns surfaced, one per bullet.
|
|
154
|
+
- **User Answers**: the user's responses, captured verbatim or summarized.
|
|
155
|
+
- **Related-Surface Survey**: the related-surface survey output (关联场景清点) —
|
|
156
|
+
every consuming entry point / shared processing logic / downstream
|
|
157
|
+
consumer with code evidence, and the scoping verdict for each. Shared
|
|
158
|
+
processing logic changes must be covered together with all their
|
|
159
|
+
consuming entry points in the same change.
|
|
160
|
+
- **Architecture Direction**: the crystallized approach, key decisions,
|
|
161
|
+
alternatives considered, and the confirmed plan summary with
|
|
162
|
+
the user's explicit confirmation. This is the HARD-GATE output.
|
|
163
|
+
- **Initial Capabilities**: preliminary guess of which specs will be touched
|
|
164
|
+
(kebab-case). Finalized in proposal.md.
|
|
165
|
+
|
|
166
|
+
This is the foundation for proposal, specs, design, and tasks. All later
|
|
167
|
+
artifacts must stay consistent with the direction recorded here.
|
|
168
|
+
requires: []
|
|
169
|
+
- id: proposal
|
|
170
|
+
generates: proposal.md
|
|
171
|
+
description: Initial proposal document outlining the change
|
|
172
|
+
template: proposal.md
|
|
173
|
+
instruction: |
|
|
174
|
+
**Generation (process constraint)**: This artifact is written by exactly
|
|
175
|
+
one author — either YOU, the orchestrating agent (SIMPLE tier), or the
|
|
176
|
+
ONE independent generation subagent dispatched once for the change
|
|
177
|
+
(COMPLEX tier) — never one subagent per artifact, and never by both.
|
|
178
|
+
The full orchestration contract (interview, tier decision, authoring,
|
|
179
|
+
review loop) lives in the clarify artifact's instruction; read it
|
|
180
|
+
first if you have not. The author runs
|
|
181
|
+
`openspec instructions <artifact-id> --change "<name>" --json`, reads
|
|
182
|
+
the project's AGENTS.md and openspec/config.yaml rules plus the
|
|
183
|
+
dependency artifacts (including the clarify.md written by the
|
|
184
|
+
orchestrating agent), then writes to the resolved output path. If a
|
|
185
|
+
generation subagent is the author, it may only read/write inside the
|
|
186
|
+
change directory (openspec/changes/<name>/).
|
|
187
|
+
|
|
188
|
+
Create the proposal document that establishes WHY this change is needed.
|
|
189
|
+
|
|
190
|
+
Sections:
|
|
191
|
+
- **Why**: 1-2 sentences on the problem or opportunity. What problem does this solve? Why now?
|
|
192
|
+
- **What Changes**: Bullet list of changes. Be specific about new capabilities, modifications, or removals. Mark breaking changes with **BREAKING**.
|
|
193
|
+
- **Related Surface (关联场景)**: the survey conclusions from clarify.md —
|
|
194
|
+
every consuming entry point / shared processing logic / downstream
|
|
195
|
+
consumer with code evidence and its scoping verdict (adapted in this
|
|
196
|
+
change, or explicitly justified out). When shared processing logic
|
|
197
|
+
changes, every consuming entry point must be adapted in THIS change;
|
|
198
|
+
splitting into separate changes requires a boundary rationale section
|
|
199
|
+
confirmed by the user. A bare "no related impact" without search
|
|
200
|
+
evidence counts as an incomplete proposal.
|
|
201
|
+
- **Capabilities**: Identify which specs will be created or modified:
|
|
202
|
+
- **New Capabilities**: List capabilities being introduced. Each becomes a new `specs/<capability-path>/spec.md`. Use kebab-case for path segments you introduce (e.g., `user-auth` or `identity/user-auth`) and follow the project's existing spec organization.
|
|
203
|
+
- **Modified Capabilities**: List existing capabilities whose REQUIREMENTS are changing. Only include if spec-level behavior changes (not just implementation details). Each needs a delta spec file. Use the exact existing path under `openspec/specs/`. Leave empty if no requirement changes.
|
|
204
|
+
- **Impact**: Affected code, APIs, dependencies, or systems.
|
|
205
|
+
|
|
206
|
+
IMPORTANT: The Capabilities section is critical. It creates the contract between
|
|
207
|
+
proposal and specs phases. Research existing specs before filling this in.
|
|
208
|
+
Each capability listed here will need a corresponding spec file.
|
|
209
|
+
|
|
210
|
+
Every change must either declare at least one capability (new or
|
|
211
|
+
modified) or explicitly opt out of specs: `openspec validate` rejects a
|
|
212
|
+
change with zero deltas unless the change's `.openspec.yaml` sets
|
|
213
|
+
`skip_specs: true`. Use `skip_specs: true` only when no spec-level
|
|
214
|
+
behavior changes (pure refactor, tooling, docs) - specs describe
|
|
215
|
+
behavior, so if behavior does not change, no spec should change either.
|
|
216
|
+
Do not invent a requirement just to satisfy validation.
|
|
217
|
+
|
|
218
|
+
Keep it concise (1-2 pages). Focus on the "why" not the "how" -
|
|
219
|
+
implementation details belong in design.md. Stay consistent with
|
|
220
|
+
clarify.md's architecture direction; if the proposal drifts from clarify,
|
|
221
|
+
update clarify first and get user confirmation.
|
|
222
|
+
|
|
223
|
+
This is the foundation - specs, design, and tasks all build on this.
|
|
224
|
+
requires:
|
|
225
|
+
- clarify
|
|
226
|
+
- id: specs
|
|
227
|
+
generates: "specs/**/*.md"
|
|
228
|
+
description: Detailed specifications for the change
|
|
229
|
+
template: spec.md
|
|
230
|
+
instruction: |
|
|
231
|
+
**Generation (process constraint)**: This artifact is written by exactly
|
|
232
|
+
one author — either YOU, the orchestrating agent (SIMPLE tier), or the
|
|
233
|
+
ONE independent generation subagent dispatched once for the change
|
|
234
|
+
(COMPLEX tier) — never one subagent per artifact, and never by both.
|
|
235
|
+
The full orchestration contract (interview, tier decision, authoring,
|
|
236
|
+
review loop) lives in the clarify artifact's instruction; read it
|
|
237
|
+
first if you have not. The author runs
|
|
238
|
+
`openspec instructions <artifact-id> --change "<name>" --json`, reads
|
|
239
|
+
the project's AGENTS.md and openspec/config.yaml rules plus the
|
|
240
|
+
dependency artifacts (including the clarify.md written by the
|
|
241
|
+
orchestrating agent), then writes to the resolved output path. If a
|
|
242
|
+
generation subagent is the author, it may only read/write inside the
|
|
243
|
+
change directory (openspec/changes/<name>/).
|
|
244
|
+
|
|
245
|
+
Create specification files that define WHAT the system should do.
|
|
246
|
+
|
|
247
|
+
A spec is a behavior contract, not an implementation plan.
|
|
248
|
+
|
|
249
|
+
Good spec content:
|
|
250
|
+
- Observable behavior users or downstream systems rely on
|
|
251
|
+
- Inputs, outputs, and error conditions
|
|
252
|
+
- External constraints (security, privacy, reliability, compatibility)
|
|
253
|
+
- Scenarios that can be tested or explicitly validated
|
|
254
|
+
|
|
255
|
+
Avoid in specs:
|
|
256
|
+
- Internal class/function names
|
|
257
|
+
- Library or framework choices
|
|
258
|
+
- Step-by-step implementation details
|
|
259
|
+
- Detailed execution plans (those belong in design.md or tasks.md)
|
|
260
|
+
|
|
261
|
+
Quick test: if the implementation can change without changing externally
|
|
262
|
+
visible behavior, it likely does not belong in the spec.
|
|
263
|
+
|
|
264
|
+
Create one spec file per capability listed in the proposal's Capabilities section.
|
|
265
|
+
`<capability-path>` is the spec directory relative to `specs/` (for example,
|
|
266
|
+
`user-auth` or `identity/user-auth`). Preserve the full path:
|
|
267
|
+
- New capabilities: use the exact path from the proposal at `specs/<capability-path>/spec.md`. Any path segment newly introduced in the proposal must be kebab-case. Follow the project's existing organization; do not add a new domain level when the project uses a flat layout.
|
|
268
|
+
- Modified capabilities: use the exact existing path from `openspec/specs/<capability-path>/` when creating the delta at `specs/<capability-path>/spec.md`. Do not move or rename the capability.
|
|
269
|
+
|
|
270
|
+
There must be at least one spec file unless the change's `.openspec.yaml`
|
|
271
|
+
sets `skip_specs: true` (no spec-level behavior change) - `openspec validate`
|
|
272
|
+
rejects a zero-delta change without that marker. If the proposal lists no
|
|
273
|
+
capabilities and `skip_specs` is not set, revisit the proposal first.
|
|
274
|
+
|
|
275
|
+
Delta operations (use ## headers):
|
|
276
|
+
- **ADDED Requirements**: New capabilities
|
|
277
|
+
- **MODIFIED Requirements**: Changed behavior - MUST include full updated content
|
|
278
|
+
- **REMOVED Requirements**: Deprecated features - MUST include **Reason** and **Migration**
|
|
279
|
+
- **RENAMED Requirements**: Name changes only - use FROM:/TO: format
|
|
280
|
+
|
|
281
|
+
Format requirements:
|
|
282
|
+
- Each requirement: `### Requirement: <name>` followed by description
|
|
283
|
+
- Use SHALL/MUST for normative requirements (avoid should/may)
|
|
284
|
+
- Each scenario: `#### Scenario: <name>` with WHEN/THEN format
|
|
285
|
+
- **CRITICAL**: Scenarios MUST use exactly 4 hashtags (`####`). Using 3 hashtags or bullets will fail silently.
|
|
286
|
+
- Every requirement MUST have at least one scenario.
|
|
287
|
+
|
|
288
|
+
New capabilities only: start the delta spec with a `## Purpose` section -
|
|
289
|
+
one or two sentences (50+ characters, or `openspec validate --strict`
|
|
290
|
+
reports it as too brief) describing what the capability is for. Archive
|
|
291
|
+
copies it into the main spec it creates; without it the new main spec is
|
|
292
|
+
left with a `TBD ... Update Purpose after archive` placeholder to fill in
|
|
293
|
+
by hand. Do NOT add `## Purpose` to a delta for an existing capability -
|
|
294
|
+
that spec already has one and the delta's is ignored. To change an
|
|
295
|
+
existing capability's Purpose - including a leftover `TBD` placeholder -
|
|
296
|
+
edit `openspec/specs/<capability-path>/spec.md` directly.
|
|
297
|
+
|
|
298
|
+
MODIFIED requirements workflow:
|
|
299
|
+
1. Locate the existing requirement in openspec/specs/<capability-path>/spec.md
|
|
300
|
+
2. Copy the ENTIRE requirement block (from `### Requirement:` through all scenarios)
|
|
301
|
+
3. Paste under `## MODIFIED Requirements` and edit to reflect new behavior
|
|
302
|
+
4. Ensure header text matches exactly (whitespace-insensitive)
|
|
303
|
+
|
|
304
|
+
Common pitfall: Using MODIFIED with partial content loses detail at archive time.
|
|
305
|
+
If adding new concerns without changing existing behavior, use ADDED instead.
|
|
306
|
+
|
|
307
|
+
Specs should be testable - each scenario is a potential test case.
|
|
308
|
+
requires:
|
|
309
|
+
- proposal
|
|
310
|
+
- id: design
|
|
311
|
+
generates: design.md
|
|
312
|
+
description: Technical design document with implementation details
|
|
313
|
+
template: design.md
|
|
314
|
+
instruction: |
|
|
315
|
+
**Generation (process constraint)**: This artifact is written by exactly
|
|
316
|
+
one author — either YOU, the orchestrating agent (SIMPLE tier), or the
|
|
317
|
+
ONE independent generation subagent dispatched once for the change
|
|
318
|
+
(COMPLEX tier) — never one subagent per artifact, and never by both.
|
|
319
|
+
The full orchestration contract (interview, tier decision, authoring,
|
|
320
|
+
review loop) lives in the clarify artifact's instruction; read it
|
|
321
|
+
first if you have not. The author runs
|
|
322
|
+
`openspec instructions <artifact-id> --change "<name>" --json`, reads
|
|
323
|
+
the project's AGENTS.md and openspec/config.yaml rules plus the
|
|
324
|
+
dependency artifacts (including the clarify.md written by the
|
|
325
|
+
orchestrating agent), then writes to the resolved output path. If a
|
|
326
|
+
generation subagent is the author, it may only read/write inside the
|
|
327
|
+
change directory (openspec/changes/<name>/).
|
|
328
|
+
|
|
329
|
+
Create the design document that explains HOW to implement the change.
|
|
330
|
+
|
|
331
|
+
When to include design.md (create only if any apply):
|
|
332
|
+
- Cross-cutting change (multiple services/modules) or new architectural pattern
|
|
333
|
+
- New external dependency or significant data model changes
|
|
334
|
+
- Security, performance, or migration complexity
|
|
335
|
+
- Ambiguity that benefits from technical decisions before coding
|
|
336
|
+
|
|
337
|
+
Sections:
|
|
338
|
+
- **Context**: Only the current state and constraints needed to explain the approach. Reference the proposal for motivation instead of restating it (e.g., "See proposal.md - Why").
|
|
339
|
+
- **Goals / Non-Goals**: What this design achieves and explicitly excludes. Don't restate the proposal's scope - add only design-level boundaries.
|
|
340
|
+
- **Decisions**: Key technical choices with rationale (why X over Y?). Include alternatives considered for each decision.
|
|
341
|
+
- **Data Model**: MANDATORY when the change involves persistence. Complete
|
|
342
|
+
DDL (CREATE TABLE with columns, types, constraints), field descriptions,
|
|
343
|
+
indexes, and audit fields. Follow the project's persistence conventions
|
|
344
|
+
(see AGENTS.md / openspec/config.yaml rules). If the change does not
|
|
345
|
+
involve persistence, state that explicitly ("本变更不涉及持久化" or the
|
|
346
|
+
project's equivalent phrasing).
|
|
347
|
+
- **Risks / Trade-offs**: Known limitations, things that could go wrong. Format: [Risk] → Mitigation
|
|
348
|
+
- **Migration Plan**: Steps to deploy, rollback strategy (if applicable)
|
|
349
|
+
- **Open Questions**: Unknowns that can safely be answered later without
|
|
350
|
+
changing the specs, the approach, or the task breakdown. Omit if none.
|
|
351
|
+
|
|
352
|
+
Open questions are for genuinely deferrable unknowns, not decisions you
|
|
353
|
+
skipped. If a question would change the specs, the chosen approach, or
|
|
354
|
+
the task breakdown, resolve it now - ask the user instead of guessing.
|
|
355
|
+
|
|
356
|
+
Focus on architecture and approach, not line-by-line implementation.
|
|
357
|
+
The proposal covers why and what; design covers how. Reference the
|
|
358
|
+
proposal for motivation and, once written, the specs for requirements -
|
|
359
|
+
if a section would only restate them, point to them instead.
|
|
360
|
+
|
|
361
|
+
Good design docs explain the "why" behind technical decisions.
|
|
362
|
+
requires:
|
|
363
|
+
- proposal
|
|
364
|
+
- id: tasks
|
|
365
|
+
generates: tasks.md
|
|
366
|
+
description: Implementation checklist with trackable tasks
|
|
367
|
+
template: tasks.md
|
|
368
|
+
instruction: |
|
|
369
|
+
**Generation (process constraint)**: This artifact is written by exactly
|
|
370
|
+
one author — either YOU, the orchestrating agent (SIMPLE tier), or the
|
|
371
|
+
ONE independent generation subagent dispatched once for the change
|
|
372
|
+
(COMPLEX tier) — never one subagent per artifact, and never by both.
|
|
373
|
+
The full orchestration contract (interview, tier decision, authoring,
|
|
374
|
+
review loop) lives in the clarify artifact's instruction; read it
|
|
375
|
+
first if you have not. The author runs
|
|
376
|
+
`openspec instructions <artifact-id> --change "<name>" --json`, reads
|
|
377
|
+
the project's AGENTS.md and openspec/config.yaml rules plus the
|
|
378
|
+
dependency artifacts (including the clarify.md written by the
|
|
379
|
+
orchestrating agent), then writes to the resolved output path. If a
|
|
380
|
+
generation subagent is the author, it may only read/write inside the
|
|
381
|
+
change directory (openspec/changes/<name>/).
|
|
382
|
+
|
|
383
|
+
Create the task list that breaks down the implementation work.
|
|
384
|
+
|
|
385
|
+
Before writing tasks, check design.md for Open Questions. If any of them
|
|
386
|
+
would change what gets built, resolve them with the user first - do not
|
|
387
|
+
bake an unstated assumption into the task list.
|
|
388
|
+
|
|
389
|
+
**IMPORTANT: Follow the template below exactly.** The apply phase parses
|
|
390
|
+
checkbox format to track progress. Tasks not using `- [ ]` won't be tracked.
|
|
391
|
+
|
|
392
|
+
Guidelines:
|
|
393
|
+
- Group related tasks under `## N. <Task Group Name>` numbered headings
|
|
394
|
+
- Each task MUST be a checkbox: `- [ ] X.Y Task description`
|
|
395
|
+
- Each task SHOULD end with a traceability tag `[spec:<capability>#<requirement>]`
|
|
396
|
+
(or `[infra]` for pure cross-cutting infrastructure tasks). Business tasks
|
|
397
|
+
without a spec target are out of scope - remove them or add the spec
|
|
398
|
+
requirement first.
|
|
399
|
+
- **Related-surface coverage (关联场景覆盖)**: the task groups must cover
|
|
400
|
+
every consuming entry point that the proposal's Related Surface section
|
|
401
|
+
scopes into this change; an in-scope entry point without an adaptation
|
|
402
|
+
task counts as an incomplete task list.
|
|
403
|
+
- **Each task group = one independent iteration.** Every group MUST contain:
|
|
404
|
+
implementation + tests + a quality gate (the project's quality gate per
|
|
405
|
+
openspec/config.yaml rules / AGENTS.md). No standalone QA group - quality
|
|
406
|
+
is embedded in every iteration. Groups must be independently implementable:
|
|
407
|
+
when a group is done, the code compiles and tests pass.
|
|
408
|
+
- **No verification group, pure or mixed.** Pure verification work —
|
|
409
|
+
quality-gate runs (e.g. a final full build verification), end-to-end / integration /
|
|
410
|
+
regression / smoke verification, residual-search sweeps (旧键残留检索),
|
|
411
|
+
regression confirmation — must never form a task group of its own:
|
|
412
|
+
neither standalone, nor as a "wrap-up" group that mixes them with
|
|
413
|
+
doc/script/config sync tasks (e.g. 「阶段二收尾:文档、脚本与全量验证」).
|
|
414
|
+
Fold verification tasks into the functional group they verify. Doc/script/
|
|
415
|
+
config sync tasks are functional work and join the functional group they
|
|
416
|
+
accompany — their presence does not legitimize a wrap-up group. Group
|
|
417
|
+
titles name the delivered business value; 收尾/验证/回归 must never be a
|
|
418
|
+
group's identity.
|
|
419
|
+
- **Minimum substance per group.** Every group's body must be substantive
|
|
420
|
+
change content: at least one task that changes behavior-bearing code or
|
|
421
|
+
config (implementation + its tests). Doc/script/deploy-doc sync,
|
|
422
|
+
verification, regression and quality-gate tasks are accompaniment —
|
|
423
|
+
they may join a functional group but never constitute its substance,
|
|
424
|
+
and task count does not substitute for substance (a 6-task group of
|
|
425
|
+
only sync + verification work still violates this rule). The last
|
|
426
|
+
group of a change is the typical decay spot: when the work remaining
|
|
427
|
+
for a would-be group is only sync + verification, fold it into the
|
|
428
|
+
preceding functional group instead of opening a tail group.
|
|
429
|
+
- Grouping priority (in order):
|
|
430
|
+
1. **Implementation order**: groups follow the project's layer dependency
|
|
431
|
+
order (see AGENTS.md / config.yaml rules). Earlier groups define
|
|
432
|
+
interfaces/models that later groups consume.
|
|
433
|
+
2. **Coherent scope**: each group delivers a complete, verifiable business
|
|
434
|
+
value — a feature, a sub-feature, or a set of closely related capabilities.
|
|
435
|
+
3. **Group size balance**: aim for 4-8 tasks per group. Groups with < 4
|
|
436
|
+
tasks → merge into an adjacent group. Groups with > 8 tasks → split
|
|
437
|
+
into focused sub-groups (each with its own tests and quality gate).
|
|
438
|
+
- Task ordering within a group: dependency chain — define → implement →
|
|
439
|
+
test → quality gate.
|
|
440
|
+
- Tasks should be small enough to complete in one session (~5-10 min coding).
|
|
441
|
+
Implementation details exceeding 10 lines belong in actual code, not as
|
|
442
|
+
separate sub-tasks.
|
|
443
|
+
|
|
444
|
+
Reference specs for what needs to be built, design for how to build it.
|
|
445
|
+
Each task should be verifiable - you know when it's done.
|
|
446
|
+
|
|
447
|
+
**Final report (process constraint)**: When this artifact is written,
|
|
448
|
+
every artifact of the change exists and the authoring session ends
|
|
449
|
+
here. You must NOT dispatch any subagent yourself. If you are the
|
|
450
|
+
generation subagent (COMPLEX tier), your final report MUST end by
|
|
451
|
+
telling the orchestrating agent to start the review loop (Phase 3 of
|
|
452
|
+
the clarify artifact's orchestration contract) - without that handoff
|
|
453
|
+
the review never happens. If you are the orchestrating agent (SIMPLE
|
|
454
|
+
tier), go straight to Phase 3 yourself and dispatch the independent
|
|
455
|
+
review subagent.
|
|
456
|
+
requires:
|
|
457
|
+
- specs
|
|
458
|
+
- design
|
|
459
|
+
apply:
|
|
460
|
+
requires: [tasks]
|
|
461
|
+
tracks: tasks.md
|
|
462
|
+
instruction: |
|
|
463
|
+
Read context files, work through pending tasks, mark complete as you go.
|
|
464
|
+
Follow the project's implementation conventions (AGENTS.md, openspec/config.yaml
|
|
465
|
+
rules, and any orchestration workflow the project uses).
|
|
466
|
+
Pause if you hit blockers or need clarification.
|
package/assets/skills/openspec-standard/templates/schemas/spec-driven-standard/templates/clarify.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
## Open Questions
|
|
2
|
+
|
|
3
|
+
<!-- Unknowns surfaced during clarification. One per bullet. Cover: problem & intent,
|
|
4
|
+
scope, related-surface survey, data model, business rules, integration
|
|
5
|
+
boundaries, architecture approaches. Resolve them with the user by
|
|
6
|
+
interviewing in rounds over a decision tree: each round asks every currently
|
|
7
|
+
answerable question (numbered, each with a recommended answer); keep going
|
|
8
|
+
until no doubt is left unresolved and nothing is silently assumed. -->
|
|
9
|
+
|
|
10
|
+
- <!-- question -->
|
|
11
|
+
|
|
12
|
+
## User Answers
|
|
13
|
+
|
|
14
|
+
<!-- The user's responses, captured verbatim or summarized. -->
|
|
15
|
+
|
|
16
|
+
- <!-- answer -->
|
|
17
|
+
|
|
18
|
+
## Related-Surface Survey
|
|
19
|
+
|
|
20
|
+
<!-- 关联场景清点:every consumer of the capability being changed, grounded in
|
|
21
|
+
code evidence (file/class/method): functional entry points (API endpoints,
|
|
22
|
+
import/export entries, scheduled jobs, message consumers, frontend calls),
|
|
23
|
+
shared processing logic reused by multiple entry points, and downstream
|
|
24
|
+
data consumers (readers/writers of the tables, fields, events, or export
|
|
25
|
+
artifacts involved). When shared processing logic changes, every consuming
|
|
26
|
+
entry point must be adapted in the SAME change; splitting into separate
|
|
27
|
+
changes requires an explicit boundary rationale confirmed by the user. -->
|
|
28
|
+
|
|
29
|
+
- <!-- entry point / shared logic / downstream consumer + code evidence + scoping verdict -->
|
|
30
|
+
|
|
31
|
+
## Architecture Direction
|
|
32
|
+
|
|
33
|
+
<!-- The crystallized approach: chosen direction, key decisions, 2-3 alternatives
|
|
34
|
+
considered with tradeoffs, and the plan summary the user explicitly confirmed
|
|
35
|
+
(interview answers alone do not count as confirmation). This is the HARD-GATE
|
|
36
|
+
output — proposal, specs, design, and tasks must stay consistent with what is
|
|
37
|
+
recorded here. -->
|
|
38
|
+
|
|
39
|
+
## Authoring Tier
|
|
40
|
+
|
|
41
|
+
<!-- SIMPLE or COMPLEX, with a one-line rationale (criteria in the clarify
|
|
42
|
+
instruction's Phase 2). SIMPLE: orchestrating agent writes proposal →
|
|
43
|
+
specs → design → tasks itself. COMPLEX: one generation subagent writes
|
|
44
|
+
them. Recorded here for auditability before Phase 2 starts. -->
|
|
45
|
+
|
|
46
|
+
- Tier: <!-- SIMPLE / COMPLEX -->
|
|
47
|
+
- Rationale: <!-- one line -->
|
|
48
|
+
|
|
49
|
+
## Initial Capabilities
|
|
50
|
+
|
|
51
|
+
<!-- Preliminary guess of which specs will be created or modified (kebab-case names).
|
|
52
|
+
Finalized in proposal.md Capabilities section. -->
|
|
53
|
+
|
|
54
|
+
- `<name>`: <!-- what this capability covers -->
|
package/assets/skills/openspec-standard/templates/schemas/spec-driven-standard/templates/design.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
## Context
|
|
2
|
+
|
|
3
|
+
<!-- Background and current state -->
|
|
4
|
+
|
|
5
|
+
## Goals / Non-Goals
|
|
6
|
+
|
|
7
|
+
**Goals:**
|
|
8
|
+
<!-- What this design aims to achieve -->
|
|
9
|
+
|
|
10
|
+
**Non-Goals:**
|
|
11
|
+
<!-- What is explicitly out of scope -->
|
|
12
|
+
|
|
13
|
+
## Decisions
|
|
14
|
+
|
|
15
|
+
<!-- Key design decisions and rationale. For each: the choice, why, and alternatives considered. -->
|
|
16
|
+
|
|
17
|
+
## Data Model
|
|
18
|
+
|
|
19
|
+
<!-- MANDATORY when the change involves persistence. Complete DDL: CREATE TABLE with
|
|
20
|
+
columns, types, constraints; field descriptions; indexes; audit fields.
|
|
21
|
+
Follow the project's persistence conventions (AGENTS.md / openspec/config.yaml
|
|
22
|
+
rules: table prefix, primary key strategy, logical delete, audit columns).
|
|
23
|
+
If no persistence, state that explicitly. -->
|
|
24
|
+
|
|
25
|
+
## Risks / Trade-offs
|
|
26
|
+
|
|
27
|
+
<!-- Known risks and trade-offs. Format: [Risk] → Mitigation -->
|
|
28
|
+
|
|
29
|
+
## Open Questions
|
|
30
|
+
|
|
31
|
+
<!-- Outstanding decisions or unknowns to resolve -->
|
package/assets/skills/openspec-standard/templates/schemas/spec-driven-standard/templates/proposal.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
## Why
|
|
2
|
+
|
|
3
|
+
<!-- Explain the motivation for this change. What problem does this solve? Why now? -->
|
|
4
|
+
|
|
5
|
+
## What Changes
|
|
6
|
+
|
|
7
|
+
<!-- Describe what will change. Be specific about new capabilities, modifications, or removals. -->
|
|
8
|
+
|
|
9
|
+
## Related Surface
|
|
10
|
+
|
|
11
|
+
<!-- 关联场景:survey conclusions from clarify.md — each entry point / shared
|
|
12
|
+
processing logic / downstream consumer with code evidence and its scoping
|
|
13
|
+
verdict (adapted in this change, or explicitly justified out with a boundary
|
|
14
|
+
rationale confirmed by the user). Shared processing logic changes must cover
|
|
15
|
+
all consuming entry points in this change. A bare "no related impact"
|
|
16
|
+
without search evidence counts as an incomplete proposal. -->
|
|
17
|
+
|
|
18
|
+
## Capabilities
|
|
19
|
+
|
|
20
|
+
### New Capabilities
|
|
21
|
+
<!-- Capabilities being introduced. Replace <name> with kebab-case identifier (e.g., user-auth, data-export, api-rate-limiting). Each creates specs/<name>/spec.md -->
|
|
22
|
+
- `<name>`: <brief description of what this capability covers>
|
|
23
|
+
|
|
24
|
+
### Modified Capabilities
|
|
25
|
+
<!-- Existing capabilities whose REQUIREMENTS are changing (not just implementation).
|
|
26
|
+
Only list here if spec-level behavior changes. Each needs a delta spec file.
|
|
27
|
+
Use existing spec names from openspec/specs/. Leave empty if no requirement changes. -->
|
|
28
|
+
- `<existing-name>`: <what requirement is changing>
|
|
29
|
+
|
|
30
|
+
## Impact
|
|
31
|
+
|
|
32
|
+
<!-- Affected code, APIs, dependencies, systems -->
|
package/assets/skills/openspec-standard/templates/schemas/spec-driven-standard/templates/tasks.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
模板说明:每个 ## N. 是一个独立迭代(task group),编排工具会逐个处理。
|
|
3
|
+
每个迭代必须自带质量保证:实现代码 + 测试 + 项目质量门(见 AGENTS.md)。
|
|
4
|
+
每组必须以实质变更为主体:至少一个任务承载真实的代码/配置行为变更(实现 + 测试)。
|
|
5
|
+
任务组划分必须覆盖 proposal「关联场景」小节划入本 change 的全部消费入口。
|
|
6
|
+
禁止把纯验证工作(质量门、端到端/回归/冒烟/残留检索)设为独立
|
|
7
|
+
任务组——无论单独成组还是混入文档/脚本同步拼成「收尾验证组」;文档/脚本同步
|
|
8
|
+
与验证只是功能组的随行任务,末位剩余工作只剩同步与验证时并入前一个功能组,
|
|
9
|
+
禁止新开收尾组,组标题以交付的业务价值命名。
|
|
10
|
+
|
|
11
|
+
> **各组**可独立实施,组内全部完成后编译通过、可启动、测试通过。
|
|
12
|
+
> **序号**即实施顺序——跨组依赖确保上游组提交后下游组可对接。
|
|
13
|
+
> 每个源文件在 tasks.md 中最多出现**一次**(避免跨组并行修改冲突)。
|
|
14
|
+
-->
|
|
15
|
+
|
|
16
|
+
> **前置 change:** 本 change 依赖 <name> change 完成后才可开始。参见 openspec/changes/<name>/。
|
|
17
|
+
|
|
18
|
+
## 1. <迭代名称:业务价值或功能名称>
|
|
19
|
+
|
|
20
|
+
<!-- 本组 4-8 个任务。独立迭代:实现 + 测试 + 质量门。
|
|
21
|
+
组内任务按依赖链排列:定义 → 实现 → 测试 → 质量门。
|
|
22
|
+
每个任务以 [spec:<capability>#<requirement>] 标注追溯(纯横切基础设施任务标 [infra])。 -->
|
|
23
|
+
|
|
24
|
+
- [ ] 1.1 <!-- 任务描述 --> [spec:<capability>#<requirement>]
|
|
25
|
+
- [ ] 1.2 <!-- 任务描述 --> [spec:<capability>#<requirement>]
|
|
26
|
+
- [ ] 1.3 <!-- 任务描述 --> [spec:<capability>]
|
|
27
|
+
- [ ] 1.4 <!-- 任务描述 --> [spec:<capability>]
|
|
28
|
+
- [ ] 1.5 <!-- 测试:UT + IT --> [spec:<capability>]
|
|
29
|
+
- [ ] 1.6 <!-- 质量门:项目质量门通过(见 AGENTS.md) --> [infra]
|
|
30
|
+
|
|
31
|
+
## 2. <迭代名称:业务价值或功能名称>
|
|
32
|
+
|
|
33
|
+
<!-- 本组 4-8 个任务。独立迭代:实现 + 测试 + 质量门。
|
|
34
|
+
组内任务按依赖链排列:定义 → 实现 → 测试 → 质量门。 -->
|
|
35
|
+
|
|
36
|
+
- [ ] 2.1 <!-- 任务描述 --> [spec:<capability>#<requirement>]
|
|
37
|
+
- [ ] 2.2 <!-- 任务描述 --> [spec:<capability>#<requirement>]
|
|
38
|
+
- [ ] 2.3 <!-- 任务描述 --> [spec:<capability>]
|
|
39
|
+
- [ ] 2.4 <!-- 任务描述 --> [spec:<capability>]
|
|
40
|
+
- [ ] 2.5 <!-- 测试 --> [spec:<capability>]
|
|
41
|
+
- [ ] 2.6 <!-- 质量门 --> [infra]
|