Should I let an AI agent refactor my whole codebase at once?
No. Large refactors are exactly where verification is weakest, because the diff is too big to review and the tests were written for the old structure. Do it in scoped steps, one per commit, each independently revertable.
From Using AI on an existing codebase without breaking it, published 9 August 2026. That article is where the reasoning behind this answer is set out, including what it does not cover.