The runtime you would leave has changed
A team that wants to rewrite a Java or Node.js service usually has a reason from a few years ago: threads were expensive, startup was slow, TypeScript needed a build step, the test stack was a pile of third-party packages. Several of those reasons have since been addressed inside the runtimes themselves.
- Java virtual threads. Java Development Kit (JDK) Enhancement Proposal (JEP) 444 delivered virtual threads in JDK 21: lightweight threads the Java runtime schedules onto a small pool of operating system threads, so a server can hold many thousands of concurrent blocking tasks. Under JDK 21, a virtual thread that blocked inside
synchronizedcode stayed pinned: it kept hold of its carrier, the operating system thread running it, so no other virtual thread could use that thread while it waited. JEP 491, delivered in JDK 24, removes this pinning. - GraalVM Native Image. The Native Image documentation describes compiling Java code ahead of time to a standalone binary that "Starts in milliseconds" and "Uses a fraction of the resources required by the Java Virtual Machine".
- TypeScript in Node.js. Node.js runs TypeScript files directly by stripping the type annotations. The feature was enabled by default in v23.6.0 and v22.18.0, and marked stable in v25.2.0 and v24.12.0.
- A built-in test runner. The
node:testmodule was added in v18.0.0 and has been stable since v20.0.0.
A rewrite may still be the right call. The case for one now has to be made against the runtime the team would leave today, which may differ from the one it remembers.
Each improvement fixes one measured problem
The documentation for each feature is precise about its limits, and the limits are where rewrite arguments go wrong.
JEP 444 is direct about this: "Virtual threads are not faster threads — they do not run code any faster than platform threads." The JEP says they raise throughput when the number of concurrent tasks is high, "more than a few thousand", and the workload is not CPU-bound. A service that spends its time waiting on databases and other services can gain a lot. A service that spends its time computing gains nothing from them. Whether another language would run that computation faster depends on the workload, and only a measurement on your own code can say.
Native Image buys its startup time with a closed-world assumption: in the documentation's words, "all the bytecode in your application that can be called at runtime must be known (observed and analyzed) at build time." Code that relies on reflection or the Java Native Interface (JNI) needs extra configuration, and some applications need work before they compile at all. That is a migration of its own, smaller than a rewrite and still not free.
Node.js type stripping replaces TypeScript syntax with whitespace, and "no type checking is performed." It handles only erasable syntax, TypeScript that can be deleted without changing what the JavaScript does. Features that need JavaScript code generated from them fail with an unsupported-syntax error, such as enums, namespaces with runtime code, and parameter properties (constructor parameters that also declare class fields). You still run the TypeScript compiler in continuous integration (CI) to check types. What you drop is the build step at run time.
Each feature answers a specific measurement: blocked threads, cold-start time, build complexity. If you have not measured which one your service has, you cannot tell whether the runtime already fixed it.
Stripe kept Ruby and added types
Stripe's account of Sorbet, its type checker for Ruby, written by Jake Zimmerman in 2022, shows the in-place option at scale. By 2017 hundreds of engineers had written millions of lines of Ruby, and the post says the language "was becoming a source of friction more than a source of productivity." Stripe's response was to make the existing language easier to work in.
The team evaluated two existing Ruby type checkers, found them too slow or too buggy, and started building Sorbet in November 2017. Sorbet became a required part of the test suite in May 2018 and was open-sourced in June 2019. Teams adopted it one file at a time, at chosen strictness levels. After almost four years, 85% of non-test files were at # typed: strict, the level that requires a signature on every method, and Sorbet ran over more than 15 million lines of code in 150,000 files.
The post does not describe a rewrite that Stripe weighed and rejected, so do not read it as one. It shows what modernizing without changing language looks like: a targeted tool aimed at the stated problem, adopted gradually, with the codebase in production the whole time.
Agents make rewrites cheaper to write, not cheaper to trust
Coding agents change the arithmetic in one direction. Translating a handler or a module into another language is now a task you can hand to an agent and review, instead of writing it line by line. The costs that decided most rewrites sit elsewhere:
- Verification. Someone has to show that the new system behaves like the old one, including the behavior nobody wrote down. What must survive an AI legacy modernization covers why the old system's behavior is evidence, not a specification.
- Coexistence. Two implementations run side by side for the whole migration, with two toolchains, two sets of dependencies and two systems the on-call engineers have to know how to fix at night. Uber reported in a 2020 post on its Edge Gateway that moving its API gateway from Node.js to Go took two years. The decisions that must survive a Node.js to Go rewrite covers that period, including who decides which implementation is current and who may approve each cutover.
- Governance. Every decision the old system encodes has to be found, kept, changed or retired on purpose.
An agent can draft the new code quickly. It cannot shorten the period in which both systems exist, and it adds a new risk: a rewrite that is cheap to start gets started without anyone writing down why.
Some vendor and community posts claim large infrastructure savings from changing language. Those figures come from other teams' workloads; measure your own before one goes into a migration plan.
Write the decision down, whichever way it goes
Before a rewrite starts, the team should be able to produce one record with its evidence. The same record serves when the answer is no.
| Field | What it holds |
|---|---|
| Measured problem | The number that is wrong, how it was measured, and the target: 99th-percentile (p99) latency under load, the time within which 99% of requests complete, cold-start time, cost per request, onboarding time. |
| Cheaper alternatives tried | What the team did inside the current stack and what each changed: a runtime upgrade, virtual threads, a native image build, a type checker. |
| Cost of coexistence | How long two implementations would run, who staffs both, and how cutover would be proven. |
| Decision | Rewrite, partial migration, or stay. Scope, owner and date. |
| Revisit trigger | The measurement that would reopen the question. |
An illustrative record for a Java order service might read: the service exhausts its thread pool under peak load while waiting on the payments API; moving request handling to virtual threads on JDK 21 removed the exhaustion in load tests; a Go rewrite would mean an estimated year of two implementations; the service stays on Java; reopen the question if p99 latency misses its target at twice current peak.
The last two rows carry the governance value. A recorded "stay" tells the next engineer, and the next agent asked to modernize the service, that the question was asked, answered with evidence, and under what condition it should be asked again. Without the record, the rewrite proposal returns every year with the same arguments and no memory of the last answer.
This is ordinary engineering decision governance: which decision governs this code, why, and with what evidence. A decision not to migrate is a decision with an owner, evidence and a reopening condition, kept in the decision corpus (the set of decisions a team maintains) with the rest. If the team later does migrate, Architecture decision records (ADRs) for software migrations covers how the record moves into legacy, transitional and target states.
Where Mneme fits
Mneme is an open-source decision and control layer for agentic software development. It stores a team's architectural decisions and checks agent changes against the ones it can test mechanically. It can hold this record but cannot make the call. Write the decision as an ADR and import it into the Decision Index, Mneme's persisted, versioned record of decisions. Each version keeps the statement, rationale and scope, and the ADR file it came from with a content hash. When the team reverses the decision, a new ADR declares that it supersedes the old one, the old ADR is marked superseded, and re-importing records both, with the history kept.
Agents connected through Mneme's Model Context Protocol (MCP) server can read the decision with tools such as decision.search, so an agent asked to modernize the service can find that the rewrite was considered and declined. Mneme enforces only decisions that carry an active typed rule: a rule Mneme can check mechanically, such as an exact text string that must not appear in certain paths. Most of a "do not rewrite" decision is a judgment about evidence and has no literal text to match, so review and ownership carry that part.
Two limits apply. The Decision Index records what each version said and where it came from, not who approved it, so keep approvals in pull request reviews on the ADR file. And Mneme does not measure latency, run load tests or estimate the cost of a migration. The evidence in the record comes from your own tools.
What engineering leaders should do
- Measure before choosing a language. Name the number that is wrong and where it comes from: blocked threads, compute, startup or build.
- Try the current runtime first. Virtual threads, native images, type stripping and gradual type checkers each target one problem. Record what each changed.
- Price coexistence, not translation. Agents cut the cost of writing the new code. Estimate the months of running both.
- Record "stay" with a revisit trigger. A declined rewrite is a decision with an owner, evidence and a condition for reopening it.