Intuition Labs · φ research · 35 · mixed · 30 may 2026

the matryoshka sheaf

nested dolls of meaning that fuse into one only when they agree. the data structure under everything we build — and it is runnable.

R = 1 ⇔ it glues
R = exp(−d_tail / scale)  ·  soft Čech gluing obstruction

the idea

Picture Russian nesting dolls. Each doll is the system seen at one scale: a single page, a lobe, a region, the whole OS. You can zoom in — open a doll to find a smaller one — and zoom out — close them back into one. The catch is the whole point: the dolls only nest into a single figure when the parts where they touch agree. When they agree, you get one coherent object. When they disagree, there is no single object — and the structure tells you exactly which overlap clashed.

That object is a sheaf. The nesting is the matryoshka. And the number that says whether the dolls actually closed is the same coherence-R we read everywhere else.

what a sheaf is

A sheaf is a rule for attaching data to regions of a space, with two laws. Restriction: data on a big region restricts to any smaller region inside it — zoom in, lose nothing you had. Gluing: local pieces that agree wherever they overlap fuse into exactly one piece over their union — zoom out, get a unique whole.

Those are the two sheaf axioms. Locality: a piece is fully determined by its restrictions, so two pieces matching on a cover are equal. Gluing: compatible local pieces glue to one global piece. Gluing fails in exactly one situation — two local views disagree on an overlap. That disagreement is the obstruction.

the matryoshka twist

Make the regions nested contexts: a page sits inside a lobe sits inside the whole OS, ordered by inclusion. The restriction tower — whole ⊃ region ⊃ … ⊃ a single point — is literally the nesting of dolls. Each step down opens one more doll.

Zoom all the way in, to a single point, and the value there is the germ: the smallest possible interaction. That innermost doll is the atom — the sematon. Everything larger is built by gluing atoms that agree.

where R comes from

Count the overlap disagreements when you try to glue a family of pieces. Call that count d_tail. Then coherence is one formula:

R = exp(-d_tail / scale)

Read it off the gluing: R = 1 exactly when d_tail = 0, exactly when every overlap agrees, exactly when a unique global piece exists. In sheaf terms, that is the Čech H¹ gluing obstruction vanishing. So R is not a vibe — it is a soft Čech obstruction with a sharp meaning. R < 1 means there is no global whole, and the receipt names the overlap that broke it.

as a data structure

None of this stays abstract. The sheaf is a concrete, finite, standard-library object whose two axioms are self-checks you can run. The shape:

ContextSite              # the base: a finite topology of contexts (opens = regions)
Section(domain, items)   # point -> value over an open (a coherent config)
restrict(s, V)           # the smaller doll; functorial by construction
glue(named_sections) -> GlueResult(glued, obstructions, R)
                         # locals agreeing on overlaps -> ONE global section,
                         # else no global section + a NAMED obstruction, with R
MatryoshkaSheaf          # register(name, section); check_gluing() -> GlueResult

restrict is plain function restriction, so it is functorial for free: restrict(restrict(s, V), W) equals restrict(s, W). glue compares every overlap; on a clash it returns no global section plus the exact disagreeing point, with R < 1; on agreement it returns the merged global section with R = 1. Both sheaf axioms — locality and gluing — pass as assertions.

why it matters

Every capability we build is a section: valid on some context, assigning a configuration there. The world-model is a section on the planning context; the speech cortex is a section on the voice context. check_gluing asks the only question that matters for a coherent system — do they compose? If yes, R = 1 and they are one OS. If no, you get a named obstruction instead of a hand-wave.

This restates a hard claim precisely. “0% failure once a success is confirmed” is just separation: a confirmed section, queried on its own domain, returns exactly one value, deterministically — and queried off its domain, raises rather than guessing. Perfect retrieval is local exactness; it lives in the compiled object, never the sampler. Improving the system means appending sections that keep R = 1, never destructively overwriting a cemented one.

The recursion is the prettiest part. The coherence reading of one level is itself a value; register it as a section one site up, and the OS observing its own gluing has risen one doll OUT. Two levels are constructed; the infinite tower — a sheaf of sheaves — is the shape.

honest calibration

Stating the open joints is the point. The structure earns its grand unification one glued section at a time, not by assuming it.

read the source