Add /remove-dir command to revoke directory access
Nobody has claimed this yet.
- Dominant language
- Shell
- Stars
- 11.2k
- Forks
- 1.9k
- Avg merge
- 14h 16m
- Merged PRs (30d)
- 6
Description
Describe the feature or problem you'd like to solve
Copilot CLI provides /add-dir and /list-dirs, but no corresponding command to remove a previously allowed directory. Users cannot reduce directory access during a session without restarting or otherwise resetting session state.
Proposed solution
Add /remove-dir <path> as the counterpart to /add-dir. It should:
- Revoke file access to the specified previously allowed directory for the current session.
- Remove the directory from
/list-dirsimmediately. - Unload trusted skills, agents, and instructions loaded from that directory when safe.
- Clearly report active references or running work that prevent immediate removal.
- Return a clear error when the path is not currently allowed.
This improves least-privilege workflows by allowing users to grant temporary access and revoke it as soon as it is no longer needed, without restarting the session.
Example prompts or workflows
-
/add-dir C:\work\shared-library, work with files there, then run/remove-dir C:\work\shared-librarywhen finished. -
Run
/list-dirs, identify an accidentally added directory, and remove it with/remove-dir <path>. -
Temporarily allow access to generated artifacts, inspect them, then revoke access while keeping the current conversation.
-
Attempt to remove a directory used by a running task and receive a clear message explaining what must finish or stop first.
Additional context
A dedicated removal command would make /add-dir reversible and provide a clearer least-privilege permission model. /reset-allowed-tools does not address directory access, and restarting a session is unnecessarily disruptive.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by examining the existing /add-dir and /list-dirs command entry points and how current-session directory permissions are tracked. Define completion against the requested behaviors: removal from /list-dirs, safe unloading of loaded resources, clear reporting for active references or running work, and an error for paths that are not allowed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- shell
- Domain
- cli, security
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100