Context
Tracks every file change and manages snapshots so any prior state can be restored at any time. This is a cross-cutting skill — it must be called before any file modification by any other agent, without exception. PM Agent enforces this order automatically.
When to Use
- Before another agent edits a file (Storyline, Design, Build, Measure, Export, etc.)
- User says "go back to previous version"
- User says "show version list"
- PM Agent is about to perform a destructive (overwrite) change
Execution Steps
Step 1: Create Snapshot (before any edit)
Always create a snapshot before editing a file. --workspace is required.
# Single file
bun scripts/co-deck/snapshot.ts slide_deck.md \
--workspace deliverables/<project> \
--desc "shrink chapter 3 slide count" \
--agent content
# Multiple files
bun scripts/co-deck/snapshot.ts slide_deck.md storyline.md \
--workspace deliverables/<project> \
--desc "full chapter restructure" \
--agent content
# HTML file (large — snapshot only when layout changes)
bun scripts/co-deck/snapshot.ts lecture_v1.html \
--workspace deliverables/<project> \
--desc "backup before image swap" \
--agent build
# Diagram assets (shared pool)
bun scripts/co-deck/snapshot.ts ../assets/diagrams/ \
--workspace deliverables/<project> \
--desc "backup before diagram regeneration" \
--agent build
File paths are relative to
--workspace.
--agent value rules:
| Agent | --agent value |
|-------|----------------|
| PM Agent | pm |
| Research Agent | research |
| Storyline Agent | storyline |
| Design Agent | design |
| Build Agent | build |
| Measure Agent | measure |
| Export Agent | export |
| Manual backup | manual |
Step 2: List Versions
bun scripts/co-deck/snapshot.ts --workspace deliverables/<project> --list
Example output:
──────────────────────────────────────────────────────────
Stored versions (5, newest first)
──────────────────────────────────────────────────────────
[ 1] 2026-06-17_16-00_build_image-swap-backup
Files: 3 / Size: 2.4MB
[ 2] 2026-06-17_14-30_content_chapter-adjust
Files: 2 / Size: 45KB
Step 3: Restore a Version
# Full version ID
bun scripts/co-deck/snapshot.ts \
--workspace deliverables/<project> \
--restore 2026-06-17_14-30_content_chapter-adjust
# Partial version ID (if uniquely matched)
bun scripts/co-deck/snapshot.ts \
--workspace deliverables/<project> \
--restore 2026-06-17_14-30
Restore automatically backs up the current file before restoring. If you regret the restore, run
--restoreagain on the new backup.
Output Format
Snapshots are stored under deliverables/<project>/_versions/:
deliverables/<project>/
└── _versions/
└── 2026-06-17_14-30_content_chapter-adjust/
├── slide_deck.md
└── storyline.md
Each snapshot auto-appends an entry to deliverables/<project>/VERSIONS.md with date, agent, description, file sizes, and restore command.
Caveats:
- Add
_versions/to.gitignore— large folders make Git inefficient - HTML files are 100KB–several MB; snapshot only on layout changes
deliverables/assets/fonts/does not need snapshots — re-downloadable any time viadownload-font.ts- Snapshot
layout_spec.json+pdf_layout_spec.mdtogether when HTML layout changes (they become invalid if HTML changes)
Related Skills
html-build— must call this skill before editing the HTML filestoryline— must call this skill before editingslide_deck.mdorstoryline.mdmeasure— must call this skill before re-running measurement (snapshotslayout_spec.json)