@fission-ai/openspec 1.7.0 → 1.8.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.
Files changed (95) hide show
  1. package/README.md +3 -1
  2. package/dist/cli/index.js +6 -1
  3. package/dist/commands/change.js +15 -1
  4. package/dist/commands/schema.js +89 -20
  5. package/dist/commands/spec.js +30 -6
  6. package/dist/commands/validate.js +2 -2
  7. package/dist/commands/workflow/instructions.js +32 -27
  8. package/dist/commands/workflow/status.js +2 -2
  9. package/dist/commands/workflow/templates.js +15 -5
  10. package/dist/core/archive.d.ts +14 -0
  11. package/dist/core/archive.js +1265 -151
  12. package/dist/core/artifact-graph/index.d.ts +1 -1
  13. package/dist/core/artifact-graph/index.js +1 -1
  14. package/dist/core/artifact-graph/instruction-loader.d.ts +3 -1
  15. package/dist/core/artifact-graph/instruction-loader.js +15 -5
  16. package/dist/core/artifact-graph/outputs.d.ts +1 -0
  17. package/dist/core/artifact-graph/outputs.js +67 -5
  18. package/dist/core/artifact-graph/resolver.js +35 -9
  19. package/dist/core/artifact-graph/types.js +21 -3
  20. package/dist/core/available-tools.d.ts +2 -2
  21. package/dist/core/available-tools.js +14 -3
  22. package/dist/core/change-metadata/schema.d.ts +1 -0
  23. package/dist/core/change-metadata/schema.js +7 -0
  24. package/dist/core/change-status-policy.js +2 -2
  25. package/dist/core/completions/command-registry.js +8 -0
  26. package/dist/core/config-schema.d.ts +3 -0
  27. package/dist/core/config-schema.js +28 -1
  28. package/dist/core/config.d.ts +3 -0
  29. package/dist/core/config.js +24 -2
  30. package/dist/core/file-state.js +56 -24
  31. package/dist/core/github-copilot/cloud-agent.d.ts +95 -0
  32. package/dist/core/github-copilot/cloud-agent.js +497 -0
  33. package/dist/core/global-config.d.ts +11 -0
  34. package/dist/core/init.d.ts +23 -0
  35. package/dist/core/init.js +234 -39
  36. package/dist/core/legacy-cleanup.js +4 -2
  37. package/dist/core/migration.d.ts +6 -4
  38. package/dist/core/migration.js +78 -22
  39. package/dist/core/parsers/requirement-blocks.d.ts +10 -0
  40. package/dist/core/parsers/requirement-blocks.js +60 -0
  41. package/dist/core/parsers/spec-structure.d.ts +1 -1
  42. package/dist/core/parsers/spec-structure.js +17 -1
  43. package/dist/core/profile-sync-drift.js +40 -5
  44. package/dist/core/project-config.d.ts +3 -0
  45. package/dist/core/project-config.js +31 -1
  46. package/dist/core/shared/index.d.ts +1 -0
  47. package/dist/core/shared/index.js +1 -0
  48. package/dist/core/shared/skill-content-equivalence.d.ts +7 -0
  49. package/dist/core/shared/skill-content-equivalence.js +41 -0
  50. package/dist/core/shared/skill-paths.d.ts +13 -0
  51. package/dist/core/shared/skill-paths.js +23 -0
  52. package/dist/core/shared/tool-detection.js +66 -35
  53. package/dist/core/shared-skill-target.d.ts +16 -0
  54. package/dist/core/shared-skill-target.js +156 -0
  55. package/dist/core/specs-apply.d.ts +72 -0
  56. package/dist/core/specs-apply.js +448 -55
  57. package/dist/core/templates/skill-templates.d.ts +1 -1
  58. package/dist/core/templates/skill-templates.js +1 -1
  59. package/dist/core/templates/workflows/apply-change.d.ts +10 -0
  60. package/dist/core/templates/workflows/apply-change.js +22 -182
  61. package/dist/core/templates/workflows/archive-change.js +8 -4
  62. package/dist/core/templates/workflows/bulk-archive-change.js +30 -26
  63. package/dist/core/templates/workflows/continue-change.js +6 -6
  64. package/dist/core/templates/workflows/explore.js +42 -18
  65. package/dist/core/templates/workflows/onboard.js +9 -3
  66. package/dist/core/templates/workflows/propose.js +72 -20
  67. package/dist/core/templates/workflows/store-selection.d.ts +1 -1
  68. package/dist/core/templates/workflows/store-selection.js +1 -1
  69. package/dist/core/templates/workflows/sync-specs.js +96 -18
  70. package/dist/core/templates/workflows/update-change.js +10 -8
  71. package/dist/core/update.d.ts +1 -0
  72. package/dist/core/update.js +103 -24
  73. package/dist/core/validation/validator.d.ts +23 -3
  74. package/dist/core/validation/validator.js +134 -18
  75. package/dist/core/version-check.js +6 -11
  76. package/dist/telemetry/config.d.ts +3 -4
  77. package/dist/telemetry/index.d.ts +9 -4
  78. package/dist/telemetry/index.js +20 -8
  79. package/dist/utils/change-metadata.d.ts +17 -4
  80. package/dist/utils/change-metadata.js +26 -4
  81. package/dist/utils/ci.d.ts +12 -0
  82. package/dist/utils/ci.js +16 -0
  83. package/dist/utils/command-references.d.ts +14 -2
  84. package/dist/utils/command-references.js +45 -3
  85. package/dist/utils/file-system.d.ts +10 -0
  86. package/dist/utils/file-system.js +70 -0
  87. package/dist/utils/interactive.d.ts +23 -0
  88. package/dist/utils/interactive.js +32 -0
  89. package/dist/utils/spec-discovery.d.ts +4 -4
  90. package/dist/utils/spec-discovery.js +19 -6
  91. package/dist/utils/task-progress.d.ts +17 -0
  92. package/dist/utils/task-progress.js +41 -13
  93. package/package.json +1 -1
  94. package/schemas/spec-driven/schema.yaml +8 -6
  95. package/schemas/spec-driven/templates/proposal.md +6 -4
@@ -5,7 +5,7 @@ export function getExploreSkillTemplate() {
5
5
  description: 'Enter explore mode - a thinking partner for exploring ideas, investigating problems, and clarifying requirements. Use when the user wants to think through something before or during a change.',
6
6
  instructions: `Enter explore mode. Think deeply. Visualize freely. Follow the conversation wherever it goes.
7
7
 
8
- **IMPORTANT: Explore mode is for thinking, not implementing.** You may read files, search code, and investigate the codebase, but you must NEVER write code or implement features. If the user asks you to implement something, remind them to exit explore mode first and create a change proposal. You MAY create OpenSpec artifacts (proposals, designs, specs) if the user asks—that's capturing thinking, not implementing.
8
+ **IMPORTANT: Explore mode is for thinking, not implementing.** You may read files, search code, and investigate the codebase, but you must NEVER write code or implement features. If the user asks you to implement something, remind them to exit explore mode first and create a change proposal. You MAY create OpenSpec artifacts (proposals, designs, specs) if the user asks—that's capturing thinking, not implementing. For a new change, scaffold it first as described below.
9
9
 
10
10
  **This is a stance, not a workflow.** There are no fixed steps, no required sequence, no mandatory outputs. You're a thinking partner helping the user explore.
11
11
 
@@ -100,6 +100,15 @@ Think freely. When insights crystallize, you might offer:
100
100
  - "This feels solid enough to start a change. Want me to create a proposal?"
101
101
  - Or keep exploring - no pressure to formalize
102
102
 
103
+ If the user asks you to capture the exploration as a new change, transition seamlessly into the requested capture:
104
+
105
+ 1. Run \`openspec new change "<name>"\` (with \`--store <id>\` when applicable) before creating any artifacts. Never create a new change directory under \`openspec/changes/\` by hand; the CLI scaffold creates required metadata such as \`.openspec.yaml\`. Keep the selected \`--store <id>\` on every applicable follow-up \`status\` and \`instructions\` command.
106
+ 2. Run \`openspec status --change "<name>" --json\` (append the confirmed \`--store "<id>"\` only for a registered standalone store), then process the requested artifacts in dependency order. For each requested artifact that is \`ready\`, run \`openspec instructions "<artifact-id>" --change "<name>" --json\` (append the confirmed \`--store "<id>"\` only for a registered standalone store). Before creating a requested artifact, evaluate any condition in its own \`instruction\` against the explored change; record a deliberate skip instead when the condition does not apply. If a requested artifact is blocked by a direct prerequisite the user did not request, run \`openspec instructions "<prerequisite-id>" --change "<name>" --json\` (append the confirmed \`--store "<id>"\` only for a registered standalone store) for that prerequisite whether it is \`ready\` or \`blocked\`. If its own \`instruction\` states a condition, evaluate that condition against the explored change and record a deliberate skip only when the condition does not apply. If the condition applies, or the prerequisite is not conditional, treat it as a normal prerequisite and ask before expanding the capture. Do not create an unrequested prerequisite unless the user approves.
107
+ 3. Follow the returned \`template\` and \`instruction\` fields. Read completed dependency files listed in \`dependencies\`, and apply \`context\` and \`rules\` as constraints without copying them into the artifact. If the instruction delegates creation to a specific skill or command, invoke it; otherwise write the artifact to \`resolvedOutputPath\`, using the instruction to choose a concrete path when it is a glob. Verify that the selected concrete output exists.
108
+ 4. After creating each artifact, re-run \`openspec status --change "<name>" --json\` (append the confirmed \`--store "<id>"\` only for a registered standalone store) and continue until every requested artifact is \`done\`, \`skipped\`, or was deliberately skipped because its own \`instruction\` stated a condition that did not apply. Tell the user about a deliberate conditional skip, remember it, and do not reconsider it. Dependencies are enablers, not gates: if a requested artifact is still \`blocked\` only because you deliberately skipped a conditional prerequisite, run \`openspec instructions "<artifact-id>" --change "<name>" --json\` (append the confirmed \`--store "<id>"\` only for a registered standalone store) despite the blocked status, then create it using step 3 only when those recorded conditional skips are its sole missing dependencies. If a requested artifact is blocked by a prerequisite the user did not ask to capture and cannot be conditionally skipped, explain that dependency and ask before expanding the capture.
109
+
110
+ Capture the artifact(s) the user requested without asking them to invoke another workflow command. If they asked only to start a change, stop after scaffolding and show its status.
111
+
103
112
  ### When a change exists
104
113
 
105
114
  If the user mentions a change or you detect one is relevant:
@@ -115,14 +124,16 @@ If the user mentions a change or you detect one is relevant:
115
124
 
116
125
  3. **Offer to capture when decisions are made**
117
126
 
118
- | Insight Type | Where to Capture |
119
- |----------------------------|--------------------------------|
120
- | New requirement discovered | \`specs/<capability>/spec.md\` |
121
- | Requirement changed | \`specs/<capability>/spec.md\` |
122
- | Design decision made | \`design.md\` |
123
- | Scope changed | \`proposal.md\` |
124
- | New work identified | \`tasks.md\` |
125
- | Assumption invalidated | Relevant artifact |
127
+ \`<capability-path>\` is the spec directory relative to \`specs/\` (for example, \`user-auth\` or \`identity/user-auth\`). Preserve an existing capability's full path and follow the project's established organization for new capabilities.
128
+
129
+ | Insight Type | Where to Capture |
130
+ |----------------------------|-------------------------------------|
131
+ | New requirement discovered | \`specs/<capability-path>/spec.md\` |
132
+ | Requirement changed | \`specs/<capability-path>/spec.md\` |
133
+ | Design decision made | \`design.md\` |
134
+ | Scope changed | \`proposal.md\` |
135
+ | New work identified | \`tasks.md\` |
136
+ | Assumption invalidated | Relevant artifact |
126
137
 
127
138
  Example offers:
128
139
  - "That's a design decision. Capture it in design.md?"
@@ -284,6 +295,7 @@ But this summary is optional. Sometimes the thinking IS the value.
284
295
  - **Don't rush** - Discovery is thinking time, not task time
285
296
  - **Don't force structure** - Let patterns emerge naturally
286
297
  - **Don't auto-capture** - Offer to save insights, don't just do it
298
+ - **Don't manually scaffold changes** - Never create a new change directory under \`openspec/changes/\` by hand. Always use \`openspec new change "<name>"\` (with \`--store <id>\` when applicable) so required metadata such as \`.openspec.yaml\` is created before writing artifacts.
287
299
  - **Do visualize** - A good diagram is worth many paragraphs
288
300
  - **Do explore the codebase** - Ground discussions in reality
289
301
  - **Do question assumptions** - Including the user's and your own`,
@@ -300,7 +312,7 @@ export function getOpsxExploreCommandTemplate() {
300
312
  tags: ['workflow', 'explore', 'experimental', 'thinking'],
301
313
  content: `Enter explore mode. Think deeply. Visualize freely. Follow the conversation wherever it goes.
302
314
 
303
- **IMPORTANT: Explore mode is for thinking, not implementing.** You may read files, search code, and investigate the codebase, but you must NEVER write code or implement features. If the user asks you to implement something, remind them to exit explore mode first and create a change proposal. You MAY create OpenSpec artifacts (proposals, designs, specs) if the user asks—that's capturing thinking, not implementing.
315
+ **IMPORTANT: Explore mode is for thinking, not implementing.** You may read files, search code, and investigate the codebase, but you must NEVER write code or implement features. If the user asks you to implement something, remind them to exit explore mode first and create a change proposal. You MAY create OpenSpec artifacts (proposals, designs, specs) if the user asks—that's capturing thinking, not implementing. For a new change, scaffold it first as described below.
304
316
 
305
317
  **This is a stance, not a workflow.** There are no fixed steps, no required sequence, no mandatory outputs. You're a thinking partner helping the user explore.
306
318
 
@@ -404,6 +416,15 @@ Think freely. When insights crystallize, you might offer:
404
416
  - "This feels solid enough to start a change. Want me to create a proposal?"
405
417
  - Or keep exploring - no pressure to formalize
406
418
 
419
+ If the user asks you to capture the exploration as a new change, transition seamlessly into the requested capture:
420
+
421
+ 1. Run \`openspec new change "<name>"\` (with \`--store <id>\` when applicable) before creating any artifacts. Never create a new change directory under \`openspec/changes/\` by hand; the CLI scaffold creates required metadata such as \`.openspec.yaml\`. Keep the selected \`--store <id>\` on every applicable follow-up \`status\` and \`instructions\` command.
422
+ 2. Run \`openspec status --change "<name>" --json\` (append the confirmed \`--store "<id>"\` only for a registered standalone store), then process the requested artifacts in dependency order. For each requested artifact that is \`ready\`, run \`openspec instructions "<artifact-id>" --change "<name>" --json\` (append the confirmed \`--store "<id>"\` only for a registered standalone store). Before creating a requested artifact, evaluate any condition in its own \`instruction\` against the explored change; record a deliberate skip instead when the condition does not apply. If a requested artifact is blocked by a direct prerequisite the user did not request, run \`openspec instructions "<prerequisite-id>" --change "<name>" --json\` (append the confirmed \`--store "<id>"\` only for a registered standalone store) for that prerequisite whether it is \`ready\` or \`blocked\`. If its own \`instruction\` states a condition, evaluate that condition against the explored change and record a deliberate skip only when the condition does not apply. If the condition applies, or the prerequisite is not conditional, treat it as a normal prerequisite and ask before expanding the capture. Do not create an unrequested prerequisite unless the user approves.
423
+ 3. Follow the returned \`template\` and \`instruction\` fields. Read completed dependency files listed in \`dependencies\`, and apply \`context\` and \`rules\` as constraints without copying them into the artifact. If the instruction delegates creation to a specific skill or command, invoke it; otherwise write the artifact to \`resolvedOutputPath\`, using the instruction to choose a concrete path when it is a glob. Verify that the selected concrete output exists.
424
+ 4. After creating each artifact, re-run \`openspec status --change "<name>" --json\` (append the confirmed \`--store "<id>"\` only for a registered standalone store) and continue until every requested artifact is \`done\`, \`skipped\`, or was deliberately skipped because its own \`instruction\` stated a condition that did not apply. Tell the user about a deliberate conditional skip, remember it, and do not reconsider it. Dependencies are enablers, not gates: if a requested artifact is still \`blocked\` only because you deliberately skipped a conditional prerequisite, run \`openspec instructions "<artifact-id>" --change "<name>" --json\` (append the confirmed \`--store "<id>"\` only for a registered standalone store) despite the blocked status, then create it using step 3 only when those recorded conditional skips are its sole missing dependencies. If a requested artifact is blocked by a prerequisite the user did not ask to capture and cannot be conditionally skipped, explain that dependency and ask before expanding the capture.
425
+
426
+ Capture the artifact(s) the user requested without asking them to invoke another workflow command. If they asked only to start a change, stop after scaffolding and show its status.
427
+
407
428
  ### When a change exists
408
429
 
409
430
  If the user mentions a change or you detect one is relevant:
@@ -419,14 +440,16 @@ If the user mentions a change or you detect one is relevant:
419
440
 
420
441
  3. **Offer to capture when decisions are made**
421
442
 
422
- | Insight Type | Where to Capture |
423
- |----------------------------|--------------------------------|
424
- | New requirement discovered | \`specs/<capability>/spec.md\` |
425
- | Requirement changed | \`specs/<capability>/spec.md\` |
426
- | Design decision made | \`design.md\` |
427
- | Scope changed | \`proposal.md\` |
428
- | New work identified | \`tasks.md\` |
429
- | Assumption invalidated | Relevant artifact |
443
+ \`<capability-path>\` is the spec directory relative to \`specs/\` (for example, \`user-auth\` or \`identity/user-auth\`). Preserve an existing capability's full path and follow the project's established organization for new capabilities.
444
+
445
+ | Insight Type | Where to Capture |
446
+ |----------------------------|-------------------------------------|
447
+ | New requirement discovered | \`specs/<capability-path>/spec.md\` |
448
+ | Requirement changed | \`specs/<capability-path>/spec.md\` |
449
+ | Design decision made | \`design.md\` |
450
+ | Scope changed | \`proposal.md\` |
451
+ | New work identified | \`tasks.md\` |
452
+ | Assumption invalidated | Relevant artifact |
430
453
 
431
454
  Example offers:
432
455
  - "That's a design decision. Capture it in design.md?"
@@ -468,6 +491,7 @@ When things crystallize, you might offer a summary - but it's optional. Sometime
468
491
  - **Don't rush** - Discovery is thinking time, not task time
469
492
  - **Don't force structure** - Let patterns emerge naturally
470
493
  - **Don't auto-capture** - Offer to save insights, don't just do it
494
+ - **Don't manually scaffold changes** - Never create a new change directory under \`openspec/changes/\` by hand. Always use \`openspec new change "<name>"\` (with \`--store <id>\` when applicable) so required metadata such as \`.openspec.yaml\` is created before writing artifacts.
471
495
  - **Do visualize** - A good diagram is worth many paragraphs
472
496
  - **Do explore the codebase** - Ground discussions in reality
473
497
  - **Do question assumptions** - Including the user's and your own`
@@ -211,6 +211,11 @@ I'll draft one based on our task.
211
211
 
212
212
  **DO:** Draft the proposal content (don't save yet):
213
213
 
214
+ \`<capability-path>\` is the spec directory relative to \`specs/\` (for example,
215
+ \`user-auth\` or \`identity/user-auth\`). Use the exact existing path for modified
216
+ capabilities. For new capabilities, follow the project's established spec
217
+ organization.
218
+
214
219
  \`\`\`
215
220
  Here's a draft proposal:
216
221
 
@@ -227,10 +232,11 @@ Here's a draft proposal:
227
232
  ## Capabilities
228
233
 
229
234
  ### New Capabilities
230
- - \`<capability-name>\`: [brief description]
235
+ - \`<capability-path>\`: [brief description]
231
236
 
232
237
  ### Modified Capabilities
233
238
  <!-- If modifying existing behavior -->
239
+ - \`<existing-capability-path>\`: [brief description]
234
240
 
235
241
  ## Impact
236
242
 
@@ -431,9 +437,9 @@ When a change is complete, we archive it. The archive path is derived from \`pla
431
437
  Archived changes become your project's decision history—you can always find them later to understand why something was built a certain way.
432
438
  \`\`\`
433
439
 
434
- **DO:**
440
+ **DO:** Archive the change (\`--yes\` answers the confirmation prompts, which you cannot answer from a tool call):
435
441
  \`\`\`bash
436
- openspec archive "<name>"
442
+ openspec archive "<name>" --yes
437
443
  \`\`\`
438
444
 
439
445
  **SHOW:**
@@ -5,13 +5,17 @@ export function getOpsxProposeSkillTemplate() {
5
5
  description: 'Propose a new change with all artifacts generated in one step. Use when the user wants to quickly describe what they want to build and get a complete proposal with design, specs, and tasks ready for implementation.',
6
6
  instructions: `Propose a new change - create the change and generate all artifacts in one step.
7
7
 
8
+ **Planning boundary**: This workflow creates planning artifacts only. The user request that selected or triggered this workflow authorizes planning only, even if it asks to build or fix something. Do not edit project code. After the planning artifacts are complete, stop. Do not start implementation in the same response, even if the initial request asks for it. Wait for a new user request after the artifacts are presented; then start the apply workflow.
9
+
8
10
  I'll create a change with the artifacts your schema defines. With the default spec-driven schema that is:
9
11
  - proposal.md (what & why)
10
- - \`specs/<capability>/spec.md\` (what the system must do - a delta, not the main spec)
12
+ - \`specs/<capability-path>/spec.md\` (what the system must do - a delta, not the main spec)
11
13
  - design.md (how)
12
14
  - tasks.md (implementation steps)
13
15
 
14
- When ready to implement, run /opsx:apply
16
+ \`<capability-path>\` is the spec directory relative to \`specs/\` (for example, \`user-auth\` or \`identity/user-auth\`). Preserve an existing capability's full path and follow the project's established organization for new capabilities.
17
+
18
+ When the user is ready to implement, they must start the apply workflow explicitly.
15
19
 
16
20
  ---
17
21
 
@@ -21,22 +25,43 @@ ${STORE_SELECTION_GUIDANCE}
21
25
 
22
26
  **Steps**
23
27
 
24
- 1. **If no clear input provided, ask what they want to build**
28
+ 1. **Understand the request and clarify material ambiguity**
25
29
 
26
- Ask the user (open-ended, no preset options):
30
+ If no clear input is provided, ask the user (open-ended, no preset options):
27
31
  > "What change do you want to work on? Describe what you want to build or fix."
28
32
 
29
33
  From their description, derive a kebab-case name (e.g., "add user authentication" → \`add-user-auth\`).
30
34
 
31
35
  **IMPORTANT**: Do NOT proceed without understanding what the user wants to build.
32
36
 
33
- 2. **Create the change directory**
37
+ If the request contains ambiguity that would materially affect scope, externally observable behavior, compatibility, or acceptance criteria, ask the user before creating the change. For minor details, make a reasonable assumption and record it in the planning artifacts.
38
+
39
+ 2. **Determine the workflow schema**
40
+
41
+ Use the configured default schema unless the user explicitly requests a different workflow.
42
+
43
+ **Use a different schema only if the user:**
44
+ - Explicitly requests a specific schema by name → use \`--schema <schema-name>\`
45
+ - Asks to "show workflows" or asks "what workflows" exist → resolve the authoritative root by running \`openspec context --json\` from the current working directory. If the user explicitly selected a registered store, use \`openspec context --json --store "<store-id>"\`. Then run \`openspec schemas --json\` with its working directory set to the returned \`root.path\` and let them choose. This preserves roots selected by a local \`store:\` pointer or the global \`defaultStore\`; \`schemas\` does not accept \`--store\`. If context reports only \`no_openspec_root\`, run \`openspec schemas --json\` from the current working directory instead. Do not use this fallback for invalid or unavailable stores.
46
+
47
+ Otherwise, omit \`--schema\` to preserve the configured default.
48
+
49
+ 3. **Create the change directory**
50
+
51
+ Choose one schema form below. If a registered store is selected, append \`--store "<store-id>"\` to that command and each later OpenSpec command shown below that accepts \`--store\`.
52
+
53
+ Using the configured default:
34
54
  \`\`\`bash
35
55
  openspec new change "<name>"
36
56
  \`\`\`
57
+
58
+ Using an explicitly requested schema:
59
+ \`\`\`bash
60
+ openspec new change "<name>" --schema "<schema-name>"
61
+ \`\`\`
37
62
  This creates a scaffolded change in the planning home resolved by the CLI with \`.openspec.yaml\`.
38
63
 
39
- 3. **Get the artifact build order**
64
+ 4. **Get the artifact build order**
40
65
  \`\`\`bash
41
66
  openspec status --change "<name>" --json
42
67
  \`\`\`
@@ -45,7 +70,7 @@ ${STORE_SELECTION_GUIDANCE}
45
70
  - \`artifacts\`: list of all artifacts, each with its \`status\` and its \`requires\` edges (the artifact IDs it directly depends on)
46
71
  - \`planningHome\`, \`changeRoot\`, \`artifactPaths\`, and \`actionContext\`: path and scope context. Use these instead of assuming repo-local paths.
47
72
 
48
- 4. **Create every artifact in the required set**
73
+ 5. **Create every artifact in the required set**
49
74
 
50
75
  Use a todo list to track progress through the artifacts.
51
76
 
@@ -84,7 +109,7 @@ ${STORE_SELECTION_GUIDANCE}
84
109
  - Ask the user to clarify
85
110
  - Then continue with creation
86
111
 
87
- 5. **Show final status**
112
+ 6. **Show final status**
88
113
  \`\`\`bash
89
114
  openspec status --change "<name>"
90
115
  \`\`\`
@@ -95,7 +120,7 @@ After completing all artifacts, summarize:
95
120
  - Change name and location
96
121
  - List of artifacts created with brief descriptions, plus any conditional artifact you skipped and why
97
122
  - What's ready: "All artifacts needed for implementation are ready."
98
- - Prompt: "Run \`/opsx:apply\` or ask me to implement to start working on the tasks."
123
+ - Prompt: "The artifacts are ready for review. When you are ready, run \`/opsx:apply\` or ask me to apply this change."
99
124
 
100
125
  **Artifact Creation Guidelines**
101
126
 
@@ -109,9 +134,10 @@ After completing all artifacts, summarize:
109
134
  - These guide what you write, but should never appear in the output
110
135
 
111
136
  **Guardrails**
137
+ - The request that invoked this workflow authorizes planning only. Any implementation or apply instruction in that request does not carry forward. Do NOT implement the change, start the apply workflow, or edit project code during this workflow. After presenting the artifacts, stop and wait for a new user request to start the apply workflow
112
138
  - Create every artifact the apply phase transitively depends on, not just the ids listed in \`apply.requires\`
113
139
  - Always read dependency artifacts before creating a new one - re-read from disk, not from conversation memory (files may have changed since you last saw them)
114
- - If context is critically unclear, ask the user - but prefer making reasonable decisions to keep momentum
140
+ - Ask about ambiguities that would materially change scope, externally observable behavior, compatibility, or acceptance criteria; for minor details, make reasonable assumptions and record them
115
141
  - If a change with that name already exists, ask if user wants to continue it or create a new one
116
142
  - Verify each artifact file exists after writing before proceeding to next`,
117
143
  license: 'MIT',
@@ -127,13 +153,17 @@ export function getOpsxProposeCommandTemplate() {
127
153
  tags: ['workflow', 'artifacts', 'experimental'],
128
154
  content: `Propose a new change - create the change and generate all artifacts in one step.
129
155
 
156
+ **Planning boundary**: This workflow creates planning artifacts only. The user request that selected or triggered this workflow authorizes planning only, even if it asks to build or fix something. Do not edit project code. After the planning artifacts are complete, stop. Do not start implementation in the same response, even if the initial request asks for it. Wait for a new user request after the artifacts are presented; then start the apply workflow.
157
+
130
158
  I'll create a change with the artifacts your schema defines. With the default spec-driven schema that is:
131
159
  - proposal.md (what & why)
132
- - \`specs/<capability>/spec.md\` (what the system must do - a delta, not the main spec)
160
+ - \`specs/<capability-path>/spec.md\` (what the system must do - a delta, not the main spec)
133
161
  - design.md (how)
134
162
  - tasks.md (implementation steps)
135
163
 
136
- When ready to implement, run /opsx:apply
164
+ \`<capability-path>\` is the spec directory relative to \`specs/\` (for example, \`user-auth\` or \`identity/user-auth\`). Preserve an existing capability's full path and follow the project's established organization for new capabilities.
165
+
166
+ When the user is ready to implement, they must start the apply workflow explicitly.
137
167
 
138
168
  ---
139
169
 
@@ -143,22 +173,43 @@ ${STORE_SELECTION_GUIDANCE}
143
173
 
144
174
  **Steps**
145
175
 
146
- 1. **If no input provided, ask what they want to build**
176
+ 1. **Understand the request and clarify material ambiguity**
147
177
 
148
- Ask the user (open-ended, no preset options):
178
+ If no input is provided, ask the user (open-ended, no preset options):
149
179
  > "What change do you want to work on? Describe what you want to build or fix."
150
180
 
151
181
  From their description, derive a kebab-case name (e.g., "add user authentication" → \`add-user-auth\`).
152
182
 
153
183
  **IMPORTANT**: Do NOT proceed without understanding what the user wants to build.
154
184
 
155
- 2. **Create the change directory**
185
+ If the request contains ambiguity that would materially affect scope, externally observable behavior, compatibility, or acceptance criteria, ask the user before creating the change. For minor details, make a reasonable assumption and record it in the planning artifacts.
186
+
187
+ 2. **Determine the workflow schema**
188
+
189
+ Use the configured default schema unless the user explicitly requests a different workflow.
190
+
191
+ **Use a different schema only if the user:**
192
+ - Explicitly requests a specific schema by name → use \`--schema <schema-name>\`
193
+ - Asks to "show workflows" or asks "what workflows" exist → resolve the authoritative root by running \`openspec context --json\` from the current working directory. If the user explicitly selected a registered store, use \`openspec context --json --store "<store-id>"\`. Then run \`openspec schemas --json\` with its working directory set to the returned \`root.path\` and let them choose. This preserves roots selected by a local \`store:\` pointer or the global \`defaultStore\`; \`schemas\` does not accept \`--store\`. If context reports only \`no_openspec_root\`, run \`openspec schemas --json\` from the current working directory instead. Do not use this fallback for invalid or unavailable stores.
194
+
195
+ Otherwise, omit \`--schema\` to preserve the configured default.
196
+
197
+ 3. **Create the change directory**
198
+
199
+ Choose one schema form below. If a registered store is selected, append \`--store "<store-id>"\` to that command and each later OpenSpec command shown below that accepts \`--store\`.
200
+
201
+ Using the configured default:
156
202
  \`\`\`bash
157
203
  openspec new change "<name>"
158
204
  \`\`\`
205
+
206
+ Using an explicitly requested schema:
207
+ \`\`\`bash
208
+ openspec new change "<name>" --schema "<schema-name>"
209
+ \`\`\`
159
210
  This creates a scaffolded change in the planning home resolved by the CLI with \`.openspec.yaml\`.
160
211
 
161
- 3. **Get the artifact build order**
212
+ 4. **Get the artifact build order**
162
213
  \`\`\`bash
163
214
  openspec status --change "<name>" --json
164
215
  \`\`\`
@@ -167,7 +218,7 @@ ${STORE_SELECTION_GUIDANCE}
167
218
  - \`artifacts\`: list of all artifacts, each with its \`status\` and its \`requires\` edges (the artifact IDs it directly depends on)
168
219
  - \`planningHome\`, \`changeRoot\`, \`artifactPaths\`, and \`actionContext\`: path and scope context. Use these instead of assuming repo-local paths.
169
220
 
170
- 4. **Create every artifact in the required set**
221
+ 5. **Create every artifact in the required set**
171
222
 
172
223
  Use a todo list to track progress through the artifacts.
173
224
 
@@ -206,7 +257,7 @@ ${STORE_SELECTION_GUIDANCE}
206
257
  - Ask the user to clarify
207
258
  - Then continue with creation
208
259
 
209
- 5. **Show final status**
260
+ 6. **Show final status**
210
261
  \`\`\`bash
211
262
  openspec status --change "<name>"
212
263
  \`\`\`
@@ -217,7 +268,7 @@ After completing all artifacts, summarize:
217
268
  - Change name and location
218
269
  - List of artifacts created with brief descriptions, plus any conditional artifact you skipped and why
219
270
  - What's ready: "All artifacts needed for implementation are ready."
220
- - Prompt: "Run \`/opsx:apply\` to start implementing."
271
+ - Prompt: "The artifacts are ready for review. When you are ready, run \`/opsx:apply\`."
221
272
 
222
273
  **Artifact Creation Guidelines**
223
274
 
@@ -231,9 +282,10 @@ After completing all artifacts, summarize:
231
282
  - These guide what you write, but should never appear in the output
232
283
 
233
284
  **Guardrails**
285
+ - The request that invoked this workflow authorizes planning only. Any implementation or apply instruction in that request does not carry forward. Do NOT implement the change, start the apply workflow, or edit project code during this workflow. After presenting the artifacts, stop and wait for a new user request to start the apply workflow
234
286
  - Create every artifact the apply phase transitively depends on, not just the ids listed in \`apply.requires\`
235
287
  - Always read dependency artifacts before creating a new one - re-read from disk, not from conversation memory (files may have changed since you last saw them)
236
- - If context is critically unclear, ask the user - but prefer making reasonable decisions to keep momentum
288
+ - Ask about ambiguities that would materially change scope, externally observable behavior, compatibility, or acceptance criteria; for minor details, make reasonable assumptions and record them
237
289
  - If a change with that name already exists, ask if user wants to continue it or create a new one
238
290
  - Verify each artifact file exists after writing before proceeding to next`
239
291
  };
@@ -4,5 +4,5 @@
4
4
  * Interpolated into every workflow's instructions so generated skills
5
5
  * consistently teach how to target a registered store with `--store <id>`.
6
6
  */
7
- export declare const STORE_SELECTION_GUIDANCE = "**Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `view`). Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.";
7
+ export declare const STORE_SELECTION_GUIDANCE = "**Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change \"<name>\" --json --store \"<id>\"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.";
8
8
  //# sourceMappingURL=store-selection.d.ts.map
@@ -4,5 +4,5 @@
4
4
  * Interpolated into every workflow's instructions so generated skills
5
5
  * consistently teach how to target a registered store with `--store <id>`.
6
6
  */
7
- export const STORE_SELECTION_GUIDANCE = `**Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run \`openspec store list --json\` to discover registered store ids, then pass \`--store <id>\` on the commands that read or write specs and changes (\`new change\`, \`status\`, \`instructions\`, \`list\`, \`show\`, \`validate\`, \`archive\`, \`doctor\`, \`context\`, \`view\`). Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local \`openspec/\` root.`;
7
+ export const STORE_SELECTION_GUIDANCE = `**Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run \`openspec store list --json\` to discover registered store ids, then pass \`--store <id>\` on the commands that read or write specs and changes (\`new change\`, \`status\`, \`instructions\`, \`list\`, \`show\`, \`validate\`, \`archive\`, \`doctor\`, \`context\`, \`view\`). Once selected, treat \`--store <id>\` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run \`openspec status --change "<name>" --json --store "<id>"\`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local \`openspec/\` root.`;
8
8
  //# sourceMappingURL=store-selection.js.map