@liangxie/qf 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/.claude/commands/opsx/apply.md +155 -0
  2. package/.claude/commands/opsx/archive.md +160 -0
  3. package/.claude/commands/opsx/explore.md +174 -0
  4. package/.claude/commands/opsx/propose.md +109 -0
  5. package/.claude/commands/opsx/sync.md +143 -0
  6. package/.claude/skills/openspec-apply-change/SKILL.md +159 -0
  7. package/.claude/skills/openspec-archive-change/SKILL.md +117 -0
  8. package/.claude/skills/openspec-explore/SKILL.md +289 -0
  9. package/.claude/skills/openspec-propose/SKILL.md +113 -0
  10. package/.claude/skills/openspec-sync-specs/SKILL.md +147 -0
  11. package/.codex/skills/openspec-apply-change/SKILL.md +159 -0
  12. package/.codex/skills/openspec-archive-change/SKILL.md +117 -0
  13. package/.codex/skills/openspec-explore/SKILL.md +289 -0
  14. package/.codex/skills/openspec-propose/SKILL.md +113 -0
  15. package/.codex/skills/openspec-sync-specs/SKILL.md +147 -0
  16. package/.cursor/commands/opsx-apply.md +155 -0
  17. package/.cursor/commands/opsx-archive.md +160 -0
  18. package/.cursor/commands/opsx-explore.md +174 -0
  19. package/.cursor/commands/opsx-propose.md +109 -0
  20. package/.cursor/commands/opsx-sync.md +143 -0
  21. package/.cursor/skills/openspec-apply-change/SKILL.md +159 -0
  22. package/.cursor/skills/openspec-archive-change/SKILL.md +117 -0
  23. package/.cursor/skills/openspec-explore/SKILL.md +289 -0
  24. package/.cursor/skills/openspec-propose/SKILL.md +113 -0
  25. package/.cursor/skills/openspec-sync-specs/SKILL.md +147 -0
  26. package/.github/prompts/opsx-apply.prompt.md +152 -0
  27. package/.github/prompts/opsx-archive.prompt.md +157 -0
  28. package/.github/prompts/opsx-explore.prompt.md +171 -0
  29. package/.github/prompts/opsx-propose.prompt.md +106 -0
  30. package/.github/prompts/opsx-sync.prompt.md +140 -0
  31. package/.github/skills/openspec-apply-change/SKILL.md +159 -0
  32. package/.github/skills/openspec-archive-change/SKILL.md +117 -0
  33. package/.github/skills/openspec-explore/SKILL.md +289 -0
  34. package/.github/skills/openspec-propose/SKILL.md +113 -0
  35. package/.github/skills/openspec-sync-specs/SKILL.md +147 -0
  36. package/.omo/run-continuation/ses_0d9f5cba6ffeW2r1NWuthiPI0F.json +10 -0
  37. package/.opencode/commands/opsx-apply.md +152 -0
  38. package/.opencode/commands/opsx-archive.md +157 -0
  39. package/.opencode/commands/opsx-explore.md +171 -0
  40. package/.opencode/commands/opsx-propose.md +106 -0
  41. package/.opencode/commands/opsx-sync.md +140 -0
  42. package/.opencode/skills/openspec-apply-change/SKILL.md +159 -0
  43. package/.opencode/skills/openspec-archive-change/SKILL.md +117 -0
  44. package/.opencode/skills/openspec-explore/SKILL.md +289 -0
  45. package/.opencode/skills/openspec-propose/SKILL.md +113 -0
  46. package/.opencode/skills/openspec-sync-specs/SKILL.md +147 -0
  47. package/LICENSE +21 -0
  48. package/index.js +17 -0
  49. package/openspec/changes/archive/2026-07-03-add-say-command/.openspec.yaml +2 -0
  50. package/openspec/changes/archive/2026-07-03-add-say-command/design.md +73 -0
  51. package/openspec/changes/archive/2026-07-03-add-say-command/proposal.md +28 -0
  52. package/openspec/changes/archive/2026-07-03-add-say-command/specs/cli-framework/spec.md +22 -0
  53. package/openspec/changes/archive/2026-07-03-add-say-command/specs/say-command/spec.md +22 -0
  54. package/openspec/changes/archive/2026-07-03-add-say-command/tasks.md +17 -0
  55. package/openspec/config.yaml +20 -0
  56. package/package.json +25 -0
@@ -0,0 +1,109 @@
1
+ ---
2
+ name: /opsx-propose
3
+ id: opsx-propose
4
+ category: Workflow
5
+ description: Propose a new change - create it and generate all artifacts in one step
6
+ ---
7
+
8
+ Propose a new change - create the change and generate all artifacts in one step.
9
+
10
+ I'll create a change with artifacts:
11
+ - proposal.md (what & why)
12
+ - design.md (how)
13
+ - tasks.md (implementation steps)
14
+
15
+ When ready to implement, run /opsx:apply
16
+
17
+ ---
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`). 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
+ **Input**: The argument after `/opsx:propose` is the change name (kebab-case), OR a description of what the user wants to build.
22
+
23
+ **Steps**
24
+
25
+ 1. **If no input provided, ask what they want to build**
26
+
27
+ Use the **AskUserQuestion tool** (open-ended, no preset options) to ask:
28
+ > "What change do you want to work on? Describe what you want to build or fix."
29
+
30
+ From their description, derive a kebab-case name (e.g., "add user authentication" → `add-user-auth`).
31
+
32
+ **IMPORTANT**: Do NOT proceed without understanding what the user wants to build.
33
+
34
+ 2. **Create the change directory**
35
+ ```bash
36
+ openspec new change "<name>"
37
+ ```
38
+ This creates a scaffolded change in the planning home resolved by the CLI with `.openspec.yaml`.
39
+
40
+ 3. **Get the artifact build order**
41
+ ```bash
42
+ openspec status --change "<name>" --json
43
+ ```
44
+ Parse the JSON to get:
45
+ - `applyRequires`: array of artifact IDs needed before implementation (e.g., `["tasks"]`)
46
+ - `artifacts`: list of all artifacts with their status and dependencies
47
+ - `planningHome`, `changeRoot`, `artifactPaths`, and `actionContext`: path and scope context. Use these instead of assuming repo-local paths.
48
+
49
+ 4. **Create artifacts in sequence until apply-ready**
50
+
51
+ Use the **TodoWrite tool** to track progress through the artifacts.
52
+
53
+ Loop through artifacts in dependency order (artifacts with no pending dependencies first):
54
+
55
+ a. **For each artifact that is `ready` (dependencies satisfied)**:
56
+ - Get instructions:
57
+ ```bash
58
+ openspec instructions <artifact-id> --change "<name>" --json
59
+ ```
60
+ - The instructions JSON includes:
61
+ - `context`: Project background (constraints for you - do NOT include in output)
62
+ - `rules`: Artifact-specific rules (constraints for you - do NOT include in output)
63
+ - `template`: The structure to use for your output file
64
+ - `instruction`: Schema-specific guidance for this artifact type
65
+ - `resolvedOutputPath`: Resolved path or pattern to write the artifact
66
+ - `dependencies`: Completed artifacts to read for context
67
+ - Read any completed dependency files for context
68
+ - Create the artifact file using `template` as the structure and write it to `resolvedOutputPath`
69
+ - Apply `context` and `rules` as constraints - but do NOT copy them into the file
70
+ - Show brief progress: "Created <artifact-id>"
71
+
72
+ b. **Continue until all `applyRequires` artifacts are complete**
73
+ - After creating each artifact, re-run `openspec status --change "<name>" --json`
74
+ - Check if every artifact ID in `applyRequires` has `status: "done"` in the artifacts array
75
+ - Stop when all `applyRequires` artifacts are done
76
+
77
+ c. **If an artifact requires user input** (unclear context):
78
+ - Use **AskUserQuestion tool** to clarify
79
+ - Then continue with creation
80
+
81
+ 5. **Show final status**
82
+ ```bash
83
+ openspec status --change "<name>"
84
+ ```
85
+
86
+ **Output**
87
+
88
+ After completing all artifacts, summarize:
89
+ - Change name and location
90
+ - List of artifacts created with brief descriptions
91
+ - What's ready: "All artifacts created! Ready for implementation."
92
+ - Prompt: "Run `/opsx:apply` to start implementing."
93
+
94
+ **Artifact Creation Guidelines**
95
+
96
+ - Follow the `instruction` field from `openspec instructions` for each artifact type
97
+ - The schema defines what each artifact should contain - follow it
98
+ - Read dependency artifacts for context before creating new ones
99
+ - Use `template` as the structure for your output file - fill in its sections
100
+ - **IMPORTANT**: `context` and `rules` are constraints for YOU, not content for the file
101
+ - Do NOT copy `<context>`, `<rules>`, `<project_context>` blocks into the artifact
102
+ - These guide what you write, but should never appear in the output
103
+
104
+ **Guardrails**
105
+ - Create ALL artifacts needed for implementation (as defined by schema's `apply.requires`)
106
+ - Always read dependency artifacts before creating a new one
107
+ - If context is critically unclear, ask the user - but prefer making reasonable decisions to keep momentum
108
+ - If a change with that name already exists, ask if user wants to continue it or create a new one
109
+ - Verify each artifact file exists after writing before proceeding to next
@@ -0,0 +1,143 @@
1
+ ---
2
+ name: /opsx-sync
3
+ id: opsx-sync
4
+ category: Workflow
5
+ description: Sync delta specs from a change to main specs
6
+ ---
7
+
8
+ Sync delta specs from a change to main specs.
9
+
10
+ This 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).
11
+
12
+ **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`). 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.
13
+
14
+ **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.
15
+
16
+ **Steps**
17
+
18
+ 1. **If no change name provided, prompt for selection**
19
+
20
+ Run `openspec list --json` to get available changes. Use the **AskUserQuestion tool** to let the user select.
21
+
22
+ Show changes that have delta specs (under `specs/` directory).
23
+
24
+ **IMPORTANT**: Do NOT guess or auto-select a change. Always let the user choose.
25
+
26
+ 2. **Resolve change context**
27
+
28
+ Run:
29
+ ```bash
30
+ openspec status --change "<name>" --json
31
+ ```
32
+
33
+ 3. **Find delta specs**
34
+
35
+ Use `artifactPaths.specs.existingOutputPaths` from the status JSON as the list of delta spec files.
36
+
37
+ Each delta spec file contains sections like:
38
+ - `## ADDED Requirements` - New requirements to add
39
+ - `## MODIFIED Requirements` - Changes to existing requirements
40
+ - `## REMOVED Requirements` - Requirements to remove
41
+ - `## RENAMED Requirements` - Requirements to rename (FROM:/TO: format)
42
+
43
+ If no delta specs found, inform user and stop.
44
+
45
+ 4. **For each delta spec, apply changes to main specs**
46
+
47
+ For each repo-local capability delta spec path returned by the CLI:
48
+
49
+ a. **Read the delta spec** to understand the intended changes
50
+
51
+ b. **Read the main spec** at `openspec/specs/<capability>/spec.md` (may not exist yet)
52
+
53
+ c. **Apply changes intelligently**:
54
+
55
+ **ADDED Requirements:**
56
+ - If requirement doesn't exist in main spec → add it
57
+ - If requirement already exists → update it to match (treat as implicit MODIFIED)
58
+
59
+ **MODIFIED Requirements:**
60
+ - Find the requirement in main spec
61
+ - Apply the changes - this can be:
62
+ - Adding new scenarios (don't need to copy existing ones)
63
+ - Modifying existing scenarios
64
+ - Changing the requirement description
65
+ - Preserve scenarios/content not mentioned in the delta
66
+
67
+ **REMOVED Requirements:**
68
+ - Remove the entire requirement block from main spec
69
+
70
+ **RENAMED Requirements:**
71
+ - Find the FROM requirement, rename to TO
72
+
73
+ d. **Create new main spec** if capability doesn't exist yet:
74
+ - Create `openspec/specs/<capability>/spec.md`
75
+ - Add Purpose section (can be brief, mark as TBD)
76
+ - Add Requirements section with the ADDED requirements
77
+
78
+ 5. **Show summary**
79
+
80
+ After applying all changes, summarize:
81
+ - Which capabilities were updated
82
+ - What changes were made (requirements added/modified/removed/renamed)
83
+
84
+ **Delta Spec Format Reference**
85
+
86
+ ```markdown
87
+ ## ADDED Requirements
88
+
89
+ ### Requirement: New Feature
90
+ The system SHALL do something new.
91
+
92
+ #### Scenario: Basic case
93
+ - **WHEN** user does X
94
+ - **THEN** system does Y
95
+
96
+ ## MODIFIED Requirements
97
+
98
+ ### Requirement: Existing Feature
99
+ #### Scenario: New scenario to add
100
+ - **WHEN** user does A
101
+ - **THEN** system does B
102
+
103
+ ## REMOVED Requirements
104
+
105
+ ### Requirement: Deprecated Feature
106
+
107
+ ## RENAMED Requirements
108
+
109
+ - FROM: `### Requirement: Old Name`
110
+ - TO: `### Requirement: New Name`
111
+ ```
112
+
113
+ **Key Principle: Intelligent Merging**
114
+
115
+ Unlike programmatic merging, you can apply **partial updates**:
116
+ - To add a scenario, just include that scenario under MODIFIED - don't copy existing scenarios
117
+ - The delta represents *intent*, not a wholesale replacement
118
+ - Use your judgment to merge changes sensibly
119
+
120
+ **Output On Success**
121
+
122
+ ```
123
+ ## Specs Synced: <change-name>
124
+
125
+ Updated main specs:
126
+
127
+ **<capability-1>**:
128
+ - Added requirement: "New Feature"
129
+ - Modified requirement: "Existing Feature" (added 1 scenario)
130
+
131
+ **<capability-2>**:
132
+ - Created new spec file
133
+ - Added requirement: "Another Feature"
134
+
135
+ Main specs are now updated. The change remains active - archive when implementation is complete.
136
+ ```
137
+
138
+ **Guardrails**
139
+ - Read both delta and main specs before making changes
140
+ - Preserve existing content not mentioned in delta
141
+ - If something is unclear, ask for clarification
142
+ - Show what you're changing as you go
143
+ - The operation should be idempotent - running twice should give same result
@@ -0,0 +1,159 @@
1
+ ---
2
+ name: openspec-apply-change
3
+ description: Implement tasks from an OpenSpec change. Use when the user wants to start implementing, continue implementation, or work through tasks.
4
+ license: MIT
5
+ compatibility: Requires openspec CLI.
6
+ metadata:
7
+ author: openspec
8
+ version: "1.0"
9
+ generatedBy: "1.5.0"
10
+ ---
11
+
12
+ Implement tasks from an OpenSpec change.
13
+
14
+ **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`). 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.
15
+
16
+ **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.
17
+
18
+ **Steps**
19
+
20
+ 1. **Select the change**
21
+
22
+ If a name is provided, use it. Otherwise:
23
+ - Infer from conversation context if the user mentioned a change
24
+ - Auto-select if only one active change exists
25
+ - If ambiguous, run `openspec list --json` to get available changes and use the **AskUserQuestion tool** to let the user select
26
+
27
+ Always announce: "Using change: <name>" and how to override (e.g., `/opsx:apply <other>`).
28
+
29
+ 2. **Check status to understand the schema**
30
+ ```bash
31
+ openspec status --change "<name>" --json
32
+ ```
33
+ Parse the JSON to understand:
34
+ - `schemaName`: The workflow being used (e.g., "spec-driven")
35
+ - `planningHome`, `changeRoot`, and `actionContext`: planning scope and edit constraints
36
+ - Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others)
37
+
38
+ 3. **Get apply instructions**
39
+
40
+ ```bash
41
+ openspec instructions apply --change "<name>" --json
42
+ ```
43
+
44
+ This returns:
45
+ - `contextFiles`: artifact ID -> array of concrete file paths (varies by schema - could be proposal/specs/design/tasks or spec/tests/implementation/docs)
46
+ - Progress (total, complete, remaining)
47
+ - Task list with status
48
+ - Dynamic instruction based on current state
49
+
50
+ **Handle states:**
51
+ - If `state: "blocked"` (missing artifacts): show message, suggest using openspec-continue-change
52
+ - If `state: "all_done"`: congratulate, suggest archive
53
+ - Otherwise: proceed to implementation
54
+
55
+ 4. **Read context files**
56
+
57
+ Read every file path listed under `contextFiles` from the apply instructions output.
58
+ The files depend on the schema being used:
59
+ - **spec-driven**: proposal, specs, design, tasks
60
+ - Other schemas: follow the contextFiles from CLI output
61
+
62
+ 5. **Show current progress**
63
+
64
+ Display:
65
+ - Schema being used
66
+ - Progress: "N/M tasks complete"
67
+ - Remaining tasks overview
68
+ - Dynamic instruction from CLI
69
+
70
+ 6. **Implement tasks (loop until done or blocked)**
71
+
72
+ For each pending task:
73
+ - Show which task is being worked on
74
+ - Make the code changes required
75
+ - Keep changes minimal and focused
76
+ - Mark task complete in the tasks file: `- [ ]` → `- [x]`
77
+ - Continue to next task
78
+
79
+ **Pause if:**
80
+ - Task is unclear → ask for clarification
81
+ - Implementation reveals a design issue → suggest updating artifacts
82
+ - Error or blocker encountered → report and wait for guidance
83
+ - User interrupts
84
+
85
+ 7. **On completion or pause, show status**
86
+
87
+ Display:
88
+ - Tasks completed this session
89
+ - Overall progress: "N/M tasks complete"
90
+ - If all done: suggest archive
91
+ - If paused: explain why and wait for guidance
92
+
93
+ **Output During Implementation**
94
+
95
+ ```
96
+ ## Implementing: <change-name> (schema: <schema-name>)
97
+
98
+ Working on task 3/7: <task description>
99
+ [...implementation happening...]
100
+ ✓ Task complete
101
+
102
+ Working on task 4/7: <task description>
103
+ [...implementation happening...]
104
+ ✓ Task complete
105
+ ```
106
+
107
+ **Output On Completion**
108
+
109
+ ```
110
+ ## Implementation Complete
111
+
112
+ **Change:** <change-name>
113
+ **Schema:** <schema-name>
114
+ **Progress:** 7/7 tasks complete ✓
115
+
116
+ ### Completed This Session
117
+ - [x] Task 1
118
+ - [x] Task 2
119
+ ...
120
+
121
+ All tasks complete! Ready to archive this change.
122
+ ```
123
+
124
+ **Output On Pause (Issue Encountered)**
125
+
126
+ ```
127
+ ## Implementation Paused
128
+
129
+ **Change:** <change-name>
130
+ **Schema:** <schema-name>
131
+ **Progress:** 4/7 tasks complete
132
+
133
+ ### Issue Encountered
134
+ <description of the issue>
135
+
136
+ **Options:**
137
+ 1. <option 1>
138
+ 2. <option 2>
139
+ 3. Other approach
140
+
141
+ What would you like to do?
142
+ ```
143
+
144
+ **Guardrails**
145
+ - Keep going through tasks until done or blocked
146
+ - Always read context files before starting (from the apply instructions output)
147
+ - If task is ambiguous, pause and ask before implementing
148
+ - If implementation reveals issues, pause and suggest artifact updates
149
+ - Keep code changes minimal and scoped to each task
150
+ - Update task checkbox immediately after completing each task
151
+ - Pause on errors, blockers, or unclear requirements - don't guess
152
+ - Use contextFiles from CLI output, don't assume specific file names
153
+
154
+ **Fluid Workflow Integration**
155
+
156
+ This skill supports the "actions on a change" model:
157
+
158
+ - **Can be invoked anytime**: Before all artifacts are done (if tasks exist), after partial implementation, interleaved with other actions
159
+ - **Allows artifact updates**: If implementation reveals design issues, suggest updating artifacts - not phase-locked, work fluidly
@@ -0,0 +1,117 @@
1
+ ---
2
+ name: openspec-archive-change
3
+ description: Archive a completed change in the experimental workflow. Use when the user wants to finalize and archive a change after implementation is complete.
4
+ license: MIT
5
+ compatibility: Requires openspec CLI.
6
+ metadata:
7
+ author: openspec
8
+ version: "1.0"
9
+ generatedBy: "1.5.0"
10
+ ---
11
+
12
+ Archive a completed change in the experimental workflow.
13
+
14
+ **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`). 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.
15
+
16
+ **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.
17
+
18
+ **Steps**
19
+
20
+ 1. **If no change name provided, prompt for selection**
21
+
22
+ Run `openspec list --json` to get available changes. Use the **AskUserQuestion tool** to let the user select.
23
+
24
+ Show only active changes (not already archived).
25
+ Include the schema used for each change if available.
26
+
27
+ **IMPORTANT**: Do NOT guess or auto-select a change. Always let the user choose.
28
+
29
+ 2. **Check artifact completion status**
30
+
31
+ Run `openspec status --change "<name>" --json` to check artifact completion.
32
+
33
+ Parse the JSON to understand:
34
+ - `schemaName`: The workflow being used
35
+ - `planningHome`, `changeRoot`, `artifactPaths`, and `actionContext`: path and scope context
36
+ - `artifacts`: List of artifacts with their status (`done` or other)
37
+
38
+ **If any artifacts are not `done`:**
39
+ - Display warning listing incomplete artifacts
40
+ - Use **AskUserQuestion tool** to confirm user wants to proceed
41
+ - Proceed if user confirms
42
+
43
+ 3. **Check task completion status**
44
+
45
+ Read the tasks file (typically `tasks.md`) to check for incomplete tasks.
46
+
47
+ Count tasks marked with `- [ ]` (incomplete) vs `- [x]` (complete).
48
+
49
+ **If incomplete tasks found:**
50
+ - Display warning showing count of incomplete tasks
51
+ - Use **AskUserQuestion tool** to confirm user wants to proceed
52
+ - Proceed if user confirms
53
+
54
+ **If no tasks file exists:** Proceed without task-related warning.
55
+
56
+ 4. **Assess delta spec sync state**
57
+
58
+ Use `artifactPaths.specs.existingOutputPaths` from status JSON to check for delta specs. If none exist, proceed without sync prompt.
59
+
60
+ **If delta specs exist:**
61
+ - Compare each delta spec with its corresponding main spec at `openspec/specs/<capability>/spec.md`
62
+ - Determine what changes would be applied (adds, modifications, removals, renames)
63
+ - Show a combined summary before prompting
64
+
65
+ **Prompt options:**
66
+ - If changes needed: "Sync now (recommended)", "Archive without syncing"
67
+ - If already synced: "Archive now", "Sync anyway", "Cancel"
68
+
69
+ If user chooses sync, use Task tool (subagent_type: "general-purpose", prompt: "Use Skill tool to invoke openspec-sync-specs for change '<name>'. Delta spec analysis: <include the analyzed delta spec summary>"). Proceed to archive regardless of choice.
70
+
71
+ 5. **Perform the archive**
72
+
73
+ Create an `archive` directory under `planningHome.changesDir` if it doesn't exist:
74
+ ```bash
75
+ mkdir -p "<planningHome.changesDir>/archive"
76
+ ```
77
+
78
+ Generate target name using current date: `YYYY-MM-DD-<change-name>`
79
+
80
+ **Check if target already exists:**
81
+ - If yes: Fail with error, suggest renaming existing archive or using different date
82
+ - If no: Move `changeRoot` to the archive directory
83
+
84
+ ```bash
85
+ mv "<changeRoot>" "<planningHome.changesDir>/archive/YYYY-MM-DD-<name>"
86
+ ```
87
+
88
+ 6. **Display summary**
89
+
90
+ Show archive completion summary including:
91
+ - Change name
92
+ - Schema that was used
93
+ - Archive location
94
+ - Whether specs were synced (if applicable)
95
+ - Note about any warnings (incomplete artifacts/tasks)
96
+
97
+ **Output On Success**
98
+
99
+ ```
100
+ ## Archive Complete
101
+
102
+ **Change:** <change-name>
103
+ **Schema:** <schema-name>
104
+ **Archived to:** the archive path derived from `planningHome.changesDir`/YYYY-MM-DD-<name>/
105
+ **Specs:** ✓ Synced to main specs (or "No delta specs" or "Sync skipped")
106
+
107
+ All artifacts complete. All tasks complete.
108
+ ```
109
+
110
+ **Guardrails**
111
+ - Always prompt for change selection if not provided
112
+ - Use artifact graph (openspec status --json) for completion checking
113
+ - Don't block archive on warnings - just inform and confirm
114
+ - Preserve .openspec.yaml when moving to archive (it moves with the directory)
115
+ - Show clear summary of what happened
116
+ - If sync is requested, use openspec-sync-specs approach (agent-driven)
117
+ - If delta specs exist, always run the sync assessment and show the combined summary before prompting