An AI agent refactored a 717K-line TypeScript codebase in 3 days for $2,430 using 31 spec-audit passes and no human code review
A case study posted to arXiv (2608.12440) documents an agent dismantling a core lifetime invariant across 3,648 files — 189 modified, 31 created, 34,770 insertions and 16,422 deletions — with no human reviewing the diff and no pre-existing test suite to lean on. The protocol was specification-first: 14 refinement cycles auditing the spec against the source, then implementation, then verification, for 31 audit passes total that surfaced and fixed 201 defects before a human ever ran the program. The author published the full formal spec and 1,500+ pages of session logs as evidence. The transferable technique is the ratio — nearly half the total effort spent auditing a written spec against existing code before any edit, which is the opposite of how most agent refactors are run.
↳ Follow the thread