About this project

opencode-worktree is a plugin for OpenCode (V1) that automates git worktree management for AI-driven development. When an AI agent calls `worktree_create`, the plugin creates a new git worktree in a dedicated directory, syncs specified files, runs post-create hooks, and spawns a new terminal with OpenCode already running inside. When `worktree_delete` is called, it runs pre-delete hooks, auto-commits changes, and removes the worktree. The plugin supports multiple terminals across macOS, Linux, Windows, WSL, tmux, and cmux, with automatic detection. Configuration is done via `.opencode/worktree.jsonc` or a global config file, allowing file copying, symlinking, and custom hooks. The project is retired for OpenCode V1 only, with no V2 port planned; users are directed to OpenCode V2 native workflows or OCX 2.0.15. It is part of the OCX ecosystem and can be combined with other plugins like opencode-workspace and opencode-background-agents. The repository includes source code, installation instructions via OCX, and a manual installation option. The project is MIT licensed and not affiliated with the OpenCode team.