Legacy code
also: legacy codebase, legacy system
Older code that still runs but that nobody fully understands anymore, often with no tests showing what it's supposed to do. People are afraid to touch it.
Existing code inherited from earlier developers or earlier versions, typically poorly documented, lacking automated tests, and built on older patterns or dependencies. Changing it is risky because its intended behavior is unclear and side effects are hard to predict.
The wiring in an old house. The lights work, but nobody knows which switch controls what, and there's no diagram. Cut the wrong wire and the fridge in another room goes off.
Agents are fast and confident, which is dangerous in code nobody understands. Telling your agent it's working in legacy code signals it to read first, change little, and protect current behavior.
This is legacy code with no tests. Before changing the tax calculation, I'll write tests that capture what it does today, so we'll notice if anything shifts.
The invoicing module is legacy code nobody fully understands. Explain what it does before changing anything, and add tests that capture its current behavior first.
Thinking legacy code just means old or bad code. Much of it is valuable and works. The problem is that nobody knows exactly why it works, so changes are risky.