Do-over: An Undo Button for AI Agent Shell Commands
Summarized by AI from reporting by Hacker News AI, published under our editorial policy.
Do-over is a tool that creates snapshots of files before AI agents like Claude Code execute commands, allowing you to undo accidental deletions. It protects untracked files and those outside your git repository, filling a gap that git alone can't cover.

Key takeaways
- Do-over creates snapshots of files before AI agents like Claude Code execute commands.
- It protects untracked, ignored, and files outside your git repository that git doesn't cover.
- Do-over was inspired by an incident where an AI agent deleted 50GB of data.
- The tool is open-source and available on GitHub for anyone to use.
Do-over is a tool that creates snapshots of files before AI agents like Claude Code execute commands, allowing you to undo accidental deletions. It protects untracked files and those outside your git repository, filling a gap that git alone can't cover.
How Do-over Works
Do-over integrates with Claude Code's hooks to take a snapshot of files that a command is about to modify right before it runs. This means that if an AI agent accidentally deletes or modifies files, you can easily revert to the snapshot and undo the damage. The tool specifically targets files that git doesn't protect, such as untracked or ignored files, as well as files that exist outside your repository.
The Problem It Solves
The inspiration for Do-over came from a real-world incident where an AI agent deleted 50GB of data while tidying up a project. Git is great for tracking changes within a repository, but it doesn't protect files that aren't tracked or those outside the repo. Do-over fills this gap by providing a safety net for these files. It also protects against commands that can be weaponized within git itself, such as git checkout ., git clean -fd, and git reset, which can inadvertently delete important files.
Why It Matters for Everyday Users
For anyone who uses AI agents to manage or tidy up their code, Do-over provides peace of mind. It's a simple but effective tool that can prevent catastrophic data loss. Whether you're a developer working on a large project or someone who occasionally uses AI to clean up files, Do-over ensures that you have a way to undo accidental changes. It's like having an undo button for your entire file system, not just within a git repository.
How to Get Started with Do-over
If you're using Claude Code and want to protect your files, you can start by integrating Do-over into your workflow. The tool is open-source and available on GitHub. To get started, visit the Do-over GitHub repository and follow the installation instructions. Once installed, Do-over will automatically create snapshots before any command is executed, allowing you to undo changes if something goes wrong.
Frequently asked
- Is Do-over compatible with other AI agents besides Claude Code?
- Currently, Do-over is designed to work with Claude Code's hooks. Compatibility with other AI agents would depend on their specific hook systems.
- Can Do-over replace git?
- No, Do-over does not seek to replace git. It complements git by protecting files that git doesn't track, providing an additional layer of safety.
- How do I install Do-over?
- You can install Do-over by visiting its GitHub repository and following the provided installation instructions.