im·a·cto

$ cat writing/the-rewrite-looks-free-now.md

← the_log

The Rewrite Looks Free Now

Generation went to zero, so the from-scratch rewrite finally looks affordable. The retyping was never the expensive part. Every ugly conditional in the old file is a scar from a production incident, and a clean rewrite amputates the memory along with the mess.

There’s a file on every team that people talk about in a lowered voice. You know the one. Eight hundred lines, a function that should be four and is forty, three conditionals in a row that nobody can explain, and a comment near the bottom that just says: do not remove this, it breaks checkout. No name on the comment. No ticket. Just a warning from someone who is probably gone. Everyone routes around that file. Touching it is how you spend a weekend.

For years the answer to that file was: leave it. Not because anyone loved it. Because rewriting it meant weeks of careful, thankless retyping, re-deriving behavior you couldn’t fully see, and the risk landed on you if checkout went down. The math never closed. The mess stayed, and you learned to live beside it.

That math just changed. Hand the file to a fleet and you get a clean version back in a minute. Small functions, sane names, tests, the works. The weeks of typing that used to stop you cold are gone, and for the first time you can look at that file and say yes, rewrite it. So the question stops being can we afford to and becomes why wouldn’t we. That is exactly the moment to slow down.

the cost was never the keystrokes

Here’s the trap hiding in the new math. When the price of a rewrite dropped, everyone assumed the whole price dropped. It didn’t. Only one line item did.

The labor of retyping was always the visible cost, the one you could feel in your wrists and put on a sprint board. It was never the expensive part. The expensive part was re-deriving why: why those three conditionals are in that order, why checkout breaks without that one line, why the function that should be four lines is forty. That cost didn’t move. The fleet can regenerate the code. It cannot regenerate the reasons, because the reasons were never in the file.

Joel Spolsky wrote the definitive version of this in 2000, and it has aged into something close to a law. He called rewriting from scratch the single worst strategic mistake a software company can make, and the reason he gave is the one that matters here. That old, ugly code is not junk. It is accumulated bug fixes. Every weird special case is a bug someone hit in production, at 2am, with a customer on the line, and fixed. Throw the code away and you throw away the fixes. Then you get to rediscover every one of them, in production, at 2am, with a customer on the line.

The keystrokes went to zero. The knowledge didn’t.
A fleet regenerates the code in a minute and none of the reasons the code was shaped that way. Those never lived in the file.

the ugliness is the memory

So look at that file again, at the conditional nobody can explain. That is not sloppiness. That is a scar.

Somewhere behind it is a real wound. A payment provider that returns success and then reverses it. A timezone that only breaks for users in one country during one week of the year. A race that showed up exactly once, under load, and cost someone a very long night. The conditional is the stitch. It looks ugly because scars are ugly. It is also the only place that incident is written down, because nobody filed the doc, they just fixed the code and moved on. Strip the file down to something clean and readable and you have performed a very tidy amputation. The scar is gone. So is the memory of the wound, and the wound is still out there.

This is why the reframe matters more now than it did in 2000, not less. Back then the rewrite was slow, and the slowness was a tax that at least made you think twice. Cheap generation removed the tax. It removed the pause. The fleet will hand you the amputated version so fast and so clean that the clean is the whole problem: it looks like an upgrade, it reads better than the original, and it has quietly discarded every hard-won correction the mess was carrying. I’ve argued before that reviewing a fleet means reading the decisions, not the diff. A rewrite is the hardest case of that, because the decisions you most need to check are the ones that don’t appear in the new code at all. They’re the scars that didn’t make the cut.

when I didn’t rewrite, and when I did

I walked into Brandfolder to a product crashing on a memory leak. Every instinct said the codebase was broken, and broken things want to be rebuilt. I didn’t rebuild it. I stopped the bleeding first: found the leak, got it stable, kept the accumulated behavior intact, and only then started building the team and the product around it. The temptation to declare it all garbage and start clean was real, and it would have been the wrong call. The thing was crashing, but it also worked, in a hundred small ways I didn’t yet understand. You stabilize what you don’t understand before you replace it. That’s not caution for its own sake. It’s respect for the scars you can’t see yet.

The counter-example is Phoneware, and the difference is the whole point. I walked into portal features living in per-customer JavaScript bundles and app backends stranded in automation flows, and I am replacing that pile with a TypeScript monorepo. That is a rewrite. But it isn’t a rewrite to escape code I didn’t understand. It’s a rewrite because the system had outgrown its own shape, and I did the understanding first: mapped what every bundle actually did, why the customizations existed, what behavior had to survive the move. Then rebuilt it on rails, staged, with canary targeting so changes land safely instead of all at once. Same action, opposite decision. One was running from the old code. The other was carrying it forward.

That’s the tell, and it’s the only one you need. A rewrite driven by I don’t understand this and I want it gone is an amputation. A rewrite driven by I understand this well enough to know it’s outgrown its shape is a transplant. When the fleet made the rewrite cheap, it made the first kind cheap too, and the first kind is the one that costs you six months from now.

the question to ask before you say yes

The file is still sitting there. The fleet is still offering to make it clean. And the yes is right there, cheaper than it has ever been. Before you take it, ask the one question the low price is designed to make you skip: do I understand why this code is shaped the way it is, or do I just want the shape to go away?

If it’s the second, you’re not buying a cleaner codebase. You’re buying back every night someone already stayed up to fix this thing, at full price, later, when you least expect it. The rewrite looks free now. The understanding it skips never was.

Jason Waldrip has spent his career leading engineering at consumer-scale software companies. He writes about engineering leadership, infrastructure, and building in the age of AI agents.

A note on how this was made: I wrote this with Claude Opus 4.8. I brought the frame, the stories, and the calls on what mattered and what to cut; Claude did most of the drafting. I’d rather say that plainly than pretend the tool wasn’t in the room.

© 2026 — written by a human, with help, and said so canonical jasonwaldrip.com · delivered through The Bushido Collective