Scaling Long-Running Autonomous Coding
Cursor experimented with running hundreds of concurrent coding agents on single projects for weeks, writing over a million lines of code and trillions of tokens. The goal: understand how far autonomous coding can be pushed on projects that typically take human teams months.
Source: Cursor blog
The Limits of a Single Agent
Today's agents work well for focused tasks but are slow for complex projects. The natural next step is parallelism, but coordination is the hard problem.
Failed Approaches
Flat Self-Coordination
Agents with equal status coordinated through a shared file with locking.
Problems:
- Agents held locks too long or forgot to release them
- 20 agents would slow to throughput of 2-3, with most time spent waiting
- Agents could fail while holding locks, or update the file without acquiring the lock at all
Optimistic Concurrency Control
Agents could read state freely, but writes fail if state changed since last read. Simpler and more robust than locking, but still had deeper problems.
The real issue: with no hierarchy, agents became risk-averse. They avoided difficult tasks, made small safe changes, and no agent took responsibility for hard problems or end-to-end implementation. Work churned without progress.
What Worked: Planners and Workers
Separating roles into a pipeline with distinct responsibilities:
- Planners: Continuously explore the codebase and create tasks. Can spawn sub-planners for specific areas, making planning itself parallel and recursive.
- Workers: Pick up tasks and focus entirely on completing them. Don't coordinate with other workers or worry about the big picture. Grind on the assigned task, push changes when done.
- Judge agent: At end of each cycle, determines whether to continue. Next iteration starts fresh.
An initially built "integrator" role for quality control and conflict resolution was removed. It created more bottlenecks than it solved. Workers handled conflicts themselves.
Experiments
Browser from Scratch
Agents ran for a week, writing 1M+ lines of code across 1,000 files. New agents could still understand the codebase and make meaningful progress. Hundreds of workers ran concurrently on the same branch with minimal conflicts. (GitHub: fastrender)
Solid to React Migration (Cursor Codebase)

Over three weeks: +266K/-193K edits. Passing CI and early checks, still needs careful review.
Video Rendering Optimization
A long-running agent made video rendering 25x faster with an efficient Rust version, added zoom/pan with spring transitions and motion blur. This code was merged and shipped to production.
Other Running Experiments
- Java LSP: 7.4K commits, 550K LoC
- Windows 7 emulator: 14.6K commits, 1.2M LoC
- Excel clone: 12K commits, 1.6M LoC
Key Lessons
- Model choice matters for long-running tasks. GPT-5.2 is much better at extended autonomous work: following instructions, keeping focus, avoiding drift. Opus 4.5 tends to stop earlier and take shortcuts. Different models excel at different roles (GPT-5.2 is a better planner than GPT-5.1-Codex despite the latter being coding-specialized).
- Many improvements came from removing complexity. Simpler is better. The integrator role was a bottleneck.
- Right amount of structure is in the middle. Too little leads to conflicts, duplication, drift. Too much leads to fragility.
- Prompts matter more than harness. A surprising amount of behavior comes down to prompt engineering: getting agents to coordinate, avoid pathological behaviors, and maintain focus.
- Periodic fresh starts combat drift. Long sessions accumulate stale context and tunnel vision.
Open Problems
- Planners should wake up when tasks complete to plan the next step
- Agents occasionally run far too long
- Periodic fresh starts still needed to combat drift
- Multi-agent coordination remains far from optimal
Related Topics
- agentic-engineering-best-practices - Principles for individual agent sessions
- auto-research - Self-improving agents in competitive settings
- cursor-composer-2 - Cursor's model training approach
- building-ai-agents - Core agent architecture patterns