@axelgar/opentree
v0.1.16
Published
Git worktree manager CLI for orchestrating parallel AI coding sessions
Readme
opentree
Orchestrate parallel AI coding sessions in isolated git worktrees.
Think Conductor, but for the terminal.
opentree is a cross-platform CLI tool that manages multiple AI coding agent sessions. Each session runs in an isolated git worktree with its own branch, orchestrated via tmux. Perfect for working on multiple features/fixes simultaneously without context-switching overhead.
Features
- 🌳 Isolated Workspaces: Each workspace = git worktree + branch + tmux window
- 🤖 Agent Integration: Launch OpenCode (or other agents) automatically in each workspace
- 📊 TUI Dashboard: Interactive terminal UI for managing workspaces (press
?for help) - 🔀 Parallel Development: Work on multiple branches simultaneously without checkout overhead
- 📝 Diff Viewer: Review changes before committing
- 🚀 PR Creation: Create GitHub PRs directly from the TUI with auto-generated title and body
- 🐛 Issue Workflow: Create a workspace directly from a GitHub issue number
- ✅ CI Status: Live CI check status displayed per workspace
- 🔍 Filter & Sort: Filter workspaces by name, sort by name/age/activity/PR status
- 🧹 Clean Lifecycle: Archive workspaces after merge, keeping your repo tidy
- ⌨️ Shell Completion: Tab completion for workspace names in bash, zsh, and fish
Requirements
- Git (2.5+) - for worktree support
- tmux (2.0+) - for session orchestration
- OpenCode (optional) - default coding agent (install)
- GitHub CLI (
gh) (optional) - for PR creation and issue fetching (install)
Installation
Homebrew (macOS/Linux)
brew install axelgar/tap/opentreenpm
npm install -g @axelgar/opentreeFrom Source
git clone https://github.com/axelgar/opentree.git
cd opentree
go build -o opentree ./cmd/opentree
sudo mv opentree /usr/local/bin/Using Go Install
go install github.com/axelgar/opentree/cmd/opentree@latestQuick Start
# Navigate to any git repository
cd ~/my-project
# Launch TUI dashboard (interactive mode)
opentree
# Or use CLI commands directly
opentree new feat/add-auth # Create workspace
opentree issue 42 # Create workspace from GitHub issue #42
opentree list # List all workspaces
opentree attach feat/add-auth # Attach to tmux window
opentree diff feat/add-auth # Review changes
opentree pr feat/add-auth # Create GitHub PR
opentree delete feat/add-auth # Clean up workspaceUsage
TUI Mode (Interactive)
Run opentree without arguments to launch the interactive dashboard:
opentreeNavigation:
↑/k- move up↓/j- move down
Actions:
n- Create new workspace (prompts for branch name, then base branch)i- Create workspace from a GitHub issue numberEnter- Attach to selected workspaced- Show diff for selected workspacep- Create PR for selected workspace (auto-generates title and body from commits)o- Open PR in browserx- Delete selected workspace (shows diff confirmation if uncommitted changes)space- Toggle multi-select on current workspace/- Filter workspaces by names- Cycle sort order (name → age → activity → PR)E- Toggle error log?- Toggle full helpq- Quit
The TUI also shows a live agent output preview for the selected workspace and CI check status badges for open PRs.
CLI Mode (Direct Commands)
Create a Workspace
opentree new <branch-name> [flags]
# Examples
opentree new feat/user-auth # Create workspace with branch
opentree new fix/login-bug --base dev # Branch off 'dev' instead of 'main'Creates:
- Git worktree at
.opentree/<branch-name>/ - New branch (or checks out existing)
- tmux window in
opentree-<repo>session - Launches the configured coding agent in the workspace
Create Workspace from GitHub Issue
opentree issue <number> [flags]
# Examples
opentree issue 42 # Workspace from issue #42
opentree issue 42 --base dev # Branch off 'dev'Fetches the issue from GitHub, auto-generates a branch name (e.g. issue-42-add-dark-mode), and writes a TASK.md file with the issue title, labels, and description into the worktree so the AI agent can start working immediately. Requires the gh CLI.
List Workspaces
opentree listShows table with: branch name, status, last modified time.
Attach to Workspace
opentree attach <branch-name>Attaches to the workspace's tmux window. Detach with Ctrl+b d.
Show Diff
opentree diff <branch-name>Shows git diff between workspace and base branch.
Create Pull Request
opentree pr <branch-name> [flags]
# Examples
opentree pr feat/user-auth # Interactive prompts
opentree pr feat/user-auth --title "Add user auth" --body "..." # Non-interactiveRequires GitHub CLI (gh) to be authenticated.
Delete Workspace
opentree delete <branch-name>
# Examples
opentree delete feat/user-authRemoves the worktree, kills the tmux window, and deletes the branch. If uncommitted changes are detected, a diff is shown and confirmation is required before proceeding.
Install Shell Completion
opentree install-completionAuto-detects your shell (zsh, bash, or fish) and installs tab completion. After installation, workspace names will be completed when using attach, delete, pr, and diff commands.
Configuration
Create opentree.toml in your repo root or ~/.config/opentree/opentree.toml. opentree searches up the directory tree for the config file, similar to how git finds .git.
[worktree]
base_dir = ".opentree" # Where to store worktrees (relative to repo root)
default_base = "main" # Default base branch
[agent]
command = "opencode" # Command to launch agent
args = [] # Additional arguments
[tmux]
session_prefix = "opentree" # Prefix for the tmux session name
[github]
auto_push = false # Auto-push branch before creating PRUsing Different Agents
To use a different coding agent instead of OpenCode:
[agent]
command = "claude" # Or "aider", "cursor", etc.
args = ["--some-flag"]Or override per workspace:
OPENTREE_AGENT_COMMAND="claude" opentree new feat/my-featureHow It Works
Worktrees: Git worktrees allow multiple checkouts of the same repo in different directories. Each workspace lives in
.opentree/<branch-name>/.tmux Orchestration: A single tmux session (
opentree-<repo>) manages all workspaces. Each workspace = one tmux window. Attach to work, detach to switch.State Persistence: Workspace metadata (branch, created time, agent, issue number) stored in
.opentree/state.json.Agent Integration: When creating a workspace, opentree launches your configured agent (default: OpenCode) inside the tmux window, ready to code.
Issue Context: When using
opentree issue, aTASK.mdfile is written to the worktree containing the issue details, giving the AI agent immediate context.
Workflow Example
# Start working on a feature
opentree new feat/add-dark-mode
# Or pick up a GitHub issue directly
opentree issue 42
# (tmux attaches automatically, agent launches)
# (work with AI agent, make changes...)
# (detach with Ctrl+b d when done)
# While that's building, start a bugfix in parallel
opentree new fix/header-overflow
# (work on bugfix...)
# (detach)
# Review changes for first feature
opentree diff feat/add-dark-mode
# Create PR when ready (auto-generates title and body from commits)
opentree pr feat/add-dark-mode
# Clean up after merge
opentree delete feat/add-dark-modeTroubleshooting
"Error: not a git repository"
opentree must be run from inside a git repository. Navigate to your project root first.
"Error: tmux not found"
Install tmux:
- macOS:
brew install tmux - Ubuntu/Debian:
sudo apt install tmux - Arch:
sudo pacman -S tmux
"Error: opencode not found"
Install OpenCode from github.com/anomalyco/opencode, or configure a different agent in opentree.toml.
"Error: gh not found"
Install GitHub CLI from cli.github.com, then authenticate:
gh auth loginWorkspaces not appearing in TUI
State file might be corrupted. Check .opentree/state.json or delete and recreate workspaces.
Contributing
Contributions welcome! Please open an issue or PR.
Development Setup
git clone https://github.com/axelgar/opentree.git
cd opentree
go mod download
go build -o opentree ./cmd/opentree
./opentree --helpArchitecture
See PLAN.md for detailed architecture documentation.
License
MIT License - see LICENSE for details.
Acknowledgments
- Inspired by Conductor.build by Sahil Lavingia
- Built with Bubble Tea TUI framework
- Integrates with OpenCode AI coding agent
