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]: Allow sessions to have custom working directories #9366
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Feature: Allow sessions to have custom working directories
Problem
Currently, all sessions share the same working directory (Instance.directory). This limits the ability to run multiple sessions in parallel when they need isolated file systems, such as:
Working on different git branches simultaneously
Running sessions in sandboxed environments
Supporting non-standard project layouts
Proposed Solution
Add a session.creating plugin hook - Allow plugins to customize session creation, including setting a custom working directory
Add Session.directory accessor - Allow sessions to have their own working directory that tools respect, falling back to Instance.directory if not set
Use Cases
Git worktrees: A plugin could create a separate worktree for each session, enabling parallel work on different branches without conflicts
Sandboxing: Sessions could operate in isolated directories for security or testing
Monorepos: Sessions could target different packages within a monorepo
Implementation
I already started playing around to add this feature and opened these two PRs that would complete the feature:
This is actually already working on CLI side. If you start opencode in a subdirectory of a project - it will set session.directory to that pwd. Allowing a different external_directory permission setup and such.
The POST /session API also has that directory parameter.
Issue is just: the web UI just doesn't currently show these (they are shown in TUI), nor allows to select this (in console you just start in that directory)
Activity
github-actions commentedon Jan 19, 2026
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
ssmirr commentedon Jan 19, 2026
None of those previous issues had a solution proposed or implemented, but I have two (hopefully useful) PRs open that adds the feature.
pschiel commentedon Jan 20, 2026
This is actually already working on CLI side. If you start opencode in a subdirectory of a project - it will set
session.directoryto that pwd. Allowing a differentexternal_directorypermission setup and such.The
POST /sessionAPI also has that directory parameter.Issue is just: the web UI just doesn't currently show these (they are shown in TUI), nor allows to select this (in console you just start in that directory)
R44VC0RP commentedon Jan 25, 2026
Closing as duplicate of #1143 - this is being addressed in PR #9365 which adds per-session working directory support.