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
Support a root folder for aggregating sessions across subdirectories in Opencode #1877
I've been wanting to use multiple worktrees with Opencode, to reach a similar ease-of-workflow as https://conductor.build supports for Claude Code.
Opencode can almost get there - I can create worktree for a task like a ticket, then start opencode in that worktree.
But the biggest challenge is coming back later to continue the work. I have to either keep track of tons of opencode worktrees, always cd in then start opencode to come back to the correct worktree each time, and I don't get a smooth list anywhere of all recent worktree-sessions.
Solution
I think a great solution to this would be twofold:
Add configuration for a project to set one "root folder" to capture all sessions from all subfolders.
This means if I set a project's 'session root' to /home/my-app, then running opencode anywhere within my-app/** would capture one master session list at /home/my-app.
Then, add "cwd" metadata to each session in the list. Then when switching sessions have opencode switch to that session's cwd automatically.
Then if I started a session under my-app/worktree/feature-a, I could later find it by running opencode anywhere under my-app - then I select feature-a's session and it cd's into worktree/feature-a for me and I can continue working.
Then when I'm ready, I just switch over to feature-b seamlessly via /sessions, without even closing opencode or cd-ing in the terminal.
This would make /sessions effectively be the index of all my open work in all my worktrees, and allow this multi-task multi-folder workflow.
Followup
After this feature, the follow-up feature is the ability to have opencode change its own working directory via its own api. Then I could for example tell it
"{task description}
create a git worktree for this task, then change the current session's cwd to that worktree's folder
And opencode would create the worktree, move the session into the worktree's folder for me, and switch to it.
Then I could finally create a subagent to start up new worktree-sessions for me easily
changed the title [-]Add `cwd` to sessions and 'root folder' to support worktrees[/-][+]Add 'root folder' configuration for sessions, set `cwd` when going into sessions, to support worktrees[/+]on Aug 12, 2025
changed the title [-]Add 'root folder' configuration for sessions, set `cwd` when going into sessions, to support worktrees[/-][+]Support a root folder for aggregating sessions across subdirectories in Opencode[/+]on Aug 12, 2025
i have a branch where we're doing an overhaul to support this - it's for our work on building an app similar to conductor
Reacted by Arsham Shirvani, Stephen Collings, Andrew Joslin, Yasin Kavakli, Lucas Pedro Bordignon, Brian Cheung, Benjamín Eidelman, 0xPhaze, James Stone, Aidan Gallagher and 6 more
I think this is needed for worktrees to share sessions. In v1.3.3, I could see all opencode sessions across worktrees for the same repo/project, but after upgrading, this seen to be no longer the case. For context, I’m using worktrunk, where worktrees are created as sibling directories, e.g.:
my-repo
my-repo.feature-1
my-repo.feature-2
With newer setup, not being able to access sessions across worktrees is kinda worsened the UX/DevX. The newer isolated approach also means sessions are lost once a worktree is removed. I'm still currently keeping 1.3.3 pinned for this reason.
Badly needed, sharing sessions across worktrees makes the experience way better. At the moment I have custom tooling to copy sessions to worktree which is not great.
Activity
[-]Add `cwd` to sessions and 'root folder' to support worktrees[/-][+]Add 'root folder' configuration for sessions, set `cwd` when going into sessions, to support worktrees[/+][-]Add 'root folder' configuration for sessions, set `cwd` when going into sessions, to support worktrees[/-][+]Support a root folder for aggregating sessions across subdirectories in Opencode[/+]thdxr commentedon Aug 12, 2025
i have a branch where we're doing an overhaul to support this - it's for our work on building an app similar to conductor
yasinkavakli commentedon Aug 20, 2025
How's it going with this feature Dax? Because I like this idea 👍
tarrencev commentedon Dec 26, 2025
Very excited for this. I'm currently a Conductor user but would prefer the server / client architecture of opencode that enables remote sessions
thdxr commentedon Mar 25, 2026
To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.
dezren39 commentedon Apr 9, 2026
still would be good
erzhtor commentedon Apr 18, 2026
I think this is needed for worktrees to share sessions. In v1.3.3, I could see all opencode sessions across worktrees for the same repo/project, but after upgrading, this seen to be no longer the case. For context, I’m using worktrunk, where worktrees are created as sibling directories, e.g.:
With newer setup, not being able to access sessions across worktrees is kinda worsened the UX/DevX. The newer isolated approach also means sessions are lost once a worktree is removed. I'm still currently keeping 1.3.3 pinned for this reason.
axsuul commentedon Apr 18, 2026
Badly needed, sharing sessions across worktrees makes the experience way better. At the moment I have custom tooling to copy sessions to worktree which is not great.
ryands17 commentedon May 7, 2026
@axsuul How do you copy sessions to a worktree?