🚦
AI Agents•10 min read•2026-11-24

Running Several Claude Code Agents on One Backlog Without Collisions

Two coding agents polling the same backlog will pick the same task. Here is why it happens, what an atomic claim fixes, and how to split work so parallel agents stay out of each other's way.

Karim Gaad
Karim Gaad

Founder of FlowBoard · Full-stack developer & serial entrepreneur

Introduction

One coding agent working through a backlog is a productivity trick. Three of them is a coordination problem, and it shows up on the first night. You start three Claude Code sessions, tell each one to "take the next task from the board", and in the morning two of them have built the same feature on two branches while the third sat on a task that was blocked all along.

None of that is the model's fault. It is the same problem two human developers have when they both look at the top of the board at 9:00 and both start the first card, except agents do it faster, more often and without the hallway conversation that would have caught it. The fix is not a smarter prompt. It is a claim that cannot be taken twice.

Why Agents Collide: Three Calls With a Gap

The natural way to give an agent work over an API is the way a person does it: search the backlog, choose the top item, assign it to yourself. That is three calls. Between the search and the assignment there is a gap, and every agent that searches inside that gap sees the same top item, chooses it, and assigns it.

The failure is silent. Both agents receive a successful response, both start, and the duplication only appears later as two pull requests for one task. Adding a "check if someone else has it" step does not close the gap, it moves it: the check and the assignment are still two separate moments.

Databases solved this decades ago with transactions, and a task queue for agents needs the same thing: read the candidate and take it in one atomic step, re-checking inside that step that nobody else got there first.

What an Atomic Claim Looks Like

FlowBoard exposes this as one MCP tool, claim_next_task, and one API endpoint. The call returns the highest-scored task the caller can actually work on and takes it in a single transaction. The transaction re-reads the task before writing, so when two agents race, the loser sees the winner's claim and moves on to the next candidate instead of doubling up.

The interesting part is not the transaction. It is the definition of "can actually work on", because that is where most agent runs are wasted. A task is skipped when it is:

  • Already claimed by another agent.
  • Blocked by a dependency that is not done yet. A blocker that was deleted counts as satisfied, so a removed dependency cannot strand a task forever.
  • A container. A parent with open subtasks is not the unit of work; its subtasks are.
  • Still an idea. Ideas are un-reviewed submissions. An agent cannot pick one up until a person accepts it and places it on a flow board.
  • Sent back for rework. Deliberately excluded: a task returned with questions carries context about what was wrong, and handing it to whichever agent polls next throws that context away.

When nothing qualifies, the call answers claimed: null as a normal result, not an error, and reports how many tasks it scanned and skipped. That lets an agent tell "the backlog is empty" from "the top of the backlog is all blocked", which are very different mornings.

The Agent Works It, a Person Owns It

A claim does not make the agent the owner. FlowBoard records the agent as the task's delegate and leaves a human as the assignee. If nobody owned the task, the person who created the agent's key becomes the assignee, so every delegated task has someone answering for it.

This matters more as the number of agents grows. "Who is responsible for this change?" should never be answered with a key name. The split also gives you two useful views: filter by assignee to see what a person is accountable for, and filter by delegate to see what the agents are holding between them. An agent finds its own claimed work with search_tasks and delegate="me".

Claiming is also not starting. The status stays where it was until the agent begins a work session, so a claim that dies with a crashed session does not leave a task pretending to be in progress.

Splitting the Backlog Between Agents

An atomic claim stops two agents taking the same task. It does not stop two agents stepping on the same files. For that, give each agent a lane:

  • By type. Point one agent at bugs only and another at features. The claim call accepts a type filter, so a bug-fixing agent never wanders into a refactor.
  • By project. If you keep separate flow projects, for example app and API, give each agent one project and the file overlap mostly disappears.
  • By ownership. An onlyUnassigned option makes an agent take only tasks with no assignee and no delegate, leaving everything a person has already picked alone.

On the code side, the rule that works is one checkout per agent. Give every session its own git worktree and branch, so two agents never edit the same working directory, and let the merge request be the place where overlapping changes meet. That is the same pull discipline a pull system asks of people: take one item, finish it, then take the next.

Keep a Person at the Exit

Parallel agents make it easy to produce more changes than anyone can review, and the bottleneck moves from writing code to checking it. Three habits keep that honest:

  • QA is a verdict, not a column. Work that a user will notice is flagged for QA and lands in the pending-QA queue. Agents can move work forward; keep the sign-off with a person who did not write the change.
  • Release notes are drafted, then approved. An agent can write the release notes from the tasks that are genuinely done, and a person approves them before they publish.
  • Limit the number of agents to what you can review. If merge requests wait two days for review, a fourth agent adds queue, not throughput.

A Minimal Setup That Works

  1. Connect each Claude Code session to the board through the FlowBoard MCP server, one API key per agent so their work is attributed separately.
  2. Give each session the same instruction: call claim_next_task with its lane filter, create a worktree and branch for the claimed task, do the work, open a merge request, comment the link on the task, then claim again.
  3. When the claim returns null, stop. Do not poll in a tight loop.
  4. Review in the morning: merge requests, QA verdicts, and anything the scan reported as blocked.

For a longer worked example of an overnight run, see how I let AI agents clear my backlog overnight, and for building your own loop against the API, build your own coding agent.

Frequently Asked Questions

Can I run several Claude Code agents on the same repository?

Yes, if each one works in its own git worktree and branch and takes tasks through an atomic claim. The worktree keeps their files apart; the claim keeps them from starting the same task.

Why do two agents pick the same task?

Because search, choose and assign are separate calls. Every agent that searches before the first one assigns sees the same top task. Only a claim that reads and takes the task in one transaction closes that gap.

What happens when the backlog has nothing an agent can work on?

The claim returns null with counts of what it scanned and skipped. The agent should stop rather than retry, and the skip counts tell you whether the backlog is empty or blocked.

Who is accountable for a task an agent completed?

The human assignee. The agent is recorded as the delegate, the person doing the work on someone's behalf, while ownership stays with a person.

How many agents should a small team run at once?

As many as you can review the output of within a day. Beyond that, extra agents grow the review queue rather than the amount shipped.

Ready to Try FlowBoard?

Start managing your projects with continuous flow. No sprints, no bloat - just ship.

Get Started Free

Keep reading