A cli application & tmux plugin for tight integration between tmux, git worktrees and Opencode.
To quickly create isolated environments for coding agents, this cli application automates the following workflow:
- Create a git worktree with a new branch (stored in
$HOME/.local/share/treeai) - Open the worktree in a new tmux session or window, with
opencodeopen - Provide the agent with a prompt (or use the --prompt flag to pass one in without focusing the new session/window)
- Use
<leader>Lin tmux to flick back to your working session while the agent works (you might even create some more trees at this point) - When happy with the agent's work, run
treeai <branch> --mergeto merge the worktree back to the current branch and clean up the tmux sessions/prune worktrees
Note that you must have go>=1.24.2 installed - will be fixed in future, when I'm less lazy.
curl -sSL https://raw.githubusercontent.com/jesses-code-adventures/treeai/main/install.sh | bashOr manually:
git clone https://github.com/jesses-code-adventures/treeai.git
cd treeai && make installAdd to ~/.tmux.conf:
bind-key o command-prompt -p "worktree name:" "run-shell 'treeai %%'"treeai branch-name- Create worktree + tmux session with opencodetreeai branch-name --merge- Merge worktree and cleanup--silent- Suppress output--command "cmd"- Add tmux windows with custom commands--window- Open tmux window instead of session--prompt "prompt"- Send a prompt to opencode in the new session/window--bin "bin"- Binary to launch in the tmux session/window, if notopencode--data "path"- Path to data directory, if not$HOME/.local/share/treeai--gitignore- Use .gitignore instead of .git/info/exclude to exclude worktrees from git--debug- Enable debug logging--copy "file"- Copy a gitignored file to the worktree
make build- Build the treeai binarymake install- Build and install to XDG_BIN_HOME or ~/.local/binmake test- Run all testsmake check- Run fmt, vet, and testmake clean- Remove build artifactsgo test -run TestFunctionName- Run single test functiongo mod tidy- Clean up dependencies
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make your changes following the code style guidelines
- Run tests:
make check - Push to your fork and submit a pull request
MIT License - see LICENSE for details.