Case study demonstrates AI successfully refactors a large TypeScript codebase without human review, implying new possibilities for autonomous coding practices.
This paper reports a single, fully instrumented case study of a large-scale architectural refactoring carried out by an AI coding agent under a specification-first protocol, with no human review of the generated code at any point. The task, dismantling a central invariant across a large interdependent codebase with no pre-existing test suite to serve as an oracle, was assessed by the author as effectively infeasible through incremental refactoring, the kind of change that conventionally calls for rewriting the affected components from scratch instead. Under the specification-first protocol described in this paper, however, the agent completed it successfully. The system under study is a production TypeScript application of 717,725 lines across 3,648 files, comprising a custom orchestration backend, a custom React frontend, and a custom RPC data bus connecting the two. The task required dismantling a core lifetime invariant of the system: the guarantee that a user-interface panel remains open for the entire duration of an AI request. The target behaviour was that a streaming generation survives the closing of its panel and can be reattached, on reopening, to the exact same live stream with no loss or duplication of content. The protocol applied was: formal specification produced by the agent, 14 successive refinement cycles auditing that specification against the real source code, atomic implementation, a compilation and unit-test feedback loop, then 17 verification cycles auditing the produced code against the frozen specification. Across the 31 audit passes, 201 defects were identified and corrected before any human executed the program. The convergence criterion was empirical: two consecutive verification passes returning zero findings. The resulting change touched 189 files (of which 31 were new). Combined with the preparatory extraction phase, the two commits total 288 changed files, 34,770 insertions and 16,422 deletions. On first manual execution after the refactor, and across roughly thirty subsequent sessions covering its different use cases, the modified software behaved as specified, with no bug observed. Total elapsed time was three days; total inference cost was USD 2,430. The detailed specification implemented by the agent and the full raw session logs of every cycle are published as evidence, amounting to 1,500+ pages, in French. They allow third-party inspection of the actual process rather than of its summary alone, and can be submitted to a language model for translation and for consistency checking against the claims made in this paper.
No takes yet. Share an insight, caveat, or question.
Joël Abenhaïm (2026) studied this question.
Synapse has enriched 5 closely related papers on similar clinical questions. Consider them for comparative context: