
AI can edit your files without an undo button. CRAFT’s git integration adds automatic backup at every meaningful moment — event-driven commits, no git knowledge required.
Last week we showed how CRAFT’s handoff system gives Claude Cowork persistent memory across sessions. This week: the other half of the equation — keeping your files safe.
The File Safety Problem
Claude Cowork can modify any file in your project folder. That’s powerful — until something goes wrong. A recipe overwrites a file you needed. An edit introduces a subtle error you don’t notice for three sessions. The Cowork sandbox resets and your unsaved changes vanish.
There’s no built-in undo. No automatic save points. No way to roll back to “what my project looked like before that last operation.” If you’re running a multi-session project, you’re one bad edit away from hours of lost work.
This is different from the session memory problem we covered last week. Handoffs protect your session intelligence — decisions, context, priorities. Git protects your file state — the actual contents of every file in your project. You need both. One without the other leaves a gap.
CRAFT treats session memory and file safety as complementary systems. Handoffs preserve what the AI knows. Git preserves what the AI produced. Together, they mean nothing is lost — not the context, not the code, not the content.
How CRAFT Adds Automatic Git Backup
CRAFT doesn’t ask you to learn git. It doesn’t expect you to remember to commit. Instead, it embeds version control directly into AI workflows through event-driven triggers that fire at natural breakpoints.
Three types of events trigger automatic commits:
File modification. Any CRAFT recipe that changes files triggers a git checkpoint after it completes. The commit message automatically includes which recipe made the change and what it did — so your git history reads like a project log, not a series of cryptic hashes.
Token threshold. When Claude’s context window reaches 70% capacity, CRAFT automatically commits your current state. This protects against the scenario where a long session runs out of context and loses uncommitted work.
Session transitions. Every handoff includes a git commit. When you end a session, your file state is captured before the handoff is written. When the next session starts, there’s a committed baseline to work from.
Four purpose-built recipes handle this:
Sets up a local git repository with optional GitHub remote configuration. Handles PAT authentication using a token-per-session pattern where credentials are provided at the start of each session and scrubbed afterward. Creates .gitignore, runs the initial commit, and configures the remote — all through a single recipe invocation.
The workhorse. Event-driven commit system that fires on file modification, token threshold, or manual request. Auto-prefixes commit messages based on the calling recipe, includes index.lock pre-flight detection to handle sandbox failures, and supports both blocking and non-blocking execution modes. This recipe has been through 8 versions across 27 development sessions — the most iterated recipe in the framework.
Creates a snapshot before any destructive file operation. If a recipe is about to overwrite or restructure files, this captures the pre-change state first. Think of it as a save point before a boss fight — if the operation goes wrong, you roll back to exactly where you were.
Validates file changes against git state using a dual-responsibility pattern: advisory mode for developer review (shows you what changed and why) and enforcement mode for automated quality gates (blocks problematic changes from being committed).
What Makes This Different
Most backup solutions are timer-based — they save every N minutes regardless of what’s happening. CRAFT’s approach is event-driven. Commits happen at meaningful moments: when a recipe finishes modifying files, when the context window is getting full, when a session is about to end. This produces a git history that actually tells the story of your project’s evolution.
The commit messages are generated automatically and include the recipe that triggered them. When you look at your git log, you see entries like “Session 12: WK1-BLOG inline CSS rewrite (RCP-CWK-005)” — not “auto-save 3:47pm.”
Git works entirely on your computer without any remote connection. Your files are versioned locally the moment CRAFT initializes. GitHub remote backup is optional — nothing leaves your machine unless you explicitly configure it and provide credentials.
Surviving the Sandbox
Cowork’s sandbox introduces unique challenges. Git operations can fail and leave stale lock files that block all subsequent commits. CRAFT handles this with an index.lock recovery protocol — pre-flight detection in the initialization and checkpoint recipes catches the problem before it cascades, and an automated recovery path clears it when it occurs.
During CRAFT’s own development, this recovery protocol was invoked four or more times. Each time, the system detected the lock, cleared it, and continued — no manual intervention, no lost commits.
The Evidence
Every session in CRAFT’s 71-session development history ends with a committed git state. Five or more crash recoveries relied directly on git state to restore file contents. Remote backup to GitHub was confirmed and maintained across sessions. The complementary protection worked exactly as designed — handoffs restored what the AI knew, git restored what the AI had built.
This is Week 3 of our 8-week capability spotlight. Each week we go deep on one part of CRAFT — how it works, what problems it solves, and how to use it. Follow along as we build the case for structured AI working environments.
