Skill v1.0.0
currentAutomated scan100/100name: sdd-archive-project description: Archive a completed project by moving its foundation/<slug> folder into context/<app>/foundation/archive/ and stamping roadmap.md with archived status metadata: version: "1.0.0"
/sdd-archive-project — Close a Project
Move a completed project's foundation folder from context/<app>/foundation/<project-slug>/ to context/<app>/foundation/archive/<created-date>-<project-slug>/ (the same app's foundation archive), stamp roadmap.md frontmatter with status: archived + archived_at, use git mv so file history follows, and commit.
This is the project-level sibling of /sdd-archive. Where /sdd-archive closes a single change (changes/<change-id>/), this closes an entire project — its shape-notes.md, prd.md, roadmap.md, and any prd-vN.md versioned saves — once all its work is done.
<app> is the resolved workspace directory's name (e.g. assets, campaigns, crm); it is derived from the resolved foundation-folder path (see "Resolution"). Repos with no workspace layout keep the flat context/foundation/… layout — drop the <app> segment from every path below.
The gate is lenient warn-only with three hard blocks: uncommitted edits inside the project folder, pre-existing staged changes anywhere, and any in-flight change still pointing at this project (archiving would orphan it). Everything else — unfinished roadmap slices, open PRD questions — is surfaced as a warning followed by a confirmation prompt; the user can still archive.
After archiving, other sdd skills refuse to write inside context/*/foundation/archive/… — archived projects are read-only by convention.
Initial Response
When this command is invoked:
- An argument was provided → parse it (see "Argument Parsing") and proceed to "Resolution".
- No argument → respond with this message and STOP:
I'll archive a completed project. Please provide a project slug or path:Examples:/sdd-archive-project brickworks-preview-panel/sdd-archive-project @context/assets/foundation/brickworks-preview-panel/List active projects with: `ls -d context/*/foundation/*/ | grep -v /foundation/archive/`
Then wait for the user to provide an argument.
Argument Parsing
Take the first whitespace-delimited token. Normalize:
- Strip a leading
@if present. - Strip a trailing
/if present. - If the result contains
/, take the last non-empty path segment.
The result is <project-slug>.
Resolution
- Resolve
<project-slug>to a foundation folder. If the argument was a full path, it reveals the root directly — use it. Otherwise discover every context root per../sdd-shape/references/context-resolution.md(find eachcontext/.sdd.yml, excluding vendor/build dirs) and search each root for<CONTEXT_ROOT>/foundation/<project-slug>/— a flat rootRchecksR/foundation/<project-slug>/; a legacy rootRchecks eachR/<app>/foundation/<project-slug>/. Never match under…/foundation/archive/…. Repos predating the.sdd.ymlmarker fall back to the legacy globscontext/*/foundation/<project-slug>/and flatcontext/foundation/<project-slug>/. A valid project folder contains at least one ofshape-notes.md,prd.md,roadmap.md.
- Exactly one match (across all roots) → use it. Set
CONTEXT_ROOTto that root (and derive<app>when the match is a legacy root — everycontext/<app>/…path below then reads as$CONTEXT_ROOT/…). - More than one match → the same slug exists under multiple roots/apps. Ask the user which to archive, then proceed with the chosen path.
- Zero matches → it may already be archived. Check every discovered root's
foundation/archive/*-<project-slug>(plus the legacy fallbackcontext/*/foundation/archive/*-<project-slug>) for a directory whose name ends with-<project-slug>. If found, printerror: project "<project-slug>" is already archived at <path>.and STOP. Otherwise printerror: no project folder named <project-slug> found under any discovered context root. Runls -d "$CONTEXT_ROOT"/foundation/*/ | grep -v /foundation/archive/(per root) to list active projects.and STOP.
_(Flat roots have no <app> segment — drop it from every context/<app>/… path in the rest of this skill, exactly as the header note says.)_
Hard blocks
Three pre-flight checks. Any failing blocks the archive.
1. Uncommitted edits inside the project folder. Run git status --porcelain "context/<app>/foundation/<project-slug>/". If output is non-empty, block and print:
✗ Cannot archive: context/<app>/foundation/<project-slug>/ has uncommitted changes.<one line per offending path>Commit or stash them first, then re-run /sdd-archive-project.
2. Pre-existing staged changes anywhere. The archive commit bundles whatever is staged. Run git diff --cached --quiet. If exit code is non-zero, block and print:
✗ Cannot archive: pre-existing staged changes would be bundled into the archive commit.<output of `git diff --cached --name-only`>Commit them first or `git reset` to unstage, then re-run /sdd-archive-project.
3. In-flight changes still pointing at this project. Glob context/<app>/changes/*/change.md. For each, read its frontmatter change_id: and status:, and detect whether the change belongs to this project by either signal:
- Change-ID match (primary — the family's standard link, same as `/sdd-archive`): the project's
roadmap.md(if it exists) has an item whoseChange IDequals thischange_idexactly. - `roadmap:` frontmatter (secondary, when present): a
roadmap:field that resolves to this project'scontext/<app>/foundation/<project-slug>/roadmap.md. (No shipped skill writes this field today; honor it if a workflow added it by hand.)
If either signal matches and status: is not archived, collect that change-id. If any were collected, block and print:
✗ Cannot archive: these active changes still point at this project:<change-id> (status: <status>)...Finish and /sdd-archive each of them first — archiving the project now would orphan them.
Either check 1/2 failing, or a non-empty list in check 3 → STOP. These are hard blocks; do not proceed to the warn prompt.
If git is not available or the repo is not a git repo, print warning: not a git repository — skipping uncommitted-changes blocks. and continue (checks 1–2 skipped; check 3 still runs — it reads files, not git). Archive still works without git; we just lose history-preservation via git mv and skip the commit step.
Soft warnings (non-blocking)
Collect these, then present all at once with a single confirmation prompt.
- Unfinished slices: if
roadmap.mdexists, parse its## At a glancetable and count rows whose Status column is notdone. If any, queue:<N> roadmap slices not done: <comma-separated "<Change ID> (<Status>)" tokens, truncated to 5 with "…">. - Open PRD items: if
prd.mdexists, check its## Open Questionssection for entries and scan for# TODOmarkers. If any remain, queue:PRD still has <N> open item(s) (Open Questions / TODO). - No roadmap: if
roadmap.mdis absent, queue:Project has no roadmap.md — it was never roadmapped.
If at least one warning was queued, print:
⚠ /sdd-archive-project warnings for <project-slug>:- <warning 1>- <warning 2>
Then ask (use the interactive prompt mechanism):
- question:
Archive project "<project-slug>" anyway?
header: Archive project options:
- label:
Continue archiving
description: Move foundation/<project-slug>/ to foundation/archive/ despite the warnings.
- label:
Cancel
description: Don't archive. Exit cleanly. multiSelect: false
- Continue archiving → proceed to "Move and stamp".
- Cancel → print
Cancelled. Project unchanged.and STOP.
If no warnings were queued, skip the prompt and proceed directly.
Move and stamp
- Compute the archive destination.
DATE= the project's created date: readcreated:frontmatter fromshape-notes.md, elseroadmap.md, elseprd.md(first that exists and has aYYYY-MM-DDvalue). If none is found, use today:date -u +%F.DEST="context/<app>/foundation/archive/${DATE}-<project-slug>".- If
$DESTalready exists, printerror: archive destination "<DEST>" already exists. Inspect manually.and STOP.
- Stamp `roadmap.md` (in place, before the move; skip this step if the project has no
roadmap.md):
- Set
status: archived. - Set
archived_at: <ISO-8601 datetime, today, UTC>—date -u +"%Y-%m-%dT%H:%M:%SZ". - Set
updated: <today as YYYY-MM-DD>. - Edit only these three frontmatter lines. Leave
created,version,main_goal, etc. alone. Ifstatus:/archived_at:keys are absent from the frontmatter, add them.
- Move the folder.
- Prefer
git mv "context/<app>/foundation/<project-slug>" "$DEST"so history follows. - If
git mvfails, fall back tomkdir -p "context/<app>/foundation/archive"thenmv "context/<app>/foundation/<project-slug>" "$DEST". Print a warning if the fallback was used. - Confirm post-move:
[ -d "$DEST" ] && [ ! -d "context/<app>/foundation/<project-slug>" ]. If either fails, print a diagnostic and STOP.
- Stage the stamp into the rename (only if
roadmap.mdexists):git add "$DEST/roadmap.md"so the frontmatter stamp lands in the same commit as the rename.
- Commit.
``bash git commit -m "$(cat <<'EOF' chore(<app>): archive project <project-slug> EOF )" ``
The scope is the `<app>` the project lives under (e.g. chore(assets): archive project brickworks-preview-panel). This repo's commitlint enforces a fixed scope list of package/app names and rejects a literal archive scope, so the app is the correct, accepted scope. (Flat-layout repos with no scope-enum may use chore(archive): archive project <project-slug>.) Never pass --no-verify or signing-bypass flags; if a pre-commit hook fails, fix the cause and create a new commit. Skip this step entirely if git is unavailable.
- Print confirmation:
✓ Archived project <project-slug>context/<app>/foundation/<project-slug>/ → <DEST>/roadmap.md updated: ← print this block only if the project had a roadmap.mdstatus: archivedarchived_at: <ISO datetime>updated: <today>Committed as: <short SHA> chore(<app>): archive project <project-slug>The folder is now read-only by convention.
Error handling
- Any unexpected filesystem error during the move leaves the source folder in place; the
roadmap.mdstamp lands before the move, so on partial failure you may seestatus: archivedincontext/<app>/foundation/<project-slug>/roadmap.mdwhile the folder is still underfoundation/. Inspect manually; re-running is safe (Resolution detects the already-archived copy). - Do NOT attempt rollback — the stamp is intent-marking and partial state is recoverable by hand.
What this skill does NOT do
- Does not close roadmap items — the whole roadmap moves with the project; there is no per-item flip like
/sdd-archivedoes. - Does not touch the app-level change archive
context/<app>/archive/— that is/sdd-archive's domain. This skill only writes undercontext/<app>/foundation/archive/. - Does not archive individual changes — run
/sdd-archive <change-id>for those first (hard block 3 enforces this). - Does not push. The archive commit lands locally;
git pushis the user's call. - Does not run tests/build as a gate — the gate is lenient warn-only by design.
- Does not unarchive. To revisit an archived project, reference the archived folder for context.