The Stable Map Spec
A diagram generated from source is regenerated whenever the source changes. A map is somewhere you can return to. These five properties are the difference, written so that any tool can implement them and anyone can test whether it did.
- 5
- properties, all testable
- v1
- published September 2026
- Free
- to implement, no permission needed
1. The problem
Generated diagrams re-lay out on every render, so the same system looks different each time you open it.
That is fine for a picture and fatal for a map. Recognising where something sits is most of what makes a map useful, and nobody can recognise a place that moves. The cost is invisible in a demo, where the diagram is seen once, and it dominates in daily use, where it is seen a hundred times.
This got worse as generation got better. When a diagram was drawn by hand once a quarter, it held still because nobody touched it. Deriving it from the source on every change fixed the accuracy problem and created a legibility problem in its place: the picture now changes faster than any reader can form a memory of it. The tools solved the first problem well and mostly have not noticed the second.
Nothing here requires a new algorithm. It requires a tool to say what it guarantees, in terms someone can rely on and someone else can check.
2. What is already known
The idea is thirty years old and not ours. The contract is what is missing.
Graph drawing research has studied this since the early 1990s under the name preserving the mental map, from work by Misue, Eades, Lai and Sugiyama, and there is a substantial literature on dynamic graph drawing and layout stability since. Anyone building in this area should read it first. We did, and we are not claiming the insight.
Two things are genuinely unaddressed. That research generally assumes a graph mutated incrementally, whereas a map derived from a repository is re-derived wholesale from a source that people edit all day, which makes the identity question harder than the layout question. And none of it is expressed as something a product can commit to and a customer can verify. A body of technique exists; a contract does not.
The precedent for closing that gap is the C4 model, published as a free notation by its author while the tooling was sold separately. The notation spread because it was useful to people who never bought anything. This aims at the same shape.
3. Definitions
Six terms, used precisely for the rest of the document.
Source is the artefact the map is derived from: a repository, a schema, a set of traces. Derivation is producing a graph from that source, and regeneration is doing it again later, after the source has changed.
Identity is the rule that decides whether a thing in this derivation is the same thing as one in the last. Region is the area a node is allotted, which contains that node and all of its descendants. Layout is an assignment of coordinates to nodes.
Must and should are used as RFC 2119 uses them. A tool that fails a must does not conform. A tool that fails a should conforms, and owes its users an explanation.
4. The five properties
Each one is a single sentence, and each one is testable from the outside.
P1 Identity
A thing that still exists in the source must keep the identifier it had before, and that identifier must be derived from the source rather than from processing order or a counter.
Everything below depends on this one. A layout cannot keep a node where it was if it cannot tell that it is the same node. A conforming tool must publish its identity rule, because the rule determines what counts as the same thing and reasonable rules disagree.
P2 Determinism
The same graph and the same prior layout must produce the same coordinates, exactly.
Note what determinism is defined over. Not the graph alone: the prior layout is an input, deliberately, because a stable map is a function of its own history. A tool whose output depends only on the graph has thrown away the information stability is made of. Exactness is meant literally, since anything approximate here compounds across regenerations.
P3 Containment
Every node must sit inside its parent's region, every region must contain the regions of all its descendants, and sibling regions must not overlap.
This is what makes “inside” mean something. Without it a reader cannot infer that things drawn together belong together, which is the one inference a spatial layout exists to support. It also bounds the damage from every other operation: if regions nest, rearranging one cannot scatter nodes across the map.
P4 Continuity
A node that survives a regeneration must keep its exact coordinates unless its newly allocated region no longer contains them, and a tool must publish the conditions under which it moves a surviving node.
The conditional is the substance. An unconditional promise would be unimplementable, since a region that shrinks has to put its contents somewhere, and a promise nobody can keep gets quietly dropped. The requirement is that movement has a stated cause a reader can predict, rather than being whatever the algorithm happened to do this time.
P5 Proportionality
A small change to the source should cause a small change to the map, and a tool should state the size of change at which this stops holding.
This is the property users actually feel and the only one stated as a should. It is not absolute in any implementation we know of, including ours: restructure enough of the source and any layout has to give up and reallocate. What separates a map from a picture is that ordinary edits, the ones that happen every day, move nothing at all. Section 7 gives our measured figures, including where ours stops.
They are ordered by dependency rather than importance. Identity makes continuity expressible, containment makes movement bounded, and proportionality is what the other four add up to from the reader's side of the screen.
5. What it buys the reader
One consequence, which is the only part of this a non-technical reader should have to care about.
A place stays findable. A link to a location still lands there next month. A screenshot in a document is still true. “It is over on the left, under billing” survives being said out loud on a Tuesday and acted on the following week.
This falls out of P1 and P4 rather than being a rule of its own, and it is worth stating separately because it is the thing being bought. The properties are how a tool earns it and how you check that it did.
6. Conformance
Five procedures. None of them needs access to the implementation, which is the point.
Each test takes a source, derives a layout, changes the source, and regenerates. Compare coordinates exactly. Approximate equality is a failure here, not a pass with rounding, because “nearly where it was” is precisely what an unstable layout already gives you.
- P1Identity. Derive twice from an unchanged source. The set of identifiers must be identical. Then rename nothing and move one file, and check whether the tool's published identity rule predicted what happened.
- P2Determinism. Derive twice from the same source and the same prior layout, in separate processes. Every coordinate must match exactly.
- P3Containment. For every node, assert its position falls inside its parent's region. For every pair of siblings, assert their regions do not intersect. This one needs no regeneration at all.
- P4Continuity. Add one leaf to a subtree. Every node outside that subtree whose region still contains its old position must have identical coordinates. Any node that moved must be explainable by the tool's published conditions.
- P5Proportionality. Run the previous test at increasing sizes: one leaf, five, fifty, a doubled branch. Record the count of unrelated nodes that moved at each step. The result is a curve, and the tool should have told you in advance roughly where it bends.
A tool conforms when the four must tests pass, it publishes its identity rule, and it publishes the conditions under which a surviving node moves. Reporting the P5 curve is part of conforming even when the curve is unflattering.
7. Where cleap falls short
Three places, measured rather than estimated.
Identity is derived from the path. A file that moves or is renamed is a new node with a new identifier, so it loses its position and so does everything under it. This satisfies P1 as written and fails what a reader actually wants, which is for a renamed thing to still be the same thing. Content-based identity would fix it and is not built.
Proportionality holds, and then stops. Running the P5 procedure against our own engine: adding one, two or five files to a neighbouring branch moved no unrelated node at all, with exact coordinate equality. Tripling a branch's size moved most of the map, some nodes across most of the world. There is a cliff rather than a slope, and where it sits depends on the shape of the change.
A large restructure can rotate an untouched subtree. When a region changes shape rather than only size, the internal arrangement of even an unchanged subtree can come back transposed: what sat side by side now sits stacked. Nothing in the five properties forbids this, which is arguably a gap in the specification rather than only in our implementation. We would rather publish that than quietly leave it out.
8. Out of scope
Four things this deliberately says nothing about.
Which algorithm to use. Treemaps, force-directed layouts with pinning, hierarchical placement: any of them can satisfy all five. Naming one would turn a contract into a recipe and exclude better ideas.
What it should look like. Notation, shape, colour and level of abstraction are not addressed here. The C4 model answers that question and answers it well; this one is orthogonal to it and the two compose.
Whether the map is correct. Stability is worthless without accuracy. A stable map that is wrong is more dangerous than an unstable one that is right, because it is trusted. Freshness is a real problem and a different one.
Whether the layout is any good. A fully conforming layout can still be unreadable. These properties are necessary for a map and nowhere near sufficient.
9. Using it
Free to implement, cite or ignore. No permission required and none granted.
Implement it in a competing product if it is useful. Nothing here is patented and nothing is licensed, because a specification that has to be negotiated is a specification nobody adopts. If you conform, say so and point at your P5 curve, and we will link to you from this page whether or not you compete with us.
If you think a property is wrong, or that the third shortfall above is really a missing sixth property, write to hello@cleap.dev. This is v1 of a document that expects to be argued with, and the version number is there so that a later disagreement has something to name.
cleap is a map of a codebase built to these properties. How it compares puts that beside the other tools in the category, and the showcase lets you open a real one without an account.
The Stable Map Spec, version 1, published September 2026 by the team behind cleap. The measurements in section 7 were produced by running the section 6 procedures against our own layout engine, and they will be re-run and republished when it changes.