Interactive `claude` launched in a subfolder is filed under a parent dir — shared daemon / bg-spare pool appears anchored to the wrong cwd
Summary
When claude is launched interactively from a project subdirectory, the session is recorded and stored under a different (parent/umbrella) directory than where it was launched. The launch directory is effectively ignored. Headless claude -p from the same folder roots correctly, so the bug is specific to the interactive (daemon-backed) path.
Net effect: every interactive chat started in any subfolder pools into one umbrella project, silently. Project isolation is broken.
Environment
- Claude Code v2.1.177, Linux (aarch64), shell zsh. Reproduces with and without tmux.
Steps to reproduce
cd ~/Apps/spec-kit(a git repo that is a subfolder of~/Apps).- Run
claude(interactive). - The conversation is stored under
~/.claude/projects/<encoded ~/Apps>with recordedcwd = ~/Apps— not~/Apps/spec-kit. - Contrast:
claude -p "..."from the same directory is correctly stored under<encoded ~/Apps/spec-kit>withcwd = ~/Apps/spec-kit.
Expected
Interactive claude should root the session at its launch directory (the cwd of the front-end), identical to headless -p. Launching in ~/Apps/spec-kit should create/append a ~/Apps/spec-kit project.
Actual
The session's recorded cwd and project bucket is the parent umbrella dir (~/Apps), regardless of the actual launch directory.
Evidence (live /proc/<pid>/cwd + cmdline)
- The interactive front-end processes are correctly in the subfolder: multiple
claudeprocesses withcwd = ~/Apps/spec-kit. - There is a single shared
claude daemon runprocess, plus a pool of pre-spawned--bg-spareworker processes. The majority of those spares are anchored to~/Apps(the umbrella), with only a couple at the actual subfolder. - Filesystem ground truth: every interactive session created from the subfolder was filed under the
~/Appsproject withcwd = ~/Apps. The only session correctly filed under the subfolder project was a headless-prun.
This points to the daemon binding sessions to a pre-warmed worker's anchored cwd rather than the front-end's actual launch cwd.
Impact
- Conversations started in different project subfolders all collapse into one parent project — confusing and, for users who organize work per-subfolder, effectively makes per-project sessions impossible via the normal interactive flow. (User report: "I can only have 1 instance" / "everything just falls into ~/Apps.")
Requests
- Root interactive sessions at the front-end's launch cwd (match
-pbehavior); the daemon should not bind a session to a spare worker whose cwd differs from the launch directory. - Provide a documented setting/env to disable the shared background daemon / spare-worker pool, so each
claudeis an independent process rooted where it is launched.
Related
#68373 — covers the (separate) issue of how this same bug report was mishandled in-session. This issue is the underlying product defect.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗