TL;DR: a git worktree gives each Claude Code agent its own folder and branch. It does not give it its own ports, container names or database volume. We tested two worktrees of one project running the same local stack and wrote down what broke and the config that fixes it.
If you search Claude Code worktree or Claude Code multiple agents in parallel, the advice is to add git worktree add ../agent-feature. That part works. The stack each agent runs is the part that collides.
What we tested
Two worktrees of one repo, each running an API on port 3456 and a Redis container, started with flisk up. The test used Flisk CLI v1.4.47, Docker Engine 29.8.2, macOS on Apple silicon, on 2026-11-10. Flisk is a command-line tool that starts a multi-service app locally.
Three collisions
- Container names. Both worktrees inherit the same project name from
.flisk/project.json, so both want the containerflisk-<project>-redis. The seconduprunsdocker rm -fon the first agent's container, and the first agent's stack shuts down. - Ports. Host ports are fixed: 80 and 443 for the proxy, 10350 for the Tilt dashboard, a Postgres port, and the service ports. A second stack fails with
EADDRINUSE. - Database volume. Both worktrees point to the same
<project>_pgdatavolume. A migration or delete by one agent changes the other's data.
Process state files are fine, because each worktree keeps its own .flisk/native folder. The processes still crash on the port and container conflicts.
The workaround
Give each worktree its own project name:
{ "project": { "name": "my-app-agent-auth" } } That scopes the container names and the volume. Then give each its own ports in the worktree's .env:
# worktree 1 FLISK_HTTP_PORT=8080 FLISK_HTTPS_PORT=8443 TILT_PORT=10351 FLISK_POSTGRES_PORT=15433 PORT=3001 # worktree 2 FLISK_HTTP_PORT=8081 FLISK_HTTPS_PORT=8444 TILT_PORT=10352 FLISK_POSTGRES_PORT=15434 PORT=3002 If you do not want to edit these files, run flisk up, the checks and flisk down one worktree at a time.
What changed since
The test above found that a second flisk up replaced another folder's containers without a warning. Flisk 1.4.57 (2026-11-11) changed that: flisk up now stops before it replaces anything when another existing folder already has containers of the same project name, says which folder, and tells you how to rename the project. flisk down --purge refuses in the same case, so it cannot delete a database another folder uses. Automatic per-worktree scoping of names and ports is still a design, not a feature, so the workaround stays.
Limits
This was two worktrees on one machine, not a load test. Your stack may bind other ports, so list them all before you start a second agent.
Full report: worktree-isolation-findings. Guide: agent-worktree-isolation.