Skip to content

Two agents, one repo, and a GitHub issue board holding it together

How I ran multiple coding agents in parallel on the same codebase without merge conflicts or half-finished branches, using GitHub Issues as the job board, one simple file-ownership rule, and a human at the merge gate.

Aierizer Samuel8 min read
Illustration of an issue board with to do, in progress, in review and blocked columns, each task labelled with its priority and the AI model assigned to it

I had a webapp with a list of problems. Code reviews turned up the usual mix: a few security holes, some slow queries, a pile of naming inconsistencies, and the sort of dead code that everyone steps around. Nothing exotic. Just more than I wanted to grind through by hand, and the kind of work that’s easy to start and hard to finish.

I wanted to throw some agents at it. The worry was the obvious one: if you turn a couple of agents loose on the same codebase, you get merge conflicts, half-finished branches, and multiple bots confidently rewriting the same file in opposite directions. The general “I thought more AI would fix the issue” situation that ends in more trouble down the road. So before writing any code, I spent an afternoon on the part that usually gets skipped: how the work is coordinated, the pipeline of it all, rather than how it’s done.

Here’s how I set it up. It isn’t a framework, and it worked well enough that I wanted to write it down.

The job board is just GitHub Issues

The first decision was not to build an orchestrator. There’s a temptation to write a scheduler that assigns tasks, tracks state, and dispatches agents. For a finite cleanup, that’s a project in itself, and it would have taken longer than it was worth.

Instead, the source of truth is GitHub Issues. One issue per unit of work. A small set of labels does the coordination:

  • priority (p0 through p3): what’s actually urgent
  • status (todo, wip, review, blocked): where it is in the pipeline
  • model (opus, sonnet, glm): which agent should pick it up
  • lane (fix, feature): how heavy the process needs to be

You get a list where a task is claimable if it’s todo, its dependencies are closed, and no open pull request touches its files. That’s the whole rule. There’s no server watching the board and handing out assignments because there is no need for one.

The static map of the work (which unit owns which files, what depends on what) lives in a plain markdown file in the repo. The live state lives in GitHub. Keeping those two separate mattered more than I expected, since the map doesn’t change while you work; the board does.

The one rule that makes parallel safe

Everything else depends on one rule: every source file is owned by at most one open pull request at a time.

If two agents never touch the same file, they can’t conflict, and I can review their PRs in any order. So the up-front work was cutting the problem list into units that don’t overlap on files. The security fix for the bulk-delete controllers is one unit. The events authorization is another. The search service is a third. Each names the exact files it’s allowed to touch, and I checked that those sets don’t intersect before running anything in parallel.

What we get is a dependency graph. One rename had to land first because it changed method names half the codebase called, so everything else waited behind it. After that, a wave of unrelated fixes could all run at once. Drawing that graph took maybe twenty minutes and saved me from every “why is this branch full of conflicts” conversation.

Of course, this comes with limitations as well, but most of the time I didn’t find them annoying. You can also always choose to step away from the ruleset when you think it won’t make too much of a mess. The idea is not to bloat your workflow with useless rules, so you should only follow them when they help you out.

I used Claude Code and OpenCode

The two tools never talk to each other, and that’s on purpose.

I used Claude Code for the work where being wrong is expensive: the authorization holes, the data-loss bugs. I used OpenCode for the low-stakes polish: escaping some search wildcards, deleting dead caching code, standardizing timestamps. The routing is a label on the issue and nothing more. Claude can’t launch OpenCode and OpenCode can’t launch Claude, and I didn’t want them to. Both just read the same issues, follow the same lifecycle, and open pull requests against the same repo.

Each task runs in its own Git worktree with its own test database, so two or more agents running the full test suite at the same time don’t corrupt each other’s data. Worktrees are built into Git, and working with them is very straightforward.

The lifecycle each task goes through is boring, and that is a good thing since it’s predictable. We go through the same process of claiming the issue, creating a new branch, reading the code, and writing a failing test that asserts the correct behavior; then we make it pass, refactor, run the linter and the security scanner, run the full CI locally, open a pull request, and flip the issue to review. Then we STOP! The agent does not merge!

Humans always lie, and sometimes tests do as well (HouseMD)

The most useful principle is, of course, that a passing test suite doesn’t mean the code is right. Especially if the tests were generated! Several of the security bugs had green tests the whole time. It can happen that the tests encoded the broken behavior and asserted that a delete succeeded, without asking whether the person doing the deleting was allowed to. So the rule was that the new test has to fail first, and fail because the old behavior was wrong. If you can’t make it fail, you don’t understand the bug yet.

The pipeline also flushed out a few things that had nothing to do with the fixes and everything to do with the plumbing. The coverage gate had been configured but never actually enforced, so the first honest run failed on files nobody had tested in months. The security scanner’s wrapper script forced a “check for a newer version” flag that made CI fail because a patch release existed upstream, not because it found anything.

I prefer keeping it in my hands at the end of the day

I review and merge every pull request, testing them, going through issues that might have been glossed over, and correcting mistakes made along the way. That’s the deliberate cap on the whole thing. Parallelism doesn’t help past the point where I can review. Endless agents just mean a longer queue of PRs waiting on me. So I mostly run two or three agents at a time, not ten. There’s no branch protection on the plan I’m using, which means the merge gate is literally me not merging anything red or unreviewed. It turned out that this is fine for my use case. The pipeline’s job isn’t to remove me, but to make sure that when work reaches me, it’s already tested, scanned, and scoped to files I can reason about in one sitting.

Small note: also keep in mind that running 5-10 or more agents at the same time will probably burn through your tokens really fast. If you run it locally, your RAM will start to feel it, especially if they reach the CI stage around the same time and you have a sizeable test suite. You can always run it in the cloud as well, but hey, that’s also money, so it depends on the situation you’re in. For me, this was just fine. And this leads to the last point pretty neatly.

What it cost

Almost nothing beyond the model calls. GitHub Issues, labels, and pull requests are free. The gh CLI was already installed. Git worktrees ship with Git. The test runner, linter, and security scanner were already wired into the project. The only new spend is the tokens, and the routing keeps the expensive model on the work that warrants it while the cheap one handles the cleanup and easy parts.

In short: maybe we should decide how files map to pull requests before we start, keep the state somewhere both we and the agents can read, and stay in the loop at least at the end. Getting the agents to write code is easy. You open the project, start your agent of choice, and there you go. Coordinating them and keeping things maintainable and high-quality is where the thinking is needed. And for the time being, at least, we are still here for that.

Sitting on a backlog you never find time to finish?

Clearing an aging codebase, closing out a security and cleanup list, or migrating off a platform that's slowing you down. This is exactly the kind of work I help small businesses get through. I'll scope it honestly, keep you in the loop, and only take on what I can actually do well.

Tell me about your project