Agent Change Guard
Track, diff, and revert every file change made during an AI agent session —
turn by turn. Works with Claude Code and the OpenAI Codex CLI out of
the box, and with Cursor Agent or manual work via sessions and manual
checkpoints, in VS Code or Cursor.
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.
Features
- Per-turn checkpoints: with Claude Code and Codex, every user message
automatically becomes a checkpoint labelled with that message. Expand a turn
to see exactly which files it touched and diff each one against its state
before the turn.
- Auto session start: the first agent message starts a session for you
(configurable), so tracking begins without you remembering to.
- Restore to checkpoint: rewind the workspace to the end of any turn.
Files changed by later turns are restored; earlier work is kept.
- Open original message: jump from a turn back to the closest supported
Claude Code or Codex session/thread, with the exact local transcript line as
fallback.
- Agent Changes activity-bar view: sessions → turns → files, with
Created / Modified / Deleted badges.
- Built-in diffs: per-turn (before ↔ after the turn) and cumulative
(baseline ↔ current).
- Revert a single file, revert a whole session, or accept and keep changes.
- 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.
Usage with Claude Code or Codex
- Run
Agent Change Guard: Start Session (or click + in the Agent
Changes view) before — or while — the agent works. With auto-start on
(the default), simply sending the agent a message starts a session.
- Chat with the agent as usual. Each message you send closes out the previous
turn into a checkpoint named after that message.
- Expand a turn in the sidebar to see its files; click one for the
before ↔ after diff of that turn.
- Click the external-link action on a turn to reopen the related
Claude Code/Codex session or thread when the platform supports it.
- Right-click a turn → Restore To Checkpoint to rewind later work.
Turn detection is automatic: Claude Code transcripts are tailed under
~/.claude/projects/ and Codex rollout transcripts under ~/.codex/sessions/.
Auto-start and auto-checkpoint can each be toggled per agent in settings.
Usage with other agents (or by hand)
Start a session, let the agent work, and run
Agent Change Guard: Create Checkpoint whenever you want to mark a boundary.
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: ….
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 (in MB) 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 when none is active. |
agentChangeGuard.codex.autoCheckpoint |
true |
Create a checkpoint per Codex turn while a session is active. |
agentChangeGuard.codex.autoStartSession |
true |
Auto-start a session on the first Codex message when none is active. |
How it works
On Start Session 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 content-addressed blobs — that's what powers per-turn diffs and
restore.
Agent turns are detected by tailing transcript files: Claude Code under
~/.claude/projects/ and the Codex CLI's rollout JSONL under
~/.codex/sessions/. Nothing is sent anywhere; transcripts are only read
locally to extract message boundaries, labels, and source locations for the
Open Original Message action.
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.
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.
- Claude Code and Codex expose session/thread-level links, not documented
message-level deep links; Open Original Message opens the closest
supported platform location and falls back to the local transcript line.
- Cursor Agent turns are not auto-detected yet (use manual checkpoints);
auto-detection relies on Claude Code's and Codex's transcript file formats.
Development
npm install
npm run compile # bundle with esbuild (or: npm run watch)
npm run typecheck # tsc --noEmit
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
codexWatcher.ts // tails Codex CLI rollout 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
Package a .vsix with npm run package.
License
MIT