AGENT SKILL

openspec-archive-change

Archive a completed change in the experimental workflow. Use when the user wants to finalize and archive a change after implementation is complete.

License 许可
MIT
最近更新
2026-11-09
Stars
★ 6
Forks
1

01 前言 Front Matter

name
openspec-archive-change
license
MIT
metadata
{ "author": "openspec", "version": "1.0", "generatedBy": "1.3.0" }
description
Archive a completed change in the experimental workflow. Use when the user wants to finalize and archive a change after implementation is complete.
compatibility
Requires openspec CLI.

03 SKILL.md 正文

Archive a completed change in the experimental workflow.

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.

Steps

  1. 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.

  2. 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.

  3. 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
  4. 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.

  5. 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.

    Archive only does the move + retro — no automated sync is performed.

  6. 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>
    
  7. 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.

  8. 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)

Output On Success

## Archive Complete

**Change:** <change-name>
**Schema:** <schema-name>
**Archived to:** openspec/changes/archive/YYYY-MM-DD-<name>/
**Specs:** No automated sync (deferred to v0.8.0 spec-sync skill); delta-spec assessment shown above for human follow-up.
**Retro:** retros/<change-id>.md (stub written / appended)

All artifacts complete. All tasks complete.

Guardrails

  • Always run Step 0 first (project board Status=Done verification) for consumers on ai-playbook v0.10.0+; refuse archive on non-zero exit per project-board-sync.md L7
  • Always prompt for change selection if not provided
  • Use artifact graph (openspec status --json) for completion checking
  • Don't block archive on warnings - just inform and confirm
  • Preserve .openspec.yaml when moving to archive (it moves with the directory)
  • Show clear summary of what happened
  • Always chain the retro write (step 6) — Gate F deliverable per the runbook; never skip silently
  • If delta specs exist, always run the assessment and show the combined summary (informational only until v0.8.0)

04 同仓库更多 Skills

Wizarck
Wizarck/ai-playbook

sweep

Use when the user wants to find code that has quietly stopped being used — types /sweep, asks for a "dead code sweep", "repo entropy", "what can we delete", "orphan files", "unused code", or asks to review a sweep ledger. Adjudicates candidates a deterministic scanner already produced; it never deletes anything and never re-derives findings from raw source. Pairs with ponytail, which gates what gets written rather than what rots.

★ 6
Wizarck
Wizarck/ai-playbook

ponytail

Use when the user wants the laziest solution that actually works — types /ponytail, says "be lazy", "lazy mode", "simplest solution", "minimal solution", "yagni", "do less", or "shortest path", or complains about over-engineering, bloat, boilerplate, or unnecessary dependencies. Supports intensity levels lite, full, ultra (default). Pairs with caveman, which compresses prose, not code.

★ 6
Wizarck
Wizarck/ai-playbook

ponytail-review

Use when the user wants a code review focused exclusively on over-engineering — says "review for over-engineering", "what can we delete", "is this over-engineered", "simplify review", or invokes /ponytail-review. Complements correctness/security review; this one only hunts complexity in the current diff. Gated by the ponytail review_ponytail component.

代码审查
★ 6
Wizarck
Wizarck/ai-playbook

ponytail-debt

Use when the user wants to harvest every `ponytail:` comment in the codebase into a tracked debt ledger — says "ponytail debt", "/ponytail-debt", "what did ponytail defer", "list the shortcuts", "ponytail ledger", or "what did we mark to do later". One-shot report, changes nothing. Gated by the ponytail debt_ponytail component.

★ 6
Wizarck
Wizarck/ai-playbook

ponytail-audit

Use when the user wants a whole-repo audit for over-engineering — says "audit this codebase", "audit for over-engineering", "what can I delete from this repo", "find bloat", or invokes /ponytail-audit. Like ponytail-review but scans the entire tree, not a diff. One-shot report, applies no fixes. Gated by the ponytail audit_ponytail component.

★ 6
Wizarck
Wizarck/ai-playbook

openspec-propose

Propose a new change with all artifacts generated in one step. Use when the user wants to quickly describe what they want to build and get a complete proposal with design, specs, and tasks ready for implementation.

★ 6