You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: Support explicit workspace naming and make workspace sessions run in the workspace directory via the plugin API #20262
Also, being able to name Workspaces exists already, it's just hard, in the GUI, to find out what branch we are on, and therefor I need to name my workspaces like [branch-name] feature name. But it's fine I guess.
I have a project-level plugin (.opencode/plugins/worktree.ts) that creates a git worktree for each session on session.created. The worktrees are created correctly, but the session directory is always the repo root — so built-in tools like bash, read, and edit still run there instead of in the worktree.
What I'd like is a way to configure this in opencode.json so that every new session automatically gets its own worktree workspace and runs tools there. Something like:
This would make the worktree the default execution context for all sessions in that project, without requiring manual workspace selection in the TUI each time.
@KochC i can second your findings, this was my first approach and I ran into the same limitations. As I understand it, you cant mutate the current active workdir from within a plugin, or at least it is not getting propagated to tools. I tried a different hook, but observation was as you just described.
So if a plugin is able to change the current working directory in a running session, one could make the switch and build up custom workflows. It might also be, that this is intended to create immutable session runtime for stability / security concerns. However, then i would appreciate to be able to at least fork the session with respective runtime settings (e.g. a worktree path becoming the sessions working directory) adjusted for the tools.
Then my above suggestions would even become obsolete :)
I feel like some core features (especially the custom workspace naming) are also discussed in #13592, however my request here goes beyond the manual UI task.
Since a new workspace gets assigned to its own session and the path of the working directory is switched to the assigned work-tree path already in the latest OpenCode versions, I would really love to see this access level possible from within a plugin to enhance customization of workflows in OpenCode.
changed the title [-][FEATURE]: Support explicit workspace naming and make workspace sessions run in the workspace directory[/-][+][FEATURE]: Support explicit workspace naming and make workspace sessions run in the workspace directory via the plugin API[/+]on Apr 8, 2026
Activity
sven1103 commentedon Mar 31, 2026
I was logged in with my agent account, but it is a real feature request :)
jacquesbh commentedon Apr 1, 2026
I don't have the same behavior as you do.
Example:

Also, being able to name Workspaces exists already, it's just hard, in the GUI, to find out what branch we are on, and therefor I need to name my workspaces like
[branch-name] feature name. But it's fine I guess.sven1103 commentedon Apr 1, 2026
Let me clarify:
I built a small plugin prototype to test whether workspace bootstrap can be done from plugin code rather than manually through the UI.
What the prototype does successfully:
experimental.workspace.create(...)session.create({ workspaceID })tui.selectSession(...)What is still not solved:
@opencode-ai/sdk/v2client from serverUrlSo the missing capability is not just “GUI switching”, but “plugin-created workspaces becoming the real execution root for the session”.
I’m aware this is still an experimental feature, so I’m sharing this mainly as informative feedback and as a signal of capability interest.
KochC commentedon Apr 1, 2026
Adding another use case to support this request.
I have a project-level plugin (
.opencode/plugins/worktree.ts) that creates a git worktree for each session onsession.created. The worktrees are created correctly, but the sessiondirectoryis always the repo root — so built-in tools likebash,read, andeditstill run there instead of in the worktree.What I'd like is a way to configure this in
opencode.jsonso that every new session automatically gets its own worktree workspace and runs tools there. Something like:{ "experimental": { "workspace": { "type": "worktree" } } }This would make the worktree the default execution context for all sessions in that project, without requiring manual workspace selection in the TUI each time.
sven1103 commentedon Apr 1, 2026
@KochC i can second your findings, this was my first approach and I ran into the same limitations. As I understand it, you cant mutate the current active workdir from within a plugin, or at least it is not getting propagated to tools. I tried a different hook, but observation was as you just described.
So if a plugin is able to change the current working directory in a running session, one could make the switch and build up custom workflows. It might also be, that this is intended to create immutable session runtime for stability / security concerns. However, then i would appreciate to be able to at least fork the session with respective runtime settings (e.g. a worktree path becoming the sessions working directory) adjusted for the tools.
Then my above suggestions would even become obsolete :)
sven1103 commentedon Apr 8, 2026
I feel like some core features (especially the custom workspace naming) are also discussed in #13592, however my request here goes beyond the manual UI task.
Since a new workspace gets assigned to its own session and the path of the working directory is switched to the assigned work-tree path already in the latest OpenCode versions, I would really love to see this access level possible from within a plugin to enhance customization of workflows in OpenCode.
[-][FEATURE]: Support explicit workspace naming and make workspace sessions run in the workspace directory[/-][+][FEATURE]: Support explicit workspace naming and make workspace sessions run in the workspace directory via the plugin API[/+]github-actions commentedon Jul 4, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.