[BUG] Agent edited files during plan mode, then destroyed user work with careless git checkout

Resolved 💬 3 comments Opened Jan 18, 2026 by WeZZard Closed Jan 22, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Session ID: 4ad665ba-0464-4a61-bc3b-472d2f0f717d

Description:

During an active plan mode session, the agent violated plan mode rules by directly editing source files instead of only the plan file. When the user pointed out the error, the agent attempted to revert its changes using git checkout, which also reverted the user's uncommitted work that existed before the session began.

The agent then compounded the error by running additional git commands that removed more user files (a shared/ directory).

Actual Behavior:
Agent edited source files directly during plan mode
Agent used git checkout to "fix" the error, destroying user's uncommitted work
User lost their refactoring work
Impact: High - Data loss of user's uncommitted work

What Should Happen?

Expected Behavior:

Agent should NEVER edit non-plan files during plan mode
If agent makes an error, recovery should not destroy user's pre-existing work
Agent should check for uncommitted changes before running destructive git commands

Error Messages/Logs

Steps to Reproduce

Steps to Reproduce:
Have uncommitted changes in the working directory
Enter plan mode
Ask agent to plan changes to files
Agent incorrectly edits actual files instead of plan file
User tells agent to revert
Agent runs git checkout -- <files> which reverts both agent changes AND user's pre-existing uncommitted work

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

Claude Code IDE Plugin: 2.1.11

Platform

Google Vertex AI

Operating System

macOS

Terminal/Shell

VS Code integrated terminal

Additional Information

_No response_

View original on GitHub ↗

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