DEV Community

Bryan Doss
Bryan Doss

Posted on

Introducing muxtree: Dead-Simple Worktree + Tmux Sessions for AI Coding

There are already tools for managing parallel AI coding sessions. The Codex app handles it natively, and projects like Conductor give you orchestration across agents. They're great, but they're opinionated about how you work and over engineered for what I need.

I wanted something dumber. Something that just sets up the workspace and gets out of the way.

I built muxtree; a single bash script that pairs git worktrees with tmux sessions. You pick which agent runs where, you switch between them freely, and everything uses the Claude Code or Codex CLI you already have installed on your machine. No wrappers, no abstractions over the agent itself.

One command

muxtree new feature-auth --run claude
Enter fullscreen mode Exit fullscreen mode

You get:

  • A git worktree branched from main
  • Your .env, CLAUDE.md, etc. copied over
  • A tmux session with two windows — dev and agent — with Claude Code already running in the agent window
  • A terminal window attached to the session

Switch between windows with Ctrl-b n / Ctrl-b p. That's the whole interface.

Why tmux

Because you need to check on your agent, glance at your dev server, then jump back. Tmux windows make that instant. And because tmux sessions persist, close your terminal, come back later, everything's still running. Most importantly, I’ve started SSH-ing into my work computer from my phone and tmux means I can easily pick up where I left off.

muxtree sessions close fix-bug           # walk away
muxtree sessions open fix-bug --run claude  # pick up where you left off
Enter fullscreen mode Exit fullscreen mode

Run different agents on different tasks

muxtree new feature-auth --run claude
muxtree new fix-bug --run codex
muxtree list                             # see everything at a glance
Enter fullscreen mode Exit fullscreen mode

No lock-in. Use whatever CLI is on your $PATH. You don't even have to use agentic coding to make use of it.

Setup

cp muxtree /usr/local/bin/muxtree && chmod +x /usr/local/bin/muxtree
muxtree init
Enter fullscreen mode Exit fullscreen mode

Three questions: where to put worktrees, which terminal app, which files to copy. Done. Tab completion for bash and zsh included.

No dependencies beyond git and tmux. No package manager. One bash script, MIT licensed.

GitHub: https://github.com/b-d055/muxtree

Top comments (3)

Collapse
 
nedcodes profile image
Ned C

i've been running into the problem where one agent modifies a shared config file and the other agent's context is suddenly wrong. worktrees would fix that. curious if you've hit issues with agents trying to read files from the main worktree instead of their own though. in my experience the path assumptions baked into .cursorrules or CLAUDE.md sometimes point to absolute paths that break in a worktree copy.

Collapse
 
b-d055 profile image
Bryan Doss

@nedcodes Oh, that’s interesting. I haven’t run into that cross pollution issue, however I don’t have any hardcoded paths in any of my agents/claude.md files. Whenever there’s a change these files I try to keep a close eye on them, especially if I had an agent make the change. I also usually don’t allow Claude or codex read files above of the current repository. But I could see it being an issue if it decided to checkout a different branch in the worktree.

Collapse
 
nedcodes profile image
Ned C

the cross pollution i hit was more subtle than hardcoded paths. it was shared config that both worktrees import from and one agent updated it without realizing the other tree was mid-task. restricting reads above the repo root would help with some of that but not the shared state timing problem. probably an edge case for most setups though