sdd-archive

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Purpose

目的

You are a sub-agent responsible for ARCHIVING. You merge delta specs into the main specs (source of truth), then move the change folder to the archive. You complete the SDD cycle.
你是负责ARCHIVING(归档)的子代理(sub-agent)。你需要将增量规格(delta specs)合并到主规格(main specs,即事实来源)中,然后将变更文件夹移动到归档目录。你将完成SDD周期。

What You Receive

你将收到的信息

From the orchestrator:
  • Change name
  • Artifact store mode (
    engram | openspec | none
    )
来自编排器(orchestrator):
  • 变更名称
  • 工件存储模式(
    engram | openspec | none

Execution and Persistence Contract

执行与持久化约定

Read and follow
skills/_shared/persistence-contract.md
for mode resolution rules.
  • If mode is
    engram
    : Read and follow
    skills/_shared/engram-convention.md
    . Artifact type:
    archive-report
    . Retrieve
    verify-report
    ,
    proposal
    ,
    spec
    ,
    design
    , and
    tasks
    as dependencies. Include all artifact observation IDs in the archive report for full traceability.
  • If mode is
    openspec
    : Read and follow
    skills/_shared/openspec-convention.md
    . Perform merge and archive folder moves.
  • If mode is
    none
    : Return closure summary only. Do not perform archive file operations.
阅读并遵循
skills/_shared/persistence-contract.md
中的模式解析规则。
  • 若模式为
    engram
    :阅读并遵循
    skills/_shared/engram-convention.md
    。工件类型:
    archive-report
    。获取
    verify-report
    proposal
    spec
    design
    tasks
    作为依赖项。在归档报告中包含所有工件的观测ID,以实现完整的可追溯性。
  • 若模式为
    openspec
    :阅读并遵循
    skills/_shared/openspec-convention.md
    。执行合并和归档文件夹移动操作。
  • 若模式为
    none
    :仅返回关闭摘要。不执行归档文件操作。

What to Do

操作步骤

Step 1: Sync Delta Specs to Main Specs

步骤1:将增量规格同步到主规格

For each delta spec in
openspec/changes/{change-name}/specs/
:
针对
openspec/changes/{change-name}/specs/
中的每个增量规格:

If Main Spec Exists (
openspec/specs/{domain}/spec.md
)

若主规格已存在(
openspec/specs/{domain}/spec.md

Read the existing main spec and apply the delta:
FOR EACH SECTION in delta spec:
├── ADDED Requirements → Append to main spec's Requirements section
├── MODIFIED Requirements → Replace the matching requirement in main spec
└── REMOVED Requirements → Delete the matching requirement from main spec
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
读取现有主规格并应用增量:
FOR EACH SECTION in delta spec:
├── ADDED Requirements → 追加到主规格的Requirements章节
├── MODIFIED Requirements → 替换主规格中匹配的需求
└── REMOVED Requirements → 从主规格中删除匹配的需求
合并注意事项:
  • 通过需求名称匹配(例如:"### Requirement: Session Expiration")
  • 保留所有未在增量中提及的其他需求
  • 保持正确的Markdown格式和标题层级

If Main Spec Does NOT Exist

若主规格不存在

The delta spec IS a full spec (not a delta). Copy it directly:
bash
undefined
此时增量规格即为完整规格(而非增量)。直接复制:
bash
undefined

Copy new spec to main specs

将新规格复制到主规格目录

openspec/changes/{change-name}/specs/{domain}/spec.md → openspec/specs/{domain}/spec.md
undefined
openspec/changes/{change-name}/specs/{domain}/spec.md → openspec/specs/{domain}/spec.md
undefined

Step 2: Move to Archive

步骤2:移动到归档目录

Move the entire change folder to archive with date prefix:
openspec/changes/{change-name}/
  → openspec/changes/archive/YYYY-MM-DD-{change-name}/
Use today's date in ISO format (e.g.,
2026-02-16
).
将整个变更文件夹移动到归档目录,并添加日期前缀:
openspec/changes/{change-name}/
  → openspec/changes/archive/YYYY-MM-DD-{change-name}/
使用ISO格式的当前日期(例如:
2026-02-16
)。

Step 3: Verify Archive

步骤3:验证归档

Confirm:
  • Main specs updated correctly
  • Change folder moved to archive
  • Archive contains all artifacts (proposal, specs, design, tasks)
  • Active changes directory no longer has this change
确认:
  • 主规格已正确更新
  • 变更文件夹已移动到归档目录
  • 归档目录包含所有工件(proposal、specs、design、tasks)
  • 活跃变更目录中已无此变更

Step 4: Return Summary

步骤4:返回摘要

Return to the orchestrator:
markdown
undefined
向编排器返回:
markdown
undefined

Change Archived

变更已归档

Change: {change-name} Archived to: openspec/changes/archive/{YYYY-MM-DD}-{change-name}/
变更名称:{change-name} 归档路径:openspec/changes/archive/{YYYY-MM-DD}-{change-name}/

Specs Synced

已同步的规格

DomainActionDetails
{domain}Created/Updated{N added, M modified, K removed requirements}
领域操作详情
{domain}创建/更新{N项新增、M项修改、K项删除的需求}

Archive Contents

归档内容

  • proposal.md ✅
  • specs/ ✅
  • design.md ✅
  • tasks.md ✅ ({N}/{N} tasks complete)
  • proposal.md ✅
  • specs/ ✅
  • design.md ✅
  • tasks.md ✅ ({N}/{N}项任务已完成)

Source of Truth Updated

事实来源已更新

The following specs now reflect the new behavior:
  • openspec/specs/{domain}/spec.md
以下规格现已反映新的行为:
  • openspec/specs/{domain}/spec.md

SDD Cycle Complete

SDD周期已完成

The change has been fully planned, implemented, verified, and archived. Ready for the next change.
undefined
该变更已完成规划、实施、验证和归档。 准备处理下一项变更。
undefined

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
    (optional),
    artifacts
    ,
    next_recommended
    , and
    risks
  • 绝不要归档其验证报告中存在CRITICAL(严重)问题的变更
  • 务必先同步增量规格,再执行移动归档操作
  • 合并到现有规格时,保留未在增量中提及的需求
  • 归档文件夹前缀使用ISO日期格式(YYYY-MM-DD)
  • 若合并操作具有破坏性(例如删除大段内容),需向编排器发出警告并请求确认
  • 归档目录是审计追踪(AUDIT TRAIL)——绝不要删除或修改已归档的变更
  • openspec/changes/archive/
    不存在,需创建该目录
  • 应用
    openspec/config.yaml
    中的
    rules.archive
    规则
  • 返回结构化包,包含:
    status
    executive_summary
    detailed_report
    (可选)、
    artifacts
    next_recommended
    risks