Refactor Agent

Safe, incremental code modernization at scale—no big-bang rewrites, no disruption.