Why I Built Agentree: Isolated Development Environments for AI Agents

June 11, 2025

5 mins

Last month, I hit my breaking point with Cursor's API costs. Don't get me wrong - Cursor is great, but when you're grinding through complex refactors, those Claude API calls add up fast. $200/month for Claude's official plan suddenly looked like a bargain.

Before Claude, I tried OpenAI's Codex platform. The async approach seemed promising, but the experience was rough. Every new task meant spinning up a fresh container (painfully slow), and worse - I had to manually set up the environment each time. One project used a private AWS CodeArtifact NPM registry with 12-hour tokens. So my workflow became: generate token locally, update Codex environment, wait for container, hope it works.

Plus, OpenAI models just aren't as agentic. They'd give up on complex problems too quickly, and the branch syncing was a mess. Multiple agents on one branch? Forget it.

I'd actually tried Claude Code a few months earlier, but the API cost model didn't stick for me. When Claude 4 was released, I decided to give it another shot. The Claude Max plan with its effectively unlimited usage (5-hour sessions) made it super compelling. Claude 4 struck the perfect balance - it actually understands what you're trying to build and sticks with problems until they're solved.

But here's the thing: Claude Code is painfully slow for anything non-trivial. We're talking 5-10 minutes for complex changes. As a developer, sitting there watching it think feels like watching paint dry.

The Lightbulb Moment

One night, while waiting for Claude to finish refactoring our auth system, I had a thought: why am I sitting here? Why can't I just spin up another Claude instance to work on that bug fix in parallel?

Turns out, you can't. Well, not easily. Opening multiple terminals with Claude means they'd all stomp on each other's changes. Git worktrees seemed like the answer, but have you ever tried setting up a worktree manually? It's a nightmare:

  1. Create the worktree (easy enough)
  2. Copy over your .env files (annoying)
  3. Copy your .env.local, .dev.vars, and whatever other config files (getting tedious)
  4. Run pnpm install (or npm, or yarn... hope you remember which)
  5. Run your build scripts
  6. Oh wait, you forgot to copy .claude/settings.local.json
  7. Start over

By the time you're done, Claude could've finished the original task.

From Bash Script to Real Tool

I started with a hacky bash script. It worked fine, but honestly? I just wanted an excuse to play with Go.

That's when I decided to rewrite it in Go with the help of Claude. Why Go? Because I wanted to use Bubble Tea - this really cool TUI library I discovered from Dax (@thdxr) on X through his work on SST and terminal.shop. Plus, Go binaries just work everywhere. No dependencies, no "works on my machine" - just download and run.

What Agentree Actually Does

Here's the magic: one command, and you get a fully isolated environment for your AI agent:

agentree -b fix-auth-bug

That's it. Agentree:

  • Creates a new branch (agent/fix-auth-bug)
  • Sets up a worktree in a parallel directory
  • Copies ALL your env files (it reads your .gitignore to find them)
  • Installs dependencies (auto-detects pnpm/npm/yarn/cargo/etc)
  • Drops you into the new directory

Now I can have 3-4 Claude instances running in parallel. One's refactoring the database layer, another's writing tests, and a third is updating docs. They each work in isolation, and I can review their PRs separately.

The Real Game Changer: Parallel Development

Here's what changed my workflow: I can now run multiple Claude instances simultaneously. While one Claude is deep in thought refactoring my database layer (10 minutes and counting), I've got another fixing that UI bug, and a third writing tests.

Each gets its own branch, its own directory, its own context. When they're done, I review each PR separately. It's like having multiple junior developers who never sleep, never complain, and actually understand your codebase.

No more context switching. No more waiting. Just pure, parallelized AI coding.

Try It Yourself

brew tap AryaLabsHQ/tap
brew install AryaLabsHQ/tap/agentree

Then just run agentree -i for the interactive setup. It'll walk you through everything.

What's Next?

Right now, Agentree solves my immediate pain: running multiple Claude instances without conflicts. But I'm building towards something bigger:

  • Claude-specific optimizations: Auto-generate context files, optimize for Claude's workflow
  • Multi-agent handoffs: Start with Claude, hand off to Cursor for UI work
  • Workflow templates: "Fix bug", "Add feature", "Write tests" - each with their own setup

The vision? Make AI agents as easy to manage as Docker containers. Spin them up, let them work, merge their changes, done.

And yes, you could run this stuff remotely or in CI/CD. But honestly? For 99% of my work, I just want Claude instances running on my MacBook while I grab coffee. If I need remote access, Tailscale + SSH from my phone works fine. But that's rare - local development with Agentree just works.


GitHub: https://github.com/AryaLabsHQ/agentree
Homebrew: brew tap AryaLabsHQ/tap && brew install AryaLabsHQ/tap/agentree