forgo.cloud
Sign in
Repo workspace

forkjoin-ai/gnosis

Monster, FOIL & protocol69 — the ELI5

docs/ELI5_MONSTER_FOIL_PROTOCOL69.md
forkjoin-ai/gnosis

Monster, FOIL & protocol69 — the ELI5

A friendly refresher on the three weird ideas that let a program compute once and teleport forever. It really is wild. Read top to bottom; each part sets up the next.

The one-sentence version: turn a program into a graph, run the graph on a tiny native engine (monster), remember the answer by its shape-fingerprint so you never run it twice (FOIL), and let other machines — even across a room over the radio — claim that frozen answer with a one-number handshake instead of recomputing it (protocol69).

Three layers, each answering a sharper version of the same question:

Layer The question it answers The trick
monster "What if running code didn't need a whole language runtime?" Compile the shape of the program, run that.
FOIL "What if you never had to run the same thing twice?" Fingerprint the shape; replay the cached answer.
protocol69 "What if the answer could arrive from somewhere else?" A fail-closed XOR handshake that admits a frozen answer.

Part 1 — monster: your code is secretly a graph

Normally, to run myFn(x) you boot a giant machine: Node, Python, a JVM. That machine is huge and slow to start, and it does the same warm-up every single time.

monster says: forget the machine. A function is really just a flow chart — do this, then fork into these two, race them, fold the winners back together. So monster reads your source (.ts, .py, .go, .gnot, …), throws away the language, and keeps only that flow chart. The repo calls it a topology:

"monster is a native runtime for topologies produced by the orchestration extractor. There is no JS engine, no Python interpreter, no JVM. A source file becomes a graph (nodes + edges + per-node IR), and Monster runs that graph."polyglot/README.md

ELI5: instead of hiring a whole orchestra to play your song every night, monster writes the song down as sheet music and plays just the notes. No orchestra, no tuning, no warm-up. The notes are the fork / race / fold shape of your code.

That shape has a name when it's written to disk: a .gg file (the graph). And the engine that walks it is the little Rust binary monster (you call it with pnpm run monster -- …, or it hides under gnode and a0).


Part 2 — FOIL: don't run it once if you ran it before

Here's the leap. If a program is just a shape, then two runs with the same shape and the same inputs produce the same answer — always (these flows are deterministic). So why run it twice?

FOIL is monster's memory. It takes the fingerprint of the graph-plus-inputs (a "grassmannian" fingerprint — think a hash of the geometry of the flow), and the first time it sees that fingerprint it runs the program and freezes the answer next to the fingerprint. Every later time it sees the same fingerprint, it skips everything:

"FOIL grassmannian shell skip … warm pure runs return with ZERO runtime startup — no node, no monster, just shasum + cat. Only fires on an exact cache hit."bin/monster

ELI5: the first kid to solve the homework writes the answer on the fridge with the exact problem next to it. Every other kid who has the exact same problem just reads the fridge. They don't redo the math — they don't even pick up a pencil. A cache miss falls through and actually runs; a hit is basically cat.

So now you have: program → shape → frozen answer, addressable by fingerprint. That frozen answer is the thing protocol69 learns to teleport.

Why "FOIL"? (it's a three-way pun, all three load-bearing)

  • tinfoil — as in the tinfoil hat. The conspiracy crowd swears data secretly teleports, materializes out of cache, and arrives from the sky with a secret handshake. Here that's not paranoia — it's the architecture. FOIL is the layer that makes the tinfoil-hat theory true.
  • a foil — the literary kind: the contrast, the counterpart, the "bad guy" a hero is measured against. FOIL is the shadow the slow, honest path is checked against — the cache that has no business already knowing the answer, yet does.
  • an airfoil — the wing. An airfoil glides on moving air; FOIL glides on entropy (it literally rides a jitter pool — FOIL_ENTROPY_POOL, FOIL_ENTROPY_BOOST). Lift from flow, not thrust: you don't power through the computation, you glide over it on the shape of what's already moving.

(All of it is flavor on top of one provable idea: certified replay from a shape-fingerprint cache. The codebase piles on more metaphors too — entropy pools, turgor pressure, "squirt/eject" launchers — but many rewrites are backed by named Lean theorems, so the fast path is provably the same answer as the slow path. See distributed-inference/FOIL_HOTPATH_MERSENNE_PLAN.md.)


Part 3 — protocol69: the answer that arrives from the sky

Now the wild part. If an answer is frozen and addressable by a small key, you don't even need to be the machine that computed it. Someone else can hand you the key, and you can serve the frozen answer — if you can trust the handoff.

protocol69 is that trust handshake, and it's almost insultingly simple. It's one number, built by XOR:

  broadcastSymbol   XOR   localFoilOperand   =   projection
        66          XOR          7           =       69        ✅ admit
  • 66 is the broadcast symbol — it rides in on the shared signal (it's the prefixHash of the canonical RF-key packet).
  • 7 is the local FOIL operand — the number you already hold locally (the prefixLen). This is FOIL's fingerprint world meeting the wire.
  • XOR them. If you get exactly 69, you admit the answer. Anything else → you reject and serve nothing. Fail-closed.

Why XOR and not, say, multiply? Because XOR is a handshake, not a secret. No key crosses the wire — only the agreement does. A receiver admits only when the operand it already holds XORs against the broadcast to land on 69. A wrong, missing, or tampered broadcast lands somewhere else and admits nothing. (And 66 × 7 = 462, which is just… not 69. It's XOR. 66 = 0b1000010, 7 = 0b0000111, XOR = 0b1000101 = 69. The protocol is literally named after the result, sixty9.)

ELI5: you and a friend across the room each secretly hold half of a high-five. The sky broadcasts the other half. When your half clicks with the broadcast half to make the magic number 69, you trust it and grab the frozen answer off the shelf — you never recompute it, and no secret ever traveled. A stranger broadcasting noise can't make your hands click, so they get nothing.

That "grab the frozen answer instead of computing it" move is the teleport, and the cached answer it grabs has geodesicLength: 0 — zero distance traveled through compute-space. You didn't walk to the answer; you were handed the coordinates and the answer was already there.


How they stack (the whole magic trick)

  your program  (typed_handler.ts:fetchRecords, or fn main(){…})
        │   monster: throw away the language, keep the fork/race/fold SHAPE
        ▼
  .gg topology  (nodes + edges + IR)
        │   FOIL: fingerprint the shape+inputs, freeze the answer once
        ▼
  frozen answer addressable by a tiny cache-key
        │   protocol69: wrap the key; admit on 66 XOR 7 = 69; fail-closed
        ▼
  cache-key receipt  ("gnosis:protocol69:polyglot-app-cache:v1:…")
        │   teleport: hand the receipt to ANY admitted node…
        ▼
  …it serves the frozen answer locally — geodesicLength:0, no recompute.

The thesis in one breath: compute once, anywhere; serve everywhere, instantly. The mesh isn't a pile of CPUs racing to recompute — it's a shared cache where a cache-miss becomes a broadcast offer, a worker computes the frozen answer once, and everyone else teleports it in with the XOR handshake.


It actually flew across a room

This isn't a metaphor. On the in-room SDR bench we took a real program, lowered it through monster's polyglot runner into a .gg topology, asked for its protocol69 app-cache-key receipt, and then radioed that receipt across the room: an ADALM-Pluto transmitted it on 433.92 MHz, an RTL-SDR a few feet away received it, and it decoded bit-exact.

typed_handler.ts:fetchRecords ──monster──▶ .gg ──protocol69──▶ cache-key receipt
   ──Pluto TX ))) 433.92 MHz air ))) RTL-SDR RX──▶ decode ✓ (66 XOR 7 = 69, admitted)

The receiver didn't run the program. It got the key from the sky, the handshake projected to 69, and it could serve the frozen answer. That's protocol69, FOIL, and monster doing their three jobs in sequence — over actual radio. Wild.

(Want to try it? scripts/smoke-sdr-teleport.sh --teleport. See rtlsdr-mock-sim/BENCH_SETUP.md.)


Tiny glossary

Term In one line
topology / .gg Your program reduced to a fork/race/fold graph.
monster The native engine that runs the graph — no language runtime.
gnode / a0 Friendlier wrappers over monster (TS CLI / workspace orchestrator).
FOIL The shape-fingerprint cache: run-once, then replay (shasum + cat). Name = tinfoil / a foil / airfoil, all three.
grassmannian fingerprint The hash of a flow's geometry used as the cache key.
protocol69 The XOR admission handshake: 66 ⊕ 7 = 69, fail-closed.
broadcast symbol (66) Comes in on the shared signal — RF-key prefixHash.
local FOIL operand (7) The number you already hold — RF-key prefixLen.
teleport / geodesicLength:0 Serving a frozen answer instead of recomputing it.
cache-miss offer A broadcast "who has this answer?" to the mesh.

Where to dig deeper

  • polyglot/README.md — what monster is, execution shapes, the .gg model.
  • bin/monster — the FOIL grassmannian hot-path (read the comments).
  • distributed-inference/src/protocol69.rs — the 66 XOR 7 = 69 constants + rationale.
  • src/protocol69.ts — the teleport envelopes and admission gate in TypeScript.
  • gnosis-math/Gnosis/Protocol69IotaTeleport.lean — the Lean proof that the program→cache-key handoff is exactly 66 xor 7 = 69.
  • distributed-inference/FOIL_HOTPATH_MERSENNE_PLAN.md — the certified fast-path rewrites.
  • docs/GETTING_STARTED.md — broader Gnosis onboarding.