[BUG] remote-control --spawn worktree silently deletes completed session worktrees and commits on session end
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?
Bug Description
When using claude remote-control --spawn worktree, all worktree branches and commits
are silently deleted when sessions end (whether completed or failed). There is no window
to review or merge the work. This results in permanent data loss.
Steps to reproduce
claude remote-control --spawn worktree --name "my-project"- Connect from Claude iOS app, start multiple sessions
- Give each session a coding task
- Wait for sessions to complete (or hit rate limit)
- Check
git worktree listandgit branch— everything is gone
Expected behavior
Completed session worktrees should persist with their branches and commits intact
until the user explicitly merges or removes them. At minimum, a warning or merge
prompt should appear before cleanup.
Actual behavior
Worktrees and their branches are deleted the moment a session ends. The server
terminal shows "Session completed" but the work is already gone. git reflog, git branch, and git worktree list show no trace.
In my case, 5 sessions ran (3 completed after ~4 hours each, 2 failed at rate limit).
All work was lost despite the server running continuously.
Environment
- Claude Code version: 2.1.76
- OS: macOS (Apple Silicon MacBook Air)
- Plan: Max
- Terminal: default macOS Terminal
- Connected via: Claude iOS app
Impact
Multiple hours of agent work and significant rate limit usage (~20% weekly)
permanently lost with no recovery path. The completed sessions had working code
that was never merged to any persistent branch.
What Should Happen?
Expected behavior
Completed session worktrees should persist with their branches and commits intact
until the user explicitly merges or removes them. At minimum, a warning or merge
prompt should appear before cleanup.
Error Messages/Logs
Steps to Reproduce
Steps to reproduce
claude remote-control --spawn worktree --name "my-project"- Connect from Claude iOS app, start multiple sessions
- Give each session a coding task
- Wait for sessions to complete (or hit rate limit)
- Check
git worktree listandgit branch— everything is gone
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2-1-76
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗