Timemachine
Before the agent runs any tool that changes files, timemachine snapshots your working tree, so anything it deletes or overwrites can come back. In a --dangerously-skip-permissions session there is no prompt between the agent and your files, and plain git protects only what you committed: an uncommitted change or an untracked file the agent clobbers is gone for good. With a snapshot taken first, you get it back.
rm notes.md the file vanishes from your folder restore <id> notes.md one command copies the file back into your tree How it works
A harness plugin, one that dresses up the session itself and never touches your notes. It registers a hook that fires just before any file-changing tool runs (Edit, Write, Bash, and the rest - a PreToolUse hook, in Claude Code terms). The hook saves your tree as a commit under refs/timemachine/, a side shelf inside your repo’s own .git storage that sits on no branch, then lets the tool run. It never blocks anything. A safety net, not a gate.
Exactly what git add -A would stage.
- tracked files you changed
- new files git does not ignore
Anything .gitignore hides: your .env, keys, build output.
Names shaped like secrets are skipped even if you forgot to ignore them:
.env*.pem*.key*.p12*credentials* .git local only, never pushed newest 200 kept, older pruned Commands
node plugins/timemachine/timemachine.js listnode plugins/timemachine/timemachine.js restore <id> <path>node plugins/timemachine/timemachine.js show <id>node plugins/timemachine/timemachine.js statusnode plugins/timemachine/timemachine.js wipelistshows snapshots, newest firstrestore <id> <path>brings a file back into the working treeshow <id>shows what a snapshot holdsstatusshows count, location, last snapshot timewipedeletes every snapshot in this repo
If the agent clobbered something, run list, find a recent snapshot, and restore the path. Commit once the file is back.
Install
imprnt plugin add timemachineThis copies the plugin into plugins/timemachine/ and wires it as a native Claude Code plugin. imp passes the folder to every session it launches, so the hook is active without touching your Claude settings. (Gemini cannot host Claude hooks, so imp --gemini skips timemachine with a warning and runs without the safety net.)
To remove:
imprnt plugin rm timemachineAdding --purge deletes the folder too. Snapshots stay in .git until you wipe them.
Limits
It protects files inside a git repo only, so it pairs with keeping your work in git. It is damage recovery, not security and not an off-machine backup. And a snapshot preserves the state before each tool rather than stopping the tool: the agent still does the thing, you just get to undo it.