ForgeCurves Future Extension: Companion Runner

ForgeHyperCurves Local Companion Runner

Circumventing browser worker memory ceilings via an optional lightweight workstation daemon. Retain the clean browser-native notebook interface while scaling to 128 GB+ workstation RAM, multi-threaded Rayon parallelism, and direct memory-mapped file access.

1. The Problem: Browser-Imposed Memory Ceilings

While ForgeCurves executes numerical routines with compiled WebAssembly efficiency, standard in-browser Web Workers operate under unavoidable host restrictions:

32-Bit WASM Memory Limits

Standard wasm32 addresses memory via 32-bit unsigned integers, imposing an absolute theoretical ceiling of 4 GB ($2^{32}$ bytes) per linear memory instance.

Browser Tab Allocation Quotas

Modern browser engines (V8, Blink, Gecko) allocate worker memory from per-tab quotas. Chrome, Edge, and Firefox typically cap a single worker or WASM instance between 1.4 GB and 2.0 GB of RAM.

Garbage Collection Pressure

Allocating millions of temporary JavaScript objects before transferring them to linear memory causes severe garbage collection pauses and occasional out-of-memory tab crashes.

Large-Matrix Workload Caps

A dense $50,000 \times 2,000$ matrix of 64-bit doubles requires 800 MB. Factorizations (SVD, QR) or cross-set distances require transient allocations exceeding 2 GB, crashing browser workers.

2. The Solution: ForgeHyperCurves Daemon

Because WebAssembly bytecode is portable across host environments, ForgeCurves solves the memory ceiling through an optional downloadable background daemon (ForgeHyperCurves / forgeHypercurves):

Identical User Experience

Users remain entirely within the familiar ForgeCurves browser notebook interface at forgecurves.com. No desktop app installation or window switching required.

Transparent Loopback Streaming

Cell execution requests transparently route over a fast local loopback WebSocket connection (ws://127.0.0.1:8765) directly to the companion runner.

Workstation Memory Unlocked

The companion daemon accesses the workstation's physical RAM (16 GB, 32 GB, 64 GB, 128 GB+) and high-speed NVMe swap, bypassing browser memory quotas completely.

Graceful Zero-Install Fallback

If the daemon is offline, ForgeCurves automatically falls back to the in-browser Web Worker engine, ensuring 100% functionality without mandatory software installation.

3. Dual Execution Modes in the Companion

ForgeHyperCurves provides two interchangeable execution engines sharing the identical communication protocol:

Mode 1: Exact WASM Parity Runner (Wasmtime)

Embeds a standalone WebAssembly runtime (Bytecode Alliance Wasmtime) executing the exact identical octave_wasm_math.wasm binary used in the browser. Guarantees 100% bitwise parity while expanding memory to physical RAM with 64-bit indexing (memory64).

Mode 2: Pre-Compiled Native Host Binary

Pre-compiled standalone executable compiled from clean Rust without browser wrappers. Unlocks 64-bit native pointers, hardware vectorization (AVX-512 / ARM Neon), Rayon multi-threaded CPU parallelization, and mmap memory-mapped file access for 200 GB+ datasets.

# Starting the ForgeHyperCurves companion daemon on workstation $ ./forgeHypercurves --port 8765 --mode wasm --max-memory 64GB [INFO] ForgeHyperCurves Companion Daemon v1.0.0 listening on 127.0.0.1:8765 [INFO] Embedded Wasmtime engine initialized with octave_wasm_math.wasm [INFO] Memory ceiling: 64.00 GB RAM | Worker Bridge: Ready for ForgeCurves

4. Execution Architecture Comparison

Comparing the standard in-browser Web Worker against the two ForgeHyperCurves companion modes:

Architecture Dimension In-Browser Web Worker (Default) Companion Mode 1 (Wasmtime WASM) Companion Mode 2 (Native Multi-Threaded)
Memory Ceiling ∼1.5 – 2.0 GB (Browser Tab Cap) Up to Full System RAM (64 GB+) Full RAM + NVMe Swap (128 GB+)
Execution Engine V8 / SpiderMonkey Worker Standalone Wasmtime JIT Native x86_64 / ARM64 Machine Code
Hardware Vectorization WASM SIMD128 (128-bit) WASM SIMD128 / memory64 Native AVX2, AVX-512, ARM Neon
Multi-Threading Single Worker Thread Multi-threaded WASM instances Rayon Thread Pool (All CPU Cores)
Local Filesystem Virtual OPFS / IndexedDB Local FS over JSON-RPC Direct mmap (Datasets > RAM)
User Installation Zero Install (Pure Web) Download 5 MB Executable Download 5 MB Executable
Bitwise Parity Reference standard 100% Bitwise Identical IEEE 754 Floating-Point Parity

5. Communication Protocol & Kernel Adapter

The companion daemon communicates using standard JSON-RPC 2.0 messages matching the existing OctaveKernelAdapter interface:

// ForgeCurves -> Companion (Cell Execution Request) { "jsonrpc": "2.0", "id": "cell-exec-101", "method": "executeCell", "params": { "code": "A = randn(50000, 2000); [U, S, V] = svd(A, 'econ');", "timeoutMs": 300000 } } // Companion -> ForgeCurves (Streaming Telemetry Output) { "jsonrpc": "2.0", "id": "cell-exec-101", "result": { "status": "ok", "executionTimeMs": 1420.5, "memoryUsedMb": 1640.2 } }