Overcoming the legacy roadblock

Legacy codebases are the bane of AI tools. How can we overcome this?