Punam SafeCode - Snapshot Recovery for AI Coding
The Undo Button for AI Coding.
Before AI breaks your code, Punam saves it.
The Problem
AI coding tools can change many files in seconds. If the result breaks your
project, editor undo history may not be enough, untracked files may be lost,
and you may not have made a Git commit before the changes started.
The Solution
Punam SafeCode creates local project snapshots before risky edits. You can
preview what a restore will change, roll back files in seconds, and export a
recovery point as a ZIP. No Git setup or cloud account is required.
Free and open source · Fully local · No account · No telemetry · No tracking
Punam SafeCode never uploads your code. Snapshots remain in your workspace
unless you explicitly export or move them.
See It in Action
Create a Snapshot
Name a recovery point before an AI coding session or any risky edit.


Recover a Snapshot
Preview and restore a real project snapshot after unwanted code changes.

Preview and Manage Snapshots
Review a snapshot and access Preview, Restore, Export, and Delete from the
snapshot menu.

Restore Preview
Inspect the restore summary before applying a snapshot. Punam creates an
emergency snapshot of the current state before every restore.

Features
🗃️ Create Snapshot
Capture the full state of your project in one click. Give it a name like "Before AI refactor" or leave it blank for a timestamp. All files are copied into .punam-snapshots/ inside your project.
⚡ Quick Snapshot
Press Ctrl+Shift+F5 (Cmd+Shift+F5 on Mac) for an instant snapshot with no input box. Perfect for a fast safety net before you let AI make changes.
🔍 Restore Preview with File-Level Diffs
Before restoring, see exactly what will change:
- Files that will be modified
- Files that will be added (exist in snapshot, missing from workspace)
- Files that will be deleted (in workspace, not in snapshot)
Click any file in the preview to open VS Code's native diff editor showing the snapshot version side-by-side with your current code.
✅ Selective Restore
Don't want to restore everything? Use Selective Restore to pick exactly which files to bring back. Modified and added files are pre-selected; deletions are opt-in. An emergency snapshot is still created first.
🔄 One-Click Full Rollback
Restore any snapshot to bring your project back to that exact state. Before every restore, Punam automatically creates an emergency snapshot of your current state so you can always undo the undo.
🔀 Compare Two Snapshots
Compare any two snapshots against each other to see what changed between them — not just snapshot vs workspace. Great for tracking what happened across multiple AI sessions.
Add tags (e.g. ai-session, stable, refactor) and free-text notes to any snapshot. Tags and notes appear in tooltips and the restore preview panel so you always know what each snapshot represents.
📦 ZIP Export
Export any snapshot as a .zip file to share with a colleague, attach to a bug report, or archive offline.
🕒 Snapshot Timeline
A sidebar panel lists all your snapshots with name, date, and file count. Right-click any snapshot for context actions: Preview, Selective Restore, Restore, Diff File, Edit Tags, Edit Notes, Export, Delete.
📊 Storage Dashboard
See how much disk space your snapshots are using. Quick actions to open the storage folder or adjust retention settings.
🛡️ Status Bar
A persistent shield icon in the status bar shows:
- Last snapshot time (e.g. "5m ago")
- Auto-snapshot status (on/off with visual indicator)
- Warning highlight when auto-snapshots are disabled
Click the status bar item to create a new snapshot instantly.
⚡ Auto Snapshots
When 5 or more files change quickly (e.g. an AI tool doing a bulk edit), Punam captures the resulting project state as a recovery point in the background. Toggle auto-snapshots on/off with Ctrl+Shift+F6 or via the command palette.
Why Not Just Git?
Git is a version control system — it tracks intentional, meaningful commits. It is not designed to capture "before I let the AI touch everything" moments.
|
Git |
Punam SafeCode |
| Requires setup |
Yes (init, stage, commit) |
No |
| Works on untracked files |
No |
Yes |
| Instant point-in-time capture |
Requires discipline |
Yes, one click |
| Emergency rollback before AI edits |
Manual |
Automatic |
| ZIP export of a moment |
Needs manual steps |
Built-in |
Punam SafeCode complements Git. It does not replace it. Use Git for structured version history. Use Punam for safety nets around risky AI sessions.
Commands
Open the Command Palette (Ctrl+Shift+P / Cmd+Shift+P) and type Punam:
| Command |
Keybinding |
Description |
Punam: Create Snapshot |
|
Capture project state with a custom name |
Punam: Quick Snapshot |
Ctrl+Shift+F5 |
Instant snapshot, no input box |
Punam: List Snapshots |
|
View all snapshots in a Quick Pick |
Punam: Preview Restore |
|
Show what will change (click files for diff) |
Punam: Selective Restore |
|
Pick individual files to restore |
Punam: Restore Snapshot |
|
Full restore (creates emergency backup first) |
Punam: Compare Two Snapshots |
|
Diff two snapshots against each other |
Punam: Diff File with Snapshot |
|
Open native diff for a single file |
Punam: Edit Snapshot Tags |
|
Add/edit comma-separated tags |
Punam: Edit Snapshot Notes |
|
Add/edit a text note |
Punam: Snapshot Storage Info |
|
View disk usage and cleanup options |
Punam: Toggle Auto Snapshots |
Ctrl+Shift+F6 |
Enable/disable automatic snapshots |
Punam: Export Snapshot as ZIP |
|
Save a snapshot as a .zip file |
Punam: Delete Snapshot |
|
Remove a snapshot permanently |
Punam: Open Snapshot Timeline |
|
Focus the Punam sidebar panel |
You can also access all actions by right-clicking any snapshot in the Punam Snapshots sidebar.
Settings
| Setting |
Default |
Description |
punamSafeCode.autoSnapshot.enabled |
true |
Enable all automatic snapshots |
punamSafeCode.autoSnapshot.onSave |
false |
Snapshot on every file save |
punamSafeCode.autoSnapshot.onBulkChange |
true |
Create a recovery point after 5+ files change at once |
punamSafeCode.snapshot.maxSnapshots |
20 |
Retain at most this many snapshots |
punamSafeCode.snapshot.includeHiddenFiles |
false |
Include dotfiles in snapshots |
punamSafeCode.snapshot.confirmBeforeRestore |
true |
Show confirmation dialog before restore |
punamSafeCode.snapshot.storageFolder |
.punam-snapshots |
Folder name for snapshot storage |
Safety Design
- Snapshots are stored inside your project in
.punam-snapshots/ — nothing leaves your machine.
- Before every restore, an emergency pre-restore snapshot is created automatically.
- Restore never deletes
.git or .punam-snapshots from your workspace.
- All path operations are validated to stay inside workspace root — no symlink escapes, no path traversal.
- Large files (>20 MB) are skipped to keep snapshots fast. The count of skipped files is recorded in metadata.
- The following folders are always excluded from snapshots:
.git, node_modules, dist, build, out, .next, .vite, target, .turbo, .cache, coverage, .punam-snapshots.
Limitations
- Local only. Snapshots live on your machine in
.punam-snapshots/. There is no cloud sync.
- Large folders excluded.
node_modules, dist, etc. are not snapshotted. Restore reinstates source files only. Run npm install after restoring if needed.
- Individual files >20 MB are skipped. Binary assets, datasets, and videos are not captured.
- Not a Git replacement. Punam does not track diffs, branches, or history semantics. Use Git alongside it.
- Single workspace. Only the first workspace folder is used in a multi-root workspace.
Getting Started
- Install the extension.
- Open a project folder.
- Notice the 🛡️ status bar item at the bottom — it shows your protection status.
- Open the Punam SafeCode shield in the Activity Bar.
- Click the + button or Create your first snapshot in the welcome panel.
- Give your snapshot a name like "Before AI session" and press Enter. Or press
Ctrl+Shift+F5 for a quick unnamed snapshot.
- Let the AI do its thing.
- If something goes wrong:
- Preview: click a snapshot to see what changed, click any file for a side-by-side diff
- Selective Restore: right-click → Selective Restore to pick specific files
- Full Restore: right-click → Restore to roll back everything
The status bar always shows when your last snapshot was taken and whether auto-snapshots are active.
Open Source and Privacy
Punam SafeCode is free software released under the
MIT License.
Its source code is public so users can inspect how project files are copied,
restored, and deleted.
Snapshots are a local recovery aid, not a substitute for Git, tested backups,
or off-device disaster recovery.
Punam SafeCode — local, fast, and always ready to save you.