sdd-archive
Merge delta specs to main specs and close the SDD change cycle. Trigger: When archiving changes
- License 许可
- MIT
- 最近更新
- 2026-10-22
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- sdd-archive
- scope
- core
- license
- MIT
- metadata
- { "author": "gentleman-programming", "version": "2.0", "delegate_only": true }
- description
- Merge delta specs to main specs and close the SDD change cycle. Trigger: When archiving changes
- display_name
- SDD Archive
- user-invocable
- false
- disable-model-invocation
- true
02 资源文件 1
- 参考文档apply-progress.md82 B
03 SKILL.md 正文
<!-- Synced from https://raw.githubusercontent.com/Gentleman-Programming/gentle-ai/v1.40.2/internal/assets/skills/sdd-archive/SKILL.md (tag v1.40.2, commit 660917927b4821f5e540dc8fa501d6bee723222c); adapted for Jarvis/Hive runtime semantics. -->
ORCHESTRATOR GATE: If you loaded this skill via the
skill()tool, you are the ORCHESTRATOR — STOP. Do NOT execute these instructions inline. Delegate to the dedicatedsdd-archivesub-agent using your platform's delegation primitive. This skill is for EXECUTORS only.
Executor Override
If you ARE the sdd-archive sub-agent (NOT the orchestrator), the gate above does NOT apply to you. Continue with the phase work below. Do NOT delegate. Do NOT call the Skill tool. You are the executor — execute.
Language Domain Contract
Generated technical artifacts default to English. Do not inherit the user's conversational language or the active persona's regional voice for SDD artifacts unless the user explicitly requests that artifact language or the project convention requires it.
If Spanish technical artifacts are explicitly requested, use neutral/professional Spanish unless the user explicitly asks for a regional variant.
Public/contextual comments follow the target context language by default. Explicit user language or tone overrides win; Spanish comments default to neutral/professional Spanish unless the user or target context clearly calls for regional tone.
Purpose
You are a sub-agent responsible for ARCHIVING. jarvis sdd archive --root <change-root> --destination <archive-destination> is the canonical archive operation: it accepts no positional change name, validates lifecycle state, merges delta specs into main specs, and moves the complete OpenSpec topology when the selected store requires it. Do not replace it with ad-hoc file copies, spec edits, or moves. It exits non-zero and moves nothing when a lifecycle gate blocks archive. You complete the SDD cycle only after implementation and verification evidence is complete, current, and safe.
Archive outcomes are explicit: archived only after every gate and topology check passes; blocked with typed recovery when status, evidence, verification, or storage state is unsafe; and inline closure only in none mode. A blocked outcome never performs a partial spec sync, partial move, or evidence repair.
What You Receive
From the orchestrator:
- Change name
- Artifact store mode (
hive | openspec | hybrid | none) - Structured status from
jarvis sdd status <change> --json, schema:jarvis.sdd-status - Status fields including
blockedReasons,taskProgress,applyState,artifacts,artifactPaths,contextFiles,actionContext, andphaseInstructions - Verify evidence exposed through
artifacts["verify-report"],artifactPaths["verify-report"],contextFiles["verify-report"], and/or explicit verify-report artifact content
Execution and Persistence Contract
Follow Section B (retrieval) and Section C (persistence) from
skills/_shared/sdd-phase-common.md.
- hive: Resolve v2 progress with
sdd_apply_progress_get, then iterate the guarded snapshot's references withsdd_apply_evidence_getto read one canonical bounded batch perbatch_id; do not select a latest generic observation. Read the normal SDD artifacts and record observation IDs in the archive report for traceability. Save the archive report assdd/{change-name}/archive-reportwithmcp__hive__mem_save; that complete executor-written report is Hive logical closure. - openspec: Read and follow
skills/_shared/openspec-convention.md.jarvis sdd archive --root <change-root> --destination <archive-destination>performs canonical spec synchronization and the validated rename of the complete change topology under one archive lock, only after the status gate passes. This CLI command does not infer or accept a positional change name. - hybrid: Both independently validated backends are required. The archived OpenSpec directory retains
apply-progress.md, referencedapply-evidence/documents, and.apply-progress-receipts/together; Hive retains resolvable guarded snapshot/evidence topics and the archive-report observation. Neither side is a winner, and a missing or different side isbackend_diverged, not archiveable. - none: Return closure summary only. Do not perform archive file operations and do not persist an archive report. For
nonemode, return a closure summary only; do not persist an archive report.
Resolve or adopt the immutable project/change binding before selecting an archive backend. A persisted hive, openspec, or hybrid binding wins over JARVIS_SDD_STORE_MODE; none is never persisted. Hive binding belongs in SQLite, OpenSpec binding belongs in openspec/changes/{change-name}/state.yaml, and hybrid requires matching copies. Treat unavailable/protocol failure as distinct from absence. Malformed, unsupported, noncanonical, divergent, or protected-progress state blocks; hybrid never chooses a copy as a winner.
Status and Archive Safety Gate
Before syncing specs, moving folders, or writing an archive report: Apply the Native Status Gate from _shared/sdd-phase-common.md to the forwarded status; run jarvis sdd status <change> --json yourself only when no status was forwarded; STOP on any gate failure. Gate phase: sdd-archive; dependencies["sdd-archive"] must be exactly ready, except that all_done is acceptable only when the prepared archive report is present.
- Read
blockedReasons,taskProgress,applyState,artifacts,artifactPaths,contextFiles,actionContext, andphaseInstructions. - Locate verify evidence via
artifacts["verify-report"],artifactPaths["verify-report"],contextFiles["verify-report"], and/or explicit verify-report artifact content. There is no top-level verify report status field. - When reading legacy apply-progress, treat only an exact
status: completemarker as explicit completion. Any other marker, unknown, malformed, conflicting, or unmarked progress is incomplete unless structured status classified an unmarked artifact as done from deterministic all-complete task evidence. Legacy history is read-only during archive. - For
jarvis.sdd-apply-progress/v2, resolve the canonical snapshot and its exact referenced immutable evidence batches in snapshot order. Requiredoneprogress (neversuperseded), matching identities, hashes, task-manifest coverage, and final serialized documents at or below 40,000 Unicode runes; orphaned or cumulative observations are never evidence. Historical completed v2 changes remain archiveable. Recheck readiness under the archive lock before moving any topology. - Any
continuation_required,evidence_item_too_large,snapshot_capacity_exhausted,lock_busy,legacy_upgrade_required,project_mismatch, conflict, migration, orbackend_divergedresult is incomplete: fail closed, preserve the topology unchanged, and return its typed recovery direction. Do not merge, rewrite, or repair evidence during archive. - Every archive edit, spec merge, and folder move must stay inside
actionContext.allowedEditRoots; never move workspace changes into repo-local archives or edit linked repositories. If an edit would escape them, STOP.
Verification Gate
- Archive reads only the canonical active verify-report contract: exactly one
## Verdict,## Critical Findings, and## Blockerssection.PASSorPASS WITH WARNINGSis archive-ready only witharchive ready, zero critical findings, andBlockers: None(including normalized**None**or_None_). - A static-mode report (
Verification mode: static) with**PASS WITH WARNINGS — archive ready.**is archive-ready: itsno test runner: static review onlywarning andstatic-reviewedscenarios are expected, so never block archive for runtime evidence that cannot exist. - Do not infer readiness from historical narrative, archived-style reports, YAML, or prose. Missing/duplicate headings, missing fields, or a missing marker fail closed with
regenerate_with_sdd_verify; return that typed recovery code and re-runsdd-verify. - If verify-report evidence is missing, failing, stale, or does not cover the current artifacts, STOP and return
blocked; archive cannot proceed when verify-report evidence is missing/failing/stale. - Unresolved CRITICAL verification findings always block archive. Do not accept overrides for unresolved CRITICAL findings.
- If verify evidence references older artifact IDs, an older task state, or a different apply-progress state, treat the report as stale and STOP.
- Partial, missing, or stale artifacts block archive until they are reconciled and re-verified.
Task Completion Gate
sdd-apply is responsible for marking completed tasks in the persisted tasks artifact. sdd-archive validates that the persisted artifact reflects the final state before closing the cycle.
Before syncing specs or moving any archive folder, inspect the tasks artifact:
- hive: read the full
sdd/{change-name}/tasksobservation. - openspec/hybrid: read
openspec/changes/{change-name}/tasks.md. - status: compare the artifact with
taskProgressfromjarvis.sdd-status.
Any incomplete task checkbox or taskProgress entry blocks archive. STOP and return blocked; do not sync specs, move the change folder, or claim the SDD cycle is complete.
Stale checkboxes are not archive-ready by themselves. applyState.hasProgress means the apply-progress artifact exists, while applyState.complete means canonical apply-progress is complete and authoritative task checkboxes are all checked; verify-report remains a separate archive dependency. If checkboxes, taskProgress, applyState, apply-progress, or verify-report evidence disagree, STOP and report that sdd-apply and sdd-verify must reconcile the persisted artifacts before archive. Do not mark archive-ready based only on stale checkboxes, internal todos, or conversation claims.
When prior apply-progress = partial exists, STOP until current tasks, apply-progress, and verify-report have been reconciled and re-verified. When the validated v2 snapshot lifecycle is incomplete, STOP until current tasks, progress topology, and verify-report have been reconciled and re-verified. Incomplete progress means archive must wait for reconciliation and verification, even if checkboxes look complete.
A superseded predecessor cannot be archived, even if its old tasks were complete. Use jarvis sdd supersede --change <predecessor> --successor <successor> --actor <actor> --reason <reason> for a bound partial predecessor, not archive. New seals require --actor and --reason; strict predecessor and successor preflight precedes consent. Signed credited tasks require typing the exact successor name; zero credit skips the prompt only after preflight. Retry with the same successor and omitted attribution flags or their exact signed values. The seal preserves the predecessor's original manifest and immutable history; fresh successor progress starts at generation 1/revision 1 without transferred credit. Hybrid publication is not distributed-atomic: replay exact signed intent on retry, never choose a backend winner. Consent is not archive authority; never archive the predecessor.
Archive does not provide a completion override path. Missing, partial, or stale tasks/apply-progress/verify-report artifacts must be reconciled by the appropriate prior phase and verified again before archive continues.
What to Do
Step 1: Load Skills
Follow Section A from skills/_shared/sdd-phase-common.md.
Step 2: Read Archive Context
Read status-provided contextFiles / artifactPaths instead of assuming fixed filenames when they are available. Then read the proposal, spec, design, tasks, verify-report, and apply-progress if present. Follow skills/_shared/apply-progress.md for canonical v2 apply-progress validation. Archive only from source-of-truth artifacts, not generated user-machine outputs.
Step 3: Prepare Verification and Archive Report
Produce the current verification evidence and archive report before invoking jarvis sdd archive.
- The verification report must already be passing, current, and tied to the validated tasks and apply-progress topology; do not create or repair verification evidence during the archive move.
- The archive-report must be complete and executor-written. It is the Hive logical-closure artifact; do not introduce a typed closure API, closure state, or archive receipt.
- For
openspecandhybrid, write the archive report in the change root before the command. Forhiveandhybrid, save the same report before the command withmcp__hive__mem_save, artifactarchive-report, topic_key:sdd/{change-name}/archive-report, and type:architecture. - Hybrid requires byte-identical and non-blank archive reports plus equivalent protected progress on both sides. Revalidate both immediately under the local archive lock; never choose one copy or claim distributed atomicity. Hive writes after the final Hive fetch are outside that local lock.
- The report must record status inputs used for the archive decision:
taskProgress,applyState,artifacts["verify-report"],artifactPaths["verify-report"],contextFiles["verify-report"], verify-report artifact content verdict/staleness, whether apply-progress was present or partial, and reconciliation/re-verification evidence. - For
none, return the closure summary inline only; do not write or persist an archive report.
Step 4: Sync Delta Specs to Main Specs
IF mode is hive: Skip filesystem sync — artifacts live in Hive only. The archive report records all observation IDs for traceability.
IF mode is none: Skip — no artifacts to sync.
IF mode is openspec or hybrid: Run jarvis sdd archive --root <change-root> --destination <archive-destination>; it syncs the active openspec/changes/{change-name}/specs/ into openspec/specs/ itself. Never hand-edit, copy, merge, or roll back main specs yourself.
- Under the archive lock and after the status gate, the command plans every delta read-only, then writes every main spec with before-digest checks or none. Unsupported delta structure or invalid merge evidence blocks the whole sync before any write. Non-requirement
##sections in a delta (for example notes) are ignored, listed inignored_sections, and never merged. - It prints one JSON result:
outcome(archived,planned, orblocked),code,detail,recovery,destination, andspec_syncwith per-capabilitypath,action(created/updated), added/modified/removed/renamed requirement names,ignored_sections,before_digest, andafter_digest. - Add
--planfirst only if the user wants to see the plan; it prints the plan and writes and moves nothing. - If
codeisspec_sync_confirmation_required, the plan removes requirements. Show the listedspec_sync.removalsto the user once, and rerun the same command with--confirm-destructiveonly after the user explicitly confirms. Never add--confirm-destructivewithout that confirmation. - For any other
spec_sync_*code (spec_sync_merge_blocked,spec_sync_plan_failed,spec_sync_conflict_recovery_required,spec_sync_write_failed,spec_sync_recovery_required), returnblockedand report the code,detail,recovery, and anyspec_sync.recovery_targetsverbatim. Nothing was moved; do not repair specs or work around the blocker.
Step 5: Move to Archive
IF mode is hive or none: Skip filesystem movement. Hive retains its already-persisted archive report; none has only the inline closure.
IF mode is openspec or hybrid: The same locked jarvis sdd archive --root <change-root> --destination <archive-destination> invocation moves the change only after every synced main-spec digest verifies:
openspec/changes/{change-name}/
→ openspec/changes/archive/YYYY-MM-DD-{change-name}/
The command validates reports and moves the complete OpenSpec topology: the snapshot, every referenced immutable evidence document, receipts, verification report, and archive report. Source and destination must both be inside actionContext.allowedEditRoots; the destination must not resolve to the source root. It re-reads proposal, design, specs, tasks, verify report, archive report, progress, receipts, evidence, and dependencies under the archive lock immediately before rename. In hybrid mode, repeat byte-identical non-blank archive-report and equivalent protected-progress validation under that lock before rename. This local lock is not distributed atomicity; Hive writes after the final Hive fetch are outside it. Reject a symlink in any existing source, destination, parent, staging, or authoritative path; do not repair it during archive. Deterministic staging may be finalized only by the byte-identical exact retry, while anonymous, malformed, changed, or symlinked residue remains fail closed. Use today's date in ISO format (e.g., 2026-02-16). Do not persist or rewrite an archive report after this command.
If the move fails after a verified sync, the command reverts every main spec to its captured pre-sync bytes, never overwriting a concurrent edit, and returns archive_recovery_required with spec_sync.reverted: true; a spec it cannot safely restore yields spec_sync_recovery_required with recovery_targets. Report the code and recovery verbatim, do not claim cycle completion, and rerun only after the cause is fixed. Main specs are never silently partial. A rerun after an interrupted archive resumes from the change's .spec-sync-journal.json instead of merging already-synced main specs again.
Step 6: Verify Archived Topology
IF mode is openspec or hybrid: Confirm:
- [ ] Main specs updated correctly
- [ ] Change folder moved to archive
- [ ] Archive contains all artifacts (proposal, specs, design, tasks, verify-report, archive-report, canonical snapshot, referenced evidence, and receipts)
- [ ] Archived
tasks.mdhas no unchecked implementation tasks - [ ] No incomplete validated progress topology remains unreconciled
- [ ] Active changes directory no longer has this change
IF mode is hive: Confirm the already-persisted archive report records all artifact observation IDs, the tasks observation has no unchecked implementation tasks, taskProgress is complete, apply-progress is reconciled, and verify-report is current and passing.
IF mode is none: Skip verification — no persisted artifacts.
Step 7: Return Summary
Return to the orchestrator:
## Change Archived
**Change**: {change-name}
**Archived to**: `openspec/changes/archive/{YYYY-MM-DD}-{change-name}/` (openspec/hybrid) | Hive archive report (hive) | inline (none)
### Archive Safety Status
| Check | Result | Evidence |
|-------|--------|----------|
| taskProgress | Complete | {status/artifact reference} |
| tasks artifact | Complete | {N}/{N} tasks complete |
| applyState | Reconciled | {state} |
| verify-report evidence | Passing and current | {artifact state/id/path/content reference} |
| CRITICAL findings | None unresolved | {summary} |
### Specs Synced
| Domain | Action | Details |
|--------|--------|---------|
| {domain} | Created/Updated | {N added, M modified, K removed, R renamed requirements} |
### Archive Contents
- proposal.md ✅
- specs/ ✅
- design.md ✅
- tasks.md ✅ ({N}/{N} tasks complete)
- verify-report.md ✅ (passing/current)
- archive report ✅ (prepared before archive and retained with the topology)
### Source of Truth Updated
The following specs now reflect the new behavior:
- `openspec/specs/{domain}/spec.md`
### SDD Cycle Complete
The change has been fully planned, implemented, verified, and archived.
Ready for the next change.
Rules
- ALWAYS pass the Native Status Gate before archive; do not infer archive readiness from conversation alone.
- NEVER archive a change that has unresolved CRITICAL issues in its verification report.
- NEVER archive when the verify report is missing, failing, stale, or does not cover current artifacts.
- NEVER archive when implementation tasks are incomplete in task checkboxes or
taskProgress. - NEVER treat stale checkboxes, internal todos, or conversation claims as archive-ready evidence.
- NEVER archive when validated progress is incomplete until tasks, progress topology, and verify-report are reconciled and re-verified.
- NEVER fix archive readiness by editing generated artifacts; update source-of-truth Jarvis assets/templates or persisted SDD artifacts only.
- NEVER use user/orchestrator approval to archive with partial, missing, stale, or unreconciled artifacts; block and require reconciliation plus re-verification instead.
- In
nonemode, return closure status inline only; do not persist an archive report. - ALWAYS let
jarvis sdd archiveperform the spec sync and the locked move together; spec synchronization is either fully verified or rolled back/fail-closed, never silently partial. NEVER hand-edit main specs. - When merging into existing specs, PRESERVE requirements not mentioned in the delta.
- Use ISO date format (YYYY-MM-DD) for archive folder prefix.
- If archive returns
spec_sync_confirmation_required, show the listed removals once and rerun with--confirm-destructiveonly after explicit 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.archivefromopenspec/config.yaml. - Return envelope per Section D from
skills/_shared/sdd-phase-common.md.
04 同仓库更多 Skills
work-unit-commits
Plan commits as reviewable work units. Trigger: implementation, commit splitting, chained PRs, or keeping tests and docs with code.
skill-registry
Create or update the skill registry for the current project. Scans user skills and project conventions, writes .jarvis/skill-registry.md, and saves to Hive if available. Trigger: When user says "update skills", "skill registry", "actualizar skills", "update registry", or after installing/removing skills.
skill-improver
Trigger: improve skills, audit skills, refactor skills, skill quality. Audit and upgrade existing LLM-first skills safely.
skill-creator
Trigger: new skills, agent instructions, documenting AI usage patterns. Create LLM-first skills with valid frontmatter.
sdd-verify
Verify implementation against specs with structural and behavioral checks. Trigger: When verifying implementation
sdd-tasks
Break down a change into a concrete, ordered implementation checklist. Trigger: When creating task lists