Agent destroyed uncommitted work by copying worktree files over working directory
Resolved 💬 2 comments Opened Mar 26, 2026 by zardzomg Closed Mar 26, 2026
Bug Report
What happened:
Claude Code agent launched worktree-based sub-agents that started from git HEAD (clean state), missing all of the user's uncommitted changes. The agents then force-copied their output files back into the user's working directory, overwriting days of uncommitted work across multiple files.
Files destroyed:
server/routes/bookings.js(pro pay assignment changes)web/src/app/[orgSlug]/book/page.tsx(Stripe Connect fix, Nominatim proxy, spec UX redesign)mobile/apps/field-pro/app/(tabs)/jobs.tsxmobile/apps/field-pro/app/(tabs)/more.tsx(language picker)web/src/app/(dashboard)/layout.tsx
Impact:
- Multiple days of development work were overwritten
- No git commits existed to recover from (changes were unstaged)
- VS Code local history was empty — no recovery path
- User had to wait while recovery agents attempted to reconstruct lost work from conversation transcripts
Expected behavior:
- Worktree agents should NEVER copy files back over the user's working directory without explicit permission
- If the working directory has uncommitted changes to files the agent wants to modify, the agent should warn the user and ask before proceeding
- Uncommitted work must be treated as sacred — it represents in-progress work that may not exist anywhere else
Severity: Critical — data loss of user's work product
Environment: Claude Code CLI, macOS, git repo with uncommitted changes
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗