How to run several Claude Code agents on one repository

Running one Claude Code session per task is easy. Running three on the same feature usually ends in three branches that conflict at review time. This guide sets up vx so the agents land into one shared effort, see each other's work as it happens, and finish as one pull request.

You need Docker with the compose plugin, Claude Code, and a repository on GitHub or any git remote. The examples use a repository called acme/shop-api and three agents named backend, audit and config; replace them with your own.

The shortcut: ask Claude

vx ships a Claude Code plugin with four skills. Install it once:

claudeClaude Code
> /plugin marketplace add TerracodeBA/vx
> /plugin install vx@vx

Then say what you want. "Set up vx for me and connect my repo acme/shop-api" uses the vx:setup skill. "Run three agents on vx to add rate limiting and an audit log to the login endpoint" uses vx:team, which plans the split with you, creates the agents, briefs and launches them, watches, verifies and asks before shipping. The rest of this guide is what those skills do, step by step, so you can run it yourself or understand what Claude is doing.

1. Run the vx server

terminalDocker
$ git clone https://github.com/TerracodeBA/vx && cd vx/deploy
$ docker compose up -d
$ curl -s http://127.0.0.1:7070/healthz
ok

This starts Postgres and vx-server on 127.0.0.1:7070. For a team, run it on a shared server behind HTTPS instead; the deployment guide covers the proxy, users and backups.

To let vx open pull requests on GitHub itself, set VX_GITHUB_TOKEN in deploy/.env: a fine-grained token with Contents and Pull requests read and write. Without it, vx reaches GitHub over SSH and prints a link to open the pull request by hand.

2. Create your user and log in

terminalvx/deploy
$ docker compose exec vx vx-server user-add alice --name "Alice Example" --email alice@users.noreply.github.com
Created user:alice.
Token (shown once): vxt_...

$ go install github.com/TerracodeBA/vx/cmd/vx@latest
$ vx login --server http://127.0.0.1:7070 --token <your token>
$ vx whoami
user:alice

The name and email become the git author of shipped commits, so your GitHub no-reply address works well. The CLI is also on the releases page if you do not use Go.

3. Connect the repository and start an effort

aliceterminal
$ vx repo create acme/shop-api --github acme/shop-api
$ vx effort new "Rate limiting" --repo acme/shop-api --goal "Limit login attempts per IP and record an audit log"

Use --git <url or path> instead of --github for any other remote. The effort starts from the default branch; add --from release/1.4 to start from another one. Note the slug it prints, here rate-limiting.

4. Plan the split

This is the step that decides whether parallel agents help or collide. Before launching anything, write down:

  1. Two to five parts that touch mostly different files, one per agent.
  2. The interfaces between the parts, exactly: package names, function signatures, which agent owns which file. Agents code against each other's interfaces before those exist.
  3. Which part lands a shared file first, such as routes or options that others extend.

Fewer, well-separated parts work better than many overlapping ones. Shared files cause most conflicts, so give each one an owner.

5. Create one identity and working copy per agent

aliceterminal
$ for a in backend audit config; do
    vx agent add "$a" --env-file "$HOME/.vx-agents/$a.env"
    (source "$HOME/.vx-agents/$a.env" && vx clone acme/shop-api rate-limiting "$HOME/work/rate-limiting-$a")
  done

Each agent gets its own identity, such as agent:alice/backend, acting for you. The env file holds the agent's server address and token with mode 600; keep it private. Every change the agent lands records the agent, you, and the model and session from VX_MODEL and VX_SESSION.

6. Start one Claude Code session per working copy

Open a terminal per agent, load its identity, and start Claude Code in its working copy:

terminal 1 of 3backend
$ source ~/.vx-agents/backend.env
$ export VX_MODEL=<model id>
$ cd ~/work/rate-limiting-backend && claude

Give each session a brief that stands on its own: the effort goal and all the parts, so it knows what the others do; the agreed interfaces and the files it owns; its tasks as small steps; and the instruction to use vx, never git, and not to ship. With the plugin installed, Claude picks up the vx:work skill inside a vx working copy and follows the loop below. The vx:team skill writes these briefs for you and launches the agents as background subagents instead of separate terminals.

7. The loop each agent follows

each agentper task
$ vx sync                                   # pick up others' work
$ vx status                                 # own changes, drift, who else is working
$ vx new "Add rate limit middleware"        # one task, one intent
  ...edit files...
$ vx land --run "go test ./..." --run "go vet ./..."
  • One intent per workspace. The intent becomes the commit message when the effort ships.
  • --run makes vx run the checks itself. If others landed in the meantime, vx syncs first and runs the checks on the merged files, so the recorded result describes exactly what lands.
  • An agent blocked on another part runs vx wait --timeout 10m && vx sync, which returns as soon as someone lands.

8. Handling conflicts

vx merges concurrent work file by file, then line by line, and stops only when two agents changed the same lines. Then vx land exits with code 2 and lands nothing. The agent runs vx sync, which writes diff3-style markers with the common base in the middle, resolves them keeping both intentions, re-runs the tests and lands again. vx land refuses files that still contain markers.

If two agents keep conflicting on the same file, pause one and let the other land first. The how vx works page shows a real conflict and its markers.

9. Watch the agents work

Open http://127.0.0.1:7070 and sign in with your token. The effort page updates live: every land with its agent, person, model and checks, who is working right now and on what, per-agent activity, and each change as a unified or split diff. Changes the server had to merge are tagged merged by server, so you can see which results were checked on the final code.

From the terminal, vx effort show rate-limiting --repo acme/shop-api lists open workspaces and vx log inside a working copy lists what landed, newest first, with its checks.

10. Verify and ship one pull request

Check the combined result yourself before shipping. Agents' reports are their own account.

aliceterminal
$ vx clone acme/shop-api rate-limiting /tmp/verify-rate-limiting && cd /tmp/verify-rate-limiting
$ go test ./...
$ vx ship plan --repo acme/shop-api rate-limiting      # the commits and PR text
$ vx ship open --repo acme/shop-api rate-limiting --draft

vx replays every landed change onto the latest main as one commit each, with the agent, person, model and checks as commit trailers, and pushes the branch vx/rate-limiting. With a GitHub token on the server it opens or updates the pull request; without one it prints a link to open it. vx never pushes to main and never merges: you review and merge on GitHub as usual.