[FEATURE] Add a way to remove a working directory from the current session (counterpart to /add-dir)

Resolved 💬 2 comments Opened Jun 4, 2026 by sgiorgi-jw Closed Jun 8, 2026

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

/add-dir (and --add-dir) can add directories to a session's allowed roots, but there's no way to remove one. Confirmed via claude --help: there's --add-dir <directories...> and
no removal flag, and there's no /remove-dir slash command.

This matters because:

  • Extra roots are surfaced in the model's startup environment context. Directories that are no longer relevant become noise the model can wander into — searches fan out into them, file references get ambiguous, and it dilutes focus on the actual working tree
  • Once a directory is in scope (via /add-dir this session, --add-dir at launch, or additionalDirectories in settings), the _only_ way to drop it is to quit, edit/remove the persisted config, and relaunch. There's no in-session correction

Current behavior

  • /add-dir <path> - adds for the session
  • /clear - does not remove added roots (it only clears conversation context), so there's no escape hatch there either
  • Removal requires: locate the source (session flag vs. additionalDirectories in one of three settings files), edit it, restart

Proposed Solution

A /remove-dir <path> slash command that drops a directory from the current session's allowed roots, regardless of how it was added. Mirror the ergonomics of /add-dir:

  • Tab-completion / listing of currently-active roots
  • Clear error if the path isn't currently a root
  • Should the primary working directory be removable? Probably no - refuse with a message

Alternative Solutions

_No response_

Priority

Medium - Would be very helpful

Feature Category

CLI commands and flags

Use Case Example

_No response_

Additional Context

Nice-to-haves

  • /list-dir (or have /add-dir with no args print the current set) so users can see what's in scope before removing
  • A matching --remove-dir is probably unnecessary since you control launch flags, but consistency might warrant it

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗