Feature Request: Session-level undo/rollback for AI-generated changes
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
Problem
Currently, Claude Code lacks the ability to undo all changes made during a session. If Claude makes breaking changes across multiple files, there's no built-in way to rollback to the state before Claude started making edits. This creates significant risk when using Claude Code for complex refactoring or feature implementation.
Real-world scenario that prompted this request
Asked Claude Code to help with a refactor
Claude made changes across multiple files
Initially accepted the changes
Discovered everything was breaking
Had not committed the working version beforehand
No way to easily undo all of Claude's changes at once
Had to manually revert files using VSCode Timeline or git restore
How other AI coding assistants handle this
Cursor:
Maintains a session history of all AI-generated changes
Provides "Undo AI changes" functionality
Allows reverting the entire conversation's changes with one action
Aider:
Tracks all changes made during the session
Supports /undo command to rollback changes
Can undo specific commits or entire sessions
Proposed Solution
Add session-level change tracking with the ability to:
Track all edits made by Claude during the current session
Maintain a diff/patch of every file modification
Include timestamps and associated conversation context
Provide undo commands:
/undo - Undo the last change Claude made
/undo-all - Revert all changes from this session
/undo-to <message-id> - Revert to a specific point in the conversation
Session snapshots:
Automatically create a lightweight snapshot before first edit
Allow manual snapshots with /snapshot command
Show snapshot list with /snapshots
Visual indicators:
Show "Changes made: X files modified" after each Claude action
Provide a diff view of session changes
Warning when session has made 10+ file modifications
Alternative Solutions
If full session tracking is too complex initially, even a simpler approach would help:
Automatically create a git stash or temporary commit before Claude's first edit in a session
Provide a /rollback command that restores to that point
Store the stash reference in session metadata
Why this matters
Reduces risk: Users feel safer asking Claude to attempt complex changes
Encourages experimentation: Knowing you can easily undo encourages trying Claude's suggestions
Prevents data loss: Protects users who forget to commit before AI changes
Matches user expectations: Users coming from Cursor/Aider expect this functionality
Professional workflow: Aligns with how developers actually work (iterative, with safety nets)
Workarounds (current state)
Users currently must:
Remember to manually commit before every Claude session
Use VSCode Timeline to restore individual files
Manually track which files Claude modified
Use git restore on each file individually
These workarounds are error-prone and don't match the developer experience of competing tools.
Additional Context
Platform: All (Linux, macOS, Windows)
Related to: Developer experience, safety features, session management
Priority
Critical - Blocking my work
Feature Category
Interactive mode (TUI)
Use Case Example
I asked Claude Code to refactor my authentication system. Claude made changes across 8 files including middleware, routes, and utilities. After testing, I discovered the changes broke the login flow.
However, I hadn't committed my working code before asking Claude for help. Now I need to manually:
- Remember which 8 files Claude modified
- Use git restore on each file individually, OR
- Use VSCode Timeline to restore each file one by one
With Cursor or Aider, I could simply run /undo-all and instantly revert all AI changes. This would have saved 15+ minutes of manual recovery and reduced the anxiety of letting AI make large-scale changes.
Another common scenario: Claude suggests a "quick fix" that touches 3-4 files. It compiles but breaks runtime behavior. Instead of one command to undo, I have to track down each modified file.
Additional Context
- This issue affects both new and experienced users
- Users coming from Cursor/Aider expect this functionality and are surprised it's missing
- Current workaround requires discipline: manually committing before every Claude interaction
- VSCode Timeline exists but requires manually restoring files one by one
- The lack of this feature makes users hesitant to ask Claude for complex refactoring
- Even a simple implementation (auto-stash before first edit + /rollback command) would dramatically improve confidence in using the tool
- Related to safety and trust in AI-assisted development
Environment:
- OS: Linux (but affects all platforms)
- Claude Code version: [your version]
- Using: VSCode extension
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗