Overview
An OpenCode plugin that creates isolated git worktrees where each worktree automatically opens its own terminal with OpenCode running inside. No manual setup, no context switching, no cleanup work.Why This Exists
Manual worktrees require setup: create the worktree, open a terminal, navigate to it, start OpenCode. This plugin eliminates that friction. When the AI callsworktree_create, your terminal spawns automatically, OpenCode is already running, and files are synchronized. When it calls worktree_delete, changes commit automatically and the worktree cleans itself up.
Works great standalone, but pairs especially well with cmux for agentic workflows. cmux provides native workspace management and programmatic control designed for automated development workflows. Each worktree launch opens a new cmux workspace (no current-workspace reuse). tmux is also supported for traditional multiplexer setups, and remains runtime-priority when already inside a tmux session.
When to Use This
Installation
How It Works
- Create — AI calls
worktree_create("feature/dark-mode") - Terminal spawns — New window opens with OpenCode at the worktree path
- Work — AI experiments in complete isolation
- Delete — AI calls
worktree_delete("reason") - Cleanup — Changes commit automatically, git worktree removed
~/.local/share/opencode/worktree/<project-id>/<branch>/ outside your repository.
Tools
Platform Support
Configuration
The plugin reads.opencode/worktree.jsonc first. A project file created by
the plugin is treated as a placeholder when it still contains only default
values, so the plugin reads ~/.config/opencode/worktree.jsonc when that file
exists. A manually created project config always takes precedence, including
one with only default values. Unchanged default files generated by older plugin
versions are also recognized. The two files are not merged.
If neither config file exists, the plugin creates .opencode/worktree.jsonc
with default values. The plugin does not create a project config when the
global config exists.
~/.config/opencode/worktree.jsonc.
It is used when no project config exists or when the project file is an
auto-generated default that still contains only default values.
Common Configurations
Node.js project:See Also
- Workspace Integration — Full multi-agent workspace bundle.
- Background Agents — Async delegation system.
- KDCO Workspace Guide — Installation walkthrough.