Skip to content

Support a root folder for aggregating sessions across subdirectories in Opencode #1877

Closed as not planned

Description

@ajoslin

(Happy to open PR if feature idea is good)

Problem

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:

  1. 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.
  1. 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

Activity

  1. 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
  2. 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
  3. thdxr commented on Aug 12, 2025

    @thdxr
    Member

    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

  4. yasinkavakli commented on Aug 20, 2025

    @yasinkavakli

    How's it going with this feature Dax? Because I like this idea 👍

  5. tarrencev commented on Dec 26, 2025

    @tarrencev

    Very excited for this. I'm currently a Conductor user but would prefer the server / client architecture of opencode that enables remote sessions

  6. thdxr commented on Mar 25, 2026

    @thdxr
    Member

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

  7. dezren39 commented on Apr 9, 2026

    @dezren39

    still would be good

  8. erzhtor commented on Apr 18, 2026

    @erzhtor

    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.

  9. axsuul commented on Apr 18, 2026

    @axsuul

    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.

  10. ryands17 commented on May 7, 2026

    @ryands17

    @axsuul How do you copy sessions to a worktree?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions