Archive a completed change in the experimental workflow.
-
Verify project board Status=Done before archiving (per project-board-sync.md §2 L7)
Invoke scripts/verify_board_state.py BEFORE doing any archive work. The script queries the GH Project board and exits non-zero if the matching item's Status is not Done. Refuse to archive on non-zero exit — do NOT paraphrase the script's output, cite the exit code (per verification-before-completion.md §4.1.2).
Required env / inputs:
--change-id — the OpenSpec change-id being archived
--owner — GH user/org login owning the project
--project-number — numeric Project V2 ID
--expected-status Done — default for archive workflows
python -m scripts.verify_board_state \
--change-id <name> \
--owner <gh-user-or-org> \
--project-number <N> \
--expected-status Done
Exit-code semantics (stable contract):
0 — Status=Done, proceed.
1 — Status mismatch. Refuse archive: surface the script's stderr to the user and ask them to (a) wait for L1 PR-merged automation to fire, or (b) verify the L2 workflow ran correctly, or (c) manually advance the status if board got drift.
2 — Item not found. Refuse archive: the change-id doesn't match a project item title.
3 — GraphQL/network error. Surface to user and offer one retry.
If scripts/verify_board_state.py is not present (consumer on ai-playbook < v0.10.0): emit a warning and continue (legacy behaviour). New consumers (v0.10.0+) MUST have the script and MUST not bypass.
-
If no change name provided, prompt for selection
Run openspec list --json to get available changes. Use the AskUserQuestion tool to let the user select.
Show only active changes (not already archived).
Include the schema used for each change if available.
IMPORTANT: Do NOT guess or auto-select a change. Always let the user choose.
-
Check artifact completion status
Run openspec status --change "<name>" --json to check artifact completion.
Parse the JSON to understand:
schemaName: The workflow being used
artifacts: List of artifacts with their status (done or other)
If any artifacts are not done:
- Display warning listing incomplete artifacts
- Use AskUserQuestion tool to confirm user wants to proceed
- Proceed if user confirms
-
Check task completion status
Read the tasks file (typically tasks.md) to check for incomplete tasks.
Count tasks marked with - [ ] (incomplete) vs - [x] (complete).
If incomplete tasks found:
- Display warning showing count of incomplete tasks
- Use AskUserQuestion tool to confirm user wants to proceed
- Proceed if user confirms
If no tasks file exists: Proceed without task-related warning.
-
Assess delta spec sync state (informational only — no automated sync in this version)
Check for delta specs at openspec/changes/<name>/specs/. If none exist, proceed without notice.
If delta specs exist:
- Compare each delta spec with its corresponding main spec at
openspec/specs/<capability>/spec.md
- Determine what changes would be applied (adds, modifications, removals, renames)
- Show a combined summary so the user knows what an eventual sync would do.
Future enhancement: a dedicated spec-sync skill is planned for v0.8.0 (per specs/v0.8.0-roadmap.md item 10). For now, archive only does the move + retro — no automated sync is performed.
-
Perform the archive
Create the archive directory if it doesn't exist:
mkdir -p openspec/changes/archive
Generate target name using current date: YYYY-MM-DD-<change-name>
Check if target already exists:
- If yes: Fail with error, suggest renaming existing archive or using different date
- If no: Move the change directory to archive
mv openspec/changes/<name> openspec/changes/archive/YYYY-MM-DD-<name>
-
Chain a retrospective write to retros/<change-id>.md (Gate F deliverable)
Per runbook-bmad-openspec.md §3.1 and §4 + Gate F in §5, every archive MUST chain a retro write. Path: retros/<change-id>.md (relative to the project root). Create the retros/ directory if it does not exist.
-
If a bmad-retrospective skill is available, invoke it via the Skill tool, passing the change-id and the archive path. It produces the retro per the BMAD retrospective format.
-
Otherwise, write a stub markdown directly with the following sections (the human fills them in):
# Retrospective: <change-id>
- **Archived**: YYYY-MM-DD
- **Archive path**: openspec/changes/archive/YYYY-MM-DD-<change-id>/
- **Schema**: <schema-name>
## What worked
<one-paragraph: practices, patterns, decisions that paid off>
## What didn't
<one-paragraph: friction, surprises, rework>
## Lessons
<bulleted: durable lessons; candidates for retention to Hindsight if cross-project>
## Carry-forward to next change
<bulleted: action items, follow-up tickets, spec edits>
If retros/<change-id>.md already exists, do NOT overwrite — append a new dated section instead and warn the user.
-
Display summary
Show archive completion summary including:
- Change name
- Schema that was used
- Archive location
- Whether specs were synced (if applicable)
- Note about any warnings (incomplete artifacts/tasks)