[BUG] No way to detach an already-attached secondary working directory from a session

Status Open
Reported on v2.1.232
Maintainer reply None cached
Activity 0 comments · opened Oct 14, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

There's no way for a session to detach an already-attached secondary working directory. ccd_directory's change_directory tool only changes the primary working directory -- using it to try to remove a secondary one moves the whole session's primary directory elsewhere instead, which is the wrong action entirely.

This was hit when a Claude Code desktop session (primary repo: common-infra) ended up with a second repo also attached as an additional working directory, visible in the desktop app's folder-switcher showing both repos side by side. The user didn't want this and asked for it to be removed, but no tool exists to detach just the secondary directory without disturbing the primary one.

What Should Happen?

A session should have a way to detach a wrongly-attached secondary working directory while leaving the primary working directory and the rest of the session's state untouched -- either a dedicated tool action, or at minimum a documented UI control in the folder-switcher (e.g. a remove/eject control per attached folder).

Error Messages/Logs

Steps to Reproduce

Step 1: Start a Claude Code desktop session with repo A as the primary working directory.
Step 2: Attach repo B as an additional working directory in the same session (e.g. via the folder-switcher, or a tool action that results in a second folder being attached).
Step 3: Decide you want the session back to a single working directory (repo A only), and look for a way to detach just repo B.
Step 4: Observe there is no such action: ccd_directory's change_directory tool only reassigns the session's PRIMARY directory to a new path -- it does not remove a secondary one -- and no other exposed tool offers a detach-this-secondary-folder action. The only option is a manual step somewhere in the app's own UI/session settings, which isn't clearly surfaced either.

Claude Model

None

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

2.1.232 (Claude Code)

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

This also means a session can't safely message another repo's own peer session for cross-repo info while an attached secondary directory lingers -- the session has no way to clean up after itself even once it realizes the attachment shouldn't be there. A workaround was to leave the directory attached and just avoid using it, since nothing in the app's exposed tools could remove it.

View original on GitHub ↗