Repository navigation
Multi-folder projects: primary repo plus read/search folders (#514) - #1653
Conversation
A project can list secondary folders next to its primary path. The primary keeps git, worktrees, AGENTS.md/skills/memory. Agents can read and search the secondary folders; writes are denied until the user grants a folder on a thread's permission card. - projects.update accepts folders (absolute, existing, local only, max 8) - claude: --add-dir per folder, plus a permissions.ask Edit(//dir/**) rule for ungranted folders (prompts even under acceptEdits/bypass, 2.1.283) - permission card: "Allow writes to <folder>" persists a per-thread grant - every provider gets a [Project folders] prompt note; non-claude writes stay blocked by the existing write.outside guardrail hooks - project editor "Other folders" field and a "+N folders" sidebar badge Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 638d015a35
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| function secondaryFolders(project) { | ||
| if (!project || project.remoteHost || !Array.isArray(project.folders)) return []; | ||
| return project.folders.filter((f) => typeof f === "string" && path.isAbsolute(f)); |
There was a problem hiding this comment.
Reject or translate secondary folders for WSL projects
On Windows, a project rooted at \\wsl$\<distro>\... has no remoteHost, so this returns its Windows UNC folder paths even though runs cross the WSL boundary. Claude explicitly drops these folders when crossesBoundary(project) is true, while foldersNoteFor still tells every provider they are available using host-side paths; consequently WSL users can configure folders that agents cannot read or search. Detect wslTarget(project) here or reject/translate these paths during normalization.
Useful? React with 👍 / 👎.
| const p = path.resolve(s); | ||
| if (p === primary) continue; |
There was a problem hiding this comment.
Compare Windows folder identities case-insensitively
On Windows, paths are case-insensitive but these string comparisons are not. Entering the primary checkout with different casing, such as c:\repo for a project stored as C:\Repo, therefore stores the primary as a secondary folder and installs an ask rule over ordinary project edits; casing variants are likewise not de-duplicated. Canonicalize folder identities before comparing them so the primary cannot become its own read-only secondary folder.
Useful? React with 👍 / 👎.
| for (const f of folders) { | ||
| const rel = path.relative(f, abs); | ||
| if (rel === "" || (!rel.startsWith("..") && !path.isAbsolute(rel))) return f; |
There was a problem hiding this comment.
Match the most specific configured folder
When configured folders overlap, this first-match loop assigns every nested edit to whichever ancestor appears first. For example, with [/shared, /shared/private], granting only /shared/private still leaves edits there classified as the ungranted /shared; conversely, granting the ancestor can auto-allow a request raised by the still-ungranted nested folder. Select the longest containing path or reject overlapping folder entries so each displayed grant controls the folder it names.
Useful? React with 👍 / 👎.
Closes #514.
A project can now list secondary folders next to its primary path. The primary keeps git, worktrees, AGENTS.md / skills / memory (#179 keying unchanged). Agents can read and search the secondary folders. Writes there are denied until the user grants that folder on the thread's permission card.
What changed
project.foldersholds the ordered secondary folders (absolute, must exist, local projects only, max 8, de-duplicated, primary skipped). Turning a project remote clears them. Grants live per thread inthread.folderWriteGrants. Shared helpers are inelectron/projectFolders.js.--add-dir=<dir>. Ungranted folders also get apermissions.askrule,Edit(//dir/**), merged into the single--settingsJSON with fastMode. I checked this against the real CLI (2.1.283): the ask rule still prompts under acceptEdits and bypassPermissions, reads in the added dir need no prompt, and primary-folder writes are unchanged. The folder lists are part of the warm-CLI reuse key, so a grant respawns the CLI on the next turn.allowFolder). That allows the edit and saves the grant. If a folder is granted mid-run, the warm CLI still has the ask rule, so those edits are auto-allowed only in modes that would auto-allow a primary edit.[Project folders]note listing each folder as read-only or granted.Known limits (v1)
write.outsideguardrail hooks, and for Codex also by the sandbox. They have no grant path. With guardrails off, only Codex's sandbox still blocks.--add-dirfolders.Tests
electron/test/project-folders.test.jscovers validation, the argv/settings shape, the prompt note, and a full ask →allowFolder→ allow run through a fake Claude CLI.test/permissionPrompt.test.tsxandtest/editProject.test.tsx.test:electron4792/4792 (CODER_* env stripped, CI-style), related renderer suites 297/297,tscandvite buildclean.🤖 Generated with Claude Code