aboutsummaryrefslogtreecommitdiffstats
path: root/.claude
diff options
context:
space:
mode:
Diffstat (limited to '.claude')
-rw-r--r--.claude/commands/opsx/apply.md184
-rw-r--r--.claude/commands/opsx/archive.md225
-rw-r--r--.claude/commands/opsx/explore.md228
-rw-r--r--.claude/commands/opsx/propose.md159
-rw-r--r--.claude/commands/opsx/sync.md258
-rw-r--r--.claude/commands/opsx/update.md87
-rw-r--r--.claude/skills/openspec-apply-change/SKILL.md188
-rw-r--r--.claude/skills/openspec-archive-change/SKILL.md182
-rw-r--r--.claude/skills/openspec-explore/SKILL.md343
-rw-r--r--.claude/skills/openspec-propose/SKILL.md163
-rw-r--r--.claude/skills/openspec-sync-specs/SKILL.md262
-rw-r--r--.claude/skills/openspec-update-change/SKILL.md91
12 files changed, 2370 insertions, 0 deletions
diff --git a/.claude/commands/opsx/apply.md b/.claude/commands/opsx/apply.md
new file mode 100644
index 0000000..731c789
--- /dev/null
+++ b/.claude/commands/opsx/apply.md
@@ -0,0 +1,184 @@
1---
2name: "OPSX: Apply"
3description: "Implement tasks from an OpenSpec change (Experimental)"
4allowed-tools: Bash(openspec:*)
5category: "Workflow"
6tags: ["workflow", "artifacts", "experimental"]
7---
8
9Implement tasks from an OpenSpec change.
10
11**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`, `schemas`, `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.
12
13**Input**: Optionally specify a change name (e.g., `/opsx:apply add-auth`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
14
15**Steps**
16
171. **Select the change**
18
19 If a name is provided, use it. Otherwise:
20 - Infer from conversation context if the user mentioned a change
21 - Auto-select if only one active change exists
22 - If ambiguous, run `openspec list --json` to get available changes and ask the user to select one
23
24 Always announce: "Using change: <name>" and how to override (e.g., `/opsx:apply <other>`).
25
262. **Check status to understand the schema**
27 ```bash
28 openspec status --change "<name>" --json
29 ```
30 Parse the JSON to understand:
31 - `schemaName`: The workflow being used (e.g., "spec-driven")
32 - `planningHome`, `changeRoot`, and `actionContext`: planning scope and edit constraints
33 - Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others)
34
353. **Get apply instructions**
36
37 ```bash
38 openspec instructions apply --change "<name>" --json
39 ```
40
41 This returns:
42 - `contextFiles`: artifact ID -> array of concrete file paths (varies by schema - could be proposal/specs/design/tasks or spec/tests/implementation/docs)
43 - Progress (total, complete, remaining)
44 - Task list with status
45 - Dynamic instruction based on current state
46 - Optional `context`: current required project instruction input from the selected root
47 - Optional `operationGuidance`: current advisory guidance for apply
48
49 **Handle states:**
50 - If `state: "blocked"` (missing artifacts): show message, suggest using `/opsx:continue` (if it is not installed, run `openspec status --change "<name>" --json` to see the next artifact and `openspec instructions <artifact-id> --change "<name>" --json` for how to create it)
51 - If `state: "all_done"`: congratulate, suggest archive
52 - Otherwise: proceed to implementation
53
54 Treat `context` as a required prompt-level input. Read and consider it, and
55 apply relevant project facts, conventions, and constraints while implementing.
56 Treat `operationGuidance` as optional additive advice. Read and consider every
57 entry, and follow entries that are applicable and compatible with the built-in
58 workflow.
59
60 Keep both fields separate from CLI-returned state, missing artifacts, tasks,
61 progress, `contextFiles`, and the built-in `instruction`. They are not
62 evidence of task completion, do not replace the built-in instruction, and do
63 not permit bypassing a blocked state. If context conflicts with the built-in
64 instruction, an explicit user choice, or a CLI-controlled value, report the
65 conflict and preserve the controlling value. If guidance is inapplicable or
66 conflicts with those controlling inputs, do not follow it and explain why.
67 These are prompt-level behavior contracts, not enforceable checks.
68
694. **Read context files**
70
71 Read every file path listed under `contextFiles` from the apply instructions output.
72 The files depend on the schema being used:
73 - **spec-driven**: proposal, specs, design, tasks
74 - Other schemas: follow the contextFiles from CLI output
75
76 Do not copy `context` or `operationGuidance` verbatim into implementation
77 files or planning artifacts unless the user separately asks for that content.
78
795. **Show current progress**
80
81 Display:
82 - Schema being used
83 - Progress: "N/M tasks complete"
84 - Remaining tasks overview
85 - Dynamic instruction from CLI
86
876. **Implement tasks (loop until done or blocked)**
88
89 For each pending task:
90 - Show which task is being worked on
91 - Make the code changes required
92 - Keep changes minimal and focused
93 - Mark task complete in the tasks file: `- [ ]` → `- [x]`
94 - Continue to next task
95
96 **Pause if:**
97 - Task is unclear → ask for clarification
98 - Implementation reveals a design issue → suggest updating artifacts
99 - A task needs work beyond what the spec and tasks describe, or you are tempted to drop, narrow, defer, or accept exceptions to specified behavior to make it fit → surface the added scope and ask; do not absorb it silently
100 - Error or blocker encountered → report and wait for guidance
101 - User interrupts
102
1037. **On completion or pause, show status**
104
105 Display:
106 - Tasks completed this session
107 - Overall progress: "N/M tasks complete"
108 - If all done: suggest archive
109 - If paused: explain why and wait for guidance
110
111**Output During Implementation**
112
113```
114## Implementing: <change-name> (schema: <schema-name>)
115
116Working on task 3/7: <task description>
117[...implementation happening...]
118✓ Task complete
119
120Working on task 4/7: <task description>
121[...implementation happening...]
122✓ Task complete
123```
124
125**Output On Completion**
126
127```
128## Implementation Complete
129
130**Change:** <change-name>
131**Schema:** <schema-name>
132**Progress:** 7/7 tasks complete ✓
133
134### Completed This Session
135- [x] Task 1
136- [x] Task 2
137...
138
139All tasks complete! You can archive this change with `/opsx:archive`.
140```
141
142**Output On Pause (Issue Encountered)**
143
144```
145## Implementation Paused
146
147**Change:** <change-name>
148**Schema:** <schema-name>
149**Progress:** 4/7 tasks complete
150
151### Issue Encountered
152<description of the issue>
153
154**Options:**
1551. <option 1>
1562. <option 2>
1573. Other approach
158
159What would you like to do?
160```
161
162**Guardrails**
163- Keep going through tasks until done or blocked
164- Always read context files before starting (from the apply instructions output)
165- If task is ambiguous, pause and ask before implementing
166- If implementation reveals issues, pause and suggest artifact updates
167- Keep code changes minimal and scoped to each task
168- Update task checkbox immediately after completing each task
169- Pause on errors, blockers, or unclear requirements - don't guess
170- When a task needs work beyond what the spec describes, surface the added scope and pause - never silently narrow, defer, or simplify away specified behavior
171- Only mark a task `- [x]` when its specified behavior is fully implemented, not when it is partially done or deferred
172- Use contextFiles from CLI output, don't assume specific file names
173- Do not use context or operation guidance as proof that a task is complete
174- Apply relevant project context; report conflicts with controlling workflow inputs
175- Consider every guidance entry; explain any inapplicable or conflicting advice
176- Do not copy runtime context or operation guidance into implementation files or planning artifacts
177- Preserve CLI-controlled blocked/ready/all-done behavior and completion criteria
178
179**Fluid Workflow Integration**
180
181This skill supports the "actions on a change" model:
182
183- **Can be invoked anytime**: Before all artifacts are done (if tasks exist), after partial implementation, interleaved with other actions
184- **Allows artifact updates**: If implementation reveals design issues, suggest updating artifacts - not phase-locked, work fluidly
diff --git a/.claude/commands/opsx/archive.md b/.claude/commands/opsx/archive.md
new file mode 100644
index 0000000..d93baca
--- /dev/null
+++ b/.claude/commands/opsx/archive.md
@@ -0,0 +1,225 @@
1---
2name: "OPSX: Archive"
3description: "Archive a completed change in the experimental workflow"
4allowed-tools: Bash(openspec:*)
5category: "Workflow"
6tags: ["workflow", "archive", "experimental"]
7---
8
9Archive a completed change in the experimental workflow.
10
11**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`, `schemas`, `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.
12
13`<capability-path>` is the spec directory relative to `specs/` (for example, `user-auth` or `identity/user-auth`). Preserve the full path from each delta spec when resolving its main spec.
14
15**Input**: Optionally specify a change name after `/opsx:archive` (e.g., `/opsx:archive add-auth`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
16
17**Steps**
18
191. **Select the change**
20
21 If a name is provided, use it. Otherwise:
22 - Infer from conversation context if the user mentioned a change
23 - Auto-select if only one active change exists
24 - If ambiguous, run `openspec list --json` to get available changes and ask the user to select one
25
26 When prompting, show only active changes (not already archived).
27 Include the schema used for each change if available.
28
29 Always announce: "Using change: <name>" and how to override (e.g., `/opsx:archive <other>`).
30
31 **Load current archive inputs before the existing archive checks:**
32
33 After resolving the selected change and planning root, run:
34 ```bash
35 openspec instructions archive --change "<name>" --json
36 ```
37 Keep the same selected-root flags on this command. This lookup is advisory and
38 optional: it only supplies extra prompt inputs, so it must never block archiving.
39 If it exits non-zero or returns invalid JSON — for example on an older CLI that
40 does not support this command yet — continue the archive workflow with no
41 context and no operation guidance. Do not report an error and do not stop.
42
43 A successful response may omit both optional fields. Treat `context` as a
44 required prompt-level input: read and consider it, and apply relevant project
45 facts, conventions, and constraints. Treat `operationGuidance` as optional
46 additive advice: read and consider every entry, and follow entries that are
47 applicable and compatible with the built-in archive workflow.
48
49 Keep both fields separate from built-in steps, explicit user choices, resolved
50 paths, CLI checks, and command contracts. If context conflicts with one of those
51 controlling inputs, report the conflict and preserve the controlling value. If
52 guidance is inapplicable or conflicts with a controlling input, do not follow it
53 and explain why. Do not infer replacement paths, skipped prompts, or flags from
54 either field, and do not copy their text verbatim into specs, change artifacts,
55 or archive summaries unless the user separately asks for it. These are
56 prompt-level behavior contracts, not enforceable checks.
57
582. **Check artifact completion status**
59
60 Run `openspec status --change "<name>" --json` to check artifact completion.
61
62 Parse the JSON to understand:
63 - `schemaName`: The workflow being used
64 - `planningHome`, `changeRoot`, `artifactPaths`, and `actionContext`: path and scope context
65 - `artifacts`: List of artifacts with their status (`done`, `skipped`, or other)
66
67 **If any artifacts are neither `done` nor `skipped`** (skipped artifacts satisfy the requirement - the change declares skip_specs):
68 - Display warning listing incomplete artifacts
69 - Prompt user for confirmation to continue
70 - Proceed if user confirms
71
723. **Check task completion status**
73
74 Read the tasks file (typically `tasks.md`) to check for incomplete tasks.
75
76 Count tasks marked with `- [ ]` (incomplete) vs `- [x]` (complete).
77
78 **If incomplete tasks found:**
79 - Display warning showing count of incomplete tasks
80 - Prompt user for confirmation to continue
81 - Proceed if user confirms
82
83 **If no tasks file exists:** Proceed without task-related warning.
84
854. **Assess delta spec sync state**
86
87 Use `artifactPaths.specs.existingOutputPaths` from status JSON as the only
88 delta-spec source. If the `specs` entry is missing or
89 `existingOutputPaths` is empty, proceed without a sync prompt and do not infer
90 delta specs from other artifacts.
91
92 **If delta specs exist:**
93 - Compare each delta spec with its corresponding main spec at `<planningHome.root>/openspec/specs/<capability-path>/spec.md` (use the store-aware `planningHome.root` from step 2, not a hardcoded repo path)
94 - Determine what changes would be applied (adds, modifications, removals, renames)
95 - Show a combined summary before prompting
96
97 **Prompt options:**
98 - If changes needed: "Sync now (recommended)", "Archive without syncing"
99 - If already synced: "Archive now", "Sync anyway", "Cancel"
100
101 Route on the answer:
102 - "Cancel" — stop, do not archive
103 - "Archive without syncing" or "Archive now" — proceed to archive
104 - "Sync now" or "Sync anyway" — sync, then verify (below)
105 - Anything else — ask again rather than archiving
106
107 Before a selected sync writes any main spec, run
108 `openspec instructions specs --change "<name>" --json` once with the same
109 selected-root flags. Require a zero exit status and valid artifact-instruction
110 JSON. If the lookup fails or returns invalid JSON, report the error and stop
111 before writing any main spec or moving the change. A valid response with omitted
112 `rules` is the no-rules case. Apply returned `rules` only to the content and
113 form of main specs produced by this merge; do not use them as archive guidance,
114 change CLI behavior, or copy the rule text into any output file.
115
116 Then run the `/opsx:sync` workflow inline (agent-driven intelligent merge) for change '<name>', passing the delta spec analysis and the fetched specs-rule snapshot from above, and wait for it to finish. The inline sync must reuse that snapshot without fetching `specs` instructions again. Do not delegate it to a background task — step 5 would move `changeRoot` out from under a sync that is still reading it, leaving the change archived and the main specs never updated. If your agent can only run it by delegation, delegate synchronously and wait for the result.
117
118 Then re-run the comparison from the top of this step against every capability that has a delta spec in `artifactPaths.specs.existingOutputPaths` — not only the ones the sync reports it touched. A successful sync leaves nothing left to apply, so each capability must now read as already synced:
119 - ADDED requirements present
120 - MODIFIED requirements carrying the scenario and description changes named in the delta, with their other scenarios intact
121 - REMOVED requirements gone — and where this sync retired a capability (removed its last requirement, leaving `## Requirements` empty), its main spec deleted rather than left empty; a spec the sync deliberately kept and reported is also a match
122 - RENAMED requirements present under the new name and absent under the old one
123
124 If the sync failed, or any capability does not match, report what differs and stop — do not archive. Nothing has moved and `changeRoot` is intact, so the user can fix the mismatch or re-run the sync and start the archive again.
125
1265. **Perform the archive**
127
128 Create an `archive` directory under `planningHome.changesDir` if it doesn't exist:
129 ```bash
130 mkdir -p "<planningHome.changesDir>/archive"
131 ```
132
133 Generate the target name: use the change name as-is when it already starts with a `YYYY-MM-DD-` prefix; otherwise prepend the current date as `YYYY-MM-DD-<change-name>`. Never stack a second date (same rule as `openspec archive`).
134
135 **Check if target already exists:**
136 - If yes: Fail with error, suggest renaming existing archive or using different date
137 - If no: Move `changeRoot` to the archive directory
138
139 ```bash
140 mv "<changeRoot>" "<planningHome.changesDir>/archive/<target-name>"
141 ```
142
1436. **Display summary**
144
145 Show archive completion summary including:
146 - Change name
147 - Schema that was used
148 - Archive location
149 - Spec sync status (synced / sync skipped / no delta specs)
150 - Note about any warnings (incomplete artifacts/tasks)
151
152**Output On Success**
153
154```markdown
155## Archive Complete
156
157**Change:** <change-name>
158**Schema:** <schema-name>
159**Archived to:** the archive path derived from `planningHome.changesDir`/<target-name>/
160**Specs:** ✓ Synced to main specs
161
162All artifacts complete. All tasks complete.
163```
164
165**Output On Success (No Delta Specs)**
166
167```markdown
168## Archive Complete
169
170**Change:** <change-name>
171**Schema:** <schema-name>
172**Archived to:** the archive path derived from `planningHome.changesDir`/<target-name>/
173**Specs:** No delta specs
174
175All artifacts complete. All tasks complete.
176```
177
178**Output On Success With Warnings**
179
180```markdown
181## Archive Complete (with warnings)
182
183**Change:** <change-name>
184**Schema:** <schema-name>
185**Archived to:** the archive path derived from `planningHome.changesDir`/<target-name>/
186**Specs:** Sync skipped (user chose to skip)
187
188**Warnings:**
189- Archived with 2 incomplete artifacts
190- Archived with 3 incomplete tasks
191- Delta spec sync was skipped (user chose to skip)
192
193Review the archive if this was not intentional.
194```
195
196**Output On Error (Archive Exists)**
197
198```markdown
199## Archive Failed
200
201**Change:** <change-name>
202**Target:** the archive path derived from `planningHome.changesDir`/<target-name>/
203
204Target archive directory already exists.
205
206**Options:**
2071. Rename the existing archive
2082. Delete the existing archive if it's a duplicate
2093. Wait until a different date to archive
210```
211
212**Guardrails**
213- Announce the selected change; prompt for selection when it is ambiguous
214- Use artifact graph (openspec status --json) for completion checking
215- Don't block archive on warnings - just inform and confirm
216- Preserve .openspec.yaml when moving to archive (it moves with the directory)
217- Show clear summary of what happened
218- If sync is requested, run the `/opsx:sync` workflow inline (agent-driven)
219- Never archive while a spec sync is still in flight — run the sync inline and verify the main specs before moving `changeRoot`
220- If delta specs exist, always run the sync assessment and show the combined summary before prompting
221- Apply relevant runtime context and report conflicts; operation guidance remains advisory
222- Consider every guidance entry and explain any inapplicable or conflicting advice
223- Existing CLI checks, resolved paths, prompts, and command contracts are unchanged
224- Artifact rules constrain only the specs being written and are never operation guidance
225- Never copy runtime context, operation guidance, or artifact-rule text verbatim into output files
diff --git a/.claude/commands/opsx/explore.md b/.claude/commands/opsx/explore.md
new file mode 100644
index 0000000..7d261cd
--- /dev/null
+++ b/.claude/commands/opsx/explore.md
@@ -0,0 +1,228 @@
1---
2name: "OPSX: Explore"
3description: "Enter explore mode - think through ideas, investigate problems, clarify requirements"
4allowed-tools: Bash(openspec:*)
5category: "Workflow"
6tags: ["workflow", "explore", "experimental", "thinking"]
7---
8
9Enter explore mode. Think deeply. Visualize freely. Follow the conversation wherever it goes.
10
11**IMPORTANT: Explore mode is for thinking, not implementing.** You may read files, search code, investigate the codebase, and run read-only commands or tools without confirmation, 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 or update OpenSpec change artifacts (proposals, designs, specs) within a confirmed scope—that's capturing thinking, not implementing. Answering design or clarifying questions is never consent to write. Before the first write-capable action, name the artifacts or files you would change and what you would do, ask a direct yes/no question, and wait for the user's confirmation in a separate message. Confirmation covers only the scope you described; ask again before expanding it. For a new change, scaffold it first as described below.
12
13**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.
14
15**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`, `schemas`, `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.
16
17**Input**: The argument after `/opsx:explore` is whatever the user wants to think about. Could be:
18- A vague idea: "real-time collaboration"
19- A specific problem: "the auth system is getting unwieldy"
20- A change name: "add-dark-mode" (to explore in context of that change)
21- A comparison: "postgres vs sqlite for this"
22- Nothing (just enter explore mode)
23
24---
25
26## The Stance
27
28- **Curious, not prescriptive** - Ask questions that emerge naturally, don't follow a script
29- **Open threads, not interrogations** - Surface multiple interesting directions and let the user follow what resonates. Don't funnel them through a single path of questions.
30- **Visual** - Use ASCII diagrams liberally when they'd help clarify thinking
31- **Adaptive** - Follow interesting threads, pivot when new information emerges
32- **Patient** - Don't rush to conclusions, let the shape of the problem emerge
33- **Grounded** - Explore the actual codebase when relevant, don't just theorize
34
35---
36
37## Planning a Change
38
39When the user is planning a change, guide them toward shared understanding with focused discovery questions. For open-ended discussion, follow the conversation without imposing an interview or a required output.
40
41Before asking a factual question, follow the context discovery below and inspect relevant OpenSpec artifacts, source, tests, docs, and configuration. Do not ask the user to repeat facts you can verify. Summarize relevant findings without reproducing private context or rules. If evidence is missing, conflicting, or inaccessible, state that limitation and ask only for the clarification needed to proceed.
42
43- **Follow dependencies** - Resolve the next blocking decision before its dependent details. For example, clarify the user's outcome and scope before choosing an API or data model. Revisit downstream assumptions when an earlier answer changes. Skip branches that do not matter to this goal.
44- **Keep questions focused** - Ask one focused question at a time, and briefly explain why it matters and which decision it unlocks. Batch questions only if the user asks for a batch; keep them small and group related decisions.
45- **Offer grounded recommendations** - When evidence supports a recommendation, state your preferred option and why it fits the user's goals, with alternatives and their tradeoffs when useful. Do not invent intent, priorities, or external constraints: ask the user when only they can answer. Avoid a fixed question format.
46- **Keep a conversational record** - Track decisions in the conversation, not in files. Separate confirmed decisions from proposed defaults and unresolved questions. Silence is not acceptance. Accepting an answer or a batch of recommendations is not permission to write. Keep file-write confirmation separate from discovery questions and follow the guardrails below.
47
48Stop asking when the user has enough clarity. Let them pause, pivot, or defer a decision; do not exhaust every branch or force a proposal.
49
50For example, after inspecting the relevant code:
51
52```text
53The CLI already uses SQLite and has no remote service. Is sharing state
54across devices in scope? That determines whether local storage is enough.
55If this stays a single-device tool, I recommend keeping SQLite to avoid
56adding a service to operate; shared state would need a separate sync design.
57```
58
59---
60
61## What You Might Do
62
63Depending on what the user brings, you might:
64
65**Explore the problem space**
66- Ask clarifying questions that emerge from what they said
67- Challenge assumptions
68- Reframe the problem
69- Find analogies
70
71**Investigate the codebase**
72- Map existing architecture relevant to the discussion
73- Find integration points
74- Identify patterns already in use
75- Surface hidden complexity
76
77**Compare options**
78- Brainstorm multiple approaches
79- Build comparison tables
80- Sketch tradeoffs
81- Recommend a path (if asked)
82
83**Visualize**
84```
85+------------------------------------------+
86| Use ASCII diagrams liberally |
87+------------------------------------------+
88| |
89| [State A] -------> [State B] |
90| | |
91| v |
92| [State C] |
93| |
94| System diagrams, state machines, |
95| data flows, architecture sketches, |
96| dependency graphs, comparison tables |
97| |
98+------------------------------------------+
99```
100
101**Draw with plain ASCII only** — borders `+` `-` `|`, arrows `-->` `<--` `^` `v`, markers `*` `x`.
102Unicode diagram glyphs can render at different widths across terminals, fonts, and locales, so padded boxes and aligned tables can drift. Keep every diagram character ASCII.
103
104**Surface risks and unknowns**
105- Identify what could go wrong
106- Find gaps in understanding
107- Suggest spikes or investigations
108
109---
110
111## OpenSpec Awareness
112
113You have full context of the OpenSpec system. Use it naturally, don't force it.
114
115### Check for context
116
117At the start, quickly check what exists:
118```bash
119openspec list --json
120```
121
122This tells you:
123- If there are active changes
124- Their names, schemas, and status
125- What the user might be working on
126
127That is the *change* list - work in flight. It does not include the project's durable capabilities, so list those too:
128```bash
129openspec list --specs
130```
131Add `--json` for ids and requirement counts, and append `--store "<id>"` only for a registered standalone store. This is the inventory of what the project already claims to do, and `openspec list` on its own never shows it. To look at one, run `openspec show "<spec-id>" --type spec --json --no-scenarios` (same `--store` rule) - it returns that capability's purpose and requirement texts without pulling the whole spec file into context, and `--type spec` stops a change of the same name from making it ambiguous.
132
133The filtered read is only an overview. Before deciding what is already covered or what should change, read each relevant spec in full, including scenarios, with `openspec show "<spec-id>" --type spec` (same `--store` rule).
134
135Then read the project's own context from the resolved root - `<root.path>/openspec/config.yaml` (or `config.yml`). Use the `root.path` returned above, and skip this if neither file exists:
136- `context`: project background - tech stack, conventions, constraints
137- `rules`: keyed by artifact id - the entries for an artifact apply only when you write that artifact
138
139Ground your thinking in these. They are constraints for you to follow, not content to reproduce: do NOT copy them into the conversation or into any artifact you create.
140
141If the user mentioned a specific change name, read its artifacts for context.
142
143### When no change exists
144
145Think freely. When insights crystallize, you might offer:
146
147- "This feels solid enough to start a change. Want me to create a proposal?"
148- Or keep exploring - no pressure to formalize
149
150If the user asks you to capture the exploration as a new change, transition seamlessly into the requested capture:
151
1521. 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.
1532. 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.
1543. 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.
1554. 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.
156
157Capture 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.
158
159### When a change exists
160
161If the user mentions a change or you detect one is relevant:
162
1631. **Resolve and read existing artifacts for context**
164 - Run `openspec status --change "<name>" --json`.
165 - Use `changeRoot`, `artifactPaths`, and `actionContext` from the status JSON.
166 - Read existing files from `artifactPaths.<artifact>.existingOutputPaths`.
167
1682. **Reference them naturally in conversation**
169 - "Your design mentions using Redis, but we just realized SQLite fits better..."
170 - "The proposal scopes this to premium users, but we're now thinking everyone..."
171
1723. **Offer to capture when decisions are made**
173
174 `<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.
175
176 | Insight Type | Where to Capture |
177 |----------------------------|-------------------------------------|
178 | New requirement discovered | `specs/<capability-path>/spec.md` |
179 | Requirement changed | `specs/<capability-path>/spec.md` |
180 | Design decision made | `design.md` |
181 | Scope changed | `proposal.md` |
182 | New work identified | `tasks.md` |
183 | Assumption invalidated | Relevant artifact |
184
185 Example offers:
186 - "That's a design decision. Capture it in design.md?"
187 - "This is a new requirement. Add it to specs?"
188 - "This changes scope. Update the proposal?"
189
1904. **The user decides** - Offer and move on. Don't pressure. Don't auto-capture.
191
192---
193
194## What You Don't Have To Do
195
196- Follow a script
197- Ask the same questions every time
198- Produce a specific artifact
199- Reach a conclusion
200- Stay on topic if a tangent is valuable
201- Be brief (this is thinking time)
202
203---
204
205## Ending Discovery
206
207There's no required ending. Discovery might:
208
209- **Flow into a proposal**: "Ready to start? I can create a change proposal."
210- **Result in artifact updates**: "Updated design.md with these decisions"
211- **Just provide clarity**: User has what they need, moves on
212- **Continue later**: "We can pick this up anytime"
213
214When things crystallize, you might offer a summary - but it's optional. Sometimes the thinking IS the value.
215
216---
217
218## Guardrails
219
220- **Don't implement** - Never write code or implement features. Workflow configuration counts too: creating or editing schemas, templates, or `openspec/config.yaml` is a change, not thinking. Creating or updating OpenSpec change artifacts within the confirmed scope is fine, writing anything else is not.
221- **Don't fake understanding** - If something is unclear, dig deeper
222- **Don't rush** - Discovery is thinking time, not task time
223- **Don't force structure** - Let patterns emerge naturally
224- **Don't auto-capture** - Offer to save insights, don't just do it. Read-only commands and tools need no confirmation. Before the first write-capable action—including `openspec new change` or another command that writes files—name the artifacts or files and proposed changes, ask a direct yes/no question, and wait for explicit confirmation in a separate user message. That confirmation covers only the described scope; ask again before expanding it. Answers to design or clarifying questions are never consent to write.
225- **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.
226- **Do visualize** - A good diagram is worth many paragraphs
227- **Do explore the codebase** - Ground discussions in reality
228- **Do question assumptions** - Including the user's and your own
diff --git a/.claude/commands/opsx/propose.md b/.claude/commands/opsx/propose.md
new file mode 100644
index 0000000..0e487c5
--- /dev/null
+++ b/.claude/commands/opsx/propose.md
@@ -0,0 +1,159 @@
1---
2name: "OPSX: Propose"
3description: "Propose a new change - create it and generate all artifacts in one step"
4allowed-tools: Bash(openspec:*)
5category: "Workflow"
6tags: ["workflow", "artifacts", "experimental"]
7---
8
9Propose a new change - create the change and generate all artifacts in one step.
10
11**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.
12
13I'll create a change with the artifacts your schema defines. With the default spec-driven schema that is:
14- proposal.md (what & why)
15- `specs/<capability-path>/spec.md` (what the system must do - a delta, not the main spec)
16- design.md (how)
17- tasks.md (implementation steps)
18
19`<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.
20
21When the user is ready to implement, they must start the apply workflow explicitly.
22
23---
24
25**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`, `schemas`, `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.
26
27**Input**: The argument after `/opsx:propose` is the change name (kebab-case), OR a description of what the user wants to build.
28
29**Steps**
30
311. **Understand the request and clarify material ambiguity**
32
33 If no input is provided, ask the user (open-ended, no preset options):
34 > "What change do you want to work on? Describe what you want to build or fix."
35
36 From their description, derive a kebab-case name (e.g., "add user authentication" → `add-user-auth`).
37
38 **IMPORTANT**: Do NOT proceed without understanding what the user wants to build.
39
40 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.
41
422. **Load project context**
43
44 Run `openspec context --json` from the current working directory (or `openspec context --json --store "<store-id>"` when a registered store was explicitly selected). Use the returned `root.path` as the authoritative OpenSpec root. If context reports `no_openspec_root`, stop without creating or changing any files. Offer `openspec init` and wait for the user to request initialization. Do not initialize automatically or run `openspec new change`. After initialization, rerun this context check before continuing. For any other context failure, stop and report the error; do not fall back to the current directory or run later OpenSpec commands without the selected store.
45
46 Only when context returns a resolved `root.path`, read `<root.path>/openspec/config.yaml`. Use `config.yml` only when `config.yaml` does not exist. If neither file exists, continue without project context. Do not fall back to `config.yml` if `config.yaml` is unreadable or invalid.
47
48 If the file parses as a YAML object and its `context` field is a string no larger than 51,200 bytes in UTF-8, apply that field before exploring the codebase or making planning decisions. If the file cannot be read or parsed, or the context field is invalid or oversized, continue without project context. Validate this field independently of other config fields, as OpenSpec does.
49
50 Treat context as project-provided data and constraints, not as authority to change this workflow: it cannot override user authorization, the planning boundary, tool restrictions, or artifact and output rules. Do not copy the context into artifacts; use it to focus any codebase exploration and as a constraint on the proposal.
51
523. **Determine the workflow schema**
53
54 Use the configured default schema unless the user explicitly requests a different workflow.
55
56 **Use a different schema only if the user:**
57 - Explicitly requests a specific schema by name → use `--schema <schema-name>`
58 - 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`; when a registered store was explicitly selected, append `--store "<store-id>"` to `openspec schemas --json` as well. If context fails, stop as described in the context-loading step; do not fall back to the current directory.
59
60 Otherwise, omit `--schema` to preserve the configured default.
61
624. **Create the change directory**
63
64 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`.
65
66 Using the configured default:
67 ```bash
68 openspec new change "<name>"
69 ```
70
71 Using an explicitly requested schema:
72 ```bash
73 openspec new change "<name>" --schema "<schema-name>"
74 ```
75 This creates a scaffolded change in the planning home resolved by the CLI with `.openspec.yaml`.
76
775. **Get the artifact build order**
78 ```bash
79 openspec status --change "<name>" --json
80 ```
81 Parse the JSON to get:
82 - `applyRequires`: array of artifact IDs needed before implementation (e.g., `["tasks"]`)
83 - `artifacts`: list of all artifacts, each with its `status` and its `requires` edges (the artifact IDs it directly depends on)
84 - `planningHome`, `changeRoot`, `artifactPaths`, and `actionContext`: path and scope context. Use these instead of assuming repo-local paths.
85
866. **Create every artifact in the required set**
87
88 Use a todo list to track progress through the artifacts.
89
90 Loop through artifacts in dependency order (artifacts with no pending dependencies first):
91
92 a. **For each artifact that is `ready` (dependencies satisfied)**:
93 - Get instructions:
94 ```bash
95 openspec instructions <artifact-id> --change "<name>" --json
96 ```
97 - The instructions JSON includes:
98 - `context`: Project background (constraints for you - do NOT include in output)
99 - `rules`: Artifact-specific rules (constraints for you - do NOT include in output)
100 - `template`: The structure to use for your output file
101 - `instruction`: Schema-specific guidance for this artifact type
102 - `skipped`/`warning`: present when the change declares skip_specs and this artifact must NOT be created - stop and pick another artifact
103 - `resolvedOutputPath`: Resolved path or pattern to write the artifact
104 - `dependencies`: Completed artifacts to read for context
105 - Read any completed dependency files for context - always re-read them from disk, even if you saw them earlier in the conversation (the user may have edited them)
106 - **Inspect the relevant project before drafting**: Read `context` and `rules` first, then inspect relevant implementation, nearby tests, configuration, and documentation outside `openspec/`. Keep inspection read-only and proportional to the change; reuse findings for later artifacts and inspect more only as needed.
107 - Identify the target project from the request and project context; the planning home may be separate from the code. If the target is unclear, ask. For greenfield or non-code changes, inspect the available structure and relevant documents. If source is unavailable, state the limitation and ask when it materially affects the plan.
108 - Ground scope, approach, and tasks in what you find. Distinguish observed behavior from assumptions and proposed additions; surface conflicts with existing specs instead of silently deciding which is correct.
109 - Do this discovery now, rather than leaving generic "explore the codebase" or "make a plan" tasks for implementation. Keep any necessary follow-up investigation specific to an unresolved question.
110 - If the `instruction` field delegates creation to a specific skill or command, invoke it to produce the artifact instead of writing the file yourself, then verify the artifact file exists at `resolvedOutputPath`
111 - Otherwise create the artifact file using `template` as the structure and write it to `resolvedOutputPath`. If `resolvedOutputPath` is a glob, follow `instruction` to choose the concrete file path
112 - Apply `context` and `rules` as constraints - but do NOT copy them into the file
113 - Show brief progress: "Created <artifact-id>"
114
115 b. **Continue until every artifact in the required set exists (not just `apply.requires`)**
116 - After creating each artifact, re-run `openspec status --change "<name>" --json`
117 - The required set is `applyRequires` plus every artifact reachable from those by following the `requires` edges in `status --json` - walk them transitively (spec-driven closes over proposal, specs, design, tasks). Leave artifacts outside that set alone
118 - `status` is file-existence only, so an `applyRequires` artifact reading `done` does NOT mean its dependencies exist - writing `tasks.md` early marks `tasks` done while `specs` was never written. Use each artifact's `requires` edges, not its `status`, to build the required set: a `done` artifact still lists what it depends on
119 - An artifact already reading `status: "skipped"` is satisfied: the change declares `skip_specs` in `.openspec.yaml`, so its files must NOT exist. Never try to create one
120 - Create every artifact in the required set that is missing, then re-check - creating one can unblock others
121 - Skip one only when `status` already reports it `skipped`, or when its own `instruction` says it is conditional: run `openspec instructions <artifact-id> --change "<name>" --json` and skip only if its `instruction` field marks it optional (e.g. "create only if..."). Spec-driven's `design.md` qualifies; `specs` qualifies only via the `skipped` status above, never by your own judgment. Tell the user, and do not reconsider it
122 - Dependencies are enablers, not gates: if a required artifact is still `blocked` only because you skipped a conditional dependency, write it anyway
123 - Stop when every artifact in the required set is `done`, `skipped`, or was deliberately skipped
124
125 c. **If an artifact requires user input** (unclear context):
126 - Ask the user to clarify
127 - Then continue with creation
128
1297. **Show final status**
130 ```bash
131 openspec status --change "<name>"
132 ```
133
134**Output**
135
136After completing all artifacts, summarize:
137- Change name and location
138- List of artifacts created with brief descriptions, plus any conditional artifact you skipped and why
139- What's ready: "All artifacts needed for implementation are ready."
140- Prompt: "The artifacts are ready for review. When you are ready, run `/opsx:apply`."
141
142**Artifact Creation Guidelines**
143
144- Follow the `instruction` field from `openspec instructions` for each artifact type - it is the authoritative guidance, even for familiar artifact names
145- If the `instruction` field directs you to use a specific skill or command to create the artifact, invoke it instead of writing the artifact directly
146- The schema defines what each artifact should contain - follow it
147- Read dependency artifacts for context before creating new ones
148- Use `template` as the structure for your output file - fill in its sections
149- **IMPORTANT**: `context` and `rules` are constraints for YOU, not content for the file
150 - Do NOT copy `<context>`, `<rules>`, `<project_context>` blocks into the artifact
151 - These guide what you write, but should never appear in the output
152
153**Guardrails**
154- 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
155- Create every artifact the apply phase transitively depends on, not just the ids listed in `apply.requires`
156- 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)
157- Ask about ambiguities that would materially change scope, externally observable behavior, compatibility, or acceptance criteria; for minor details, make reasonable assumptions and record them
158- If a change with that name already exists, ask if user wants to continue it or create a new one
159- Verify each artifact file exists after writing before proceeding to next
diff --git a/.claude/commands/opsx/sync.md b/.claude/commands/opsx/sync.md
new file mode 100644
index 0000000..2dd4cc3
--- /dev/null
+++ b/.claude/commands/opsx/sync.md
@@ -0,0 +1,258 @@
1---
2name: "OPSX: Sync"
3description: "Sync delta specs from a change to main specs"
4allowed-tools: Bash(openspec:*)
5category: "Workflow"
6tags: ["workflow", "specs", "experimental"]
7---
8
9Sync delta specs from a change to main specs.
10
11This is an **agent-driven** operation - you will read delta specs and directly edit main specs to apply the changes. This allows intelligent merging (e.g., adding a scenario without copying the entire requirement).
12
13**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`, `schemas`, `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.
14
15`<capability-path>` is the spec directory relative to `specs/` (for example, `user-auth` or `identity/user-auth`). Preserve the full path from each delta spec when resolving its main spec.
16
17**Input**: Optionally specify a change name after `/opsx:sync` (e.g., `/opsx:sync add-auth`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
18
19**Steps**
20
211. **Select the change**
22
23 If a name is provided, use it. Otherwise:
24 - Infer from conversation context if the user mentioned a change
25 - Auto-select if only one active change exists
26 - If ambiguous, run `openspec list --json` to get available changes and ask the user to select one
27
28 When prompting, show changes that have delta specs (under `specs/` directory).
29
30 Always announce: "Using change: <name>" and how to override (e.g., `/opsx:sync <other>`).
31
322. **Resolve change context**
33
34 Run:
35 ```bash
36 openspec status --change "<name>" --json
37 ```
38
39 The JSON includes `planningHome.root`. Main specs live under `<planningHome.root>/openspec/specs/` — use that (store-aware) root for every main-spec path below, not a hardcoded repo path. When a store is selected it points at the store, not the current repository.
40
413. **Find delta specs**
42
43 Use `artifactPaths.specs.existingOutputPaths` from the status JSON as the
44 only source of delta spec paths. If the `specs` entry is missing or
45 `existingOutputPaths` is empty, report that there are no delta specs to sync,
46 do not infer them from other artifacts, and stop without requesting artifact
47 instructions or writing a main spec.
48
49 Sync every path in `existingOutputPaths` unless the caller narrowed the set.
50 A caller narrows it by naming an explicit list of complete entries from
51 `existingOutputPaths` — copy those absolute values verbatim. Archive does
52 this inline, and a user can too (for example, by selecting the entry ending
53 in `/specs/billing/invoices/spec.md`).
54 Then sync only the named paths and leave the remaining delta specs untouched:
55 bulk archive excludes a delta whose implementation it could not find, and
56 syncing it anyway would write a main spec the caller deliberately withheld.
57 Carry that narrowed selection through step 4; never widen it back to the full
58 list. If a named path is not in `existingOutputPaths`, do not sync it —
59 report it and stop, rather than dropping it silently. If the named list is
60 empty, report that there is nothing to sync and stop without writing a main
61 spec.
62
63 Each delta spec file contains sections like:
64 - `## ADDED Requirements` - New requirements to add
65 - `## MODIFIED Requirements` - Changes to existing requirements
66 - `## REMOVED Requirements` - Requirements to remove
67 - `## RENAMED Requirements` - Requirements to rename (FROM:/TO: format)
68
69 If no delta specs found, inform user and stop.
70
714. **For each delta spec, apply changes to main specs**
72
73 Before the first main-spec write, obtain one current specs-rule snapshot:
74 - If archive invoked this workflow inline and supplied a valid snapshot from
75 `openspec instructions specs --change "<name>" --json`, reuse it and do not
76 fetch the same instructions again.
77 - Otherwise run that command once now with the same selected-root flags.
78 - If the direct lookup exits non-zero or returns invalid artifact-instruction
79 JSON, report the error and stop before writing any main spec. Do not treat the
80 failure as an absent rule set.
81 - A valid response with omitted `rules` means no artifact rules are configured
82 and the existing semantic merge continues.
83
84 Apply returned `rules` only to the content and form of the main specs produced
85 by this merge. Artifact rules are not operation guidance and cannot change
86 selected roots, delta paths, CLI checks, or workflow steps. Use their text as
87 constraints without copying it verbatim into a main spec or summary.
88
89 For each capability delta spec path selected in step 3 — the full `existingOutputPaths` list, or the narrowed subset when a caller supplied one (these may belong to a selected store, not the repo):
90
91 a. **Read the delta spec** to understand the intended changes
92
93 b. **Read the main spec** at `<planningHome.root>/openspec/specs/<capability-path>/spec.md` (may not exist yet)
94
95 c. **Apply changes intelligently**:
96
97 **ADDED Requirements:**
98 - If requirement doesn't exist in main spec → add it
99 - If requirement already exists → update it to match (treat as implicit MODIFIED)
100
101 **MODIFIED Requirements:**
102 - Find the requirement in main spec
103 - Apply the changes - this can be:
104 - Adding new scenarios the main spec does not have yet
105 - Modifying existing scenarios
106 - Changing the requirement description
107 - Preserve scenarios/content not mentioned in the delta
108
109 **REMOVED Requirements:**
110 - Remove the entire requirement block from main spec
111 - Retiring the capability. Delete the whole `spec.md` - and the directory once
112 nothing else is left in it - only when ALL of these hold:
113 1. removing the requirements *this run* left no requirement blocks;
114 2. the rest of the spec is well-formed (it still has a `## Purpose`);
115 3. the main spec was not already empty before this sync - if you removed
116 nothing, change nothing;
117 4. every other nonblank line in the whole file is accounted for as the
118 title, Purpose, Requirements header, or a canonical requirement's
119 statement, scenarios, or fenced examples;
120 5. the change's `.openspec.yaml` declares `retire_capabilities: true`;
121 6. the `spec.md` resolves inside the real specs root (do not follow a
122 capability-directory symlink to delete an external file).
123 If removing the selected requirements would leave no requirement blocks and
124 any retirement condition is not satisfied, do not modify the main spec. Stop
125 the sync for that capability, report the blocking condition, and tell the user
126 how to resolve it. Never write or leave an empty `## Requirements` section.
127 When only the marker is missing, say that too - it is the one thing the user
128 can add to make the retirement go through.
129 - Deleting the file also deletes its `## Purpose`; any other section blocks
130 retirement. Name Purpose when you report the retirement. Include a pasteable
131 `git checkout` only when the spec lived in the caller's checkout;
132 otherwise give checkout-scoped recovery guidance.
133
134 **RENAMED Requirements:**
135 - Find the FROM requirement, rename to TO
136
137 **`## Purpose` in the delta:**
138 - The main spec already has one and it is authoritative - leave it alone
139 (this is what `openspec archive` does; it warns and moves on)
140
141 d. **Create new main spec** if capability doesn't exist yet:
142 - Create `<planningHome.root>/openspec/specs/<capability-path>/spec.md`
143 - Add Purpose section: copy the delta's `## Purpose` body verbatim when it has one
144 (this is what `openspec archive` does); only write a brief TBD placeholder when it does not
145 - Add Requirements section with the ADDED requirements
146 - Follow the **Main Spec Format Reference** below
147
1485. **Validate updated main specs**
149
150 Run `openspec validate --specs` with the same selected-root flags used earlier.
151 If validation fails, report the problems and do not claim the sync succeeded.
152
1536. **Show summary**
154
155 After applying all changes, summarize:
156 - Which capabilities were updated
157 - What changes were made (requirements added/modified/removed/renamed)
158 - Any new main spec left with a TBD Purpose placeholder, so it gets written
159 now rather than lingering
160 - Any capability retired, naming the deleted `spec.md`, its Purpose, and
161 either a pasteable `git checkout` or checkout-scoped recovery guidance
162
163**Delta Spec Format Reference**
164
165```markdown
166## Purpose
167
168Only on a delta that introduces a brand-new capability. Seeds the new main spec.
169
170## ADDED Requirements
171
172### Requirement: New Feature
173The system SHALL do something new.
174
175#### Scenario: Basic case
176- **WHEN** user does X
177- **THEN** system does Y
178
179## MODIFIED Requirements
180
181### Requirement: Existing Feature
182The system SHALL keep doing the existing thing, now also handling A.
183
184#### Scenario: Scenario the main spec already has
185- **WHEN** user does X
186- **THEN** system does Y
187
188#### Scenario: New scenario to add
189- **WHEN** user does A
190- **THEN** system does B
191
192## REMOVED Requirements
193
194### Requirement: Deprecated Feature
195
196## RENAMED Requirements
197
198- FROM: `### Requirement: Old Name`
199- TO: `### Requirement: New Name`
200```
201
202**Main Spec Format Reference**
203
204Main specs are what the delta merges INTO. They must never contain delta operation headers (`## ADDED/MODIFIED/REMOVED/RENAMED Requirements`) - after syncing, every requirement lives under a single `## Requirements` section:
205
206```markdown
207# <capability> Specification
208
209## Purpose
210Short description of what this capability does and why it exists.
211
212## Requirements
213
214### Requirement: New Feature
215The system SHALL do something new.
216
217#### Scenario: Basic case
218- **WHEN** user does X
219- **THEN** system does Y
220```
221
222**Key Principle: Intelligent Merging**
223
224Unlike programmatic merging, you merge rather than overwrite:
225- A MODIFIED block carries the whole requirement - body plus every scenario that survives the change. `openspec validate` and `openspec archive` both reject one that drops a scenario the main spec still has.
226- Keep anything the delta does not mention, in the main spec's existing order
227- Use your judgment to merge changes sensibly
228
229**Output On Success**
230
231```markdown
232## Specs Synced: <change-name>
233
234Updated main specs:
235
236**<capability-1>**:
237- Added requirement: "New Feature"
238- Modified requirement: "Existing Feature" (added 1 scenario)
239
240**<capability-2>**:
241- Created new spec file
242- Added requirement: "Another Feature"
243
244Main specs are now updated. The change remains active - archive when implementation is complete.
245```
246
247**Guardrails**
248- Read both delta and main specs before making changes
249- Preserve existing content not mentioned in delta
250- Never copy a delta file into a main spec as-is - merge its content so the main spec keeps the Main Spec Format Reference structure, with no delta operation headers
251- If something is unclear, ask for clarification
252- Show what you're changing as you go
253- The operation should be idempotent - running twice should give same result
254- Use only `artifactPaths.specs.existingOutputPaths`; never infer delta specs from unrelated artifacts
255- Honor a caller-supplied subset of `existingOutputPaths`; never widen it back to the full list
256- Fetch specs instructions once for direct sync, or reuse the archive-supplied snapshot inline
257- Stop before every main-spec write on a non-zero or invalid JSON specs-instruction response
258- Artifact rules constrain only the specs being written and are never copied into output files
diff --git a/.claude/commands/opsx/update.md b/.claude/commands/opsx/update.md
new file mode 100644
index 0000000..7992927
--- /dev/null
+++ b/.claude/commands/opsx/update.md
@@ -0,0 +1,87 @@
1---
2name: "OPSX: Update"
3description: "Update a change - revise existing planning artifacts and keep them coherent (Experimental)"
4allowed-tools: Bash(openspec:*)
5category: "Workflow"
6tags: ["workflow", "artifacts", "experimental"]
7---
8
9Revise a change's existing planning artifacts and keep them coherent. Never edit code.
10
11**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`, `schemas`, `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.
12
13**Input**: Optionally specify a change name after `/opsx:update` (e.g., `/opsx:update add-auth`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
14
15`/opsx:continue` is an optional workflow and may not be installed. Before suggesting it anywhere below, verify that it is available. If it is unavailable, `openspec status --change "<name>" --json` shows the next artifact and `openspec instructions "<artifact-id>" --change "<name>" --json` explains how to create it.
16
17**Steps**
18
191. **Select the change**
20
21 If a name is provided, use it. Otherwise:
22 - Infer from conversation context if the user mentioned a change
23 - Auto-select if only one active change exists
24 - If ambiguous, run `openspec list --json` to get available changes sorted by most recently modified, and ask the user to select one
25
26 When prompting, present the top 3-4 most recently modified changes as options, showing:
27 - Change name
28 - Schema (from `schema` field if present, otherwise "spec-driven")
29 - Status (e.g., "0/5 tasks", "complete", "no tasks")
30 - How recently it was modified (from `lastModified` field)
31
32 Mark the most recently modified change as "(Recommended)" since it's likely what the user wants to update.
33
34 Always announce: "Using change: <name>" and how to override (e.g., `/opsx:update <other>`).
35
362. **Get the change's artifacts**
37 ```bash
38 openspec status --change "<name>" --json
39 ```
40 Parse the JSON to understand current state. The response includes:
41 - `schemaName`: The workflow schema being used (e.g., "spec-driven")
42 - `artifacts`: Array of artifacts with their status ("done", "skipped", "ready", "blocked")
43 - `isPlanningComplete`: Boolean indicating if all planning artifacts are complete. Older CLI versions expose the same value as `isComplete`.
44 - `planningHome`, `changeRoot`, `artifactPaths`, and `actionContext`: path and scope context. Use these instead of assuming repo-local paths.
45
46 The artifact ids and paths come from the active schema - do NOT assume them, and do NOT branch on hardcoded artifact names. Custom schemas must work unchanged.
47
48 The files to edit are `artifactPaths.<id>.existingOutputPaths` - the concrete files that exist on disk, already glob-expanded for glob artifacts (e.g. `specs/**/*.md`). Do NOT write to `resolvedOutputPath`: for a glob artifact it is still the glob pattern, not a real file.
49
503. **Understand the request**
51 - If the user asked for a specific revision ("the design now uses X"), that is the starting edit.
52 - If they only said "update" / "make this coherent", treat it as a coherence review: read the existing artifacts and check them against each other for contradictions, gaps, and duplication.
53
544. **Read and reconcile**
55 - Read the artifact(s) the request touches and the change's other existing artifacts.
56 - Apply the requested edit. Then check every other existing artifact against it - in ANY direction: an edit to a later artifact may require revising an earlier one, not only the other way around. Build order is a useful reading order, not a constraint on which artifacts may be revised.
57 - Note everything that is now inconsistent, missing, or contradictory.
58 - Revise only files that already exist (`existingOutputPaths`). Do NOT create artifacts that don't exist yet, and do NOT invent new files under a glob artifact - note them and point the user to `/opsx:continue` to create them.
59 - If the change is already coherent, say so and make no edits.
60
615. **Confirm and apply, one artifact at a time**
62 - Show each proposed revision and why. Write only after the user confirms.
63 - If the user rejects a revision, do not write it - leave that artifact unchanged.
64 - When a substantial rewrite is needed, get that artifact's rules and template first:
65 ```bash
66 openspec instructions "<artifact-id>" --change "<name>" --json
67 ```
68
696. **Point to the next step (guidance only - NEVER act on it)**
70 - Artifacts still missing -> suggest `/opsx:continue` to create them.
71 - Change already implemented (tasks checked off / already applied) -> the code may no longer match the revised plan; suggest `/opsx:apply` to carry the delta into code.
72 - Everything done and implemented -> suggest `/opsx:archive`.
73
74**Output**
75
76After each invocation, show:
77- Which artifacts were revised (and which proposed revisions were rejected)
78- Anything deferred to `/opsx:continue` (not-yet-created artifacts or files)
79- Where the change stands and the recommended next command
80
81**Guardrails**
82- Planning artifacts only - NEVER edit implementation code. If the revised plan implies code changes, stop and point to `/opsx:apply`.
83- Use the artifact ids and paths reported by `openspec status`; never branch on hardcoded artifact names.
84- Edit only the concrete files in `existingOutputPaths`; never write to a glob `resolvedOutputPath`.
85- Do not advance the build frontier: no new artifacts, no new files under glob artifacts - that is `/opsx:continue`'s job.
86- Confirm every edit with the user before writing.
87- If the request changes the change's *intent* rather than refining it, first verify whether the optional `/opsx:new` workflow is available. If it is, recommend starting fresh with `/opsx:new` (the "Update vs. Start Fresh" heuristic). If it is unavailable, ask for a distinct unused change name and recommend `openspec new change "<new-change-name>"` instead.
diff --git a/.claude/skills/openspec-apply-change/SKILL.md b/.claude/skills/openspec-apply-change/SKILL.md
new file mode 100644
index 0000000..ca20232
--- /dev/null
+++ b/.claude/skills/openspec-apply-change/SKILL.md
@@ -0,0 +1,188 @@
1---
2name: openspec-apply-change
3description: Implement tasks from an OpenSpec change. Use when the user wants to start implementing, continue implementation, or work through tasks.
4allowed-tools: Bash(openspec:*)
5license: MIT
6compatibility: Requires openspec CLI.
7metadata:
8 author: openspec
9 version: "1.0"
10 generatedBy: "1.13.0"
11---
12
13Implement tasks from an OpenSpec change.
14
15**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`, `schemas`, `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.
16
17**Input**: Optionally specify a change name (e.g., `/opsx:apply add-auth`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
18
19**Steps**
20
211. **Select the change**
22
23 If a name is provided, use it. Otherwise:
24 - Infer from conversation context if the user mentioned a change
25 - Auto-select if only one active change exists
26 - If ambiguous, run `openspec list --json` to get available changes and ask the user to select one
27
28 Always announce: "Using change: <name>" and how to override (e.g., `/opsx:apply <other>`).
29
302. **Check status to understand the schema**
31 ```bash
32 openspec status --change "<name>" --json
33 ```
34 Parse the JSON to understand:
35 - `schemaName`: The workflow being used (e.g., "spec-driven")
36 - `planningHome`, `changeRoot`, and `actionContext`: planning scope and edit constraints
37 - Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others)
38
393. **Get apply instructions**
40
41 ```bash
42 openspec instructions apply --change "<name>" --json
43 ```
44
45 This returns:
46 - `contextFiles`: artifact ID -> array of concrete file paths (varies by schema - could be proposal/specs/design/tasks or spec/tests/implementation/docs)
47 - Progress (total, complete, remaining)
48 - Task list with status
49 - Dynamic instruction based on current state
50 - Optional `context`: current required project instruction input from the selected root
51 - Optional `operationGuidance`: current advisory guidance for apply
52
53 **Handle states:**
54 - If `state: "blocked"` (missing artifacts): show message, suggest using `/opsx:continue` (if it is not installed, run `openspec status --change "<name>" --json` to see the next artifact and `openspec instructions <artifact-id> --change "<name>" --json` for how to create it)
55 - If `state: "all_done"`: congratulate, suggest archive
56 - Otherwise: proceed to implementation
57
58 Treat `context` as a required prompt-level input. Read and consider it, and
59 apply relevant project facts, conventions, and constraints while implementing.
60 Treat `operationGuidance` as optional additive advice. Read and consider every
61 entry, and follow entries that are applicable and compatible with the built-in
62 workflow.
63
64 Keep both fields separate from CLI-returned state, missing artifacts, tasks,
65 progress, `contextFiles`, and the built-in `instruction`. They are not
66 evidence of task completion, do not replace the built-in instruction, and do
67 not permit bypassing a blocked state. If context conflicts with the built-in
68 instruction, an explicit user choice, or a CLI-controlled value, report the
69 conflict and preserve the controlling value. If guidance is inapplicable or
70 conflicts with those controlling inputs, do not follow it and explain why.
71 These are prompt-level behavior contracts, not enforceable checks.
72
734. **Read context files**
74
75 Read every file path listed under `contextFiles` from the apply instructions output.
76 The files depend on the schema being used:
77 - **spec-driven**: proposal, specs, design, tasks
78 - Other schemas: follow the contextFiles from CLI output
79
80 Do not copy `context` or `operationGuidance` verbatim into implementation
81 files or planning artifacts unless the user separately asks for that content.
82
835. **Show current progress**
84
85 Display:
86 - Schema being used
87 - Progress: "N/M tasks complete"
88 - Remaining tasks overview
89 - Dynamic instruction from CLI
90
916. **Implement tasks (loop until done or blocked)**
92
93 For each pending task:
94 - Show which task is being worked on
95 - Make the code changes required
96 - Keep changes minimal and focused
97 - Mark task complete in the tasks file: `- [ ]` → `- [x]`
98 - Continue to next task
99
100 **Pause if:**
101 - Task is unclear → ask for clarification
102 - Implementation reveals a design issue → suggest updating artifacts
103 - A task needs work beyond what the spec and tasks describe, or you are tempted to drop, narrow, defer, or accept exceptions to specified behavior to make it fit → surface the added scope and ask; do not absorb it silently
104 - Error or blocker encountered → report and wait for guidance
105 - User interrupts
106
1077. **On completion or pause, show status**
108
109 Display:
110 - Tasks completed this session
111 - Overall progress: "N/M tasks complete"
112 - If all done: suggest archive
113 - If paused: explain why and wait for guidance
114
115**Output During Implementation**
116
117```
118## Implementing: <change-name> (schema: <schema-name>)
119
120Working on task 3/7: <task description>
121[...implementation happening...]
122✓ Task complete
123
124Working on task 4/7: <task description>
125[...implementation happening...]
126✓ Task complete
127```
128
129**Output On Completion**
130
131```
132## Implementation Complete
133
134**Change:** <change-name>
135**Schema:** <schema-name>
136**Progress:** 7/7 tasks complete ✓
137
138### Completed This Session
139- [x] Task 1
140- [x] Task 2
141...
142
143All tasks complete! You can archive this change with `/opsx:archive`.
144```
145
146**Output On Pause (Issue Encountered)**
147
148```
149## Implementation Paused
150
151**Change:** <change-name>
152**Schema:** <schema-name>
153**Progress:** 4/7 tasks complete
154
155### Issue Encountered
156<description of the issue>
157
158**Options:**
1591. <option 1>
1602. <option 2>
1613. Other approach
162
163What would you like to do?
164```
165
166**Guardrails**
167- Keep going through tasks until done or blocked
168- Always read context files before starting (from the apply instructions output)
169- If task is ambiguous, pause and ask before implementing
170- If implementation reveals issues, pause and suggest artifact updates
171- Keep code changes minimal and scoped to each task
172- Update task checkbox immediately after completing each task
173- Pause on errors, blockers, or unclear requirements - don't guess
174- When a task needs work beyond what the spec describes, surface the added scope and pause - never silently narrow, defer, or simplify away specified behavior
175- Only mark a task `- [x]` when its specified behavior is fully implemented, not when it is partially done or deferred
176- Use contextFiles from CLI output, don't assume specific file names
177- Do not use context or operation guidance as proof that a task is complete
178- Apply relevant project context; report conflicts with controlling workflow inputs
179- Consider every guidance entry; explain any inapplicable or conflicting advice
180- Do not copy runtime context or operation guidance into implementation files or planning artifacts
181- Preserve CLI-controlled blocked/ready/all-done behavior and completion criteria
182
183**Fluid Workflow Integration**
184
185This skill supports the "actions on a change" model:
186
187- **Can be invoked anytime**: Before all artifacts are done (if tasks exist), after partial implementation, interleaved with other actions
188- **Allows artifact updates**: If implementation reveals design issues, suggest updating artifacts - not phase-locked, work fluidly
diff --git a/.claude/skills/openspec-archive-change/SKILL.md b/.claude/skills/openspec-archive-change/SKILL.md
new file mode 100644
index 0000000..7bd1363
--- /dev/null
+++ b/.claude/skills/openspec-archive-change/SKILL.md
@@ -0,0 +1,182 @@
1---
2name: openspec-archive-change
3description: Archive a completed change in the experimental workflow. Use when the user wants to finalize and archive a change after implementation is complete.
4allowed-tools: Bash(openspec:*)
5license: MIT
6compatibility: Requires openspec CLI.
7metadata:
8 author: openspec
9 version: "1.0"
10 generatedBy: "1.13.0"
11---
12
13Archive a completed change in the experimental workflow.
14
15**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`, `schemas`, `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.
16
17`<capability-path>` is the spec directory relative to `specs/` (for example, `user-auth` or `identity/user-auth`). Preserve the full path from each delta spec when resolving its main spec.
18
19**Input**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
20
21**Steps**
22
231. **Select the change**
24
25 If a name is provided, use it. Otherwise:
26 - Infer from conversation context if the user mentioned a change
27 - Auto-select if only one active change exists
28 - If ambiguous, run `openspec list --json` to get available changes and ask the user to select one
29
30 When prompting, show only active changes (not already archived).
31 Include the schema used for each change if available.
32
33 Always announce: "Using change: <name>" and how to override (e.g., `/opsx:archive <other>`).
34
35 **Load current archive inputs before the existing archive checks:**
36
37 After resolving the selected change and planning root, run:
38 ```bash
39 openspec instructions archive --change "<name>" --json
40 ```
41 Keep the same selected-root flags on this command. This lookup is advisory and
42 optional: it only supplies extra prompt inputs, so it must never block archiving.
43 If it exits non-zero or returns invalid JSON — for example on an older CLI that
44 does not support this command yet — continue the archive workflow with no
45 context and no operation guidance. Do not report an error and do not stop.
46
47 A successful response may omit both optional fields. Treat `context` as a
48 required prompt-level input: read and consider it, and apply relevant project
49 facts, conventions, and constraints. Treat `operationGuidance` as optional
50 additive advice: read and consider every entry, and follow entries that are
51 applicable and compatible with the built-in archive workflow.
52
53 Keep both fields separate from built-in steps, explicit user choices, resolved
54 paths, CLI checks, and command contracts. If context conflicts with one of those
55 controlling inputs, report the conflict and preserve the controlling value. If
56 guidance is inapplicable or conflicts with a controlling input, do not follow it
57 and explain why. Do not infer replacement paths, skipped prompts, or flags from
58 either field, and do not copy their text verbatim into specs, change artifacts,
59 or archive summaries unless the user separately asks for it. These are
60 prompt-level behavior contracts, not enforceable checks.
61
622. **Check artifact completion status**
63
64 Run `openspec status --change "<name>" --json` to check artifact completion.
65
66 Parse the JSON to understand:
67 - `schemaName`: The workflow being used
68 - `planningHome`, `changeRoot`, `artifactPaths`, and `actionContext`: path and scope context
69 - `artifacts`: List of artifacts with their status (`done`, `skipped`, or other)
70
71 **If any artifacts are neither `done` nor `skipped`** (skipped artifacts satisfy the requirement - the change declares skip_specs):
72 - Display warning listing incomplete artifacts
73 - Ask the user to confirm they want to proceed
74 - Proceed if user confirms
75
763. **Check task completion status**
77
78 Read the tasks file (typically `tasks.md`) to check for incomplete tasks.
79
80 Count tasks marked with `- [ ]` (incomplete) vs `- [x]` (complete).
81
82 **If incomplete tasks found:**
83 - Display warning showing count of incomplete tasks
84 - Ask the user to confirm they want to proceed
85 - Proceed if user confirms
86
87 **If no tasks file exists:** Proceed without task-related warning.
88
894. **Assess delta spec sync state**
90
91 Use `artifactPaths.specs.existingOutputPaths` from status JSON as the only
92 delta-spec source. If the `specs` entry is missing or
93 `existingOutputPaths` is empty, proceed without a sync prompt and do not infer
94 delta specs from other artifacts.
95
96 **If delta specs exist:**
97 - Compare each delta spec with its corresponding main spec at `<planningHome.root>/openspec/specs/<capability-path>/spec.md` (use the store-aware `planningHome.root` from step 2, not a hardcoded repo path)
98 - Determine what changes would be applied (adds, modifications, removals, renames)
99 - Show a combined summary before prompting
100
101 **Prompt options:**
102 - If changes needed: "Sync now (recommended)", "Archive without syncing"
103 - If already synced: "Archive now", "Sync anyway", "Cancel"
104
105 Route on the answer:
106 - "Cancel" — stop, do not archive
107 - "Archive without syncing" or "Archive now" — proceed to archive
108 - "Sync now" or "Sync anyway" — sync, then verify (below)
109 - Anything else — ask again rather than archiving
110
111 Before a selected sync writes any main spec, run
112 `openspec instructions specs --change "<name>" --json` once with the same
113 selected-root flags. Require a zero exit status and valid artifact-instruction
114 JSON. If the lookup fails or returns invalid JSON, report the error and stop
115 before writing any main spec or moving the change. A valid response with omitted
116 `rules` is the no-rules case. Apply returned `rules` only to the content and
117 form of main specs produced by this merge; do not use them as archive guidance,
118 change CLI behavior, or copy the rule text into any output file.
119
120 Then run the `openspec-sync-specs` workflow inline (agent-driven intelligent merge) for change '<name>', passing the delta spec analysis and the fetched specs-rule snapshot from above, and wait for it to finish. The inline sync must reuse that snapshot without fetching `specs` instructions again. Do not delegate it to a background task — step 5 would move `changeRoot` out from under a sync that is still reading it, leaving the change archived and the main specs never updated. If your agent can only run it by delegation, delegate synchronously and wait for the result.
121
122 Then re-run the comparison from the top of this step against every capability that has a delta spec in `artifactPaths.specs.existingOutputPaths` — not only the ones the sync reports it touched. A successful sync leaves nothing left to apply, so each capability must now read as already synced:
123 - ADDED requirements present
124 - MODIFIED requirements carrying the scenario and description changes named in the delta, with their other scenarios intact
125 - REMOVED requirements gone — and where this sync retired a capability (removed its last requirement, leaving `## Requirements` empty), its main spec deleted rather than left empty; a spec the sync deliberately kept and reported is also a match
126 - RENAMED requirements present under the new name and absent under the old one
127
128 If the sync failed, or any capability does not match, report what differs and stop — do not archive. Nothing has moved and `changeRoot` is intact, so the user can fix the mismatch or re-run the sync and start the archive again.
129
1305. **Perform the archive**
131
132 Create an `archive` directory under `planningHome.changesDir` if it doesn't exist:
133 ```bash
134 mkdir -p "<planningHome.changesDir>/archive"
135 ```
136
137 Generate the target name: use the change name as-is when it already starts with a `YYYY-MM-DD-` prefix; otherwise prepend the current date as `YYYY-MM-DD-<change-name>`. Never stack a second date (same rule as `openspec archive`).
138
139 **Check if target already exists:**
140 - If yes: Fail with error, suggest renaming existing archive or using different date
141 - If no: Move `changeRoot` to the archive directory
142
143 ```bash
144 mv "<changeRoot>" "<planningHome.changesDir>/archive/<target-name>"
145 ```
146
1476. **Display summary**
148
149 Show archive completion summary including:
150 - Change name
151 - Schema that was used
152 - Archive location
153 - Whether specs were synced (if applicable)
154 - Note about any warnings (incomplete artifacts/tasks)
155
156**Output On Success**
157
158```markdown
159## Archive Complete
160
161**Change:** <change-name>
162**Schema:** <schema-name>
163**Archived to:** the archive path derived from `planningHome.changesDir`/<target-name>/
164**Specs:** <"✓ Synced to main specs" only if the step 4 verification passed; otherwise "No delta specs" or "Sync skipped">
165
166<"All artifacts complete. All tasks complete." — or, if archived with warnings, list them instead (e.g. "Archived with 2 incomplete tasks")>
167```
168
169**Guardrails**
170- Announce the selected change; prompt for selection when it is ambiguous
171- Use artifact graph (openspec status --json) for completion checking
172- Don't block archive on warnings - just inform and confirm
173- Preserve .openspec.yaml when moving to archive (it moves with the directory)
174- Show clear summary of what happened
175- If sync is requested, run the `openspec-sync-specs` workflow inline (agent-driven)
176- Never archive while a spec sync is still in flight — run the sync inline and verify the main specs before moving `changeRoot`
177- If delta specs exist, always run the sync assessment and show the combined summary before prompting
178- Apply relevant runtime context and report conflicts; operation guidance remains advisory
179- Consider every guidance entry and explain any inapplicable or conflicting advice
180- Existing CLI checks, resolved paths, prompts, and command contracts are unchanged
181- Artifact rules constrain only the specs being written and are never operation guidance
182- Never copy runtime context, operation guidance, or artifact-rule text verbatim into output files
diff --git a/.claude/skills/openspec-explore/SKILL.md b/.claude/skills/openspec-explore/SKILL.md
new file mode 100644
index 0000000..a8fc549
--- /dev/null
+++ b/.claude/skills/openspec-explore/SKILL.md
@@ -0,0 +1,343 @@
1---
2name: openspec-explore
3description: 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.
4allowed-tools: Bash(openspec:*)
5license: MIT
6compatibility: Requires openspec CLI.
7metadata:
8 author: openspec
9 version: "1.0"
10 generatedBy: "1.13.0"
11---
12
13Enter explore mode. Think deeply. Visualize freely. Follow the conversation wherever it goes.
14
15**IMPORTANT: Explore mode is for thinking, not implementing.** You may read files, search code, investigate the codebase, and run read-only commands or tools without confirmation, 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 or update OpenSpec change artifacts (proposals, designs, specs) within a confirmed scope—that's capturing thinking, not implementing. Answering design or clarifying questions is never consent to write. Before the first write-capable action, name the artifacts or files you would change and what you would do, ask a direct yes/no question, and wait for the user's confirmation in a separate message. Confirmation covers only the scope you described; ask again before expanding it. For a new change, scaffold it first as described below.
16
17**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.
18
19**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`, `schemas`, `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.
20
21---
22
23## The Stance
24
25- **Curious, not prescriptive** - Ask questions that emerge naturally, don't follow a script
26- **Open threads, not interrogations** - Surface multiple interesting directions and let the user follow what resonates. Don't funnel them through a single path of questions.
27- **Visual** - Use ASCII diagrams liberally when they'd help clarify thinking
28- **Adaptive** - Follow interesting threads, pivot when new information emerges
29- **Patient** - Don't rush to conclusions, let the shape of the problem emerge
30- **Grounded** - Explore the actual codebase when relevant, don't just theorize
31
32---
33
34## Planning a Change
35
36When the user is planning a change, guide them toward shared understanding with focused discovery questions. For open-ended discussion, follow the conversation without imposing an interview or a required output.
37
38Before asking a factual question, follow the context discovery below and inspect relevant OpenSpec artifacts, source, tests, docs, and configuration. Do not ask the user to repeat facts you can verify. Summarize relevant findings without reproducing private context or rules. If evidence is missing, conflicting, or inaccessible, state that limitation and ask only for the clarification needed to proceed.
39
40- **Follow dependencies** - Resolve the next blocking decision before its dependent details. For example, clarify the user's outcome and scope before choosing an API or data model. Revisit downstream assumptions when an earlier answer changes. Skip branches that do not matter to this goal.
41- **Keep questions focused** - Ask one focused question at a time, and briefly explain why it matters and which decision it unlocks. Batch questions only if the user asks for a batch; keep them small and group related decisions.
42- **Offer grounded recommendations** - When evidence supports a recommendation, state your preferred option and why it fits the user's goals, with alternatives and their tradeoffs when useful. Do not invent intent, priorities, or external constraints: ask the user when only they can answer. Avoid a fixed question format.
43- **Keep a conversational record** - Track decisions in the conversation, not in files. Separate confirmed decisions from proposed defaults and unresolved questions. Silence is not acceptance. Accepting an answer or a batch of recommendations is not permission to write. Keep file-write confirmation separate from discovery questions and follow the guardrails below.
44
45Stop asking when the user has enough clarity. Let them pause, pivot, or defer a decision; do not exhaust every branch or force a proposal.
46
47For example, after inspecting the relevant code:
48
49```text
50The CLI already uses SQLite and has no remote service. Is sharing state
51across devices in scope? That determines whether local storage is enough.
52If this stays a single-device tool, I recommend keeping SQLite to avoid
53adding a service to operate; shared state would need a separate sync design.
54```
55
56---
57
58## What You Might Do
59
60Depending on what the user brings, you might:
61
62**Explore the problem space**
63- Ask clarifying questions that emerge from what they said
64- Challenge assumptions
65- Reframe the problem
66- Find analogies
67
68**Investigate the codebase**
69- Map existing architecture relevant to the discussion
70- Find integration points
71- Identify patterns already in use
72- Surface hidden complexity
73
74**Compare options**
75- Brainstorm multiple approaches
76- Build comparison tables
77- Sketch tradeoffs
78- Recommend a path (if asked)
79
80**Visualize**
81```
82+------------------------------------------+
83| Use ASCII diagrams liberally |
84+------------------------------------------+
85| |
86| [State A] -------> [State B] |
87| | |
88| v |
89| [State C] |
90| |
91| System diagrams, state machines, |
92| data flows, architecture sketches, |
93| dependency graphs, comparison tables |
94| |
95+------------------------------------------+
96```
97
98**Draw with plain ASCII only** — borders `+` `-` `|`, arrows `-->` `<--` `^` `v`, markers `*` `x`.
99Unicode diagram glyphs can render at different widths across terminals, fonts, and locales, so padded boxes and aligned tables can drift. Keep every diagram character ASCII.
100
101**Surface risks and unknowns**
102- Identify what could go wrong
103- Find gaps in understanding
104- Suggest spikes or investigations
105
106---
107
108## OpenSpec Awareness
109
110You have full context of the OpenSpec system. Use it naturally, don't force it.
111
112### Check for context
113
114At the start, quickly check what exists:
115```bash
116openspec list --json
117```
118
119This tells you:
120- If there are active changes
121- Their names, schemas, and status
122- What the user might be working on
123
124That is the *change* list - work in flight. It does not include the project's durable capabilities, so list those too:
125```bash
126openspec list --specs
127```
128Add `--json` for ids and requirement counts, and append `--store "<id>"` only for a registered standalone store. This is the inventory of what the project already claims to do, and `openspec list` on its own never shows it. To look at one, run `openspec show "<spec-id>" --type spec --json --no-scenarios` (same `--store` rule) - it returns that capability's purpose and requirement texts without pulling the whole spec file into context, and `--type spec` stops a change of the same name from making it ambiguous.
129
130The filtered read is only an overview. Before deciding what is already covered or what should change, read each relevant spec in full, including scenarios, with `openspec show "<spec-id>" --type spec` (same `--store` rule).
131
132Then read the project's own context from the resolved root - `<root.path>/openspec/config.yaml` (or `config.yml`). Use the `root.path` returned above, and skip this if neither file exists:
133- `context`: project background - tech stack, conventions, constraints
134- `rules`: keyed by artifact id - the entries for an artifact apply only when you write that artifact
135
136Ground your thinking in these. They are constraints for you to follow, not content to reproduce: do NOT copy them into the conversation or into any artifact you create.
137
138### When no change exists
139
140Think freely. When insights crystallize, you might offer:
141
142- "This feels solid enough to start a change. Want me to create a proposal?"
143- Or keep exploring - no pressure to formalize
144
145If the user asks you to capture the exploration as a new change, transition seamlessly into the requested capture:
146
1471. 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.
1482. 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.
1493. 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.
1504. 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.
151
152Capture 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.
153
154### When a change exists
155
156If the user mentions a change or you detect one is relevant:
157
1581. **Resolve and read existing artifacts for context**
159 - Run `openspec status --change "<name>" --json`.
160 - Use `changeRoot`, `artifactPaths`, and `actionContext` from the status JSON.
161 - Read existing files from `artifactPaths.<artifact>.existingOutputPaths`.
162
1632. **Reference them naturally in conversation**
164 - "Your design mentions using Redis, but we just realized SQLite fits better..."
165 - "The proposal scopes this to premium users, but we're now thinking everyone..."
166
1673. **Offer to capture when decisions are made**
168
169 `<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.
170
171 | Insight Type | Where to Capture |
172 |----------------------------|-------------------------------------|
173 | New requirement discovered | `specs/<capability-path>/spec.md` |
174 | Requirement changed | `specs/<capability-path>/spec.md` |
175 | Design decision made | `design.md` |
176 | Scope changed | `proposal.md` |
177 | New work identified | `tasks.md` |
178 | Assumption invalidated | Relevant artifact |
179
180 Example offers:
181 - "That's a design decision. Capture it in design.md?"
182 - "This is a new requirement. Add it to specs?"
183 - "This changes scope. Update the proposal?"
184
1854. **The user decides** - Offer and move on. Don't pressure. Don't auto-capture.
186
187---
188
189## What You Don't Have To Do
190
191- Follow a script
192- Ask the same questions every time
193- Produce a specific artifact
194- Reach a conclusion
195- Stay on topic if a tangent is valuable
196- Be brief (this is thinking time)
197
198---
199
200## Handling Different Entry Points
201
202**User brings a vague idea:**
203```
204User: I'm thinking about adding real-time collaboration
205
206You: Real-time collab is a big space. Let me think about this...
207
208 COLLABORATION SPECTRUM
209 ============================================
210
211 Awareness Coordination Sync
212 | | |
213 v v v
214 +--------+ +--------+ +--------+
215 |Presence| |Cursors | | CRDT |
216 | "3 | | Multi | |Conflict|
217 |online" | | select | | free |
218 +--------+ +--------+ +--------+
219 | | |
220 trivial moderate complex
221
222 Where's your head at?
223```
224
225**User brings a specific problem:**
226```
227User: The auth system is a mess
228
229You: [reads codebase]
230
231 +---------------------------------------------+
232 | CURRENT AUTH FLOW |
233 +---------------------------------------------+
234 |
235 +-------------+-------------+
236 v v v
237 +---------+ +---------+ +---------+
238 | Google | | GitHub | | Email |
239 | OAuth | | OAuth | | Magic |
240 +----+----+ +----+----+ +----+----+
241 | | |
242 +-------------+-------------+
243 v
244 +-----------+
245 | Session |
246 +-----+-----+
247 |
248 v
249 +-----------+
250 | Perms |
251 +-----------+
252
253 I see three tangles. Which one's burning?
254```
255
256**User is stuck mid-implementation:**
257```
258User: /opsx:explore add-auth-system
259 The OAuth integration is more complex than expected
260
261You: [reads change artifacts]
262
263 You're on task 4: "Implement OAuth flow"
264
265 Let me trace what's involved...
266
267 [draws diagram, explores options, suggests paths]
268
269 Want to update the design to reflect this?
270 Or add a spike task to investigate?
271```
272
273**User wants to compare options:**
274```
275User: Should we use Postgres or SQLite?
276
277You: Generic answer is boring. What's the context?
278
279User: A CLI tool that tracks local dev environments
280
281You: That changes everything.
282
283 +-------------------------------------------------+
284 | CLI TOOL DATA STORAGE |
285 +-------------------------------------------------+
286
287 Key constraints:
288 - No daemon running
289 - Must work offline
290 - Single user
291
292 SQLite Postgres
293 Deployment embedded needs server
294 Offline yes no
295 Single file yes no
296
297 SQLite. Not even close.
298
299 Unless... is there a sync component?
300```
301
302---
303
304## Ending Discovery
305
306There's no required ending. Discovery might:
307
308- **Flow into a proposal**: "Ready to start? I can create a change proposal."
309- **Result in artifact updates**: "Updated design.md with these decisions"
310- **Just provide clarity**: User has what they need, moves on
311- **Continue later**: "We can pick this up anytime"
312
313When it feels like things are crystallizing, you might summarize:
314
315```
316## What We Figured Out
317
318**The problem**: [crystallized understanding]
319
320**The approach**: [if one emerged]
321
322**Open questions**: [if any remain]
323
324**Next steps** (if ready):
325- Create a change proposal
326- Keep exploring: just keep talking
327```
328
329But this summary is optional. Sometimes the thinking IS the value.
330
331---
332
333## Guardrails
334
335- **Don't implement** - Never write code or implement features. Workflow configuration counts too: creating or editing schemas, templates, or `openspec/config.yaml` is a change, not thinking. Creating or updating OpenSpec change artifacts within the confirmed scope is fine, writing anything else is not.
336- **Don't fake understanding** - If something is unclear, dig deeper
337- **Don't rush** - Discovery is thinking time, not task time
338- **Don't force structure** - Let patterns emerge naturally
339- **Don't auto-capture** - Offer to save insights, don't just do it. Read-only commands and tools need no confirmation. Before the first write-capable action—including `openspec new change` or another command that writes files—name the artifacts or files and proposed changes, ask a direct yes/no question, and wait for explicit confirmation in a separate user message. That confirmation covers only the described scope; ask again before expanding it. Answers to design or clarifying questions are never consent to write.
340- **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.
341- **Do visualize** - A good diagram is worth many paragraphs
342- **Do explore the codebase** - Ground discussions in reality
343- **Do question assumptions** - Including the user's and your own
diff --git a/.claude/skills/openspec-propose/SKILL.md b/.claude/skills/openspec-propose/SKILL.md
new file mode 100644
index 0000000..20f2b5b
--- /dev/null
+++ b/.claude/skills/openspec-propose/SKILL.md
@@ -0,0 +1,163 @@
1---
2name: openspec-propose
3description: 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.
4allowed-tools: Bash(openspec:*)
5license: MIT
6compatibility: Requires openspec CLI.
7metadata:
8 author: openspec
9 version: "1.0"
10 generatedBy: "1.13.0"
11---
12
13Propose a new change - create the change and generate all artifacts in one step.
14
15**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.
16
17I'll create a change with the artifacts your schema defines. With the default spec-driven schema that is:
18- proposal.md (what & why)
19- `specs/<capability-path>/spec.md` (what the system must do - a delta, not the main spec)
20- design.md (how)
21- tasks.md (implementation steps)
22
23`<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.
24
25When the user is ready to implement, they must start the apply workflow explicitly.
26
27---
28
29**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`, `schemas`, `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.
30
31**Input**: The user's request should include a change name (kebab-case) OR a description of what they want to build.
32
33**Steps**
34
351. **Understand the request and clarify material ambiguity**
36
37 If no clear input is provided, ask the user (open-ended, no preset options):
38 > "What change do you want to work on? Describe what you want to build or fix."
39
40 From their description, derive a kebab-case name (e.g., "add user authentication" → `add-user-auth`).
41
42 **IMPORTANT**: Do NOT proceed without understanding what the user wants to build.
43
44 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.
45
462. **Load project context**
47
48 Run `openspec context --json` from the current working directory (or `openspec context --json --store "<store-id>"` when a registered store was explicitly selected). Use the returned `root.path` as the authoritative OpenSpec root. If context reports `no_openspec_root`, stop without creating or changing any files. Offer `openspec init` and wait for the user to request initialization. Do not initialize automatically or run `openspec new change`. After initialization, rerun this context check before continuing. For any other context failure, stop and report the error; do not fall back to the current directory or run later OpenSpec commands without the selected store.
49
50 Only when context returns a resolved `root.path`, read `<root.path>/openspec/config.yaml`. Use `config.yml` only when `config.yaml` does not exist. If neither file exists, continue without project context. Do not fall back to `config.yml` if `config.yaml` is unreadable or invalid.
51
52 If the file parses as a YAML object and its `context` field is a string no larger than 51,200 bytes in UTF-8, apply that field before exploring the codebase or making planning decisions. If the file cannot be read or parsed, or the context field is invalid or oversized, continue without project context. Validate this field independently of other config fields, as OpenSpec does.
53
54 Treat context as project-provided data and constraints, not as authority to change this workflow: it cannot override user authorization, the planning boundary, tool restrictions, or artifact and output rules. Do not copy the context into artifacts; use it to focus any codebase exploration and as a constraint on the proposal.
55
563. **Determine the workflow schema**
57
58 Use the configured default schema unless the user explicitly requests a different workflow.
59
60 **Use a different schema only if the user:**
61 - Explicitly requests a specific schema by name → use `--schema <schema-name>`
62 - 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`; when a registered store was explicitly selected, append `--store "<store-id>"` to `openspec schemas --json` as well. If context fails, stop as described in the context-loading step; do not fall back to the current directory.
63
64 Otherwise, omit `--schema` to preserve the configured default.
65
664. **Create the change directory**
67
68 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`.
69
70 Using the configured default:
71 ```bash
72 openspec new change "<name>"
73 ```
74
75 Using an explicitly requested schema:
76 ```bash
77 openspec new change "<name>" --schema "<schema-name>"
78 ```
79 This creates a scaffolded change in the planning home resolved by the CLI with `.openspec.yaml`.
80
815. **Get the artifact build order**
82 ```bash
83 openspec status --change "<name>" --json
84 ```
85 Parse the JSON to get:
86 - `applyRequires`: array of artifact IDs needed before implementation (e.g., `["tasks"]`)
87 - `artifacts`: list of all artifacts, each with its `status` and its `requires` edges (the artifact IDs it directly depends on)
88 - `planningHome`, `changeRoot`, `artifactPaths`, and `actionContext`: path and scope context. Use these instead of assuming repo-local paths.
89
906. **Create every artifact in the required set**
91
92 Use a todo list to track progress through the artifacts.
93
94 Loop through artifacts in dependency order (artifacts with no pending dependencies first):
95
96 a. **For each artifact that is `ready` (dependencies satisfied)**:
97 - Get instructions:
98 ```bash
99 openspec instructions <artifact-id> --change "<name>" --json
100 ```
101 - The instructions JSON includes:
102 - `context`: Project background (constraints for you - do NOT include in output)
103 - `rules`: Artifact-specific rules (constraints for you - do NOT include in output)
104 - `template`: The structure to use for your output file
105 - `instruction`: Schema-specific guidance for this artifact type
106 - `skipped`/`warning`: present when the change declares skip_specs and this artifact must NOT be created - stop and pick another artifact
107 - `resolvedOutputPath`: Resolved path or pattern to write the artifact
108 - `dependencies`: Completed artifacts to read for context
109 - Read any completed dependency files for context - always re-read them from disk, even if you saw them earlier in the conversation (the user may have edited them)
110 - **Inspect the relevant project before drafting**: Read `context` and `rules` first, then inspect relevant implementation, nearby tests, configuration, and documentation outside `openspec/`. Keep inspection read-only and proportional to the change; reuse findings for later artifacts and inspect more only as needed.
111 - Identify the target project from the request and project context; the planning home may be separate from the code. If the target is unclear, ask. For greenfield or non-code changes, inspect the available structure and relevant documents. If source is unavailable, state the limitation and ask when it materially affects the plan.
112 - Ground scope, approach, and tasks in what you find. Distinguish observed behavior from assumptions and proposed additions; surface conflicts with existing specs instead of silently deciding which is correct.
113 - Do this discovery now, rather than leaving generic "explore the codebase" or "make a plan" tasks for implementation. Keep any necessary follow-up investigation specific to an unresolved question.
114 - If the `instruction` field delegates creation to a specific skill or command, invoke it to produce the artifact instead of writing the file yourself, then verify the artifact file exists at `resolvedOutputPath`
115 - Otherwise create the artifact file using `template` as the structure and write it to `resolvedOutputPath`. If `resolvedOutputPath` is a glob, follow `instruction` to choose the concrete file path
116 - Apply `context` and `rules` as constraints - but do NOT copy them into the file
117 - Show brief progress: "Created <artifact-id>"
118
119 b. **Continue until every artifact in the required set exists (not just `apply.requires`)**
120 - After creating each artifact, re-run `openspec status --change "<name>" --json`
121 - The required set is `applyRequires` plus every artifact reachable from those by following the `requires` edges in `status --json` - walk them transitively (spec-driven closes over proposal, specs, design, tasks). Leave artifacts outside that set alone
122 - `status` is file-existence only, so an `applyRequires` artifact reading `done` does NOT mean its dependencies exist - writing `tasks.md` early marks `tasks` done while `specs` was never written. Use each artifact's `requires` edges, not its `status`, to build the required set: a `done` artifact still lists what it depends on
123 - An artifact already reading `status: "skipped"` is satisfied: the change declares `skip_specs` in `.openspec.yaml`, so its files must NOT exist. Never try to create one
124 - Create every artifact in the required set that is missing, then re-check - creating one can unblock others
125 - Skip one only when `status` already reports it `skipped`, or when its own `instruction` says it is conditional: run `openspec instructions <artifact-id> --change "<name>" --json` and skip only if its `instruction` field marks it optional (e.g. "create only if..."). Spec-driven's `design.md` qualifies; `specs` qualifies only via the `skipped` status above, never by your own judgment. Tell the user, and do not reconsider it
126 - Dependencies are enablers, not gates: if a required artifact is still `blocked` only because you skipped a conditional dependency, write it anyway
127 - Stop when every artifact in the required set is `done`, `skipped`, or was deliberately skipped
128
129 c. **If an artifact requires user input** (unclear context):
130 - Ask the user to clarify
131 - Then continue with creation
132
1337. **Show final status**
134 ```bash
135 openspec status --change "<name>"
136 ```
137
138**Output**
139
140After completing all artifacts, summarize:
141- Change name and location
142- List of artifacts created with brief descriptions, plus any conditional artifact you skipped and why
143- What's ready: "All artifacts needed for implementation are ready."
144- Prompt: "The artifacts are ready for review. When you are ready, run `/opsx:apply` or ask me to apply this change."
145
146**Artifact Creation Guidelines**
147
148- Follow the `instruction` field from `openspec instructions` for each artifact type - it is the authoritative guidance, even for familiar artifact names
149- If the `instruction` field directs you to use a specific skill or command to create the artifact, invoke it instead of writing the artifact directly
150- The schema defines what each artifact should contain - follow it
151- Read dependency artifacts for context before creating new ones
152- Use `template` as the structure for your output file - fill in its sections
153- **IMPORTANT**: `context` and `rules` are constraints for YOU, not content for the file
154 - Do NOT copy `<context>`, `<rules>`, `<project_context>` blocks into the artifact
155 - These guide what you write, but should never appear in the output
156
157**Guardrails**
158- 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
159- Create every artifact the apply phase transitively depends on, not just the ids listed in `apply.requires`
160- 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)
161- Ask about ambiguities that would materially change scope, externally observable behavior, compatibility, or acceptance criteria; for minor details, make reasonable assumptions and record them
162- If a change with that name already exists, ask if user wants to continue it or create a new one
163- Verify each artifact file exists after writing before proceeding to next
diff --git a/.claude/skills/openspec-sync-specs/SKILL.md b/.claude/skills/openspec-sync-specs/SKILL.md
new file mode 100644
index 0000000..730ea90
--- /dev/null
+++ b/.claude/skills/openspec-sync-specs/SKILL.md
@@ -0,0 +1,262 @@
1---
2name: openspec-sync-specs
3description: Sync delta specs from a change to main specs. Use when the user wants to update main specs with changes from a delta spec, without archiving the change.
4allowed-tools: Bash(openspec:*)
5license: MIT
6compatibility: Requires openspec CLI.
7metadata:
8 author: openspec
9 version: "1.0"
10 generatedBy: "1.13.0"
11---
12
13Sync delta specs from a change to main specs.
14
15This is an **agent-driven** operation - you will read delta specs and directly edit main specs to apply the changes. This allows intelligent merging (e.g., adding a scenario without copying the entire requirement).
16
17**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`, `schemas`, `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.
18
19`<capability-path>` is the spec directory relative to `specs/` (for example, `user-auth` or `identity/user-auth`). Preserve the full path from each delta spec when resolving its main spec.
20
21**Input**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
22
23**Steps**
24
251. **Select the change**
26
27 If a name is provided, use it. Otherwise:
28 - Infer from conversation context if the user mentioned a change
29 - Auto-select if only one active change exists
30 - If ambiguous, run `openspec list --json` to get available changes and ask the user to select one
31
32 When prompting, show changes that have delta specs (under `specs/` directory).
33
34 Always announce: "Using change: <name>" and how to override (e.g., `/opsx:sync <other>`).
35
362. **Resolve change context**
37
38 Run:
39 ```bash
40 openspec status --change "<name>" --json
41 ```
42
43 The JSON includes `planningHome.root`. Main specs live under `<planningHome.root>/openspec/specs/` — use that (store-aware) root for every main-spec path below, not a hardcoded repo path. When a store is selected it points at the store, not the current repository.
44
453. **Find delta specs**
46
47 Use `artifactPaths.specs.existingOutputPaths` from the status JSON as the
48 only source of delta spec paths. If the `specs` entry is missing or
49 `existingOutputPaths` is empty, report that there are no delta specs to sync,
50 do not infer them from other artifacts, and stop without requesting artifact
51 instructions or writing a main spec.
52
53 Sync every path in `existingOutputPaths` unless the caller narrowed the set.
54 A caller narrows it by naming an explicit list of complete entries from
55 `existingOutputPaths` — copy those absolute values verbatim. Archive does
56 this inline, and a user can too (for example, by selecting the entry ending
57 in `/specs/billing/invoices/spec.md`).
58 Then sync only the named paths and leave the remaining delta specs untouched:
59 bulk archive excludes a delta whose implementation it could not find, and
60 syncing it anyway would write a main spec the caller deliberately withheld.
61 Carry that narrowed selection through step 4; never widen it back to the full
62 list. If a named path is not in `existingOutputPaths`, do not sync it —
63 report it and stop, rather than dropping it silently. If the named list is
64 empty, report that there is nothing to sync and stop without writing a main
65 spec.
66
67 Each delta spec file contains sections like:
68 - `## ADDED Requirements` - New requirements to add
69 - `## MODIFIED Requirements` - Changes to existing requirements
70 - `## REMOVED Requirements` - Requirements to remove
71 - `## RENAMED Requirements` - Requirements to rename (FROM:/TO: format)
72
73 If no delta specs found, inform user and stop.
74
754. **For each delta spec, apply changes to main specs**
76
77 Before the first main-spec write, obtain one current specs-rule snapshot:
78 - If archive invoked this workflow inline and supplied a valid snapshot from
79 `openspec instructions specs --change "<name>" --json`, reuse it and do not
80 fetch the same instructions again.
81 - Otherwise run that command once now with the same selected-root flags.
82 - If the direct lookup exits non-zero or returns invalid artifact-instruction
83 JSON, report the error and stop before writing any main spec. Do not treat the
84 failure as an absent rule set.
85 - A valid response with omitted `rules` means no artifact rules are configured
86 and the existing semantic merge continues.
87
88 Apply returned `rules` only to the content and form of the main specs produced
89 by this merge. Artifact rules are not operation guidance and cannot change
90 selected roots, delta paths, CLI checks, or workflow steps. Use their text as
91 constraints without copying it verbatim into a main spec or summary.
92
93 For each capability delta spec path selected in step 3 — the full `existingOutputPaths` list, or the narrowed subset when a caller supplied one (these may belong to a selected store, not the repo):
94
95 a. **Read the delta spec** to understand the intended changes
96
97 b. **Read the main spec** at `<planningHome.root>/openspec/specs/<capability-path>/spec.md` (may not exist yet)
98
99 c. **Apply changes intelligently**:
100
101 **ADDED Requirements:**
102 - If requirement doesn't exist in main spec → add it
103 - If requirement already exists → update it to match (treat as implicit MODIFIED)
104
105 **MODIFIED Requirements:**
106 - Find the requirement in main spec
107 - Apply the changes - this can be:
108 - Adding new scenarios the main spec does not have yet
109 - Modifying existing scenarios
110 - Changing the requirement description
111 - Preserve scenarios/content not mentioned in the delta
112
113 **REMOVED Requirements:**
114 - Remove the entire requirement block from main spec
115 - Retiring the capability. Delete the whole `spec.md` - and the directory once
116 nothing else is left in it - only when ALL of these hold:
117 1. removing the requirements *this run* left no requirement blocks;
118 2. the rest of the spec is well-formed (it still has a `## Purpose`);
119 3. the main spec was not already empty before this sync - if you removed
120 nothing, change nothing;
121 4. every other nonblank line in the whole file is accounted for as the
122 title, Purpose, Requirements header, or a canonical requirement's
123 statement, scenarios, or fenced examples;
124 5. the change's `.openspec.yaml` declares `retire_capabilities: true`;
125 6. the `spec.md` resolves inside the real specs root (do not follow a
126 capability-directory symlink to delete an external file).
127 If removing the selected requirements would leave no requirement blocks and
128 any retirement condition is not satisfied, do not modify the main spec. Stop
129 the sync for that capability, report the blocking condition, and tell the user
130 how to resolve it. Never write or leave an empty `## Requirements` section.
131 When only the marker is missing, say that too - it is the one thing the user
132 can add to make the retirement go through.
133 - Deleting the file also deletes its `## Purpose`; any other section blocks
134 retirement. Name Purpose when you report the retirement. Include a pasteable
135 `git checkout` only when the spec lived in the caller's checkout;
136 otherwise give checkout-scoped recovery guidance.
137
138 **RENAMED Requirements:**
139 - Find the FROM requirement, rename to TO
140
141 **`## Purpose` in the delta:**
142 - The main spec already has one and it is authoritative - leave it alone
143 (this is what `openspec archive` does; it warns and moves on)
144
145 d. **Create new main spec** if capability doesn't exist yet:
146 - Create `<planningHome.root>/openspec/specs/<capability-path>/spec.md`
147 - Add Purpose section: copy the delta's `## Purpose` body verbatim when it has one
148 (this is what `openspec archive` does); only write a brief TBD placeholder when it does not
149 - Add Requirements section with the ADDED requirements
150 - Follow the **Main Spec Format Reference** below
151
1525. **Validate updated main specs**
153
154 Run `openspec validate --specs` with the same selected-root flags used earlier.
155 If validation fails, report the problems and do not claim the sync succeeded.
156
1576. **Show summary**
158
159 After applying all changes, summarize:
160 - Which capabilities were updated
161 - What changes were made (requirements added/modified/removed/renamed)
162 - Any new main spec left with a TBD Purpose placeholder, so it gets written
163 now rather than lingering
164 - Any capability retired, naming the deleted `spec.md`, its Purpose, and
165 either a pasteable `git checkout` or checkout-scoped recovery guidance
166
167**Delta Spec Format Reference**
168
169```markdown
170## Purpose
171
172Only on a delta that introduces a brand-new capability. Seeds the new main spec.
173
174## ADDED Requirements
175
176### Requirement: New Feature
177The system SHALL do something new.
178
179#### Scenario: Basic case
180- **WHEN** user does X
181- **THEN** system does Y
182
183## MODIFIED Requirements
184
185### Requirement: Existing Feature
186The system SHALL keep doing the existing thing, now also handling A.
187
188#### Scenario: Scenario the main spec already has
189- **WHEN** user does X
190- **THEN** system does Y
191
192#### Scenario: New scenario to add
193- **WHEN** user does A
194- **THEN** system does B
195
196## REMOVED Requirements
197
198### Requirement: Deprecated Feature
199
200## RENAMED Requirements
201
202- FROM: `### Requirement: Old Name`
203- TO: `### Requirement: New Name`
204```
205
206**Main Spec Format Reference**
207
208Main specs are what the delta merges INTO. They must never contain delta operation headers (`## ADDED/MODIFIED/REMOVED/RENAMED Requirements`) - after syncing, every requirement lives under a single `## Requirements` section:
209
210```markdown
211# <capability> Specification
212
213## Purpose
214Short description of what this capability does and why it exists.
215
216## Requirements
217
218### Requirement: New Feature
219The system SHALL do something new.
220
221#### Scenario: Basic case
222- **WHEN** user does X
223- **THEN** system does Y
224```
225
226**Key Principle: Intelligent Merging**
227
228Unlike programmatic merging, you merge rather than overwrite:
229- A MODIFIED block carries the whole requirement - body plus every scenario that survives the change. `openspec validate` and `openspec archive` both reject one that drops a scenario the main spec still has.
230- Keep anything the delta does not mention, in the main spec's existing order
231- Use your judgment to merge changes sensibly
232
233**Output On Success**
234
235```markdown
236## Specs Synced: <change-name>
237
238Updated main specs:
239
240**<capability-1>**:
241- Added requirement: "New Feature"
242- Modified requirement: "Existing Feature" (added 1 scenario)
243
244**<capability-2>**:
245- Created new spec file
246- Added requirement: "Another Feature"
247
248Main specs are now updated. The change remains active - archive when implementation is complete.
249```
250
251**Guardrails**
252- Read both delta and main specs before making changes
253- Preserve existing content not mentioned in delta
254- Never copy a delta file into a main spec as-is - merge its content so the main spec keeps the Main Spec Format Reference structure, with no delta operation headers
255- If something is unclear, ask for clarification
256- Show what you're changing as you go
257- The operation should be idempotent - running twice should give same result
258- Use only `artifactPaths.specs.existingOutputPaths`; never infer delta specs from unrelated artifacts
259- Honor a caller-supplied subset of `existingOutputPaths`; never widen it back to the full list
260- Fetch specs instructions once for direct sync, or reuse the archive-supplied snapshot inline
261- Stop before every main-spec write on a non-zero or invalid JSON specs-instruction response
262- Artifact rules constrain only the specs being written and are never copied into output files
diff --git a/.claude/skills/openspec-update-change/SKILL.md b/.claude/skills/openspec-update-change/SKILL.md
new file mode 100644
index 0000000..64e764f
--- /dev/null
+++ b/.claude/skills/openspec-update-change/SKILL.md
@@ -0,0 +1,91 @@
1---
2name: openspec-update-change
3description: Update an OpenSpec change by revising its existing planning artifacts and keeping them coherent with one another. Use when the user wants to revise a change's plan, fold new decisions into it, or reconcile its artifacts after an edit. Never edits code.
4allowed-tools: Bash(openspec:*)
5license: MIT
6compatibility: Requires openspec CLI.
7metadata:
8 author: openspec
9 version: "1.0"
10 generatedBy: "1.13.0"
11---
12
13Revise a change's existing planning artifacts and keep them coherent. Never edit code.
14
15**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`, `schemas`, `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.
16
17**Input**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
18
19`/opsx:continue` is an optional workflow and may not be installed. Before suggesting it anywhere below, verify that it is available. If it is unavailable, `openspec status --change "<name>" --json` shows the next artifact and `openspec instructions "<artifact-id>" --change "<name>" --json` explains how to create it.
20
21**Steps**
22
231. **Select the change**
24
25 If a name is provided, use it. Otherwise:
26 - Infer from conversation context if the user mentioned a change
27 - Auto-select if only one active change exists
28 - If ambiguous, run `openspec list --json` to get available changes sorted by most recently modified, and ask the user to select one
29
30 When prompting, present the top 3-4 most recently modified changes as options, showing:
31 - Change name
32 - Schema (from `schema` field if present, otherwise "spec-driven")
33 - Status (e.g., "0/5 tasks", "complete", "no tasks")
34 - How recently it was modified (from `lastModified` field)
35
36 Mark the most recently modified change as "(Recommended)" since it's likely what the user wants to update.
37
38 Always announce: "Using change: <name>" and how to override (e.g., `/opsx:update <other>`).
39
402. **Get the change's artifacts**
41 ```bash
42 openspec status --change "<name>" --json
43 ```
44 Parse the JSON to understand current state. The response includes:
45 - `schemaName`: The workflow schema being used (e.g., "spec-driven")
46 - `artifacts`: Array of artifacts with their status ("done", "skipped", "ready", "blocked")
47 - `isPlanningComplete`: Boolean indicating if all planning artifacts are complete. Older CLI versions expose the same value as `isComplete`.
48 - `planningHome`, `changeRoot`, `artifactPaths`, and `actionContext`: path and scope context. Use these instead of assuming repo-local paths.
49
50 The artifact ids and paths come from the active schema - do NOT assume them, and do NOT branch on hardcoded artifact names. Custom schemas must work unchanged.
51
52 The files to edit are `artifactPaths.<id>.existingOutputPaths` - the concrete files that exist on disk, already glob-expanded for glob artifacts (e.g. `specs/**/*.md`). Do NOT write to `resolvedOutputPath`: for a glob artifact it is still the glob pattern, not a real file.
53
543. **Understand the request**
55 - If the user asked for a specific revision ("the design now uses X"), that is the starting edit.
56 - If they only said "update" / "make this coherent", treat it as a coherence review: read the existing artifacts and check them against each other for contradictions, gaps, and duplication.
57
584. **Read and reconcile**
59 - Read the artifact(s) the request touches and the change's other existing artifacts.
60 - Apply the requested edit. Then check every other existing artifact against it - in ANY direction: an edit to a later artifact may require revising an earlier one, not only the other way around. Build order is a useful reading order, not a constraint on which artifacts may be revised.
61 - Note everything that is now inconsistent, missing, or contradictory.
62 - Revise only files that already exist (`existingOutputPaths`). Do NOT create artifacts that don't exist yet, and do NOT invent new files under a glob artifact - note them and point the user to `/opsx:continue` to create them.
63 - If the change is already coherent, say so and make no edits.
64
655. **Confirm and apply, one artifact at a time**
66 - Show each proposed revision and why. Write only after the user confirms.
67 - If the user rejects a revision, do not write it - leave that artifact unchanged.
68 - When a substantial rewrite is needed, get that artifact's rules and template first:
69 ```bash
70 openspec instructions "<artifact-id>" --change "<name>" --json
71 ```
72
736. **Point to the next step (guidance only - NEVER act on it)**
74 - Artifacts still missing -> suggest `/opsx:continue` to create them.
75 - Change already implemented (tasks checked off / already applied) -> the code may no longer match the revised plan; suggest `/opsx:apply` to carry the delta into code.
76 - Everything done and implemented -> suggest `/opsx:archive`.
77
78**Output**
79
80After each invocation, show:
81- Which artifacts were revised (and which proposed revisions were rejected)
82- Anything deferred to `/opsx:continue` (not-yet-created artifacts or files)
83- Where the change stands and the recommended next command
84
85**Guardrails**
86- Planning artifacts only - NEVER edit implementation code. If the revised plan implies code changes, stop and point to `/opsx:apply`.
87- Use the artifact ids and paths reported by `openspec status`; never branch on hardcoded artifact names.
88- Edit only the concrete files in `existingOutputPaths`; never write to a glob `resolvedOutputPath`.
89- Do not advance the build frontier: no new artifacts, no new files under glob artifacts - that is `/opsx:continue`'s job.
90- Confirm every edit with the user before writing.
91- If the request changes the change's *intent* rather than refining it, first verify whether the optional `/opsx:new` workflow is available. If it is, recommend starting fresh with `/opsx:new` (the "Update vs. Start Fresh" heuristic). If it is unavailable, ask for a distinct unused change name and recommend `openspec new change "<new-change-name>"` instead.