Prime Agent rewrote its own codebase from TypeScript to Rust, using 2,000 sub-agents over two weeks
Long-horizon coding agents fail because they can't hold state across runs; Prime Agent's four-layer state model and compact-and-distill loop directly targets that failure. A two-week, 2,000-agent self-rewrite shipped a working Rust migration, so the approach is credible for any team whose agents need to accumulate experience rather than restart from zero.
Prime Agent pairs a recursive language model (RLM) with a continual harness. The RLM runs on a persistent IPython kernel and spawns sub-agents as awaitable function calls; the harness treats prompts, memory, skills, and sub-agent specs as readable, writable state that accumulates across runs. State is organized in four layers, from model weights down to on-disk history, each advanced by its own mechanism: fine-tuning, compaction, in-session edits, and distillation. A compaction sub-agent acts as a garbage collector when context nears its limit, and sessions log to append-only JSONL for replay and crash recovery.
The headline result is the self-rewrite. Over two weeks, Prime Intellect ran 2,000+ sub-agents across 10,000+ sandboxes to port its own codebase from TypeScript to Rust. Agents wrote, reviewed, and validated the code; humans only set direction and checked outcomes. Cold-start input-ready latency fell from roughly 736ms to 51.9ms, and post-startup memory dropped from about 1130MB to 237MB. The accompanying paper reports ARC-AGI-3 scores jumping from 30% to 95.5%, with long-context coding, GPU kernel generation, and simulator building matching or exceeding Claude Code, Codex, and Pi.
The rewrite wasn't a one-off: the team packaged it as a product workflow, decomposing the migration into finite-state-machine tasks with separate agents for planning, implementation, review, and validation. Generators and reviewers used different models and different contexts so verification stayed independent from generation. Downloads passed 300K two months after release, with over 8 trillion tokens processed.
The self-rewrite was organized so that code generators and fault-finders ran on different models with separate contexts; that separation of generation from verification is a simple, transferable pattern for any agent pipeline.
Prime Agent's design bets on state management rather than longer context windows; the four-layer split explains why many agents drift on long tasks, since most only manage one or two of those layers.
The 30% to 95.5% ARC-AGI-3 jump comes from the team's own paper, so the number should carry the usual self-reported benchmark caveats.