Archive multiple completed changes in a single operation.
This skill allows you to batch-archive changes, handling spec conflicts intelligently by checking the codebase to determine what's actually implemented.
Input: None required (prompts for selection)
Steps
Get active changes
Run openspec list --json to get all active changes.
If no active changes exist, inform user and stop.
Prompt for change selection
Use AskUserQuestion tool with multi-select to let user choose changes:
- Show each change with its schema
- Include an option for "All changes"
- Allow any number of selections (1+ works, 2+ is the typical use case)
IMPORTANT: Do NOT auto-select. Always let the user choose.
Batch validation - gather status for all selected changes
For each selected change, collect:
a. Artifact status - Run openspec status --change "<name>" --json
- Parse
schemaName and artifacts list
- Note which artifacts are
done vs other states
b. Task completion - Read openspec/changes/<name>/tasks.md
- Count
- [ ] (incomplete) vs - [x] (complete)
- If no tasks file exists, note as "No tasks"
c. Delta specs - Check openspec/changes/<name>/specs/ directory
- List which capability specs exist
- For each, extract requirement names (lines matching
### Requirement: <name>)
Detect spec conflicts
Build a map of capability -> [changes that touch it]:
auth -> [change-a, change-b] <- CONFLICT (2+ changes)
api -> [change-c] <- OK (only 1 change)
A conflict exists when 2+ selected changes have delta specs for the same capability.
Resolve conflicts agentically
For each conflict, investigate the codebase:
a. Read the delta specs from each conflicting change to understand what each claims to add/modify
b. Search the codebase for implementation evidence:
- Look for code implementing requirements from each delta spec
- Check for related files, functions, or tests
c. Determine resolution:
- If only one change is actually implemented -> sync that one's specs
- If both implemented -> apply in chronological order (older first, newer overwrites)
- If neither implemented -> skip spec sync, warn user
d. Record resolution for each conflict:
- Which change's specs to apply
- In what order (if both)
- Rationale (what was found in codebase)
Show consolidated status table
Display a table summarizing all changes:
| Change | Artifacts | Tasks | Specs | Conflicts | Status |
|---------------------|-----------|-------|---------|-----------|--------|
| schema-management | Done | 5/5 | 2 delta | None | Ready |
| project-config | Done | 3/3 | 1 delta | None | Ready |
| add-oauth | Done | 4/4 | 1 delta | auth (!) | Ready* |
| add-verify-skill | 1 left | 2/5 | None | None | Warn |
```text
For conflicts, show the resolution:
```text
* Conflict resolution:
- auth spec: Will apply add-oauth then add-jwt (both implemented, chronological order)
```text
For incomplete changes, show warnings:
```text
Warnings:
- add-verify-skill: 1 incomplete artifact, 3 incomplete tasks
```text
1. **Confirm batch operation**
Use **AskUserQuestion tool** with a single confirmation:
- "Archive N changes?" with options based on status
- Options might include:
- "Archive all N changes"
- "Archive only N ready changes (skip incomplete)"
- "Cancel"
If there are incomplete changes, make clear they'll be archived with warnings.
1. **Execute archive for each confirmed change**
Process changes in the determined order (respecting conflict resolution):
a. **Sync specs** if delta specs exist:
- Use the openspec-sync-specs approach (agent-driven intelligent merge)
- For conflicts, apply in resolved order
- Track if sync was done
b. **Perform the archive**:
```bash
mkdir -p openspec/changes/archive
mv openspec/changes/<name> openspec/changes/archive/YYYY-MM-DD-<name>
```text
c. **Track outcome** for each change:
- Success: archived successfully
- Failed: error during archive (record error)
- Skipped: user chose not to archive (if applicable)
1. **Display summary**
Show final results:
```text
## Bulk Archive Complete
Archived 3 changes:
- schema-management-cli -> archive/2026-01-19-schema-management-cli/
- project-config -> archive/2026-01-19-project-config/
- add-oauth -> archive/2026-01-19-add-oauth/
Skipped 1 change:
- add-verify-skill (user chose not to archive incomplete)
Spec sync summary:
- 4 delta specs synced to main specs
- 1 conflict resolved (auth: applied both in chronological order)
```text
If any failures:
```text
Failed 1 change:
- some-change: Archive directory already exists
```text
## Conflict Resolution Examples
Example 1: Only one implemented
```text
Conflict: specs/auth/spec.md touched by [add-oauth, add-jwt]
Checking add-oauth:
- Delta adds "OAuth Provider Integration" requirement
- Searching codebase... found src/auth/oauth.ts implementing OAuth flow
Checking add-jwt:
- Delta adds "JWT Token Handling" requirement
- Searching codebase... no JWT implementation found
Resolution: Only add-oauth is implemented. Will sync add-oauth specs only.
```text
Example 2: Both implemented
```text
Conflict: specs/api/spec.md touched by [add-rest-api, add-graphql]
Checking add-rest-api (created 2026-01-10):
- Delta adds "REST Endpoints" requirement
- Searching codebase... found src/api/rest.ts
Checking add-graphql (created 2026-01-15):
- Delta adds "GraphQL Schema" requirement
- Searching codebase... found src/api/graphql.ts
Resolution: Both implemented. Will apply add-rest-api specs first,
then add-graphql specs (chronological order, newer takes precedence).
```text
**Output On Success**
```text
## Bulk Archive Complete
Archived N changes:
- <change-1> -> archive/YYYY-MM-DD-<change-1>/
- <change-2> -> archive/YYYY-MM-DD-<change-2>/
Spec sync summary:
- N delta specs synced to main specs
- No conflicts (or: M conflicts resolved)
```text
**Output On Partial Success**
```text
## Bulk Archive Complete (partial)
Archived N changes:
- <change-1> -> archive/YYYY-MM-DD-<change-1>/
Skipped M changes:
- <change-2> (user chose not to archive incomplete)
Failed K changes:
- <change-3>: Archive directory already exists
```text
**Output When No Changes**
```text
## No Changes to Archive
No active changes found. Use `/opsx:new` to create a new change.
```text
**Guardrails**
- Allow any number of changes (1+ is fine, 2+ is the typical use case)
- Always prompt for selection, never auto-select
- Detect spec conflicts early and resolve by checking codebase
- When both changes are implemented, apply specs in chronological order
- Skip spec sync only when implementation is missing (warn user)
- Show clear per-change status before confirming
- Use single confirmation for entire batch
- Track and report all outcomes (success/skip/fail)
- Preserve .openspec.yaml when moving to archive
- Archive directory target uses current date: YYYY-MM-DD-<name>
- If archive target exists, fail that change but continue with others
1---2name: openspec-bulk-archive-change-33description: Archive multiple completed changes at once. Use when archiving several parallel changes.4license: MIT5---67Archive multiple completed changes in a single operation.89This skill allows you to batch-archive changes, handling spec conflicts intelligently by checking the codebase to determine what's actually implemented.1011**Input**: None required (prompts for selection)1213## Steps14151. **Get active changes**1617 Run `openspec list --json` to get all active changes.1819 If no active changes exist, inform user and stop.20211. **Prompt for change selection**2223 Use **AskUserQuestion tool** with multi-select to let user choose changes:24 - Show each change with its schema25 - Include an option for "All changes"26 - Allow any number of selections (1+ works, 2+ is the typical use case)2728 **IMPORTANT**: Do NOT auto-select. Always let the user choose.29301. **Batch validation - gather status for all selected changes**3132 For each selected change, collect:3334 a. **Artifact status** - Run `openspec status --change "<name>" --json`35 - Parse `schemaName` and `artifacts` list36 - Note which artifacts are `done` vs other states3738 b. **Task completion** - Read `openspec/changes/<name>/tasks.md`39 - Count `- [ ]` (incomplete) vs `- [x]` (complete)40 - If no tasks file exists, note as "No tasks"4142 c. **Delta specs** - Check `openspec/changes/<name>/specs/` directory43 - List which capability specs exist44 - For each, extract requirement names (lines matching `### Requirement: <name>`)45461. **Detect spec conflicts**4748 Build a map of `capability -> [changes that touch it]`:4950 ```text51 auth -> [change-a, change-b] <- CONFLICT (2+ changes)52 api -> [change-c] <- OK (only 1 change)5354 ```5556 A conflict exists when 2+ selected changes have delta specs for the same capability.57581. **Resolve conflicts agentically**5960 **For each conflict**, investigate the codebase:6162 a. **Read the delta specs** from each conflicting change to understand what each claims to add/modify6364 b. **Search the codebase** for implementation evidence:65 - Look for code implementing requirements from each delta spec66 - Check for related files, functions, or tests6768 c. **Determine resolution**:69 - If only one change is actually implemented -> sync that one's specs70 - If both implemented -> apply in chronological order (older first, newer overwrites)71 - If neither implemented -> skip spec sync, warn user7273 d. **Record resolution** for each conflict:74 - Which change's specs to apply75 - In what order (if both)76 - Rationale (what was found in codebase)77781. **Show consolidated status table**7980 Display a table summarizing all changes:8182```text83 | Change | Artifacts | Tasks | Specs | Conflicts | Status |84 |---------------------|-----------|-------|---------|-----------|--------|85 | schema-management | Done | 5/5 | 2 delta | None | Ready |86 | project-config | Done | 3/3 | 1 delta | None | Ready |87 | add-oauth | Done | 4/4 | 1 delta | auth (!) | Ready* |88 | add-verify-skill | 1 left | 2/5 | None | None | Warn |89```text9091 For conflicts, show the resolution:9293```text94 * Conflict resolution:95 - auth spec: Will apply add-oauth then add-jwt (both implemented, chronological order)96```text9798 For incomplete changes, show warnings:99100```text101 Warnings:102 - add-verify-skill: 1 incomplete artifact, 3 incomplete tasks103```text1041051. **Confirm batch operation**106107 Use **AskUserQuestion tool** with a single confirmation:108109 - "Archive N changes?" with options based on status110 - Options might include:111 - "Archive all N changes"112 - "Archive only N ready changes (skip incomplete)"113 - "Cancel"114115 If there are incomplete changes, make clear they'll be archived with warnings.1161171. **Execute archive for each confirmed change**118119 Process changes in the determined order (respecting conflict resolution):120121 a. **Sync specs** if delta specs exist:122 - Use the openspec-sync-specs approach (agent-driven intelligent merge)123 - For conflicts, apply in resolved order124 - Track if sync was done125126 b. **Perform the archive**:127128 ```bash129 mkdir -p openspec/changes/archive130 mv openspec/changes/<name> openspec/changes/archive/YYYY-MM-DD-<name>131```text132133 c. **Track outcome** for each change:134 - Success: archived successfully135 - Failed: error during archive (record error)136 - Skipped: user chose not to archive (if applicable)1371381. **Display summary**139140 Show final results:141142```text143 ## Bulk Archive Complete144145 Archived 3 changes:146 - schema-management-cli -> archive/2026-01-19-schema-management-cli/147 - project-config -> archive/2026-01-19-project-config/148 - add-oauth -> archive/2026-01-19-add-oauth/149150 Skipped 1 change:151 - add-verify-skill (user chose not to archive incomplete)152153 Spec sync summary:154 - 4 delta specs synced to main specs155 - 1 conflict resolved (auth: applied both in chronological order)156```text157158 If any failures:159160```text161 Failed 1 change:162 - some-change: Archive directory already exists163```text164165## Conflict Resolution Examples166167Example 1: Only one implemented168169```text170Conflict: specs/auth/spec.md touched by [add-oauth, add-jwt]171172Checking add-oauth:173- Delta adds "OAuth Provider Integration" requirement174- Searching codebase... found src/auth/oauth.ts implementing OAuth flow175176Checking add-jwt:177- Delta adds "JWT Token Handling" requirement178- Searching codebase... no JWT implementation found179180Resolution: Only add-oauth is implemented. Will sync add-oauth specs only.181```text182183Example 2: Both implemented184185```text186Conflict: specs/api/spec.md touched by [add-rest-api, add-graphql]187188Checking add-rest-api (created 2026-01-10):189- Delta adds "REST Endpoints" requirement190- Searching codebase... found src/api/rest.ts191192Checking add-graphql (created 2026-01-15):193- Delta adds "GraphQL Schema" requirement194- Searching codebase... found src/api/graphql.ts195196Resolution: Both implemented. Will apply add-rest-api specs first,197then add-graphql specs (chronological order, newer takes precedence).198```text199200**Output On Success**201202```text203## Bulk Archive Complete204205Archived N changes:206- <change-1> -> archive/YYYY-MM-DD-<change-1>/207- <change-2> -> archive/YYYY-MM-DD-<change-2>/208209Spec sync summary:210- N delta specs synced to main specs211- No conflicts (or: M conflicts resolved)212```text213214**Output On Partial Success**215216```text217## Bulk Archive Complete (partial)218219Archived N changes:220- <change-1> -> archive/YYYY-MM-DD-<change-1>/221222Skipped M changes:223- <change-2> (user chose not to archive incomplete)224225Failed K changes:226- <change-3>: Archive directory already exists227```text228229**Output When No Changes**230231```text232## No Changes to Archive233234No active changes found. Use `/opsx:new` to create a new change.235```text236237**Guardrails**238239- Allow any number of changes (1+ is fine, 2+ is the typical use case)240- Always prompt for selection, never auto-select241- Detect spec conflicts early and resolve by checking codebase242- When both changes are implemented, apply specs in chronological order243- Skip spec sync only when implementation is missing (warn user)244- Show clear per-change status before confirming245- Use single confirmation for entire batch246- Track and report all outcomes (success/skip/fail)247- Preserve .openspec.yaml when moving to archive248- Archive directory target uses current date: YYYY-MM-DD-<name>249- If archive target exists, fail that change but continue with others