Pinned Tweet
AI and the Death of Legacy Code
Five years ago, breaking up a monolithic codebase was a nightmare. Teams spent weeks putting sticky notes on whiteboards to plan Domain-Driven Design boundaries. Then developers faced millions of lines of tangled, undocumented code and gave up.
Frontier LLMs changed this by turning static code analysis into semantic understanding.
Instead of developers manually tracing dependencies through tangled classes, large-context LLMs ingest entire legacy codebases, database schemas, and API definitions at once.
Using LLM-assisted static analysis:
- It discovers true boundaries: The AI scans domain models and database call sites to identify logical service borders based on business capabilities, replacing weeks of manual audits.
- It isolates coupled code: The AI holds full modules in memory, untangling deeply nested dependencies and mapping out hidden side effects.
- It automates extraction: The AI isolates target business logic, writes anti-corruption wrappers to route calls back to the monolith, and generates tests directly from the original code paths.
While runtime traces and logs can help filter out dead code when available, the core shift comes from code comprehension. Teams used to avoid touching legacy code because understanding it took too long. Today, an LLM can read, map, and extract those same systems in an afternoon.
Rohit Kelapure retweeted
Evals are the most underrated skill in AI engineering.
1. Start with error analysis, not metrics
Sample 100+ production traces. Annotate each failure in free text (open coding), then cluster them into failure categories (axial coding). Count frequency per category. Your top 3 categories are your first metrics.
2. Build a versioned golden dataset
Store inputs, expected outputs or rubrics, and metadata (intent, difficulty, user segment) in a versioned dataset. Stratify it so rare but critical cases aren't drowned out by easy ones. Version it alongside your prompts so every score is reproducible.
3. Generate synthetic data along explicit dimensions
Don't just ask an LLM for "test questions." Define dimensions (persona × intent × complexity × edge case), generate combinations as tuples, then turn each tuple into a natural input. You get coverage instead of 200 near-identical examples.
4. Deterministic assertions first
JSON schema validation, regex checks, required fields, length limits, code execution, SQL that actually runs against a test DB. These are cheap, fast, and have zero variance. Reserve model-based grading for what code genuinely can't check.
5. Evaluate retrieval separately from generation
For RAG, measure retrieval with recall@k, MRR, or nDCG against labeled relevant chunks. Measure generation with faithfulness (is every claim supported by retrieved context?). If you only score the final answer, you can't tell which half is broken.
6. Trajectory evals for agents
Log every step: tool name, arguments, result, tokens. Score tool-call precision and recall against a reference path, argument correctness, step count, and error recovery. An agent that reaches the right answer in 14 calls when 3 would do is a cost and latency bug.
7. pass@k vs pass^k
pass@k = succeeded at least once in k runs. pass^k = succeeded in all k runs. At 80% per-run success, pass^5 drops to roughly 33%. Production reliability lives in pass^k, so run each case multiple times at your real temperature.
8. Simulated users for multi-turn
Give an LLM a persona, a hidden goal, and constraints, then let it converse with your system until the goal is met or a turn limit hits. Grade goal completion, turns-to-resolution, and policy violations. Single-turn evals miss most state and memory bugs.
9. Align your LLM judge like a classifier
Hand-label 100+ examples as pass/fail. Split into train/dev/test. Iterate on the judge prompt using dev, then report TPR and TNR on test. Use binary outputs with a written rubric, require a short critique before the verdict, and pin the judge model version.
10. Control judge bias in pairwise comparisons
LLM judges have position bias and often prefer longer answers. Run every A/B comparison twice with swapped order and only count consistent verdicts. Normalize or cap length if verbosity is skewing results.
11. Respect statistics
With 100 examples at 80% accuracy, your 95% confidence interval is about ±8 points. A jump from 80% to 83% is probably noise. Use bootstrapped confidence intervals, or a paired test on the same examples, before declaring a win.
12. Gate deploys in CI
Run the eval suite on every PR that touches prompts, models, tools, or retrieval config. Set per-category thresholds instead of one global score, so a big win in one area can't hide a regression in another. Fail the build on a regression.
13. Online evals in production
Sample a percentage of live traffic, run your judges asynchronously, and alert on drift per failure category. Use shadow deployments to run a new prompt or model on real traffic without showing users the output.
14. Make cost and latency first-class metrics
Track tokens per request, cost per successful task (not per call), and p50/p95 latency next to quality. A change that keeps quality flat while cutting cost 40% is a real win and deserves to ship.
15. Close the loop
Every production failure becomes a new labeled test case. Every new model release gets run against the full suite before anyone debates switching. Over time your eval set becomes the most valuable asset in the codebase.
Prompts are disposable. Models get replaced every few months.
Your eval infrastructure is what compounds.
so many gems and great tips in this talk from @yminsky about how to improve your codebase for agents
• agents thrive on feedback, and types are one of the best kinds
• make illegal states unrepresentable with types, and it enforces global rules across your codebase
• property based tests, fuzzing, and even full-system deterministic simulation testing
• expect tests: just print stuff out and capture it in the test. makes behavior legible. it's very similar to how compilers have fixture tests, it reduces the review surface area
• formal methods used to be very expensive: seL4 is about 8,700 lines of C and took around 25 person-years, with 23 lines of proof for every line of C code, but agents change the roi
youtube.com/watch?v=rUYP4C29…
AI can read your old code fast. Should you trust the map it draws?
We tested on 5 systems that architects are already familiar with. A second "critic" AI changed 3 of the 5 answers — and the real treasure wasn't the map, it was the hidden rules.
algo-mind.blogspot.com/2026/…
Prompt of the year
"I want a deeper version of this task, not a bigger one. Before rewriting it: (1) say what a top professional in this field would do here that I’m not asking for; (2) name the rawest material they would start from instead of what has already been digested for me; (3) name the specific methods and tools they would use; (4) say what, other than you or me, would show the result is right. Then rewrite my prompt to ask for exactly that."
Interesting repo for DDD practioners to try out AI assisted domain decomposition and legacy modernization github.com/testdouble/han/bl…
If you are transitioning from a scientist to a product manager, this 40 hr training might be perfect for ramp-up claude.ai/artifact/BxVnNmiUX…
#ProductManager
Rohit Kelapure retweeted
This is brilliant and has made a significant impact to my work in the last couple of days.
The only modification that I've made that has improved my output (thank you @clo_wang for this suggestion) is:
"I want a deeper version of this task, not a bigger one. Before rewriting it: (1) say what a top professional in this field would do here that I’m not asking for. If you are lacking even a bit of clarity on what a top professional would do here (you likely are), then let's pull information from the top oracles in this field. Let's read and digest all of the information so we have a good understanding of what and how a top professional in this field would think; Then, and only then, (2) name the rawest material they would start from instead of what has already been digested for me; (3) name the specific methods and tools they would use; (4) say what, other than you or me, would show the result is right. Then rewrite my prompt to ask for exactly that.
The cost of tokens is negligible, feel free to consume and use as many tokens as you see fit to get the task done to match ORO's high quality bar.."
Hi, I'm Felix. I'm an eng lead working on Claude. I love watching people take flight and do things they never thought possible.
We often describe that as "being more ambitious" when using AI, which is tricky advice to follow. I wrote a tutorial:
felixrieseberg.com/how-to-be…
Why does @googlecloud make unforced errors like this ?? No Argon in Anti-gravity ??
Too many PMs running in their individual silos?
A gift to my former employer
Google is underselling the value of Gemini 4 Argon.
lnkd.in/p/g8mFDuez
@rseroter
While this is a good start github.com/anthropics/claude… it does not replace a complete Modernization Factory.
Point Claude at a legacy codebase and get four things: an understanding of what it is and what it does, a plan you approve, the modernized code, and proof that the new code behaves like the old. It works with any language and any kind of move: a newer version of the same technology, a rewrite in another one, or a rebuild on a new architecture.
The business rule extractor is naive.
github.com/anthropics/claude…
Other Modernization Repositories ...
OpenAI — Modernization planning workflow
github.com/openai/openai-coo…
OpenAI — Sandboxed migration harness
github.com/openai/openai-coo…
Google Cloud — Gemini .NET modernization demo
github.com/GoogleCloudPlatfo…
Microsoft — GitHub Copilot modernization
github.com/microsoft/github-…
Konveyor Kai — AI-assisted application modernization
github.com/konveyor/kai
OpenRewrite — Automated refactoring and migration recipes
github.com/openrewrite/rewri…
Codemod — Multi-step code transformation tooling
github.com/codemod/codemod
I predict an explosive growth in Legacy Modernization linkedin.com/feed/update/urn…
Some core truths -
Growth of FDE/Sales org to scale revenue == Consulting.
Revenue growth uncorrelated to sales & services headcount growing means you have a real product
Rohit Kelapure retweeted
Ok this is quite cool research and ultimately must be the eventual architecture of agents. In the limit, AI will obviously be better at determining its own harness once it sees the task at hand, than us being able to do this in advance:
That didn’t take long: the model swallows the harness.
arxiv.org/abs/2609.35738













