anthropics / anthropics/claude-code

[BUG] Claude Desktop (Code tab, macOS): claude://code/new link shows its folder but starts the session in a scratch workspace

Open
#95,441 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area:desktop duplicate has repro platform:macos
Dominant language
TypeScript
Stars
147k
Forks
24k
PR merge metrics
PR metrics pending

Description

Summary

A claude://code/new?q=…&folder=<path> link opens the new-session screen with the prompt filled in, and the screen shows <path> as the folder. When the prompt is sent from that screen, the session starts in a freshly minted scratch workspace instead of <path>. If you click any other session, then New session, and send from there, the same draft starts in <path>.

Environment

  • Claude desktop app 2.2553.1 (Code tab), Claude Code 2.1.275
  • macOS 14.8.7

Steps to reproduce

  1. Have a local git repo at ~/dev/<repo> that has been used for earlier Code sessions.
  2. Run open "claude://code/new?q=Reply%20with%20only%20the%20output%20of%20pwd.&folder=%2FUsers%2F<user>%2Fdev%2F<repo>".
  3. On the new-session screen that opens, confirm the folder shown is <repo>, then press send.

Expected

The session starts in ~/dev/<repo> and pwd prints it.

Actual

The session starts in ~/Library/Application Support/Claude/scratch-workspaces/…/scratch-<date>-<id>. main.log shows trust saved for the right folder, then a scratch workspace minted at send:

13:05:49 LocalSessions.saveTrust: cwd=/Users/<user>/dev/<repo>
13:05:49 Saved workspace trust for /Users/<user>/dev/<repo>
13:05:59 LocalSessions.createScratchWorkspace
13:05:59 [CCD] minted scratch workspace …/scratch-2026-09-18-<id>
13:05:59 Starting local session local_<id> in …/scratch-2026-09-18-<id>

Nothing is logged between saveTrust and createScratchWorkspace.

Controlled runs

Same link each time, with a one-line prompt:

Run Before sending Link to send Started in
1 nothing 10s scratch
2 clicked other sessions, came back via New session 94s <repo>
3 nothing, stayed on the screen 65s scratch
4 nothing, screen showed <repo> as the folder 10s scratch
5 clicked one other session, then New session 67s <repo>

So it is not the prompt content and not timing. Sending from the screen the link opened loses the folder. Reloading that screen keeps it.

Other observations

  • It happens for one repo (5 of 6 links since 2026-09-16), while 7 of 7 links to other repos on the same machine landed correctly. I could not tell what distinguishes that repo. It has two extra git worktrees and many earlier sessions.
  • A session that lands in scratch starts in Manual even with "permissions": {"defaultMode": "auto"} in ~/.claude/settings.json. The same link reloaded as above starts in Auto.
  • Workaround in use: a first line in the prompt telling the sender to click another session, then New session, before sending.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at handling for the claude://code/new link and the new-session send path, then compare it with the path after clicking another session and choosing New session. Use main.log to trace LocalSessions.saveTrust and LocalSessions.createScratchWorkspace. Done means the initial screen preserves the requested folder when sending, so the session starts in that repository rather than a scratch workspace.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, macos, python
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.