Building a Harness for a Swarm of Agents: How We Helped Finish Melee
How I built a harness that kept a swarm of AI agents doing verified work on the Melee decompilation, at 168 billion tokens.
For about five months I ran a swarm of AI agents against the decompilation of the GameCube game Melee, at about $200,000 in API token cost and 168 billion tokens. This post is not a reverse-engineering tutorial. It is about how to build a harness that makes that many agents do useful, verified work.
1. Where the Idea Came From
This project started as a test of how hard I could push the models. I had been running long goal-mode sessions to see how much work a model could finish on its own. The first result was an auto HDR photography project, which became its own blog post.
Then Anthropic announced Project Glasswing. The model was strong, but the method was what stood out to me. They fanned out sub-agents, gave each one a file, and let them all work at the same time. Putting that much compute on one problem at once let the swarm find things that one agent would not.
Around the same time, Peter Steinberger posted a screenshot of about $1 million in token spend in a single month. That changed how I thought about cost. Some people and organizations will spend $1 million a week on tokens, and it will be normal. Next to a defense budget, $1 million a week is small.
So my question became how to use that many tokens well. Burning tokens is easy. Turning them into real results, the kind a shareholder would pay for, is the hard part.
Then I watched a Theo video about AI making progress on decompiling old GameCube games. I checked whether Melee had a decomp project. It did, and it was the largest one. I decided to try it, because how hard could it be? It was much harder than I expected.
2. Five Months, 168 Billion Tokens
The harness started on 2026-06-05, the day I opened my first pull request to the Melee decomp. By 2026-10-19 the logs held about 168 billion tokens across more than 140,000 agent runs. Most of those tokens, 93%, were cache reads, because every worker rereads the same source and context.
The models changed over time. From June to August, most of the work ran on gpt-5.5. After that, workers ran on gpt-5.6-sol and gpt-6.1-sol, and the knowledge backfill ran on gpt-5.6-terra. A few hundred long single-target searches ran on gpt-6-astra, and Opus agents handled the hardest merges.
Starting that many agents is easy. Getting useful work out of them is the hard part, and the rest of this post is about that part.
3. Background: Matching Decomp and Melee
A matching decompilation rebuilds a game's C source so that it compiles back into the exact bytes of the shipped game. The original Metrowerks compiler decides register use, instruction order, and stack layout. The same logic written two ways can produce different bytes, so the last few percent of a function are often the hardest.
The community project doldecomp/melee had worked on this for years. When I started on 2026-06-05, Melee was 70.15% matched by code size. About 30% was left, which was 1,150 functions and about 1.16 million bytes of code.
A tool called objdiff compares each compiled function with the original and reports a match percentage. That number is the ground truth for everything below.
4. The Problem: How Do You Parallelize This?
One agent on one function at a time is slow. Many agents at once collide, because functions share headers, structs, and types. Two agents that edit the same header can each break the other's match.
The idea that made parallel work possible was to treat decomp like Sudoku. In Sudoku you cannot force one square, but each solved square tells you something about the rest of the board. In decomp, one solved function can reveal a struct field, a naming rule, or a copied pattern that unlocks a function in another file.
So the design does not try to pick the perfect next target. It uses the Glasswing method: run many agents, expect most attempts to find nothing, and keep every result that helps. Each kept result makes the next attempt a little easier. Progress comes as many small cuts, not as one big solve.
5. How It Was Built
The harness is a Bun and TypeScript system that runs in rounds called epochs. Each epoch follows the same five steps.
Agents never talk to each other. They coordinate through SQLite leases, events, and files on disk. A worker's model session runs on my host and calls tools inside its sandbox remotely.
Librarian agents work beside the workers. They read finished attempts, upstream pull requests, and source code, and they propose cited facts for a shared knowledge base. A validating layer decides which facts get written. Each new worker gets a target card built from those facts, so it starts with what earlier agents learned.
6. Running the Swarm and Its Limits
My first instinct was to add workers. On the later Super Mario Sunshine runs I stepped the swarm through 32, 48, 64, 90, 120, and 150 workers. A stress test held 200 workers steady.
At 120 workers, total model turns stayed flat at about 700 per 5 minutes, the same as at 64 workers. The cap was the throughput of the model gateway, not the worker count. Each extra worker only cut the turns available to every other worker inside its time limit.
The sandboxes had their own ceiling. Daytona handled the churn of about 32 to 48 workers well. Above that, sandbox creates timed out and stuck deletes piled up. One run logged 1,212 worker failures against a 250-CPU quota.
The host was a limit too. One evening, other work on the same Mac pushed its load to about 270, and 80 workers made 18 model turns in 5 minutes. I paused the run to protect the targets.
The lesson is to find the real bottleneck before you add agents. Past that point, more agents only spread the same throughput thinner.
7. Rules That Let Only Good Code Through
A swarm finds every shortcut you leave open. So no agent grades its own work. The runner, not the worker, compiles each submission, diffs it, scores it, checks its scope, and lints it. Four rules carry most of the weight.
These rules cost matches. Some 100% results never reach the main branch. I accept that trade, because a match the maintainers will not merge is worth nothing.
8. Forward-Deployed Work With the Maintainers
The harness only matters if its code lands upstream. So I worked with the maintainers the way a forward-deployed engineer works with a customer. The clearest record of this comes from the Super Mario Sunshine decomp, where I read every review comment and every ruling in the project Discord.
Each review comment went into a log with its fix, the pattern behind it, and a hit count. Once a pattern had 2 or more hits, it became a lint rule, worker guidance, or a note for the upstream agent instructions. A comment about leftover agent TODOs became a lint, and so did a ruling against stack-padding tricks.
Discord rulings worked the same way. When the maintainers ruled out stack tricks and frame-only operand swaps, the harness got lints for both. It also got a test from the same ruling: build the code both ways and diff the output.
Rules need review too. One lint flagged accessors that had real evidence behind them, and I retracted it. A wrong rule rejects good work across the whole swarm, so it costs more than a wrong comment.
9. Measuring Which Tools Work
Workers had a large toolbox: compile-and-diff, Ghidra lookups, the m2c decompiler, a source permuter, searches over past pull requests, and more. I did not know which tools helped, so I measured it.
The first report, on 2026-06-30, matched each worker's tool calls to its outcome. A win was an accepted exact match, or a new best score that passed the gates. Lift is the success rate with the tool minus the rate without it. The data came from one run with 71 workers, 252 attempts, and 39 wins.
The plain compile-and-diff loop had the highest lift of any tool, and the clever lookups scored worst. These figures are correlations, not causes. A stuck worker reaches for more tools, so part of the negative lift is selection, not harm.
On 2026-08-13, ghidra_lookup, opseq_similar_functions, and mismatch_db_search came out of the worker profile. All three had negative lift in the report. The commit does not cite the report, so I treat the link as likely, not proven.
A second audit in early September covered 1,627 workers and 215,634 tool calls. It led to a cleanup on 2026-09-05 that removed five graph and search tools from workers. Workers now get callers, callees, and similar functions at startup instead. One removed tool, past_prs_search, correlated with exact matches, and it went for consolidation, not for low lift.
The same audit caught a mistake. The retired ledger_search tool had been used by 98% of the workers that reached an exact match, and its replacement returned none of that history. Measure before you prune, and measure again after.
10. What We Built and Dropped
The biggest thing I removed was the scheduler. The first version was a director agent that read the board and sent out about 8 targets at a time, each with a budget and a stop rule. A deterministic epoch loop replaced it on 2026-06-16.
The second version was a ranking layer. It scored every target by size, closeness to 100%, and about 22 code-graph features, then ordered the queue. On 2026-08-30 I decided to remove it fully. It added churn, it blocked data targets in three places, and the results did not depend on it.
Now every open target is admitted in report order. The only rule is one active claim per source file, and even that rule is a convenience, not a safety rule. Sandboxes isolate each worker, and integration applies patches one at a time. Two agents on related code can duplicate some work, but they cannot corrupt the main branch, and I accept that cost.
Other parts went the same way in the simplification pass of late August. Admission windows, drain lanes, a pull-request campaign system, and an integration-resolver agent all came out. Each one solved a problem I had at the time, and the harness ran better without them.
11. Results on Melee
The contribution report credits the harness with 667 functions and 13.85% of Melee's final code. That figure counts my 57 merged pull requests, one more pull request built from harness matches, and harness matches verified against stored artifacts.
Of the 1,150 functions unmatched when I started, the harness completed 648 and improved or completed 1,040. Across the 751 upstream pull requests merged in that window, mine made 58.89% of all improvement events. Another 13 pull requests by other authors reused harness work.
On 2026-09-07, Melee reached 100%, with 19,828 of 19,828 functions and every byte of code and data matched. The community did most of that work over years. The harness was one contributor in the last stretch, and the numbers above are its share.
The swarm did not succeed because it was large. It worked because the harness checked every result, turned review into rules, measured its own tools, and dropped what did not pay for itself.
Sidebar: Super Mario Sunshine
I pointed the same harness at Super Mario Sunshine, a C++ game. One epoch moved it from 51.11% to 57.513% matched code, or 10,577 of 12,881 functions, with 0 broken matches. An Opus merge agent then combined that work with upstream changes at 57.83% and lost 0 exact matches.
Pending: The Fakematch Audit
This section is held. It covers the source-fidelity audit and the steering gate, if Ford decides it belongs in this post.
