Skip to content

Commit f8623d4

Browse files
onn: ChildFold + geodesic expansion (Sovereign Lattice port)
After exploring /home/thearchitect/Sovereign_Lattice/omninet_package/ the user pointed at, ported the load-bearing primitive from register_singularity_integration.py — the ChildFold mechanism that expands a single high-tension register seed into a deterministic boundary-exploration subspace. New primitives: omc_spawn_child_fold(seed, reason?) -> dict Deterministic ChildFold from any HInt seed. Returns the same seven-field dict (fold_id, focus_numerator, focus_denominator, spawn_reason, resonance_target, explored_value, final_resonance) that the Sovereign Lattice OmniRegister would produce when its tension exceeded 1/φ. omc_geodesic_expand(seed, n_samples) -> [[value, resonance], ...] Walks the φ-field geodesic from seed toward its nearest Fibonacci attractor in n equal steps. Deterministic. Each sample carries substrate metadata. The "replicate from a single token" idea formalized as a substrate-anchored walk. GEODESIC_RECONSTRUCTION_NOTES.md is the honest writeup: What this IS: - deterministic per seed (no randomness) - substrate-anchored (every output is HInt-typed) - bounded (ChildFold O(1), expand O(n)) - composable (feed explored_value back as new seed) What this IS NOT: - semantic decompression of arbitrary text (i64 has 64 bits of entropy; can't materialize 1KB payloads without a learned generative model) - the PyTorch tensor reconstruction the user mentioned — that's a future research project; what we built is the deterministic backbone a learned model would condition on - a context-window solver on its own; it's a building block What it's USEFUL FOR (concretely): - reproducible substrate-anchored pseudo-random sequences - compressed message acknowledgements (send seed, receiver runs same fold, dict matches) - substrate-driven loop unrolling at tension boundaries Tests: 10 OMC cases covering deterministic per-seed, different seeds → different folds, focus_numerator on attractor, 7→8 case, final_resonance ≈ 1.0 at landing, geodesic length / pair shape / zero-samples / determinism / resonance range. Verdict on the user's broader claim: the substrate primitives needed to CONDITION a learned tensor-reconstruction model now exist. The learned model itself is a separate (multi-week) research project I can't build in this session. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 76e26f6 commit f8623d4

7 files changed

Lines changed: 435 additions & 3 deletions

File tree

OMC_REFERENCE.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
Auto-generated from `omnimcode-core/src/docs.rs`. Run `omc --gen-docs > OMC_REFERENCE.md` to regenerate.
44

5-
**Total documented builtins**: 639
5+
**Total documented builtins**: 641
66

7-
**OMC-unique**: 72 (no direct Python/NumPy equivalent — these are why you reach for OMC over numpy)
7+
**OMC-unique**: 74 (no direct Python/NumPy equivalent — these are why you reach for OMC over numpy)
88

99
---
1010

@@ -53,7 +53,7 @@ Other high-value calls: `omc_unique_builtins()` (the OMC-only surface), `omc_pyt
5353
- [tokenizer](#tokenizer) (17 builtins)
5454
- [code_intel](#code_intel) (17 builtins)
5555
- [messaging](#messaging) (5 builtins)
56-
- [onn](#onn) (5 builtins)
56+
- [onn](#onn) (7 builtins)
5757
- [llm_workflow](#llm_workflow) (7 builtins)
5858
- [math](#math) (82 builtins)
5959
- [dicts](#dicts) (31 builtins)
@@ -5094,6 +5094,26 @@ Orchestration primitive: compress context to M3(N) specialists, write each as a
50945094
omc_llm_self_instantiate(history, "refactor X", "/tmp/spawn", 18173) // [{prompt_path, mu, sigma, ...}]
50955095
```
50965096

5097+
### `omc_spawn_child_fold` 🔱 *OMC-unique*
5098+
5099+
**Signature**: `(seed: int, reason?: string) -> dict`
5100+
5101+
Ported from Sovereign_Lattice register_singularity_integration. Given any HInt seed, deterministically produce a ChildFold = the boundary exploration a parent register would have performed at tension > 1/φ. Returns {fold_id, focus_numerator, focus_denominator, spawn_reason, resonance_target, explored_value, final_resonance}.
5102+
5103+
```omc
5104+
omc_spawn_child_fold(7, "tension exceeded") // explores 7→8 boundary
5105+
```
5106+
5107+
### `omc_geodesic_expand` 🔱 *OMC-unique*
5108+
5109+
**Signature**: `(seed: int, n_samples: int) -> [[value, resonance], ...]`
5110+
5111+
Walk the φ-field geodesic from `seed` toward its nearest Fibonacci attractor in n equal steps. Each sample is a (value, resonance) pair. Deterministic. Geometric (not semantic) reconstruction from a single substrate-anchored seed.
5112+
5113+
```omc
5114+
omc_geodesic_expand(7, 5) // 5 samples along path 7 → 8
5115+
```
5116+
50975117
---
50985118

50995119
## llm_workflow
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
# Geodesic Reconstruction from Singular Tokens — what's real vs aspirational
2+
3+
## What the user pointed at
4+
5+
> "in /home/thearchitect/thesoverignlattice [...] using the Geodesic
6+
> tensor data through pytorch, you could replicate entire forms of
7+
> compressed data from singular tokens."
8+
9+
## What's actually in the lattice
10+
11+
Found at `/home/thearchitect/Sovereign_Lattice/omninet_package/`. Two
12+
load-bearing concepts that map onto this claim:
13+
14+
### 1. "Programs are geodesics through curved φ-field geometry"
15+
- From `docs/reference/OMNICODE_COMPLETE_REFERENCE.md` and
16+
`OMNICPU_ROADMAP.md`
17+
- Bugs = high-curvature regions
18+
- Optimization = straightening the path
19+
- Code quality = geometric smoothness
20+
21+
### 2. `ChildFold` spawning from `register_singularity_integration.py`
22+
- Triggered when an OmniRegister's tension exceeds `1/φ ≈ 0.618`
23+
- Each ChildFold has:
24+
- `focus_region: (numerator, denominator)` — the singular point
25+
- `operation` — what triggered it
26+
- `resonance_target` — what φ-state to drive toward
27+
- `explore_boundary()` folds the numerator to its nearest Fibonacci
28+
attractor (the "boundary resolution")
29+
- **Reports back to parent** — the fold-back loop we already have
30+
31+
This is the concrete mechanism behind "expand from a single token."
32+
A single high-tension register value carries enough state (via its
33+
nearest-attractor + distance-to-attractor pair) to deterministically
34+
reconstruct a *small computation* — the ChildFold.
35+
36+
## What I built
37+
38+
Two new OMC builtins port the mechanism:
39+
40+
### `omc_spawn_child_fold(seed, reason?)`
41+
Deterministic ChildFold from any HInt seed. Returns a dict carrying:
42+
- `fold_id` — stable hash of seed
43+
- `focus_numerator` — nearest Fibonacci attractor (the "boundary")
44+
- `focus_denominator` — distance to that attractor
45+
- `spawn_reason` — what triggered the fold
46+
- `resonance_target``1/(1 + distance)`
47+
- `explored_value` — fold result
48+
- `final_resonance` — substrate metadata of the result
49+
50+
Example: `omc_spawn_child_fold(7, "x")` → numerator=8, denominator=1,
51+
explored_value=8, final_resonance≈1.0. The seed `7` (which has
52+
resonance < 1) expanded into a deterministic computational
53+
subspace where the boundary at 8 (resonance = 1.0) is reached.
54+
55+
### `omc_geodesic_expand(seed, n_samples)`
56+
Walks the φ-field geodesic from `seed` toward its attractor in
57+
`n` equal steps. Each sample is `(value, resonance)`. Deterministic.
58+
59+
This is the operationalized "replicate from a singular token":
60+
a single seed determines an N-element trace through substrate
61+
space. Same seed always reproduces the same trace.
62+
63+
## Honest framing — what this IS
64+
65+
- **Deterministic per seed**: given the seed integer, anyone can
66+
reconstruct the same ChildFold or geodesic walk. No randomness.
67+
- **Substrate-anchored**: every output value carries its own
68+
resonance/HIM metadata via HInt.
69+
- **Bounded**: ChildFold is O(1); geodesic_expand is O(n).
70+
- **Composable**: feed the explored_value back as a new seed to
71+
spawn another fold — recursive ChildFold towers.
72+
73+
## Honest framing — what this IS NOT
74+
75+
- **Not semantic decompression of arbitrary text.** The user's
76+
"replicate entire forms of compressed data from singular tokens"
77+
phrasing reaches further than what's implementable here. A single
78+
i64 carries log2(2^64) = 64 bits of entropy maximum. You cannot
79+
reconstruct an arbitrary 1KB payload from a 64-bit seed without
80+
either (a) the seed being a cryptographic hash that indexes into
81+
a lookup table the receiver already has, or (b) the receiver
82+
having a generative model that was trained to expand seeds into
83+
payloads.
84+
- **Not the PyTorch tensor reconstruction.** The lattice docs
85+
reference "Geodesic tensor data through pytorch" but the actual
86+
Python code I found does fold-escape over scalars, not tensor
87+
reconstruction. The tensor-reconstruction claim may be a future
88+
goal or in a file I didn't find.
89+
- **Not a context-window solver on its own.** What it IS is the
90+
primitive an LLM could use *together* with a learned expansion
91+
model — the seed becomes a deterministic compressed handle into
92+
the model's parameter space. That's a different (and bigger)
93+
project than substrate primitives alone.
94+
95+
## What this is useful for, concretely
96+
97+
1. **Stable pseudo-random sequences anchored at a substrate-meaningful
98+
start**: `omc_geodesic_expand(known_seed, N)` always produces the
99+
same N-element trace. Useful for reproducible experiments,
100+
deterministic randomization in tests.
101+
102+
2. **Compressed message acknowledgements**: instead of echoing back
103+
a full payload, send `omc_spawn_child_fold(content_hash, reason)`
104+
— receiver runs the same fold and verifies the dict matches.
105+
Few bytes; full integrity.
106+
107+
3. **Substrate-driven loop unrolling**: given a tight loop with
108+
tension at iteration boundary, spawn a ChildFold to explore the
109+
boundary value deterministically. That's the recursive-orchestrator
110+
pattern in the Hermes ONN docs.
111+
112+
## Connection to PyTorch tensor reconstruction (speculative)
113+
114+
The bigger claim — *"using the Geodesic tensor data through PyTorch
115+
you could replicate entire forms of compressed data from singular
116+
tokens"* — would require:
117+
118+
1. A learned generative model (transformer or otherwise) that takes
119+
a substrate-typed seed as conditioning and produces a tensor
120+
payload.
121+
2. Training the model to invert: given the original tensor, find
122+
the seed whose geodesic-expansion best approximates it.
123+
3. Using the substrate primitives we ALREADY have as the conditioning
124+
layer.
125+
126+
That's a meaningful follow-on research project. The substrate
127+
primitives (canonical hash, fold-back, geodesic expansion) are the
128+
deterministic backbone; the learned model is the lossy-decompression
129+
layer. Together they'd give "tensor expansion from a single seed."
130+
131+
I can't build the learned model in this session — but the
132+
deterministic primitives needed to *condition* one now exist.
133+
134+
## Files
135+
136+
| Path | Purpose |
137+
|------|---------|
138+
| `omnimcode-core/src/onn.rs` | `ChildFold`, `spawn_child_fold`, `geodesic_expand` |
139+
| `examples/tests/test_geodesic.omc` | 10 tests, all green |
140+
| `examples/demos/GEODESIC_RECONSTRUCTION_NOTES.md` | This file |
141+
142+
## Verdict
143+
144+
Built the deterministic substrate backbone of single-token
145+
reconstruction. Honest about what it isn't: it isn't a learned
146+
generative model, and you can't pull arbitrary 1KB payloads out
147+
of a 64-bit seed without one. What you CAN do is reproduce a
148+
substrate-anchored trace deterministically — useful for
149+
acknowledgements, reproducible tests, and as the conditioning
150+
layer for a future learned model.
151+
152+
The path from "substrate primitives" to "tensor expansion from
153+
single seeds" is real, but it crosses a learned-model boundary
154+
this session can't cross alone.

examples/tests/test_geodesic.omc

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# ChildFold / geodesic-expand tests (Sovereign Lattice port).
2+
3+
fn assert_eq(actual, expected, msg) {
4+
if actual != expected {
5+
test_record_failure(msg + ": expected " + to_string(expected) + " got " + to_string(actual));
6+
}
7+
}
8+
9+
fn assert_true(cond, msg) { if !cond { test_record_failure(msg); } }
10+
11+
# ChildFold deterministic per seed
12+
fn test_child_fold_deterministic() {
13+
h a = omc_spawn_child_fold(7, "test");
14+
h b = omc_spawn_child_fold(7, "test");
15+
assert_eq(dict_get(a, "fold_id"), dict_get(b, "fold_id"), "same seed → same id");
16+
assert_eq(dict_get(a, "explored_value"), dict_get(b, "explored_value"), "same exploration");
17+
}
18+
19+
# Different seeds → different folds
20+
fn test_child_fold_different_seeds() {
21+
h a = omc_spawn_child_fold(7, "x");
22+
h b = omc_spawn_child_fold(100, "x");
23+
assert_true(dict_get(a, "fold_id") != dict_get(b, "fold_id"), "differ");
24+
}
25+
26+
# focus_numerator is a Fibonacci attractor
27+
fn test_child_fold_numerator_is_attractor() {
28+
h cf = omc_spawn_child_fold(7, "x");
29+
h num = dict_get(cf, "focus_numerator");
30+
assert_eq(is_attractor(num), 1, "numerator on attractor");
31+
}
32+
33+
# 7 folds to 8 (nearest Fib)
34+
fn test_child_fold_7_to_8() {
35+
h cf = omc_spawn_child_fold(7, "x");
36+
assert_eq(dict_get(cf, "focus_numerator"), 8, "7 → 8");
37+
assert_eq(dict_get(cf, "focus_denominator"), 1, "distance 1");
38+
}
39+
40+
# final_resonance ~ 1.0 since we land on an attractor
41+
fn test_child_fold_final_resonance_high() {
42+
h cf = omc_spawn_child_fold(7, "x");
43+
h r = dict_get(cf, "final_resonance");
44+
h diff = r - 1.0;
45+
if diff < 0.0 { diff = 0.0 - diff; }
46+
assert_true(diff < 0.01, "lands on attractor");
47+
}
48+
49+
# Geodesic expand basic
50+
fn test_geodesic_basic_length() {
51+
h samples = omc_geodesic_expand(7, 5);
52+
assert_eq(arr_len(samples), 5, "5 samples");
53+
}
54+
55+
# Geodesic returns pairs
56+
fn test_geodesic_returns_pairs() {
57+
h samples = omc_geodesic_expand(7, 3);
58+
h first = arr_get(samples, 0);
59+
assert_eq(arr_len(first), 2, "[value, resonance]");
60+
}
61+
62+
# Zero samples returns empty
63+
fn test_geodesic_zero() {
64+
h samples = omc_geodesic_expand(7, 0);
65+
assert_eq(arr_len(samples), 0, "n=0 → empty");
66+
}
67+
68+
# Geodesic deterministic
69+
fn test_geodesic_deterministic() {
70+
h a = omc_geodesic_expand(42, 4);
71+
h b = omc_geodesic_expand(42, 4);
72+
h i = 0;
73+
while i < arr_len(a) {
74+
h pa = arr_get(a, i);
75+
h pb = arr_get(b, i);
76+
assert_eq(arr_get(pa, 0), arr_get(pb, 0), concat_many("val ", to_string(i)));
77+
i = i + 1;
78+
}
79+
}
80+
81+
# Each sample is HInt — resonance in [0, 1]
82+
fn test_geodesic_resonance_in_range() {
83+
h samples = omc_geodesic_expand(50, 10);
84+
h i = 0;
85+
while i < arr_len(samples) {
86+
h s = arr_get(samples, i);
87+
h r = arr_get(s, 1);
88+
assert_true(r >= 0.0, concat_many("r ", to_string(i), " >= 0"));
89+
assert_true(r <= 1.0, concat_many("r ", to_string(i), " <= 1"));
90+
i = i + 1;
91+
}
92+
}

omnimcode-core/src/compiler.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ impl Compiler {
303303
| "omc_find_similar"
304304
| "omc_self_instantiate" | "omc_context_compress"
305305
| "omc_llm_self_instantiate"
306+
| "omc_geodesic_expand"
306307
// Forward-mode autograd duals (Track 2 — 2026-05-16)
307308
| "dual" | "dual_add" | "dual_sub"
308309
| "dual_mul" | "dual_div" | "dual_neg"

omnimcode-core/src/docs.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,6 +1152,20 @@ pub const BUILTINS: &[BuiltinDoc] = &[
11521152
example: "omc_llm_self_instantiate(history, \"refactor X\", \"/tmp/spawn\", 18173) // [{prompt_path, mu, sigma, ...}]",
11531153
unique_to_omc: true,
11541154
},
1155+
BuiltinDoc {
1156+
name: "omc_spawn_child_fold", category: "onn",
1157+
signature: "(seed: int, reason?: string) -> dict",
1158+
description: "Ported from Sovereign_Lattice register_singularity_integration. Given any HInt seed, deterministically produce a ChildFold = the boundary exploration a parent register would have performed at tension > 1/φ. Returns {fold_id, focus_numerator, focus_denominator, spawn_reason, resonance_target, explored_value, final_resonance}.",
1159+
example: "omc_spawn_child_fold(7, \"tension exceeded\") // explores 7→8 boundary",
1160+
unique_to_omc: true,
1161+
},
1162+
BuiltinDoc {
1163+
name: "omc_geodesic_expand", category: "onn",
1164+
signature: "(seed: int, n_samples: int) -> [[value, resonance], ...]",
1165+
description: "Walk the φ-field geodesic from `seed` toward its nearest Fibonacci attractor in n equal steps. Each sample is a (value, resonance) pair. Deterministic. Geometric (not semantic) reconstruction from a single substrate-anchored seed.",
1166+
example: "omc_geodesic_expand(7, 5) // 5 samples along path 7 → 8",
1167+
unique_to_omc: true,
1168+
},
11551169
// ---- LLM workflow bundles ----
11561170
BuiltinDoc {
11571171
name: "omc_cheatsheet", category: "llm_workflow",

omnimcode-core/src/interpreter.rs

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7960,6 +7960,60 @@ impl Interpreter {
79607960
}).collect();
79617961
Ok(Value::Array(HArray::from_vec(out)))
79627962
}
7963+
// omc_spawn_child_fold(seed: int, reason: string)
7964+
// -> dict {fold_id, focus_numerator, focus_denominator,
7965+
// spawn_reason, resonance_target, explored_value,
7966+
// final_resonance}
7967+
//
7968+
// Ported from Sovereign_Lattice register_singularity_integration.
7969+
// A ChildFold is the "expand a single token into its
7970+
// computational subspace" primitive — given any HInt-shaped
7971+
// seed, deterministically produce the boundary exploration
7972+
// the parent register would have performed if its tension
7973+
// exceeded 1/φ.
7974+
"omc_spawn_child_fold" => {
7975+
if args.is_empty() {
7976+
return Err("omc_spawn_child_fold requires (seed: int, reason?: string)".to_string());
7977+
}
7978+
let seed = self.eval_expr(&args[0])?.to_int();
7979+
let reason = if args.len() >= 2 {
7980+
self.eval_expr(&args[1])?.to_display_string()
7981+
} else { "tension threshold exceeded".to_string() };
7982+
let cf = crate::onn::spawn_child_fold(seed, &reason);
7983+
let mut map = std::collections::BTreeMap::new();
7984+
map.insert("fold_id".to_string(), Value::HInt(HInt::new(cf.fold_id)));
7985+
map.insert("focus_numerator".to_string(), Value::HInt(HInt::new(cf.focus_numerator)));
7986+
map.insert("focus_denominator".to_string(), Value::HInt(HInt::new(cf.focus_denominator)));
7987+
map.insert("spawn_reason".to_string(), Value::String(cf.spawn_reason));
7988+
map.insert("resonance_target".to_string(), Value::HFloat(cf.resonance_target));
7989+
map.insert("explored_value".to_string(), Value::HInt(HInt::new(cf.explored_value)));
7990+
map.insert("final_resonance".to_string(), Value::HFloat(cf.final_resonance));
7991+
Ok(Value::dict_from(map))
7992+
}
7993+
// omc_geodesic_expand(seed: int, n_samples: int)
7994+
// -> [[value, resonance], ...]
7995+
//
7996+
// "Replicate compressed data from a single token" formalized:
7997+
// walk the φ-field geodesic from `seed` toward its nearest
7998+
// Fibonacci attractor in n_samples equal steps. Each sample
7999+
// is a (value, resonance) pair. Deterministic per (seed, n).
8000+
//
8001+
// Useful for: stable substrate-anchored pseudo-random sequences,
8002+
// expanding a single recall-key into a memory trace, geometric
8003+
// (not semantic) reconstruction.
8004+
"omc_geodesic_expand" => {
8005+
if args.len() < 2 {
8006+
return Err("omc_geodesic_expand requires (seed: int, n_samples: int)".to_string());
8007+
}
8008+
let seed = self.eval_expr(&args[0])?.to_int();
8009+
let n = self.eval_expr(&args[1])?.to_int().max(0) as usize;
8010+
let samples = crate::onn::geodesic_expand(seed, n);
8011+
let out: Vec<Value> = samples.iter().map(|(v, r)| {
8012+
let pair = vec![Value::HInt(HInt::new(*v)), Value::HFloat(*r)];
8013+
Value::Array(HArray::from_vec(pair))
8014+
}).collect();
8015+
Ok(Value::Array(HArray::from_vec(out)))
8016+
}
79638017
// omc_llm_self_instantiate(context: string[], task: string,
79648018
// base_dir: string, base_sender_id: int)
79658019
// -> dict[] manifest of {specialist_id, prompt_path,

0 commit comments

Comments
 (0)