2.7 KiB
name, description, license, compatibility, metadata
| name | description | license | compatibility | metadata | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| openspec-archive-change | Archive a completed change after implementation. Use when the user wants to finalize and archive a change once its tasks are done. | MIT | Claude Code — no external CLI required. |
|
Archive a completed change.
Adapted for Claude Code. No
openspecCLI. Archiving is a plain directory move:openspec/changes/<name>/→openspec/changes/archive/YYYY-MM-DD-<name>/.
Input: Optionally specify a change name. If omitted, prompt for selection.
Steps
-
Select the change
List active changes and let the user choose with the AskUserQuestion tool:
ls -1 openspec/changes 2>/dev/null | grep -v '^archive$'IMPORTANT: Do NOT guess or auto-select. Always let the user choose (unless they already named the change in their request).
-
Check task completion
Read
openspec/changes/<name>/tasks.mdand count incomplete tasks (- [ ]) vs complete (- [x]).- If incomplete tasks exist: show the count and use the AskUserQuestion tool to confirm the user still wants to archive. Proceed only if confirmed.
- If no
tasks.mdexists: proceed without a task warning.
-
Sync any delta specs (optional)
If the change captured spec deltas under
openspec/changes/<name>/specs/, compare each with its main spec atopenspec/specs/<capability>/spec.mdand offer to apply the changes (read both, then Edit the main spec). Options to present:- "Sync now (recommended)" / "Archive without syncing"
If there are no delta specs, skip this step.
-
Perform the archive
mkdir -p openspec/changes/archiveDetermine today's date (
date +%F→YYYY-MM-DD) and build the target nameYYYY-MM-DD-<name>.- If the target already exists: stop with an error; suggest a different date suffix or renaming the existing archive.
- Otherwise: move the change folder:
mv openspec/changes/<name> openspec/changes/archive/<YYYY-MM-DD>-<name> -
Display summary
## Archive Complete
**Change:** <change-name>
**Archived to:** openspec/changes/archive/YYYY-MM-DD-<name>/
**Specs:** ✓ Synced to main specs (or "No delta specs" / "Sync skipped")
Guardrails
- Always prompt for change selection if not provided
- Don't block archive on warnings — inform, confirm, then proceed
- Never overwrite an existing archive target
- Show a clear summary of what happened
- If delta specs exist, run the sync assessment and show the summary before prompting