The Bun rewrite proves 'never rewrite from scratch' was always a cope
In just 11 days, 64 AI agents successfully ported roughly 535,000 lines of Zig code to Rust. It didn't take 14 months, or a war room full of senior engineers. All it took was eleven days and a credit card. ## The rule that just cracked In the year 2000, Joel Spolsky wrote that the rewrite from scratch is the "single worst strategic mistake" that any software company can make. That became gospel.…
In just 11 days, 64 AI agents successfully ported roughly 535,000 lines of Zig code to Rust, negating the need for a 14-month effort involving a war room of senior engineers. This feat was accomplished by a team that had previously dismissed Joel Spolsky's advice on the "single worst strategic mistake" any software company could make - rewriting from scratch.
The reasoning behind Spolsky's rule was simple: rewrites discard all the bug fixes made over the years, and the messy code often hated is actually knowledge encoded in patches. However, 14 months of work translating 535,496 lines of Zig to Rust, adding over 1 million lines of new Rust code, and fixing 6,778 compiler errors demonstrates that rewriting can be completed much faster.
The creators of Bun, Jarred Sumner, aimed to eliminate memory leaks and use-after-free bugs by rewriting the core runtime from Zig to Rust. He utilized automated workflows with 50 agents, 4 working simultaneously on separate Git worktrees, with each worktree having 16 Claude agents. These agents fixed over 16,000 compiler errors autonomously, resulting in significant improvements such as a 99.9% reduction in memory usage from 6.7 GB to 609 MB, 20% smaller binary size on Linux and Windows, and a 2-5% increase in HTTP throughput.
Despite the success of the Bun rewrite, concerns remain about the quality of the code. Andrew Kelley, the creator of Zig, described the project as "unreviewed slop" due to the lack of proper review. However, the fact remains that the rewritten version of Bun not only ships but also benchmarks better than its predecessor. This situation highlights the limitations of traditional engineering rules and the need to reassess long-held beliefs.
The real question is not whether AI can refactor code, but whether the original reasons for rejecting the idea still hold true in light of changing circumstances and the benefits achieved through rewriting.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.