The instinct when inheriting a completely abandoned, broken codebase is to patch the immediate bugs and keep the lights on at all costs. The instinct of a naive engineer is to immediately demand a from-scratch rewrite. Both are traps.
The decision to rewrite must be a calculated Return on Investment. When adding two or three trivial features to the legacy system takes just as long as rebuilding the entire foundation, the choice becomes clear. But you don’t stabilize a sinking ship by ignoring the leaks — you patch the old hull in parallel while you build the new one.
Calculate the ROI First
Audit the core architecture and measure the velocity cost of adding a simple feature. The question is not “is this code bad?” — it is always bad. The question is whether maintaining it costs more in engineer-hours per feature than a rewrite would.
If the core is irreparably flawed — thread synchronization broken, race conditions masked by debug-mode compilation — and feature velocity is measured in weeks instead of days, a rewrite is justified. Run velocity_cost_analysis() and document the numbers. You will need them.
Make the Business Case for Headcount
A solo rewrite that misses deadlines is worse than a slightly delayed but properly staffed one. The velocity cost data is your resource request. Present it directly: “we need X people for Y months, after which maintenance load drops by Z.”
Request the minimum viable team — even two engineers for a time-boxed proof sprint is enough to start. If headcount is frozen, pursue internal transfers, temporary secondments from other teams, or contractor budget. headcount_negotiation() is a skill, not a formality: the analysis must make the business case, not just the emotional one.
Keep the Legacy Alive While You Accelerate
Management will often assume the migration will take years. Use that runway. Patch the legacy bugs to keep the business running, but pour all extra velocity into the rewrite. Ship the first replacement module to a low-risk subset of users — domestic clients, internal teams — within months, not years.
Use the rewrite as an opportunity to improve the user experience. Refuse to replicate the old, flawed UI exactly. architectural_audacity is the ship_of_theseus_rewrite operating correctly: you are replacing components, not cloning mistakes.
Done when: the first replacement module is live, the legacy system is still running beside it, and you have proof the new foundation holds.