A rewrite is when a codebase could teach you the most, and it is usually when no one is listening. The old code had thin understanding to begin with, and the new code arrives with none.
So ask the agent for one more thing while it works: a ledger. Every change it makes, and why it made it, in plain text. Plain text scales. A whole team can read it, search it next year, and hand it to whoever joins after the original people have moved on.
The ledger is how the work turns into a lesson.
The best use of an agent leaves behind more understanding than it found.
Kay
P.S. Try the scaffold plugin, which keeps a ledger of what you understood alongside the code your AI writes. https://systemthinkinglab.ai/scaffold