Feature hasn't been suggested before.
Note: #1543 requests the same concept. This issue adds a concrete implementation proposal and references the broader set of related symlink issues.
Describe the enhancement you want to request
When working across multiple projects (e.g., a frontend and backend in separate repos, or a shared library), OpenCode can only see files in the directory it was launched from. Files in other directories aren't indexed for @ file search, and reading/writing them triggers permission prompts every time.
This is a common workflow. VS Code and Cursor solve it with "Add Folder to Workspace", which lets you bring additional directories into your current session. OpenCode doesn't have an equivalent.
Related issues:
Multiple PRs (#10366, #11351, #12992, #18291) have tried fixing symlink following, but none have landed. PR #18291 showed that global --follow causes Windows CI timeout due to junction loops. The symlink approach is fundamentally fragile.
Proposed solution: add a workspace field to opencode.jsonc:
Directories listed here would be:
- Indexed for
@ file search (visible in fuzzy picker)
- Accessible without external directory permission prompts
- Watched for file changes
They would not affect snapshots, git operations, project identity, or the existing desktop "workspace" feature (git worktrees). Workspace folders are independent trusted directories that don't participate in branching or undo/redo.
Why this approach:
- Explicit over implicit: no surprise expansion from symlinks or junctions
- Cross-platform: works on Windows, macOS, Linux without junction/symlink issues
- Small surface area: the main change is extending
Instance.containsPath() and File.scan() (~50 lines)
- Familiar pattern: similar to Cursor/VS Code's workspace folders concept
Longer term, workspace folders could be managed directly through the UI (desktop, web, TUI), e.g. an "Add Folder" action that updates the config without manual editing.
Happy to implement this if the approach sounds reasonable.
Feature hasn't been suggested before.
Describe the enhancement you want to request
When working across multiple projects (e.g., a frontend and backend in separate repos, or a shared library), OpenCode can only see files in the directory it was launched from. Files in other directories aren't indexed for
@file search, and reading/writing them triggers permission prompts every time.This is a common workflow. VS Code and Cursor solve it with "Add Folder to Workspace", which lets you bring additional directories into your current session. OpenCode doesn't have an equivalent.
Related issues:
Multiple PRs (#10366, #11351, #12992, #18291) have tried fixing symlink following, but none have landed. PR #18291 showed that global
--followcauses Windows CI timeout due to junction loops. The symlink approach is fundamentally fragile.Proposed solution: add a
workspacefield toopencode.jsonc:{ "workspace": ["../backend", "~/src/shared-lib"] }Directories listed here would be:
@file search (visible in fuzzy picker)They would not affect snapshots, git operations, project identity, or the existing desktop "workspace" feature (git worktrees). Workspace folders are independent trusted directories that don't participate in branching or undo/redo.
Why this approach:
Instance.containsPath()andFile.scan()(~50 lines)Longer term, workspace folders could be managed directly through the UI (desktop, web, TUI), e.g. an "Add Folder" action that updates the config without manual editing.
Happy to implement this if the approach sounds reasonable.