Feature Request: Native Undo/Checkpoint/Restore Functionality

Resolved 💬 5 comments Opened Aug 18, 2025 by coygeek Closed Sep 29, 2025

Title: Feature Request: Native Undo/Checkpoint/Restore Functionality

Is your feature request related to a problem? Please describe.

Claude Code is an incredibly powerful agentic tool. When it's on the right track, it can make numerous file modifications, run commands, and refactor code at a speed that's impossible to follow manually. However, when a task goes slightly off-course, it can be very difficult and time-consuming to revert the workspace to its state before the error. There is currently no built-in, user-friendly way to "undo" a series of actions or restore the project to a known good checkpoint.

The current solution for this problem relies entirely on the user manually implementing a complex checkpointing system using the hooks functionality. This is a significant barrier for several reasons:

  • High Complexity: It requires a deep understanding of the hooks system, shell scripting (bash, python, etc.), JSON parsing (jq), and Git commands (stash, commit, reset).
  • Not Discoverable: A new user would have no idea this is even possible without extensively reading the documentation and piecing together a solution.
  • Fragile & Boilerplate: Every team or user has to reinvent this wheel, leading to custom, potentially buggy scripts that aren't robustly maintained.
  • Poor User Experience: The process is entirely backend-driven. There is no UI for viewing, managing, or understanding the checkpoints created by the hooks.

A core safety and usability feature like this should be a first-class citizen in the tool, not a DIY project for advanced users.

Describe the solution you'd like

I propose the introduction of a native, built-in checkpoint and restore system that is managed directly by Claude Code. This would make the tool dramatically safer and more powerful, encouraging users to trust it with more complex, multi-step tasks.

This feature could be exposed to the user through a few simple, intuitive slash commands:

  • /checkpoint [name] or /save [name]: Manually create a named checkpoint of the current state of all tracked files in the workspace.
  • /checkpoints or /history: List all available checkpoints (both manual and automatic) with timestamps and optional names. This could present an interactive selector.
  • /restore <checkpoint_name_or_id> or /undo: Restore the workspace to the state of a specific checkpoint. This command should have a confirmation prompt to prevent accidental data loss.

Key Implementation ideas:

  1. Automatic Checkpoints: In addition to manual commands, Claude Code could automatically create a checkpoint before executing any file modification tool (Edit, MultiEdit, Write). This provides a granular history of Claude's actions, allowing users to undo a single incorrect step. This could be a configurable setting.
  2. Git-Powered Backend: The most robust implementation would leverage Git behind the scenes.
  • Git Stash: Each checkpoint could be a git stash with a descriptive message like claude-checkpoint: 2025-08-16-15:30:15. This is clean and doesn't pollute the commit history. Restoring would be a git stash apply.
  • Temporary Branch: For ultimate safety, a /session start could automatically create a claude-session/<timestamp> branch, isolating all of Claude's work. A /session commit could merge it back, while a /session discard would simply delete the branch.
  1. User-Friendly Interface: The /checkpoints command should provide a clear, interactive list, perhaps even showing a diff of the changes between the current state and the selected checkpoint before restoring.

Describe alternatives you've considered

I am aware that this functionality can be emulated today using the hooks system, as outlined in the documentation. The primary alternative is to write custom scripts that trigger on PreToolUse or SessionStart events.

For example, one could configure a PreToolUse hook for the Edit|Write matcher that runs a shell script to perform a git stash push "Claude Checkpoint". An "undo" would require the user to manually drop out of Claude Code and run git stash pop.

While this is a powerful demonstration of the flexibility of hooks, it is not an adequate substitute for a native feature because it places the burden of implementation, security, and maintenance entirely on the user. A native solution would be more robust, secure, and accessible to all users, not just those proficient with shell scripting and system configuration.

Additional context

Implementing a reliable undo/restore feature would be a game-changer for user trust and confidence. It would empower users to let Claude attempt more ambitious, "agentic" tasks, knowing they can easily roll back any changes if the agent goes down the wrong path. This aligns perfectly with Claude Code's vision as a powerful, action-oriented coding assistant.

Thank you for considering this feature request. I believe it would significantly enhance the usability and safety of Claude Code.

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗