Desktop Code sessions: option to disable automatic worktree creation
Problem
Every time Claude Desktop starts a new Code session, it automatically creates a fresh git worktree under .claude/worktrees/<random-name>/. Each worktree gets its own project folder in ~/.claude/projects/, which means:
- Conversation history is fragmented — no two Code sessions share a recents list, so previous sessions appear to "disappear" from the sidebar
- Sessions cannot be resumed — starting a new Code session creates a new worktree, so there's no way to continue where you left off
- Worktrees accumulate — orphaned worktrees pile up after sessions end
- JSONL files get bucketed into worktree-specific project folders (e.g.,
C--Users-Andrew-myrepo--claude-worktrees-random-name-abc123/) instead of the main project folder (C--Users-Andrew-myrepo/)
This is especially confusing when a session is interrupted (crash, "inappropriate use" error, etc.) — the user starts a new session expecting to see their history, but it's in a completely different project folder that Desktop can't resolve.
Expected behavior
An option to run Code sessions directly in the repo's working directory (like the CLI does) without creating a worktree. This would keep all sessions in the same ~/.claude/projects/ folder and preserve conversation history continuity.
Suggested solution
One or more of:
- Setting in
claude_desktop_config.json: e.g.,"codeSessionWorktrees": falseto disable worktree creation - Per-project option: let users choose "use worktree" vs "use repo directly" when starting a Code session
- Session resume: even with worktrees, allow resuming a previous session in the same worktree instead of always creating a new one
Environment
- Claude Desktop on Windows 11
- Claude Code v2.1.119
- Repo with multiple prior Code sessions, all in separate worktree project folders
Workaround
Using Claude Code CLI (claude in terminal) instead of Desktop's Code tab — the CLI operates directly in the repo directory and maintains conversation continuity.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗