FRF Pipeline Map
Reference document for the deblur pipeline as a composition of FORK/RACE/FOLD subsystems. Names every parallel surface and ties it back to the canonical FRF primitives in this monorepo.
Context
Every parallel surface in the deblur pipeline is FORK/RACE/FOLD, mirroring the canonical primitives in open-source/aether/src/glossolalia-moa.ts:forkRaceFoldMOA (TS) and open-source/gnosis/gnosis-frf (Rust).
The TS analog used inside this host is frf.ts:forkRaceFold — a small primitive that takes an array of async tasks, an optional filter (RACE), and a fold function. Same shape, narrower surface area: tasks resolve to results, the filter discards dropouts, and the fold composes survivors. Everything in this document either calls it directly, calls a wrapper around it (frf-pool.ts), or is structurally identical to it without taking the dependency.
The unifying root-5 / phi attractor
sqrt(5) ~= 2.2360679 and phi ~= 1.6180339 show up in two unrelated-seeming places in this codebase. They are the same attractor.
attractor.ts(and the σ-selection step insigma-attractor.ts) uses sqrt(5) as the Binet normalizer for the Newton step. phi is the deficit-ratio attractor — Fibonacci sliding window viainterfere()fromglossolalia-moa.ts. The σ-walk is a number-theoretic descent toward the closed-form Binet expression for the n-th Fibonacci.gnosis-frf(Rust) uses sqrt(5) as the Hurwitz attractor in its Reynolds-adaptive spin window. Turbulent-vs-laminar workload detection chooses the spin count by the Hurwitz gap to phi-class irrationals.
Both are number-theoretic gaps to Diophantine approximation. Same primitive, different physical meaning. The whole monorepo treats sqrt(5) / phi as the universal attractor for fork/race/fold convergence dynamics — it is the deepest irrational in the Hurwitz spectrum, so it is the slowest to be approximated by rationals, so it is the most stable target for sliding-window estimators.
Subsystem mapping
The bottom three rows are the moonshot extensions described in the next section — they layer ON TOP of the core FRF subsystems rather than implementing the FRF triple themselves.
| Subsystem | File | FORK | RACE | FOLD |
|---|---|---|---|---|
| sigma attractor | sigma-attractor.ts |
per-candidate Wiener over phi-spaced grid | identity (no filtering) | sequential Fibonacci walk; argmin abs(Binet residual); sqrt(5)-normalized Newton step |
| RGB channels | deblur-any-image.ts (and explicit image-rgb-frf.ts) |
one task per channel (R/G/B) | identity | interleave back into row-major RGB |
| Multi-config ensemble | forkraceFoldDeblur.ts |
N parallel deblurAnyImage calls (different sigma, methods, ...) |
filter by carrierBuley.score <= ceiling |
pixel-wise weighted average; buleyeanWeight(R, rank by abs(residual)) from @a0n/buleyean-kernel |
| Bilateral row tiles | image-bilateral-frf.ts |
K horizontal stripes (each with kernelRadius overlap) | identity | concatenate interior rows of each tile in y-order |
| Video frames | video-deblur.ts |
dispatch frames to worker pool | reorder buffer holds out-of-order arrivals | seq-ordered write to ffmpeg encoder |
| Audio (image-deblur shape) | audio-deblur.ts |
STFT bins -> deblurAnyImage on log-magnitude |
NaN-pixel filter inside the orchestrator | iSTFT after Griffin-Lim phase recovery |
| Audio (denoise) | audio-denoise.ts (Boll spectral subtraction) |
per-frame magnitude subtraction | spectral floor beta kept (over-subtraction never zeroes a bin) | iSTFT with original phase |
| Betti sieve | betti-signature.ts |
per-config beta-vector compute | reject if sum(beta) > decagon ceiling | (used by forkraceFoldDeblur) |
| Rejection-weighted fold | buleyean-rejection-weights.ts |
(no fork — operates on existing ensemble outputs) | identity | augment buleyeanWeight by rejection proximity prior |
| Cross-modal Moonshine | cross-modal-moonshine.ts |
per-frame visual/audio delta compute | identity | per-frame sigma adjustment + heartbeat BuleyProjection |
Topological sieves (moonshot extensions)
The FRF subsystems above describe HOW work is parallelized and merged. The sieves described here describe WHAT to admit into the merge — extra criteria layered on top of the residual-rank fold to capture properties the residual cannot express alone.
Betti-Number Signature Sieve (src/betti-signature.ts)
Treats a recovered plane as a topological space and computes its super-level-set Betti signature (beta0, beta1, beta2). The Manifoldtic Closure check sum(beta) <= TOWER_CEILINGS.decagon (10) admits the config; higher sums indicate "invented topology" — content the deblur fabricated that has no homological signature in the source neighbourhood. The discrete Euler characteristic chi = V - E + F (8-connected components, edges, 2x2 faces) gives beta1 = beta0 + beta2 - chi.
const sig = bettiSignature(plane, threshold); // {beta0, beta1, beta2}
const admit = sig.beta0 + sig.beta1 + sig.beta2 <= TOWER_CEILINGS.decagon;Used as: an extra rejection criterion in forkraceFoldDeblur — a candidate that passes the carrierBuley.score ceiling can still be sieved out by topology if its beta-vector deviates from the ensemble median by more than a threshold.
Honest gap: this is super-level-set Betti, NOT persistent homology. Persistence-based sieving across thresholds is a Phase B lift.
Buleyean Rejection-Aware Weighting (src/buleyean-rejection-weights.ts)
Reifies "perfect failure = perfect success" from open-source/buleyean-rl. The default ensemble FOLD discards rejected candidates after the ceiling filter; this module uses their sigma coordinates as a prior on the survivors. A surviving candidate's Buleyean rank weight gets attenuated by the proximity to the closest rejected candidate: w_aug = w_rank * (1 - alpha * 1/(1+d)). The floor at 1 preserves buleyean-positivity (the sliver) so no survivor is fully silenced. With default alpha=0.5, a candidate sitting exactly on a rejection boundary gets its weight halved.
const w = rejectionAwareWeight({ R, rank, sigma, rejectedSigmas, alpha: 0.5 });
// w = buleyeanWeight(R, rank) * (1 - alpha / (1 + minDist))Used as: replaces the plain buleyeanWeight(R, rank) in the ensemble fold when the caller provides the rejected-candidate set.
Honest gap: proximity is in raw sigma-space; a learned distance metric that incorporates spectral fingerprint similarity would be more honest.
Cross-Modal Moonshine (src/cross-modal-moonshine.ts)
Audio and video are two images of the same source. Their per-frame Bule heartbeats (visual brightness deltas, audio energy deltas) should align when the source is coherent. Frames where the heartbeats disagree (loud-audio-still-pixels = motion blur; quiet-audio-flashing-pixels = lighting transient) get a per-frame sigma boost. sigmaPerFrame[t] = baseSigma * (1 + adjustmentStrength * (1 - agreement[t])). Heartbeat classification feeds a BuleyProjection: waste (visual without audio), opportunity (audio without visual), diversity (aligned).
const { sigmaPerFrame, projection } = crossModalMoonshine({
visualDeltas, audioDeltas, baseSigma, adjustmentStrength: 0.5,
});Used as: an input to deblurVideo for per-frame sigma adjustment in clips with audio. Caller pre-extracts the per-frame visual mean and per-window audio RMS.
Honest gap: this is a structural sieve, not a learned cross-modal model. Aligned heartbeats can still be wrong (a person nodding silently has mismatched heartbeats but isn't blurred). Useful as a prior, not as ground truth.
Per-row notes
sigma attractor. The FORK is genuinely parallel in shape — every candidate sigma evaluates a Wiener deconvolution independently. The FOLD is sequential because the Fibonacci recursion is sequential: the next deficit ratio depends on the previous two. This is the canonical case where "FRF shape" does not buy parallel speedup — but it does buy a clean separation between the embarrassingly parallel candidate evaluation and the inherently sequential argmin walk.
RGB channels. Three independent 2D deblurs over identical kernels. The FOLD is a literal interleave — no math, just memory layout. Cleanest case in the system.
Multi-config ensemble. This is the surface that motivates the carrier-Buley score (a tower-of-Hanoi style numeric carrier). The RACE filter discards configs whose carrier exceeds the hexon ceiling — which means structural failures (NaN spread, runaway ringing) are dropped before the FOLD ever sees them. The FOLD is the load-bearing one: pixel-wise weighted average using buleyeanWeight, where the rejection rank is computed against per-pixel residual.
Bilateral row tiles. K stripes with kernelRadius-pixel overlap on each side; only the interior rows of each tile contribute to the output. The overlap absorbs the edge bias of the bilateral filter so the FOLD is a clean concatenation. No identity-RACE wrinkle here; every tile contributes.
Video frames. The only subsystem that uses frf-pool.ts in production. Frames are dispatched to a worker pool, but ffmpeg requires monotonic frame ordering, so the RACE is actually a reorder buffer rather than a discard filter. Out-of-order completions are held until the contiguous prefix can be flushed.
Audio (image-deblur). Treats a log-magnitude spectrogram as a grayscale image and runs deblurAnyImage on it. Structurally valid because the spectrogram has spatial coherence, but the image-domain prior (locally smooth, edge-preserving) is not the right prior for whisper amplification — see Honest Gaps.
Audio (denoise). Boll spectral subtraction. The "RACE" is the spectral floor beta — over-subtraction is clipped so no bin can be zeroed. This is a soft RACE: nothing is dropped, but the FOLD stage refuses to fold down past beta.
Composition example: full ensemble pipeline
deblurAnyImage(input, options)
fork: per-channel
fork: per-sigma candidate (sigma-attractor)
fold: deficit-ratio walk -> selectedSigma
apply: wienerDeblur OR richardsonLucyDeblur
optional: bilateralFilterFRF
fork: per-row-tile
fold: concatenate
optional: classifyDeblurStep -> composeWithFaceUnit
fold: interleave R/G/B
return DeblurAnyImageResult
OR ensemble:
forkRaceFoldDeblur(input, configs[])
fork: per-config (each runs the full deblurAnyImage above)
race: filter by carrierBuley.score <= TOWER_CEILINGS.hexon
fold: pixel-wise weighted average; weights = buleyeanWeight(R, rank)
return DeblurEnsembleResultWhere TRUE parallelism lives (and where it doesn't)
Honest accounting:
- The
forkRaceFoldprimitive is async-shaped, not parallel-by-default. On a single-thread Node host, async tasks share one CPU core unless they yield to I/O. CPU-bound forks (Wiener, Bilateral, RL) serialise on the event loop. frf-pool.tsis theworker_threads-backed FRF that actually runs forks on separate threads. It accepts a pluggableWorkerFactoryso callers control whether the worker is loaded from a JS file (production), a TS file via the tsx loader (dev), oreval: truecode (tests).gnosis-frf(Rust) gives true parallelism with ~200ns dispatch — used by any future Rust kernel (e.g., the WASM SIMD FFT plan).video-deblur.tsalready usesworker_threads; tests useworkers: 0inline mode because vitest cannot propagate its TS loader to workers.
The current state delivers FRF SHAPE everywhere; FRF EXECUTION (true parallelism) lives in frf-pool.ts and the worker path inside video-deblur.ts. The rest is intentionally async-shaped without parallel — the design contract is "swap the inner runner for true parallelism without API churn." Every FORK site is already written so its tasks are independent; flipping to threads or to a Rust kernel does not require rewriting the orchestrator.
Pointers and prior art
open-source/aether/src/glossolalia-moa.ts—forkRaceFoldMOA,interfere,InterfereState. The token-decoder original; line ~160 has the canonicalinterfere()step.open-source/gnosis/gnosis-frf/— Rust rayon replacement; 16-20x faster on uniform workloads; 200ns dispatch; sqrt(5)-Hurwitz Reynolds spin tuning.open-source/x-gnosis/— nginx-compatible web server with FRF at every layer; theorem-backed throughput claims.open-source/gnosis/polyglot/—gnexecRust TS runtime (4.3x faster than node); framework extractor.packages/buleyean-kernel/—buleyeanWeight(R, v) = R - min(v, R) + 1; the SSOT rejection-sliver formula used in every FOLD that does deficit-weighted merging.open-source/gnosis-math/Gnosis/CostAlgebra.lean— formal cost-algebra theorems; the runtime mirror iscost-algebra.ts.
Honest gaps
- True
worker_threadsparallelism infrf-pool.tsrequires either a JS bundle, a TS loader (tsx), or eval-string workers. Each has tradeoffs documented in that file's header. There is no single config that satisfies "production deploy + dev TS + vitest" without a per-environment factory. - WASM SIMD FFT is not implemented — see
wasm-simd-fft-plan.mdfor the migration path. Until then, all 2D FFT goes through the pure-JS path infft2.ts, which is the dominant cost in Wiener and the bottleneck for any meaningful throughput target. audio-deblur.tsapplies image-deblur math to a magnitude spectrogram, which is structurally valid but not the right inner kernel for whisper amplification.audio-denoise.ts(Boll spectral subtraction) is the actual whisper-recovery primitive. Keep them separate; do not let the image-shape one drift into the production path.- Per-frame sigma selection in video is amortised by computing sigma on frame 0 and reusing it. Works for stationary blur, breaks for variable blur within a clip. Future: re-sample sigma every N frames, or detect blur-change via a cheap structure-tensor delta and trigger re-selection.
- The RACE step in
forkraceFoldDeblurfilters on carrier-Buley score, not on output quality. A config can pass the carrier ceiling and still produce a perceptually worse image than its peers; the FOLD's deficit-weighted average is what compensates. If the tower ceiling is set too low, the ensemble silently shrinks to one survivor and the FOLD becomes a passthrough — there is no logging at the moment that distinguishes "ensemble of one" from "ensemble of N."