CCD auto-cleans session worktrees mid-work — breaks remote control workflow
Claude Code Desktop (CCD) spawns every session in a per-session git worktree at .claude/worktrees/<adjective-name-hex>/. The cleanup is automatic and the trigger is undocumented (appears to be post-PR-merge or idle).
When cleanup fires, the session terminates abruptly. Critical impact for users working remotely via Claude Code's remote control feature:
- The remote control connection drops the moment the worktree is removed.
- The user is told "your session has ended" — but they didn't end it.
- If the user is away from their main device (phone, traveling, Dispatch, web client), they cannot reconnect or recover until they physically reach the host machine.
- Work in flight is suspended until that physical reconnection happens.
- For users running live systems (trading, ops, on-call response), this is a hard workflow break — the entire premise of remote control is "I can keep working from anywhere."
Effectively, the current behavior makes long-running remote sessions unsafe to start because the user cannot predict when CCD will pull the rug. This is preventing work, not enabling it.
Use case driving this: live algorithmic trading system. On 2026-05-06 this happened twice in one session during a live-system audit. Each transition cost context continuity and required physical access to the host machine to recover.
Workaround tried: searched for a settings.json key, CLI flag, or env var to disable worktree-per-session. None documented (verified via claude-code-guide agent against official docs).
Requesting any of:
--no-worktreeCLI flag, or"useWorktree": falseinsettings.json, to keep sessions rooted at the origin repo (highest priority for remote-control users)- "Preserve until explicit cleanup" mode where worktrees only clean on user command
- At minimum: a clear warning + grace period (30+ seconds) before auto-cleanup, so the user can
/save-stateand the remote-control client can flag the imminent disconnect
Reproduction: open CCD against a project repo, connect via remote control, work until a PR merges, observe the session terminate within ~1 minute and remote control disconnect.
Severity: high for remote-control users; medium for local-only.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗