arXiv:2610.20068cs.SEOct 2026

Manuscript Offprint

arXiv:2610.20068

The Code of Theseus: Can Agents Rebuild Software from Recovered Design Documents?

Cezar Sas, Sandra Mitrović, Fabio Barth, Georg Rehm, Matteo Salani

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Cezar Sas*, Sandra Mitrović*, Fabio Barth†, Georg Rehm†, Matteo Salani*

*IDSIA (SUPSI), Switzerland

{cezar.sas, sandra.mitrovic, matteo.salani}@idsia.ch

†DFKI, Germany

{fabio.barth, georg.rehm}@dfki.de

Abstract—LLM agents increasingly design a system before implementing it, yet the data to train and evaluate them centres on implementation and testing: requirements and design artefacts are often missing, outdated or private. Source code, in contrast, is abundant. Prior work recovers architecture documentation by feeding LLMs the source code or letting agents explore it, which saturates the context, does not scale to many repositories, and yields a single artefact rather than aligned ones. We present a framework that recovers aligned stakeholder intent, requirements and architecture from a compact repository representation, a static dependency graph and key contextual files, and release the artefacts of 10,764 Java, Python, C/C++ and C# repositories as a dataset. An LLM judge rates the artefacts of three generators as clear and internally consistent, but less reliably correct and at the right level of abstraction. To test whether the artefacts carry the design, we pose a software Ship of Theseus: a coding agent rebuilds 29 COMMIT0 libraries from the intent alone or with the recovered requirements and architecture, given only an interface contract and part of the tests. The artefacts do not significantly change the held-out pass rate (33.7% vs. 35.8%), but bring the rebuilt module structure significantly closer to the original (module F1 from 0.54 to 0.63), with either generator and even with concise artefacts. Recovered artefacts thus convey design that tests do not capture, offering a scalable source of design-level data for agents that design before they implement, and the round trip measures this without human references.

Index Terms—Software Reconstruction, Agentic SE, SDLC, LLM, ASE, SAR, Reverse Engineering, Dataset

I. INTRODUCTION

Large language model (LLM) agents are increasingly used to automate software engineering (SE) tasks, from code generation and testing to debugging and repository-level maintenance. Multi-agent frameworks such as MetaGPT [1], AgileCoder [2], HyperAgent [3] and ChatDev [4] go further and distribute the work across the stages of the software development lifecycle (SDLC), so that the system is designed before it is implemented.

The data available to train and evaluate such agents does not follow this shift. Existing benchmarks focus on implementation (61%) and testing (12%), while requirements engineering (5%) and software design (3%) are barely represented [5]. Yet these early stages are necessary before implementation, whether the agent plans its own work or a multi-agent system assigns requirements and design to dedicated roles. Without them, agents write monolithic programs, with far fewer files and shallower directories than the originals [6]. Data that connects intent, requirements and design to the code that realises them is scarce, because early-stage artefacts are often missing, incomplete, obsolete, inconsistent with the implementation, or private [7, 8]. This also poses a limitation to comprehensive benchmarking of multi-agent systems for software development on intermediate steps [9].

Source code, in contrast, is abundant, and LLMs can recover design documentation from it. CIAO [10] reconstructs architecture documentation that contributors to the repository find useful, from a flattened representation of its source code and directory structure. Two questions remain open if recovered artefacts are to serve as data for agents. First, generation must scale to thousands of repositories and produce artefacts that are aligned with each other, not architecture documentation alone. Second, it is unclear whether the artefacts carry enough of the design to build the system from them.

We address both. Our framework builds a compact, deterministic representation of each repository by using static analysis to extract a dependency graph and contextual files, which are then used to condition an LLM to generate three aligned artefacts: stakeholder intent, requirements, and architecture. Applied at scale, the framework yields aligned intent–requirements–architecture–code data on which LLMs can be trained.

We evaluate the artefacts in two ways, which give our three research questions. First, an LLM judge rates the artefacts of three generator models on seven quality dimensions (RQ1: how good are the recovered artefacts as a coherent body of documentation?). Second, we close the loop from code to artefacts and back to code: a coding agent rebuilds 29 Python libraries of the COMMIT0 benchmark [11] from the artefacts of two generators alone, and the original implementation serves as the reference. This poses a software version of the Ship of Theseus: if an agent rebuilds a library from the design recovered from its code, is it the same system? The held-out tests show whether it behaves the same (RQ2), and structural metrics show whether it is built the same way (RQ3).

In summary, this paper makes four contributions:

• A framework for recovering aligned stakeholder intent, requirements, and architecture artefacts from compact repository representation;

• A round-trip evaluation showing improved module-level structural similarity without significant changes in func-tional correctness;

• An LLM-as-a-judge evaluation of three generator models across seven quality dimensions;

• A large-scale dataset of 10k repositories paired with aligned early-stage SDLC artefacts for LLM training.

The supplementary material are publicly available at https://github.com/SasCezar/code-theseus and as a Hugging Face dataset at https://huggingface.co/datasets/cezar-sas/code-theseus.

References (52)