mulligan is an undo tool for coding agents, provided as a command-line tool. Its core purpose is to address unexpected changes that agents may make while modifying a project, especially shell command changes that the agent's own undo functionality cannot cover.
Main capabilities include: automatically snapshotting project files at every prompt, tool call, and end of turn; viewing the timeline with mulligan list, viewing diffs between any two points with mulligan diff, restoring to any snapshot point with mulligan undo, with redo support; restoring only a single file or folder; storing snapshots in a separate git repository outside the project without touching the user's repository; capturing file changes caused by shell commands; skipping files over 10MB, sockets, pipes, nested repositories, and submodules; a default limit of 500 snapshots, 30 days, and 2GB per project, configurable; no network access or telemetry, prompt content is stored locally only by default and can be disabled.
Usage: download the binary to ~/.local/bin via the install script, or build from source (requires Swift 6.1+). Use mulligan setup <agent> to get agent configuration instructions; mulligan does not automatically edit configuration files. For agents without hooks, use mulligan run -- <agent>. In folders without git, run mulligan init first.
Use cases: developers using coding agents such as Codex, Claude Code, Gemini CLI, OpenCode, Cursor, Copilot CLI, and Aider who need to safely undo changes made by the agent and its shell commands.
Limitations: Windows is not currently supported; requires git 2.25+; macOS requires 13+; Linux requires x86_64 or ARM64; does not back up ignored files, oversized files, or nested repositories; it is not a backup tool, and keeping commit and backup habits is recommended.