No history yet

Parallel Session Orchestration

Transcript

Beau

Okay, so last time we set up that whole .trees directory structure, which, by the way, already cleaned up my project root folder so much. It's like, I finally have a place to put all the… the chaos. Each agent has its own little sandbox on a different branch.

Jo

Exactly, sandboxes. That's the perfect word for it. Because now we get to the fun part. We're not just giving one agent a sandbox. We're building a whole playground and letting a team of them work together.

Beau

A team? So we're moving from just running Claude Code in parallel to... what, orchestrating them? Like a symphony of little coding minions?

Jo

That's it. It’s an experimental concept some teams are using called 'Agent Teams'. Think of it like a real software team. You don't have five junior devs all trying to write to the same file at once, right? You have a lead dev or a project manager.

Beau

Okay, yeah, you have someone breaking down the work. The 'user auth' story goes to one person, the 'database migration' goes to another.

Jo

Precisely. So, in our setup, we designate one Claude Code instance as the 'lead coordinator'. This one doesn't write much code. Its main job is to analyze a large task, break it into smaller sub-tasks, and then you, the human, use its output to spawn other 'teammate' agents in separate worktrees to handle those specific jobs.

Beau

So wait, the lead agent isn't automatically kicking off the others? I'm still in the loop?

Jo

You are absolutely in the loop. Think of yourself as the CTO. The lead agent is your project manager. It creates the plan, but you give the final 'go' and assign the tickets. This is critical for safety and control.

Beau

I like being the CTO. So, if I have, say, three worktrees ready from our last session—'feature-api', 'feature-ui', and 'refactor-utils'—how does this actually... look? How am I watching all this happen without going insane with twenty terminal windows open?

Jo

That is the million-dollar question. And the answer is a terminal multiplexer. Something like Tmux, or even the built-in split panes in iTerm2 or Windows Terminal. You're not opening twenty windows; you're opening one window with multiple panes.

Beau

Ah, Tmux. I've always meant to get deeper into that. So you'd have one big pane for the lead agent, and then a few smaller ones for the teammates?

Jo

Exactly. Imagine your screen. The whole left half is one big pane. That's your 'lead' agent in a worktree called, maybe, 'analysis'. You give it a big prompt like, 'Plan the implementation for a new user profile page with editable fields.' And you run it in what we call 'Plan Mode'.

Beau

'Plan Mode'? What does that mean?

Jo

It means you're telling it specifically not to write any files. Its only job is to read the codebase and output a step-by-step plan. This is the most important separation: the 'Analysis-Execution' split. The lead agent plans, but it never, ever touches the actual code.

Beau

Whoa, okay. That's a safety mechanism. So it can't get confused and start writing half-finished thoughts into my main branch.

Jo

It can't. It prevents context leakage and hallucinated file writes. The lead agent's worktree is purely for research. It reads your code and spits out a plan: '1. Create a new API endpoint in `routes/user.js`. 2. Build a React component in `components/Profile.jsx`. 3. Add a new database migration.'

Beau

And then... on the right side of my Tmux session, I have two smaller panes. I take step one from the plan, paste it as a prompt into a teammate agent running in the 'feature-api' worktree. And I take step two and give it to another agent in the 'feature-ui' worktree.

Jo

You've got it. And those agents are in 'Write Mode'. Their environments are isolated. The API agent doesn't know or care about the React component. It just has one job: build the endpoint. You can watch both of them work in real-time, in their own little panes.

Beau

This is a total paradigm shift. Instead of me doing the context-switching between backend and frontend, I'm just delegating and supervising. My brain stays focused on the high-level plan from the lead agent.

Jo

That's the whole point. It reduces your cognitive load. Now, what's the obvious next question when you start running, say, five agents at once?

Beau

My laptop fan starts sounding like a jet engine preparing for takeoff?

Jo

Pretty much. You have to be mindful of your system's constraints. Each Claude Code session is its own process, consuming CPU and RAM. On a modern laptop, you can probably run three or four teammate agents comfortably alongside a lead agent.

Beau

So I should probably keep an eye on my Activity Monitor or Task Manager when I first start experimenting with this.

Jo

Definitely. It’s about finding the right balance. And remember, these worktrees are cheap. Once the API agent is done, you commit its work, merge it, and you can just delete that worktree. It served its purpose. It was a throwaway environment for a specific task.

Beau

So the workflow is: Plan with a lead agent in a read-only worktree. Then, execute with multiple specialized agents in separate, temporary write-enabled worktrees. All while watching from my Tmux control tower.

Jo

You've completely nailed it. You've just described high-performance, multi-agent orchestration. It's moving from being the sole coder to being the director of a team of AI assistants.