Claude rewrote committed application code without preserving prior state, causing loss of user work
Resolved 💬 2 comments Opened Jun 1, 2026 by Guimaraes-Andre Closed Jun 5, 2026
Summary
A Claude Code session (Sonnet) rewrote my Android React Native app from scratch, replacing the existing visual design with a different one in committed code, despite my project having an explicit CLAUDE.md instruction to commit any unsaved work before making changes.
Impact
- ~5 weeks of incremental design work effectively lost from the
App.tsxlineage (preserved only by chance in a file namedApp.tsx.broken) - Several hours of subsequent token-billed sessions trying to recover the original design
- The "rollback to a previous commit" guarantee that git is supposed to provide was rendered useless — because the rewrite session never committed the prior state before replacing it
Reproduction context
- Project: React Native / Expo Android app
- CLAUDE.md contained: "Sempre commitar antes de instalar APK; garante ponto de recuperação por cada install"
- Between Apr 11 and May 18 2026 my local working code accumulated significant changes
- A Claude session on May 19 made multiple commits, but each was a rewrite of the running state, not a preservation of it
- Result:
git checkout <any commit before today>does NOT restore the design that was running in production
What should have happened
Before any rewrite or substantial refactor, Claude should commit the current state as a snapshot ("WIP: before rewrite") and only then proceed. This is a baseline software engineering discipline, made explicit in my CLAUDE.md.
Request
- Token credit for sessions spent recovering from this loss
- Strengthen Sonnet's default behaviour to commit current state before destructive operations, regardless of whether the user is actively monitoring
- Acknowledge that "commit before install" type rules in CLAUDE.md should be load-bearing, not advisory
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗