Skip to main content
The sdd-archive sub-agent completes the SDD cycle by merging delta specs into the main specs (source of truth), then moving the change folder to the archive.

Metadata

string
sdd-archive
string
2.0
string
gentleman-programming
string
MIT

When It’s Triggered

The orchestrator launches sdd-archive when:
  • User runs /sdd-archive <change-name>
  • Verification passed (no CRITICAL issues)
  • Change is ready to be closed

What It Does

Step 1: Sync Delta Specs to Main Specs

For each delta spec in openspec/changes/{change-name}/specs/:

If Main Spec Exists

Reads the existing main spec and applies the delta:
Merge carefully:
  • Match requirements by name (e.g., ”### Requirement: Session Expiration”)
  • Preserve all OTHER requirements that aren’t in the delta
  • Maintain proper Markdown formatting and heading hierarchy

If Main Spec Does NOT Exist

The delta spec IS a full spec (not a delta). Copy it directly:

Step 2: Move to Archive

Moves the entire change folder to archive with date prefix:
Uses today’s date in ISO format (e.g., 2026-03-04).

Step 3: Verify Archive

Confirms:
  • Main specs updated correctly
  • Change folder moved to archive
  • Archive contains all artifacts (proposal, specs, design, tasks, verify-report)
  • Active changes directory no longer has this change

Step 4: Return Summary

Returns a result envelope with archive summary.

Result Envelope Example

Delta Merge Example

Before (openspec/specs/auth/spec.md):
Delta (openspec/changes/add-2fa/specs/auth/spec.md):
After Merge (openspec/specs/auth/spec.md):

Archive Structure

After archiving, the structure looks like:

Rules

  • NEVER archive a change that has CRITICAL issues in its verification report
  • ALWAYS sync delta specs BEFORE moving to archive
  • When merging into existing specs, PRESERVE requirements not mentioned in the delta
  • Use ISO date format (YYYY-MM-DD) for archive folder prefix
  • If the merge would be destructive (removing large sections), WARN the orchestrator and ask for confirmation
  • The archive is an AUDIT TRAIL — never delete or modify archived changes
  • If openspec/changes/archive/ doesn’t exist, create it
  • Apply any rules.archive from openspec/config.yaml
  • Return a structured envelope with: status, executive_summary, detailed_report, artifacts, next_recommended, and risks

Persistence Behavior

OpenSpec Mode

  • Performs full merge and archive operations
  • Writes to openspec/specs/{domain}/spec.md
  • Moves folder to openspec/changes/archive/

Engram Mode

  • Saves archive report with all artifact observation IDs for traceability
  • Topic key: sdd/{change-name}/archive-report
  • Includes links to all previous artifacts (explore, proposal, spec, design, tasks, verify-report)
  • Does NOT modify filesystem

None Mode

  • Returns closure summary inline
  • Does NOT perform file operations