Topological Engineering

“Never tear. Never glue. Deform.”

A general theory of AI-driven development methods.

The Torus Engineering Working Group
September 2026

Abstract Loops, tori, Klein bottles, fractals — every AI-driven development method proposed to date has taken a particular topological space as its object. We cease to treat them one at a time. Instead we present topological engineering, a general theory in which agentic systems are designed and evaluated by the quantities preserved under continuous deformation — rewording a prompt, switching models, splitting subagents, compacting context — that is, by their topological invariants. We further give a diagnostic of agentic systems by Betti numbers (§3), a classification theorem for AI-driven development methods (Theorem 4.1), and an existence theorem for stuck points of fully autonomous agents (Theorem 5.1).
g = 0sphere g = 1torus g = 2double torus
Fig. 1. Classification of orientable closed surfaces (detail).

§1Introduction

Loop engineering studied the circle S1. Torus engineering studied its product S1 × S1; Klein bottle engineering abandoned orientability; fractal engineering liberated the dimension from the integers. Each was honest work, and each was work on a particular object.

Were we to propose one method per object, the number of methods would grow with the number of surfaces, and there are infinitely many surfaces. The sequence must be truncated somewhere.

This paper does not study objects. It studies the properties that survive whatever one changes — the topological invariants. What is unchanged when the prompt is rewritten, when the model is replaced, when the work is split across any number of subagents: that alone deserves to be called design. We now present its general theory.

§2Definitions

Definition 2.1 (Topological engineering). The practice of designing and evaluating an agentic system by the topological invariants preserved under continuous deformation is called topological engineering. Rewording a prompt, switching models, splitting subagents, compacting context, and renaming tools are all continuous deformations — nothing is torn and nothing is glued — and the system before a deformation is homeomorphic to the system after it. It follows that design consists not in fixing particular implementations but in fixing invariants.

A continuous deformation is subject to exactly two rules. Never tear: no connection between agents may be severed. Never glue: no two contexts that were separate may be fused into one. Within these rules, anything is permitted. Deform.

Proposition 2.2 (Compaction invariance). Context compaction is a continuous deformation. Hence a problem that disappears under compaction was never a genuine hole. Only the holes that survive compaction are genuine.∎

Proposition 2.2 is made precise in the language of persistent homology. As context is compacted in stages, at successively coarser granularity — that is, across scales — a hole that is born at one stage and dies at the next is mere noise. Only holes that persist across scales are structural defects. One need repair only the points far from the diagonal of the persistence diagram; the rest will be handled by the next compaction.

For a position that takes cross-scale structure itself as the object of design, see fractal engineering (companion paper).

§3Diagnosing Agents by Betti Numbers

There is no need to inspect the system’s org chart. Compute its homology.

Definition 3.1 (Betti numbers of an agentic system). To an agentic system we associate the following three quantities.

b0 = the number of connected components = the number of groups of agents that share no context: islands of subagents unaware of one another’s existence.

b1 = the number of independent cycles = the number of independent feedback loops (retry, verify, improvement).

b2 = the number of enclosed cavities = the number of contexts that every agent summarizes and passes along, and that no agent ever reads.

Each Betti number presents a characteristic symptom.

b0 ≥ 2: islands
The same bug is discovered independently on each island and fixed independently on each island. There are as many fixes as there are islands.
b1 = 0: no cycles
The agent tries exactly once. Its first output is its last, and a failure reaches the deliverable intact. Torus engineering, with its execution loop and its improvement loop, has b1 = 2.
b2 ≥ 1: cavities
The canonical example is the section of CLAUDE.md that is circulated but never read. The prohibitions written there are faithfully summarized and handed to the next agent every time, and faithfully violated every time. Seen from outside, a cavity is perfectly closed, so no agent’s output ever shows a crack.

The alternating sum χ = b0 − b1 + b2 is called the Euler characteristic. In the next section we use it to classify every method there is.

§4The Classification Theorem

Theorem 4.1 (Classification of AI-driven development methods). Every AI-driven development method is homeomorphic either to an orientable closed surface of genus g or to a non-orientable closed surface with k crosscaps. There is no third option.∎

Methods are tacitly assumed here to be compact (the budget is finite) and connected (b0 = 1). The classification of known methods is given in Table 1.

Table 1. Classification of AI-driven development methods.
Surfaceg / kχAs an agentic systemMethod
Sphereg = 02A fully autonomous loop with no point of human interventionLoop engineering
Torusg = 10One point of intervention; an execution loop and an improvement loop (b1 = 2)Torus engineering
Double torusg = 2−2Two points of intervention. Under review—
Klein bottlek = 20A system in which the orchestrator cannot be told apart from its subagentsKlein bottle engineering
(Non-integer dimension)—UndefinedOutside the scope of this theorem; see the companion paperFractal engineering

Which row of this table your system occupies may be determined by counting V − E + F.

For the relation between the inside of a closed surface and its boundary, see holographic engineering.

§5The Hairy Ball Theorem

We turn finally to the number of points of human intervention itself. A fully autonomous agent, with no point of intervention at all, corresponds in Table 1 to the sphere. And about the sphere, one classical theorem is known.

v(p) = 0 cowlick
Fig. 2. A vector field on a fully autonomous agent, and its cowlick.

Theorem 5.1 (Existence of a point of bewilderment). Every continuous tangent vector field on the sphere has a zero (the hairy ball theorem). Hence a fully autonomous agent with no point of human intervention (g = 0) necessarily has a point from which it can proceed in no direction. A vector field on the torus (g = 1), on the other hand, can do without zeros. It follows that the minimal1 topology on which an agent never gets stuck is a surface with one hole.∎

The hole through which human judgment passes is not a metaphor. It is a theorem.

§6Frequently Asked Questions

Is it safe to migrate our existing system?
It is. The system before migration is homeomorphic to the system after it. Your users will not be able to tell the difference, just as no one can tell a coffee mug from a doughnut (Fig. 1).
What happens if an agent keeps improving its own prompt?
By the Brouwer fixed-point theorem, it necessarily reaches a point at which it no longer improves. That point is called completion.
We switched to a new model version, and everything broke.
Genus is preserved by homeomorphisms. What broke was something other than the genus — namely, whatever you had not defined as an invariant.
How do we reduce b2?
The cavity vanishes as soon as someone reads it.

§7Concluding Remarks

The loop was a sphere; the torus was a torus; the Klein bottle was a Klein bottle. The fractal was never a surface at all. Every method this site has put forward either occupies some row of Table 1 or is shown to occupy none.

We have not been proposing methods. We have been classifying them.

And the torus was right.

1 In fact, unique. A vector field on a closed orientable surface of genus 2 or more once again has a zero (the Poincaré–Hopf theorem, since χ ≠ 0). The treatment of systems with two points of intervention is under review. ↩