claude-code - 💡(How to fix) Fix Desktop Code sessions: option to disable automatic worktree creation [2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#53412Fetched 2026-04-26 05:16:35
View on GitHub
Comments
2
Participants
3
Timeline
5
Reactions
0
Author
Timeline (top)
labeled ×3commented ×2

Error Message

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.

Fix Action

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.

RAW_BUFFERClick to expand / collapse

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:

  1. Conversation history is fragmented — no two Code sessions share a recents list, so previous sessions appear to "disappear" from the sidebar
  2. Sessions cannot be resumed — starting a new Code session creates a new worktree, so there's no way to continue where you left off
  3. Worktrees accumulate — orphaned worktrees pile up after sessions end
  4. 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": false to 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.

extent analysis

TL;DR

Disable worktree creation by adding a setting to claude_desktop_config.json to run Code sessions directly in the repo's working directory.

Guidance

  • Investigate adding a "codeSessionWorktrees": false setting to claude_desktop_config.json to prevent worktree creation.
  • Consider implementing a per-project option to choose between using a worktree or the repo directly when starting a Code session.
  • Explore allowing session resume in the same worktree instead of always creating a new one to improve conversation history continuity.
  • Verify the behavior by checking the project folder structure in ~/.claude/projects/ after starting a new Code session with the proposed setting.

Example

No code snippet is provided as the issue does not imply a specific code change, but rather a configuration adjustment.

Notes

The suggested solution may require updates to Claude Desktop's configuration handling and Code session management. The workaround using the Claude Code CLI suggests that the desired behavior is achievable, but a Desktop-specific solution is needed.

Recommendation

Apply workaround: Use the Claude Code CLI (claude in terminal) until a Desktop-specific solution is implemented, as it maintains conversation continuity by operating directly in the repo directory.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

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.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Desktop Code sessions: option to disable automatic worktree creation [2 comments, 3 participants]