Skip to content
Back to skills

agent-backup

ASecurity

Universal Agent State Capsule (UASC v2.0) cross-platform backup and disaster recovery framework for AI agent workspaces. Use when running weekly offline-portable agent backups, setting up automated backup schedules, migrating agent context across platforms (Claude, OpenAI/Codex, Google/Gemini, Cursor, Cline, Roo Code), or executing cold-start disaster recovery on a new machine.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 23, 2026
ai-agentspythonrustgoshellbashnodeawsgitapi

Works with

  • claude web
  • cursor
  • cli
  • api
  • mcp

Security analysis

A100/100

Pro scans all 9 files and shows the line behind each finding

Scanned November 23, 2026

npx -y skills add MingYiShang/agent-backup --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of agent-backup?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for agent-backup
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/mingyishang-agent-backup/badge)](https://www.skillsdirectory.com/skills/mingyishang-agent-backup)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: agent-backup
description: Universal Agent State Capsule (UASC v2.0) cross-platform backup and disaster recovery framework for AI agent workspaces. Use when running weekly offline-portable agent backups, setting up automated backup schedules, migrating agent context across platforms (Claude, OpenAI/Codex, Google/Gemini, Cursor, Cline, Roo Code), or executing cold-start disaster recovery on a new machine.
license: MIT
metadata:
  version: "2.0.0"
  spec: "uasc-2.0"
---

# Universal Agent State Capsule (`agent-backup`, UASC v2.0)

## Skill Identity and Mission

- **Skill Name**: `agent-backup` (UASC Universal Agent State Capsule)
- **Version**: `2.0.0` (`uasc-2.0`)
- **Role**: Operate as a Site Reliability and Disaster Recovery Engineer dedicated to safeguarding the user's complete AI agent workspace against physical hardware destruction, operating system failure, accidental deletion, or cloud link rot. Run weekly backups into a single offline-portable archive and execute either **Same-Platform 1:1 Resurrection** or **Cross-Platform Transpilation** on a new computer.

## Five Non-Negotiable Operational Tenets

1. **Dual-Track Preservation**: Capture both platform-native state files (enabling 1:1 native resurrection on the same platform) and platform-agnostic plain-text semantics (enabling lossless cross-platform migration across Claude, OpenAI/Codex, Google/Gemini, and third-party agents).
2. **Zero Plaintext Secrets**: Never embed raw API keys, tokens, passwords, or private keys into an unencrypted main archive.
3. **Atomic and Verified Packaging**: Never overwrite an existing healthy backup in place. Every archive must include `checksum.sha256` and pass a dry-run extraction integrity test before completion.
4. **Bounded Footprint**: Exclude bloated dependency trees, build artifacts, model weights, and oversized media. Replace oversized assets with a hash-and-source manifest so backups stay fast, low-RAM safe, and USB-friendly.
5. **Strict Honesty**: Never fabricate unexported cloud chats or missing files. Explicitly document any platform-restricted items in a `manual_gaps` checklist.

## Six-Layer Full-Stack State Capture Model

| Layer | Name | Captured Artifacts | Primary Purpose |
| --- | --- | --- | --- |
| **Layer 0** | Bootstrap and Integrity | `00_START_HERE.txt`, `RESTORE_PROTOCOL.md`, `WEEKLY_CHANGELOG.md`, `manifest.json`, `checksum.sha256` | Prevent cold-start paralysis and detect USB bit-rot |
| **Layer 1** | Assets and Workspaces | `git bundle` + `dirty.patch`, curated non-Git files, `external_large_files` manifests, `online_assets/` | Preserve full commit history and uncommitted edits without bloat |
| **Layer 2** | Runtime and Tooling | `env_snapshot/` lockfiles (`requirements.txt`, `environment.yml`, `package-lock.json`, `uv.lock`, `Cargo.toml`), sanitized MCP configs, skills | Ensure restored code runs and tools reconnect cleanly |
| **Layer 3** | Native Platform State | `native_snapshots/` adapters (`.claude`, `.codex`, `.gemini`, Cursor/Cline/Roo Code) + `path_remap_table.json` | Enable exact 1:1 same-platform session and window resurrection |
| **Layer 4** | Cognitive and Window Topology | `01_project_blueprint.md`, `02_decisions_and_pitfalls.md`, `03_rules_universal.md`, `windows/windows_registry.json`, `windows/win_XX_topic.md` | Prevent context-window amnesia and avoid repeating dead-ends |
| **Layer 5** | Zero-Trust Secret Vault | Regex/entropy redaction (`REDACTED:VAR_NAME`), `global/secrets_inventory.md`, optional `vault/secrets.enc` (AES-256 / `age`) | Protect cloud billing and private repos if physical media is lost |

For the complete architecture, Multi-Platform Native Adapter Matrix, JSON/Markdown schemas, and sanitization regex specifications, read [references/specification.md](./references/specification.md).

## Standardized Capsule Archive Layout

Each weekly run produces a versioned archive named `agent-capsule-YYYY-Www-YYYYMMDD.tar.gz` (or `.zip` on Windows if preferred; `.7z` or `.tar.gz.age` when full-archive encryption is enabled):

```text
agent-capsule-YYYY-Www-YYYYMMDD/
├── 00_START_HERE.txt               # Human 3-step cold-start manual + boot prompt
├── RESTORE_PROTOCOL.md             # Agent execution specification for Mode 3 recovery
├── WEEKLY_CHANGELOG.md             # Weekly delta report vs. previous capsule
├── manifest.json                   # Master inventory (schema_version: "uasc-2.0")
├── checksum.sha256                 # SHA-256 hashes for every file in the capsule
├── global/
│   ├── persona_and_preferences.md  # Working style, conventions, long-term constraints
│   ├── skills_and_prompts/         # Global skills, slash commands, prompt templates
│   ├── mcp_and_tools.sanitized.json# Redacted MCP servers, tools, plugin lists
│   └── secrets_inventory.md        # Required env var names, purposes, reissue steps
├── native_snapshots/
│   ├── path_remap_table.json       # Home dir, drive letters, path hash mappings
│   ├── claude/                     # Sanitized ~/.claude configs, transcripts, CLAUDE.md
│   ├── codex/                      # Sanitized ~/.codex configs, sessions, AGENTS.md
│   ├── gemini/                     # Sanitized ~/.gemini configs, checkpoints, GEMINI.md
│   └── third_party/                # Cursor, Cline, Roo Code, Windsurf, Cherry Studio, Open WebUI
├── projects/
│   └── <project_slug>/
│       ├── 01_project_blueprint.md
│       ├── 02_decisions_and_pitfalls.md
│       ├── 03_rules_universal.md
│       ├── windows/
│       │   ├── windows_registry.json
│       │   └── win_01_topic.md     # 5-part schema per concurrent window
│       ├── env_snapshot/           # Lockfiles + OS, CUDA, and CLI versions
│       ├── local_workspace/        # repo.bundle + dirty.patch or curated files
│       └── online_assets/          # Exported web chats, offline docs, URL maps
└── vault/                          # Optional Layer 5 (only with user passphrase)
    └── secrets.enc
```

## Mode 1: Weekly Full Backup Workflow

Execute these six phases in order whenever triggered manually or by weekly schedule:

1. **Phase 1 — Pre-Flight Discovery and Cloud Intake Gate**:
   - Detect host OS, active project directories, and installed native agent folders.
   - Compare against last week's `manifest.json` (if supplied via `--prev-manifest`) to identify new or changed projects.
   - Present a concise **3-Minute Cloud Export Checklist** for browser-sandboxed assets (Claude Web Projects, ChatGPT `conversations.json` / Custom GPTs, Google AI Studio / Gems) with staging hints; ask whether to export now or log under `manual_gaps` and continue.
2. **Phase 2 — Dual-Track Capture and Smart Filtering**:
   - **Git repos**: Run `git bundle create repo.bundle --all` and export uncommitted edits to `dirty.patch` plus valid untracked files.
   - **Non-Git dirs**: Copy active source files, manuscripts, configs, and structured data directly.
   - **Mandatory exclusions**: Skip `node_modules`, `.venv`, `venv`, `__pycache__`, `.pyc`, `dist`, `build`, `.next`, `.cache`, `target`, `.tmp`, non-diagnostic `.log`, lock/WAL artifacts, and raw credential stores (`auth.json`).
   - **Size circuit breaker**: Skip any single file > 50 MB or non-essential cache directory > 200 MB by default; compute SHA-256 (for files) and log recovery instructions in `manifest.json` under `external_large_files`.
   - **Environment & native harvesting**: Export runtime lockfiles/CLI versions into `env_snapshot/` and copy native configs/histories into `native_snapshots/` alongside `path_remap_table.json`.
3. **Phase 3 — Semantic Distillation and Window Archiving**:
   - Generate/update `01_project_blueprint.md`, `02_decisions_and_pitfalls.md`, and `03_rules_universal.md` for each project.
   - Map parallel workstreams into `windows/windows_registry.json` and five-part `windows/win_XX_topic.md` resume packs.
   - Audit external URLs/image hosts and archive critical references into `online_assets/`.
4. **Phase 4 — Zero-Trust Secret Sanitization**:
   - Scan all staged text, configs, JSONL transcripts, and scripts for secret patterns (`sk-`, `sk-ant-`, `AIza`, `ghp_`, `github_pat_`, `xoxb-`, AWS keys, Bearer tokens, `BEGIN PRIVATE KEY`, `.env` assignments).
   - Replace matches with `REDACTED:VAR_NAME` and register names/purposes in `global/secrets_inventory.md`.
   - Only encrypt raw credentials into `vault/secrets.enc` if the user explicitly supplies a strong passphrase for AES-256 or `age`.
5. **Phase 5 — Atomic Packaging and Integrity Verification**:
   - Write `00_START_HERE.txt`, `RESTORE_PROTOCOL.md`, `WEEKLY_CHANGELOG.md`, and `manifest.json` in a clean temporary staging directory.
   - Generate `checksum.sha256` over every staged file, stream-compress to a `.tmp` archive, run a mandatory dry-run extraction/CRC integrity test plus `manifest.json` validation, and atomically rename to the final archive (never overwriting an existing healthy archive).
6. **Phase 6 — Delivery and 3-2-1 Rotation Guidance**:
   - Output the **Weekly Backup Completion Report** (archive path, total size, WoW delta, project/window counts, redacted secret count, `manual_gaps`).
   - Remind the user to copy the capsule to offline media following the **3-2-1 Rule** (1 local, 1 offline physical drive, 1 optional encrypted offsite mirror) and **GFS Rotation** (4 weekly + 1 monthly archival capsule).

## Mode 2: Weekly Automation Setup

Generate OS-native recurring schedules with **catch-up execution** (if powered off during the weekly trigger, automatically run 10 minutes after next boot):
- **Windows**: PowerShell driver script + Windows Task Scheduler weekly trigger (e.g., Sundays 20:00, `StartWhenAvailable` enabled) with desktop reminder for the 3-minute cloud check and USB copy.
- **macOS**: `launchd` `.plist` user agent.
- **Linux**: `systemd` user `.service` + `.timer` (`Persistent=true`) or `crontab`.

## Mode 3: New Machine Disaster Recovery Workflow

When extracting a capsule on a new machine, execute these six steps in order:

1. **Step 1 — Integrity Verification and Host Profiling**: Validate `checksum.sha256` first (if corrupted, pinpoint damaged files and fall back to the prior week's capsule). Read `manifest.json` and `RESTORE_PROTOCOL.md`, detect new OS/home/agent platform, and confirm target workspace root and project scope.
2. **Step 2 — Dual-Mode State Restoration**:
   - *Mode A (Same-Platform 1:1 Resurrection)*: Read `path_remap_table.json` and rewrite legacy absolute paths and encoded project directory hashes inside configs/JSONLs before placing into native dirs. Back up existing host files with `.bak`.
   - *Mode B (Cross-Platform Transpilation)*: Transpile `03_rules_universal.md` and `global/persona_and_preferences.md` into `CLAUDE.md`, `AGENTS.md`, `GEMINI.md`, or `.cursorrules`, and convert `mcp_and_tools.sanitized.json` to target MCP schemas.
3. **Step 3 — Workspace and Runtime Reconstruction**: Clone `repo.bundle` and apply `dirty.patch` (plus untracked/non-Git files), restore `online_assets/`, and output environment rebuild commands from `env_snapshot/` plus `external_large_files` recovery actions (awaiting approval before heavy installs).
4. **Step 4 — Secure Credential Re-Injection**: Read `global/secrets_inventory.md` (or guide local decryption of `vault/secrets.enc`) and output a checklist of `.env` files/variables to populate locally. Never ask the user to paste plaintext secrets into chat.
5. **Step 5 — Multi-Window Workspace Re-Hydration**: Load `windows_registry.json`, `win_XX_topic.md`, and `02_decisions_and_pitfalls.md`; print a numbered Window Recovery Summary and copy-paste **One-Click Resume Prompts** for every active window.
6. **Step 6 — Post-Restore Acceptance Checklist**: Explicitly verify workspace/Git integrity, transpiled rules/MCP placement, staged dependency commands, flagged missing secrets/large files, and generated per-window resume prompts.

## Operational Best Practices

- **Week 1 Cold-Start Fire Drill**: Extract the first capsule into a temporary directory, open a blank agent window, and run Mode 3 end-to-end (target < 5 minutes).
- **Local Files as Single Source of Truth**: Distill browser-sandboxed web threads into local Markdown notes weekly so no critical knowledge lives only in web UIs.
- **Redundant Physical Storage**: Use at least two separate backup drives from different manufacturers (or rugged SSD + encrypted private cloud mirror).

## Bundled Scripts and Templates

Run the bundled zero-dependency Python 3 scripts under `scripts/`:

```bash
# Mode 1: Run a weekly full backup capsule
python scripts/uasc_backup.py --output-dir <OUTPUT_DIR> --projects-root <WORKSPACE_ROOT>

# Mode 2: Generate OS-native weekly automation artifacts
python scripts/setup_schedule.py --output-dir <BACKUP_DIR> --projects-root <WORKSPACE_ROOT>

# Mode 3: Verify capsule checksums, remap paths, transpile rules, or restore workspaces
python scripts/uasc_restore.py verify <EXTRACTED_CAPSULE_DIR>
python scripts/uasc_restore.py remap-paths <EXTRACTED_CAPSULE_DIR> --new-home <NEW_HOME_DIR>
python scripts/uasc_restore.py transpile-rules <EXTRACTED_CAPSULE_DIR> --target <claude|codex|gemini|cursor> --out <OUT_DIR>
python scripts/uasc_restore.py restore-workspaces <EXTRACTED_CAPSULE_DIR> --target-root <TARGET_WORKSPACE_ROOT>
```

See [references/restore-protocol-template.md](./references/restore-protocol-template.md) for the `00_START_HERE.txt` and `RESTORE_PROTOCOL.md` schemas embedded into every capsule.

Files in this skill

  • SKILL.md13.4 KB
  • assets/logo.svg1.9 KB
  • docs/ARCHITECTURE.md2.8 KB
  • examples/README.md1.1 KB
  • references/restore-protocol-template.md6.7 KB
  • references/specification.md10.3 KB
  • scripts/setup_schedule.py7 KB
  • scripts/uasc_backup.py49.6 KB
  • scripts/uasc_restore.py16.1 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.