mulligan
A do-over for your coding agent. A snapshot every time your agent gets a prompt or uses a tool, shell commands included, so you can see what it did and go back to any point.
mkdir -p ~/.local/bin && curl -fsSL "https://github.com/stanczykwyatt/mulligan/releases/latest/download/mulligan-$(uname -s)-$(uname -m).tar.gz" | tar -xz -C ~/.local/bin mulligan
If it saves you from a bad agent run, a star on GitHub helps other people find it.
free · open source · macos and linux · codex · claude code · gemini cli · any agent · no network access
What you get
$ mulligan list weather-app · 4 snapshots #1 6 min ago prompt: “add a 7-day forecast, and tidy up” #2 5 min ago before Bash: npm run format 23 files changed after #3 4 min ago before Bash: rm -rf src/legacy 6 deleted after #4 3 min ago end of turn $ mulligan undo 2
- Every agent, one timeline. Hooks for Codex, Claude Code, Gemini CLI, OpenCode, Cursor, Copilot CLI, Qwen Code and Pi, and
mulligan run -- aiderfor anything else. - Shell changes too. Snapshots are of your files, so
rm -rf,sed -i, formatters and generators are covered, not just the agent's own edits. - List, diff, undo, redo back to any point, or
restorejust one file or folder. - Undo is undoable. Every restore takes a snapshot first, and changes nothing if it can't.
- Tiny. One small binary for macOS and Linux, with git as its only requirement.
What it never does
- Touch your repository. Snapshots live in a separate repository outside your project. Your history, index, stash and hooks are never read or written.
- Lose a file. It only replaces or removes what it can put back. Ignored files, huge files and nested repositories are left alone.
- Get in your agent's way. Hooks print nothing and always succeed.
- Run at the top of your disk. It refuses your home folder,
/and system folders. - Go online. No network code and no telemetry, checked by CI on every build.
Questions
How do I undo what Codex did?
Add the hooks that mulligan setup codex prints (Codex 0.124 or later), and trust them in /hooks. After a turn, mulligan list shows the snapshots and mulligan undo 2 goes back to one. On older versions, mulligan run -- codex works too.
Claude Code and Gemini CLI have checkpoints already. Why this?
Their checkpoints follow the agent's own file edits. Claude Code's docs say files changed only by Bash commands aren't tracked, and Gemini's rewind doesn't undo shell changes. mulligan snapshots the files themselves, and works the same across every agent you use.
Does it mess with my git repository?
No. It never commits, stages, stashes or checks out anything there, and never changes its .git. You can use it with uncommitted work and a dirty index. SECURITY.md explains how.
What about node_modules and .env?
Anything in .gitignore isn't snapshotted, and an undo never touches it. That keeps snapshots small, and secrets in ignored files out of them.
How much space and time does it take?
Each snapshot stores only the files that changed, compressed. Snapshots are capped at 500, 30 days and 2 GB per project by default. A snapshot takes about a tenth of a second for a project of 5,000 files.