Agent Change Guard
See exactly what your AI agent changed — message by message — and rewind any of it.
Agent Change Guard tracks every file change made during an AI agent session in
VS Code or Cursor. With Claude Code it works automatically: each message you
send becomes a checkpoint, so the sidebar reads like your conversation —
"1. fix the login bug · 3 files", "2. add tests · 5 files" — and every
turn can be diffed or rewound independently.
It never touches git. Baselines and checkpoints are plain file copies kept
in the extension's private storage, so reverting can't wipe your uncommitted
work, your index, or your stash.
Why
AI agents can touch dozens of files in one turn. Before you accept that work,
you want to see exactly what changed — per message, not just per session — and
be able to rewind to any point, without committing first and without trusting
the agent's own summary.
Installation
- From a
.vsix (current): download agent-change-guard-x.y.z.vsix, then
run cursor --install-extension agent-change-guard-x.y.z.vsix
(or code --install-extension … for VS Code), or use
Extensions panel → ⋯ → Install from VSIX.
- Marketplace / Open VSX: coming soon.
Quick start (Claude Code)
Nothing to set up.
- Open a project and chat with Claude Code as usual.
- Your first message auto-starts a session (the workspace is snapshotted —
watch the status bar). Every following message closes the previous turn
into a checkpoint named after that message.
- Open the Agent Changes view (shield icon in the activity bar). Expand a
turn to see its files; click one for the before ↔ after diff of that turn.
- Right-click a turn → Restore To Checkpoint to rewind everything later
turns did. Right-click the session → Mark as Accepted when you're happy.
Prefer explicit control? Set agentChangeGuard.claudeCode.autoStartSession
to false and start sessions yourself with
Agent Change Guard: Start Session.
Quick start (Cursor Agent, Codex, or manual work)
Turn boundaries can't be auto-detected for these (yet), so:
- Run
Agent Change Guard: Start Session before the agent works.
- Run
Agent Change Guard: Create Checkpoint whenever you want to mark a
boundary (the milestone icon in the view toolbar).
- Without checkpoints, a session shows a flat list of cumulative changes —
diff, revert per file, revert the session, or accept.
All commands are in the command palette under Agent Change Guard: ….
Features
- Per-turn checkpoints — automatic with Claude Code, manual with any agent.
- Restore to checkpoint — rewind the workspace to the end of any turn;
files changed by later turns are restored, earlier work is kept.
- Two kinds of diff — per-turn (before ↔ after that turn) and cumulative
(session baseline ↔ current).
- Safe reverts — per file or whole session, always from private copies,
never via git.
- Explorer badges (✦) on files changed during the active session.
- Status bar counter showing changes and turns while recording.
- Content-based detection — files only appear if their bytes actually
changed; a file edited back to its original content drops off the list.
- Respects your
.gitignore plus a configurable ignore list.
- Changes made while the window was closed are picked up on reload.
Settings
| Setting |
Default |
Description |
agentChangeGuard.ignoreDirectories |
node_modules, .git, dist, … |
Directory names that are never tracked or snapshotted. |
agentChangeGuard.respectGitignore |
true |
Also ignore files matched by the workspace root .gitignore. |
agentChangeGuard.maxFileSizeMB |
5 |
Files larger than this are not snapshotted and cannot be reverted. |
agentChangeGuard.claudeCode.autoCheckpoint |
true |
Create a checkpoint per Claude Code turn while a session is active. |
agentChangeGuard.claudeCode.autoStartSession |
true |
Auto-start a session on the first Claude Code message. |
How it works
When a session starts, the workspace (minus ignored paths and oversized
files) is copied into private extension storage as the baseline. While the
session is active, a file watcher records changes, comparing content hashes
so no-op saves don't count. At each turn boundary the changed files' contents
are stored as deduplicated, content-addressed blobs — that's what powers
per-turn diffs and restore.
Because reverts and restores only write from these private copies, your git
state and other uncommitted changes are left untouched. Accepting or removing
a session deletes its stored data.
Privacy
Claude Code turns are detected by tailing its local transcript files under
~/.claude/projects/ for the open workspace. The transcripts are only read
to find message boundaries and labels. Nothing is sent anywhere — the
extension makes no network requests at all.
Limitations
- One session at a time; multi-root workspaces track only the first folder.
- Renames show as a delete plus a create.
- Files over the size limit are listed but cannot be diffed or restored.
- Cursor Agent and Codex turns are not auto-detected yet (use manual
checkpoints); Claude Code detection relies on its transcript file format.
Development
npm install
npm run compile # bundle with esbuild (or: npm run watch)
npm run typecheck # tsc --noEmit
npm run package # build the .vsix
Press F5 in VS Code (Run Extension) to launch an Extension Development
Host with the extension loaded. Open a real project folder in that window
before starting a session.
src/
extension.ts // activation, command wiring, diffs, status bar
sessionManager.ts // session + checkpoint state, watcher, revert/restore
snapshotManager.ts // baseline copies + content-addressed checkpoint blobs
claudeWatcher.ts // tails Claude Code transcripts -> turn boundaries
treeProvider.ts // the Agent Changes tree view
decorations.ts // Explorer badges for agent-touched files
types.ts // shared types
utils.ts // ids, paths, ignore rules, hashing
License
MIT