| name | openspec-bulk-archive-change |
| description | Archive multiple completed changes at once. Use when archiving several parallel changes. |
| allowed-tools | Bash(openspec:*) |
| license | MIT |
| compatibility | Requires openspec CLI. |
| metadata | {"author":"openspec","version":"1.0","generatedBy":"1.11.0"} |
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.
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.
<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.
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
Ask the user to choose changes (multi-select):
- 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.
Load current archive inputs once for the selected root before batch validation:
Choose one selected change from this root and run
openspec instructions archive --change "<selected-change>" --json with the
same selected-root flags. This lookup is advisory and optional: it only supplies
extra prompt inputs, so it must never block the batch. If it fails or returns
invalid JSON — for example on an older CLI that does not support this command
yet — continue the batch with no context and no operation guidance. Do not
report an error and do not stop.
A valid response may omit context and operationGuidance. Treat
context as a required prompt-level input across the batch: read and consider
it, and apply relevant project facts, conventions, and constraints. Treat
operationGuidance as optional additive advice: read and consider every
entry, and follow entries that are applicable and compatible with the built-in
batch workflow.
Keep both fields separate from conflict analysis, explicit user choices,
resolved paths, CLI checks, and command contracts. If context conflicts with one
of those controlling inputs, report the conflict and preserve the controlling
value. If guidance is inapplicable or conflicts with a controlling input, do not
follow it and explain why. Do not infer skipped prompts, replacement paths, or
flags from either field, and do not copy their text verbatim into specs, changes,
or summaries. These are prompt-level behavior contracts, not enforceable checks.
-
Batch validation - gather status for all selected changes
For each selected change, collect:
a. Artifact status - Run openspec status --change "<name>" --json
- Parse
schemaName, artifacts, planningHome, changeRoot, artifactPaths, and actionContext
- Note which artifacts are vs other states
Conflict Resolution Examples
Example 1: Only one implemented
Conflict: <planningHome.root>/openspec/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.
Example 2: Both implemented
Conflict: <planningHome.root>/openspec/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).
Output On Success
## Bulk Archive Complete
Archived N changes:
- <change-1> -> archive/<target-name-1>/
- <change-2> -> archive/<target-name-2>/
Spec sync summary:
- N delta specs synced to main specs
- No conflicts (or: M conflicts resolved)
Output On Partial Success
## Bulk Archive Complete (partial)
Archived N changes:
- <change-1> -> archive/<target-name-1>/
Skipped M changes:
- <change-2> (user chose not to archive incomplete)
Failed K changes:
- <change-3>: Archive directory already exists
Output When No Changes
## No Changes to Archive
No active changes found. Create a new change to get started.
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
- Never archive after the user cancels the confirmation — a cancelled batch archives nothing
- Track and report all outcomes (success/skip/fail)
- Preserve .openspec.yaml when moving to archive
- Archive directory target uses current date: YYYY-MM-DD-; a name that already starts with a
YYYY-MM-DD- prefix is used as-is (never stack a second date)
- If archive target exists, fail that change but continue with others
- If sync is requested, run the
openspec-sync-specs workflow inline (agent-driven) for each change with included delta specs
- Carry the per-delta
includedDeltas and excludedDeltas decisions into execution; sync and verify only included deltas
- Report every excluded delta as
sync skipped without treating the archive itself as skipped
- Never archive a change while a spec sync is still in flight — run the sync inline and verify main specs at
<planningHome.root>/openspec/specs/<capability-path>/spec.md before moving changeRoot
- Fetch archive inputs once per selected root before spec inspection or moves
- Fetch all required specs-rule snapshots before the batch's first main-spec write or move
- A failed archive-inputs lookup never blocks the batch; it proceeds with no context or guidance
- A failed specs instruction lookup stops the whole batch atomically
- Changes without concrete
artifactPaths.specs.existingOutputPaths continue without spec sync
- Apply relevant runtime context across the batch and report conflicts
- Operation guidance remains advisory; consider every entry and explain rejected advice
- Keep runtime inputs, conflict analysis, CLI-derived values, and artifact rules separate
- Artifact rules constrain only written specs
- Never copy runtime input or artifact-rule text verbatim into output files