Preflight Checklist
Problem Statement
When I add a directory to my session using /add-dir, there's no way to remove it without ending the entire session and starting over. This becomes problematic during long sessions where I might:
- Accidentally add the wrong directory path (typo or incorrect folder)
- Need to temporarily access another project or repository
- Want to correct a mistake without losing conversation context
For example, if I accidentally run /add-dir /home/user/wrong-path or intentionally add /home/user/temp-project to help with a specific question, there's no way to remove it once I'm done. I'm forced to either:
-
Keep the unwanted directory loaded, which can:
- Increase the scope of what Claude can access (potential security/privacy concern)
- Cause cross-project context pollution
- Reduce focus on my actual working directories
- Impact performance with unnecessary directory indexing
-
Restart the entire session, which means:
- Losing all conversation history and context
Currently, the only solution is to restart the entire session, losing all valuable conversation history and context built up during the session.
Proposed Solution
Add a /remove-dir command that works as the inverse of /add-dir:
Option A: Direct command
/remove-dir /path/to/directory
Removes the specified directory from the current session's working directories.
Option B: Interactive management
Running /add-dir without arguments could show:
- List of currently added directories (both from config and session)
- Interactive checkboxes to add/remove directories
- Clear indication of which are persistent (from settings) vs session-only
Option C: Enhanced /permissions command
Extend the existing /permissions command to show and manage added directories:
/permissions
View current directories
Remove session-added directories
Toggle directory access
The command should:
- Only remove directories added via
/add-dir in the current session
- Not modify persistent directories from
settings.json
- Provide confirmation of what was removed
- Show updated list of active directories after removal
Alternative Solutions
Workarounds I'm currently using:
- Restarting Claude Code sessions (loses all context and history)
- Being very careful about when I use
/add-dir (limits flexibility)
- Manually editing
settings.json if I accidentally persist it (error-prone)
What other tools do:
- VS Code: Workspaces can have folders added/removed dynamically
- IDEs like IntelliJ: Project structure can be modified without restart
- Git:
git rm --cached removes files from tracking without deletion
Priority
Medium - Would be very helpful
Feature Category
CLI commands and flags
Use Case Example
Scenario 1: Correcting a mistake
- I'm working on a project and want to add a related directory
- I accidentally run
/add-dir /home/user/wrong-folder (typo or incorrect path)
- I realize the mistake immediately but the wrong directory is now added
- With this feature: I run
/remove-dir /home/user/wrong-folder, then /add-dir /home/user/correct-folder to fix it
- Without this feature: I either:
- Keep the wrong directory loaded (clutters my workspace, potential security/privacy concern)
- Restart the entire session to correct the mistake (lose all conversation history and context)
Scenario 2: Temporary directory access
- I'm working on my main project in
/home/user/my-app
- A colleague asks about code in a different repository at
/home/user/other-project
- I run
/add-dir /home/user/other-project to help answer their question
- After answering, I want to continue working on my main project without that extra context
- With this feature: I run
/remove-dir /home/user/other-project and continue my session cleanly
- Without this feature: I either:
- Keep the extra directory loaded (performance hit, potential confusion, broader context scope)
- Restart the entire session (lose all conversation history and context)
Time saved: This would save 5-10 minutes per occurrence when correcting mistakes or temporarily adding directories for specific questions, plus preserve valuable conversation context that would otherwise be lost in a restart.
Additional Context
- Currently,
/add-dir only adds directories; there's no corresponding removal command
- The
/permissions command exists but doesn't show or manage added directories
- Session-added directories are not persisted in
settings.json (they're session-only), but there's no way to remove them mid-session
- This would complement the existing
/add-dir functionality and make directory management more flexible
- Related to broader directory/workspace management patterns in modern development tools
Preflight Checklist
Problem Statement
When I add a directory to my session using
/add-dir, there's no way to remove it without ending the entire session and starting over. This becomes problematic during long sessions where I might:For example, if I accidentally run
/add-dir /home/user/wrong-pathor intentionally add/home/user/temp-projectto help with a specific question, there's no way to remove it once I'm done. I'm forced to either:Keep the unwanted directory loaded, which can:
Restart the entire session, which means:
Currently, the only solution is to restart the entire session, losing all valuable conversation history and context built up during the session.
Proposed Solution
Add a
/remove-dircommand that works as the inverse of/add-dir:Option A: Direct command
/remove-dir /path/to/directory
Removes the specified directory from the current session's working directories.
Option B: Interactive management
Running
/add-dirwithout arguments could show:Option C: Enhanced /permissions command
Extend the existing
/permissionscommand to show and manage added directories:/permissions
View current directories
Remove session-added directories
Toggle directory access
The command should:
/add-dirin the current sessionsettings.jsonAlternative Solutions
Workarounds I'm currently using:
/add-dir(limits flexibility)settings.jsonif I accidentally persist it (error-prone)What other tools do:
git rm --cachedremoves files from tracking without deletionPriority
Medium - Would be very helpful
Feature Category
CLI commands and flags
Use Case Example
Scenario 1: Correcting a mistake
/add-dir /home/user/wrong-folder(typo or incorrect path)/remove-dir /home/user/wrong-folder, then/add-dir /home/user/correct-folderto fix itScenario 2: Temporary directory access
/home/user/my-app/home/user/other-project/add-dir /home/user/other-projectto help answer their question/remove-dir /home/user/other-projectand continue my session cleanlyTime saved: This would save 5-10 minutes per occurrence when correcting mistakes or temporarily adding directories for specific questions, plus preserve valuable conversation context that would otherwise be lost in a restart.
Additional Context
/add-dironly adds directories; there's no corresponding removal command/permissionscommand exists but doesn't show or manage added directoriessettings.json(they're session-only), but there's no way to remove them mid-session/add-dirfunctionality and make directory management more flexible