anthropics / anthropics/claude-code
Desktop (Linux): Code tab session started without a project folder runs in a throwaway scratch workspace, silently disabling SessionStart hooks
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 147k
- Forks
- 24k
- PR merge metrics
- PR metrics pending
Description
Preflight Checklist
- I have searched existing requests and this issue is not a duplicate
- This is a single issue (not multiple)
Environment
- Claude Desktop 2.2553.1 (deb package)
- Ubuntu 26.04.1 LTS (server install with KDE Plasma added), Wayland
- Code tab, local session
Summary
When a Code tab session is started without picking a project folder, the app
does not fall back to a real directory. It creates a throwaway workspace:
~/.config/Claude/scratch-workspaces/<uuid>/<uuid>/scratch-<date>-<hash>
This differs from the behaviour described in #79804 (falls back to $HOME)
and #90736 (falls back to the globally last-used folder). In both of those the
cwd is at least a real, persistent directory. Here it is a directory that
exists only for the lifetime of the session.
Impact: SessionStart hooks fail silently
This is the part I have not seen reported. settings.json hooks are shared
between CLI and Desktop, and they do fire in the Desktop app — I verified
UserPromptSubmit, PreToolUse and Stop all trigger normally.
But a SessionStart hook that derives a workspace identity from cwd gets a
path that matches nothing it knows, so it exits without output. In my setup
that meant no session notes, no required reading, and no issue inbox — and
crucially no error, because "unknown directory, stay quiet" is the correct
behaviour for such a hook. The failure is indistinguishable from "nothing to
report".
A user with project-scoped hooks therefore loses them entirely, with no signal
that anything was skipped.
Steps to reproduce
- On Linux, launch the Desktop app and open the Code tab.
- Start a new session without selecting a project folder.
- Run
pwdin the session.
Expected
The session starts in a real directory — the last-used folder, a configurable
default, or an explicit prompt to choose one.
Actual
The session starts in a per-session scratch directory that is removed when the
session ends.
Request
Either of these would resolve it:
- A configurable default project folder for new Code tab sessions. Cowork
appears to have gained this (see #44933); the Code tab has not. I could not
find any such setting in Settings → Claude Code, nor a documented key in the
settings reference. - Failing that, do not fall back to a scratch workspace at all — require a
folder, or reuse the last one.
Notes on workarounds I checked
- No CLI flag equivalent exists (the "CLI flag equivalents" table in the
desktop docs lists none for the working directory). - The
.desktopentry cannot carry one:Exec=claude-desktop %Utakes URLs,
and/usr/bin/claude-desktopis a binary, not a wrapper script. - The
claude://deep links shipped in the app bundle (code/new,
code/continue,code/needs-input) accept no folder parameter.
Related
- #44933 — Cowork: default project folder (same need, different surface)
- #90736 — new session inherits global last-used folder
- #79804 — session without project folder defaults cwd to
$HOME
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the Code tab session from the issue and confirm its working directory with pwd. Then inspect the Desktop documentation, settings.json handling, and the code/new deep-link entry point for working-directory selection; done means a new session uses a persistent directory or explicitly requires one, with SessionStart hooks receiving that directory.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- json, linux
- Domain
- desktop, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100