Creates point-in-time backup of the project repository before any push or on-demand
Uses git bundle for atomic snapshots, tags with date and session ID, verifies bundle integrity, and records the snapshot in a tracking log. Designed to protect against accidental destructive operations and provide recovery points.
Monorepo Snapshot Backup
TL;DR
How To Start
STEP 1Provide Repository and Session Info
-
monorepo_path
· string · required
Path to the cloned repository root. -
session_id
· string · required
Current session ID for snapshot tagging (e.g., “H073”). -
backup_dir
· string · optional · default: {monorepo_path}/backups
Directory to store bundle files. -
push_to_backup_repo
· boolean · optional · default: false
Whether to push the snapshot to the backup repository. -
backup_repo_url
· string · optional · default: github.com/CRAFTFramework/craft-framework-backup
URL of the backup GitHub repository.
Usage Examples
EXAMPLE 1Pre-push local snapshot
EXAMPLE 2Snapshot with backup repo push
EXAMPLE 3Snapshot with uncommitted changes
How AI Reads This Recipe
- Pre-Flight (Step 0). Verify monorepo_path exists and is a git repository. Fail with error if not.
- Verify Clean State (Step 1). Run git status –porcelain. If uncommitted changes exist, warn the user and ask for confirmation before proceeding.
- Capture Metadata (Step 2). Get HEAD commit hash, current branch, last commit date, and generate snapshot timestamp. Build snapshot tag name and bundle filename from metadata.
- Create Backup Directory (Step 3). Create backup_dir if it does not exist. Verify directory is writable.
- Create Git Bundle (Step 4). Run git bundle create with –all flag to capture all branches and tags. Report bundle file size.
- Verify Bundle (Step 5). Run git bundle verify on the created bundle. Fail with error if verification fails.
- Tag Snapshot (Step 6). Create a git tag at HEAD with the snapshot tag name. Warn (do not fail) if tagging fails.
- Record in Log (Step 7). Append full snapshot metadata to MONOREPO-SNAPSHOT-LOG.txt. Create the log file with header if it does not exist.
- Backup Repo Push (Step 8). If push_to_backup_repo is true, push the snapshot tag and then push –mirror to the backup repository URL. If push fails due to unrelated histories, note the CWK-045 /tmp clone pattern as alternative.
- Report Status (Step 9). Display completion summary with snapshot tag, bundle filename, size, and verification status.
When To Use This Recipe
Recipe FAQ
What is a git bundle?
How is this different from CWK-005 (Git Checkpoint)?
What happens if the backup repo push fails?
Where are the bundle files stored?
Should I clean up old bundles?
Version History
Get this recipe with CRAFT for Claude Cowork
Cowork recipes ship bundled with CRAFT for Claude Cowork — there’s no separate download. Clone the framework once, and your AI runs every recipe automatically when invoked.
Pull anytime to stay on the latest version — free to clone, no login or email required.
Then start your session
Once CRAFT is in your project folder, open a new Cowork session and ask Claude to initialize. For example:
You
Claude
Not familiar with Git? Download as a ZIP
No command line needed. Just download, move, and unzip:
- Open the CRAFT framework repo on GitHub.
- Click the green Code button, then choose Download ZIP.
- Move the downloaded ZIP into your Claude Cowork project folder.
- Unzip it: double-click on Mac, or right-click → Extract All on Windows.
