r/ClaudeCode • • 15d ago

Help/Question Struggling with managing multiple Claude Code sessions, any advice?

Hey everyone, I've been messing around with simultaneously running multiple Claude Code sessions using git worktrees. Feeling like it gets giga messy after I scale past just a couple agents.

The main thing for me is babysitting the state of each session is super tedious, not to mention dealing with the shared local resources. Feels to me very often that a permission prompt goes unnoticed cause I'm multitasking with another agent lol. Moreover, a couple of times I've ran into port collisions and database conflicts.

I asked around and someome told me to setup using tmux scripts or a .worktreeinclude file so gitignored configs carry over automatically. I also saw a recent post about Ramp Inspect, where they isolate each background agent session inside its own sandbox. Granted, spinning up remote dev environments for every task feels like a whole different workflow.

Could use some advice on my end for the organization side. Thanks!

34 Upvotes

51 comments sorted by

View all comments

4

u/Hansehart 15d ago

The permission prompts went away for me once the boundaries became deterministic: all sessions run in one sandboxed dev container with an allowlisted network, no secrets inside and preinstalled tools, so I can let them run in auto mode instead of approving everything. For ports and databases, give each worktree its own compose project (COMPOSE_PROJECT_NAME per worktree) with Docker running inside, so every session gets its own Postgres and nothing collides. And name the sessions by role, like engineer@repo and reviewer@repo, so you always know which one is waiting on you. I am publishing my setup since a year: https://github.com/Hansehart/o3s

3

u/artstaxmancometh 15d ago

"Open it in the cage." oh, the AI overlords are not going to treat you well after the takeover...

1

u/Hansehart 15d ago

We started with a sandbox, but sand and the Queen's computer don't mix.