/dev-process-toolkit:spec-archive <ULID, tracker ID, tracker URL, or M<N>> [--plan-only] [--parked] | --backfill-milestone-labels [--apply | --dry-run]from dev-process-toolkit
Manually archives user-selected FRs or milestones by git mv into spec archive directories with a diff approval gate. Accepts ULID, tracker ID/URL, or milestone token.
Ships in dev-process-toolkit. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Archive the user-selected FR(s) identified by $ARGUMENTS. This is the escape hatch for situations /implement Phase 4 auto-archival can't reach. It never scans the spec files for completed milestones or checked-box ACs — the caller must name what to archive.
Before any other step:
docs/patterns.md § Tracker Mode Probe). If CLAUDE.md has no ## Task Tracking section, mode is none. Tracker-mode /spec-archive still operates only on local specs/ content — archival of completed tracker tickets is the tracker's own concern.Call buildResolverConfig(claudeMdPath, adaptersDir) from adapters/_shared/src/resolver_config.ts once at entry, then pass the result to resolveFRArgument($ARGUMENTS, config) from adapters/_shared/src/resolve.ts. Malformed adapter metadata surfaces as MalformedAdapterMetadataError → NFR-10 canonical refusal.
ulid → archive that single FR (step 1).tracker-id / url → branch on mode: tracker mode uses findFRPathByTrackerRef(specsDir, trackerKey, trackerId) (path-returning, no id: requirement); mode: none uses findFRByTrackerRef(specsDir, trackerKey, trackerId) (ULID-returning). The tracker-mode helper is the canonical lookup — findFRByTrackerRef would always miss in tracker mode (no id: line) and trigger the refuse branch below against an FR that exists on disk.
"No local FR mapped to <tracker>:<id>. Archival never auto-imports. To dismiss the tracker ticket, close it in the tracker directly." Exit non-zero. No side effects. /spec-archive never auto-imports.fallthrough and $ARGUMENTS matches the shared milestone-token grammar (M<N> or Epic-keyed M_<epic-key>) → batch archival of every FR with milestone == <token> plus the plan file (step 1). /spec-archive M12 is the canonical group form.fallthrough otherwise → refuse and prompt the user for a valid ULID / tracker ref / milestone token (NFR-18).AmbiguousArgumentError → surface per NFR-10 with the <tracker>:<id> disambiguation remedy; exit non-zero.Full decision table: docs/resolver-entry.md.
Archival uses the same code path as /implement Phase 4. The milestone-binding assertion below is FR-backed scope only: it iterates exactly the FR files being archived and their tracker: bindings — it never enumerates the tracker board and never fetches a ticket that has no FR; bugs and ad-hoc tickets are out of scope by construction.
Single-FR archival (argument resolved to one ULID):
Provider.filenameFor(spec). Verify status: active or status: in_progress.Provider.releaseLock call.project_milestone: true). Before any move, call assertMilestoneBindingAtArchive(provider, project, frFile, { projectRoot, mode }) from adapters/_shared/src/assert_milestone_binding_at_archive.ts: it fetches the FR's bound ticket and verifies the adapter-aware milestone binding — all three kinds the helper handles (object → an identifier-keyed M_<key> milestone derives projectMilestone.id forward to the token, a grandfathered numeric M<N> byte-equals the plan-heading canonical name; epic → the ticket's parent key sanitizes back to the Epic-keyed milestone token, degrading to the label surface for grandfathered numeric milestones; label → labels contains milestone-<M-token>) — attaching once on a miss. Vacuous under mode: none, on capability-gap adapters, or when the plan file is absent. A refused outcome refuses the archive with the NFR-10 canonical shape naming the ticket, the expected binding, which of the gate's SIX causes fired, and the remedy that fits THAT cause. Surface the refusal's own remedy verbatim. Do not substitute a generic "run /spec-archive --backfill-milestone-labels, or attach the milestone manually" line: it is wrong on three of the six causes and dangerous on two of them — when the ticket fetch failed, or when the post-attach re-read failed, nothing is known to be missing and a manual attach invites a DUPLICATE WRITE. "The single attach attempt did not land" is likewise only one cause of six — the FR stays status: active and no git mv fires.git mv specs/frs/<name> specs/frs/archive/<name> using the Provider.filenameFor(spec) base — stem preserved across the move. Archival never renames.status: active → status: archived; set archived_at: <ISO now>. Precision: full ISO-8601 with date + time + Z (e.g., 2026-04-30T17:23:11Z); not date-only with zeroed time. Render the wall-clock instant via date -u +%Y-%m-%dT%H:%M:%SZ, never the shorter date +%Y-%m-%d form (it rounds to midnight UTC, which an earlier smoke caught as a regression shape).rewriteArchiveLinks(repoRoot, frId) from adapters/_shared/src/spec_archive/rewrite_links.ts. It scans specs/requirements.md, every specs/plan/*.md, every specs/plan/archive/*.md, and CHANGELOG.md (scoped to lines above the first dated ## [X.Y.Z] — YYYY-MM-DD header — released sections are frozen) for frs/<id>.md references and rewrites them to frs/archive/<id>.md. Both Markdown link forms (](frs/<id>.md) and ](./frs/<id>.md)) and bare path mentions are covered. Orphan FRs (no references anywhere) yield an empty rewrite, no error. The rewrites land in the same atomic commit as the git mv and frontmatter flip.specs/design/ is immutable across archival — design-reference images under specs/design/ are never git mv'd and never rewritten by rewriteArchiveLinks; only the spec markdown moves, the referenced images stay put.requireCommittableBranch({ commitType: "chore", proposedBranchName, currentBranch, isAutoMode }) from adapters/_shared/src/require_committable_branch.ts with proposedBranchName returned by branchNameFor({ kind: "fr-archive", trackerId }) from skills/spec-archive/branch_name_for.ts (FR archive → chore/archive-<tracker-id>; milestone archive → chore/archive-m<N>; collision-suffix per STE-228 AC-STE-228.11). On created / edited the gate runs git checkout -b <branchName> so the archive commit lands on the new branch; declined rolls back staging via git reset HEAD <paths> (explicit list, never --hard) and exits non-zero; no-op (off-trunk OR commitType ∈ TRUNK_OK_TYPES = ["ci"]) is silent. Auto-mode default-apply uses the <dpt:auto-approve>v1</dpt:auto-approve> marker per STE-226. See STE-228 § Branch-name canonical table for the full builder catalogue.Provider.releaseLock(<ulid>). In tracker mode this transitions the ticket to done; in tracker-less mode it removes the in-flight lock file. No lock is released before the archive commit exists; a failed archive commit leaves the lock held.Milestone-group archival (argument is M<N>):
specs/frs/*.md for milestone == M<N>. If the match set is empty, branch to plan-only archival (STE-200 AC-STE-200.1, see below); otherwise refuse cleanly with "M<N> has plan with unchecked ACs and no FRs; ambiguous state" only when the plan is present but the auto-detect heuristic does not fire.specs/plan/M<N>.md exists, include git mv specs/plan/M<N>.md specs/plan/archive/M<N>.md — before any FR's link rewrite, so the rewrite computes the plan's FR links from its archived folder and every one resolves.assertMilestoneBindingAtArchive (same helper + arguments as the single-FR path) before that FR's git mv — the milestone binding is verified per FR, not once per batch. On a refused outcome the batch skips only the offending FR — no git mv, no frontmatter flip, no releaseLock for it — reports it with the same NFR-10 detail, and the other FRs proceed.git mv specs/frs/<Provider.filenameFor(spec)> specs/frs/archive/<same-name> + frontmatter flip + traceability-link rewrite (rewriteArchiveLinks(repoRoot, frId)).requireCommittableBranch call as the single-FR path, with proposedBranchName from branchNameFor({ shape: "milestone", milestone }) (chore/archive-m<N>). Then land all N moves + N flips + N rewrites + the optional plan-file move in a single atomic commit. Any error aborts the commit entirely — no partial archival.Provider.releaseLock once per archived FR. No lock is released before the archive commit exists. Then run the Post-Archive Drift Check.Plan-only archival (STE-200 AC-STE-200.1 / AC-STE-200.2 — milestone has zero FRs in specs/frs/):
M<N> is empty AND specs/plan/M<N>.md exists, run the auto-detect heuristic — fire the plan-only branch when any of: (a) plan frontmatter kind: scaffolding (per STE-197), OR (b) every ^- [ ] task checkbox in specs/plan/M<N>.md is [x] (or [deferred]) — the scan is heading-agnostic, so it does not depend on the milestone heading's separator form, OR (c) the operator passed --plan-only explicitly.git mv specs/plan/M<N>.md specs/plan/archive/M<N>.md and flip the plan frontmatter status: active → archived with archived_at: <ISO now> (per STE-197 AC-STE-197.4 — synthesize a frontmatter block for legacy frontmatter-less plans). After the move, call repairArchivedPlanLinks(repoRoot, "specs/plan/archive/M<N>.md") from adapters/_shared/src/spec_archive/rewrite_links.ts: no FR is archived in this run, so rewriteArchiveLinks never fires, and a link written while the plan was active (../frs/archive/<id>.md) breaks one folder deeper. The repair recomputes each FR link that no longer resolves and leaves every resolving link untouched; the repair lands in the same atomic commit.plan_only_archival capability row in the closing summary.--plan-only flag (AC-STE-200.2): forces the plan-only branch when the auto-detect heuristic would not fire (escape hatch for unusual cases). Refuse if FR match set is non-empty — --plan-only is for explicitly-empty cases; mixed usage is operator error. Refuse if specs/plan/M<N>.md does not exist with "No FRs and no plan file for M<N>".
--parked flag (AC-STE-369.4): /spec-archive M<N> --parked additionally writes ship_state: parked into the plan's frontmatter during the archival flip (milestone-group or plan-only — any path that moves the plan file). The +ship_state: parked line renders inside the existing mandatory Diff Preview approval gate — no new prompt. Parking marks the milestone as deliberately unshipped: the plan_ship_coherence gate probe surfaces it as a parked milestones: NOTES row instead of a violation. Unparking happens by shipping.
Exit hints (milestone archival closing line): default runs end Archived. Next: /ship-milestone M<N>; parked runs end Archived (parked). Unpark by shipping: /ship-milestone M<N>; a spanning milestone whose sibling gate refuses — bun run ${CLAUDE_PLUGIN_ROOT}/adapters/_shared/src/sibling_release.ts <projectRoot> specs/plan/archive/M<N>.md M<N> --offer exits 1 — ends Archived. Sibling <sibling> still waiting — ship after it, or ship this half alone: /ship-milestone M<N> --partial when the refusal names a sibling still holding work, taking <sibling> from it; any other refusal is printed as is, in place of a hint. A parked run keeps the parked hint.
Driven runs. Omit this offer when the invocation body carries the driven-run marker: the step it offers was already fixed by the orchestrator that named it. The exit hint is a recommendation to a human, never a gate — the archival, its approval gate and the drift check are untouched — and under a driven run the next actor is the orchestrator, which already holds /ship-milestone, so the default line only restates the chain. Standalone runs still print it, and the parked variant is not this offer: it names an unpark no chain has scheduled, so it renders on every parked run. The sibling-wait variant is not this offer either: it names a --partial no chain has scheduled, so it renders whenever the gate refuses.
Capability tokens (closing summary). Per archived FR, the closing summary MUST emit milestone_label_asserted_at_archive when the milestone-binding assertion passed (binding present, or missing-then-attached) and MUST emit milestone_label_archive_refused when the assertion refused that FR's archive (FR skipped, still status: active; the refusal names which of its six causes fired and carries the remedy that fits that cause — quote it verbatim rather than assuming the attach simply did not land). Exactly one literal backticked token per archived FR; narrative paraphrase is insufficient — /gate-check's closing_summary_capability_keys probe greps the literal.
No skill writes to files under specs/frs/archive/ or specs/plan/archive/ except the frontmatter flip (status / archived_at, plus ship_state under --parked) at move time. Full reference: docs/layout-reference.md § /spec-archive.
specs/technical-spec.md holds ongoing architectural truth, not shippable work. Architectural decisions are marked Superseded-by: FR-<N> in place — that matches the ADR convention (adr.github.io, Nygard) and preserves the decision trail where future implementers look for it. /spec-archive does not edit technical-spec.md. If the user asks to "archive" an ADR, direct them to supersede it in place instead.
--backfill-milestone-labels — one-shot milestone-binding backfill sweep/spec-archive --backfill-milestone-labels sweeps existing FRs whose bound tickets are missing their milestone binding and backfills them. Call backfillMilestoneLabels(provider, project, specsDir, { mode, apply }) from adapters/_shared/src/backfill_milestone_labels.ts: it scans both the active specs/frs/ tree and the archived specs/frs/archive/ tree, keeping only FRs that carry both a tracker: binding and milestone: frontmatter. Each FR's canonical milestone name resolves from its plan-file heading (specs/plan/<M>.md, falling back to specs/plan/archive/<M>.md); the present/missing check is adapter-aware (object binding → an identifier-keyed M_<key> milestone derives projectMilestone.id forward to the token, a grandfathered numeric M<N> byte-equals the canonical name; label binding → the issue's labels contain milestone-<M-token>).
Dry-run by default. Without --apply the sweep writes nothing — it fetches each bound ticket read-only and previews every intended attach as a ticket → milestone row. --dry-run names the default explicitly; pass --apply to perform the attaches. Re-running --apply after a clean sweep is a no-op: every ticket classifies as already-correct and zero writes fire.
Aggregate report. The sweep closes with four count buckets — backfilled (attached this run, or intended in a dry-run), already-correct (binding present, skipped with no write), failed (attach did not land), outOfProject (a Jira FR keyed outside the bound project, skipped with zero tracker calls and reported, never silent) — and, per failed ticket, its id, the expected milestone, and the plan file it maps to, each with the NFR-10 canonical detail (Remedy line). The sweep is best-effort per ticket: one failed attach is recorded and the remaining FRs still process; no partial abort.
Scope + vacuity. FR-backed only: the sweep iterates FR files and their tracker: bindings — it never enumerates the tracker board, so a ticket with no FR (ad-hoc bugs, board-only items) can never be fetched or touched. Under mode: none, or when the adapter declares project_milestone: false, the sweep is vacuous — zero candidates, no tracker call, empty report.
Before any filesystem change, render a diff preview the user can confirm or reject. For single-FR archival:
--- specs/frs/<name> → specs/frs/archive/<name> (git mv; <name> = Provider.filenameFor(spec), stem preserved)
@@ frontmatter @@
-status: active
-archived_at: null
+status: archived
+archived_at: 2026-04-22T15:00:00Z
--- Provider.releaseLock(<ulid>)
+++ (tracker mode: transition_status → done) — return "transitioned" when the ticket was In Progress
+++ (tracker mode: ticket already at canonical Done) — return "already-released" (idempotent; no write)
+++ (tracker-less: rm .dpt/locks/<ulid>) — return "transitioned" when the lock file existed
+++ (tracker-less: no lock file present) — return "already-released" (silent no-op)
For milestone-group archival, list each git mv, each frontmatter flip, each releaseLock, each FR's milestone-binding assertion outcome (present / attached / refused / vacuous — refused FRs render as skipped), and the optional plan-file move explicitly. Do not summarize — the user must be able to read the full plan and confirm or reject. Close the bulk Diff Preview with a single aggregate summary row naming the two releaseLock return counts:
releaseLock summary: <N transitioned, M already-released>
This aggregate is how the bulk path reports which FRs performed a write versus which were already terminal — the count comes free from Provider.releaseLock's return value, so no extra getTicketStatus call is needed (NFR-8 call-budget discipline).
Approval gate: do NOT perform any git mv, frontmatter write, or releaseLock until the user explicitly approves. If the user rejects, asks for changes, or is ambiguous, stop and restart at step 0a with their feedback.
If the user reopens an archived FR (e.g., they discover post-ship rework is needed), the canonical path is to git mv specs/frs/archive/<name> specs/frs/<name> (where <name> is whatever Provider.filenameFor(spec) returns — tracker ID in tracker mode, short-ULID in mode: none) and flip status: archived → status: active with archived_at: null. This is NOT a /spec-archive operation — reopens are performed by the user directly or by /spec-write on the reopened FR. The ULID in frontmatter is stable across open/archive cycles (NFR-15); no revision-suffix mechanism is required.
After the archive move(s) complete, and before the final report, run a two-pass drift check against the live spec files. The drift check is advisory only — it never auto-rewrites narrative and never blocks the archival operation itself.
Grep specs/requirements.md, specs/technical-spec.md, specs/testing-spec.md, and every specs/plan/*.md (excluding specs/plan/archive/**) for the exact identifiers just archived. Search literally for M{N}, FR-{N} (if still referenced by legacy FR numbers in prose), and AC-{N}. patterns (the trailing dot anchors the AC token).
Every hit is an orphan token reference: the live spec names content that no longer lives in the active tree. Pass A findings are high severity. Pass A runs before Pass B and its rows appear first in the unified report so deterministic findings are reviewed before judgment findings.
Read each live spec file in turn with the following brief:
Canary pattern: narrative that labels the project by the archived scope. The load-bearing example is the Flutter dogfood run — archiving the documentation milestones left requirements.md Overview calling the project a "layered documentation set" and Out-of-Scope saying "Code changes — documentation only", while a code milestone was still in flight. Any similar framing — "documentation-only", "docs-only deliverable", "layered X set" where X is the archived scope — is the signal Pass B must catch. Pass B findings are medium severity.
Pass B is inherently subjective; the canary example bounds the judgment but edge cases will vary between runs. False positives are accepted as the cost of catching semantic drift that grep cannot see.
technical-spec.md uses Superseded-by markers, not archival — Pass B flags for this file are advisory only, never push for removal
Merge Pass A and Pass B findings into a single table following Schema I (see specs/technical-spec.md § 3). Pass A rows appear first, then Pass B rows.
| File | Section | Severity | Reason | Suggested action |
|------|---------|----------|--------|------------------|
| requirements.md | §6 Traceability Matrix | high | Orphan row `AC-HG95TZ.2` references archived HG95TZ | Remove row |
| requirements.md | Overview (§1) | medium | "layered documentation set" framing assumes archived scope; contradicts in-flight M5 code milestone | Rewrite Overview to reflect current milestone mix |
Exactly 5 columns in the order File, Section, Severity, Reason, Suggested action. Exactly 2 severity values: high (Pass A) and medium (Pass B).
The Schema I table is the DRIFT report, not the CLOSING report. It is rendered in full inline, right here, at the user-choice gate below — the operator sees every row before choosing — and on the save-for-later path it is written verbatim to specs/drift-{YYYY-MM-DD}.md. It is therefore reference material surfaced inline while the archival runs, not verbatim content the closing report reproduces above the fence: header + separator + one row per finding cannot fit any budget, and a milestone archival routinely finds double figures. The closing status block carries a drift findings: <K> (<H> high, <M> medium) summary: row plus at most the first 3 as first 3 of <K> rows. The total <K> is always stated, so the bound is never a silent truncation. Authoring shape: docs/stage-status-block.md § How a stage FITS.
Empty report: if both passes found nothing, print the literal string No drift detected and continue to the final report without prompting the user.
If the drift report is non-empty, offer the user exactly three choices:
specs/drift-{YYYY-MM-DD}.md for later review. Archival completes; no narrative edits are made.The drift check never blocks the archival operation itself. The archive moves, frontmatter flips, and releaseLock calls are already committed to disk by the time this check runs; the user's choice only governs what happens to the drift report.
Closing summary — the status block. /spec-archive closes with exactly one stage-status-block fence as the LAST thing in its report, with at most 12 lines of prose lead-in above it — the block replaces the narration this contract formerly mandated rather than riding beneath it. Fixed section order, the - (none found) fallback and the caps live in docs/stage-status-block.md; adoption is graded by adapters/_shared/src/stage_block_adoption.ts. Skip this block when the invocation body carries the driven-run marker: the orchestrator drives the next step in the same turn.
stage: spec-archive # then milestone, status, summary, gate, drive, e2e, follow_ups in fixed order — docs/stage-status-block.md
M<N>). Never auto-scan live specs for "done" milestones, checked boxes, or completion heuristics.git mv, frontmatter write, or releaseLock call.specs/technical-spec.md — ADRs use Superseded-by: in place.specs/frs/archive/** or specs/plan/archive/** except the status / archived_at (and ship_state under --parked) frontmatter flip at move time.Provider.releaseLock(id) for every archived FR.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
29 skills in this plugin
/best-practicesManage the project best-practices manifest at `specs/best-practices.yaml`. Add, edit, delete, or list entries cataloguing house best-practices docs with scope globs and topics that feed guidance retrieval into planning and implementation./brainstormSocratic design session for greenfield features with open solution spaces. Clarifies goals one question at a time, proposes 2-3 approaches with tradeoffs, gets design approval, then feeds into /spec-write./debugStructured debugging protocol for failed gate checks, failing tests, unexpected behavior, or a reported bug. Use when /gate-check or /tdd fails and the cause is unclear, or when a reported bug (a symptom, a ticket, a bug FR) needs its cause found and a test that proves the fix. Phases: Root Cause → Pattern Analysis → Hypothesis Testing → Implementation.npx claudepluginhub nesquikm/dev-process-toolkit --plugin dev-process-toolkitOther plugins' skills for the same job