anthropics / anthropics/claude-code

Desktop (Linux): Code tab session started without a project folder runs in a throwaway scratch workspace, silently disabling SessionStart hooks

Open
#95,485 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area:desktop area:hooks bug has repro platform:linux
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
  1. On Linux, launch the Desktop app and open the Code tab.
  2. Start a new session without selecting a project folder.
  3. Run pwd in 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:

  1. 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.
  2. 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 .desktop entry cannot carry one: Exec=claude-desktop %U takes URLs,
    and /usr/bin/claude-desktop is 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

  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

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.