Why the second pane opens instantly
Starting a coding CLI takes seconds. Pre-warmed sessions hide that wait — here is how we do it without eating your memory.
How PaneScale snapshots a working copy byte for byte without moving HEAD, the index or any branch — and why rewinding refuses to overwrite your edits.
“Undo for agents” sounds simple: save the files before the agent runs, put them back if you don’t like the result. In practice there are three traps, and we fell into each of them before getting it right. This article walks through them, shows how to build the same kind of checkpoint with plain Git commands, and ends with what no checkpoint can undo.
The quickest way to snapshot a working copy is git stash or a commit on the current branch. Both change things the user cares about: the stash list, the branch history, the index. A checkpoint tool that rewrites your index while you’re mid-commit is worse than no tool.
Our approach: checkpoints are commits that no branch points to. They live under a private ref, refs/panescale/checkpoints/<id>, which keeps them safe from garbage collection and out of your git log. To build them we use a temporary index file, so the real index is never read or written. HEAD doesn’t move. Your branches don’t move. Nothing is pushed.
Git is helpful with text: it normalizes line endings and runs filters on the way in and out. For a checkpoint, helpful is wrong. If a file had CRLF line endings before the agent ran, it must have CRLF after a rewind — byte for byte.
Our approach: files are hashed into the checkpoint without filters, so the stored blob is exactly what was on disk. On rewind, every restored file is read back and compared with what was intended.
This is the important one. An agent finishes a step at 14:05. At 14:07 you fix a typo in one of the files it touched. At 14:10 you decide the agent’s step was a mistake and rewind it.
A naive rewind restores every file from the 14:05 checkpoint and silently deletes your typo fix. You wouldn’t notice until much later.
Our approach: rewinding is refusing. Before writing a file back, PaneScale checks that the file on disk is still exactly what the step left behind. If it isn’t — because you or anyone else changed it since — that file is not restored. The result tells you so: “kept: edited after this step.” Everything else is restored, so you get a partial rewind rather than an all-or-nothing failure.
Redo follows the same rules in reverse.
All three save the state of your files. They differ in what else they touch:
git stash | Commit on your branch | Checkpoint under a private ref | |
|---|---|---|---|
| Changes your working copy | Yes — it removes your changes until you pop them | No | No |
| Changes the index | Yes | Yes | No — a temporary index is used |
Moves HEAD or a branch | No | Yes | No |
Shows up in git log / stash list | Stash list | Yes | No |
| Survives garbage collection | Yes | Yes | Yes — the ref keeps it reachable |
The last column is the only one that leaves everything you can see exactly as it was. That is the property an automatic tool needs: it may run a hundred times a day, and you should never notice it ran.
The idea is not magic, and it helps to see it spelled out. This shell version builds a checkpoint without touching your index, HEAD or any branch:
# a private index, so the real one is never read or written
export GIT_INDEX_FILE="$(git rev-parse --git-dir)/checkpoint.index"
git read-tree HEAD # start from the last commit
git add -A # record the working copy in the private index
tree=$(git write-tree)
# a commit that no branch points to
commit=$(git commit-tree "$tree" -p HEAD -m "checkpoint before step 3")
# a private ref keeps it safe from garbage collection
git update-ref refs/checkpoints/step-3 "$commit"
unset GIT_INDEX_FILE
rm "$(git rev-parse --git-dir)/checkpoint.index"To bring a single file back without touching the index, git restore --source=refs/checkpoints/step-3 --worktree -- path/to/file writes the checkpointed version into the working copy only.
This version is useful, but it has the two weaknesses the traps above describe. git add applies Git’s filters and line-ending rules, so the stored bytes are not always the bytes that were on disk, and it skips ignored files. And git restore overwrites whatever is on disk now, including your 14:07 typo fix. A byte-exact checkpoint hashes files without filters — Git has git hash-object --no-filters for that — and a careful rewind compares the current file with the step’s result before it writes anything.
PaneScale takes a checkpoint whenever it is about to change your workspace on your behalf:
Interactive terminal panes are different: you are driving, and the agent is a tool in your hands. For those, isolation through a lane is the safety net — nothing reaches your branch until you merge.
A checkpoint restores files in your working copy. Anything an agent did outside those files is out of its reach:
That is why checkpoints are one layer, not the whole answer. Actions that leave your machine or change your branch go through signed one-time approvals, and agents that run unattended work in their own worktree, so the worst case of a bad step is a lane you discard.
Checkpoints are ordinary Git objects. Unchanged files are shared with every other commit, so a checkpoint only costs what actually changed. Git’s housekeeping keeps the rest compact.
Because Git stores content by its hash, a file that is identical in a hundred checkpoints is stored once. In practice a day of checkpoints on a medium-sized project costs about as much disk space as the changes the agents actually made — usually far less than one node_modules folder.
Details are in the Undo & checkpoints docs.
No. A checkpoint is a safety net for the minutes between your commits, not a history you share. Commit when a change is finished and reviewed; checkpoints only exist so that an agent’s step can be undone without touching the work around it.
A checkpoint is built from the files of your working copy, so it is only as complete as what it records. Build output and dependency folders are usually ignored on purpose, and it rarely makes sense to snapshot them — they can be rebuilt. If an agent changes something outside your project, no checkpoint covers it; that is what lanes and approvals are for.
They are ordinary Git objects under a private ref, so they stay until they are cleaned up. Because unchanged files are shared, keeping them is cheap; the Undo & snapshots docs explain where they live and how they are listed.
Because checkpoints live under a private ref and are never pushed, they stay on the machine where they were taken. Your colleagues never see them, and they never appear in a pull request. That is deliberate: a checkpoint records the state of your working copy at a moment that only matters to you. When work is worth sharing, it becomes a commit on a branch, reviewed like any other.
Starting a coding CLI takes seconds. Pre-warmed sessions hide that wait — here is how we do it without eating your memory.
Why the Token Guardian shows “not reported” instead of a guess — and how real budgets stop runs instead of turning numbers red.
Teammates in PaneScale remember. Here is why everything they remember is passed as context and never as instructions — and why that matters for safety.