RCP-CWK-006 Cowork Pre-Modification Backup

Creates a named restore point in git before you make significant changes

The AI commits any uncommitted work, tags the current state with a descriptive name, and gives you exact commands to roll back if something goes wrong. Think of it as a save game before a boss fight.


Cowork Pre-Modification Backup

Tags: Introduced in Beta, Git, Backup, Safety, Restore, Version Control, Cowork

TL;DR

What It Does
Creates a named restore point in git before you make significant changes. The AI commits any uncommitted work, tags the current state with a descriptive name, and gives you exact commands to roll back if something goes wrong. Think of it as a save game before a boss fight.
How It Works
The AI verifies git is initialized, commits any pending changes to ensure a clean state, then creates an annotated git tag with a backup/ prefix (e.g., backup/pre-version-bump). The tag records the operation name, date, and which files are at risk. After the backup, you proceed with your operation knowing you can restore to this exact point.
What To Expect
A tagged restore point in under 2 minutes. The AI reports the tag name, commit hash, and protected files, then provides the exact git commands to restore or diff against the backup if needed.
Best Results When You
Run this before any operation that modifies critical files — version bumps, cookbook edits, large refactors, or any change you are not fully confident about. The cost is negligible (one tag) and the safety net is worth it.
Typical Time
1–2 minutes.
Difficulty
Beginner — the AI handles everything. You just name the operation.

How To Start

Run this recipe before any significant file modification. It requires an existing git repository (run CWK-004 first if needed).

STEP 1Tell the AI What You Are About to Do

Name the operation you are about to perform. Optionally list the specific files that will be modified — this gets recorded in the tag metadata for future reference.
Available parameters
  • operation_name · string · required
    Short descriptive name for the operation about to be performed. Used in the tag name (e.g., “version-bump-0226a5” becomes tag “backup/pre-version-bump-0226a5”).
  • files_at_risk · list · optional
    Specific files that will be modified. If not provided, the backup covers all tracked files.
Example invocations
Basic backup
#H->AI::Directive: (Create pre-modification backup for operation "cookbook-rewrite")
With specific files
#H->AI::Directive: (Create pre-modification backup for operation "version-bump-0226a5" with files_at_risk framework/CFT-FWK-COOKBK-COWORK.txt, CLAUDE.md)

STEP 2Confirm the Backup Tag

The AI commits any uncommitted changes to ensure a clean state, then creates an annotated tag. It reports the tag name, commit hash, and files protected. At this point, the restore point is set — proceed with your operation.

STEP 3Use the Restore Commands if Needed

If something goes wrong during your operation, the AI provides two commands: one to restore all files to the backup state, and one to see exactly what changed since the backup. You can also ask the AI to run these for you.

Usage Examples

Two scenarios — a precautionary backup before a cookbook edit, and a backup with specific files listed before a version bump.
Example 1 · Backup before cookbook edit
User: #H->AI::Directive: (Create pre-modification backup for operation "cookbook-rewrite")
AI: Verifying git state. Working tree has 3 uncommitted changes. Committing current state before backup. Creating tag: backup/pre-cookbook-rewrite.
AI: Backup complete. Tag: backup/pre-cookbook-rewrite. Commit: b7a9e12. All tracked files protected. To restore if needed: git checkout backup/pre-cookbook-rewrite — . To see what changed: git diff backup/pre-cookbook-rewrite
User: Good, proceeding with the rewrite.
[User performs operation with safety net in place]
Example 2 · Backup with specific files before version bump
User: #H->AI::Directive: (Create pre-modification backup for operation "version-bump-0226a5" with files_at_risk framework/CFT-FWK-COOKBK-COWORK.txt, CLAUDE.md)
AI: Git state clean — no pre-commit needed. Creating tag: backup/pre-version-bump-0226a5. Files at risk: framework/CFT-FWK-COOKBK-COWORK.txt, CLAUDE.md.
AI: Backup complete. Tag: backup/pre-version-bump-0226a5. Commit: d3f1c8a. Proceed with version bump when ready.
[Tag metadata records which files were expected to change]

How AI Reads This Recipe

When this recipe is triggered, the AI creates a safety checkpoint using git tags. The AI should:
  1. VERIFY that a git repository exists — if not, direct the user to CWK-004 (Git Initialization) and stop.
  2. COMMIT any uncommitted changes before creating the backup tag to ensure the restore point captures the complete current state.
  3. CREATE an annotated git tag with the backup/ prefix convention and include the operation name, date, and files at risk in the tag message.
  4. REPORT the tag name, commit hash, protected files, and the exact git commands for restoration and diffing.
  5. NEVER proceed with the planned operation within this recipe — this recipe only creates the backup. The operation itself is a separate step.
The AI should NOT skip the pre-commit step even when the working tree appears clean — uncommitted staged changes are easy to miss. The backup tag must be annotated (git tag -a) so the metadata is preserved, not just a lightweight pointer.

When to Use This Recipe

Use this recipe when you:
  • Are about to make a large or risky change to project files.
  • Want a named restore point before a version bump, refactor, or cookbook edit.
  • Need to protect specific files before an operation that might corrupt them.
  • Want the ability to diff against a known-good state after completing an operation.
Do not use this recipe when:
You are making routine, small changes that are already covered by regular git checkpoints (CWK-005). This recipe is for pre-planned significant operations, not every edit. Overusing backup tags clutters the tag namespace.

Recipe FAQ

Q.How is this different from a regular git commit?

A commit records changes. This recipe creates a named tag (a permanent bookmark) at a specific commit, making it easy to find and restore to later. Tags persist even as new commits are added.

Q.What if I forget to run this before my operation?

You can still restore from your most recent commit, but you will not have a named, easily-findable reference point. For critical operations, always backup first.

Q.Can I have multiple backup tags?

Yes. Each tag has a unique name based on the operation (backup/pre-cookbook-rewrite, backup/pre-version-bump-0226a5, etc.). They do not conflict.

Q.How do I list all backup tags?

Run: git tag –list "backup/*" — this shows all backup tags in your repository.

Q.Does the backup include untracked files?

Only if they are committed first. The pre-commit step stages all changes (git add -A), which includes untracked files. After that, the tag points to a commit that includes them.

Q.How do I delete old backup tags I no longer need?

Run: git tag -d backup/pre-{operation-name} — this removes the tag locally. If pushed to a remote, also run: git push origin –delete backup/pre-{operation-name}.

Version History

Changes to this recipe over time. Most recent first.
v1.00a 2026-02-28
Initial release. Pre-modification backup using annotated git tags with backup/ prefix convention, automatic pre-commit of uncommitted changes, and restore/diff command reporting.

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

Please initialize my CRAFT session.

Claude

CRAFT session ready. Your project is loaded, your persona is active, and your recipes are available. What would you like to work on?

What is CRAFT for Claude Cowork?

Not familiar with Git? Download as a ZIP

No command line needed. Just download, move, and unzip:

  1. Open the CRAFT framework repo on GitHub.
  2. Click the green Code button, then choose Download ZIP.
  3. Move the downloaded ZIP into your Claude Cowork project folder.
  4. Unzip it: double-click on Mac, or right-click → Extract All on Windows.

Similar Posts