Code Changes Explorer by Talha
Review the file changes a CLI coding agent (Claude Code, OpenCode, Codex, ...) makes in your workspace,
the way Copilot agent mode and Cursor show them: removed lines in red, added lines in green, the changed files
marked in the Explorer, and one Undo and Redo for everything the agent did.
Everything lives in one place: the Agent Review tab in the Activity Bar (the icon with a + and a −).
Claude Code can signal its turns through hooks, and any other agent can do the same through a small script.
The Agent Review tab
Click the Agent Review icon in the Activity Bar. It holds three views:
- Overview: for each workspace folder, how many files the agent changed (and the lines gained and lost),
how many turns are applied or undone, and big buttons for Undo All, Redo All, Keep All, Undo
Last Turn, Redo Turn and Rescan. A button is greyed out, with a tooltip, when it has nothing to do.
If Claude Code's hooks are not set up, a Set up Claude Code turns button appears.
- Agent Changes: the changed files as a folder tree, each with its
+12 −3 line counts.
- Agent Turns: every turn, newest first, with Undo Every Agent Turn and Redo All Undone Agent Turns
in its title bar.
The status bar item turns amber while there are pending changes, so they are hard to miss.
What you see
- In the editor. Lines the agent added have a green background and a green bar beside them. Where it
removed or replaced lines, a red rule marks the spot and a red note at the end of that line says what went
("− 2 lines replaced", "− 8 lines removed"). A single removed line is shown struck through. Hover the note to
read all the removed text. Above each change are Keep, Undo and Compare links.
- In the Explorer. Every file the agent changed is marked in the file tree, in the Explorer's own style:
M (changed, yellow), A (added, green) and D (deleted, red), and a dot on each folder that holds
changes, so you can see where the changes are without opening anything. The Agent Changes view in the
Agent Review tab lists the same files in a folder tree, each with how many lines it gained and lost (
+12 −3).
Its header shows the totals, and the tab's icon carries a count. The tab opens itself the first time the agent
changes something in a workspace; after that it stays as you leave it.
- Full red and green lines. Click Compare, a file in the Agent Changes view, or a change mark in the
gutter. VS Code's own diff editor opens with the removed lines in red and the added lines in green. The first
time, the extension asks whether to show diffs in one column (Show inline, like Copilot and Cursor) or
keep them side by side. It changes your
diffEditor.renderSideBySide setting only if you choose
Show inline. Set agentReview.diffLayout to change the choice later.
- In the gutter. VS Code's change marks appear beside the lines the agent changed: green for added lines,
blue for changed lines, a red triangle where lines were removed. Turn them off with
agentReview.gutterDiff.
- In the status bar. The count of changes, and Undo and Redo buttons for whole turns.
How loud the highlighting is: set agentReview.highlight to subtle, normal (the default) or strong.
strong adds thicker bars, rules above and below each change, and + / − icons in the gutter.
The colours follow your theme and can be changed in workbench.colorCustomizations:
agentReview.addedForeground, agentReview.modifiedForeground, agentReview.deletedForeground, and the line
backgrounds agentReview.addedBackground and agentReview.removedBackground.
A limit of VS Code. An extension cannot insert extra lines between the lines of a normal editor, which
is how Copilot and Cursor show a removed line in red right above the new one: they use parts of VS Code that
extensions cannot reach. So in the normal editor a removed line is a red note beside the line it came from,
and the full red and green lines are in Compare and in the gutter's change view.
How it works
- Each workspace folder gets a baseline: a private copy of its files, kept in a git repository inside
VS Code's storage folder. Your own
.git is never touched.
- A change is anything that differs from the baseline. Changed, added, deleted and renamed files appear under
Agent Changes in the Agent Review tab (and in the Source Control view), and the status bar shows the count. A
rename shows as a deletion and an addition.
- Keep moves the change into the baseline. It stops being pending, and your files are not written.
- Undo reverts the change in the file. If the file is open, the edit goes through the editor, so
Ctrl+Z works, and the file is saved when it had no unsaved edits.
- A save you make in VS Code is your own edit, not an agent change.
- The baseline survives restarts, so changes made while VS Code was closed still show up.
.gitignore, node_modules/, .agent-review/, files over agentReview.maxFileSizeKB (default 1024 KB)
and anything in agentReview.exclude are never reviewed.
- Line endings are kept exactly, including CRLF files in repositories that use
text=auto.
Undo and redo, in one place
You never have to go from file to file. All the agent's changes can be undone and redone together:
- Undo and Redo in the status bar, the same two buttons in the title of the Agent Changes and
Agent Turns views, and the keys Ctrl+Alt+Z and Ctrl+Alt+Y (Cmd+Alt+Z and Cmd+Alt+Y on a Mac). Undo
takes back the newest turn: every file in it goes back to how it was, all at once, including files the agent
created or deleted. The tooltip says which turn and how many files.
- Undo All Agent Changes returns every changed file to its state before the agent ran. It is recorded as a
turn of its own ("Undo all agent changes"), so Redo brings everything back if you change your mind.
- Redo All Undone Agent Turns brings back every turn you undid; Undo Every Agent Turn takes back all
the applied turns, newest first. Both are in the Overview (Redo All) and the Agent Turns title bar, and
in the Command Palette.
- In Agent Turns, the button on a turn goes further: Undo This Turn and Every Newer One, or Redo Up to
and Including This Turn. It asks first when that is more than one turn.
- Keep All accepts everything and makes the current files the new baseline.
Your own Ctrl+Z still works in each open file, because changes are written through the editor.
Multi-root workspaces
Every folder of a multi-root workspace is reviewed separately. Each folder has its own baseline, turn history
and watchers. The Agent Changes view lists each folder as a parent (with its file count) when there are
several, and the Source Control view has Agent Changes (name) and Agent Turns (name) for each. The same
file name in two folders is two separate changes. The status bar counts changes in all folders. Commands act on
the folder of the file they are given, or on the active editor's folder. When that is not clear, they ask which
folder.
Turns
A turn is a group of agent changes. Turns are listed under Agent Turns in the Agent Review tab (and in
the Source Control view), newest first. While an agent works, the list shows Agent turn in progress.
- Undo Last Agent Turn reverts every file the turn changed, and removes files the turn created
(to the Recycle Bin). The turn stays in the list, faded, until you redo it.
- Redo Agent Turn applies the turn again.
- Click a turn to choose a file and compare its state before and after the turn.
- Saving a file in VS Code ends the current turn. The agent's changes before the save form one turn, and
your save is never part of a turn. If you edited a file after the turn, undo or redo asks before
replacing your edits.
- A new agent turn after an undo discards the undone turns, as in an editor.
- The history is kept with the baseline: it survives restarts and is capped at 100 turns.
How a turn is found
- With agent signals (exact): a turn is everything the agent changed from its start signal to its end
signal, however long it paused in between. Claude Code sends these signals through the hooks you install
below.
- Without signals (timing): changes that come within
agentReview.turnQuietSeconds of each other (default
10) form one turn. A longer pause starts a new turn.
Claude Code: exact turns
- Open the project in VS Code. If Claude Code is used there, VS Code asks whether to record exact Claude Code
turns in the folder, with Set up and Not now. Click Set up. It adds two hooks to
.claude/settings.local.json, which only you use: one
runs when you send a prompt (the turn starts), and one runs when Claude finishes responding (the turn ends).
Nothing else in the file changes.
- Start a new Claude Code session in the project, so the hooks load.
- Work as usual. Each response appears as one turn in the list, from the prompt that started it to the end of
the response.
If you clicked Not now, run Agent Review: Install Claude Code Turn Hooks instead and choose Only me
(recommended) or Shared with the team. The question is asked once per folder.
The hooks run a copy of the hook script kept in VS Code's storage for this extension, so their path does not
change when the extension is updated. The copy is refreshed each time VS Code starts. After an update, the
extension points your personal hooks at the current copy and tells you. A shared settings file is never changed
automatically: run the command with Shared with the team to update it.
The hooks need Node.js on your PATH. Without it, setup stops with a message and changes nothing. The review
itself still works, with timing-based turns. The hooks write to .agent-review/events.jsonl in the project, and
that folder contains a .gitignore that hides it from git.
Agent Review: Remove Claude Code Turn Hooks removes only these two hooks, and keeps everything else.
Shared with the team writes the same hooks to .claude/settings.json. The hook commands contain this
computer's folder paths, so teammates need their own copy. Prefer Only me.
Other agents (OpenCode, Codex, Aider, ...)
Any tool that can run a command when a turn starts and when it ends can send the same signals:
node "<extension folder>/hooks/agent-review-hook.js" turn-start --dir "<workspace folder>" --session <id>
node "<extension folder>/hooks/agent-review-hook.js" turn-end --dir "<workspace folder>" --session <id>
The extension folder is the folder of this extension in your VS Code extensions directory, and it changes with
each version. For a path that survives updates, use the copy that the extension keeps for Claude Code, in VS
Code's storage folder for this extension (on Windows, usually
%APPDATA%\Code\User\globalStorage\local.agent-change-review\agent-review-hook.js). That copy exists once the
extension has started.
Or append a line yourself to <workspace folder>/.agent-review/events.jsonl:
{"event":"turn-start","session":"<id>"}
{"event":"turn-end","session":"<id>"}
session tells apart agent sessions that run at the same time, and a turn ends when every session in it has
ended. A tool without signals still gets turns from the timing rule above.
Keys
Rebind them in Keyboard Shortcuts (search "Agent Review").
| Action |
Default key |
| Undo the last agent turn (every file in it) |
Ctrl+Alt+Z |
| Redo the agent turn |
Ctrl+Alt+Y |
| Next change in the file |
Alt+F5 |
| Previous change in the file |
Shift+Alt+F5 |
| Keep the change at the cursor |
Ctrl+Alt+K |
| Undo the change at the cursor |
Ctrl+Alt+U |
- Editor title bar (in a file the agent changed): previous and next change, Show Diff, Keep File's
Agent Changes and Undo File's Agent Changes.
- Agent Changes view, title bar: Undo, Redo, Keep All and Undo All. Hover a file for Keep
and Undo on that file. Click a file to see its changes.
- Agent Turns view, title bar: Undo and Redo. Hover a turn for Undo This Turn and Every Newer
One or Redo Up to and Including This Turn.
- Source Control view: the same buttons on Agent Changes and Agent Turns.
Keep All, Undo All, undo of a file the agent created, and undo or redo over edits you made ask for
confirmation first.
Large repositories
- The first time a folder is opened, every file in it is read once to build the baseline. For a 5,000-file
folder on the development machine this took about 10 seconds. Later opens and rescans reread only the files
whose timestamps changed: about 0.3 seconds for 5,000 files, down from about 2 seconds before this was done.
- The baseline and the turn history each keep a copy of every file that is not ignored, so a huge folder of
binary files makes them large. To keep a folder out, add it to
agentReview.exclude. Excluded files are
neither stored nor reviewed.
- Benchmark:
node scripts/bench-large.js 5000 (after npm run compile).
Requirements
- Git on your PATH. The extension calls the git command line. If Git is missing, VS Code shows a message when it
starts, with a link to the Git download. No folder is reviewed until you install Git and restart VS Code.
- Node.js on your PATH, for the Claude Code hooks only.
Limits
- Without signals, turns are timing-based. A pause longer than
turnQuietSeconds inside one agent
response starts a new turn.
- A save in VS Code ends the current turn, so saving while an agent works splits its turn.
- Interrupts and API errors send no end signal. Claude Code's Stop hook does not run when you interrupt a
turn (Esc), and API errors fire a different hook, StopFailure, instead
(hooks reference,
interactive mode). The turn then stays open until the next
response finishes, or until 15 minutes pass without activity. Its changes show under Agent Changes in the
meantime, but not in Agent Turns.
- Anything that changes files outside VS Code while it runs (a terminal command,
git pull) is recorded as a
turn, unless it is saved in VS Code.
- Turns start when VS Code opens. Changes made while VS Code was closed are not turns, and a signal sent
while VS Code was closed is not replayed.
- A turn that is still open when VS Code closes is not recorded.
- If a file has unsaved edits, undo or redo changes the editor only. Save the file to write it to disk.
- Each turn keeps a copy of the files it changed, so very large files make the history large.
- Changes in an open file are read from the editor, so your own unsaved edits in a file with agent changes
appear as changes too. Keep would then include them in the baseline.
- Keep All uses the files on disk, not unsaved editor text.
- Binary files and files with a byte-order mark can only be kept or undone as a whole file.
- Symbolic links are not reviewed, and neither are files inside another git repository in the workspace (a folder
with its own
.git). Those files belong to that repository.
- A file open with unsaved edits that is not UTF-8 (for example Windows-1252) is compared as UTF-8, so it can show
as changed until it is saved.
- Removing a pattern from
agentReview.exclude makes its files look like new additions until you keep them.
- Restricted Mode. VS Code keeps this extension off in a folder you have not trusted. When VS Code asks
whether you trust the authors of the folder, choose to trust it.
- Uninstalling leaves the Claude Code hooks behind. Run Agent Review: Remove Claude Code Turn Hooks
before you uninstall, or remove the two hooks from
.claude/settings.local.json yourself.
Commands
| Command |
What it does |
| Agent Review: Show Agent Changes |
Opens the Agent Review tab |
| Agent Review: Redo All Undone Agent Turns |
Applies every undone turn again |
| Agent Review: Undo Every Agent Turn |
Undoes all applied turns, newest first (can be redone) |
| Agent Review: Show Diff of This File's Agent Changes |
Opens the file's changes with red and green lines |
| Agent Review: Next / Previous Agent Change |
Moves the cursor between changes in the file |
| Agent Review: Keep / Undo Agent Change |
Keeps or undoes the change at the cursor |
| Agent Review: Keep / Undo File's Agent Changes |
Keeps or undoes every change in the file |
| Agent Review: Keep All / Undo All Agent Changes |
Applies to every change in the folder (Undo All can be redone) |
| Agent Review: Undo Last Agent Turn / Redo Agent Turn |
Undoes or redoes a whole turn, in every file at once |
| Agent Review: Install / Remove Claude Code Turn Hooks |
Adds or removes the Claude Code hooks |
| Agent Review: Rescan Workspace |
Recomputes every change in every folder |
Packaging
npx @vscode/vsce package --allow-missing-repository --skip-license
This writes agent-review-undo-<version>.vsix. The package includes the compiled extension, the hook script,
and the one runtime dependency (diff). It excludes the sources, tests, and build tools. Publishing to the
Marketplace needs a publisher account and an access token. Neither is set up here.
Development
npm install
npm test # compiles, then runs the unit tests against real git and the hook scripts
npm run smoke:ui # starts VS Code with a fresh profile and runs the in-editor check
npm run smoke:ui -- --multi-root # the same, with two folders in one workspace
npm run smoke:ui -- --real-agent # also runs one small Claude Code task (costs a little API usage)
npm run check:install # packages, installs into a new VS Code profile, and checks that it starts
node scripts/bench-large.js 5000 # times the review on a generated 5,000-file folder
Press F5 in VS Code to run the extension in a development window.
The unit tests include a check that package.json and the code agree: every command, menu, context key, colour,
view and setting named on one side exists on the other. A typo there does not stop the build, it only makes a
button do nothing, so the test is the guard.
smoke:ui starts the code command. While VS Code is installing an update, the stable VS Code refuses to start
and the check times out with a message saying so. Start another build instead:
$env:AGENT_REVIEW_CODE = 'code-insiders'; npm run smoke:ui.