skills/restore/SKILL.md
Restore from the Kopia backup repo in one of two opinionated modes. **wikis** (frequent, default) syncs per-project `.ai-docs/` directories from backup to local project trees — used to move compound-knowledge wikis between machines via the backup drive as sneakernet. **full** (rare) restores all sources to original paths for greenfield machine rebuild. Use when the user says "restore wikis", "sync wikis from backup", "pull the wikis", "I plugged in the backup drive on this machine", "rebuild this machine", "greenfield restore", or "restore everything". For ad-hoc single-file restores, use `backup-ops restore` instead.
npx skillsauth add rdfitted/claude-code-setup restoreInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Opinionated restore workflows that complement the backup (write) and backup-ops (verify/maintain/mirror/interactive-restore) skills.
| User says... | Mode | |---|---| | "restore wikis", "sync wikis", "pull the .ai-docs", "I plugged in the drive", "update wikis from backup" | wikis (default) | | "rebuild this machine", "greenfield restore", "restore everything to original locations", "full restore" | full |
Default to wikis if unclear — it's the frequent path and is safer (creates .bak backups before overwriting).
~/.claude/backup-config.json exists (the backup skill writes this during setup)winget install --id Kopia.KopiaUI then add %LOCALAPPDATA%\Programs\KopiaUI\resources\server to user PATHdrive_label from config (volume label, NOT drive letter)kopia repository connect filesystem --path "<drive-letter>:\KopiaRepo"
On first connect on a new machine: prompts for password, stores in Windows Credential Manager. Subsequent runs: silent.~/.claude/backup-config.json. Bail if missing.drive_label:
$vol = Get-Volume -FileSystemLabel $config.repo.drive_label -ErrorAction Stop
$drive = "$($vol.DriveLetter):"
If not mounted, stop with a clear error.$env:Path = "$env:Path;C:\Users\USERNAME\AppData\Local\Programs\KopiaUI\resources\server"
kopia --version # bail if this fails
kopia repository status succeeds if already connected):
$status = & kopia repository status 2>&1
if ($LASTEXITCODE -ne 0) {
& kopia repository connect filesystem --path "$drive\$($config.repo.repo_subdir)"
# will prompt for password if not in credential manager
}
~/.claude/backup-logs/restore-<ISO timestamp>.log. Tee everything.Purpose: Sync each project's .ai-docs/ directory from the latest backup snapshot to the local project tree. This is how compound-knowledge wikis move between machines.
Assumption: User runs /backup on the source machine first, plugs in the drive, runs /restore wikis on the target machine.
restore_mappings)In single-machine restores (same machine for both backup and restore), source and target paths are identical and project folder names match — the auto-walk just works. Cross-machine restores routinely hit two mismatches:
D:\Code Projects on the source machine, but on the target machine the cloned projects live under C:\Users\USERNAME\Code Projects.D:\Code Projects\GVB ERP on the source corresponds to Code Projects\gvb on the target (GitHub-derived kebab-case repo names).Without explicit mapping, the auto-walk silently skips everything because no local path matches the source layout. The fix is an optional restore_mappings block in ~/.claude/backup-config.json:
"restore_mappings": {
"source_paths": [
{
"source": "D:\\Code Projects",
"target": "C:\\Users\\RDuff\\Code Projects",
"project_name_map": {
"GVB ERP": "gvb",
"Ultra Building Solutions": "ultrabuildingsolutions",
"TOG - ERP": "tog-erp",
"the og main brain": "ogmainbrain",
"TOG PM Assistant": "ogpmbrain"
}
}
]
}
Each entry says: "snapshots whose source path is <source> get restored under <target> on this machine, with these per-project renames." Names not in project_name_map fall through to the source name verbatim. Projects with no local target directory are skipped as usual.
If restore_mappings.source_paths is empty or absent, the skill falls back to legacy auto-walk (uses the local config's sources list, expects exact name matches).
Determine source roots to consider:
restore_mappings.source_paths is non-empty: use each entry's explicit source (the snapshot path on the originating machine), target (local path), and optional project_name_map.Code Projects entries from local sources config — typically C:\Users\USERNAME\Code Projects, D:\Code Projects. Source path = target path. No name remapping.For each source root, get the latest snapshot ID:
$latestSnap = & kopia snapshot list "<source-path>" --max-results 1 | <parse ID>
Note: the snapshot path is the path that was backed up on the source machine — it does not need to exist on the local machine. Kopia stores it as metadata.
Find all .ai-docs/ subtrees within that snapshot:
# Walk the snapshot tree
& kopia ls "k<snapshot-id>" --recursive | Select-String "\\.ai-docs$"
This returns a list of subpaths like <source-project-name>/.ai-docs.
For each found .ai-docs/ subtree:
<source-project-name> in this entry's project_name_map; if absent, use the source name unchanged.<target>\<local-project-name>\.ai-docs (using target from the mapping entry, or source-path in legacy mode).Test-Path "<target>\<local-project-name>" is false): SKIP and log as "project not on this machine — source=<source-name> resolved=<local-name>". Logging both names lets the user decide whether to clone the project or fix a missing mapping entry..ai-docs/ exists: rename to .ai-docs.bak.<ISO-timestamp>:
Rename-Item "<local>\.ai-docs" "<local>\.ai-docs.bak.$(Get-Date -Format 'yyyyMMddTHHmmss')"
kopia snapshot restore "k<snapshot-id>/<source-project-name>/.ai-docs" "<target>\<local-project-name>\.ai-docs"
Report:
.ai-docs/ synced (with project names).bak directories created (with paths).ai-docs/ to .ai-docs.bak.<timestamp> before overwriting — never destroy in place. The .bak is cheap insurance against the case where the backup was stale (e.g. user edited locally on this machine without syncing first)..ai-docs/ belongs to a project; if the project isn't here, the wiki shouldn't be either.~/.ai-docs/ — that's the mainbrain wiki, git-tracked in rdfitted/mainbrain_fitted. Recovery path for that is git pull, not this skill..bak paths — print every .bak directory created so the user can verify they didn't lose unsynced work. Recommend deleting .bak folders after confirming the synced version is good.Purpose: Greenfield restoration onto a new/empty machine. Restores every source in backup-config.json to its original path.
Assumption: This is a fresh machine. No safety net — restores overwrite whatever's there (which should be nothing or near-nothing).
$parent = Split-Path "<source-path>" -Parent
if (-not (Test-Path $parent)) { New-Item -ItemType Directory -Path $parent -Force }
--force. Print a warning showing what's at the path, ask user to confirm or pass --force.kopia snapshot restore "<snapshot-id>" "<source-path>"
--force to proceed.--force — easy way to clobber live state..gitconfig, CLAUDE.md, etc.) last — these are single files and least disruptive; restoring them after dirs prevents partial-state issues.After the run, print a tight summary:
restore [wikis|full] complete — <ISO timestamp>
sources processed: N
bytes restored: X.X GB
duration: M min Ss
.bak directories: K (paths listed above)
skipped: Y (reasons listed above)
log: C:\Users\USERNAME\.claude\backup-logs\restore-<ISO>.log
If any errors: print them prominently, don't bury.
backup — primary write workflowbackup-ops — verify, maintain, mirror, ad-hoc interactive restore~/.claude/skills/backup-ops/RESTORE.md — manual Kopia CLI reference (open/browse/pull/full-restore commands)~/.claude/backup-config.json — source list and drive label.bak cleanup workflow), curate via /curate-learnings → ~/.ai-docs/wiki/practices/backup-ops restore or mount the repo (kopia mount all Z:)kopia mount all Z: and Explorerbackup-ops restore or raw kopia snapshot restore <id> <target>~/.ai-docs/ → that's git-tracked in rdfitted/mainbrain_fitted; use git pull insteaddocumentation
# /bp-iterate Iterate the Fitted Business Plan(s). Manages the **internal canonical** and the **external partner/investor variant**, snapshot-on-version-bump lineage, redaction enforcement between variants, and cross-document coupling. ## When this runs - User says `/bp-iterate`, "iterate the BP," "bump the BP," "update the business plan," "version up the BP," "create / update / refresh the external variant" - A material trigger fires per the BP's own Iteration Log (first 2 new closes / fundi
tools
Run Kopia-based backups of key Windows files and config to an external drive. Use when the user says "back up", "run a backup", "snapshot", "the backup drive is plugged in", or wants to set up / configure backups for the first time. Handles initial repo setup, drive detection by volume label, source enumeration, and snapshot creation with structured exclusions.
testing
Secondary backup operations against the Kopia repo — verify integrity, run maintenance/prune, mirror to a second destination, restore files/folders, or run a quick top-up snapshot of hot directories. Use when the user says "verify backups", "check backup integrity", "prune old snapshots", "restore from backup", "mirror backups to cloud", "quick backup", "top up the backup", or asks about backup health. For the primary backup run, use the `backup` skill instead.
development
Session-start ritual that establishes a learning heartbeat. Detects Tier 1 (code project with .ai-docs/) vs Tier 2 (home directory / institutional mode), loads minimal context, then schedules a recurring CronCreate heartbeat that periodically captures learnings to the appropriate target — project-level learnings.jsonl OR the global wiki at ~/.ai-docs/wiki/. Invoked automatically at session start (after the wiki/project-dna read in ~/CLAUDE.md) or manually via /start.