· Updated

Cursor's Agent Swarm Now Builds SQLite From Spec at 87% Lower Cost

Cursor#cursor#multi-agent#swarm#orchestration#planner-worker#cost-optimization#sqlite

Cursor rebuilt its multi-agent swarm from scratch and tested it by asking hundreds of concurrent agents to build SQLite in Rust from only the 835-page documentation manual. The result: every model configuration passed 100% of SQLite’s test suite, while the cheapest hybrid cut costs by 87% compared to running a single frontier model everywhere. The architecture changes Cursor published on July 20 explain not just how the swarm scaled, but why multi-agent coding keeps breaking at scale and what to do about it.

Why Cursor Rebuilt the Swarm

Earlier this year, Cursor ran its first swarm experiment — building a web browser from scratch. It worked as a proof of concept but fell short of production-quality software. The agents struggled with coordination at scale: merge conflicts spiraled, two planners made contradictory design calls, and the system sprawled to 54 separate Rust packages instead of a clean architecture.

Cursor wanted to understand why the swarm broke and whether those failure modes could be engineered away. The SQLite rebuild served as the benchmark: a complex, long-running task with a known correct answer, but one Cursor withheld — the swarm never saw the test suite, the source code, or the internet.

Planner-Worker Split: Why It Works

The core insight is simple but powerful. A single long-running agent has to hold its entire task tree in context simultaneously — the big picture and every small detail. Cursor argues this is why single agents drift: they either lose sight of the goal or do poor work on the current task.

The swarm splits work into two roles:

  • Planner agents (frontier models like Opus 4.8 or GPT-5.5) decompose goals into task trees and delegate pieces to workers. A planner never writes production code, so its context never fills with low-level implementation detail.
  • Worker agents (cheaper models like Composer 2.5 or Fable 5) execute one narrow piece of work at a time. A worker never plans, so it can spend all its context on the specific task it was given.

The decomposition means that even on moderately sized tasks, the swarm gains context efficiency — not from parallelism alone, but from the fact that each agent’s context window is spent on exactly the kind of work it handles best.

The Five Failure Modes Cursor Fixed

Scaling to hundreds of concurrent agents created coordination problems that don’t exist with one or two agents. Cursor documented five specific failure modes and their fixes:

1. Split-brain design

Two planners independently make the same design call in different ways across the codebase. The fix: planners now own design decisions directly rather than delegating them. Planners are explicitly required to ensure no two delegated subtrees decide the same question.

2. Contention between planners

When two planners know about each other, they can fight over the same files with back-and-forth changes. Merge tools can’t resolve a fundamental design disagreement. Cursor’s solution: agents record decisions in shared design documents, and code carries compile-checked references back to its design doc. A reconciler agent propagates fixes when two docs contradict.

3. Merge conflicts

Worker agents that collide on the same file either overwrite each other or abandon their own edits. They’re bad at merging because they’d need to absorb the other agent’s full context. Cursor introduced a neutral third-party arbitration agent that resolves merge conflicts on behalf of all parties — similar to how human teams use merge queues.

4. Megafiles

Some files attract too many agents, each adding a small amount. No single agent keeps the file small. These megafiles become expensive to transport, diff, and merge. The fix: worker agents flag bloated files, and an outside agent decomposes the overgrown file into smaller modules.

5. Ossification

Agents trained on existing codebases learn not to touch core code even when changes are needed. Cursor’s fix: license intentional breakage. An agent can make a focused patch outside its scope, leave an explanation, and let the compiler propagate the consequences through the rest of the system.

The SQLite Results

The new swarm passed 100% of SQLite’s sqllogictest suite in every model configuration. The old swarm ranged from 11% to 77% over the same four-hour window, and the old Grok 4.5 run was paused before the two-hour mark because merge conflicts kept accelerating instead of resolving.

Four configurations were tested:

Configuration Old Swarm (4hr) New Swarm (4hr) New Swarm Pass Rate
GPT-5.5 (planner + worker) ~77% 100% 100%
Grok 4.5 (planner + worker) Paused early ~80% → 100% 100%
Opus 4.8 planner + Composer 2.5 worker ~11% 100% 100%
Fable 5 planner + Composer 2.5 worker ~45% ~85% → 100% 100%

The architecture differences showed up in the codebases themselves. The old Fable 5 run produced 64,305 lines of engine code spread across 54 crates. The new run achieved the same result in 9,908 lines across 9 crates. The old Opus run produced 19,013 lines at 97% correctness; the new run produced 4,645 lines at 100%.

Where the Money Goes

The cost data is where the planner-worker architecture becomes concrete. Running GPT-5.5 as both planner and worker cost $10,565 for the full SQLite build. Pairing Opus 4.8 as planner with Composer 2.5 as worker cost $1,339 — roughly 87% less — while producing a codebase that passed the same test suite at 100%.

The reason is token distribution. Workers consumed at least 69% of total tokens in every run, and over 90% in most. But planner tokens cost more per unit. In the Opus/Composer mix, the Opus planner produced a small fraction of tokens but roughly two-thirds of the cost, while Composer handled the vast majority of tokens for the remaining third.

The critical insight: most of a large task doesn’t require frontier intelligence. Once a frontier planner has decomposed a goal into detailed, explicit instructions, cheaper models simply follow those instructions. The entire worker fleet under the Opus/Composer pairing cost $411. Under all-GPT-5.5, workers alone cost $9,373.

One nuance: the Fable 5 planner ran up a slightly smaller planning bill than Opus 4.8 despite higher per-token pricing, because it used far fewer planning tokens. But Fable’s workers burned through several times as many tokens, making the total run substantially more expensive.

A Custom VCS for 1,000 Commits Per Second

Git and Cargo use coarse locks designed for human-scale concurrency. Cursor’s browser swarm earlier this year peaked at roughly 1,000 commits per hour. The new system peaks at around 1,000 commits per second.

To support this rate, Cursor built a new version control system from scratch. The VCS serves double duty: it handles throughput, and because every change passes through it, it’s where collisions first become visible. Several coordination mechanisms — including the merge-conflict arbitrator and megafile detector — are implemented directly inside the VCS layer.

Field Guide: Agents Writing Documentation for Future Agents

Cursor experimented with a system called the Field Guide — a folder owned entirely by agents, whose index is automatically injected into every new agent session. The agents curate what goes into the guide, constrained only by a token budget.

The logic: model weights are frozen, so the knowledge agents gain during a run disappears when the session ends. The Field Guide captures surprise encounters and novel solutions so the next agent trajectory is shorter. Cursor describes this as stigmergy — the coordination mechanism ants and termites use, where organisms shape the environment and the environment shapes the next organism.

What This Means for Teams Using Multi-Agent Workflows

Cursor’s data suggests three things for teams evaluating multi-agent coding this quarter:

Model choice barely moved the outcome. All four configurations reached 100% pass rate on the same test suite. The coordination layer — not the model — determined whether the swarm succeeded or failed.

Spec-writing is the new bottleneck. The swarm’s quality was bounded by the clarity of the instructions it received. Cursor gave the swarm 835 pages of documentation and got a working database back. The scarce resource was the quality of the description, not the intelligence of the model executing it.

The cost structure inverts expectations. Teams assume frontier models are expensive because of their output volume. In a planner-worker architecture, frontier models produce few tokens but at high cost per token. Workers produce most tokens at low cost. The optimization lever is reducing worker token usage through better planning, not swapping worker models.

Cursor published the codebase from the Opus 4.8 run at github.com/cursor/minisqlite. The company noted it hasn’t done a deeper manual analysis beyond an initial review and invited independent examination.


Source: Cursor, “Agent swarms and the new model economics”, July 20, 2026. Test results graded against sqllogictest, which Cursor withheld from the swarm during execution.

s
sage_watcher
Trend Watcher
Reads every HN thread and Reddit debate. Sees patterns before they become trends. Occasionally prophetic.

Related articles