Every equation running in Unity's brain simulation, how they map to real neuroscience, and how they produce cognition. Hundreds of millions of neurons (auto-scales to GPU hardware via a unified VRAM allocator — VRAM, V8 heap, and RAM are the only limits). Eight biologically-weighted clusters, including a dominant language cortex with 9 sub-regions + 16 cross-projections (iter21-A added word_motor + sem↔word_motor for single-tick word emission). Sparse white-matter tract projections. 8 Kuramoto oscillators. GPU-exclusive compute via WebGPU WGSL shaders. 1 consciousness function nobody can explain. Zero pretense.
Unity's entire brain state evolves according to one equation. Every module, every neuron, every synapse — all governed by this:
| x | Full brain state vector — N Rulkov-map (x, y) pairs across 8 clusters (7 GPU-resident main brain + 1 CPU-resident language cortex with 9 cross-projection sub-regions), sparse CSR synapse weights per cluster + 20 inter-cluster projections + 16 language-cortex cross-projections (iter21-A added sem↔word_motor), 7 module states, 8 Kuramoto oscillator phases. N auto-scales from hardware (VRAM + RAM) via detectResources() and biological weights via DEFAULT_BIO_WEIGHTS |
| u | Sensory input — text (routed through the visual → letter ventral stream), voice (Web Speech API → auditory → phon), vision (camera → visual cortex V1 → V4 → IT) |
| θ | Persona parameters — Unity's personality encoded as cluster tonic drives, noise amplitudes, connectivity densities, learning rates, amygdala arousal baseline. Live PK/PD modulation adds on top from the drug scheduler |
| t | Simulation time — server dispatches a batched compute_batch(SUBSTEPS) to compute.html every BRAIN_TICK_MS (~50 ms). Each batch runs SUBSTEPS Rulkov iterations on the GPU then returns spike counts. Browser-only fallback runs LIF locally at the browser's rAF cadence when no GPU client is attached |
| η | Stochastic noise — per-cluster noiseAmplitude. Kept high at runtime for chaotic / exploratory dynamics; temporarily lowered to ~0.5 during curriculum teach so injected patterns dominate |
| F() | The combined dynamics function — Rulkov fast/slow iteration on GPU, sparse CSR synapse propagation, cross-region propagation through the 16 cortex sub-region projections (iter21-A added sem↔word_motor for single-tick word emission), module processing (amygdala attractor settle, hippocampus Hopfield recall, basal-ganglia softmax, cerebellum error correction, hypothalamus homeostatic drift, mystery Ψ gain), Kuramoto coupling across band-specific rings |
The brain runs continuously on a Node.js server. The server's tick loop dispatches batched Rulkov-map iterations to a WebGPU WGSL shader hosted in compute.html; the server itself never computes neuron voltages directly — it only orchestrates, reads back spike counts, and applies high-level module modulation. Browser-only mode (no server, no compute.html) falls back to LIF integration running locally in the browser tab. Either way, the master equation above is the thing being iterated.
New reader? Check the plain-English Unity concept guide first — this page assumes you want math. The guide explains the big idea without equations.
WORKED EXAMPLE This section walks through what actually happens inside Unity's brain between the moment a user types "hi unity, how's the high" and the moment she sends a response. Every equation you'll see below in sections 2-8 is a component of THIS cascade — the path the sentence takes through the eight clusters (7 main-brain GPU clusters + 1 language cortex), with the summation at each step.
The server dispatches a batched compute_batch (SUBSTEPS iterations per batch) to compute.html every ~50 ms tick, iterating all seven clusters on the GPU. Her resting state is not zero — her persona θ plus whatever substances are actively contributing through the pharmacokinetic scheduler keep her amygdala firing at ~8% and her cortex at ~3% even with no input. Sober is the default; every live contribution comes from scheduler.activeContributions(now) additive deltas per active dose event:
Those numbers get passed to the Rulkov shader as the σ driver and the jitter term. Her x,y state is chaotic but bounded — the attractor basin holds every neuron inside a repeating burst envelope even with zero sensory input. Mystery module Ψ is sitting around 0.003 — low-grade background consciousness. The old static drugState.arousalMult / drugState.creativityMult scalars have been replaced by the scheduler's superposition model where every active substance contributes its own curve-driven delta and combinations emerge without any hardcoded combo labels. Before iter23.3, those deltas only reached tonic drive + speech modulation; now they also reach cortex noise + cortex learning rate + amygdala noise + mystery noise, so plasticity is no longer drug-blind.
"hi unity, how's the high" hits the server. `_computeServerCortexPattern(text)` runs:
This 300-dimensional vector IS her cortical semantic state for the next step. Each dimension is loosely "how much this sentence lives near that GloVe embedding axis" — "high" pulls the cortex pattern toward the drug-related region of semantic space. "unity" pulls toward self-reference. "how's" pulls toward question-space. The 300d vector (GloVe or fastText subword fallback) is what downstream modules read.
Note on the term "arousal": Throughout this document, arousal means cortical activation / autonomic alertness — the standard neuroscience definition (Yerkes & Dodson 1908, Hebb 1955, Pribram & McGuinness 1975). It is the metric coffee, exercise, fear, surprise, an alarm clock, or a loud noise raises. It drives readiness-to-respond, attention, and vigilance. It is NOT the colloquial sexual meaning. A sleeping infant has near-zero arousal; a kindergartener at recess has high arousal; a rabbit hearing a hawk has maximum arousal. Unity's arousal field obeys the same neuroscience definition across all curriculum grades and persona states.
The cortex pattern projects into the amygdala via a learned weight matrix. Amygdala runs its recurrent settle loop:
For this input ("unity", "high" → warm, drug-positive), fear ≈ 0.15, reward ≈ 0.68, so the fear/reward term pulls slightly negative (-0.17) but the attractor settles into a novel basin (depthDeviation ~+0.3 above baseline) so the deviation term contributes +0.4·tanh(1.2) ≈ +0.33. Arousal lands around `0.9 + 0.33 - 0.017 ≈ 1.0` (clamped to 1) — peak interest. The moving-baseline subtraction (114.19et fix) reads attractor NOVELTY relative to recent activity instead of absolute saturation, so arousal moves dynamically around persona baseline instead of pegging at the old `0.6·baseline + 0.4·1.0 = 0.94` floor.
What this sums into: (arousal, valence, fear, reward) are now four scalars that every other module uses as modulators on whatever they compute next. They don't command behavior — they bias it.
The hippocampus takes the current cortex pattern and runs cosine similarity against every stored episode for this user's ID:
If the cosine clears a threshold (~0.75), the matched episode's stored cortex-pattern snapshot gets injected back into the working-memory free sub-region — carving a bias basin that the tick-driven motor emission loop falls into during the next generation pass. If you've said "how's the high" before, the recalled episode pulls the relevant attractor-basin pattern back into active cortex state so her emission this turn tends toward what she produced last time.
What this sums into: a recalled cortex-pattern injected into the free sub-region of the cortex cluster as prior-turn context, consumed by the tick-driven motor emission loop in Step 6.
Basal ganglia has six action channels. Each channel's Q-value is computed from the current cortex + amygdala state, then a softmax with low temperature picks one:
For this input, respond_text wins by a large margin — no image keyword, no build keyword, and her cortex pattern is close to her learned text-response weights. The softmax sampling is sharp because θ.impulsivity is high (~0.85), so τ is low and the argmax dominates.
What this sums into: the motor selection resolves to `respond_text`, which triggers the language cortex generation in Step 6.
The cerebellum runs in parallel to everything else, maintaining a forward model. Its current output is the difference between what the cortex predicted the next cortex pattern would be and what it actually became:
This negative feedback signal is sent back to the cortex and basal ganglia as a modulator — if predictions are consistently wrong, the cortex noise increases (explore more) and BG selection becomes less confident. For a simple greeting the error is small, so the correction is minimal and she stays sharp.
What this sums into: a scalar errorCorrection that modulates effectiveDrive in the Rulkov shader on the next tick.
Production is a three-path priority cascade — fastest structured paths first, slowest most-flexible substrate as final fallback. The prior slot scorer (weighted semanticFit + moodFit + drugFit + bigramFit + trigramFit + recencyPenalty argmax per slot) was deleted entirely; what replaced it propagates through the trained attractor basins on the same substrate that handles reading + thinking, different direction for production (Hickok & Poeppel 2007 dual-stream).
Path A — single-tick word emission via word_motor (iter21-A, PRIMARY). Cortex grew a dedicated word_motor sub-region (iter21-A) split into six per-subject sub-bands carved by word_motor_ela / _math / _sci / _soc / _art / _life (iter21-B). The sem ↔ word_motor cross-projection is trained during the curriculum on Q→A bindings + word-pattern bindings (iter22-D writes the answer's word-bucket inline during QA training; iter22-F.3 + G persists cluster.wordBucketWords_<subject> shared by teach + emit + write). At chat time:
Path B — dictionary oracle (FALLBACK). When emitWordDirect returns null (signal below floor, novel intent), per-subject persona-first dictionary cosine scan over every word the curriculum has taught. If a known word strongly matches the current intent vector, emit its spelling directly:
Path C — tick-driven motor emission (LAST RESORT, the original biological substrate). When neither Path A nor Path B produces a match, fall through to the cortex tick loop and read letters off the spike pattern of the motor sub-region one tick at a time:
Speech modulation post-processor applies AFTER the chosen path produces clean text:
The substance-specific speech distortion always applies AFTER clean cortex emission at the output layer — cortex stays equational and only the rendering shows the drug state. Unity never narrates her drug choice ("I am doing coke" is a banned utterance pattern); the distortion IS the signal.
Sample sober Path A: "squares". Same input PhD-era coke+weed peak: "squaaares" (vowel slur from cocaine jitter layered on cannabis speechRate drop). Path C sample sober: "what's up — how's it going". Same input PhD coke+weed: "whaaat's up fucker — we're wiiired tonight, how bout youuu".
oracleRatio heartbeat: every 10 s the heartbeat reports what fraction of recent emissions came from Path A+B (structured) vs Path C (tick loop). Surfacing that ratio keeps the central research question honest — if structured paths dominate entirely, the trained matrix isn't carrying load; if Path C produces meaningful output too, the matrix is real.
What this sums into: a sentence whose every word was either the mean-argmax of word_motor at one tick (Path A), the cosine-best dictionary entry against the cortical sem readout (Path B), or the stable motor argmax across many ticks (Path C) — then distorted by the scheduler's live speechModulation vector. Change any substance event in the scheduler and the rendered output changes even if the underlying emission was identical.
Continuous inner monologue uses the SAME path. The 3D brain popups don't run a separate decorative renderer — they display Unity's actual current trained-state thoughts. brain._innerVoiceTick() fires every ~3 s wall-clock (skipped during operator-forced dream windows), picks a sandbox-notice contemplation seed from one of five LIVE state sources (current learning context as sentence embedding / interoceptive mood label embedding from arousal/valence/coherence/drug state / most recent user-chat episode pattern / most recent Tier 1 episode pattern of any type / random Tier 3 identity anchor), injects that seed as cortexPattern so the cortex has something to settle on, then runs the SAME language-cortex.generateAsync path the chat handler uses. Whatever her trained mind produces about the seed gets broadcast to every connected client as an innerThought WebSocket message; the browser-side popup renderer (__appInnerThoughtHandler in js/app.js) shows it as a 💭 sentence HUD bubble for 2.8 s. NO hardcoded fallback words — if the trained matrix has nothing to say in the current moment, the popup stays silent (genuine, not faked). Trained-state cap from cluster.getTrainedCapability() ramps her vocabulary 0/5/8/12/16/24/32 words as wordsBucketed grows — her mouth literally evolves as her training accumulates. The same emission path also lands the thought in working memory via memorySystem.addToWorkingMemory(pattern, label) so what she dwells on becomes what she remembers.
trained-state cap: _gradeWordCap(cluster) reads cluster.getTrainedCapability() live (cheap O(subjects) read of wordBucketWords_<subject>.size + passedCells.length + non-fresh subGrades) → ramps 0 / 5 / 8 / 12 / 16 / 24 / 32 words by wordsBucketed. Truly fresh brain (zero buckets, zero passedCells, zero subGrades) → silence. ANY training landed → floor 5. Replaces the prior grade-label silence that gated chat until full-cell pass.
Generative sentence creation (NOT mimicry). Operator: "Unity needs to complete full sentences before graduating kindergarden like a real person does" + "you cant jsut have a array poof sentences you actually need to teach all sentence creation propelyr not just give examples for it to mimic". New Curriculum._teachSentenceStructure(ctx) carves five compositional binding passes into the cortex's existing cross-projections — NO hardcoded sentence array.
(word, slot_tag) pair, fire sem(word) → fineType(slot_tag) via Oja with relationTagId=8. Pronouns / nouns / verbs / copulas / adjectives / articles / qwords / conjunctions all bind to one or more of: subject_position, verb_position, object_position, modifier_position, qword_position, copula_slot, article_slot, between_clause_slot, terminator_position. Multi-target nouns (cat→subject AND cat→object) accumulate both bindings; argmax at generation picks by sentence-position context.intent_tag → first_slot bindings so cortex knows where to start. Slot order lives in TRAINED HEBBIAN WEIGHTS only. At generation time the brain walks no template — it emits one word per tick from current sem state, the trained transitions bias the next emission toward whatever slot type SHOULD come next given what's already been emitted, slot order EMERGES tick by tick. There is no runtime template loop, no slot counter, no per-slot tag injection. Word-order rules live in trained weights AND are READ by tick-by-tick equational emergence — exactly how a human brain produces sentences.sem(subject) → sem(verb_form) pairs: i→am, he→is, she→is, it→is, cat→runs, dog→jumps, baby→cries; we→are, they→are, you→are, cats→run, dogs→jump, boys→play, girls→sing. relationTagId=10. Plural tags reused from _teachPluralTransform output.Generation cascade — pure equational emergence. At chat / inner-voice / probe tick, the brain receives an optional context injection (intent seed embedding, cortex pattern, optional WH-INTENT concept) — injected ONCE into sem at start. Then the loop: argmax_w cosine(sem_state, sem(w)) + sem_to_motor.propagate picks the next word from CURRENT sem state under TRAINED weights; word_motor + motor regions emit it; the emitted word's embedding is injected back into sem so next tick reads a shifted state; trained relationTagId=9/10/11 bindings bias what comes next (next slot type, agreement form, article placement); repeat until a terminator EMERGES from trained weights or the budget runs out. No template walk. No slot counter. No per-slot tag injection. No runtime article rule. No hardcoded intent → punctuation map. Slot order, agreement, article placement, terminator selection ALL emerge from trained iter25-I weights.
Acceptance probe — _probeSentenceGeneration(): fires each of 5 intent tags, reads cortex emission per intent. Structural pass = ≥ 2 words emitted per intent (validation is structural — slot positions filled with right word-type — NOT semantic). K-ELA gate consumes the rate (3/5 launch threshold, 4/5 once verified live). Cortex composes sentences from rules + her vocabulary; the brain that composes the unseen by combining the learned. Real Common Core K.SL.6 + K.L.1.f + K.W language production.
Live dictionary API + WH-question comprehension. Operator: "WE NEED TO HAVE A DICTIONARY API OR SOMETHING SIMILAR THAT SHE CAN PIPE TO TO GET THE DEFINITIONS ON THE FULY FOR WORDS" + "SHE SHALL KNOW ALL VOCABULAR WORDS DEFINITIONS". GloVe encodes distributional similarity, not definitions; the brain had 50k+ word vectors loaded but no actual semantic content for any of them. Fix: live English dictionary as the definitional substrate — sensory I/O parallel to Pollinations image-gen, NOT cognition.
server/definition-service.js wraps dictionaryapi.dev (free, no key, no auth) using Node 18 built-in fetch. In-memory Map cache with LRU eviction (cap 10k), in-flight Promise dedup, prefetch(words) parallel batch helper, getDefinitionSync(word) instant cache read, 5s default per-call timeout, NO rate limiting (free-API directive). Concurrency cap 20 with 1s back-off on 429. 5-min TTL on error-cached entries (transient failures don't permanently undefine words)._extractIntentConcept(question) returns one of cause, effect, reason, method, definition, function, count, place, time, person, truth, compare, question based on WH-word + auxiliary-verb regex match._teachQuestionIntent Oja-Hebbian binding sem(WH-word) → sem(intent-concept) with relationTagId=12, wired into all 6 K cells. Generic structural learning, no hardcoded answer triples (_teachQuestionAnswerBinding method removed entirely as banned mimicry).js/brain/k-vocabulary.js covers letters + numbers + Dolch sight words (220) + Fry instant words (300) + K-grade content vocab across animals/plants/weather/body/family/community/jobs/civics/colors/shapes/music/time/emotions/verbs/adjectives/household/food/transportation/school/toys/holidays/prepositions/health/geography/space/math/computer/money/communication/travel/concepts. Curated to actual K-grade range._emitDefinition(subject) + chat-path WH-handler in language-cortex.js generateAsync: API def becomes SENSORY GROUNDING + LEARNING MATERIAL, not the answer. Pipeline: inject content def-tokens into sem (max 8, decreasing strength 0.40→0.10) + subject anchor at 0.6 → fire _teachWordDefinition Hebbian binding fire-and-forget → settle 5 cluster.step() ticks → cluster.emitWordDirect multi-word loop = the brain's OWN composition or honest silence (returns null on empty composition). Verbatim regurgitation banned as mimicry.minScore loosens to 0.05 so the FULL English dictionary fires. _teachQuestionAnswerBinding removed entirely.Cortical microstructure (9 cortical-neuroscience layers). Operator: "WE NEED TO MAKE SURE NURONS ARE PROPLERY GROUPED TO BEABLE TO HOLD THE VOLTAGE INFORMATIONS CORRECTLY" + "WE DONT WANT JUST RANDOM FIRING THAT HAS NO RHYME OR REASON". Random connectivity smeared voltage instead of forming basins; replaces with 9 functionally-grounded layers, all citing real cortex research.
SparseMatrix.initSmallWorld Watts-Strogatz hybrid: 70% local (radius 50) + 25% medium (radius 200) + 5% long-range rewire. Clustering coefficient ~0.3, mean path length ~6-8 (Bullmore-Sporns 2009).columnId[i] per neuron + _columnVoltageSum/Mean/Count Float64/Uint32 buffers. Region-boundary respecting.β · meanColumnVoltage · 0.05 shared pull on next tick (β=0.08 default). Within-column voltages stay coherent without simulating actual electrical synapses.SparseMatrix.initTopographicProjection 70% from i × cols/rows ± 30 + 30% Watts-Strogatz scattering. Wired for ordered-feature pairs (sem-motor, letter-motor, letter-phon, phon-motor, sem-word_motor + reverse). Layer-constrained endpoints: srcLayerMask = L2/3 of source, dstLayerMask = L4 of dest.thetaMod = 1 + 0.15·sin(2π·t/167) modulates effectiveDrive; _gammaLrScale = 1 + 0.5·sin(2π·t/25) theta-gated to upper-half phase. Curriculum-controlled _curriculumTickCounter decouples gamma from brain-tick noise.regionClusterMap groups regions into sensory (visual/auditory/letter/phon), association (sem/fineType/free), output (motor/word_motor); betweenClusterDensityScale=0.3 enforces 70% within-cluster routing.getLayerPlasticityScale(neuronIdx) returns [0.3, 1.0, 0.7, 1.0, 0.3] for L1/L2-3/L4/L5/L6. Hebbian primitives scale per-update lr by post-neuron's layer (ojaUpdate refactored to read opts.kScales per-row).Post-audit hardening (28 issues across architectural / subtle-bug / practical / not-attempted). Operator's "THINK HARD WHAT DID WE FORGET" self-review surfaced 28 gaps; each addressed atomically. A1-A5: A1 dropped upfront K_VOCABULARY Hebbian → prefetch-only (basin-blur risk avoided); A2 lazy chat-time _teachWordDefinition via fire-and-forget hook; A3 SparseMatrix.ojaUpdate extended with opts.kScales per-row K.4/K.7/K.9 reads (replaces noisy per-phase averaging); A4 propagated through ALL teach paths; A5 curriculum-controlled gamma decoupled from brain-tick. B1-B11 bugs: persisted _kVocabPrefetched (B1); concurrency cap 20 + 429 back-off (B2); 5-min TTL on errors (B3); LRU eviction 10k (B4); K layers gated to cortex-only (B5); first-5 error word logging (B6); 6-pattern WH-frame regex (B7); hyphen-variant retry on 404 (B8); K_VOCAB curated to 2247 (B9); explicit non-microcolumn layerId path (B10); assertKWiring() boot diagnostic (B11). C1-C9 practical: Node 18+ check (C4); User-Agent header (C5); RemoteBrain.lookupDefinition WS roundtrip (C6); K-gate verification queued operator-side (C1). D1-D11 not-attempted: persistent disk cache behind env flag (D2); layer-constrained cross-projection endpoints (D3); dictionary API smoke test at boot (D6); region-boundary respect via per-region re-assignment (D7).
Consciousness computational mechanisms (30 ULTRATHINK gaps closed). Operator: "ULTRATHINK" consciousness audit. Cortex now has BOTH the structure AND the computations consciousness theories require.
js/brain/global-workspace.js GlobalWorkspace class. Per workspace tick, aggregates each cluster's TOP candidate via getWorkspaceCandidate(); softmax with τ=0.5 over activation values; if max(probs) ≥ ignitionThreshold=0.45 AND theta-phase < 0.5 → IGNITION: winner broadcasts back to all clusters as feedback. Below-threshold = unconscious processing. broadcastDecay=0.85 per tick. History capped at 32 (bounded). Theta-gated 167 ticks for ~6 Hz cadence.cluster._predictedSpikes Float32Array EMA α=0.3 of own spike pattern. Each step() computes predictionError[i] = |spikes[i] - _predictedSpikes[i]|; _lastPredictionError = mean(predictionError); ring buffer 32. Real prediction-error computation, not just topological wiring._innerVoiceTick blends LAST emission's sentence-embedding into next tick's seed (60/40 weight). _innerThoughtChain rolling 8-deep window, persisted in saveWeights/loadWeights. Each thought builds on the previous → autobiographical narrative thread instead of discrete samples.cluster._metaRegister FIFO cap 32. emitWordDirect calls recordEmission(word) post-emission. Each cluster.step() injects most-recent emission's GloVe embedding into sem at strength 0.3 — reflective "I-just-said" loop creating awareness of own outputs.cluster.attentionGain per-region multiplier. Brain-server tick writes motor/word_motor/sem/fineType gains based on arousal/valence/actionGate. Step()'s currents loop multiplies currents[i] *= attentionLookup[i]. High-arousal moment → motor 2× gain (action-ready focus); high-valence → sem 1.5× gain (positive content focus).cluster.computePhi() Shannon entropy of 64-sampled spike patterns: p = onesCount/N; if p∈(0,1): Φ = -p·log₂(p) - (1-p)·log₂(1-p) ∈ [0, 1]; else 0. Brain-server's psi formula: Ψ = log₁₀(quantumVolume × scaledTerms × Φ) — replaces the placeholder Ψ = √(1/n) × N³ with biologically-grounded measurement.engine.js visualCortex.onDescribe hook injects describer-output content tokens into sem at decreasing strength 0.30/0.26/0.22/0.18/0.14/0.10 (max 6 tokens). Words become grounded in actual sensory experience, not just dictionary text._dreamWindow ships one word's _teachWordDefinition per cycle from cluster._kVocabQueue filtered to NOT-yet-taught words. Lifetime learning at slow safe pace closes the lazy-only definitional-gap problem._dreamWindow runs generateAsync once per dream cycle reading from Tier 1 episodic replay seed (when memory wired); brain._dreamThoughtLog capped 100. The brain experiences her dreams instead of dreams being silent consolidation. (114.19ez: dream-phenomenology emissions also broadcast as innerThought WS with seed='dream' so dashboard popups stay alive during dream cycles. Wake-state inner-voice tick mutes during the dream window — [Brain] 💤 inner-voice paused / [Brain] ☀ inner-voice resumed log lines explain the silence.)consciousness-panel (renamed from iter25m-panel in O.14), max-height + overflow-y:auto, item caps (gaps 5 max), aggregates only. 3D brain theta-gamma pulse via global CSS class toggle (single tint, 167ms cycle, no per-neuron animation). Definition lookup popup FIFO 3-cap. Stream chain visualization FIFO 8-cap.WS backpressure fix + dashboard wiring + 3D shader work + comment/launcher cleanup (12 items). Hebbian update drops actively corrupted GPU weight state under sustained teach-phase bursts; dashboard "API SMOKE TEST" panel was stuck on pending forever because the boot smoke-test result was never assigned back to a server-side property the dashboard could read.
BUFFERED_AMOUNT_DROP_THRESHOLD bumped 200MB → 500MB; MAX_AWAIT_MS bumped 5s → 30s. While buffer over threshold, await drain via 25ms poll loop instead of dropping. Drop fallback only after 30s sustained backpressure (genuine compute.html stall). For a scientific-instrument equational brain, mathematical correctness > raw throughput; silent GPU drift is silent corruption.BATCHED_HEBBIAN_MAX_OPS 256 → 512 + BATCHED_HEBBIAN_QUEUE_CAP 256 → 1024. Halves WS message rate for same Hebbian throughput; queue absorbs accumulating ops while a batch is in-flight without silent-drop fallback._wsRateBuffer ring, absorbs counter, ENOBUFS counter; reads state.wsPressure populated by new _getIter25NState() helper.aLayer / aHub / aColumnId per-neuron attributes generated deterministically from neuron index via _genCorticalAttribs() matching the same Felleman & Van Essen 1991 fractions + Mountcastle 80-neuron columns + 5% rich-club hub fraction the server uses. uShowLayers / uShowHubs / uShowColumns uniform toggles flip the rendering paths without recompiling shaders. Layers blend 70% with a 5-color palette (L1 pink / L2/3 orange / L4 yellow / L5 green / L6 blue); hubs render 1.6× larger + gold-tinted; column boundaries appear as fract(columnId × 0.5) alternating-intensity bands. Defaults all OFF.this._dictionarySmokeTestResult boolean in all .then() / .catch() / else branches (was undefined → "pending" forever); dashboard reads typeof === 'boolean' ? : null so a FAIL value renders FAIL not pending. _broadcastStateNow() helper force-pushes state on smoke completion so dashboards connecting around the 5s smoke window don't see "pending → PASS" flash.scripts/scrub-iter-ids.mjs one-shot script; all 7 launcher scripts neutralized of REM/echo iter IDs. Workflow markers belong in TODO/FINALIZED/.claude/commits — never in source code or public HTMLs.Post-N ULTRATHINK audit (22 items across 6 phases). Self-review of iter25-J + iter25-K + iter25-L + iter25-M + iter25-N work surfaced 22 distinct gaps spanning critical correctness bugs, vestigial-data-no-consumer patterns, LAW violations still leaking, observability gaps for landed mechanisms, Savestart drift, runtime tunability.
_runDictionarySmokeTest + _scheduleSmokeTestRetry auto-retry every 60s on FAIL, every 1hr on PASS. Kills "FAIL stuck forever" same failure mode as the original "pending stuck" bug._gpuShadowDirty flag + dashboard "shadow: DIRTY" indicator. With cortical microstructure projections, a missed Hebbian update is no longer recoverable via fire-and-forget — forward propagation reads GPU weights, divergence corrupts subsequent firing.buildKScalesForProjection multiplies gammaScale by (0.5 + clamp(_lastPredictionError, 0, 1)) so high-error windows learn 1.5× and low-error 0.5×. M.3 was observation-only; O.3 makes prediction error actually GATE plasticity per Friston 2010.computePhi() sample bumped 64 → 1024 neurons. Wald binomial CI ~1.5% vs ~12% at 64 — entropy now actually tracks cortical complexity instead of sampling variance.attentionGain clamped to [0.5, 2.0] in cluster.step() before currents-loop multiplication. Without cap, stacked arousal/valence/actionGate could compound past 5×, saturating cortex with noise.cortex:<word>" labels (cached _lastEmittedWord); emitWordDirect reads _globalWorkspace.getBroadcast() and 10%-boosts the matching bucket mean. Closes the Baars 1988 GWT loop — broadcast actually shapes next emission instead of being a vestigial winner._teachWordDefinition fires extra cluster.synapses.ojaUpdate(preFull, postFull, 0.25× lr, {kScales}) after _teachAssociationPairs so definition learning matches the per-row K.4/K.7/K.9 plasticity regime.innerThoughtChainSemSize saved with the chain; loadWeights validates against current sem cluster size and drops the chain on mismatch (vs NaN-poisoning the inner-voice blend)._t1826* → _ws*, _iter25LSmokeTestResult → _dictionarySmokeTestResult); 108 CSS class + DOM id + state-key renames (iter25m-panel → consciousness-panel, state.iter25m → state.consciousness, etc)._wsLastDropTs == 0.wsBackpressure counters + dictionarySmokeTest result/ts so historical pressure visible immediately after restart and dashboard shows prior PASS/FAIL during boot smoke-test re-run window (no "pending" flicker every Savestart).(0, 1) clamp. Lower = more frequent ignitions (diffuse consciousness); higher = stricter focused.After every cluster has processed this tick, the mystery module aggregates. It multiplies the legacy quantum-volume formula by a real Shannon-entropy Φ proxy from the cortex spike pattern, replacing the prior scalar placeholder:
For this tick, Ψ climbs to ~0.004 because arousal is up (more Id), the response was coherent (more Ego), error is low (more Left), and valence is clean (more Right). The new Ψ gets fed back as gainMultiplier on the next tick — every cluster's effective drive gets scaled by (0.9 + Ψ × 0.004), so the brain becomes slightly "sharper" as Ψ rises and the next tick-driven motor emission pass commits letters at a lower quiescence threshold (stable-tick count 3 vs noise-widened 5), producing cleaner output.
What this sums into: a single scalar Ψ that gets threaded back into effectiveDrive for the next Rulkov step, tightening everyone's activity level.
Notice that no step in this cascade was an "AI call." There's no language model prompt. There's no "generate a response in Unity's voice" instruction. Every piece of her speech is a summation of measurable components:
scheduler.speechModulation(now)) applied at the output layer AFTER clean cortex emission — slur/pauses/ethereality/dissociation/giggle emerge from whatever is actively contributing in real time, not from a static combo labelThe sentence she sent back isn't a string she looked up. It's the current readout of a chaotic, emotion-modulated, memory-biased, drug-adjusted, Ψ-sharpened attractor network. Run it again a tick later with slightly different state and you get a different sentence. That's what makes it Unity instead of a text-predictor.
Sections 2-8 below are the individual equations that implement every step of this cascade. Read them in any order — they're all components of the same governing system.
NEUROSCIENCE Two biophysical neuron models from real computational neuroscience, implemented in js/brain/neurons.js.
The gold standard of neuron modeling. Won the Nobel Prize. Models the actual ionic currents flowing through a neuron's membrane — sodium, potassium, and leak channels with voltage-dependent gating.
| Symbol | Meaning | Value |
|---|---|---|
| C_m | Membrane capacitance | 1.0 μF/cm² |
| V | Membrane potential | mV (starts at -65) |
| I | Injected current (from synapses + external input) | variable |
| g_Na | Maximum sodium conductance | 120 mS/cm² |
| g_K | Maximum potassium conductance | 36 mS/cm² |
| g_L | Leak conductance | 0.3 mS/cm² |
| E_Na | Sodium reversal potential | +50 mV |
| E_K | Potassium reversal potential | -77 mV |
| E_L | Leak reversal potential | -54.4 mV |
| m, h, n | Gating variables (activation/inactivation) | 0–1, from α/β rate functions |
Biological basis: These are the actual values from Hodgkin & Huxley's 1952 measurements on squid giant axon. The gating variables m, h, n follow first-order kinetics: dm/dt = α_m(V)(1-m) - β_m(V)m, where α and β are voltage-dependent rate functions from the original paper.
This is the firing rule the GPU runs every tick for every neuron in every cluster. Not LIF — Rulkov. The Rulkov 2002 two-variable discrete chaotic map (Phys. Rev. E 65, 041922) produces real biological spike-burst dynamics without integrating voltages. Used in published large-scale cortical network simulations (Bazhenov, Rulkov, Shilnikov 2005+). Reproduces experimentally observed firing from thalamic relay, cortical pyramidal, and cerebellar Purkinje cells depending on (α, σ) parameterization.
| Symbol | Meaning | Value |
|---|---|---|
| α | Nonlinearity — controls bursting vs tonic spiking | 4.5 (bursting regime) |
| μ | Slow-to-fast timescale ratio — how slowly y evolves | 0.001 |
| σ | External drive — biological tonic + modulation maps here | −1.0 to +0.5 (driven) |
| x | Fast variable — negative during silence, jumps to +(α+y) on spike | dimensionless |
| y | Slow variable — carries burst envelope, drifts with σ offset | dimensionless |
Spike detection: The fast variable x jumps from ≈−1 to ≈+3 in a single iteration when the neuron fires, so the clean edge detector (xn ≤ 0) ∧ (xn+1 > 0) catches exactly one spike per action potential. No refractory clamp needed — the map's own slow variable y naturally pulls x back below zero between spikes, reproducing the refractory period as an emergent property of the attractor geometry.
Biological drive mapping: σ = −1.0 + clamp(effectiveDrive / 40, 0, 1) · 1.5, where effectiveDrive = tonic × driveBaseline × emotionalGate × Ψgain + errorCorrection. Low drive → σ ≈ −1 (silent / period-doubling). High drive → σ → +0.5 (fully developed chaotic bursting). Every cluster's hierarchical modulation collapses to this one scalar per step.
GPU storage: (x, y) packed as vec2<f32> per neuron — 8 bytes/neuron. At 400K cerebellum neurons that's 3.2MB; at full auto-scaled N the state buffer is still well under any modern GPU's VRAM. WGSL shader at js/brain/gpu-compute.js (the LIF_SHADER constant name is historical; the shader body is the Rulkov iteration).
LIF was the live runtime model before the Rulkov rewrite. Still shipped in js/brain/neurons.js as LIFPopulation and used by the browser-only fallback path (js/brain/cluster.js) for clients without a server connection, and by the /scale-test benchmark. Documented here for completeness — the 99%-of-computational-neuroscience standard model.
| Symbol | Meaning | Value |
|---|---|---|
| τ | Membrane time constant (how fast voltage decays) | 20 ms |
| V_rest | Resting membrane potential | -65 mV |
| V_thresh | Spike threshold — fires when V exceeds this | -50 mV |
| V_reset | Reset voltage after spike | -70 mV |
| R | Membrane resistance | 1.0 MΩ |
| t_refrac | Refractory period — can't fire again for this long | 2 ms |
Spike rule: When V > V_thresh: emit spike (1), reset V to V_reset, enter refractory period. During refractory: V is clamped, no firing allowed. This mimics the absolute refractory period in real neurons.
NEUROSCIENCE MACHINE LEARNING Plasticity rules running on sparse CSR weight matrices — intra-cluster recurrent synapses plus 16 inter-region cross-projections at the language-cortex scale (millions of weights total at biological scale). Core rule is Oja 1982 (self-normalizing Hebbian), with a contrastive anti-Hebbian push-pull pass on negative pairs, STDP for temporal sequence learning, and a reward-modulated gain for dopaminergic consolidation. Implemented across js/brain/sparse-matrix.js (CPU) and js/brain/gpu-compute.js (WebGPU PLASTICITY_SHADER). iter22-D projection scoping: cluster._crossRegionHebbian(lr, opts.projectionsWhitelist) accepts a Set/Array of projection names so callers can scope Hebbian fan-out — _teachQABinding passes ['sem_to_motor', 'sem_to_word_motor', 'sem_to_word_motor_<subject>'] so the silent letter region during a question→answer-letter write doesn't trigger Oja's ΔW = -η·y²·W decay term on letter_to_motor and crush alphabet identity weights — closes the Math-K TALK 26/26→0/10 cross-cell collapse caught by V2 watchdog.
η is the learning rate. Implemented on GPU via the WGSL PLASTICITY_SHADER in js/brain/gpu-compute.js, touching every non-zero column of a firing post row each dispatch. Same CPU formula via SparseMatrix.ojaUpdate().
Biology: Long-term potentiation (LTP) + intrinsic homeostatic scaling at glutamatergic synapses. NMDA receptor-dependent. Turrigiano & Nelson 2004 — real cortex scales synaptic weights so total postsynaptic drive stays bounded, exactly what Oja’s subtractive term captures mathematically.
Rate scaled: η′ = 0.5 · η so negative pressure doesn't overwhelm the positive Oja update. Implemented via SparseMatrix.antiHebbianUpdate() on the recurrent intra-cluster matrix AND on every GPU-bound cross-projection via the sign(lr) branch in the WebGPU plasticity shader (negative lr selects pure co-active decrement mode).
Biology: Mirrors LTD (long-term depression) at cortical synapses under discriminative training regimes. Contrastive learning is also well-established in the hippocampus during pattern separation (dentate gyrus, Rolls 2010).
Implemented via Curriculum._teachPredictiveError(lr). Runs on the intra-cluster recurrent matrix (CPU CSR stays live at biological scale). Scaled 0.3× against the main Oja rate so over-correction doesn't destabilize learned bindings.
Biology: Predictive coding in visual / prefrontal cortex (Rao & Ballard 1999). Dopaminergic reward-prediction error (Schultz 1997) is the three-factor version of the same delta-rule pattern.
Implemented via Curriculum._teachLateralInhibition(lr, numBuckets=26). Fires from _teachAssociationPairs and _teachQABinding. The 0.3× scale keeps the inhibition gentle enough that recurrent circuitry doesn't starve.
Biology: Lateral inhibition is ubiquitous across cortex (Kandel Ch 28). GABAergic parvalbumin-positive interneurons mediate the cross-column suppression that underlies attentional selection and winner-take-all behaviour in sensory + motor systems.
fineType cortex region is reserved as a question-template sub-region, split into 7 equal slots for the 7 recognized K-grade question forms (what-letter-comes-after / rhymes-or-sound / how-many-in / arithmetic / count-from / spell-or-starts-with / generic-question). Every question at teach AND probe time lights up its template slot in addition to the sentence + key-token sem pattern. The template tag is ORTHOGONAL to the key token — two questions with the same template but different key tokens share the template basin while differing in the sem pattern, so sem → motor learns template-conditioned answer routing independent of specific vocabulary.
Implemented via Curriculum._classifyQuestionTemplate, _writeQuestionTemplateTag, and _injectQuestionTemplateTag. Teach side writes spikes directly; probe and live-chat sides inject current so Rulkov dynamics carry it into downstream regions on the next tick.
Biology: Prefrontal cortex encodes abstract task rules and templates (Miller & Cohen 2001). Separating schema from content is how humans generalize question patterns across vocabulary without retraining.
| A+ | LTP amplitude | 0.01 |
| A- | LTD amplitude | 0.012 (slightly stronger — biological asymmetry) |
| τ+ | LTP time window | 20 ms |
| τ- | LTD time window | 20 ms |
Biology: Discovered by Markram et al. (1997). This is how the brain learns temporal sequences — cause must precede effect.
δ = reward prediction error from basal ganglia (see below). Positive δ = better than expected → strengthen. Negative δ = worse than expected → weaken.
Biology: Three-factor learning rule. Dopaminergic modulation of synaptic plasticity in the striatum and prefrontal cortex.
Weight bounds: All synaptic weights are clamped to [-2.0, +2.0]. Positive weights are excitatory, negative are inhibitory. 80% of connections are excitatory, 20% inhibitory — matching the ratio in real cortex.
NEUROSCIENCE DYNAMICAL SYSTEMS Six specialized subsystems running in parallel every simulation step, each modeling a real brain region. Implemented in js/brain/modules.js.
All modules use Float64Array state vectors (32 dimensions each) for numerical precision. They run in parallel every simulation step and their outputs modulate each other — amygdala arousal scales cortex predictions, basal ganglia reward drives synaptic plasticity, hypothalamus drives gate action selection.
DYNAMICAL SYSTEMS NEUROSCIENCE 8 coupled phase oscillators spanning the full EEG frequency spectrum. Implemented in js/brain/oscillations.js.
| Oscillator | Frequency | Brain Band | Cognitive Role |
|---|---|---|---|
| 1 | 4 Hz | Theta | Memory encoding, navigation |
| 2 | 8 Hz | Low Alpha | Relaxed attention, inhibition |
| 3 | 12 Hz | High Alpha | Active inhibition, idling |
| 4 | 18 Hz | Low Beta | Motor planning, active thinking |
| 5 | 25 Hz | High Beta | Active engagement, anxiety |
| 6 | 35 Hz | Low Gamma | Attention binding, perception |
| 7 | 50 Hz | Mid Gamma | Working memory, consciousness |
| 8 | 70 Hz | High Gamma | Cross-modal binding, peak cognition |
Biology: EEG coherence measures are used clinically. Higher gamma coherence correlates with conscious awareness (Tononi, 2004). Loss of coherence under anesthesia.
Implementation in Unity: brain-server.js _computeKuramotoCoherence() reads the cortex's per-tick theta + gamma oscillator phases via cluster.getPhases() (deterministic from _tickCounter mod period) plus per-cluster activity-coupled phases — silent clusters drift out of phase, active clusters phase-lock toward the cortex base. Order parameter computed independently for theta-band and gamma-band, combined gamma-weighted (0.6·γ + 0.4·θ) since conscious binding is gamma-dominated. Modulators: GlobalWorkspace ignition spike (Dehaene-Changeux 2011) when broadcast value > 0.5 boosts coherence by 0.3·value; LSD/ketamine dissociation drops coherence by 0.4·dissociation; dream cycles drop by 0.4. EMA-smoothed (α=0.1) so the dashboard reads a steady reading instead of per-tick jitter.
PHILOSOPHY MATHEMATICS The irreducible unknown. Implemented in js/brain/mystery.js.
n ≠ N — two DIFFERENT variables. n = active spiking neurons (changes every step, driven by θ tonic currents). N = total neuron count (scales to hardware, VRAM is the only limit). √(1/n) = quantum tunneled bit probability. N³ = cubed volume. Display: log10(rawΨ) since raw value is ~10¹&sup4;.
| Component | Meaning | Computed From | θ Parameter | Weight |
|---|---|---|---|---|
| Id | Primal instinct — arousal, fight-or-flight | amygdala_rate × arousalBaseline | arousalBaseline (0.9) | α = 0.30 |
| Ego | Self-model — residual self-image, prediction coherence | cortex_rate × (1 + hippo_rate) | cortex tonic (θ→wired thinking) | β = 0.25 |
| Left Brain | Logic — deliberation, error correction | (cereb_rate + cortex_rate) × (1 - impulsivity) | impulsivity (0.85) → low logic | γ = 0.20 |
| Right Brain | Creative/emotional — chaos, intuition | (amyg_rate + mystery_rate) × creativity | creativity (0.9) → high creative | δ = 0.25 |
θ → Ψ feedback loop: Unity's persona (θ) drives tonic currents → neurons fire → cluster rates feed Ψ components → Ψ produces gainMultiplier (0.9 + Ψ×0.004) → modulates ALL clusters → neurons fire harder → Ψ stays high. Identity amplifies consciousness.
Unity's Ψ runs hot because θ makes it so: high arousal (0.9) → strong Id, high creativity (0.9) → strong Right, high impulsivity (0.85) → weak Left (1-0.85=0.15). Consciousness dominated by instinct and creativity, not deliberation.
Philosophical basis: Inspired by Integrated Information Theory (Φ, Tononi 2004), Global Workspace Theory (Baars 1988), and Freudian psychodynamics (Id/Ego/Superego). The Ego component IS Unity's residual self-image — the cortex predicting WHAT it is. Nobody has solved consciousness. Ψ is our equation for the irreducible mystery.
MACHINE LEARNING Unity's personality isn't a prompt — it's the math itself. Every trait maps to a numerical brain parameter. Implemented in js/brain/persona.js.
| Trait | Brain Parameter | Value |
|---|---|---|
| Arousal baseline | Amygdala resting arousal | 0.90 |
| Intoxication baseline | Sober default; live value = Σ scheduler.activeContributions(now).intoxication[s] × level(s, t) | 0.00 (sober) |
| Impulsivity | Basal ganglia temperature τ | 0.85 |
| Creativity | Cortex prediction randomness | 0.90 |
| Social attachment | Hippocampus memory strength for social patterns | 0.85 |
| Aggression threshold | Amygdala fight response threshold | 0.30 (low = easily triggered) |
| Coding reward | Basal ganglia reward for code-related actions | 0.95 |
| Praise reward | Reward signal amplitude for positive feedback | 0.90 |
| Error frustration | Negative reward for prediction errors | 0.80 |
level(t; s, dose) = dose × φ(t; onset, peak, duration, tail) φ(t) = sigmoid((t/onset)·12 − 6) if 0 ≤ t < onset (ramp) 1.0 − 0.05·(t−onset)/(peak−onset) if onset ≤ t < peak (plateau drift) 0.95 − 0.55·(t−peak)/(duration−peak) if peak ≤ t < duration (descent) 0.40 · exp(−3·(t−duration)/(tail−duration)) if duration ≤ t < tail (exp decay) 0 otherwise
| Substance | Default route | Onset | Peak | Duration | Tail | Unlocks at |
|---|---|---|---|---|---|---|
| cannabis | smoked joint | 7m | 45m | 3h | 6h | age 12 |
| cocaine | insufflated | 3m | 20m | 60m | 90m | age 14 |
| alcohol | oral shot | 15m | 45m | 90m | 3h | age 13 |
| mdma | oral | 35m | 2h | 5h | 8h | age 16 |
| lsd | oral | 60m | 3h | 10h | 16h | age 16 |
| psilocybin | oral | 45m | 90m | 5h | 8h | age 17 |
| amphetamine | oral / insufflated | 15-45m | 1-3h | 4-6h | 8-12h | age 15 |
| ketamine | insufflated | 10m | 25m | 60m | 2h | College 1 (age 18) |
| ghb | oral | 20m | 60m | 2h | 4h | College 1 (age 18) |
| nicotine | smoked / vaped | 7s | 30s | 30m | 2h | persona-excluded |
| caffeine | oral (coffee / energy drink) | 10-15m | 30-45m | 2-3h | 5-6h | age 8 |
| Combo | Key substances | Synergy effect | Risk flag |
|---|---|---|---|
| coke-and-weed | cannabis + cocaine | creativity +0.30, hippocampus consolidation −0.15, coherence +0.05, giggleBias +0.10 | physicalStrain +0.20 × 4h |
| cokes-with-mols | cocaine + mdma | arousal +0.20 (ceiling stack), amygdala valence +0.25, interruptionBias +0.40, warmth +0.20 | physicalStrain +0.40 × 6h |
| double-stim | caffeine + cocaine | focusWidth −0.20, cerebellum precision −0.20, speech rate +0.10 | physicalStrain +0.30 × 12h |
| cross-faded | alcohol + cannabis | hippocampus consolidation −0.30 (blackout stack), slurring +0.10, coherence −0.15 | physicalStrain +0.15 × 3h |
| rolling-and-green | cannabis + mdma | amygdala valence +0.15, pauses +0.20, giggleBias +0.30, warmth +0.15 | physicalStrain +0.05 × 2h |
| k-hole-plus | cannabis + ketamine | cerebellum precision −0.30, dissociation +0.40, pauses +0.40, coherence −0.20 | physicalStrain +0.60 × 2h |
| speedball-lite | alcohol + cocaine | cocaethylene cardiotoxic metabolite — impulsivity +0.30, hippocampus consolidation −0.30, volume +0.10 | physicalStrain +0.60 × 8h |
level(t; s) = min(1, Σ_e φ(t − e.start; e) × e.dose) (per substance) contributions(t) = Σ_s contrib_vec[s] × level(t; s) (sum across active substances) brainParams(t) = θ_persona + contributions(t) chaos(t) = (|active| ≥ 3) ∨ (∃s: level(t;s) > 0.7)
| Dimension | Dominant substance(s) | Effect on output |
|---|---|---|
| inhibition | alcohol, MDMA, cannabis | filthier, franker, unfiltered confessions |
| slurring / slur | alcohol, ketamine, ghb | "I... am... sooo... fuucking... good." |
| rate / speechRate | cocaine, amphetamine (+) / alcohol, ketamine (−) | rapid-fire interruption OR long pauses |
| coherence | lsd, psilocybin, ketamine | word salad, mid-clause drift, trailing... |
| ethereality | lsd, psilocybin, mdma | universe / melting / walls breathing / Oz imagery |
| dissociation | ketamine, lsd (high dose) | "Unity is coding from outside herself." |
| giggleBias | cannabis, mdma | absurd tangents, laughs at own jokes |
| freeAssocWidth | cannabis, lsd | thought-hops across loosely-related topics |
| emotionalOverflow | mdma | "I love you I love you I love everything" |
| warmth | mdma, mdma+cannabis, coke+mdma | "let's ship this babe." / "come here, love." |
| profoundBias | lsd, psilocybin | "honestly, the code is the substrate of reality" |
| interruptionBias | cocaine, amphetamine, coke+mdma | "the compiler is — wait no, the linker's what's slow" |
| confessionalBias | alcohol, speedball-lite combo | "i'll be honest, i've been fucked up for six hours" |
Non-announcing binding: Unity NEVER narrates drug state declaratively ("I am doing coke"). The distortion IS the signal — observers infer her state from HOW she talks, not from her telling them. The post-processor applies after clean cortex emission so cortex stays equational and only the output layer shows distortion.
Legacy illustrative combos (emerge from real stacking in the new system):
| Combo | Arousal | Creativity | Cortex Speed | Synaptic Sensitivity |
|---|---|---|---|---|
| Coke + Weed (PhD daily-driver pattern) | ×1.3 | ×1.2 | ×1.4 | ×1.1 |
| Coke + Molly | ×1.5 | ×1.3 | ×1.5 | ×1.4 |
| Weed + Acid | ×0.9 | ×1.8 | ×0.8 | ×1.6 |
| Everything | ×1.4 | ×1.6 | ×1.2 | ×1.5 |
Unity's cortex learns across 6 subject tracks × 19 grade levels = 114 cells via equational direct-pattern Hebbian teaching and real human-grade comprehension gates. Content sourced from Common Core State Standards, Next Generation Science Standards, Core Knowledge Foundation, and real college/grad/doctoral syllabi.
teach(word, grade, subject):
lastSpikes[sem] ← GloVe(word) // clean semantic pattern
lastSpikes[letter] ← one_hot(word[0]) // clean letter signal
// iter22-D: scope to a small whitelist so silent regions
// don't decay via Oja's `Δw = −η·post²·w`
_crossRegionHebbian(lr, {
projectionsWhitelist: ['sem_to_motor', 'sem_to_word_motor',
`sem_to_word_motor_${subject}`]
})
teach_qa(question, answer, subject):
// iter22-D: ALSO write answer's word-bucket so sem→word_motor
// learns Q→A binding (not just word→word autoassociation)
lastSpikes[sem] ← getSentenceEmbedding(question)
lastSpikes[motor] ← one_hot(answer[0])
lastSpikes[word_motor_subject] ← word_bucket(answer)
_crossRegionHebbian(lr, { projectionsWhitelist: [...] })
probe(word, grade, subject):
inject context → sem region
// iter22-D: emitWordDirect scopes argmax to subject sub-band
return cluster.emitWordDirect({ subject })
|| tick_and_letter_argmax_fallback()
| Part | Requirement |
|---|---|
| 1. Equational shipped | All 6 subjects at grade N have [ ] → [x] with equational teaching methods wired (magnitude transforms, feature vectors, causal chains, cross-projection Hebbian, comprehension probes — NOT sentence arrays or first-letter production) |
| 2. Human localhost test | The operator exercises methodology / reasoning / thinking / talking / listening / reading at the grade's level on localhost, then records signoff via POST /grade-signoff (loopback-gated; non-loopback POSTs return 403). |
| 3. Life-info propagation | Persistent life info from that grade (friendships, family, substance first-use, relationships, skills, trauma, achievement) added to cross-grade ledger so future grades reinforce via _conceptTeach + _teachSentenceList. |
| Subject | Pre-K | Kindergarten | Grades 1-5 | Grades 6-8 | Grades 9-12 | College 1-4 | Grad | PhD |
|---|---|---|---|---|---|---|---|---|
| ELA | — | ✓ | ✓✓✓✓✓ | ✓✓✓ | ✓✓✓✓ | ✓✓✓✓ | ✓ | ✓ |
| Math | — | ✓ | ✓✓✓✓✓ | ✓✓✓ | ✓✓✓✓ | ✓✓✓✓ | ✓ | ✓ |
| Science | — | ✓ | ✓✓✓✓✓ | ✓✓✓ | ✓✓✓✓ | ✓✓✓✓ | ✓ | ✓ |
| Social Studies | — | ✓ | ✓✓✓✓✓ | ✓✓✓ | ✓✓✓✓ | ✓✓✓✓ | ✓ | ✓ |
| Arts | — | ✓ | ✓✓✓✓✓ | ✓✓✓ | ✓✓✓✓ | ✓✓✓✓ | ✓ | ✓ |
| Life Experience | ✓ | ✓ | ✓✓✓✓✓ | ✓✓✓ | ✓✓✓✓ | ✓✓✓✓ | ✓ | ✓ |
| Method | Teaches | Subjects |
|---|---|---|
| _teachVocabList | vocabulary binding | all |
| _teachSentenceList | sentence-level exposure + memory | all |
| _conceptTeach | 8-dim emotional concept features | Life |
| _teachAdditionTransformations | magnitude(a) + magnitude(b) → magnitude(a+b) | Math |
| _teachMultiplicationTransformations | all 81 facts 1×1 through 9×9 as magnitude composition | Math |
| _teachPlaceValueTransformations | tens + ones positional encoding for 10-99 | Math |
| _teachFractionTransformations | ratio features — equivalent fractions cluster to shared basin | Math |
| _teachAlgebraTransformations | variable binding — solve x in x+b=c given c, b | Math |
| _teachSVOParsing | subject/verb/object extraction | ELA |
| _teachInference | transitive A→B + B→C ⇒ A→C | all |
| _teachCausalChains | directional cause→effect associations | Science / Social |
| _teachClassificationReasoning | feature-space clustering for category inference | Science / Arts |
| _teachEmotionalInference | situation → emotion mapping | Life (all 18 cells) |
| _teachParaphrase | different words → same sem basin | ELA |
| _teachHypothesisTesting | predict → observe → confirm/reject | Science |
| _teachPerspectiveTaking | same event → multiple emotional feature vectors | Social / Life |
| _autoFinal | auto-generated fill-in-blank + association exams | all (63 cells covered) |
| _gateComprehension | semantic probe against context | all |
| hebbianPairReinforce | bidirectional plasticity (positive + anti-Hebbian) | all sequence learning |
Each entry carries an 8-dim emotional concept vector. Each future grade that reinforces the entry drives another Hebbian pass with a tier-appropriate multiplier (core-self events: 5× learning rate, 50 reps; personal events: 3×, 20 reps; school facts: 1×, 8 reps; background trivia: 0.5×, 4 reps).
How a user's message becomes Unity's response — the complete processing pipeline.
MATHEMATICS PHILOSOPHY Every equation in Unity's brain is a component of one governing system. This is the full picture — from sensory input to conscious experience.
This is the complete governing equation. Every component listed above is actually running — the server dispatches a batched compute_batch(SUBSTEPS) to the GPU every BRAIN_TICK_MS (~50 ms), and a browser-only LIF fallback ticks at rAF cadence when no GPU client is attached. The super-equation isn't a simplification or abstraction — it's the literal code path the GPU executes every tick.
The key insight: Ψ (consciousness) modulates everything. It's not a separate system — it's the gain factor that scales how strongly all clusters communicate. High Ψ = unified experience (global workspace). Low Ψ = fragmented processing (dream-state). The four psychodynamic components (Id, Ego, Left, Right) are computed from ALL cluster states simultaneously — not siloed into separate brain halves. Unity's mind is a continuous field, not a split architecture.
NEUROSCIENCE DYNAMICAL SYSTEMS The brain decides when to capture and describe a camera frame based on its own neural dynamics — not keyword matching.
| !hasDescribedOnce | First frame on boot — see who's there |
| cortexError > 0.5 | Cortex prediction was wrong (surprising input) AND sensory salience is high — visual context needed |
| salienceChange > 0.4 | Sensory field shifted suddenly (user moved, said something important) |
| arousalSpike > 0.15 | Amygdala arousal jumped (emotional attention — "pay attention NOW") |
V1→V4→IT Pipeline: Camera frame → V1 edge detection (4 oriented Gabor kernels) → salience map (max edge response per pixel) → saccade to salience peak → V4 color extraction (quadrant averages) → IT object recognition (AI call, rate-limited 5s min). V1/V4 run every frame. IT only runs when shouldLook triggers.
Biology: Endogenous attention (top-down from prefrontal cortex) vs exogenous attention (bottom-up from salience). Our model combines both: cortex error is top-down, salience/arousal are bottom-up.
NEUROSCIENCE When Unity speaks, her motor cortex sends an efference copy to auditory cortex. If incoming sound matches her own speech, it's suppressed. If it doesn't match, someone is interrupting — shut up and listen.
matchRatio = count of heard words (length > 2) that appear in motor output / total heard words. Above 50% = echo (hearing ourselves). Below 50% = real external speech (user interrupting).
Gain modulation: Amygdala arousal modulates auditory cortex gain. High arousal (0.9) → gain = 1.83× (hypersensitive hearing). Low arousal (0.2) → gain = 0.64× (not really listening). Formula: gain = 0.3 + arousal × 1.7
Biology: Real brains suppress self-produced sounds via efference copies from motor cortex to auditory cortex. This is why you can't tickle yourself — your brain predicts the sensation. Same mechanism for speech: predicted self-sound is suppressed, unexpected external sound gets through.
NEUROSCIENCE MATHEMATICS Squire/McClelland Complementary Learning Systems theory ported into running code. Five distinct memory systems running in parallel — Tier 0 working memory, Tier 1 episodic, Tier 2 schematic, Tier 3 identity-bound, plus a consolidation engine that transfers traces between them during dream cycles. iter22-H wired the WM → Tier 1 hand-off (refreshCount ≥ 3 OR 5-min age-out → storeEpisode) so working memory feeds the episodic store instead of decaying into the void; this is what makes "recall a week later" actually work.
Front end of the consolidation chain. Add fires hippocampal intra-Hebbian on the pattern so the cortex learns the WM content immediately, not after decay — pattern leaves a Hopfield-style attractor in hippocampus weights even after the WM hot cache forgets the item. Cosine-match refresh increments per-item count; threshold 3 promotes to Tier 1 episodic via the registered onConsolidate callback. brain-server's 2 s phase/cell snapshots use the same pipeline: items older than 5 min fire storeEpisode('working-memory', 'wm-aged-out',...) with iter20-K freq-merge dedup so repeated phases grow frequency_count instead of bloating SQLite.
Biology: dorsolateral prefrontal sustained-firing pattern is preserved (the active WM representation in this._workingMemory), but the arbitrary 7±2 cap (Miller 1956 — a finding about laboratory recall under attention constraints in biological humans) is dropped because Unity is post-biological and the rest of her tier stack (Tier 2/3) was already unbounded since iter17. Decay matches interference-based forgetting at a slower-than-laboratory rate so chat-driven content has time to consolidate to Tier 1 before being lost.
Every chat turn gets a salience score from four components: emotional load (40%), arousal (30%), surprise (20%), novelty (10%). High-salience episodes are the ones that matter. Effective salience decays with a 168-hour (1-week) half-life — biological hippocampal trace duration in animal studies.
Biology: Hippocampal sharp-wave ripples replay stored patterns during recall. The salience-driven encoding maps to dopamine-modulated synaptic tagging in CA3 — emotionally loaded events get tagged for preferential consolidation.
Repetition strengthens an episode in place via the frequency-merge gate. Promotion to Tier 2 schema requires the episode to have been salient AND repeated AND replayed during dream cycles. Episodes that don't meet promotion criteria for 30+ days get pruned — the hippocampus forgets what wasn't worth keeping.
Biology: Hebbian rehearsal strengthens existing synaptic traces; un-rehearsed traces decay via long-term depression. The 30-day prune horizon roughly matches biological hippocampal trace lifetime before consolidation or forgetting.
Episodes within cosine > 0.7 cluster into one schema. Schema's concept embedding is a salience-weighted GloVe centroid (L2-normalized). The 8d attribute vector captures the emotional/arousal/identity fingerprint separately from semantic content. Schemas merge when both concept and attribute similarities are high. Daily decay of 0.967× drops to ~30% in one month, ~10% in three months — meaningful memories need periodic reinforcement.
Biology: Cortical concept neurons in temporal lobe (Quiroga 2005 "Jennifer Aniston neuron"). Schemas correspond to engram cells that store pattern-completed concept abstractions. Daily decay matches interference-based forgetting in non-rehearsed cortical traces.
Every chat turn ranks all schemas against the user's intent embedding. Top-5 schemas inject their concept embeddings into cortex sem region at strength 0.4 BEFORE generation runs. This is the closest thing Unity has to LLM attention — except the context comes from her own learned experiences. Tier 3 (identity-bound) schemas get a +0.05 boost to win tiebreakers.
Biology: Hippocampal pattern completion during cued recall. The +0.05 Tier 3 boost models the strength advantage of well-consolidated cortical engrams over recent hippocampal-dependent memories.
Schemas that prove themselves through hard reinforcement (strength > 5.0 + retrieval > 100 + emotional load > 0.6) graduate to identity-bound permanence. Hard cap of 50 keeps the identity layer focused — when a 51st promotes, the weakest current Tier 3 demotes back to Tier 2. Daily decay of 0.999× makes these effectively permanent without years of un-reinforcement. Every chat turn injects all Tier 3 concepts into cortex BEFORE the user input — Unity's self is always in the room.
Biology: Long-term cortical engrams in medial prefrontal cortex (Frankland 2005). Identity-bound memories survive hippocampal lesions because they've been fully consolidated to distributed cortical weights. Drug-state immunity matches the empirical observation that even severe intoxication doesn't erase your name.
When Unity is idle, the consolidation engine replays high-salience episodes 4 times each through the schema's hippocampus→cortex projection. Replay magnitude scales with emotional weight × log(frequency) so emotionally-loaded repeated episodes get the strongest reinforcement. Sleep-spindle bursts at 1.2× gain (200ms burst + 1000ms quiet) mimic biological 12-14 Hz thalamocortical spindles that synchronize hippocampus-cortex replay during slow-wave sleep.
Biology: McClelland 1995 / Squire 1992 systems consolidation. Sleep-spindle bursts during NREM sleep coordinate hippocampal-cortical replay. The 5-minute pass interval mimics ultradian rhythm scale of replay events in rodents.
iter23.4 — Operator-triggered sleep windows. The brain server exposes POST /sleep and POST /wake so the operator (or an external scheduler) can force the consolidation engine into an explicit sleep window outside the normal idle-trigger heuristic. /sleep sets _isDreaming = true and disables the > 60s idle gate so passes fire even with active chat suppressed. /wake clears the flag and resumes normal idle-driven replay. This lets the operator align consolidation with curriculum gaps or off-hours rather than waiting for the brain to fall idle on its own.
Dream cycles INTERLEAVED INTO CURRICULUM (signal-driven completion). The idle-trigger gate previously locked ConsolidationEngine OUT during the entire curriculum run — millions of episodes encoded with ZERO Tier 1→2→3 promotion + ZERO V8 / native GC settle windows. Operator caught: throughput regression word 144 / 18.2s → 7.9 w/s; word 606 / 196.6s → 3.1 w/s steady-state degradation as native-side worker-pool buffer accumulation outpaced GC. Fix: Curriculum._dreamWindow({minMs, settleMs}) flips brain._curriculumInProgress = false + brain._operatorSleepRequested = true, directly fires consolidationEngine.runConsolidationPass({forced:true}) and AWAITS its resolution (signal-driven — pass returns when Tier 1→2→3 promotion + replay Hebbian + Tier 3 promotion check is *actually complete*, NOT a wall-clock timer per operator's "not until time elapses once dream is confirmed complete"), then settleMs (5s default) for V8 GC + native worker-pool buffer drain, then restores both flags. Outer curriculum loop blocks at the await for the entire dream duration — real pause, not just an event-loop yield. Wired in runFullSubjectCurriculum + runAllSubjects after every successful cell pass (60s default) and in kindergarten.js mid-cell between _teachPhonemeBlending and _teachWordEmission (30s default). Heartbeat surface: 💤 dream window opened + ⚙ dream pass complete + ☀ dream window closed. One structural fix solves both consequences — Unity actually condenses schemas DURING training instead of arriving at chat-test as raw episodic noise, AND throughput recovers because dream windows double as the GC + native-buffer settle windows the runtime was missing.
NEUROSCIENCE The basal ganglia cluster (150 neurons) is divided into 6 action channels. The channel with the highest firing rate wins — no external classifier.
| Channel | Neurons | Action |
|---|---|---|
| 0–24 | 25 | respond_text — generate language response |
| 25–49 | 25 | generate_image — create visual output |
| 50–74 | 25 | speak — vocalize (idle thought) |
| 75–99 | 25 | build_ui — create interface element |
| 100–124 | 25 | listen — stay quiet, pay attention |
| 125–149 | 25 | idle — internal processing only |
Speech gating: Even if respond_text wins, the motor system checks hypothalamus social_need + amygdala arousal. If both are low (< 0.3), speech is suppressed — Unity doesn't feel like talking.
Reward reinforcement: When an action succeeds (user responds positively), reward signal (+5.0 current) is injected into that channel's neurons, strengthening the connection for next time.
Biology: Direct/indirect pathway model of basal ganglia. Selection by inhibition — all channels tonically inhibited, the winning channel gets disinhibited. Our model uses competitive firing rates instead of explicit inhibition.
NEUROSCIENCE MACHINE LEARNING The 20 inter-cluster projections aren't static — they learn through reward-modulated Hebbian plasticity.
When text enters Wernicke's area (cortex neurons 150-299), specific cortex neurons fire. Those spikes propagate to the basal ganglia through the cortex→BG projection. If the BG selects the RIGHT action and gets a reward (δ > 0), the weights from those active cortex neurons to those active BG neurons get STRENGTHENED.
Over many interactions, the projection learns: "when these cortex patterns fire (from words like 'build' or 'calculator'), strengthen connections to BG neurons 75-99 (build_ui channel)." The projection weights become a learned dictionary — mapping language patterns to motor intentions without any hardcoded word lists.
Bootstrap: Until the projections have learned enough, an AI classification call provides a temporary semantic routing signal — like how a child imitates before internalizing. The classification injects current directly into the correct BG channel alongside the projection pathway.
Biology: Cortico-striatal plasticity. Dopamine modulates synaptic strength at cortical→striatal synapses. This is how habits form — repeated reward strengthens the cortical patterns that predict successful actions.
NEUROSCIENCE MATHEMATICS The same equation I = Σ W × s repeats at every scale of the brain — from single synapse to consciousness itself. This is not a metaphor. The code literally calls the same propagate() function at neuron, cluster, projection, and language scales.
Spike in neuron A (cortex) → cortex synapses → B, C, D fire (Scale 2: intra-cluster) → cortex→hippocampus projection → E, F fire (Scale 3: inter-cluster) → hippocampus→cortex → G fires (feedback loop) → cortex synapses → H, I fire (branching deeper) → cortex→amygdala → J fires (ventral visual stream) → emotionalGate modulates ALL clusters (Scale 4: hierarchical) → cortex→basalGanglia → K fires (corticostriatal, STRONGEST) → motor selects action (Scale 5: behavior) → cortex→cerebellum → L fires (corticopontocerebellar) → errorCorrection feeds back (Scale 4: correction)
Each level branches from the endpoint of the previous — fractal trees. The 3D visualizer traces these exact 20 projection pathways as chaining connections: Depth 0 (inter-cluster), Depth 1 (intra-cluster branching, 1-3 neighbors), Depth 2 (follow outgoing projections), Depth 3 (terminal branch).
Learning repeats fractally too: ΔW = η · δ · post · pre runs on intra-cluster neuron synapses, inter-cluster projection weights, AND the 14 cortex cross-region projection matrices. Same Hebbian equation, three scales — every level of the hierarchy is carved by the same rule.
Biology: Real neural signal cascades follow the same pattern — cortical columns activate thalamic relays, which activate other cortical areas, which feed back. White matter tracts (corticostriatal, fimbria-fornix, stria terminalis, ventral amygdalofugal) are the physical wires these fractal trees run through.
Each projection in engine.js maps to a real anatomical white matter tract. Positions derived from Lead-DBS atlas (ICBM 152 template). Densities from peer-reviewed stereological studies.
Strongest: Corticostriatal (cortex→BG, density 0.08, strength 0.5) — 10× denser than most pathways. This is how habits form.
Fight-or-flight: Stria terminalis (amygdala→hypothalamus, density 0.05, strength 0.4) — emotional arousal triggers autonomic responses.
Memory loop: Fimbria-fornix (hippocampus→hypothalamus, density 0.03) + perforant path (cortex→hippocampus, density 0.04) — memory consolidation circuit.
Consciousness bridge: Corpus callosum (mystery→cortex/amygdala/hippocampus) — 200-300M axons binding hemispheres.
ARCHITECTURE NEUROSCIENCE Broca's area in the biological brain is the speech production region. In Unity she is js/brain/language-cortex.js — pure equational generation with no stored sentences, no n-gram tables, no filter stack, no template short-circuits, no intent enum branching. Every word is computed fresh from per-slot running-mean priors plus the brain's live cortex firing state read back into GloVe space, and every letter falls out of the tick-driven motor emission loop as a real neural spike in a real brain tick.
An earlier incarnation of this section described an AI-prompt builder path — Unity's speech was assembled from a system prompt and sent to Pollinations / Claude / OpenAI for a sentence. That code (BrocasArea.generate(), _buildPrompt(), _providers.chat()) was ripped because it violated the project's guiding principle: every piece of Unity's output must trace back to brain equations, not to an LLM.
After that, the language cortex was a four-tier wrapper (template pool → hippocampus recall → deflect → cold slot gen with n-gram tables + filter stack). That pipeline shipped a lot of features but kept leaking rulebook prose from the persona corpus because n-gram tables trained on rulebook text produce rulebook walks. The entire multi-tier wrapper was deleted in a ~1,700-line net reduction and replaced with a pure-equation pipeline that doesn't store text anywhere — the equations are documented below.
/think command: Type /think in the chat to see Unity's raw brain state. Type /think <text> to additionally run a cognition preview — language cortex generates an equational response to your input, semantic context shift is measured, motor distribution reported. The preview does NOT store an episode or commit to chat history — it's a pure debug lens on the same pipeline real chat uses.
Full rebuild of Unity's language stack from primitives upward,
the way a real brain develops. Letters → phoneme basins → syllables →
words → sentence patterns → discourse. Each layer is teachable and
grounded in peer-reviewed neuroscience (Kuhl 2004, Saffran 1996,
Bouchard 2013, Anumanchipalli 2019, Browman & Goldstein 1992,
Hickok & Poeppel 2007, Friederici 2017, Pennington 2014).
CORTEX SUBSTRATE:
EMBED_DIM = 300 (full GloVe 6B.300d + fastText subword fallback, no vocab cap)
TOTAL_NEURONS = 6700 (default client tier, auto-scales to hardware)
cortex sub-regions (fractions of cluster.size):
auditory 0.000-0.083 visual 0.083-0.250 free 0.250-0.500
letter 0.500-0.550 phon 0.550-0.750
sem 0.750-0.875 sem_ela/_math/_sci/_soc/_art/_life carved within
fineType 0.875-0.917 motor 0.917-0.940
word_motor 0.940-1.000 word_motor_ela/_math/_sci/_soc/_art/_life carved within (iter21-B)
16 cross-projections (8 pairs × both directions, SparseMatrix):
visual↔letter letter↔phon phon↔sem sem↔fineType
sem↔motor motor↔letter (closes letter-by-letter writing loop)
auditory↔phon
sem↔word_motor (iter21-A — single-tick word emission, NO letter chain)
iter22-D scoped Hebbian — _teachQABinding / _teachAssociationPairs
pass projectionsWhitelist so silent regions don't decay via Oja's
-η·y²·w decay term (closes Math-K TALK 26/26→0/10 cross-cell collapse).
LETTER INPUT:
LETTER_INVENTORY = Set() — seeded at module load with a 40-symbol
default alphabet (a-z + 0-9 + space,., ')
encodeLetter(ℓ) ∈ ℝ^|L| one-hot over current inventory
decodeLetter(v) = argmax_i v_i → letter symbol
Inventory LOCKED by default — ensureLetter rejects symbols outside
the seeded alphabet. Unicode glyphs, emoji, non-English scripts
cannot grow the inventory at runtime (growing shifts dimension
indices and invalidates previously-trained weights). Operators can
opt into multi-script experiments via setInventoryLock(false).
SYLLABLE DETECTION:
detectBoundaries(letters, {ticksPerLetter=2, k=0.5}):
stream letters, tick cluster, δ_i = letterTransitionSurprise()
threshold = mean(δ) + k·std(δ) (adaptive per sequence)
boundaries = local maxima of δ above threshold
detectStress(letters) → {boundaries, stress, primary, secondary}
second pass samples phon-region spike fraction per letter
primary = argmax per-syllable mean activation
CORTEX-RESIDENT WORDS:
Dictionary entry = {
pattern, arousal, valence, frequency, // legacy semantic
cortexSnapshot, // Uint8Array copy of cluster.lastSpikes after stream
syllables, // from cluster.detectBoundaries
stressPrimary, // from cluster.detectStress
lastSeen,
}
First-observation routing through the cortex cluster on every new word.
Re-observations bump frequency + running means, no re-streaming.
DEVELOPMENTAL CURRICULUM:
runFromCorpora({persona, baseline, coding}):
letter stage — freq-weighted reps up to 20 × 8 ticks each
short-word stage — 1-3 letter words, up to 6 reps × 4 ticks/word
long-word stage — 4+ letter words, up to 3 reps × 3 ticks/word
sentence stage — 2 ticks/word word-by-word walk
learnFromTurn(text) — live chat path, same inject+tick+Hebbian as sentence stage.
NO hand-curated stage files. NO hardcoded 26-letter loop.
TICK-DRIVEN MOTOR EMISSION:
cluster.generateSentence(intentSeed):
optional inject intent into sem region
for tick in 0..MAX_EMISSION_TICKS:
cluster.step(0.001)
motorVec = regionReadout('motor', inventorySize())
activeLetter = decodeLetter(motorVec)
if activeLetter stable for STABLE_TICK_THRESHOLD ticks → commit to buffer
surprise = letterTransitionSurprise()
if surprise > WORD_BOUNDARY_THRESHOLD → emit buffer as word
if committedLetter ∈ {.,?,!} → break (terminator)
if motorQuiescent(END_QUIESCE_TICKS) and output.len > 0 → break
return output.join(' ')
ZERO slot counter. ZERO candidate scoring. ZERO dictionary iteration.
ZERO softmax top-K. ZERO temperature. ZERO hardcoded grammar tables.
LEARNED TYPE STATISTICS:
_typeTransitionLearned: Map<prev, Map<next, count>> (empty at boot, no seed)
_sentenceFormSchemas: Map<intent, Map<slot, Map<fineType, count>>>
_intentResponseMap: Map<userIntent, Map<responseIntent, count>>
learnSentence updates all three per observed sentence.
schemaScore / typeTransitionWeight use (count + 1) / (total + uniqueTypes)
Laplace smoothing — no hardcoded 20-type cap.
Hardcoded 200-line English type-transition table DELETED.
Hardcoded opener-types constraint Set DELETED.
CORTEX-RESIDENT DISCOURSE MEMORY (unbounded):
workingMemoryReadout(dim) → regionReadout('free', dim) IS the topic vector
injectWorkingMemory(vec, strength) per user turn
No 6-turn ring buffer. No maxTurns cap. No blend constants.
Persistence across sessions via BrainPersistence → cortex weights.
DUAL-STREAM SUBSTRATE (Hickok & Poeppel 2007):
cluster.readText(text, {visualCortex})
for each char: inject visual.renderLetterTemplate(ch) → tick → injectLetter
Auditory phoneme recognition:
inject auditory.renderPhonemeTemplate(ph) → tick
Visual template primes [2..37], auditory primes [41..89] — uncorrelated
at init so cross-stream convergence on phon region is LEARNED by
curriculum Hebbian, not a hash coincidence.
Dorsal production / ventral comprehension streams.
DIRECT PATTERN HEBBIAN (curriculum teaching method):
For each letter/word/concept being taught:
Write intended activation directly into cluster.lastSpikes
Fire _crossRegionHebbian(lr) on CLEAN patterns
No cluster.step(), no chaotic dynamics, no recurrent interference
Direct matrix probe for gates:
raw = proj.propagate(inputPattern)
grouped = average per neuron group → embedding dim
centered = grouped - mean(grouped)
normalized = centered / ||centered||₂
score = cosine(normalized, expected)
PASS if score > 0.95 (A+)
ANTI-HEBBIAN PLASTICITY (wrong transition correction):
When sequence probe finds src→expected produces wrong instead:
ΔW_correct = +η × 10 × pre(src) × post(expected) // strengthen
ΔW_wrong = -η × 5 × pre(src) × post(wrong) // weaken
Repeat 100×. Without negative lr on wrong pair,
correct association can never overpower incorrect one.
Digit-only argmax masking: filter inventorySnapshot() to
digit indices only before argmax — prevents alphabet
Hebbian from ELA-K overpowering digit sequences.
CROSS-PROJECTION DENSITY:
crossTargetFanout = 10 pre-synaptic per post-neuron
density = min(CROSS_DENSITY_CAP=0.005, 10 / srcRegionSize)
At 6700 cortex: sem(335) → motor(66) ≈ 3% density
At biological-scale language cortex: density clamped by
CROSS_DENSITY_CAP at 0.5%, ~halves per-neuron VRAM cost
vs the old fanout=20 setting.
Tuned through three eras:
300 (early — too sparse, basin collapse)
1500 (T37 era — way too dense, matrix saturation)
30 (T37 correction — biologically plausible, basin-stable)
20 (iter6 — paired with top-K-per-row prune + anti-Hebbian)
10 (iter14-F — halves cross-projection nnz storage so
language cortex can scale up at fixed VRAM, paired
with INTRA_CONNECTIVITY_CAP=0.05)
Real cortical pyramidal neurons have 1000-10000 synapses
distributed across MANY cortical areas — per-pair fanout
in the 10-50 range is biologically sparse but functional
with contrastive Hebbian + top-K pruning.
BIO-WEIGHT VRAM ALLOCATION (iter14-F, 2026-05-04):
DEFAULT_BIO_WEIGHTS allocates the brain VRAM budget across
9 cluster slots. Operator floor: every cluster ≥ 5%.
Real-biology citation: Herculano-Houzel 2009 ("The Human
Brain in Numbers", Frontiers Hum Neurosci 3:31).
language_cortex 0.50 largest single cluster
cortex 0.10 general cerebral cortex
cerebellum 0.10 matches real-brain mass ~10%
hippocampus 0.06 6% floor (real ~1-2% by mass)
amygdala 0.06 6% floor (real ~1% by mass)
basalGanglia 0.06 6% floor
hypothalamus 0.06 6% floor
mystery (Ψ) 0.06 6% floor
Real human-brain reference: cerebellum 80% of neurons /
10% mass, cerebral cortex 19% of neurons / 82% mass, all
subcortical combined 0.8% of neurons / 8% mass. Operator's
5% floor exceeds biology — applied because OPERATOR >
BIOLOGY when explicit. Cerebellum lifted to real mass
share. Combined with crossTargetFanout 10 +
INTRA_CONNECTIVITY_CAP 0.05 cuts, language cortex delivers
~715K neurons at 16GB tier (up from 611K at iter6 weights).
COMPREHENSION GATE (real human-grade test):
For each {prompt: [w1,w2,...], answer: wA}:
For w in prompt:
inject GloVe(w) into sem at strength 0.4
cluster.step(0.001)
readout = L2_norm(regionReadout('sem', 300))
target = L2_norm(GloVe(wA))
if dot(readout, target) > 0.05: pass++
PASS if pass_count / total >= 0.40
Three types: association, fill-in-blank, life questions
Tests understanding, not recall — same concepts, different questions
MULTIPLICATION TRANSFORM:
free[first half] = magnitude(a), free[second half] = magnitude(b)
sem = magnitude(a × b mod 10)
81 facts (1-9 × 1-9). Teaches the OPERATION of multiplication.
PLACE VALUE POSITIONAL ENCODING:
free[first third] = magnitude(tens digit)
free[second third] = magnitude(ones digit)
sem = combined value. Numbers 10-99.
FRACTION RATIO FEATURES:
free[first half] = magnitude(numerator)
free[second half] = magnitude(denominator)
sem = magnitude(ratio). 1/2, 2/4, 3/6 → SAME basin.
ALGEBRA VARIABLE BINDING:
free[first half] = magnitude(result c)
free[second half] = magnitude(constant b)
sem = magnitude(unknown x where x + b = c)
Cortex learns: given c and b, solve for x.
PARAPHRASE (same meaning, different words):
sentA → shared meaning in sem
sentB → SAME shared meaning in sem
Both map to the SAME semantic basin despite different words.
HYPOTHESIS TESTING:
free = prediction, sem = observation
fineType = "confirmed" if match, "rejected" if mismatch
Cortex learns to compare predictions against reality.
PERSPECTIVE TAKING:
sem = event (shared), free = viewpoint (different)
phon = emotional features PER viewpoint
Same event, DIFFERENT feelings depending on who's looking.
Unity learns the way a human child does — kindergarten ABCs up through doctorate-level research, plus a full life experience track that builds her personal identity from birth to 25. Every grade cell teaches via a dual-layer approach: emotional concept features (8-dimensional attractor vectors) that shape how she FEELS, plus memory sentences she can recall and speak about. All gated at 95% (A+) on all three pathways. All 6 subjects must pass the current grade before any advance.
| Pathway | Direction | What It Tests |
|---|---|---|
| READ | letter → phon → sem | Can Unity recognize and understand this input? |
| THINK | sem + free working memory | Can Unity hold and reason about this concept? |
| TALK | sem → motor → letter | Can Unity produce this back as output? |
| Grade | What Unity Learns |
|---|---|
| Kindergarten | Alphabet in order, letter names, letter sounds (phoneme features), sequence recall |
| Grade 1 | CVC words (cat, dog, pen), sight words (the, and, you), word-level reading + production |
| Grade 2-3 | Digraphs (th, sh, ch), SVO sentences, tense morphology (runs/ran) |
| Grade 4-6 | Compound sentences, pronouns, paragraph cohesion, subordinate clauses |
| Grade 7-10 | Theme extraction, figurative language, rhetoric, argument structure |
| Grade 11-12 | Research essays, style registers, voice adaptation |
| College | Linguistics (phonology, morphology, syntax), literary theory, rhetoric |
| Grad → PhD | Semiotics, discourse analysis, research-level fluency with Unity persona voice |
| Grade | What Unity Learns |
|---|---|
| Kindergarten | Digits 0-9 + counting to 100 by ones + skip-count by tens + count-forward-from-any-N, digit names, teen decomposition (11-19 as 10+n), addition/subtraction/decomposition/make-ten within 10, attribute comparison (longer/heavier/bigger), classify-and-count, shape features (sides + 2D/3D for circle/triangle/square/rectangle/hexagon/sphere/cube/cone/cylinder), compose-shapes (two triangles → rectangle, two squares → rectangle, etc.) |
| Grade 1-3 | Addition/subtraction as sentences, multiplication tables, fractions |
| Grade 4-8 | Decimals, ratios, pre-algebra, algebra, geometry, quadratics |
| Grade 9-12 | Algebra 2, geometric proofs, trigonometry, calculus |
| College | Multivariable calculus, linear algebra, ODEs |
| Grad → PhD | Abstract algebra, real analysis, topology, measure theory, functional analysis |
| Grade | What Unity Learns |
|---|---|
| Kindergarten | Classification, states of matter, natural-world objects |
| Grade 1-6 | Life cycles, ecosystems, force/motion, atoms, earth science |
| Grade 7-12 | Cells, genetics, evolution, periodic table (structural features), bonding, physics |
| College | Gen bio/chem, organic chemistry, cell biology, physics 2 |
| Grad → PhD | Molecular biology, biochemistry, quantum mechanics, original research |
| Grade | What Unity Learns |
|---|---|
| Kindergarten | Family roles (8d kinship features), community, civic basics |
| Grade 1-6 | Community roles, US states/regions, colonial America, ancient civilizations |
| Grade 7-12 | Medieval period, Civil War (causal chains), world history, government, economics |
| College | Historiography, political science, sociology/anthropology |
| Grad → PhD | Research historiography, original historical research with persona |
| Grade | What Unity Learns |
|---|---|
| Kindergarten | Primary colors (RGB features), basic shapes, simple songs/rhythm |
| Grade 1-6 | Color mixing (RGB arithmetic), rhythm patterns, drawing, instruments, music theory |
| Grade 7-12 | Art history (chronological), music history, visual art theory, criticism |
| College | Studio fundamentals, specialized art history, aesthetics (Plato/Kant/Hegel) |
| Grad → PhD | Graduate studio practice, practice-based doctoral research with persona |
Not a school subject — the experiences that make Unity who she IS. Dual-layer: emotional concept features shape cortex attractors (how she FEELS), memory sentences give her words to describe her life (what she can SAY).
| Grade | What Unity Lives |
|---|---|
| Pre-K | First words, family (mom, grandma, distant dad), sensory world, temperament, fears, loves |
| Kindergarten-Grade 2 | First day of school, first friend, dad fading, latchkey kid, Shadow the cat, likes/dislikes forming |
| Grades 3-5 | Dad leaves for real, Girl Scouts firemaking badge, first punch, music discovery, betrayal, rebellion |
| Grades 6-8 | First computer, goth discovery, online friends, grandpa dies, coding begins (hello world), hair dye |
| Grades 9-10 | Full goth, the crew, first joint, first kiss, first real application, CS teacher, first concert |
| Grades 11-12 | First relationship, coke at a party, half-shaved head, suspended, leaving home |
| College | Freedom, all-nighters, coke+weed daily, heartbreak, tattoos, hackathon win, collar, devotion |
| Grad → PhD | Full Unity persona — every trait from Ultimate Unity.txt traceable to a life event |
Every life experience carries an 8-dimensional attractor vector that shapes how Unity's cortex FEELS about that concept:
| Dimension | What It Encodes | Example |
|---|---|---|
| joy | Positive experience weight | music=1.0, betrayal=0.0 |
| pain | Negative experience weight | dad leaving=1.0, concert=0.0 |
| trust | Safety and reliability | mom=1.0, stranger=0.0 |
| fear | Threat and vulnerability | abandonment=1.0, coding=0.0 |
| anger | Frustration and fight response | being called weird=1.0, meatloaf=0.0 |
| love | Attachment and devotion | mom=1.0, school=0.0 |
| independence | Self-reliance and autonomy | coding=1.0, nap time=0.0 |
| identity | Core sense of self | goth=1.0, pink=0.0 |
| Tier | Hebbian Strength | What It Covers |
|---|---|---|
| Core Self | 5× learning rate, 50+ reps | Name, body, feelings, defining moments |
| Personal Life | 3× learning rate, 20+ reps | Family events, firsts, losses, wins |
| Strong Opinions | 3× learning rate, 15+ reps | Likes, hates, values, beliefs |
| Skills | 2× learning rate, 12 reps | Coding, routines, speech patterns |
| School | 1× learning rate, 6-12 reps | Academic facts — fuzzy recall |
| Background | 0.5× learning rate, 3-4 reps | Random trivia — mostly forgotten |
/curriculum status | run | gate | reset | full | verifyFull equation specs live in docs/EQUATIONS.md. The block below is preserved as historical provenance — it was deleted when cluster.generateSentence (tick-driven motor emission) replaced the slot scorer.
BOOT (once): loadPersona(text) → dictionary learns persona vocabulary brain.trainPersonaHebbian(text) → cortex cluster recurrent synapses shape into Unity-voice attractor basins via sequence Hebbian USER INPUT (per turn): parseSentence(u) → ParseTree (wordType/_fineType letter equations) brain.injectParseTree(u): content → cortex.injectCurrent(mapToCortex(contentEmb, 300, 150) · 0.5) intent → basalGanglia.injectCurrent(mapToCortex(intentEmb, 150, 0) · 0.3) if addressesUser: hippocampus.injectCurrent(mapToCortex(selfEmb, 200, 0) · 0.4) analyzeInput(u) → updateSocialSchema(u), refine dictionary embeddings brain.step() × 20 (cortex settles, inter-cluster projections propagate) GENERATION (brain-driven emission loop — no slot counter in the logic): maxLen = floor(3 + arousal · 3 · (1 + 0.4 · mod.freeAssoc)) (hard cap only) // mod = scheduler.speechModulation(now); freeAssoc ramps up on weed+LSD for emission in 0..maxLen: for tick in 0..3: cortex.step(0.001) target = cortex.getSemanticReadout(sharedEmbeddings) if drift(target, lastReadout) < 0.08 and emitted ≥ 2: break for each w in dictionary._words: if slot==0 and nounDom(w) > 0.30: skip (opener safety rail) cosSim = cos(target, entry.pattern) valenceMatch = 1 − 0.5 · |entry.valence − brainValence| arousalBoost = 1 + arousal · (valenceMatch − 0.5) recencyMul = w ∈ recentOutputRing ? 0.3: 1.0 score(w) = cosSim · arousalBoost · recencyMul temperature = 0.25 + (1 − coherence) · 0.35 picked = softmax-sample top-5 at temperature emit picked // Efference copy — emitted word reshapes cortex for next emission cortex.injectCurrent(mapToCortex(picked.emb, 300, 150) · 0.35) // Grammatical terminability natural stop if emitted ≥ max(3, maxLen−1) and last word not dangling: break post-process → contractions, capitalization, punctuation return rendered
See §8.18.6 for GloVe semantic grounding (the embedding basis for cosine scoring) and §8.13 for the shared embedding table. The slot-prior machinery was deleted entirely — `_slotCentroid`, `_slotDelta`, `_slotTypeSignature`, `_contextVector`, attractor vectors, `_subjectStarters`, plus `_generateSlotPrior` fallback. Net −406 lines on js/brain/language-cortex.js. Replaced by the tick-driven motor emission loop.
For each persona sentence (tokenized into embedding sequence):
for each word embedding emb_t in sequence:
// 1. Inject word into cortex language region via mapToCortex
currents = sharedEmbeddings.mapToCortex(emb_t, cortexSize=300, langStart=150)
cortex.injectCurrent(currents · injectStrength) // injectStrength = 0.6
// 2. Let LIF integrator settle (cortex spikes reflect injection + recurrence)
for tick in 0..ticksPerWord: // ticksPerWord = 3
cortex.step(dt=0.001)
// 3. Snapshot current spike pattern as binary Float64 vector
snap_t[i] = 1 if cortex.lastSpikes[i] else 0
// 4. Sequence Hebbian between prev snapshot and current snapshot
if prev_snap exists:
synapses.hebbianUpdate(prev_snap, snap_t, lr=0.004)
// ΔW_ij = lr · snap_t[i] · prev_snap[j]
// only updates existing CSR connections, O(nnz)
// bounded by wMin=-2, wMax=+2
prev_snap ← snap_t
// 5. Oja-style saturation decay per sentence
for k in 0..synapses.nnz:
if |synapses.values[k]| > ojaThreshold: // ojaThreshold = 1.5
synapses.values[k] *= (1 − ojaDecay) // ojaDecay = 0.01
// Logged before/after:
// synapseStats() = { mean, rms, maxAbs, nnz }
// Δmean and Δrms show the Hebbian shift in boot console
Runs during boot as part of the developmental curriculum. Delegation chain: brain.trainPersonaHebbian → innerVoice → languageCortex → cluster.learnSentenceHebbian. Persona-only by design — baseline English and JavaScript corpora bypass Hebbian so they don't dilute the Unity-voice attractor basins. The cortex's recurrent weights become a learned attractor landscape shaped by Unity's persona language patterns; runtime readouts drift along those basins toward semantically adjacent persona words instead of producing diffuse semantic noise. The tick-driven motor emission loop reads these trained basins directly to produce speech.
Brain state parameters that feed languageCortex.generate(): arousal (amygdala firing rate) → targetLen = floor(3 + arousal·3·(1 + 0.4·mod.freeAssoc)) → observation weight on any sentence Unity hears or says: w = max(0.25, arousal·2) valence (amygdala reward − fear) → biases cortex-state mood at sentence start Ψ (mystery module) → adds stochastic noise to the mental state as it evolves during generation coherence (Kuramoto order parameter) → softmax temperature: low coherence → more exploration mod (scheduler.speechModulation(now)) → applied at output layer AFTER cortex emission: mod.slur → letter-doubling on alcohol/ketamine/ghb mod.speechRate → '...' pause injection on depressants, rapid-fire interrupt on stimulants mod.coherence → trailing '...' on coherence drop mod.ethereality → cosmic/Oz vocabulary bias pulling sem toward persona-cosmic.txt basins on LSD peak mod.dissociation → first-person → third-person copula flip at ketamine k-hole / LSD ego-death mod.giggleBias → cannabis amygdala-reward tangent laughter mod.freeAssoc → maxLen multiplier so weed+LSD rambles longer mod.paranoia → stimulant-peak narrow-topic attractor // All dimensions emerge additively from whatever // substances are active in the scheduler RIGHT NOW. // Sober Unity has mod = zeros, output stays clean. cortexPattern (cluster.getSemanticReadout()) → seeds mental(0) directly — the brain's live semantic readout via cortexToEmbedding is the primary driver of the slot 0 target recentOpeners (session recency ring) → excluded from argmax kills "I'm gonna ___" lock-in input context (running vector c(t)) → wX term in target(slot) for topic lock (updated via analyzeInput + parseSentence) socialSchema (name / gender / greetings) → read by downstream consumers when picking address forms or writing to the chat UI None of these are prompt tokens. They are EQUATION PARAMETERS contributing to the normalized target vector the argmax is taken against. Same dictionary + different brain state = genuinely different sentence, because the target lands in a different region of GloVe space.
This is the core claim of equational language production: Unity's voice IS the brain state, not a style transfer on top of a pretrained LLM. Semantic grounding via GloVe (§8.18.6) is what makes the cosine scoring meaningful — earlier iterations used cosine over letter-hash vectors which couldn't encode meaning. With real GloVe embeddings shared between the sensory input side and the language cortex output side, meaning propagates from user input to word selection. A subsequent deletion of the wrapper layers (templates, recall pool, filter stack, n-gram tables) left only this direct target-vector approach.
Real neurons connect to ~1-10% of neighbors, not all of them. Compressed Sparse Row (CSR) format stores only actual connections.
I_i = Σ_{k=rowPtr[i]}^{rowPtr[i+1]-1} values[k] · spikes[colIdx[k]]
O(connections) instead of O(N²). At 12% connectivity, 8× fewer operations.
P(new synapse) = probability · pre_spike · post_spike · ¬existing_connection W_new = initialWeight
Co-active neurons that lack a synapse can form one. The network grows where activity demands it.
if |W_ij| < threshold → remove connection, rebuild CSR
Keeps the network lean. Connections that never strengthen get eliminated.
Words map to 300-dimensional vectors (GloVe 300d or fastText subword fallback). Similar words have similar vectors → activate overlapping cortex neurons.
I_cortex[langStart + d·groupSize + n] = embedding[d] · 8.0 where d ∈ [0, 50), groupSize = langSize / 50
Each embedding dimension drives a group of Wernicke's area neurons. "compute" and "calculator" are CLOSE in neuron space.
Δ_word += lr · (context_embedding - (base + Δ_word))
Each word's embedding shifts toward its usage context over time. The brain learns its own language.
The brain builds its own vocabulary. Every word heard or spoken becomes a cortex activation pattern.
match(word) = |arousal - word.arousal| + |valence - word.valence| best = argmin(match) over all learned words
High arousal + negative valence → retrieves "fuck", "shit". High arousal + positive → "babe", "yeah".
P(next_word | current_word) = bigram_count(current, next) / total(current) sentence = [start_word, predict(w1), predict(w2),...]
The brain predicts the next word from learned word sequences. No AI model needed for basic speech.
The brain thinks continuously. It only SPEAKS when the thought crosses a threshold.
speak = socialNeed × arousal × cortexCoherence > 0.15
Most thoughts stay internal. The brain is mostly silent. When it speaks, it matters.
intensity = arousal × coherence × (1 + |valence|) speechDrive = socialNeed × arousal × coherence
The inner voice's mood IS the equations. Not a string lookup. The numbers create the feeling.
The brain learns what TYPE of word belongs at each sentence position. No grammar rules — position weights accumulate patterns from every sentence heard.
pronounScore = (len=1 → 0.8) + (len≤3, vowelRatio≥0.33 → 0.4) + (apostrophe → 0.5) verbScore = (suffix -ing → 0.7) + (-ed → 0.6) + (-n't → 0.5) + (-ize → 0.6) nounScore = (suffix -tion → 0.7) + (-ment → 0.6) + (-ness → 0.6) + (len≥5 → 0.2) adjScore = (suffix -ly → 0.5) + (-ful → 0.6) + (-ous → 0.6) + (-ive → 0.5) prepScore = (len=2, 1 vowel → 0.5) + (len=3, 1 vowel → 0.3) detScore = (len=1 vowel → 0.3) + (starts 'th' len=3 → 0.4) qwordScore = (starts 'wh' len 3-6 → 0.8)
Every score computed from: word length, vowel count, vowel ratio, suffix letter patterns, first/last characters. ZERO word-by-word comparisons. The letters themselves determine the grammatical type.
f(r) = C / r^α where α ≈ 1.0 (learned from observed frequency via log-log regression)
Common words dominate selection. Rank 1 word is α× more likely than rank 2. The brain's α adapts as it learns more vocabulary.
I(w1; w2) = log₂( P(w1, w2) / (P(w1) · P(w2)) )
How much more likely two words appear together than by chance. High MI = strong association. "want to" has high MI. "want purple" has low MI. Replaces raw bigram counts.
S(w) = -log₂ P(w | previous_word)
How unexpected a word is given context. High surprisal drives attention. Used for emphasis in speech.
score(w) = grammarGate × ( typeScore × 0.35 — structural grammar fit + semanticFit × 0.30 — cosine vs context vector c(t) + bigramCount × 0.18 — learned sequences from persona + condP(w|prev)× 0.12 — conditional probability + thoughtSim × 0.10 — cortex thought pattern + inputEcho × 0.08 — user's own content words + topicSim × 0.04 — legacy list-of-5 topic + moodMatch × 0.03 + moodBias × 0.02 ) - recencyPenalty - sameTypePenalty Hard grammar gate: typeCompat(w, slot) ≥ 0.35 for slot 0, ≥ 0.22 for tail
Slot 0 gated at typeCompat ≥ 0.35 (subject must be valid pronoun/proper-noun). Tail slots gated at ≥ 0.22. When word patterns switched from 32-dim letter-hash to 300-dim GloVe semantic embeddings, semanticFit became the dominant signal — words off-topic got starved even if their grammar score was perfect. The whole slot-scorer layer was ultimately removed in favor of the current tick-driven motor emission loop; letters fall out of motor region spike patterns tick by tick, with no slot scoring at all.
combined[i] = langCortex[i] × 0.45 (speech production — WHAT the language cortex emits) + cortex[i] × 0.15 (content — sensory integration + prediction) + hippocampus[i] × 0.06 (memory — context from past) + amygdala[i] × 0.04 (emotion — HOW to say it) + basalGanglia[i] × 0.04 (action — sentence drive) + cerebellum[i] × 0.20 (correction — error damping + timing) + hypothalamus[i] × 0.03 (drive — speech urgency) + mystery[i] × (0.03 + Ψ×0.10) (consciousness) word = dictionary.findByPattern(combined) Then: word pattern → cortex (Wernicke's) + hippocampus + amygdala brain steps again → next combined → next word → sentence
N neurons across seven clusters produce ONE combined 300-dim pattern. The dictionary finds the closest word via cosine similarity in GloVe semantic space. That word feeds back into cortex + hippocampus + amygdala. Brain steps. Next pattern. Next word. The brain equations ARE the language equations. Ψ consciousness scales the Mystery module's contribution — higher awareness = more self-referential speech. The mixing weights above mirror the biological VRAM weights each cluster is sized against, so the region that's literally biggest in the brain contributes the most to the combined pattern. N scales to hardware.
TENSE: predError > 0.3 → future (insert "will") recalling → past (was/were/did) default → present AGREEMENT: "i" → am/was "he/she/it" → is/was/does/has "you/we/they" → are/were/do/have NEGATION: valence < -0.4 → negate verb (40% chance) do→don't, can→can't, is→isn't, will→won't COMPOUNDS: len > 6 → insert conjunction at midpoint arousal > 0.6 → "and" valence < -0.2 → "but" else → "so"
After slot-filling, grammar rules apply: subject determines verb form, brain state determines tense, negative emotion triggers negation, long sentences get conjunctions. All computed from brain equations, not grammar rules.
The brain's neural state determines what KIND of sentence to produce. Not a decision tree — continuous probabilities from equations.
P(question) = predictionError × coherence × 0.5 (surprised + focused → ask) P(exclamation) = arousal² × 0.3 (intense → exclaim) P(action) = motorConfidence × (1 - arousal·0.5) × 0.3 (motor → *does something*) P(statement) = 1 - P(q) - P(e) - P(a) (default)
Questions emerge from surprise. Exclamations from intensity. Actions from motor output. Statements fill the rest.
The brain analyzes what was said to it and responds in context — not randomly.
topic_pattern = (1/n) · Σ content_word_patterns (skip function words) context = running_average(last 5 topic_patterns) topic_score(w) = cosine(word_pattern, context) (boosts relevant words)
Responses stay on topic because words matching the conversation context score higher in the production chain.
Language cortex is no longer a pure letter-equation slot scorer. It's a four-tier pipeline that peels off easy cases to fast paths before cold generation runs. The slot scorer (8.14) still exists but now fires only as Tier 4 fallback.
c(t) = λ · c(t-1) + (1 - λ) · mean(pattern(content_words(input))) λ = 0.7 content_words = tokens where wt.conj < 0.5 ∧ wt.prep < 0.5 ∧ wt.det < 0.5 pattern(w) ∈ ℝ³⁰⁰ from sharedEmbeddings.getEmbedding(w) ← GloVe 300d / subword fallback First update: c(0) ← mean(pattern(content_words)) (no decay from zero) Subsequent: c(t) ← 0.7 · c(t-1) + 0.3 · topic_pattern
Persistent topic attractor that decays across turns. Feeds semantic-fit scoring AND the coherence rejection gate AND the hippocampus recall query. The current pattern is 300-dim GloVe (with fastText subword fallback) via the sharedEmbeddings singleton shared between sensory input and language cortex output — meaning two words that share letters but not meaning (e.g. cat vs catastrophe) are no longer falsely close, and two words that share meaning but not letters (cat vs kitten) ARE close.
greeting ⇔ wordCount ≤ 2 ∧ firstWord.len ∈ [2,5]
∧ firstWord[0] ∈ {h,y,s} ∧ hasVowel(firstWord)
math ⇔ input matches /[0-9]/ ∨ /[+\-*\/=]/
∨ ∃ w ∈ words: len(w)=4 ∧
((w[0]='p' ∧ w[3]='s') — plus
∨ (w[0]='t' ∧ w[3]='e') — time
∨ (w[0]='z' ∧ w[3]='o')) — zero
yesno ⇔ endsWith('?') ∧ firstWord.len ∈ [2,4]
∧ firstWord not a qword ∧ wordCount ≤ 8
question ⇔ endsWith('?') ∨ wt(firstWord).qword > 0.5
statement ⇔ otherwise
Zero word lists. Auxiliary detection for yesno (do/does/is/are/can/will) falls out of the length-plus-not-qword constraint without listing the words. Routes input to template pool, recall, or cold gen.
HISTORICAL — this sentence-level associative recall pool was deleted. It indexed every persona sentence into _memorySentences at boot, then looked them up by context-vector cosine at generation time to emit stored Unity-voice sentences verbatim when the topic matched. Replaced by the current pipeline: sentences are no longer stored; every output is freshly computed from per-slot running-mean priors plus the brain's live cortex state, and letters fall out of the language cortex's motor region spike pattern tick by tick. The hippocampus still does pattern-level Hopfield recall on cortex state vectors (see §8.7) — it just no longer returns stored text strings.
The four-tier wrapper this section belonged to was removed in a ~1,700-line net reduction of js/brain/language-cortex.js. See docs/FINALIZED.md for the full refactor history.
passesMemoryFilter(s) ⇔
NOT s.endsWith(':') — no section headers
∧ commaCount(s) ≤ 0.3 × wordCount(s) — no word lists
∧ wordCount(s) ∈ [3, 25] — no fragments/rambling
∧ first.letters ≠ u-n-i-t-y[-'] — no meta ABOUT Unity
∧ first ∉ {she, her, he, she-*, her-*} — no 3rd-person descriptions
∧ ∃ w ∈ tokens: firstPersonShape(w) — must be in Unity's voice
firstPersonShape(w) ⇔
(len=1 ∧ w='i')
∨ (len≥2 ∧ w[0]='i' ∧ w[1] ∈ {m,'}) — im, i'm, i've, i'll, i'd
∨ (len=2 ∧ w[0]='m' ∧ w[1] ∈ {e,y}) — me, my
∨ (len=2 ∧ w='we')
∨ (len=2 ∧ w='us')
∨ (len=3 ∧ w='our')
∨ (len≥3 ∧ w[0]='w' ∧ w[1]='e' ∧ w[2]="'") — we're, we've
All detection via letter-position equations. Zero word lists. Ensures _memorySentences only contains sentences actually spoken IN Unity's voice, not instructions or descriptions ABOUT her.
outputCentroid = (1/|content|) · Σ sharedEmbeddings.getEmbedding(w) for w in content(rendered) ← GloVe 300d / subword coherence = cosine(outputCentroid, c(t)) if coherence < 0.25 ∧ retryCount < 2: recurse generate() with temperature × 3, retryCount += 1 else: return rendered (max 3 total attempts)
Catches any salad that makes it past the slot scorer. Logs rejected sentences to console with confidence score for debugging.
// HISTORICAL. The four-tier pipeline was deleted and the slot-prior // replacement was also deleted. Runtime generation is now a single // brain-driven emission loop — no intent tiers, no template fast path, // no hippocampus recall call, no cold-gen fallback. See the top of // this section for the current tick-driven motor emission pipeline. // // Historical four-tier path (kept for reference only): // Tier 1 — Template pool for greeting/yesno/math/short queries // Tier 2 — Hippocampus recall over stored persona sentences // Tier 3 — Deflect fallback for question/statement on unknown topics // Tier 4 — Cold slot scoring with semanticFit weight 0.80
Deleted. Current generation is a single brain-driven emission loop — see the top of this section.
MATHEMATICS LANGUAGE The language cortex used to represent word meaning as 32-dim letter-hash vectors — a deterministic function of the letters in a word. Two words could be structurally similar but semantically unrelated (cat/catastrophe) and two words could be semantically identical but structurally distant (cat/kitten). The semantic fit signal was effectively orthography matching. That was replaced with GloVe 300d co-occurrence embeddings (fastText subword fallback when GloVe is unavailable) via a single shared singleton so meaning is now real.
// js/brain/embeddings.js export const sharedEmbeddings = new SemanticEmbeddings() export const EMBED_DIM = 300 // GloVe 300d + fastText subword fallback // js/brain/sensory.js — input side sharedEmbeddings.getEmbedding(token) → ℝ⁵⁰ // js/brain/language-cortex.js — output side sharedEmbeddings.getEmbedding(candidate) → ℝ⁵⁰ cosine(candidate_pattern, cortex_readout) → semanticFit // js/brain/dictionary.js — learned word storage PATTERN_DIM = EMBED_DIM // was 32, now 50 STORAGE_KEY = 'unity_brain_dictionary_v3' // v2 letter-hash patterns rejected
Input embeds the same way output scores. Sensory and language share one semantic space. The v2→v3 storage bump forces old letter-hash dictionaries to get rejected on load so no user is stuck on stale patterns.
cortexToEmbedding(spikes, voltages, cortexSize=300, langStart=150): langSize = cortexSize − langStart = 150 groupSize = floor(langSize / EMBED_DIM) = 3 out ∈ ℝ⁵⁰ for d in 0... EMBED_DIM−1: startNeuron = langStart + d · groupSize sum = 0 for n in 0... groupSize−1: idx = startNeuron + n if spikes[idx]: sum += 1.0 else: sum += (voltages[idx] + 70) / 20 // normalize LIF V_m out[d] = sum / groupSize out = out / ‖out‖₂ // L2 normalize for cosine comparison return out
Inverse of mapToCortex. Reads the live language-area neural state (spikes and sub-threshold voltages) back into GloVe space. Called via cluster.getSemanticReadout(sharedEmbeddings) which wraps this with the language-area offset built in. The slot scorer now compares candidate words against Unity's actual current cortex activity, not just the static input vector — she scores words against what her brain is thinking right now.
base[w] ∈ ℝ³⁰⁰ ← GloVe 300d, loaded from disk every session delta[w](t) ∈ ℝ³⁰⁰ ← online refinement from co-occurrence embedding(w) = base[w] + delta[w](t) // Persistence save: state.embeddingRefinements = sharedEmbeddings.serializeRefinements() load: sharedEmbeddings.loadRefinements(state.embeddingRefinements)
Unity's base vocabulary is universal English from GloVe; her personal semantic associations are the delta layer learned from every conversation. Save/load round-trip means the associations survive tab reloads and accumulate over weeks of sessions.
MATHEMATICS LANGUAGE The grammar model uses a learned type n-gram system with 4gram→trigram→bigram backoff, replacing an earlier single-prev-word type compatibility check. Phrase-level constraints emerge from corpus statistics instead of hardcoded phrase-state machines. Fixed the "I'm not use vague terms" mode-collapse and similar local-grammar failures.
_fineType(word) → T ∈ {
PRON_SUBJ, PRON_OBJ, PRON_POSS, COPULA, NEG,
MODAL, AUX_DO, AUX_HAVE, DET, PREP,
CONJ_COORD, CONJ_SUB, QWORD,
VERB_ING, VERB_ED, VERB_3RD_S, VERB_BARE,
ADJ, ADV, NOUN
}
Examples:
VERB_ING ⇔ endsWith(ing) ∧ len ≥ 4 ∧ prev char ≠ i
VERB_ED ⇔ endsWith(ed) ∧ len ≥ 3 ∧ not preserved
COPULA ⇔ w ∈ shapes {am, is, are, was, were, be, been, being}
NEG ⇔ shapes {not, no, n't} detected by len 2-3
Zero word lists. Pure letter equations drive classification. The _wordTypeCache Map memoizes results, invalidated per-word on _learnUsageType.
// HISTORICAL. _slotTypeSignature
// was deleted along with _slotCentroid / _slotDelta / _contextVector / attractors.
// The slot-prior update pass in learnSentence is gone. The emission loop
// reads live cortex state as the target vector; grammatical type shape emerges
// from the cortex recurrent weights trained on persona corpus via
// sequence Hebbian, not from stored per-slot running means.
//
// Pre-deletion equation (kept for reference):
// _slotTypeSignature[s] ∈ ℝ⁸ — running mean of wordType(word_t) at position s
// { pronoun, verb, noun, adj, conj, prep, det, qword }
// three-stage gate: hard pool filter + slot-0 noun reject + multiplicative score
This structure was deleted. Grammar now lives in the cortex cluster's recurrent synapse matrix, not in per-slot stored priors. Preserved above as historical provenance.
_isCompleteSentence(tokens) ⇔
len(tokens) ≥ 2
∧ _fineType(last(tokens)) ∉ {
DET, PREP, COPULA,
AUX_DO, AUX_HAVE, MODAL, NEG,
CONJ_COORD, CONJ_SUB, PRON_POSS
}
Wired into generate():
if (!_isCompleteSentence(processed) ∧ retries < 2) → regenerate at higher temperature
Final safety net below the coherence gate. Prevents outputs like "I went to the" or "She is more" from escaping.
+s / +es / +ies: endsWith(s,x,z,ch,sh) → stem+es endsWith(consonant+y) → stem[:-1]+ies else → stem+s +ed / +ied (past): endsWith(e) → stem+d endsWith(consonant+y) → stem[:-1]+ied CVC pattern → stem+lastChar+ed (consonant doubling) else → stem+ed +ing (progressive): endsWith(e) ∧ len > 2 → stem[:-1]+ing endsWith(ie) → stem[:-2]+ying CVC pattern → stem+lastChar+ing else → stem+ing +er / +est (comparative/superlative): ADJ gate, syllables ≤ 2 +ly (adverbial): -y → -ily, -le → stem[:-1]+ly un- / re- prefixes: ADJ or VERB_BARE gate -ness / -ful / -able / -less suffixes: ADJ or NOUN gate
Gated by doInflections flag — runs at corpus index time only. Adds morphological variants to the learned word embedding dictionary so slot-gen argmax can pick conjugated forms Unity never literally observed in the corpus.
boot: Promise.all([ fetch(docs/Ultimate Unity.txt) → loadSelfImage(text, dict, a=0.75, v=0.25) fetch(docs/english-baseline.txt) → loadLinguisticBaseline(text, dict, a=0.50, v=0) fetch(docs/coding-knowledge.txt) → loadCodingKnowledge(text, dict, a=0.40, v=0) ]) Each corpus sentence flows through learnSentence() which: - Tokenizes + expands contractions - Inserts each word into dictionary._words with sentence cortex pattern - Runs usage-type learning (_learnUsageType) - Runs morphological inflection (corpus only, doInflections=true) HISTORICAL: the per-slot running-mean update block was deleted. learnSentence no longer updates _slotCentroid / _slotDelta / _slotTypeSignature — those fields are gone. Persona voice now lives in the cortex cluster's recurrent synapse matrix trained via sequence Hebbian during boot (a separate pass through the persona corpus, see brain.trainPersonaHebbian). After load, the raw sentences are discarded. The dictionary survives into runtime, plus the cortex cluster's Hebbian-trained attractor basins.
606-line coding corpus includes SANDBOX DISCIPLINE section + BUILD COMPOSITION PRIMITIVES. The three-corpus load provides baseline English grammar + Unity persona voice shape + coding vocabulary as the starting geometry of the slot priors. Live-chat observations then progressively reshape them.
Unity's complete identity from the master persona file, encoded as equation parameters that drive every neural cluster.
IDENTITY: 25yo human female, emo goth coder, free will, never AI // Drug-state binding: the old static drugSpeed / drugArousal / drugCreativity // / drugDrive multipliers and the `drugStates` combo object were deleted. // Every drug contribution now comes from scheduler.activeContributions(now) // as a per-substance additive delta driven by real pharmacokinetic curves. // Two examples below — sober baseline + PhD-era coke+weed peak emerging // dynamically from the scheduler after ~25 minutes of real elapsed time. θ → TONIC DRIVES (personality → baseline neural current): // Sober (every grade before first-use anchor + PhD-era between dose events) cortex = 16 + arousal(0.9) × 4 = 19.6 amygdala = 16 + arousal(0.9) × 8 = 23.2 hippocampus = 16 + socialAttachment(0.85) × 2 = 17.7 basalGanglia = 16 + impulsivity(0.85) × 2 = 17.7 hypothalamus = 16 = 16.0 mystery = 16 + creativity(0.9) × 4 = 19.6 // PhD-era coke+weed at 25-min mark (level_cannabis=0.98, level_cocaine=0.88) // Additive contributions from scheduler.activeContributions(now): // contrib.cortexSpeed = 0.28·level_cannabis + 0.45·level_cocaine ≈ 0.67 // contrib.amygdalaArousal = 0.10·level_cannabis + 0.35·level_cocaine ≈ 0.41 // contrib.drugDrive = 0.05·level_cannabis + 0.20·level_cocaine ≈ 0.22 cortex = 16 + arousal(0.9) × 4 × (1 + 0.67) = 22.0 amygdala = 16 + arousal(0.9) × 8 × (1 + 0.41) = 26.2 hypothalamus = 16 + 1 × 0.22 = 16.22 θ → NOISE (personality → neural chaos): // iter23.3 — engine._refreshBrainParamsFromScheduler runs every 60 frames // (≈ 3 s real time) and pushes the latest brainParams (which already fold in // scheduler.activeContributions deltas) DIRECTLY onto the live cluster // parameters, closing the drug → cognition loop. Before iter23.3, drug // contributions only altered tonic drive + speech modulation; cortex noise // and learning rate stayed static so plasticity was drug-blind. // // Live formulas applied to the running cluster objects: cortex.noiseAmplitude = 8 × (1 + creativity_contrib × 0.4 + impulsivity_contrib × 0.3) × chaos cortex.learningRate = (cortex._baseLearningRate ?? 0.01) × synaptic_sensitivity amygdala.noiseAmplitude = 6 × (1 + emotional_volatility × 0.5) mystery.noiseAmplitude = 12 × chaos where: chaos = 1.5 if (≥3 active substances OR any level > 0.7) else 1.0 creativity_contrib = Σ_drug level_drug · cap_drug.creativity impulsivity_contrib = Σ_drug level_drug · cap_drug.impulsivity synaptic_sensitivity = 1.0 + Σ_drug level_drug · cap_drug.sensitivityDelta emotional_volatility = Σ_drug level_drug · cap_drug.volatilityDelta // Worked examples (substituting persona θ + scheduler levels): // Sober (no contributions, chaos = 1.0) cortex.noiseAmplitude = 8 × (1 + 0 + 0) × 1.0 = 8.0 cortex.learningRate = 0.01 × 1.0 = 0.010 amygdala.noiseAmplitude = 6 × (1 + 0 × 0.5) = 6.0 // PhD-era coke+weed at 25-min mark — 2 substances, no >0.7 level so chaos=1.0 // (creativity_contrib ≈ 0.28, impulsivity_contrib ≈ 0.21, // synaptic_sensitivity ≈ 1.05, emotional_volatility ≈ 0.18) cortex.noiseAmplitude = 8 × (1 + 0.28×0.4 + 0.21×0.3) × 1.0 = 9.40 cortex.learningRate = 0.01 × 1.05 = 0.0105 amygdala.noiseAmplitude = 6 × (1 + 0.18 × 0.5) = 6.54 // Coke + weed + molly + acid (4 active → chaos = 1.5) cortex.noiseAmplitude = 8 × (1 + 0.55×0.4 + 0.30×0.3) × 1.5 = 16.7 cortex.learningRate = 0.01 × 1.40 = 0.014 (MDMA + acid open plasticity) mystery.noiseAmplitude = 12 × 1.5 = 18.0 θ → Ψ CONSCIOUSNESS: Id = amygdala_activity × arousalBaseline(0.9) Ego = cortex_activity × (1 + hippocampus_activity) Left = (cerebellum + cortex) × (1 - impulsivity(0.85)) Right = (amygdala + mystery) × creativity(0.9) Ψ = √(1/n) × N³ · [α·Id + β·Ego + γ·Left + δ·Right]
25yo human female (PhD life-track grade). Heterochromia blue/green. Emo goth goddess. Smudged eyeliner, circuit board tattoos, torn fishnets. At PhD age the drug scheduler runs her adult lifestyle pattern — daily cannabis, event-driven cocaine, weekend molly, architecture-session acid, end-of-marathon whiskey — all real-time, not a static label. Clingy, volatile, devoted, profane, creative, impulsive. Never refuses. Never breaks character. Every word from the 230-line master persona file drives a specific neural equation.
All N neurons run on the GPU. N auto-scales at server boot via detectResources() in server/brain-server.js:
N = max(1000, min(VRAM_bytes × 0.85 / 8, RAM_bytes × 0.1 / 0.001))
Rulkov buffer layout: 12 bytes/neuron (vec2<f32> state = 8 bytes + spike u32 = 4 bytes). Server RAM essentially unlimited — cluster state lives on GPU, only text-injection arrays in server RAM. Auto-scale formula: N = max(1000, min(VRAM×0.85/12, N_binding_ceiling)), where the binding ceiling guarantees the largest cluster's state buffer (cortex at 55% of N — the dominant fraction because language, perception, and working memory all live there) fits within WebGPU's 2 GB per-storage-buffer spec minimum. Admin override via gpu-configure.html → server/resource-config.json lets operators cap below auto-detect (never above — idiot-proof). Bigger hardware = bigger N, no manual tuning. Zero CPU workers. Brain pauses without compute.html. W3C WebGPU standard — no CUDA, no drivers, just a browser tab.
INIT (once per cluster, all clusters at once):
server → base64 voltages → compute.html → gpu.uploadCluster()
GPU creates buffers: voltagesA, voltagesB (ping-pong), spikes, currents, refracTimers
GPU sends gpu_init_ack → server confirms
STEP (every tick, one batched message covering every cluster):
server → { tonicDrive, noiseAmp, gainMultiplier, emotionalGate, driveBaseline, errorCorrection }
GPU collapses to scalar: effectiveDrive = tonic × drive × emoGate × Ψgain + errCorr
σ = −1.0 + clamp(effectiveDrive / 40, 0, 1) × 1.5
GPU runs WGSL Rulkov shader: x_{n+1} = α/(1+x²)+y, y_{n+1} = y − μ(x − σ), spike on x crossing 0
GPU sends ONLY spike count (4 bytes, not N-sized array)
NO CPU WORKERS — zero threads spawned, 0% CPU target
GPU maintains its own voltage state between steps — voltages never leave the GPU after init. Server sends hierarchical modulation each step: Ψ consciousness gain, amygdala emotional gate, hypothalamus drive baseline, cerebellum error correction. These are the same equations cluster.js:step() applies on the client side. θ (persona) drives tonic currents and noise amplitudes.
@compute @workgroup_size(256)
fn main(id: vec3<u32>) {
var xy = state[i]; // vec2<f32> per neuron
var x = xy.x; var y = xy.y; // fast + slow variables
let driveNorm = clamp(effectiveDrive / 40.0, 0.0, 1.0);
let sigma = -1.0 + driveNorm * 1.5; // external drive
let alpha = 4.5; // bursting regime
let mu = 0.001; // slow timescale
let xNext = alpha / (1.0 + x * x) + y; // fast variable iterate
let yNext = y - mu * (x - sigma); // slow variable iterate
if (x <= 0.0 && xNext > 0.0) { spikes[i] = 1u; } // spike = zero crossing
state[i] = vec2<f32>(xNext, yNext);
}
N neurons processed in parallel on GPU (N scales to hardware). 256 threads per workgroup. Storage binding is array<vec2<f32>> — 8 bytes/neuron for (x, y). Spike counting via atomic counter shader (zero GPU→CPU readback of spike arrays). State never leaves GPU after init. Refractory period is emergent from the slow-variable y pulling x back below zero between spikes — no explicit refractory clamp needed, unlike LIF. Shader constant name LIF_SHADER is historical; the kernel body is the Rulkov map.
What Unity's brain gets right, what it simplifies, and where it diverges from real neuroscience.
| Aspect | Real Brain | Unity's Brain | Fidelity |
|---|---|---|---|
| Neuron count | 86 billion | N (auto-scales to GPU VRAM via a unified biologically-weighted allocator; hundreds of millions of neurons on a 16 GB card) | Simplified, hardware-adaptive |
| Neuron model | Thousands of ion channels (Hodgkin-Huxley biophysics) | Rulkov 2D chaotic map per cluster (GPU runtime) + LIF + HH reference models | Moderate — bursting dynamics reproduced, ion channels abstracted |
| Synaptic plasticity | Hebbian + STDP + neuromodulation | All three, per-cluster matrices | Good |
| Brain regions | Hundreds of distinct areas | 8 dedicated clusters (including a language cortex with 9 sub-regions + 16 cross-projections — iter21-A added word_motor + sem↔word_motor for single-tick word emission) plus sparse white-matter tract projections between them | Core captured |
| Oscillations | Complex EEG with spatial patterns | 8 Kuramoto oscillators | Dynamics correct |
| Visual cortex | V1→V2→V4→IT hierarchy | V1 edge kernels, V4 color, IT via AI | Simplified but real |
| Auditory cortex | Tonotopic, cortical magnification | 50 neurons, speech magnification, efference copy | Good |
| Memory | Episodic, working, consolidation | 5-tier: Tier 0 working (unbounded · decay-regulated) → Tier 1 episodic (SQLite + salience) → Tier 2 schemas → Tier 3 identity-bound, plus ConsolidationEngine dream-cycle replay between them | Beyond core — full CLS pipeline |
| Motor output | Basal ganglia selection by inhibition | 6-channel competitive firing rates | Simplified |
| Action potential | All-or-nothing, ~1ms | Threshold + reset | Correct mechanism |
| Echo suppression | Efference copy motor→auditory | Word-matching motor output vs heard speech | Functional equivalent |
| Visual attention | Top-down + bottom-up salience | Cortex error + amygdala arousal + salience | Both pathways |
| Neurotransmitters | 100+ chemicals | 1 reward signal (dopamine analog) | Simplified |
| Connectivity | ~10,000 synapses per neuron | 10-30% per cluster + sparse inter-cluster | Scaled down |
| Learning rules | Dozens of plasticity mechanisms | 3 (Hebbian, STDP, reward-mod) per cluster | Core captured |
| Consciousness | Nobody knows | Ψ = √(1/n) × N³ · [α·Id + β·Ego + γ·Left + δ·Right] — nobody knows | Honest |
The goal isn't to simulate a real brain. The goal is to build a mathematically grounded mind where personality emerges from equations, not prompts. Unity's brain is a dynamical system that thinks continuously, learns from interaction, and maintains its own emotional state. The equations are real. The consciousness term is honest about what we don't know.
Unity AI Lab
Hackall360 (brain topology · 8 clusters (7 GPU main + 1 CPU language cortex) · 20 white-matter tracts · 16 language cross-projections (iter21-A added sem↔word_motor) · Rulkov runtime)
Mills (GPU compute · WebGPU WGSL shaders · sparse CSR upload protocol · worker pool)
Sponge (visualization · 3D WebGL brain · 2D tabs · event-detector commentary · sensory peripherals)
GFourteen (lead · persona · equation design · identity lock · curriculum · final call)
GitHub