<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: mel filterbank.js — Phase 2 ParticleNN DSP kernel. Applies a precomputed triangular mel filterbank matrix to a power/ magnitude spectrogram: — a small matmul shaped reduction, not a general matmul (the filterbank is fixed shape and typically far smaller than 's tile sizes, so a dedicated one thread per output element kernel is simpler and avoids forcing an INT8 quantized weight path onto filter coefficients that are naturally small dense f32 matrices, not learned weights). The filterbank matrix itself (triangular mel scale filters for a given sample rate/ / / ) is computed once on the CPU at model load time — this kernel only applies it. Functions Constants — mel filterbank.js — Phase 2 ParticleNN DSP kernel. Applies a precomputed triangular mel filterbank matrix to a power/ magnitude spectrogram: — a small matmul shaped reduction, not a general matmul (the filterbank is fixed shape and typically far smaller than 's tile sizes, so a dedicated one thread per output element kernel is simpler and avoids forcing an INT8 quantized weight path onto filter coefficients that are naturally small dense f32 matrices, not learned weights). The filterbank matrix itself (triangular mel scale filters for a given sample rate/ / / ) is computed once on the CPU at model load time — this kernel only applies it. <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: noise source.js — Phase 2 ParticleNN DSP kernel. Deterministic, chunk boundary independent aspiration/turbulence noise — the exact integer hash proven in (R6)'s (itself the same technique as 's counter based noise): a two round Murmur style avalanche hash of , mapped to . Counter based (not a stateful PRNG stream) so any two chunks covering the same absolute sample index always produce the same noise value, regardless of dispatch order or chunk boundaries — required for glitch free streaming synthesis. Functions Constants — noise source.js — Phase 2 ParticleNN DSP kernel. Deterministic, chunk boundary independent aspiration/turbulence noise — the exact integer hash proven in (R6)'s (itself the same technique as 's counter based noise): a two round Murmur style avalanche hash of , mapped to . Counter based (not a stateful PRNG stream) so any two chunks covering the same absolute sample index always produce the same noise value, regardless of dispatch order or chunk boundaries — required for glitch free streaming synthesis. <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: overlap add.js — Phase 2 ParticleNN DSP kernel. Synthesis overlap add: reconstructs a continuous signal from overlapping length windowed frames at stride, matching 's proven reference. Implemented as a gather , not a scatter: each output thread owns exactly one output sample and sums every frame that overlaps it ( ) — WGSL's core spec has no add, so a scatter ( from many threads across overlapping frames) would race; gathering avoids that entirely with no atomics and no serialized per frame dispatches needed. is the number of consecutive components per logical sample in , so this kernel can consume both layouts the pipeline actually produces: — flat real frames. — INTERLEAVED COMPLEX frames, which is exactly what emits. Only the REAL component is summed (the imaginary residue of an inverse transformed real signal is numerical noise), making this the ISTFT synthesis stage directly, with no separate deinterleave kernel needed in between. Without this stride, reads the interleaved complex buffer as if it were flat real — silently mixing real and imaginary components of the wrong samples together. That gap was found by the integration test. Functions Constants — overlap add.js — Phase 2 ParticleNN DSP kernel. Synthesis overlap add: reconstructs a continuous signal from overlapping length windowed frames at stride, matching 's proven reference. Implemented as a gather , not a scatter: each output thread owns exactly one output sample and sums every frame that overlaps it ( ) — WGSL's core spec has no add, so a scatter ( from many threads across overlapping frames) would race; gathering avoids that entirely with no atomics and no serialized per frame dispatches needed. is the number of


threads across overlapping frames) would race; gathering avoids that entirely with no atomics and no serialized per frame dispatches needed. is the number of consecutive components per logical sample in , so this kernel can consume both layouts the pipeline actually produces: — flat real frames. — INTERLEAVED COMPLEX frames, which is exactly what emits. Only the REAL component is summed (the imaginary residue of an inverse transformed real signal is numerical noise), making this the ISTFT synthesis stage directly, with no separate deinterleave kernel needed in between. Without this stride, reads the interleaved complex buffer as if it were flat real — silently mixing real and imaginary components of the wrong samples together. That gap was found by the integration test. <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


particlevoice/nn/kernels/speech/stft.js
Functions
stftShader()
Constants
Notes & Examples
Where this fits in the training loop

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: stft.js — Phase 2 ParticleNN DSP kernel. The framing half of STFT: slices overlapping length windows from a flat mono signal at stride (zero padded past the signal's end), matching 's proven reference exactly. Writes each frame's samples into the real channel of an interleaved complex output ( 's layout) with the imaginary channel zeroed, so the output can be windowed ( ) then fed directly to — the actual FFT transform is a separate op (already in the operator allowlist), not duplicated here. Functions Constants — stft.js — Phase 2 ParticleNN DSP kernel. The framing half of STFT: slices overlapping length windows from a flat mono signal at stride (zero padded past the signal's end), matching 's proven reference exactly. Writes each frame's samples into the real channel of an interleaved complex output ( 's layout) with the imaginary channel zeroed, so the output can be windowed ( ) then fed directly to — the actual FFT transform is a separate op (already in the operator allowlist), not duplicated here. <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: window.js — Phase 2 ParticleNN DSP kernel. Applies a Hann window in place across framed audio: , matching 's proven / CPU reference exactly (same coefficient formula) so R3's WOLA identity tests remain the ground truth this kernel is checked against. The coefficient is computed in shader from the frame relative index rather than read from a precomputed buffer — one fewer buffer to manage, and Hann's formula is cheap per element. is the number of consecutive components per logical sample, so the same kernel windows both layouts this pipeline actually produces: — flat real frames ( ). — INTERLEAVED COMPLEX frames ( ), which is exactly what emits and what consumes. Both the real and imaginary component of a sample get the SAME coefficient (the correct definition of windowing a complex signal), because is derived from the logical sample index , not the raw component index. Without this stride, silently mis assigns coefficients when handed interleaved complex data (component index and sample index diverge by a factor of 2), so 's documented "output can be windowed (window.js) then fed directly to fft1024 f32.js" composition would produce a wrong window. That gap was found by the integration test — each kernel passed its own parity test in isolation, but the composed WOLA round trip did not reconstruct. Functions Constants — window.js — Phase 2 ParticleNN DSP kernel. Applies a Hann window in place across framed audio: , matching 's proven / CPU reference exactly (same coefficient formula) so R3's WOLA identity tests remain the ground truth this kernel is checked against. The coefficient is computed in shader from the frame relative index rather than read from a precomputed buffer — one


truth this kernel is checked against. The coefficient is computed in shader from the frame relative index rather than read from a precomputed buffer — one fewer buffer to manage, and Hann's formula is cheap per element. is the number of consecutive components per logical sample, so the same kernel windows both layouts this pipeline actually produces: — flat real frames ( ). — INTERLEAVED COMPLEX frames ( ), which is exactly what emits and what consumes. Both the real and imaginary component of a sample get the SAME coefficient (the correct definition of windowing a complex signal), because is derived from the logical sample index , not the raw component index. Without this stride, silently mis assigns coefficients when handed interleaved complex data (component index and sample index diverge by a factor of 2), so 's documented "output can be windowed (window.js) then fed directly to fft1024 f32.js" composition would produce a wrong window. That gap was found by the integration test — each kernel passed its own parity test in isolation, but the composed WOLA round trip did not reconstruct. <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: ActivationArena.js — Phase 1 ParticleNN memory. Transient GPU buffer pool for activation tensors, keyed by byte size: reuses a same size buffer already released by an earlier tensor instead of allocating a new one, and (driven by ) returns a buffer to the pool the moment its last consumer has run. Classes Method Signature Summary Get (allocating or reusing a pooled buffer of the exact same size) the GPU buffer for . Return 's buffer to the free pool (does not destroy it — it is expected to be reused by a same size tensor soon). Total buffers currently pooled (free) + active, for memory pressure diagnostics. Destroy every buffer (active and pooled) — end of program run / full teardown. <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


class GradientArena extends ActivationArena

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: GradientArena.js — Phase 1 ParticleNN memory. Transient GPU buffer pool for gradient tensors during backward passes — identical pooling mechanism to (same size bucketed acquire/release), given its own class identity/file per the plan's checklist rather than duplicated logic, since forward pass activation buffers and backward pass gradient buffers have separate lifetimes and should never be pooled together (an activation still needed for a backward computation must not be silently reused as a gradient buffer). Not wired into any executor until Phase 11 (autodiff), per the plan. Classes <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: TensorLifetimePlanner.js — Phase 1 ParticleNN memory. First/last use analysis over a 's step order: for every tensor name, which step produces it (or if it's an external input to the program) and which step is the last to read it. / use to know exactly when a buffer becomes free to hand to the next tensor that needs one, enabling buffer aliasing instead of one allocation per tensor per run. Classes TensorLifetimePlanner.js — Phase 1 ParticleNN memory. First/last use analysis over a 's step order: for every tensor name, which step produces it (or if it's an external input to the program) and which step is the last to read it. / use to know exactly when a buffer becomes free to hand to the next tensor that needs one, enabling buffer aliasing instead of one allocation per tensor per run. Method Signature Summary Tensor names whose last use is exactly — safe to release/return to an arena immediately after that step runs. Tensor names an external caller must supply before step runs (produced nowhere in this program, first read at exactly this step). <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: WeightBindWindow.js — Phase 1 ParticleNN memory. Storage buffer bind group for a program segment's resident weight pages (up to 16 pages, per the plan's "never allocate one monolithic buffer over 128 MiB" rule) — one GPU buffer per page (not one big buffer for the whole window), matching 's per page granularity. Classes Method Signature Summary Get (or upload) the GPU buffer for a resident page. Throws if the page byte length would violate the single buffer size ceiling — should never happen for correctly sized 16–32 MiB pages, but this is the hard guard the plan's rule requires. Build a bind group for (≤16) against , one entry per page at bindings , followed by any (e.g. activation buffers, uniforms) at subsequent bindings — the caller is responsible for making match this exact binding order. Release one page's GPU buffer (e.g. after ). <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: WeightPageStore.js — Phase 1 ParticleNN memory. Logical 16–32 MiB weight page manifest: a page = a contiguous tensor set with its own SHA 256 hash, matching §6's directory shape exactly ( ) — the EXACT format R8 ( ) already proved works for interrupted downloads (retry, not silent data loss) and corruption detection (hash mismatch actually caught, not tautological). Network fetch is injected ( ) rather than hardcoded to , so this store is testable with a deterministic fake fetcher (as R8 was) and still usable with a real HTTP fetch in production without a second implementation. Classes Method Signature Summary Download page (retrying once on a failed attempt, same as R8's proven interrupted download recovery), verify its hash against the directory, and cache the verified bytes. Throws on persistent hash mismatch (corruption) rather than silently caching bad data. Download every page not already resident, in directory order (priority ordering is 's job, layered on top of this). Drop a page's cached bytes (e.g. under memory pressure) — it will be re fetched on next . Functions Build a §6 shaped directory from page byte data, computing each page's real hash and cumulative byte offset. <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


attachDeviceLossRecovery(device, uploader, recreateDevice, { maxBackoffMs = 8000 } = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: WeightPageUploader.js — Phase 1 ParticleNN memory. Orchestrates (download+hash verify) and (GPU upload) together: priority ordered upload, resumability (skip already uploaded pages), and device loss re upload — the exact three properties R8 ( ) proved for a single/multi page toy case, generalized here to an arbitrary page count and caller chosen priority order. Classes Method Signature Summary Upload (an array of page indices, caller chosen — e.g. from , ordered by nearest upcoming segment first) to the GPU, downloading+verifying via first if not already resident. Already uploaded pages are skipped — safe to call again after an interrupted call (the "resume" property). Evict a page from both the GPU ( ) and the uploaded set bookkeeping — 's own cached bytes are untouched (call separately if the host copy should also be dropped). Device loss recovery: build a fresh against and re upload every previously uploaded page. Re downloads from only for pages that are no longer host resident (e.g. evicted under memory pressure before the loss) — otherwise reuses the already verified cached bytes, matching R8's re run on a new device pattern. Functions Wire the recovery contract from §5: skip recovery if (intentional disposal, not a crash); otherwise recreate the device with exponential backoff and call . Parameters: (GPUDevice) — No description in source JSDoc. (WeightPageUploader) — No description in source JSDoc. (() = Promise<GPUDevice ) — No description in source JSDoc. <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig


training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: WeightResidencyPlan.js — Phase 1 ParticleNN memory. For each program segment (from a §7 bind window directory: ), which pages must be resident — plus the diff between two segments' page sets, so a scheduler can decide exactly which pages to load/evict when moving from one segment to the next instead of reloading everything. Classes WeightResidencyPlan.js — Phase 1 ParticleNN memory. For each program segment (from a §7 bind window directory: ), which pages must be resident — plus the diff between two segments' page sets, so a scheduler can decide exactly which pages to load/evict when moving from one segment to the next instead of reloading everything. Method Signature Summary Union of pages required across several segments (e.g. a lookahead window of upcoming segments). Moving from (currently resident, may be empty) to (about to run): which pages can be evicted (no longer needed) and which must be loaded (not yet resident). Total distinct pages referenced anywhere in the plan — an upper bound on VRAM if everything were resident simultaneously (it never should be, per the plan's residency window design). <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: DeviceProfile.js — Phase 1 ParticleNN runtime. Capability/tier detection, implementing exactly the tier rules frozen in §1–§2 (hard requirements + / / tiers) — not a new policy invented here. Reuses the engine's own WebGPU acquisition ( ) rather than reimplementing adapter/device request logic, same as R1's . Functions Acquire a throwaway GPUDevice, classify its tier per DeviceContract v0 §1–§2, then destroy it — mirrors R1's read only probe discipline. The caller is expected to acquire its OWN long lived device separately (this function is a classification probe, not a device provider). Constants <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


async dispatchAndReadback(device, wgslSource, { uniform, storageInputs = [], outputByteLength, entryPoint = 'main', label = 'KernelValidation' }, workgroups)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: KernelValidation.js — Phase 1 ParticleNN testing. Reusable dispatch and readback plumbing plus the plan's required edge case test vector generators ("odd dims, min dims, zeros, extreme FP16, quantized values") — kept generic over binding shape rather than one runner per kernel, since Phase 1's six kernels all differ in bind group layout but share the same "encode uniform + storage buffers, dispatch, read one output buffer back, compare to a JS reference" shape. Functions Run one compute dispatch against a set of storage/uniform buffers built from plain typed arrays, then read one designated output buffer back. Compiles itself (rather than accepting a pre built pipeline) so it can pair the shader module with the matching explicit bind group layout described above. Parameters: (GPUDevice) — No description in source JSDoc. (string) — No description in source JSDoc. ([number, number, number]) — No description in source JSDoc. Returns: raw output bytes Compare an actual numeric array to an expected one and return a parity check result object matching R2's shape. Random values in [ 1, 1], deterministic given . Values right at/near the extremes a well behaved f16 encoder/kernel must not silently clip or NaN on. Values already rounded to representable int8 codes, for quantization path parity tests. Constants — Standard edge case dimension set: odd, minimal (1), and a "normal" power of two size, for sweeping a kernel's dimension parameter. <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the


→ brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: NeuralExecutor.js — Phase 1 ParticleNN runtime. Dispatches a compiled 's steps as one command encoder (one compute pass per step, in program order), then submits through the engine's own when one is supplied — sharing the render queue's frame budget rather than a second, uncoordinated submission path. Falls back to a direct when no broker is given (e.g. an offline/background compile and run context with no render loop to share a budget with). Classes NeuralExecutor.js — Phase 1 ParticleNN runtime. Dispatches a compiled 's steps as one command encoder (one compute pass per step, in program order), then submits through the engine's own when one is supplied — sharing the render queue's frame budget rather than a second, uncoordinated submission path. Falls back to a direct when no broker is given (e.g. an offline/background compile and run context with no render loop to share a budget with). Method Signature Summary <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: NeuralScheduler.js — Phase 1 ParticleNN runtime. Priority ordered queue of requests — for when several runs are pending at once (e.g. multiple NPCs queued to speak in the same frame window). Mirrors 's high/normal/low priority bucket design (reference, not imported — ParticleNN stays decoupled from the render side scheduler's internals) layered on top of , which already defers to a shared for actual frame budget admission — this file's job is only ordering which run gets submitted next, not re deriving budget admission itself. Classes Method Signature Summary Enqueue a run request. Returns a promise that resolves once this specific request has actually been dispatched (not merely queued). <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


withinTolerance(actual, expected, { absTolerance, relTolerance })

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: NumericalTolerance.js — Phase 1 ParticleNN testing. Canonical tolerance constants (single source — re exports these rather than defining its own copy) and the shared abs/rel error comparison used by and every kernel parity test, matching the exact convention R2's already proved out ( / against a JS scalar reference). Functions Elementwise max abs/rel error between two same length numeric arrays. True if is within (either bound satisfied per element is sufficient — matches R2's tolerance semantics). Constants — NumericalTolerance.js — Phase 1 ParticleNN testing. Canonical tolerance constants (single source — re exports these rather than defining its own copy) and the shared abs/rel error comparison used by and every kernel parity test, matching the exact convention R2's already proved out ( / against a JS scalar reference). <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: PipelineCache.js — Phase 1 ParticleNN runtime. Hash keyed compute pipeline cache: avoids recompiling the same WGSL source + entry point on every dispatch. Keyed by a cheap string hash of the generated WGSL source (kernels are JS generated, so byte identical source for the same params is expected — see ), not by kernel name + params (two different param sets can legitimately generate identical WGSL, and caching by source avoids a redundant compile in that case too). Classes Method Signature Summary Get (or compile+cache) a compute pipeline for / . If (a ) is provided, uses the explicit layout synchronous path (§8 of — REQUIRED for any kernel). If omitted, falls back to + async ( ) — only safe for kernels that do not use f16. Drop every cached pipeline/module reference (does not call any GPU dispose API — pipelines/modules are GC'd, WebGPU has no explicit destroy for them). <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


async createComputePipelineChecked(device, module, { label, name = label, entryPoint = 'main' } = {})

async assertShaderCompiled(module, name = 'shader')

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: PipelineUtils.js — Phase 1 ParticleNN runtime. Deliberate byte for byte mirror of (design reference, not imported) per the plan's explicit instruction to keep ParticleNN decoupled from the LLM runtime. Already proven correct — every Phase 1 risk spike (R2, R3, R9, etc.) has been using the LLM runtime's copy of this exact logic directly; this is the same logic under ParticleVoice's own module tree. Functions PipelineUtils.js — Phase 1 ParticleNN runtime. Deliberate byte for byte mirror of (design reference, not imported) per the plan's explicit instruction to keep ParticleNN decoupled from the LLM runtime. Already proven correct — every Phase 1 risk spike (R2, R3, R9, etc.) has been using the LLM runtime's copy of this exact logic directly; this is the same logic under ParticleVoice's own module tree. <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: ActivityIntegrationProbe.js — R15 Phase 1 risk spike orchestrator. Functions Constants <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


createBreathReservoir({ sampleRate, compliance = 0.15 })

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: BreathReservoir.js — R6A Phase 1 risk spike. "BreathReservoirState (lung pressure, compliance, target subglottal pressure) ParticleTract" — particle voice 26357c.md, Phase 2. Minimal first order lag model: lung pressure exponentially approaches whatever target subglottal pressure RespiratoryDriveHead commands, rate set by (higher compliance = slower to respond, matching the physical intuition of a more elastic reservoir). This is the mechanism that lets a physiology intervention on breath effort actually change the glottal source's amplitude sample by sample rather than jumping instantly. Functions BreathReservoir.js — R6A Phase 1 risk spike. "BreathReservoirState (lung pressure, compliance, target subglottal pressure) ParticleTract" — particle voice 26357c.md, Phase 2. Minimal first order lag model: lung pressure exponentially approaches whatever target subglottal pressure RespiratoryDriveHead commands, rate set by (higher compliance = slower to respond, matching the physical intuition of a more elastic reservoir). This is the mechanism that lets a physiology intervention on breath effort actually change the glottal source's amplitude sample by sample rather than jumping instantly. <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: CaptureGate.js — R14 Phase 1 risk spike. "Custom voice capture rejects insufficient speech, low SNR, clipping, echo, music, another speaker, gain drift, device changes, dropped samples, silence, or poor coverage." — Phase 1. Each check is a cheap, independently testable heuristic proxy (not a trained classifier) over a session of R10 frame analyses plus out of band capture metadata (device change/dropped sample counts, target phrase coverage) that a real / layer — not the energy meter — would track. Functions Echo contamination: strong correlation between the recording and a known TTS reference. Music proxy: natural speech's frame to frame RMS is far less stable than sustained tonal/musical content. Another speaker proxy: an abrupt, sustained shift in low/high band energy balance partway through. Gain drift: mean level of the last third vs first third of the speech should stay close. = { frames, echoResidualRatio, deviceChangeEventCount, droppedSampleCount, phraseCoverageRatio }. Constants <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: CaptureGateProbe.js — R14 Phase 1 risk spike orchestrator. Functions Constants <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: DeviceMatrixProbe.js — R1 Phase 1 risk spike. "device matrix.html — record shader f16, workgroup/storage/binding/invocation limits, AudioContext properties, crossOriginIsolated, AudioWorklet/ SharedArrayBuffer, OS VRAM quota." — particle voice 26357c.md, Phase 1. Reuses the engine's own capability probing primitives instead of reimplementing WebGPU adapter/device acquisition: engine/core/gpu/GpuDevice.js (GpuDevice.create, detectGpuPlatform) engine/core/gpu/GpuInit.js (isWebGpuSupported) webgpu os/kernel/VRAMTracker.js (default app/global quota) Read only: the WebGPU device created here is destroyed immediately after limits/features are read, and the AudioContext is closed immediately after its properties are read. Functions Acquire a throwaway GPUDevice via the engine's own GpuDevice, read limits/features, destroy it. Construct a throwaway AudioContext, read its properties, close it. Confirm SharedArrayBuffer is not just present but actually constructible. Read the OS default VRAM quota (webgpu os/kernel/VRAMTracker.js), no kernel required. Run every device matrix probe and roll up an overall status. is a distinct outcome from , matching the plan's own Production Contract language ("Unsupported hardware is reported explicitly as unsupported... the project does not degrade to an external runtime"): unsupported: WebGPU itself is unavailable on this device/browser. fail: WebGPU is available, but a hard architectural requirement (crossOriginIsolated, SharedArrayBuffer, AudioWorklet) is missing — almost always a serving problem (missing COOP/COEP headers), not a hardware ceiling. Re check via start server.py before treating as real. pass: WebGPU + AudioContext + cross origin


problem (missing COOP/COEP headers), not a hardware ceiling. Re check via start server.py before treating as real. pass: WebGPU + AudioContext + cross origin isolation + SharedArrayBuffer + AudioWorklet are all present. Wrap a raw probe result into the immutable JSON receipt described by the R1 exit gate: "Per device limits + capability table." Constants <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


cancelEcho(microphone, reference, delay, gain)

detectDoubleTalk(residual, referenceLevel, thresholdRatio = 0.3)

createBargeInController({ minSustainedFrames = 3 } = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: EchoBargeIn.js — R12 Phase 1 risk spike. "echo reference ring, delay estimation, acoustic echo suppression, double talk detection, no self interruption." — Phase 1. Simplified fixed delay echo cancellation (cross correlation delay estimate + least squares gain fit + direct subtraction), not an adaptive filter (NLMS/Kalman) — enough to prove the architecture correctly distinguishes pure echo from genuine double talk. (Phase 2+) would use a real adaptive filter for real acoustic paths that drift over time; this fixed delay model is a feasibility check. Functions Cross correlation delay estimate: which shift of best predicts . Least squares gain fit: minimizes microphone gain referenceAligned ^2. Commit bargeInConfirmed only when double talk is detected AND sustained for . <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: EchoBargeInProbe.js — R12 Phase 1 risk spike orchestrator. Functions Constants <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


createEndpointController({ frameMs, minSpeechMs = 200, minSilenceMs = 300, maxSegmentMs = 8000 })

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: EndpointController.js — R13 Phase 1 risk spike. "min speech/silence durations, max segment cap, causal commit bits (no lookahead)." — Phase 1. A plain frame counting debounce state machine on top of a boolean VAD decision (e.g. R11's ) — every call only consumes the CURRENT frame's VAD decision plus its own prior internal state, never anything from the future, by construction (no buffering of upcoming frames anywhere in this module). Functions EndpointController.js — R13 Phase 1 risk spike. "min speech/silence durations, max segment cap, causal commit bits (no lookahead)." — Phase 1. A plain frame counting debounce state machine on top of a boolean VAD decision (e.g. R11's ) — every call only consumes the CURRENT frame's VAD decision plus its own prior internal state, never anything from the future, by construction (no buffering of upcoming frames anywhere in this module). <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: EndpointLatencyProbe.js — R13 Phase 1 risk spike orchestrator. Functions Constants <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: EnergyDomains.js — R15 Phase 1 risk spike. "ObservedInputEnergy, GeneratedPhysiologyEnergy, and RenderedOutputEnergy are correctly separated; mic energy is labelled an uncertain acoustic equivalent proxy, not lung pressure." — Phase 1. Three distinct, runtime tagged value types plus an guard that THROWS on cross domain misuse — the concrete mechanism proving the architecture cannot silently conflate "what the mic heard" with "what the physiology model generated" or "what the renderer produced". Classes Energy derived from the real microphone signal. This is explicitly an uncertain ACOUSTIC EQUIVALENT proxy — it correlates with vocal effort but is NOT a measurement of lung pressure, glottal state, or any other physiological quantity (room acoustics, mic gain/placement, and background noise all corrupt the mapping). Method Signature Summary Energy/state produced by the neural physiology model (R6A NeuralPhysiologyState/BreathReservoir) driving the Voice Box. Method Signature Summary Energy of the final rendered PCM output (post Voice Box waveguide render). Method Signature Summary Functions Throws unless — the runtime separation guard. Stand in consumer: drives the Voice Box — must only ever accept generated physiology energy. Stand in consumer: barge in/VAD evidence — must only ever accept observed input energy. Stand in consumer: UI loudness meter for what actually came out of the speakers — must only ever accept rendered output energy. Constants — EnergyDomains.js — R15 Phase 1 risk spike. "ObservedInputEnergy, GeneratedPhysiologyEnergy, and RenderedOutputEnergy are correctly separated; mic energy is labelled an uncertain acoustic equivalent proxy, not lung pressure." — Phase 1.


and RenderedOutputEnergy are correctly separated; mic energy is labelled an uncertain acoustic equivalent proxy, not lung pressure." — Phase 1. Three distinct, runtime tagged value types plus an guard that THROWS on cross domain misuse — the concrete mechanism proving the architecture cannot silently conflate "what the mic heard" with "what the physiology model generated" or "what the renderer produced". <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: EnergyMeterProbe.js — R10 Phase 1 risk spike orchestrator. No dedicated filename exists for R10 in the plan's risk/ page list either (named "mic energy meter.html" in the risk page description text, used here directly). Functions Constants <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


particlevoice/risk/Fft1024Kernel.js
Functions
fft1024Shader()
Constants
Notes & Examples
Where this fits in the training loop

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: Fft1024Kernel.js — R3 Phase 1 risk spike WGSL generator. No raw files (Engine Alignment invariant 1): exports a function, matching the eventual / production kernels. Single workgroup, in workgroup memory, iterative radix 2 Cooley Tukey FFT. One workgroup (512 threads) computes exactly one 1024 point complex FFT; selects which frame of a batch to process, so N frames can be transformed in a single dispatch of N workgroups (needed to batch many overlapping STFT frames for the WOLA test). Direction is a per dispatch uniform, not two separate shaders: forward uses the standard e^{ i2 pi k/N} twiddle; inverse conjugates the input, runs the same forward butterfly network, then conjugates + scales the output by 1/N (IFFT(X) = (1/N) conj(FFT(conj(X)))). Buffer layout (flat, frame major): inputReal/inputImag/outputReal/outputImag are each f32 values; frame f occupies f 1024, f 1024+1024). Functions Constants — Fft1024Kernel.js — R3 Phase 1 risk spike WGSL generator. No raw files (Engine Alignment invariant 1): exports a function, matching the eventual / production kernels. Single workgroup, in workgroup memory, iterative radix 2 Cooley Tukey FFT. One workgroup (512 threads) computes exactly one 1024 point complex FFT; selects which frame of a batch to process, so N frames can be transformed in a single dispatch of N workgroups (needed to batch many overlapping STFT frames for the WOLA test). Direction is a per dispatch uniform, not two separate shaders: forward uses the standard e^{ i2 pi k/N} twiddle; inverse conjugates the input, runs the same forward butterfly network, then conjugates + scales the output by 1/N (IFFT(X) = (1/N) conj(FFT(conj(X)))). Buffer layout (flat, frame major):


runs the same forward butterfly network, then conjugates + scales the output by 1/N (IFFT(X) = (1/N) conj(FFT(conj(X)))). Buffer layout (flat, frame major): inputReal/inputImag/outputReal/outputImag are each f32 values; frame f occupies [f 1024, f 1024+1024). <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: [AGI Training Guide · AGI Architecture


createGlottalSource({ sampleRate, f0AtSample, openQuotient = 0.6, aspirationLevel = 0.0, noiseSeed = 777 })

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: GlottalSource.js — R6 Phase 1 risk spike. A simplified ("LF lite") glottal flow source, not the full Liljencrants Fant model (which requires an iterative numerical solve of its alpha/wg/ ta/b parameters from open/speed quotient — out of scope for a feasibility spike). Each glottal pulse is a raised cosine bump over the open phase of the cycle: flow(n) = 0.5 (1 cos(2 pi n/Topen)) for 0 <= n < Topen flow(n) = 0 for Topen <= n < T This is deliberately C1 continuous and zero at both pulse boundaries — clicks are a discontinuity in the waveform or its derivative, and this shape has neither, by construction, regardless of how F0 (period T) changes from one pulse to the next. (Phase 2) is the real LF implementation this stands in for. Aspiration noise is mixed in proportional to instantaneous flow (breathy voicing), driven by a counter based hash so it is chunk boundary independent (same technique as StreamingContinuitySource.js). Functions Create a glottal source generator. lets callers drive a pitch sweep (F0 varies per absolute sample index); is the fraction of each pitch period the folds are open (typical modal voice 0.5 0.7). Re exports <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


createGpuReadbackRing(device, slotByteSize, slotCount = 8)

async runPipelinedReadbackBenchmark(device, ring, sourceBuffer, byteSize, iterations, maxInFlight, makeFrame, updateBufferFn)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: GpuReadbackRing.js — R4 Phase 1 risk spike. "readback audio.html — 6 8 MAP READ slots, per buffer mapAsync(), no global queue.onSubmittedWorkDone() for normal readback." — Phase 1. A minimal round robin ring of MAP READ COPY DST staging buffers. Each slot is copied into and mapped independently; the only synchronization primitive used is that slot's own promise — there is no call anywhere in this module. Backpressure (more than requests in flight) is the caller's responsibility: throws if no slot is free, so a caller must await/release before requesting more than ahead. This is a disposable Phase 1 probe, not the production — same technique, smaller surface. Functions GpuReadbackRing.js — R4 Phase 1 risk spike. "readback audio.html — 6 8 MAP READ slots, per buffer mapAsync(), no global queue.onSubmittedWorkDone() for normal readback." — Phase 1. A minimal round robin ring of MAP READ COPY DST staging buffers. Each slot is copied into and mapped independently; the only synchronization primitive used is that slot's own promise — there is no call anywhere in this module. Backpressure (more than requests in flight) is the caller's responsibility: throws if no slot is free, so a caller must await/release before requesting more than ahead. This is a disposable Phase 1 probe, not the production — same technique, smaller surface. Run a pipelined readback benchmark: keeps up to mapAsync() requests outstanding at once (never more, never a global wait), writing a fresh frame into before each new request. <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps


Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


particlevoice/risk/HeavySceneKernel.js
Functions
heavySceneShader()
Constants
Notes & Examples
Where this fits in the training loop

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: HeavySceneKernel.js — R9 Phase 1 risk spike. "renderer voice stress.html — voice compute beside a representative heavy ParticleRealms scene." — Phase 1. A fully procedural instanced triangle render (positions/colors derived from @builtin(instance index) in the vertex shader, no vertex/instance buffers needed) standing in for "a representative heavy scene" — many draw time vertices without needing real mesh/scene data for a disposable risk spike. Functions Constants — HeavySceneKernel.js — R9 Phase 1 risk spike. "renderer voice stress.html — voice compute beside a representative heavy ParticleRealms scene." — Phase 1. A fully procedural instanced triangle render (positions/colors derived from @builtin(instance index) in the vertex shader, no vertex/instance buffers needed) standing in for "a representative heavy scene" — many draw time vertices without needing real mesh/scene data for a disposable risk spike. <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: IntegrationManifest.js — R0 Phase 1 risk spike data. Every named ParticleRealms module referenced by the ParticleVoice plan's "Codebase Integration Points" tables (particle voice 26357c.md), with the named exports each entry is expected to provide. dynamically imports each and checks every name in is present on the resulting module namespace, producing a pass/fail/missing receipt. Paths are root relative so they resolve the same regardless of which page imports this manifest (served from the repo root by start server.py). Exports were verified directly against source (grep for ), not assumed from the plan's prose "What it provides" column. Where the plan's description implied an export that does not actually exist at module scope, a field records the discrepancy so the audit page can surface it even on entries that technically "pass" (file imports fine, but a different name provides the capability than the plan implied). Constants — IntegrationManifest.js — R0 Phase 1 risk spike data. Every named ParticleRealms module referenced by the ParticleVoice plan's "Codebase Integration Points" tables (particle voice 26357c.md), with the named exports each entry is expected to provide. dynamically imports each and checks every name in is present on the resulting module namespace, producing a pass/fail/missing receipt. Paths are root relative so they resolve the same regardless of which page imports this manifest (served from the repo root by start server.py). Exports were verified directly against source (grep for ), not assumed from the plan's prose "What it provides" column. Where the plan's description implied an export that does not actually exist at module scope, a field records the


the plan's prose "What it provides" column. Where the plan's description implied an export that does not actually exist at module scope, a field records the discrepancy so the audit page can surface it even on entries that technically "pass" (file imports fine, but a different name provides the capability than the plan implied). <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


async runIntegrationPathAudit({ manifest = INTEGRATIONMANIFEST, importer = (path)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: IntegrationPathAudit.js — R0 Phase 1 risk spike runner. "Dynamic import/export checks for every named ParticleRealms module" — particle voice 26357c.md, Phase 1 / R0 Integration exit receipt. For every entry in IntegrationManifest.js this dynamically imports the module and checks that each expected named export is present on the resulting namespace object. No network/file mutation; read only probing. Functions Run the audit against a manifest. Parameters: (object) — No description in source JSDoc. (Array) — — defaults to the full IntegrationManifest. ((path: string) = Promise<any ) — — override for tests; Returns: audit result with per entry pass/fail/missing detail. Wrap a raw audit result into the immutable JSON receipt described by the R0 exit gate: "JSON file listing every named import, expected export, actual export, result pass/fail/missing." Constants <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


createVocalTract({ numSections, areas, glottalReflection = 0.85, lipReflection = -0.9 })

createNasalBranch({ numSections, areas, nostrilReflection = -0.9 })

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: KellyLochbaumWaveguide.js — R6 Phase 1 risk spike. Single delay per section digital waveguide vocal tract model (Kelly & Lochbaum 1962 scattering junctions, as described in e.g. Julius O. Smith's "Physical Audio Signal Processing"). N cylindrical tube sections with cross sectional areas A[0..N 1] give N 1 internal junction reflection coefficients k i = (A i A {i+1}) / (A i + A {i+1}). Boundary conditions: Glottal end: source flow is injected with a partial reflection ( ) of the wave returning from the tract. Lip end: an idealized open end reflection ( , negative) plus a first difference "radiation" filter approximating the differentiating characteristic of lip radiation. All boundary/junction coefficients are kept strictly inside ( 1, 1), so the closed loop lattice is passive/BIBO stable by construction (no combination of area profile changes can cause unbounded energy growth). Nasal coupling and constriction noise are deliberate simplifications, not a rigorous multi port (3 way) junction scattering derivation — see createNasalBranch() and step()'s constrictionIndex handling. Phase 2's / need the rigorous version; this is enough to prove the overall architecture is stable and produces plausible, controllable behavior. Functions KellyLochbaumWaveguide.js — R6 Phase 1 risk spike. Single delay per section digital waveguide vocal tract model (Kelly & Lochbaum 1962 scattering junctions, as described in e.g. Julius O. Smith's "Physical Audio Signal Processing"). N cylindrical tube sections with cross sectional areas A[0..N 1] give N 1 internal junction reflection coefficients k i = (A i A {i+1}) / (A i + A {i+1}). Boundary conditions: Glottal end: source flow is injected with a partial


N 1 internal junction reflection coefficients k i = (A i A {i+1}) / (A i + A {i+1}). Boundary conditions: Glottal end: source flow is injected with a partial reflection ( ) of the wave returning from the tract. Lip end: an idealized open end reflection ( , negative) plus a first difference "radiation" filter approximating the differentiating characteristic of lip radiation. All boundary/junction coefficients are kept strictly inside ( 1, 1), so the closed loop lattice is passive/BIBO stable by construction (no combination of area profile changes can cause unbounded energy growth). Nasal coupling and constriction noise are deliberate simplifications, not a rigorous multi port (3 way) junction scattering derivation — see createNasalBranch() and step()'s constrictionIndex handling. Phase 2's / need the rigorous version; this is enough to prove the overall architecture is stable and produces plausible, controllable behavior. Linearly interpolated area profile through named (position, area) control points, position in [0, 1]. Simplified nasal branch: its own short KL chain, driven by a coupled fraction of an oral tract tap signal. <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: MatmulBenchProbe.js — R2 Phase 1 risk spike. "matmul bench.html — W8A16 packed INT8 x FP16 matmul, FP32 accumulation, FP16 output; representative TTS shapes; full model cost projection with =30% headroom." — particle voice 26357c.md, Phase 1. Shapes are PROVISIONAL: Phase 0 (spec freeze) has not happened yet, so the plan does not fix concrete model dimensions. These are derived from C:\Coding\PS2\configs\r0.yaml's own "architecture smoke test" convention (d model=256, d ff=4x d model, n layers=6) — the same repo's precedent for sizing a first small model before a full spec exists — combined with this plan's own VoiceChunker steady state chunk bucket (64 frames) and stated mel bin candidate (128). Revisit once spec/DeviceContract v0.md exists. Reuses engine primitives instead of reimplementing device/buffer/pipeline plumbing: GpuDevice (engine/core/gpu/GpuDevice.js), GpuBuffer helpers (engine/core/gpu/GpuBuffer.js), and createComputePipelineChecked (agi/llm/kernels/PipelineUtils.js). Functions Wrap a raw probe result into the R2 exit receipt. Constants <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


referenceMatmul(activations, weightsInt8, scales, M, K, N)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: MatmulReferenceCpu.js — deterministic test vector generation and a plain JS scalar reference matmul for R2 (matmul bench.html) parity checking. Mirrors the dequantization + accumulation order of MatmulW8A16Kernel.js's exactly (same k4 outer / b inner loop) so the only expected divergence between CPU (double) and GPU (f32) is floating point rounding, not algorithmic difference. Functions Int8Array of length K N, logical layout weights[n K + k], values in [ 127, 127]. Float32Array of length M K, layout activations[m K + k], values in [ 1, 1]. Float32Array of length N — typical per channel INT8 quantization scales. Pack logical [K,N] int8 weights into the u32 layout MatmulW8A16Kernel.js expects. Plain JS reference matmul, same math/order as the WGSL kernel. Returns Float64Array[M N]. Max abs and max relative error between a GPU result and the CPU reference. <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


particlevoice/risk/MatmulW8A16Kernel.js
Functions
matmulW8a16Shader()
Constants
Notes & Examples
Where this fits in the training loop

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: MatmulW8A16Kernel.js — R2 Phase 1 risk spike WGSL generator. No raw files (Engine Alignment invariant 1): this module exports a function that returns a WGSL string, same convention as and the eventual . MVP scope for this spike: INT8 weights (4 packed per u32, per output channel scale) x FP32 activations, FP32 accumulation, FP32 output. This is a deliberately smaller slice of the plan's stated "W8A16 packed INT8 x FP16 matmul, FP32 accumulation, FP16 output" — FP16 activation/output packing needs its own bit packing design (2xf16 per u32, gated on from R1) and is left as an explicit follow up rather than an unverified claim. Weight layout expected by this kernel: Logical weights are [K, N] (K = input/hidden dim, N = output dim). Packed as , a u32 whose 4 bytes are the int8 weights for k = k4 4 + 0..3 (little end = lowest k). is the per output channel dequantization scale. K must be a multiple of 4. Functions Constants — MatmulW8A16Kernel.js — R2 Phase 1 risk spike WGSL generator. No raw files (Engine Alignment invariant 1): this module exports a function that returns a WGSL string, same convention as and the eventual . MVP scope for this spike: INT8 weights (4 packed per u32, per output channel scale) x FP32 activations, FP32 accumulation, FP32 output. This is a deliberately smaller slice of the plan's stated "W8A16 packed INT8 x FP16 matmul, FP32 accumulation, FP16 output" — FP16 activation/output packing needs its own bit packing design (2xf16 per u32, gated on from R1) and is left as an explicit follow up rather than an unverified claim. Weight layout expected by this kernel: Logical weights are [K, N] (K = input/hidden dim, N = output dim). Packed as , a u32 whose 4 bytes are


unverified claim. Weight layout expected by this kernel: Logical weights are [K, N] (K = input/hidden dim, N = output dim). Packed as , a u32 whose 4 bytes are the int8 weights for k = k4 4 + 0..3 (little end = lowest k). is the per output channel dequantization scale. K must be a multiple of 4. <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


createNeuralPhysiologyState({ timestampSeconds, respiratoryDrive, glottalState, tractGesture, articulationEvent, uncertainty, })

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: NeuralPhysiologyState.js — R6A Phase 1 risk spike. "NeuralPhysiologyState schema: RespiratoryDriveHead, GlottalStateHead, TractGestureHead, ArticulationEventHead, UncertaintyHead version 0x00010000." — particle voice 26357c.md, Phase 2 (adopted early here for the R6A wiring receipt). No trained model exists yet (that's Phase 3+). This provides the state SCHEMA plus a deterministic scripted stand in ("fake head") that produces plausible per frame physiology values as a pure function of time and an parameter set — enough to prove the wiring ArticulationHead NeuralPhysiologyState BreathReservoir/ParticleTract renderer actually routes control values through to the final PCM, which is what R6A's exit gate asks for. Functions Deterministic scripted stand in for a trained ArticulationHead: a short "utterance" that opens into a steady vowel then applies a brief closure gesture, with and letting a caller apply a physiology intervention and compare against a baseline run. Constants — NeuralPhysiologyState.js — R6A Phase 1 risk spike. "NeuralPhysiologyState schema: RespiratoryDriveHead, GlottalStateHead, TractGestureHead, ArticulationEventHead, UncertaintyHead version 0x00010000." — particle voice 26357c.md, Phase 2 (adopted early here for the R6A wiring receipt). No trained model exists yet (that's Phase 3+). This provides the state SCHEMA plus a deterministic scripted stand in ("fake head") that produces plausible per frame physiology values as a pure function of time and an parameter set — enough to prove the wiring ArticulationHead NeuralPhysiologyState BreathReservoir/ParticleTract renderer actually routes control values through to the final PCM, which is what R6A's exit gate asks for.


NeuralPhysiologyState BreathReservoir/ParticleTract renderer actually routes control values through to the final PCM, which is what R6A's exit gate asks for. <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: OsMediaPermissionProbe.js — R16 Phase 1 risk spike. "Secure context + user gesture + getUserMedia + enumerateDevices + AudioWorklet + SharedArrayBuffer all succeed through kernel.media. / kernel.audio. syscalls; media.audio / audio.play / microphone capabilities are correctly required and enforced by guardSyscalls; OsMediaBridge.js never touches raw navigator.mediaDevices." — Phase 1. does not exist yet (Phase 1 precedes Phase 1+ implementation) — that check is a forward contract placeholder here, not yet applicable. Everything else tests the REAL ( , ) and ( ) directly, not a stand in — this spike is about the OS integration contract itself. Functions Constants <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


createParticleEnergyMeter({ sampleRate, frameSize = 256, attackMs = 5, releaseMs = 60, noiseFloorRecoveryPerFrame = 0.0008 })

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: ParticleEnergyMeter.js — R10 Phase 1 risk spike. "RMS, dBFS, peak, clipping, DC offset, crest factor, attack/release, SNR, low/mid/high band energy, spectral flux; adaptive noise floor while no speech/echo present." — Phase 1. Plain JS CPU implementation (small analysis frames, not a GPU kernel — this is a metering/control path computation, not a bulk DSP kernel like R3's FFT). Includes its own compact FFT for band energy/spectral flux rather than importing Fft1024Kernel.js, which generates a WGSL string for GPU dispatch, not a callable JS magnitude spectrum function — a different form for a different execution context, same algorithm family as MatmulReferenceCpu.js is to matmul w8a16.js. Functions <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


createParticleVad({ sampleRate, frameSize = 256, smoothingMs = 30, riseThreshold = 0.55, fallThreshold = 0.35 })

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: ParticleVad.js — R11 Phase 1 risk spike. "ParticleVAD 1 11 head output smoothness, hysteresis, no flicker; latency p50/p95 of speech start/end decisions." — Phase 1. No trained ParticleVAD 1 model exists yet — this is a heuristic, energy/spectral flux driven stand in (built on R10's ParticleEnergyMeter), not a neural VAD. The plan names "11 continuous probability heads" without enumerating all 11 in the sections read for this spike; the 11 names below are a reasonable, clearly labeled interpretation, not a verified spec. Testing rigor here focuses on the primary head's smoothness/hysteresis/latency, since that is what a heuristic stand in can meaningfully validate. Functions Constants <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: R4ReadbackAudioWorklet.worklet.js — R4 Phase 1 risk spike. "allocation free AudioWorklet." — Phase 1. Reference/mirror target: engine/audio/synth/PatchRunner.worklet.js (SAB parameter reads, no allocation in process()). Consumes a single producer/single consumer PCM ring living in a SharedArrayBuffer (written by the main thread, standing in for what the production path would fill via GPUReadbackRing.js + SharedPCMRing.js). performs zero allocation: no , no object/array literals, no , no , no — only typed array indexing and Atomics on pre existing SharedArrayBuffer backed views. Control layout (Int32Array, SharedArrayBuffer, 4 x int32): [0] writeIndex — next PCM slot the producer will write (main thread) [1] readIndex — next PCM slot this processor will read [2] underrunCount — incremented whenever fewer than one quantum of samples are available [3] processCallCount — incremented every process() call This file cannot be dynamically ed from a normal page context: / only exist inside the AudioWorkletGlobalScope. Load it via . Exports No ES module exports detected in this file. <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


startProducer(ring, sampleRate, initialSamplesProduced = 0)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: ReadbackAudioProbe.js — R4 Phase 1 risk spike. Exit gate: "Per buffer mapAsync() p50/p95/p99; AudioWorklet survives variable quantum and rebuild; one hour zero underrun baseline." — Phase 1. Honest scoping note: a literal one hour automated soak is not run by this probe (impractical inside a single interactive/CI session). This runs a short deterministic soak (SHORT BASELINE SOAK MS) as a scaled down proxy, clearly labeled as such in the receipt, plus an underrun detector self test (proves the zero underrun count is meaningful, not tautological) and a full teardown+rebuild cycle. The full one hour soak is left as an explicit manual/CI follow up — see in the result. "Variable quantum" is not directly controllable from stable browser APIs (render quantum size is fixed at 128 in all current stable implementations); this is verified as a static property of the processor (R4ReadbackAudioWorklet.worklet.js reads for its loop bound rather than assuming 128) plus dynamic survival across two independent AudioContext instances (which may differ in ). Functions Synchronously write of audio into the ring before the worklet node is ever pulled. Absorbs the startup race between the interval based producer's first tick ( PRODUCER INTERVAL MS away) and the AudioWorklet's first process() call, which can happen sooner — without this, a handful of transient underruns at cold start are expected, not a sustained rate problem, but they'd still show up in a "zero underrun baseline" reading. Wall clock paced producer: writes exactly enough samples each tick to match elapsed real time (minus whatever was already prefilled), so it neither underruns (falls behind) nor overflows the fixed capacity ring (a


each tick to match elapsed real time (minus whatever was already prefilled), so it neither underruns (falls behind) nor overflows the fixed capacity ring (a fixed chunk per tick producer would race arbitrarily far ahead of the consumer and wrap/corrupt the ring). Exposed on window for a human/CI to opt into the real one hour soak manually. Constants <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: ReceiptCrypto.js — shared canonicalization + SHA 256 hashing for every Phase 1 risk spike JSON receipt under . Kept tiny and dependency free so any risk page can import it directly. Functions Recursively sort object keys so hashing is independent of insertion order. SHA 256 hex digest of a canonicalized JSON value, or null if WebCrypto is unavailable. Convenience: prefixed digest, or null. <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: RendererVoiceStressProbe.js — R9 Phase 1 risk spike. Exit gate: "Voice + heavy scene runs without audio underruns or persistent render frame drops." — Phase 1. Runs a heavy procedural instanced triangle render pass and a batched FFT "voice compute" dispatch every animation frame, concurrently with R4's real AudioWorklet + SharedArrayBuffer PCM ring (imported directly, not reimplemented), for a few seconds. Measures both render frame time health and audio underrun count over the same window. Functions Constants <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


rms(signal, start = 0, end = signal.length)

peakAbs(signal, start = 0, end = signal.length)

maxAbsDiff(a, b, startIndex = 0, endIndex = a.length)

detectClicks(signal, windowSize = 256, thresholdMultiplier = 12)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: SignalMetrics.js — shared signal quality helpers for Phase 1 risk pages (extracted out of VoiceBoxWaveguideProbe.js when a third consumer appeared, to avoid a third copy paste of rms/peakAbs/hasNonFinite). Functions SignalMetrics.js — shared signal quality helpers for Phase 1 risk pages (extracted out of VoiceBoxWaveguideProbe.js when a third consumer appeared, to avoid a third copy paste of rms/peakAbs/hasNonFinite). <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


particlevoice/risk/StftWolaProbe.js
Functions
async runStftWolaProbe()
async buildStftWolaReceipt(result)
prepareStftWolaReceiptDownload(receipt)
Constants
Notes & Examples
Where this fits in the training loop

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: StftWolaProbe.js — R3 Phase 1 risk spike. "stft wola.html — 1024 point f32 FFT/IFFT and normalized WOLA for 320 sample hop; identity, impulse, sweep, noise tests." — Phase 1. Exit gate: "Identity tests pass; workgroup limits respected; normalized WOLA ripple below audible threshold." Identity tests run a single frame through forward FFT then inverse FFT (both on GPU) and compare to the original signal. The WOLA test runs many overlapping analysis windowed frames through the same round trip, applies a synthesis window, overlap adds, and divides by the exact sum of squares envelope — with exact normalization the round trip is mathematically identity, so any measured "ripple" is real FFT/window/OLA implementation error, not a windowing shape artifact. Functions Constants <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: StreamingContinuityProbe.js — R5 Phase 1 risk spike orchestrator. Pure JS, no GPU/AudioContext dependency: R5's exit gate is an architectural/correctness property of the counter design (does chunking change the output?), not a GPU performance question, so no kernel is needed to validate it. See StreamingContinuitySource.js for the mechanism. Functions Constants <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


synthesizeAbsoluteCounter(totalSamples, sampleRate, f0Hz, noiseSeed, chunkSizes)

synthesizeChunkRelativeCounterBuggy(totalSamples, sampleRate, f0Hz, noiseSeed, chunkSizes)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: StreamingContinuitySource.js — R5 Phase 1 risk spike. Exit gate: "Phase continuous harmonic/noise across arbitrary chunk boundaries; absolute counter noise chunk independent." — Phase 1. There is no dedicated filename for R5 in the plan's risk/ page list (it names R0 R4, R6 R16 pages explicitly but not R5) — this file/page covers that exit gate directly. The technique: every sample's value is a pure function of its ABSOLUTE sample index (harmonic phase = 2 pi f0 n/sampleRate; noise = a counter based hash of n), with no persistent oscillator/PRNG state threaded between chunks and no chunk relative counter anywhere. Chunking therefore cannot affect the output — not "close enough", bit identical — because the per sample computation never reads chunk position at all. This is the mechanism / (Phase 2) must use for random chunk boundary training and streaming to work. Functions Counter based hash PRNG: deterministic pseudo random float in [ 1, 1], pure function of (index, seed). Pure function of absolute sample index — no carried oscillator phase state. Correct (absolute counter) synthesis: chunking (cycled) has zero effect on the output because each sample only ever reads its absolute index , never a position relative to the current chunk. Deliberately buggy (chunk relative counter) synthesis for the self test: resets its local counter to 0 at the start of every chunk, so output DOES depend on how the signal was chunked — used only to prove the bit exact comparison in this probe actually catches phase discontinuity. <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the


Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


createConv1D(inChannels, outChannels, kernelSize, rng)

createAdamW(paramArrays, { lr = 0.01, beta1 = 0.9, beta2 = 0.999, eps = 1e-8, weightDecay = 0.01 } = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: TinyAutodiff.js — R7 Phase 1 risk spike. Hand wired forward+backward layers (Linear, Conv1D, ReLU, Sigmoid), losses (MSE, BCE), and an AdamW optimizer — deliberately NOT a general computational graph autodiff engine. / / (Phase 1, nn/autodiff/) are the real general system; R7's job is to prove models at this parameter scale can be forward+backward trained in browser at all, not to build that general architecture early. All arrays are plain Float32Array with row/channel major layouts documented per function; batch=1 throughout (a single fixed sequence/vector per step) is sufficient for R7's memorization convergence test. Functions TinyAutodiff.js — R7 Phase 1 risk spike. Hand wired forward+backward layers (Linear, Conv1D, ReLU, Sigmoid), losses (MSE, BCE), and an AdamW optimizer — deliberately NOT a general computational graph autodiff engine. / / (Phase 1, nn/autodiff/) are the real general system; R7's job is to prove models at this parameter scale can be forward+backward trained in browser at all, not to build that general architecture early. All arrays are plain Float32Array with row/channel major layouts documented per function; batch=1 throughout (a single fixed sequence/vector per step) is sufficient for R7's memorization convergence test. Clip the global L2 norm across all gradient arrays in place — cheap insurance against a deep stack diverging. <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI


a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


createTinyConv1dModel(rng, sequenceLength = 16)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: TinyModels.js — R7 Phase 1 risk spike model definitions. "1M parameter model, 5M Conv1D model, tiny adversarial audio pair" — particle voice 26357c.md, Phase 1. Exact param counts land close to but not exactly at 1,000,000/5,000,000 (real counts are reported, not fudged to hit a round number) — the plan's own number is an order of magnitude descriptor. Functions 0.93M param MLP: Linear(64,650) ReLU x3 Linear(650,64). 4.5M param Conv1D stack: Conv1D(16,384,5) ReLU, 6x[Conv1D(384,384,5) ReLU], Conv1D(384,16,5). Tiny generator (noise[8] sample[16]) + discriminator (sample[16] real probability). <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: TrainingSpikeProbe.js — R7 Phase 1 risk spike orchestrator. Exit gate: "1M model converges; 5M Conv1D model converges; tiny GAN converges and checkpoints; AdamW memory estimate matches measurement." — Phase 1. "OPFS cache behavior" and "device loss re upload" are also named in the risk page description and covered here. Scoping notes (read before trusting a pass): "Converges" here means memorizes a small fixed random input/target pair (loss drops sharply) — a feasibility/mechanics check, not a generalization claim. "Device loss re upload" exercises the re upload PROCEDURE after an intentional device.destroy(); there is no scriptable public API to force an uncontrolled device loss (crash), so that path is not tested. Functions Constants <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: VadContinuityProbe.js — R11 Phase 1 risk spike orchestrator. Functions Constants <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: VoiceBoxPhysiologyProbe.js — R6A Phase 1 risk spike orchestrator. Exit gate: "ArticulationHead NeuralPhysiologyState BreathReservoir/ParticleTract acoustic renderer receipt; physiology intervention changes final PCM." — Phase 1. No dedicated filename exists for R6A in the plan's risk/ page list either (same situation as R5) — this page covers that exit gate directly. Wires: createScriptedArticulationHead (stand in for the trained model) NeuralPhysiologyState createBreathReservoir createGlottalSource + createVocalTract (R6's waveguide, reused directly, not re implemented) PCM. Renders the same scripted utterance twice — once at baseline, once with a reduced respiratory drive intervention — and requires the two PCM outputs to measurably differ while both remain stable. Functions Constants <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: VoiceBoxWaveguideProbe.js — R6 Phase 1 risk spike orchestrator. Exit gate: "Stable vowels, nasal coupling, closure/release/frication, pitch sweeps with no clicks or energy explosions." — Phase 1. Pure JS/CPU (see KellyLochbaumWaveguide.js header for why): this proves the waveguide algorithm itself is stable and produces plausible, controllable behavior. GPU kernel parity ( etc.) is a separate Phase 2 concern, tested the same way R2 checked matmul parity. Functions Constants <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: WeightPagingProbe.js — R8 Phase 1 risk spike. "Weight page download/recovery/page hash/interrupted download works; device loss re upload succeeds." — Phase 1. No dedicated filename exists for R8 in the plan's risk/ page list — named weight paging.html here. Simulates WeightPageStore.js's core responsibilities: a per page SHA 256 directory, an interrupted download that must retry (not silently drop data), corruption detection via hash mismatch, and multi page device loss re upload (extends R7's single buffer version to several pages). Functions Constants <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


sineSignal(length, sampleRate, freqHz, amplitude = 1.0)

computeSumOfSquaresEnvelope(window, hop, totalLength, numFrames)

peakAbs(a, startIndex = 0, endIndex = a.length)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: WolaSignals.js — deterministic test signals, Hann window, and CPU side sum of squares WOLA normalization/overlap add for R3 (stft wola.html). Functions Linear chirp from f0 to f1 Hz across N samples at sampleRate. sum k window[t k hop]^2 for every output sample t in 0, totalLength). Overlap add windowed frames (each already synthesis windowed) into a flat buffer. Slice a flat signal into overlapping N length frames at the given hop (zero padded past the end). <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: [AGI Training Guide · AGI Architecture


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: GPUReadbackRing.js — Phase 2 ParticleVoice audio bridge. Production generalization of (R4)'s proven round robin staging slot ring — same core technique (each slot is copied into and mapped independently; the ONLY synchronization primitive is that slot's own promise, never a global ), generalized from R4's single fixed size/offset 0 probe surface to the production needs this module's callers ( 's per chunk PCM readback, eventually 's producer side) actually have: a byte offset/length per request (not always the whole buffer from 0), for backpressure introspection instead of only a throw on exhaustion, and GPU buffer accounting via (matching 's own convention for every other buffer this project creates). R4's exit gate ( ) already measured this exact technique's p50/p95/p99 readback latency and zero underrun behavior across an 8 slot ring — this module does not re derive or change that proven synchronization discipline, only widens its calling surface. Classes Method Signature Summary Number of slots currently checked out (acquired but not yet released) — the caller's own backpressure signal, so a producer can throttle before hitting 's exhaustion error. Encode+submit a copy from into , then BEGIN (not await) . Returns the map promise — the caller awaits it whenever convenient; this module never blocks on it internally, matching R4's "no global " discipline. Must only be called after the slot's map promise (from ) has resolved. Returns a Float32Array COPY (not a live view — 's ArrayBuffer detaches on , so this module copies out before the caller releases the slot, matching R4's proven pattern). Functions Constants <! HUMAN NOTES Notes & Examples Where this fits in the training loop


before the caller releases the slot, matching R4's proven pattern). Functions Constants <! HUMAN NOTES Notes & Examples Where this fits in the training loop AGI runs an observation → brain → action → reward loop each tick: observations are gathered from the world, a brain maps them to actions, the rig applies motion, and rewards shape the next update. Example: Minimal training loop See also: AGI Training Guide · AGI Architecture


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: PolyphaseResampler.js — Phase 2 ParticleVoice audio bridge. "ParticleVoice's own DSP runs at 32 kHz internally and resamples via at the audio bridge boundary" — §"Measured lead values" / §7 (measured 48000 Hz on the reference device). No risk spike precedent exists for this module (checked and — the only "resample" hits in are unrelated texture/render resample passes), so this is a fresh CPU side (not GPU kernel) implementation — appropriate for the audio bridge, which is already CPU side per the plan ( , ). Classic Crochiere/Rabiner polyphase interpolator decimator: for an EXACT integer ratio L/M ( / reduced by their GCD — both are integers in practice, e.g. 32000 48000 reduces exactly to L=3, M=2), a single windowed sinc lowpass FIR (cutoff at , designed at the upsampled L inputRate rate to suppress both upsampling images and downsampling aliases) is decomposed into L phase sub filters of taps each. Per output sample, only multiplies are needed regardless of L — the O(tapsPerPhase L) cost is paid once at construction (filter design), not per sample. STREAMING correctness (critical for a chunked audio bridge, where chunks arrive as small windows, not one whole signal): keeps a persistent tail of not yet fully consumed input samples across calls ( / ) and a continuously advancing upsampled domain position ( ), so and concatenated produce IDENTICAL output — verified directly in . Known limitation (documented, not hidden): the FIR filter's group delay ( input samples) means the first ish output samples ramp up from a zero padded history rather than being bit perfect from sample 0 — a normal, bounded FIR startup transient, not a correctness bug (every streaming FIR filter has this).


history rather than being bit perfect from sample 0 — a normal, bounded FIR startup transient, not a correctness bug (every streaming FIR filter has this). Classes Method Signature Summary Clears all persistent filter state — matches 's reset on discontinuity convention (cancellation/interruption), so an audio bridge caller can reset the resampler in lockstep with a ring reset rather than letting stale pre reset history bleed into post reset output. Approximate output latency introduced by this filter's group delay, in output samples. Functions PolyphaseResampler.js — Phase 2 ParticleVoice audio bridge. "ParticleVoice's own DSP runs at 32 kHz internally and resamples via at the audio bridge boundary" — §"Measured lead values" / §7 (measured 48000 Hz on the reference device). No risk spike precedent exists for this module (checked and — the only "resample" hits in are unrelated texture/render resample passes), so this is a fresh CPU side (not GPU kernel) implementation — appropriate for the audio bridge, which is already CPU side per the plan ( , ). Classic Crochiere/Rabiner polyphase interpolator decimator: for an EXACT integer ratio L/M ( / reduced by their GCD — both are integers in practice, e.g. 32000 48000 reduces exactly to L=3, M=2), a single windowed sinc lowpass FIR (cutoff at , designed at the upsampled L inputRate rate to suppress both upsampling images and downsampling aliases) is decomposed into L phase sub filters of taps each. Per output sample, only multiplies are needed regardless of L — the O(tapsPerPhase L) cost is paid once at construction (filter design), not per sample. STREAMING correctness (critical for a chunked audio bridge, where chunks arrive as small windows, not one whole signal): keeps a persistent tail of not yet fully consumed input


(critical for a chunked audio bridge, where chunks arrive as small windows, not one whole signal): keeps a persistent tail of not yet fully consumed input samples across calls ( / ) and a continuously advancing upsampled domain position ( ), so and concatenated produce IDENTICAL output — verified directly in . Known limitation (documented, not hidden): the FIR filter's group delay ( input samples) means the first ish output samples ramp up from a zero padded history rather than being bit perfect from sample 0 — a normal, bounded FIR startup transient, not a correctness bug (every streaming FIR filter has this). Windowed sinc lowpass FIR, Hann windowed, normalized to unity DC gain ( ). is normalized to the