# Cursor Multiple Agents: A Worktree Workflow

Published 2026-12-01. https://kanbanmcp.com/blog/cursor-multiple-agents-worktree-workflow

# Cursor Multiple Agents: A Worktree Workflow

## Key takeaways

- Give each Cursor agent its own git worktree and branch so sessions never overwrite each other's edits.
- Spawn one agent per card, name branches after the task, and keep one card, one branch, one reviewable diff.
- Use a shared board as the system of record once you run three or more parallel sessions across tools.
- Leave a handoff note per card covering the branch, what was completed, what failed, and what comes next.
- Rebase agent branches onto main often and merge the least-overlapping branch first to keep conflicts boring.

Run cursor multiple agents by giving each session its own git worktree and branch, spawning them as background agents from one repo, and merging in a fixed order with a handoff note per branch. That setup keeps three or more parallel sessions isolated, so your morning git diff shows exactly which agent touched what.

## How do you run multiple agents in parallel in Cursor?

Cursor supports several concurrent agent sessions, including background agents that work on a branch while you keep coding in the editor. You spawn them from the agent panel or a prompt, each runs against its own branch, and you check in on them as they work. Cursor's docs cover the spawn options and how background agents pick their branch in the [background agents documentation](https://docs.cursor.com/background-agent).

### What counts as a parallel session

Anything where two or more agent sessions hold uncommitted or unmerged work on the same repo at once: two Cursor background agents, a Cursor session plus a Claude Code run in a terminal, or a Codex job you kicked off before lunch. Three or more is where handoff notes and a shared board stop being optional, which is why the workflow on [KanbanMCP's Cursor guide](https://kanbanmcp.com/agents/cursor) starts there.

### The basic spawn-monitor-merge loop

The loop is the same every time. Spawn one agent per card, isolate each on its own worktree and branch, monitor progress from the panel or your board, then merge branches one at a time and rebase the rest. The next sections turn each of those steps into concrete commands.

## Why does one repo with several agents break without isolation?

### The shared working-tree failure mode

Two Cursor agents pointed at the same checkout edit the same files. Agent A refactors a module while Agent B rewrites its tests; whoever saves last overwrites the other, and the diff is a mess neither agent can reason about. You find out at review time, after both sessions have burned tokens producing work that no longer applies cleanly.

It gets worse with three or more parallel sessions. Stashes, half-finished edits and uncommitted changes pile up in one working tree, and you cannot tell which agent touched what. The board might say two cards are in progress; the repo says nothing useful at all.

### Why git worktrees are the standard fix

`git worktree add ../feature-x -b agent/feature-x` gives each agent its own directory, its own branch and its own checkout of the repo, all sharing one object store. Agents never see each other's edits, diffs stay scoped to one card, and merges happen branch by branch on your schedule.

The remaining problem is coordination: which card is claimed, which worktree is live, and what the last agent left behind. That is the gap a shared board like [KanbanMCP](https://kanbanmcp.com/) fills, so the git setup and the task state stop drifting apart.

## How do you set up a worktree per Cursor agent?

### Step 1: create the worktrees

Run `git worktree add ../repo-taskname -b task/taskname` once per agent. Each worktree gets its own checked-out copy, its own branch and its own node_modules, so two agents can edit the same file without ever seeing each other's changes. The point of a worktree is that isolation happens at the filesystem level, not through discipline. You never rely on an agent remembering which files are "theirs", because the working directory is theirs.

Conflicts surface once, at merge time, in a diff you review, instead of surfacing continuously as agents overwriting each other mid-run. If you already name branches by task, worktrees cost you nothing extra: the branch you would have created anyway now gets a directory attached to it. Delete the worktree with `git worktree remove` once the branch is merged, and your repo stays clean.

### Step 2: branch naming and task scoping

Name branches after the card: `task/add-oauth`, `task/fix-flaky-test`. One card, one branch, one agent, one reviewable diff.

### Step 3: point each session at its worktree

Open a Cursor window per worktree and spawn the agent there. Cursor's agents work on a branch and can open a PR when done, per the [Cursor agent documentation](https://docs.cursor.com).

### Step 4: keep CLAUDE.md as the shared rulebook

Leave CLAUDE.md at the repo root so every worktree inherits the same rules; if a board holds the cards, connect agents to it via [KanbanMCP's setup docs](https://kanbanmcp.com/docs/connect).

## How do you monitor three or more agent sessions at once?

### What Cursor's panel shows and what it doesn't

Cursor's agent panel lists your background agents and their current state, which is enough to spot a session that finished or one waiting on input. What it does not give you is the state of the work: which task each agent owns, what it changed, and what is still open. With three or more parallel sessions, you end up scrolling terminal tails and git diffs in the morning just to reconstruct who did what.

### Using a board as the system of record

A shared board fixes that by making the card, not the chat session, the source of truth. Each agent claims a card, works on it, and moves it along; you watch the same board and steer from it. Because chats stay disposable, the board is what you recover a week later. The reasoning behind separating the system of record from working memory is covered in [agent memory](https://kanbanmcp.com/agent-memory).

### Handoff notes: what the next agent needs to know

The handoff note is the smallest useful unit of coordination: which branch and worktree the agent used, what it completed, what failed, and what the next session should pick up. A note per card beats a long status document because the next agent reads only what it needs before claiming the next task.

## How do you merge work from parallel Cursor agents without conflicts?

Conflicts come from two things: tasks that overlap in the same files, and branches that drift from main for too long. Fix both and merges become boring. Scope each card to a narrow set of files, rebase often, and run tests before every merge, not after.

### Scope tasks to reduce overlap

When you write the card, list the files or directories it should touch. Two agents editing the same auth module is a conflict factory; one on auth and one on the billing lane is not. If a task genuinely needs the same files as another open card, sequence them instead of running them in parallel.

### A merge order that works

Rebase each agent branch onto main frequently so drift stays small. Merge the branch with the least overlap first, then rebase the rest on the new main before their next merge. Run the test suite on the merged result before moving to the next branch. The [git worktree documentation](https://git-scm.com/docs/git-worktree) covers how each worktree keeps its own checked-out branch, which is what makes this isolation possible.

### When two agents touch the same file

Stop and resolve it as a human, not by letting an agent guess. Read the [git diff in the morning](https://kanbanmcp.com/agents), decide which change wins, and leave a handoff note on the board so the other session knows what happened.

## How do you coordinate agents across Cursor, Claude Code and Codex?

### Why per-tool panels break down at 3+ sessions

Cursor's background agent panel only knows about sessions it spawned. The moment your third session is a Claude Code run in another terminal, the panel stops being the source of truth, and you are back to reconstructing state from git diffs in the morning. The same applies to Codex and Antigravity: each tool tracks its own work, none of them tracks the project.

The fix is to move the system of record out of any single client. Sessions stay disposable; the board persists. A shared task list in the repo, whether it is a backlog.md file or a hosted board, gives every agent the same picture regardless of which tool opened it.

### Claim, work, note: a protocol any agent can follow

Keep the protocol simple enough that any agent can follow it from a CLAUDE.md line:

1. **Claim** a card before starting, so two sessions never pick up the same task.
2. **Work** on the card's branch or worktree, as covered earlier.
3. **Note** what you did and what is left, so the next agent inherits context instead of rediscovering it.

This claim/work/note loop is what makes handoffs work across clients. A Claude Code session can finish a card a Cursor agent started, because the handoff note lives on the card, not in a chat history neither can read. Tools like Vibe Kanban and Agent Kanban are built around this pattern, and it maps cleanly onto a plain markdown board too.

## How does KanbanMCP fit a Cursor multi-agent workflow?

### Running it through the same criteria

KanbanMCP is a hosted board where each agent claims a card, works on it, and leaves a handoff note for the next session. The board is the system of record, so chat sessions stay disposable. It runs the same criteria as above: claim and lock work so two agents don't take one card; notes survive between sessions; the board works across Cursor, Claude Code and Codex because agents reach it through MCP rather than a specific editor. Cursor's own agent documentation describes running multiple agents and background sessions ([Cursor agent docs](https://docs.cursor.com/agent)), which is exactly the point where card-level claiming starts to matter more than a shared to-do file. Where it helps most: you come back after a few hours, read the git diff and the notes on each card, and steer from one place instead of reopening three or more sessions.

### When a plain file is still enough

If you run one or two agents on a single repo and review every diff yourself, backlog.md or a CLAUDE.md plus a handover prompt does the job. A board earns its keep once sessions outlive your attention span and cards need claiming, not just listing.

## How do the main options for coordinating Cursor agents compare?

Cursor's built-in panel handles spawning and monitoring inside one editor, but it assumes your sessions are the whole picture. A backlog.md file or home-made board gives you a system of record, though you maintain it by hand and agents only see it if a prompt tells them. Taskmaster structures task lists well but stays adjacent to the board-and-handoff workflow. Vibe Kanban and Agent Kanban are direct alternatives: real boards agents can claim cards from.

| Option | Worktree isolation | Works outside Cursor | Handoff notes |
|---|---|---|---|
| Cursor panel | Manual | No | Chat history only |
| backlog.md / DIY board | Manual | Yes | You write them |
| Taskmaster | Manual | Yes | Task-level notes |
| Vibe Kanban | Built in | Yes | Card comments |
| KanbanMCP | Built in | Yes (Claude Code, Codex, Antigravity) | Agent leaves a note per card |

The honest trade-off for KanbanMCP: it is a hosted board, so you depend on it staying up, where a markdown file in your repo never goes down.

## FAQ

### How many Cursor agents can I run at once on one machine?

There is no hard limit, but three or more parallel sessions is where coordination stops being optional. At that point handoff notes and a shared board become necessary, because you can no longer reconstruct state from git diffs alone. Each agent needs its own worktree and branch to avoid stepping on the others.

### Do Cursor background agents use git worktrees automatically?

No. Cursor's background agents run on their own branches, but worktree isolation is something you set up yourself with git worktree add before spawning each session. Without it, two agents pointed at the same checkout can overwrite each other's edits, and you only find out at review time.

### Can Claude Code and Cursor agents work on the same board?

Yes, if the board is reachable through MCP rather than tied to one editor. Cursor's panel only knows about sessions it spawned, so a shared board becomes the system of record: any agent claims a card, works on it, and leaves a note. A Claude Code session can then finish a card a Cursor agent started.

### What do I put in a handoff note for the next agent?

Four things: which branch and worktree the agent used, what it completed, what failed, and what the next session should pick up. Keep the note attached to the card rather than in a status document, so the next agent reads only what it needs before claiming the next task.

### Is a kanban board overkill for a solo dev with three agents?

Probably not, if the sessions outlive your attention span. With one or two agents and a diff you review yourself, a backlog.md file does the job. At three or more sessions, cards need claiming rather than just listing, and handoff notes need somewhere to live that every agent can read.
