$npx -y skills add halo-dev/cli --skill openspec-archive-changeArchive a completed change in the experimental workflow. Use when the user wants to finalize and archive a change after implementation is complete.
| 1 | Archive a completed change in the experimental workflow. |
| 2 | |
| 3 | **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. |
| 4 | |
| 5 | **Steps** |
| 6 | |
| 7 | 1. **If no change name provided, prompt for selection** |
| 8 | |
| 9 | Run `openspec list --json` to get available changes. Use the **AskUserQuestion tool** to let the user select. |
| 10 | |
| 11 | Show only active changes (not already archived). |
| 12 | Include the schema used for each change if available. |
| 13 | |
| 14 | **IMPORTANT**: Do NOT guess or auto-select a change. Always let the user choose. |
| 15 | |
| 16 | 2. **Check artifact completion status** |
| 17 | |
| 18 | Run `openspec status --change "<name>" --json` to check artifact completion. |
| 19 | |
| 20 | Parse the JSON to understand: |
| 21 | - `schemaName`: The workflow being used |
| 22 | - `artifacts`: List of artifacts with their status (`done` or other) |
| 23 | |
| 24 | **If any artifacts are not `done`:** |
| 25 | - Display warning listing incomplete artifacts |
| 26 | - Use **AskUserQuestion tool** to confirm user wants to proceed |
| 27 | - Proceed if user confirms |
| 28 | |
| 29 | 3. **Check task completion status** |
| 30 | |
| 31 | Read the tasks file (typically `tasks.md`) to check for incomplete tasks. |
| 32 | |
| 33 | Count tasks marked with `- [ ]` (incomplete) vs `- [x]` (complete). |
| 34 | |
| 35 | **If incomplete tasks found:** |
| 36 | - Display warning showing count of incomplete tasks |
| 37 | - Use **AskUserQuestion tool** to confirm user wants to proceed |
| 38 | - Proceed if user confirms |
| 39 | |
| 40 | **If no tasks file exists:** Proceed without task-related warning. |
| 41 | |
| 42 | 4. **Assess delta spec sync state** |
| 43 | |
| 44 | Check for delta specs at `openspec/changes/<name>/specs/`. If none exist, proceed without sync prompt. |
| 45 | |
| 46 | **If delta specs exist:** |
| 47 | - Compare each delta spec with its corresponding main spec at `openspec/specs/<capability>/spec.md` |
| 48 | - Determine what changes would be applied (adds, modifications, removals, renames) |
| 49 | - Show a combined summary before prompting |
| 50 | |
| 51 | **Prompt options:** |
| 52 | - If changes needed: "Sync now (recommended)", "Archive without syncing" |
| 53 | - If already synced: "Archive now", "Sync anyway", "Cancel" |
| 54 | |
| 55 | 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. |
| 56 | |
| 57 | 5. **Perform the archive** |
| 58 | |
| 59 | Create the archive directory if it doesn't exist: |
| 60 | ```bash |
| 61 | mkdir -p openspec/changes/archive |
| 62 | ``` |
| 63 | |
| 64 | Generate target name using current date: `YYYY-MM-DD-<change-name>` |
| 65 | |
| 66 | **Check if target already exists:** |
| 67 | - If yes: Fail with error, suggest renaming existing archive or using different date |
| 68 | - If no: Move the change directory to archive |
| 69 | |
| 70 | ```bash |
| 71 | mv openspec/changes/<name> openspec/changes/archive/YYYY-MM-DD-<name> |
| 72 | ``` |
| 73 | |
| 74 | 6. **Display summary** |
| 75 | |
| 76 | Show archive completion summary including: |
| 77 | - Change name |
| 78 | - Schema that was used |
| 79 | - Archive location |
| 80 | - Whether specs were synced (if applicable) |
| 81 | - Note about any warnings (incomplete artifacts/tasks) |
| 82 | |
| 83 | **Output On Success** |
| 84 | |
| 85 | ``` |
| 86 | ## Archive Complete |
| 87 | |
| 88 | **Change:** <change-name> |
| 89 | **Schema:** <schema-name> |
| 90 | **Archived to:** openspec/changes/archive/YYYY-MM-DD-<name>/ |
| 91 | **Specs:** ✓ Synced to main specs (or "No delta specs" or "Sync skipped") |
| 92 | |
| 93 | All artifacts complete. All tasks complete. |
| 94 | ``` |
| 95 | |
| 96 | **Guardrails** |
| 97 | - Always prompt for change selection if not provided |
| 98 | - Use artifact graph (openspec status --json) for completion checking |
| 99 | - Don't block archive on warnings - just inform and confirm |
| 100 | - Preserve .openspec.yaml when moving to archive (it moves with the directory) |
| 101 | - Show clear summary of what happened |
| 102 | - If sync is requested, use openspec-sync-specs approach (agent-driven) |
| 103 | - If delta specs exist, always run the sync assessment and show the combined summary before prompting |