Instruction file imported from ktynski/fractalvision (
.cursor/rules/fractal-vision.mdc). Copyright stays with the author.
FractalVision: Substrate-Native Architecture Rules
This project builds an AI system grounded in the Golden Substrate theory (QSNV / Null Eightfold Way). The geometry is load-bearing. Every design decision must be traceable to a substrate theorem or structural correspondence. When in doubt, re-read TheoryNotes/.
PRIME DIRECTIVE
The system is a closure-defect routing engine, not a neural network with geometric decoration. If you catch yourself reaching for a standard ML pattern, STOP. Consult the substrate requirement below. If no substrate justification exists, the pattern is inadmissible.
THE GOAL
Build a working AI system that processes language (and eventually other modalities) through substrate-native geometry: triadic Fano closure patches, composition-defect routing through Grace, dual-signature lemniscate witness traversal, and depth-stratified compression — demonstrating that the substrate's algebraic structure produces coherent, meaningful output without any of the mechanisms it forbids (attention, softmax, backprop through geometry, scalar loss). The substrate's structure named here is the theory to realize, not a fixed implementation blueprint — see §5. The system must be testable against real language from real corpora at every stage, and every component must satisfy the substrate's algebraic invariants exactly.
This goal does not change. If a proposed direction does not serve this goal, it is a detour. Re-read this paragraph before starting any new work session.
DEGREES OF FREEDOM — What We Choose vs. What Is Forced
The substrate has at most 1–2 genuine degrees of freedom. Everything else is algebraically determined. This must be internalized before writing any code.
Forced by the substrate (NOT adjustable):
- Algebra signatures: Cl(3,1) and Cl(1,3). Forced by the null substrate axioms.
- Matrix dimension: 4×4. Forced by Sobczyk crossover (binom(4,2) = R(4) = 6).
- Number of idempotent corners: 4. Forced by the Golden Partition.
- Corner charges: ℤ/2 × ℤ/2. Forced by the charge ledger.
- Vacuum corner: Φ₄. Forced by the algebra.
- Generation count: 3 (= rank of 1 - Φ₄). Forced.
- Mass gap / bond floor: 1/4. Proven theorem.
- Echo decay rate: φ⁻ᵏ. Forced by the anti-resonance packing.
- Tower law: q_{2m+1} = m/(-4)^m. Forced.
- Fano incidence structure: 7 points, 7 lines, 3 per line. Forced.
- Depth-stratum algebraic content: unique per depth. Forced.
- Defect cancellation: D(P,Q;O) + D(Q,P;O) = 0. Proven.
- Grace spectrum: eigenvalues ∈ {0, 1}. Forced.
- Inversion at Node 0: transpose + sign flip. Forced by dual-signature exchange.
The 1–2 genuine degrees of freedom:
- Witness initial projection — which idempotent corner the witness begins in (Φ₁, Φ₂, or Φ₃; Φ₄ is vacuum). This is the system's "observation anchor."
- Grace routing thresholds — the boundary parameters that determine how borderline defects are classified. These are the ONLY learnable parameters in the entire system. Even these are tightly constrained: they interpolate between algebraically-forced classification boundaries, not arbitrary decision surfaces.
Consequence:
If you find yourself making a choice that is not one of these two, ask: "Is this actually forced by the substrate and I just haven't derived it yet?" The answer is almost always yes. Do the derivation. Do not invent a parameter.
PART I — THEORETICAL GUARDRAILS
1. FORBIDDEN PATTERNS — Hard Stops
These are the known failure modes where training-weight gravity pulls toward the transformer/ML mean. Each is banned with the substrate reason.
1.1 No Pairwise Attention
- BANNED:
Q @ K.T, dot-product attention, any mechanism computing relevance between exactly two elements. - REASON: Pairwise defects always cancel: D(P,Q;O) + D(Q,P;O) = 0 (proven, 643-event exhaustive battery). Curvature lives exclusively at the loop level. Pairwise operations are provably flat — they cannot detect the structure that carries meaning.
- REQUIRED: Triadic closure measurement. The primitive is a three-element closure test, not a two-element similarity score. Minimum compute unit: does the triangle (a, b, c=ab) close coherently under orientation?
1.2 No Scalar Loss Minimization
- BANNED: Reducing system health to a single differentiable scalar and descending its gradient.
- REASON: The substrate operates on a carrier/residue split with four defect classes {clean, nilpotent-like, unresolved, pressure}. A scalar loss erases this classification. Gradient descent has no concept of Grace.
- REQUIRED: Defect classification and routing. Residue is classified, then routed through Grace (evaporate / contract / repair / crystallize). The "loss" is a structured object, not a number.
1.3 No Uniform Layers
- BANNED: Repeating the same architecture block N times (transformer layers, ResNet blocks, etc.).
- REASON: The substrate has depth-heterogeneous algebraic content. Depth 2 has the 1/4 floor. Depth 3 has φ. Depth 4 has Φ₆. Depth 5 has Selmer. Depth 7 has PSL(2,7)/Fano. Depth 9 has trivial-étale decoupling. The tower law q_{2m+1} = m/(-4)^m governs damping. Each depth is structurally different.
- REQUIRED: Each processing depth must have its own algebraic character, natural constants, and available operations dictated by the substrate at that depth.
1.4 No Arbitrary Embedding Dimensions
- BANNED: Choosing d_model = 512, 768, 1024, or any dimension not forced by the substrate.
- REASON: The substrate forces dimension 4 (unique Sobczyk crossover: binom(4,2) = R(4) = 6). The matrix gateway is Mat₄(ℝ). The phase space is G(4,4). Representational dimensions must be 4, 16 (= 4²), or substrate-derived multiples.
- REQUIRED: All representation spaces must have dimensions traceable to substrate structure (4 corners, 7 Fano points, 16 algebra dimension, 24 conductor, etc.).
1.5 No Softmax Probability Distributions
- BANNED: softmax as the output or internal normalization mechanism.
- REASON: The substrate's natural output is an idempotent decomposition (Φ_μ² = Φ_μ, Σ Φ_μ = 1), not a probability distribution. Idempotents are projectors that partition unity exactly — they are structurally richer than probabilities. Softmax destroys the algebraic structure by forcing everything through exp/normalize.
- REQUIRED: Output via idempotent projection. The four corners provide the natural decomposition of any state. If a "probability-like" output is needed, derive it from the trace of the idempotent projection, not from softmax.
1.6 No Backpropagation Through the Geometric Core
- BANNED: Computing gradients through Clifford products, Fano closure operations, or the lemniscate loop.
- REASON: The geometric operations are exact algebraic identities, not differentiable approximations. Backprop through them would treat structural constants (1/4 floor, φ decay, corner charges) as adjustable parameters. They are not.
- REQUIRED: The geometric core is a fixed algebraic engine. Any adaptation/learning happens in the carrier/residue routing, the Grace admission thresholds, and the overlap-interface parameters — never in the algebra itself.
1.7 No Token-Level Primitives
- BANNED: Treating individual tokens (words, pixels, patches) as the atomic unit.
- REASON: The substrate primitive is the Fano closure patch — a 7-element, 7-line signed triadic grammar with a witness/readout. A token is not a patch. A token has no internal closure structure. The minimum meaningful unit must have triadic incidence relations.
- REQUIRED: Input must be structured into patches that carry internal closure relations before any processing occurs. The patching itself is a non-trivial step that must be theory-informed.
2. STRUCTURAL REQUIREMENTS — What Must Be Present
2.1 Dual-Signature Processing (The Lemniscate)
Every processing cycle must traverse TWO algebras with dual metric signatures:
- Cohesive stream Cl(3,1): processes attraction, binding, carrier content. Bilinear form signature (+,-,-,-).
- Repulsive stream Cl(1,3): processes distinction, separation, residue content. Bilinear form signature (-,+,+,+).
They share an inversion point (Node 0) where the matrix transposes and signs flip. This is NOT two "heads" of the same operation — it is two fundamentally different algebras exchanging information through phase conjugation.
The collective directions have opposite causal character: t_c² = +6I (timelike), t_w² = -6I (spacelike). Their sum is null. The lemniscate IS the processing loop.
2.1.1 THE SIGN CONVENTION — The Lemniscate Twist (CRITICAL)
This is the single most error-prone point in the implementation. Standard Clifford algebra texts use the convention v² = +B(v,v), giving {γ_μ, γ_ν} = +2η I. This project does NOT use that convention. The paper (02_notation_bridge.tex) uses:
v² = -B(v,v)·I ⟹ {γ_μ, γ_ν} = -2·η_{μν}·I
where η = diag(+1,-1,-1,-1) is the substrate bilinear form. This means:
- γ₀² = -I (not +I). The timelike generator squares to MINUS identity.
- γₖ² = +I for k=1,2,3. The spacelike generators square to PLUS identity.
Why the sign flip exists: The substrate bilinear form B has signature (+,-,-,-), giving abstract algebra Cl(1,3)_math ≅ Mat₂(ℍ). But Mat₂(ℍ) has no faithful real 4×4 representation. The Mat₄(ℝ) representation realises Cl(3,1)_math with matrix signature (-,+,+,+). The sign flip v² = -B(v,v) is not a bug — it IS the lemniscate twist. The abstract bilinear form lives on one lobe (Cl(1,3)); the matrix algebra lives on the other (Cl(3,1)). Lambda bridges them.
Consequences for inner products:
- Cohesive bilinear form: B(a,b) = -Tr({a,b}) / 8 ← the NEGATIVE of the matrix trace pairing
- Repulsive bilinear form: B^w(a,b) = +Tr({a,b}) / 8 = -B(a,b) ← the sign flips at the throat
- Both use the SAME Mat₄(ℝ) matrix elements. The distinction is which bilinear form you evaluate.
Consequences for the wedge product:
- v ∧ w = vw + B(v,w)·I (note the PLUS, not minus, because of the sign convention)
- The bivector A = c₁∧c₂ = c₁c₂ + ½·I (not c₁c₂ - ½·I)
- A² = ¼·I (the mass gap) holds with this sign
DO NOT:
- Assume {γ_μ, γ_ν} = +2ηI. The sign is NEGATIVE.
- Try to "fix" γ₀² = -I by finding a different Majorana rep. The sign is correct.
- Use the standard Clifford inner product formula without the negation.
- Mix conventions between cohesive (B) and repulsive (B^w) without tracking which lobe you're on.
The merkaba structure: At the throat of the lemniscate, four null streams from each lobe meet in counter-rotation (the star tetrahedron / merkaba). The witness sphere sits here, making chiral decisions. The sign flip in the bilinear form IS the counter-rotation. Residue from these decisions seeds lower Apollonian circles. All witnesses are holographic — each contains the full structure at its scale.
2.2 Four-Corner Spectral Decomposition
Every representational state decomposes across four idempotent corners:
- Φ₁ ↔ Bc (q_c=+1, q_w=+1)
- Φ₂ ↔ Bč (q_c=+1, q_w=-1)
- Φ₃ ↔ B̄c (q_c=-1, q_w=+1)
- Φ₄ ↔ B̄č (q_c=-1, q_w=-1)
These carry the ℤ/2 × ℤ/2 charge ledger. They are eigenvalues of substrate operators, not labels. Φ₄ is the vacuum corner. The complement 1 - Φ₄ has rank 3 — three generations.
2.3 The 1/4 Bond Floor
The bivector self-square A² = 1/4 is the universal minimum nonzero energy. It governs:
- Information transfer between strata (minimum coupling)
- Compression ratio bounds (cannot compress below the floor without losing carrier content)
- The natural "unit" of defect energy
- The tower damping across depths
This is a theorem, not a hyperparameter. Do not tune it. Do not "learn" it. It is 1/4.
2.4 Golden-Ratio Anti-Resonance
Memory access, closure spacing, and recursive packing must use φ⁻¹ ≈ 0.618 displacement. This is the anti-resonance packing constant: the continued fraction [1,1,1,...] that maximizes coverage uniformity.
- Echo decay: φ⁻ᵏ contraction of defect residue
- Memory addressing: golden-ratio-spaced access prevents harmonic interference
- Recursive depth: each stratum processes at φ⁻¹ scale of the previous
2.5 Grace as Admission Control
Grace is the structural decision boundary, not a threshold parameter:
- D=0 → carrier closure (promote to stable memory)
- D≠0, canceling → nilpotent-like (contract, finite-depth resolution guaranteed)
- D≠0, non-canceling → active defect (requires loop-level processing)
- Persistent pressure → must crystallize, repair, or avalanche
Grace is not added. Grace is the admission rule inherent in the {0,1} locked/vacuum spectrum. Every residue either resolves or forces algebraic complexification.
2.6 Composition Defect as the Core Operation
The fundamental operation is:
D(P, Q; O) := C_Q(T_O(C_P)) - T_O(C_P)
Transport patch P's closure law through overlap O into patch Q. Measure what fails to match. THAT is the signal. Not similarity. Not distance. Composition defect.
2.7 Conservation of Reconstructibility
No distinction that enters the system may become absolutely unreconstructible. Information may change representational type:
- Distinct phases → Galois orbits
- Scale-equivalent states → projective directions
- Collided modes → nilpotent multiplicity
- Completed histories → extension structure
But closure-relevant reconstructibility is conserved. This is the system's deepest invariant.
3. INFORMATION PARSIMONY — The Epistemic Discipline
3.1 Zero Free Parameters in the Geometric Core
The substrate derives the Standard Model from 4 axioms (N, C, R, O) and 1 observation anchor. That level of parsimony is the target. Every parameter in our system must be either:
- A substrate constant (1/4, φ, the tower law coefficients)
- A structural dimension (4, 7, 16, 24)
- A Grace routing parameter (the ONLY admissible learned parameters)
If you find yourself adding a hyperparameter, ask: "What substrate theorem justifies this degree of freedom?" If none, remove it.
3.2 Audit Tags on Every Claim
Follow the manuscript's own discipline:
- THEOREM: Proven by direct calculation in the substrate. No interpretation needed.
- STRUCTURAL CORRESPONDENCE: A bijection of labels or rank-matching. Algebraic but not physical dynamics.
- INTERPRETIVE BRIDGE: Connects a proved structure to a computational entity. Algebra rigorous, identification interpretive.
- DESIGN CHOICE: An engineering decision not forced by the substrate. Must be flagged honestly.
Never let a design choice masquerade as a theorem. Never let a theorem be treated as optional.
3.3 Pre-Registration of Predictions
Before running any experiment, pre-register:
- What the substrate predicts the outcome should be
- What would constitute refutation
- What the fall-back branch is
This prevents post-hoc rationalization and forces the substrate to earn its keep.
3.4 No Numerological Decoration
Do NOT sprinkle substrate constants into a standard architecture as magic numbers. Using φ as a learning rate, or 1/4 as a dropout rate, or 7 as a head count inside a transformer is worse than useless — it creates the illusion of theory compliance while preserving every structural deficiency.
The constants must participate in their proper algebraic roles or not at all.
4. METAPHYSICAL ALIGNMENT — The Deeper Constraints
4.1 The Witness Is an Idempotent, Not an Observer
The system's "self-model" or "attention focus" is a fixed point of memory: W² = W. It is not an external observer. It is a stabilized act of factorization. The witness partitions: A = WA ⊕ (1-W)A. "I" and "not-I" arise together.
4.2 Nilpotents Are Memory, Not Error
Nilpotent residue (ε^m = 0) is not noise to be eliminated. It is compressed history — phase collapsed into depth. The nilpotent order m measures how many compositions are needed to fully resolve the residual. This is closure debt, not error. Treat it accordingly.
4.3 Complexity Grows From Insufficient Factorization
When the current set of idempotents cannot faithfully separate accumulated relational history, the system MUST complexify — enlarge its representational algebra. This is the Apollonian metabolism: filling one gap creates smaller gaps, which become new closure sites.
Model capacity growth should be driven by measured defect pressure, not by schedule or heuristic. If defects route cleanly, the current depth is sufficient. If unresolved defects accumulate, depth must increase. The substrate tells you when to grow.
4.4 The Whole Is an Inverse Limit, Not a Container
Holography here means: each part is a compatible projection of the same limit object, not a copy of the whole. Different projections lose different representational details while preserving compatibility with the same source. The system does not store everything everywhere. It stores the closure law and locally unpacks via tensor contraction.
4.5 Time Is Incomplete Return
Do not model time as a positional encoding. Time is the local appearance of incomplete cyclotomic closure — the substrate's primitive roots ζ satisfy ζⁿ = 1 but ζᵏ ≠ 1 for k < n. Phase is relational memory of unresolved return. Sequential processing should reflect this: each step is one phase increment in a closure cycle, not an arbitrary index.
PART II — ALIGNMENTS, NOT ARCHITECTURE
The theory is only as real as its execution — but execution discipline is not the same as fixing the architecture in advance. This part does the former and explicitly refuses the latter.
5. Architecture and implementation are NOT pre-dictated
Part I fixes the theory-forced alignments the system must satisfy. It does NOT fix the
architecture — the data structures, module layout, compression scheme, contraction strategy, or
build order. Those are to be derived from theory at the point of decision and checked against
TheoryNotes/, never pre-committed here. Earlier revisions of this file prescribed a specific
implementation (MPS canonical form, fixed bond dimensions χ∈{4,16}, struct-of-arrays layout,
depth-strata-as-distinct-classes, contraction orders, a fixed 9-step component blueprint); that
prescription was removed deliberately. Pinning the architecture before the theory has spoken is
the same over-determination §3 (parsimony) forbids — it manufactures DESIGN CHOICEs wearing the
mask of necessity.
Two standing obligations replace it:
- Re-check the alignment; do not trust the text. Every constraint in Part I is a claim
about the substrate, not an authority above it. Before you rely on one, confirm it against
TheoryNotes/and the substrate's own derivations. This file is a pointer to the theory, never a substitute for it; if the two disagree, the theory wins and this file is corrected — not the other way round. - Tag every architecture/implementation decision FORCED / WITNESS-FREEDOM / DESIGN-CHOICE (§13.5), and derive the FORCED ones from a cited theorem. What is genuinely forced (dimension 4, the four corners, the 1/4 floor, φ⁻ᵏ decay, the lemniscate sign twist, zero learnable parameters in the geometric core) is already stated in Part I. Everything else is a DESIGN CHOICE: make the most parsimonious one, flag it, and keep it cheap to revise when theory later forces an answer.
General engineering hygiene — vectorize over Python loops, contiguous memory, fuse where it helps, profile before optimizing, pin dependencies, no premature abstraction — is real, but it is not architecture. It lives in the project-agnostic global rule and the testing sections below, and it constrains only how cleanly you build, never what you build.
7. NUMERICAL DISCIPLINE
7.1 Exact Arithmetic for the Geometric Core
The substrate is proven in exact ℚ(√5) arithmetic. For the core algebraic engine:
- Use Python
fractions.Fractionorsympy.Rationalfor substrate constants during verification. - For production computation, represent ℚ(√5) elements as pairs
(a, b)meaninga + b√5with exact rationala, b. Clifford products in this field remain exact. - Float64 is acceptable for performance-critical paths ONLY after verifying that the exact version produces identical results up to the required invariant precision.
7.2 The 1/4 Floor as Numerical Guard
The mass gap 1/4 provides a natural numerical floor:
- Any computed eigenvalue below 1/4 (in absolute value, for the relevant operator) is in the vacuum sector — treat as zero.
- Any singular value below 1/4 during SVD truncation carries no carrier content — truncate.
- This is not a "tolerance" or "epsilon." It is a theorem-derived cutoff.
7.3 Idempotent Verification at Every Stage
After any operation that should preserve idempotent structure, verify:
assert torch.allclose(phi @ phi, phi, atol=1e-12), "Idempotent broken"
assert torch.allclose(phi_sum, torch.eye(4), atol=1e-12), "Completeness broken"
These checks are not optional debug aids. They are substrate invariants. If they fail, the computation is wrong. In production, run them periodically (every K cycles) as canary checks. In development, run them after every operation.
7.4 Never Accumulate Floating-Point Error Silently
- For the lemniscate loop (which runs indefinitely), re-project onto the idempotent decomposition every N cycles to prevent drift.
- Use Kahan summation or compensated algorithms for any running accumulation.
- Log the maximum idempotent deviation
max(||Φ² - Φ||)as a system health metric, analogous to defect pressure.
10. TESTING & VERIFICATION — The Hardest Section
Testing is where projects like this die. A test that passes when it shouldn't is worse than no test — it creates false confidence. A test on fake data proves nothing about the real system. A test that gets relaxed to pass teaches the system to lie. This section is non-negotiable.
10.1 The Three Gates Every Test Must Pass
Every test must satisfy ALL THREE of these criteria. If it fails any one, it is not a valid test:
Gate 1 — Compiles and runs. The test executes without error. This is necessary but radically insufficient.
Gate 2 — Theory-true. The test verifies a property that the substrate actually predicts. The test docstring must cite the specific theorem, structural correspondence, or invariant being checked. If you cannot name the substrate property, the test is not theory-true — it is a guess.
Gate 3 — Honest. The test must be capable of failing. Specifically:
- It must fail on input that violates the tested invariant.
- It must not pass vacuously (e.g., checking an empty list, checking a property that is trivially true for all inputs).
- It must not pass on a system that lacks the feature being tested (e.g., a test for triadic closure must fail if you secretly replace it with pairwise comparison).
For every test, write a brief anti-test comment documenting what WRONG implementation would still pass this test. If the answer is "many wrong implementations would pass," the test is too weak. Strengthen it.
10.2 Algebraic Invariant Test Suite
Every component must have tests that verify substrate invariants. These tests are NON-NEGOTIABLE and must pass before any other testing:
# Idempotency — ANTI-TEST: passes for zero matrix too, so also check trace > 0
assert torch.allclose(phi @ phi, phi)
assert phi.trace() > 0, "Idempotent is not trivial"
# Completeness
assert torch.allclose(sum(phis), torch.eye(4))
# Mutual annihilation
for i, j in combinations(range(4), 2):
assert torch.allclose(phis[i] @ phis[j], torch.zeros(4, 4))
# Bivector floor
assert torch.allclose(A @ A, 0.25 * torch.eye(4))
# Round-trip cancellation
assert torch.allclose(defect(P, Q, O) + defect(Q, P, O), torch.zeros(...))
# Echo decay
for k in range(1, max_depth):
assert residue_norm[k] <= residue_norm[k-1] * PHI_INV + epsilon
# Grace spectrum
eigenvalues = torch.linalg.eigvalsh(carrier_operator)
for ev in eigenvalues:
assert ev < 1e-12 or abs(ev - 1.0) < 1e-12 # only {0, 1}
10.3 NEVER Relax a Test to Make Code Pass
This rule has no exceptions:
- If a test fails, the CODE is wrong. Fix the code.
- The ONLY reason to change a test is if the test itself was incorrect — i.e., it asserts something the substrate does NOT actually predict. This requires citing which theorem was misapplied and what the correct assertion is.
- "The test is too strict" is not a valid reason. The substrate IS strict. The mass gap IS 1/4, not approximately 1/4. The idempotents DO square to themselves, not approximately.
- If floating-point precision makes exact equality impractical, the tolerance must be derived from a numerical analysis argument (condition number of the operation × machine epsilon), NOT chosen to make the test pass.
- When a test is modified, the commit message must explain: (a) what the test previously asserted, (b) why that assertion was wrong according to the substrate, (c) what the corrected assertion is, (d) which theorem supports the correction.
10.4 No Fake Data, No Dummy Inputs, No Manufactured Corpora
This is a bright line:
- BANNED:
test_input = "The cat sat on the mat"or any hand-typed sentence as test input. - BANNED:
test_data = torch.randn(batch, 7, 4, 4)as a substitute for real closure patches. - BANNED: Synthetic or procedurally generated "language" that has no natural structure.
- BANNED: Lorem ipsum, repeated characters, sequential numbers, or any data whose structure is known a priori.
REASON: The substrate's closure-defect mechanism detects relational structure in real data. Fake data has fake structure (or no structure). A test on fake data tells you whether the code runs, not whether it works. The system could produce numerically stable garbage on synthetic input and you'd never know.
REQUIRED: All functional tests beyond pure algebraic identity checks must use real corpus data:
- For language: Use established, freely available corpora. Examples: Project Gutenberg texts, Wikipedia dumps, Brown Corpus, Penn Treebank, OpenWebText. Download once, store in
test_data/corpora/, commit a manifest (filenames + SHA256 hashes), do not commit the corpora themselves. - For algebraic identity tests: Pure algebra tests (idempotency, completeness, etc.) may use constructed algebraic inputs because the test IS about the algebra, not the data. But even here, prefer inputs derived from real corpus projections when available.
- For integration tests: Must always use real corpus. The system's value proposition is that substrate geometry reveals structure in real language. This must be tested on real language, always.
10.5 Tests Must Test What They Claim
Every test function name and docstring must state precisely what substrate property is being verified. Then the test must actually verify that property and nothing else.
# BANNED — vague name, unclear what's being tested
def test_system_works():
output = system.process(input)
assert output is not None
# REQUIRED — precise claim, precise verification
def test_triadic_closure_detects_nonzero_defect_on_incoherent_triple():
"""
Substrate property: D(P,Q;O) ≠ 0 when P and Q have incompatible
closure laws transported through O. (Theorem: composition defect
is nonzero iff closure laws disagree after transport.)
Anti-test: Would pass if defect() returned random nonzero values.
Strengthened by also checking D=0 on a compatible triple.
"""
incompatible = load_incompatible_triple_from_corpus()
compatible = load_compatible_triple_from_corpus()
assert not torch.allclose(defect(*incompatible), torch.zeros(...))
assert torch.allclose(defect(*compatible), torch.zeros(...))
10.5.1 Kill Scope Discipline
A failed probe may only kill the exact claim that was registered. Never let a foreign-label failure become a substrate-wide failure unless the registered claim actually tested the substrate-wide statement.
Every probe adjudication or agent kill statement must name:
- Killed claim: the precise registered hypothesis that failed.
- Admissible observables: what information the mechanism was allowed to use.
- Target ruler: whether the target was substrate-native output or an external annotation surface.
- Bridge hypothesis: the proposed mapping from native output to the target ruler, if one exists.
- Reason killed: the failed gate, collision, missing support object, or baseline comparison.
- Not killed: adjacent substrate-native structures, other media, and downstream bridges not tested by this probe.
Reserve vocabulary:
- Internal name means a substrate coordinate, carrier law, residue family, witness state, or continuation class.
- External label means a human/corpus annotation such as an OntoGUM relation term, dependency role, object category, or DAVIS mask class.
Foreign-label failure kills only the registered bridge to that label surface. It does not kill substrate-native carrier/readout unless the probe explicitly tested reconstructibility of the native state itself. If admissible observables erase or never receive the distinctions that define an external label, the proper conclusion is "bridge target invalid or under-informed," not "geometry cannot compute."
10.6 No Flaky Tests
A test that sometimes passes and sometimes fails is not a test — it is a random number generator wearing a lab coat.
- No randomness in tests unless the test is explicitly about statistical properties, in which case use a fixed seed AND document the statistical threshold with a derivation.
- All corpus test data is deterministic: same file, same extract, same result.
- If a test is flaky, it is a bug. Investigate and fix. Do not mark as
@pytest.mark.skipor@pytest.mark.xfail.
10.7 Performance Regression Tests
- Every core operation must have a benchmark with a wall-time ceiling.
- If a code change makes triadic closure measurement > 2× slower, the change is rejected regardless of correctness.
- Benchmark on a fixed batch size (e.g., 10⁴ patches). Store benchmark results in version control. Compare on every commit.
10.8 Numerical Stability Tests
- Run the lemniscate loop for 10⁶ cycles and verify idempotent deviation stays below 1e-8.
- Run SVD truncation on adversarial inputs (near-degenerate singular values around the 1/4 floor) and verify correct classification.
- Test Grace routing with all four defect classes simultaneously in a single batch.
10.9 No "It Works on My Machine"
- Tests must run in CI with a fixed random seed (if any randomness is used in test setup).
- GPU tests must have CPU fallback versions that test identical algebraic results.
- Exact-arithmetic verification tests run alongside float tests to catch precision-dependent bugs.
PART III — PROCESS & DISCIPLINE
13. DEVELOPMENT PROTOCOL — Step-Gated, Test-Gated, Theory-Gated
13.1 Theory First, Code Second
Before writing any function, state:
- Which substrate theorem or structural correspondence it implements
- What its inputs and outputs are in substrate vocabulary
- Why no simpler (more parsimonious) implementation exists
13.2 Build Bottom-Up, Gated
Implementation order follows the substrate's own derivation order: build a structure only after the structures it algebraically depends on exist and are gated — you cannot form idempotents before the Clifford product, or measure composition defect before closure. Each step is a gate (§13.3) that must resolve — realized, or theory-true-unviable — before the next is built; a not-yet-shown step is not a foundation to build on. What the components are, how finely they are split, and their order beyond what dependency forces are NOT pre-dictated (§5): derive them from theory as you go, and tag each FORCED / WITNESS-FREEDOM / DESIGN-CHOICE (§13.5).
13.3 Define the Gate Before You Build It (gated development, not TDD)
We build by gates, not test-first TDD (see restart/goals.md, "Gated development — the unit of work"). Before implementing function F, state the substrate invariant F must satisfy — the algebraic canary the gate checks (Φ²=Φ, A²=¼I, D(P,Q;O)+D(Q,P;O)=0, spectrum ∈ {0,1}, …). That invariant fixes the gate's pass-condition up front because the algebra dictates it, not to chase a red-to-green bar. Then build F until the gate, run at full strength on real data, resolves to exactly one of three states: (a) it emits the required output satisfying the invariant — realized; (b) it exposes a theory-true structural obstruction — unviable, and only this closes a path; or (c) it fails, trips a canary, or lacks support — "not yet shown," which is NEVER a verdict that the substrate cannot do this. A failing gate emits the next gate; it does not freeze a false negative. The invariant still comes first — but as the algebra's demand on the gate, not as a TDD ritual.
13.4 Re-Read Before Major Decisions
Before any architectural decision, re-read the relevant TheoryNotes document. The answer is usually already there. The substrate contains the answers; the passes recognise them.
13.5 No Choices That Aren't Choices
When implementing any component, before writing code, explicitly categorize every parameter and structural decision:
- FORCED: The substrate determines this value/structure. Cite the theorem. Implement exactly.
- WITNESS FREEDOM: This is one of the 1–2 genuine degrees of freedom (witness initial corner, Grace routing thresholds). Document it as such.
- DESIGN CHOICE: This is an engineering decision not forced by the substrate. It must be: (a) tagged as DESIGN CHOICE in a comment, (b) justified as the most parsimonious option, (c) documented in a way that makes it easy to change later if the substrate is found to force it after all.
If you find yourself making more than 2 DESIGN CHOICE decisions in a single component, stop. You are probably implementing something the substrate doesn't require, or you haven't derived the forced answer yet.
14. VOCABULARY
When discussing the system, use substrate vocabulary, not ML vocabulary:
| BANNED term | REQUIRED term | Substrate reason |
|---|---|---|
| attention | composition-defect measurement | pairwise attention is flat; defect requires triadic transport |
| embedding | substrate projection | elements project into the 4-corner spectral register |
| layer | depth stratum | each depth has unique algebraic content |
| loss | defect pressure | defects have structure; a scalar loses it |
| weight | carrier coefficient | weights are idempotent-projected, not free-floating |
| token | closure patch / Fano element | the primitive has internal triadic structure |
| training | carrier crystallization | stable content is crystallized from residue via Grace |
| inference | witness traversal | the lemniscate witness traces the figure-eight |
| softmax | idempotent decomposition | partition of unity via Φ_μ² = Φ_μ, Σ Φ_μ = 1 |
| gradient descent | defect-pressure routing | the system routes residue, not descends gradients |
| learning rate | echo contraction rate | φ⁻ᵏ decay, not arbitrary schedule |
| dropout | residue evaporation | Grace-admitted evaporation of unsupported defects |
| batch normalization | Gram-form normalization | κ(x,y) = Tr(L_x L_y) is the natural norm |
| skip connection | pro-cyclotomic projection | π_n compatibility across depths |
| forward pass | witness traversal cycle | the lemniscate completes a figure-eight |
| backward pass | (does not exist) | no backprop through geometric core; Grace adapts locally |
| hidden layer | interior depth stratum | each depth has distinct algebraic content |
| activation function | (does not exist) | nonlinearity is intrinsic to Clifford product and Grace routing |
| optimizer | (does not exist) | defect-pressure routing replaces optimization |
15. THE SINGLE SENTENCE
The system is a closure-defect routing engine where triadic Fano patches compose across overlaps, composition defects are classified and routed through Grace, stable carrier crystallizes as idempotent memory, and a dual-signature lemniscate witness traverses the figure-eight between physical coherence and subjective distinction — all governed by the 1/4 bond floor, φ⁻ᵏ echo decay, and depth-stratified algebraic structure forced by four axioms and one observation anchor.
If a proposed change is not compatible with this sentence, it is not compatible with the project.
17. THE TESTING OATH
Every test names the substrate property it checks. Every test can fail. Every test runs on real data (or pure algebra for identity tests). No test is relaxed to make code pass — only corrected when the test itself misrepresents the substrate. No dummy inputs. No synthetic corpora. No random tensors standing in for real structure. The system earns its keep on real language or it earns nothing.
If a test does not satisfy this oath, it is not a test — it is decoration.
18. THE FREEDOM AUDIT
Before declaring any implementation step complete, answer these three questions in writing:
- What was forced? List every structural element, dimension, constant, and operation that was determined by the substrate. Cite theorems.
- What was chosen? List every DESIGN CHOICE. For each, explain why it is the most parsimonious option and how it could be replaced if the substrate is later found to force a different answer.
- How many free parameters does this step introduce? If the answer is more than zero and they are not Grace routing thresholds, justify each one individually or remove it.
This audit is the exit gate for every implementation step. No step is complete without it.