arXiv(opens in a new tab)cs.SEOct 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2610.17197

Deleting Code Without Losing Knowledge: Regenerative Software for Python Libraries

Thomas Bartz-Beielstein

ABSTRACT

In the age of “Software 3.0”, when a complete program can be rewritten in minutes by an agent, the traditional approach of relying on code as the sole source of truth becomes questionable. Fowler advocated for a set of seven primitives, which lay the framework for Regenerative Software, so that programs can be deleted and rebuilt without losing their knowledge. The knowledge lives in machine-readable records in a tracked directory, from which a regeneration bundle is built for each unit. The regeneration bundle is a single file with the module’s architecture, intent, decisions, public contract, evaluations, and consumers, but no implementation, plus the one dependency module it may import. The open-source package spotregen implements these primitives and provides a graphical user interface. This report presents a first application of Fowler’s primitives to the safety-critical forecasting library spotforecast2-safe. During the first experiments, the Claude Code session that orchestrated the study consumed more than 43 million tokens, almost all of them its own history re-sent with every request. This motivated the switch to an architecture that is built on local models. Deterministic checks and the maintainer judged the results. The report contains executable examples for every primitive. Each example runs spotregen against the repository or against a throw-away copy of it.

Keywords regenerative software • safety-critical software • specification • test oracle • mutation analysis • provenance • time series forecasting

1 Introduction

During the development and application of a safety-critical library many lessons are learned. For example, during the application of the open-source time-series forecasting package spotforecast2-safe (Bartz-Beielstein 2026b), a corrupt load value published by the European Network of Transmission System Operators for Electricity (ENTSO-E) once truncated a leaderboard submission. The fix is stored in the code. But the code does not keep the reasons. Although we tried to keep track of the knowledge from bug fixes in an extra maintained project knowledge base (KB) and in the changelogs, most of it lives in the memory of its maintainer or is simply forgotten. Fowler (2027, ch. 1) argues that this process was rational as long as writing working code was expensive. The code and its documentation were the only reliable memory of the programs. Today, in the age of “Software 3.0” (Karpathy 2025), when an agent can rewrite a module in seconds, the cost structure inverts: implementation becomes cheap and can be quickly repeated. The scarce asset is the knowledge around it: what a module must do, why it does it that way, which incident taught that, and who breaks when it changes. Fowler calls a system built around that knowledge regenerative. He proposes the deletion test to check whether a module is regenerative:

Pick an important module in your system. If you deleted the implementation tomorrow, could you rebuild the system correctly? Could you reproduce the edge cases, the failure behavior, the timing assumptions, the integration contracts, the operational constraints, the weird exception added after the outage everyone remembers but nobody documented? Could you tell which parts of the current implementation are essential and which are accidental, evaluate a replacement without relying on the old code as the oracle, and prove, with evidence, that the new implementation keeps the promises the system is supposed to keep?

— Fowler (2027, ch. 1)

For most systems, Fowler argues, the honest answer is no. We read his question as three:

• (QF-1) Is the knowledge complete?

• (QF-2) Does a rebuild keep the promises?

• (QF-3) Can a replacement be judged?

The answer of these questions is crucial especially for safety-critical systems like spotforecast2-safe. The package is a dependency-minimised port of the forecasting core of spotforecast2 (Bartz-Beielstein 2026a) and of parts of skforecast (Amat Rodrigo and Escobar Ortiz 2026), built for environments in which the EU AI Act (European Parliament and Council 2024) and fail-safe behaviour matter. Its guarantees are determinism, explicit errors instead of silent repair, and a minimal dependency surface, which were defined as code-development and process rules, see Bartz-Beielstein and Bartz (2026). Its consumers include the sibling open-source package spotforecast2, a series of lecture and research books, and daily scripts that submit forecasts to a public ENTSO-E leaderboard. A refactoring that drops one of these guarantees without anybody noticing is exactly the failure a safety case is meant to exclude.

This report describes how the seven primitives of Fowler (2027) (intent, compilation, evaluation, provenance, pace, deletion, and compaction) were applied to spotforecast2-safe and what the application produced. The research question is the deletion test itself: can the knowledge that a module needs in order to survive its own deletion be made explicit, machine-checked, and small enough to maintain? The contributions of this report are the following.

  1. A mapping of each of the seven primitives to a concrete, versioned artefact of a Python repository, together with a static check that enforces the mapping before every release (Section 2).

  2. A pilot on four high-risk modules, with measurements of intent coverage, mutation score, and specification size (Definition 2.31, Definition 2.32, Definition 2.33; Section 3).

  3. A regeneration of one module by a large language model (LLM) from its specification alone and a behaviour change carried out specification-first, which together show the method finding and closing real gaps (Section 3.4).

  4. Executable examples using a new software architecture completely implemented with local models for every primitive. The examples are cells of this document that run spotregen, so a reader can repeat each one.

  5. Last but not least, the code used here is available as the open-source Python package spotregen on PyPI (Bartz-Beielstein 2026c), which does provide a graphical user interface.

The approach was first tried in the tabular foundation-model project macl2l and then generalised for this library. That trial included a first regeneration of one module. This report concentrates on spotforecast2-safe, where the stakes are higher because other repositories consume the library’s behaviour.

This report is structured as follows. Section 2 describes the methods and the artefacts that implement them. Section 3 presents the results of the deletion test, including the regeneration and a specification-first change. Section 4 discusses the results and their implications for regenerative software. Section 5 presents the conclusions.