Files
organism/elements/neuron/appunti/2026-06-26-tripartite-synapse_v14.md
T
2026-06-26 17:43:48 +02:00

38 KiB
Raw Blame History

Tripartite Synapse — Pseudocode v14

Companion: tripartite_synapse_v14_biology.md · principle: logic_principles (Timescale Ladder). Changes from v13: (1) every component has a plain-language intro (DAY/AP · DAY/NOT_AP · NIGHT) (2) budget refill regrouped RECEIVE → RECOVER everywhere (RECEIVE = signals only) (3) presynaptic short-term potentiation (possible_tag → VGCC occupancy) — see PRE (4) FOUR TIERS surfaced: FAST (mss) · MEDIUM (smin) · SLOW (hr) · PERSISTENT (NIGHT) DECAY groups are banded by tier; the group-to-tier ladder is stated once below (5) variable-type table in conventions maps each quantity to its tier


Functional groups (seven-group grammar)

RECEIVE   take in resources + signals that arrived from outside     (boundary: in)
TRACE     maintain the trace hierarchy — deposit fast trace; accumulate
          possible_tag + endurance_need; stabilize tag on coincidence
ADJUST    compute local operating parameters from structure + traces + modulators
BEHAVE    the component's defining action, within both ceilings
EMIT      send out — signals (messages) + resources (shipments)      (boundary: out)
RECOVER   refill own private pools consumed by behaving
DECAY     let traces recede, closing their windows

EVALUATE merged into TRACE: judging a behavior is always maintaining a trace, whether or not a trace is written. BEHAVE and EMIT stay separate — EMIT is the output half of the locality interface (RECEIVE/EMIT are the only boundary crossings). TRACE spans all timescales: the soma's inactivation, adaptation, and nuclear-Ca deposits are all TRACE. Order within a context follows data dependencies; TRACE reads/writes whatever trace state is current.

EVERY FLOW HAS A TIMESCALE. Decay relaxes toward 0 over τ; creation/arrival relaxes toward a target over τ — the same first-order operator. Within-step writes are the special case τ ≪ Δt. Rate-limited inflows (fill/refill/flux·Δt) carry their τ implicitly; shipment carries an explicit transit delay (see transit).

THE GROUPS MOVE BETWEEN TIERS (the ladder; see logic_principles "The Timescale Ladder"). Four tiers: FAST (mss) · MEDIUM (smin) · SLOW (hr) · PERSISTENT (NIGHT-written). The groups move evidence UP the ladder and read capacity DOWN it:

  ADJUST    reads PERSISTENT ceiling + FAST trace  → sets this step's operating point (down)
  BEHAVE    acts at FAST, bounded by the PERSISTENT ceiling                          (down)
  TRACE     deposits FAST, accumulates FAST→MEDIUM evidence, stabilizes MEDIUM→SLOW tag (up)
  RECOVER   refills toward the PERSISTENT ceiling                                     (down)
  DECAY     relaxes FAST · MEDIUM · SLOW (PERSISTENT never decays in DAY)
  NIGHT     commits SLOW tag + MEDIUM endurance_need → PERSISTENT ceilings            (up)

Capacity flows downward (slow sets the ceiling for fast); evidence flows upward (fast accumulates toward slow). Each component's DECAY group below is banded by tier to show this.


Conventions

SCOPE = {DAY, NIGHT}   CONTEXT = {AP, NOT_AP, bAP, NOT_bAP, CONTINUOUS}

VARIABLE TIERS (timescale = meaning; see logic_principles "The Timescale Ladder")
  FAST       (mss)   immediate response     fast_trace
  MEDIUM     (smin)  occupancy + evidence   possible_tag · endurance_need · VGCC_active · AMPA_surface · RRP
  SLOW       (hr)     consolidation bridge   tag
  ─────────────────────────────────────────────────────────────────────────────
  PERSISTENT (NIGHT)  capacity (the ceilings) structure · budget_ceiling
                      energy (not recoverable) · material (recoverable)

DAY      budget · fast_trace · possible_tag · endurance_need
BRIDGE   tag (POST: CANDIDATE→STABLE)
NIGHT    energy (not recoverable) · material (recoverable) · structure · budget_ceiling

LOCALITY only local state + arrived signals; no component reads another's internal state.

CLEFT MESSAGE CHANNELS              SHIPMENT CHANNELS (transit-delayed)
  glutamate     PRE → POST, ASTRO     soma_ship_dend SOMA→DEND
  astro_Dserine ASTRO → POST          soma_ship_axon SOMA→AXON
  retro_NO      POST → PRE (+)        dend_ship_post DEND→POST
  retro_eCB     POST → PRE ()        axon_ship_pre  AXON→PRE

Primitives (return the increment; caller applies it)

sat(x, K) = x / (K + x)

fill(pool, ceiling, rate, cost, budget) -> amount:        // PRIVATE reserve, rate-limited (implicit τ)
    amount = min(rate, ceiling - pool)·Δt;  budget -= amount·cost;  return amount

refill(c from supply S) -> amount:                         // CONTESTED supply, gap-bounded
    demand = c.budget_ceiling - c.budget
    factor = min(1, S / (Σ demand over components on S + ε));  S -= demand·factor
    return demand·factor

ship(from_budget, demand_sig, frac, cost) -> amount:       // emit into transit (not to target directly)
    amount = min(from_budget·frac, demand_sig);  from_budget -= amount·(1+ship_cost);  return amount

transit(channel, τ_transport) -> arrival:                  // delivers in-transit cargo over τ
    arrival = channel·(Δt/τ_transport);  channel -= arrival;  return arrival

SHARED parameters

dopamine  NE  ACh                         // organism broadcasts (external)
glucose  geometry                         // physical (external)
elig  dop_thr  tag_thr  tag_expiry        // strength gates (universal)
traj_thr  endur_thr                       // endurance gates (universal)
ship_cost                                 // transport overhead (all shipments)
τ_transport_{dend,axon,spine,bouton}      // shipment transit times (distance-dependent)
ε

NIGHT parameters (consolidation only)

slot_cost  cap_cost  f_cap                // commit sizes / endurance fraction
maint_frac  cap_frac                      // maintenance allocation
decay_rate  capacity_decay_rate  recycle  // passive decay + recovery
homeostatic_ceiling  coherence_factor  assembly_cost  biogenesis_cost  maint_cost
f_dend  f_axon  f_spine  f_bouton         // material distribution fractions
{dend,axon,pre,post}_ship_frac            // DAY shipment fractions
{dend,axon,pre,post}_energy_frac          // energy distribution fractions


DAY


PRE

The presynaptic bouton releases neurotransmitter and gathers evidence about whether that release was worth strengthening and worth sustaining. Its behavior unfolds across two DAY contexts and the NIGHT scope.

During DAY, during AP — the bouton releases neurotransmitter. The amount released depends on residual calcium from recent spikes (the fast trace, setting the drive), the current VGCC coupling occupancy (how tightly calcium channels are coupled to docking slots right now — filled short-term, bounded by structure), the two retrograde messages from the postsynapse (retro_eCB brakes the drive; retro_NO will confirm release reached a responsive target), and the availability of both fuel and vesicles. Two shortfalls are read differently: a fuel shortfall on a succeeding release is evidence the bouton needs more endurance; an empty pool with fuel to spare is ordinary short-term depression.

During DAY, during NOT_AP — the bouton consolidates, potentiates short-term, and recovers. With no spike to release, it latches the retrograde messages (RECEIVE); maintains its traces — accumulating eligibility toward a dopamine-gated tag (TRACE); transiently tightens its VGCC coupling from accumulated eligibility, with no dopamine, a reversible short-term potentiation bounded by the structural ceiling (BEHAVE); refills both its budget (contested supply) and its vesicle pool (private reserve) (RECOVER); and lets its traces decay, closing the windows (DECAY).

During NIGHT — the bouton's ceilings are rewritten. NIGHT raises the bouton's structure (active-zone capacity, including the VGCC-coupling ceiling) where a validated tag accumulated, and its budget capacity (mitochondrial endurance) where fuel repeatedly interrupted a succeeding release. Both draw on the same finite material and energy shipped down the axon, so the two kinds of growth compete — and whatever is not maintained drifts back down.

// PARAMETERS  K_release · release_cost · fusion_cost · vatpase_cost · spillover · brake
//             stp_thr · coupling_gain · coupling_drift · VGCC_baseline
// INTERFACE
//   EMIT      glutamate → POST, ASTRO
//   RECEIVE   retro_NO, retro_eCB ← POST  (signals latched; resources refill in RECOVER)
//   READ      glutamate (own cleft, autobrake) ; dopamine (gates tag)
//   OWN       pre_structure{slot_ceiling, VGCC_coupling, refill_ceiling} ; pre_budget_ceiling
//             VGCC_active (occupancy: current coupling, filled toward VGCC_coupling ceiling)
//   SUPPLY    astro_lactate[syn] ← ASTRO ; axon_ship_pre ← AXON ; pre_material ← AXON(NIGHT) ; pre_energy ← SOMA(NIGHT)
//   EMERGENCY shockwave_lockdown ← ASTRO

DAY | AP:
    // TRACE     (Ca²⁺ bolus from THIS spike — also drives release; frequency is emergent)
    pre_fast_trace += spike_Ca(pre_structure.VGCC_coupling)
    // ADJUST    (release drive from residual Ca²⁺ × current coupling occupancy, + DSE brake)
    drive = sat(pre_fast_trace × VGCC_active, K_release) × (1 - retro_eCB_local)
    // BEHAVE    (release; two distinct failure modes)
    if pre_budget < release_cost:
        // FUEL shortfall → endurance evidence (retro_NO-confirmed local success)
        suppress(NT_flux)
        if pre_fast_trace > traj_thr:
            pre_endurance_need += pre_fast_trace × (1 + retro_NO_local)
        exit
    if RRP == 0:
        // OCCUPANCY shortfall → short-term depression (NOT endurance; fuel was fine)
        suppress(NT_flux)
        exit
    NT_flux = RRP × drive;  RRP -= NT_flux·Δt;  pre_budget -= NT_flux·fusion_cost
    // EMIT      (glutamate into cleft)
    glutamate += NT_flux·Δt
    if glutamate > spillover: drive *= brake               // own-cleft autobrake

DAY | NOT_AP:
    // RECEIVE   (latch backward messages — signals only)
    retro_NO_local = retro_NO;  retro_eCB_local = retro_eCB
    // TRACE     (strength: eligibility → tag via dopamine)
    if pre_fast_trace > elig: pre_possible_tag += pre_fast_trace
    if dopamine > dop_thr and pre_possible_tag > tag_thr:
        pre_tag += dopamine × pre_possible_tag
    // BEHAVE    (short-term potentiation: eligibility tightens coupling, NO dopamine; drifts back)
    if pre_possible_tag > stp_thr:
        VGCC_active = min(VGCC_active + coupling_gain × pre_possible_tag, pre_structure.VGCC_coupling)
    else:
        VGCC_active = max(VGCC_active - coupling_drift·Δt, VGCC_baseline)    // STD = consequence
    // RECOVER   (refill BOTH pools: contested budget + private RRP)
    pre_budget += refill(pre from astro_lactate[syn] + transit(axon_ship_pre, τ_transport_bouton))
    RRP += fill(RRP, pre_structure.slot_ceiling, pre_structure.refill_ceiling, vatpase_cost, pre_budget)
    // DECAY
    //   FAST   (mss)
    pre_fast_trace *= decay(100ms)
    //   MEDIUM (smin)
    pre_possible_tag *= decay(s);  pre_endurance_need *= decay(min)
    //   SLOW   (hr)
    pre_tag *= decay(hr)
    //   (signals) arrived channels fade
    dopamine *= decay(ms);  retro_NO *= decay(s);  retro_eCB *= decay(s)
    //   (PERSISTENT: pre_structure, pre_budget_ceiling — no DAY decay; NIGHT only)

POST

The postsynaptic spine is the synapse's primary memory locus: it detects coincident input, runs the calcium dynamics that decide potentiation versus depression, and requires the most validation (three coincidences) before committing. Its behavior unfolds across two DAY contexts and the NIGHT scope.

During DAY, during NOT_bAP — the spine integrates input and decides plasticity. Three calcium sources feed its fast trace: AMPA current (small Ca, begins ejecting the NMDA Mg block), NMDA (large Ca, but only on the local coincidence of depolarization + astrocyte D-serine + glutamate), and — in the bAP context — the back-propagating spike. High calcium drives AMPA receptors to the surface (short-term potentiation, occupancy filled toward the slot ceiling, no dopamine); when calcium falls, they drift back (short-term depression as a consequence). The spine also emits two retrograde messages from its own state — NO when it responded, an endocannabinoid brake when over-driven — and accumulates a dopamine-gated tag toward consolidation. A fuel shortfall while calcium was climbing toward a tag is endurance evidence; a surface already at its ceiling is a structural limit, not endurance.

During DAY, during bAP — the back-propagating spike confirms coincidence. The somatic spike arrives at the spine, adds depolarization and calcium, and supralinearly amplifies an existing candidate — the soma's confirmation that it fired, one of the three coincidences the spine requires.

During NIGHT — the spine's ceilings are rewritten. NIGHT raises structure (the AMPA slot ceiling, spine volume) where a validated tag accumulated — with a coherence bonus when pre, post, and astro all tagged the same synapse — and budget capacity where fuel interrupted a climbing calcium trajectory. Both draw the same finite pool, so they compete; unmaintained ceilings drift down.

// PARAMETERS  K_AMPA · AMPA_Ca · AMPA_cost · NMDA_cost · bAP_cost · pka_cost · traffic_cost
//             req_cost · Mg_eject · Dserine_thr · Ca_STP · Ca_TAG · eCB_thr · drift · baseline
//             NO_synth_cost · eCB_synth_cost
// INTERFACE
//   EMIT      retro_NO (+), retro_eCB () → PRE
//   RECEIVE   (signals) glutamate ← PRE ; astro_Dserine ← ASTRO ; bAP ← DEND/SOMA ; dopamine
//   READ      glutamate ; astro_Dserine ; bAP (dend_structure.bAP_fidelity) ; dopamine
//   OWN       post_structure{slot_ceiling, spine_volume, reserve_ceiling} ; post_budget_ceiling
//   SUPPLY    astro_lactate[syn] ← ASTRO ; dend_ship_post ← DEND ; post_material ← DEND(NIGHT) ; post_energy ← SOMA(NIGHT)
//   EMERGENCY shockwave_lockdown ← ASTRO
// NOTE      POST endurance is own-state only (own Ca climbing); no arrived feedback term.

DAY | NOT_bAP:
    // ADJUST    (AMPA drive from arrived glutamate)
    a = sat(glutamate, K_AMPA)
    // BEHAVE    (SOURCE 1 AMPA: current + small Ca + begins Mg ejection)
    AMPA_current = a × AMPA_surface;  Vm += AMPA_current;  post_budget -= AMPA_cost
    // TRACE     (Ca deposited by AMPA)
    post_fast_trace += AMPA_Ca·AMPA_current
    // BEHAVE    (SOURCE 2 NMDA: large Ca on local coincidence)
    if Vm > Mg_eject and astro_Dserine > Dserine_thr and glutamate > 0:
        post_fast_trace += NMDA_Ca(glutamate)·rise_speed();  post_budget -= NMDA_cost
        // EMIT      (+ NO/BDNF: "release reached a responsive target")
        retro_NO += NO_emit(post_fast_trace);  post_budget -= NO_synth_cost
    // EMIT      ( endocannabinoid / DSE when over-driven)
    if Vm > eCB_thr:
        retro_eCB += eCB_emit(Vm);  post_budget -= eCB_synth_cost
    post_fast_trace *= decay(ms)
    // BEHAVE    (STP fill slots from private reserve ; else STD drift = consequence)
    if post_fast_trace > Ca_STP:
        if post_budget < traffic_cost:
            // FUEL shortfall → endurance (own Ca was climbing toward a tag)
            if post_fast_trace > traj_thr and post_fast_trace_rising:
                post_endurance_need += post_fast_trace
        else if AMPA_surface < post_structure.slot_ceiling:
            AMPA_surface += Ca_insert(post_fast_trace);  post_budget -= traffic_cost
        // else: surface already at slot_ceiling → structure-limited (not endurance)
    else:
        AMPA_surface = max(AMPA_surface - drift·Δt, baseline)   // STD = consequence
    // TRACE     (strength: CANDIDATE then STABLE via dopamine)
    if post_fast_trace > Ca_TAG: post_possible_tag += post_fast_trace;  post_budget -= pka_cost
    if dopamine > dop_thr and post_possible_tag > tag_thr:
        post_tag += dopamine × post_possible_tag
    // RECOVER   (refill budget from contested supply)
    post_budget += refill(post from astro_lactate[syn] + transit(dend_ship_post, τ_transport_spine))
    // DECAY
    //   FAST   (mss) — post_fast_trace already decayed above (intra-step, pre-tagging)
    //   MEDIUM (smin)
    post_possible_tag *= decay(min);  post_endurance_need *= decay(min)
    //   SLOW   (hr)
    post_tag *= decay(hr)
    //   (signals)
    dopamine *= decay(ms)
    //   (PERSISTENT: post_structure, post_budget_ceiling — no DAY decay; NIGHT only)

DAY | bAP:
    // BEHAVE    (SOURCE 3 bAP: depolarization + Ca, amplifies existing signal)
    Vm += bAP_depol × dend_structure.bAP_fidelity;  post_budget -= bAP_cost
    // TRACE     (supralinear boost only if a CANDIDATE is present)
    if post_possible_tag > Ca_TAG: post_fast_trace += bAP_Ca_boost()

DEND

The dendritic branch is the postsynapse's supply line and the neuron's input integrator. It carries the back-propagating spike out to its spines, integrates their voltages toward the soma, and ships material and budget to the spines it supports. Its behavior unfolds across two DAY contexts and the NIGHT scope.

During DAY, during bAP — the branch propagates and integrates. When the soma fires, the branch propagates the back-propagating spike toward its spines, with a fidelity that attenuates with distance (distal spines get weaker confirmation, are harder to potentiate). It deposits branch calcium and integrates its spines' voltages into a single branch signal sent on to the soma. A fuel shortfall that cuts propagation short while the branch was strongly active is endurance evidence; propagation that simply attenuates with distance is a structural limit, not endurance.

During DAY, during NOT_bAP — the branch consolidates, supplies, and recovers. It maintains its tag toward consolidation, lowers its commit threshold under acetylcholine (attention), ships budget down to its spines (demand-weighted by their tags), runs local translation if tagged, refills its own budget from astrocytic lactate and somatic shipment, and lets its traces decay.

During NIGHT — the branch's ceilings are rewritten. NIGHT raises structure (bAP fidelity, translation capacity) where a validated tag accumulated and budget capacity where fuel interrupted strong branch activity, both from the shared pool, both competing; unmaintained ceilings drift down.

// PARAMETERS  prop_cost · branch_Ca_cost · integrate_cost · translate_cost · ACh_gain
// INTERFACE
//   EMIT      bAP_local → POST ; branch_Vm → SOMA ; dend_ship_post → POST
//   RECEIVE   (signals) SOMA.fired ; POST.Vm + spine spillover ; dopamine ; ACh
//   READ      SOMA.fired ; POST.Vm + spine spillover ; dopamine ; ACh
//   OWN       dend_structure{bAP_fidelity(pos), translation_ceiling, transport_speed} ; dend_budget_ceiling
//   SUPPLY    astro_lactate[branch] ← ASTRO ; soma_ship_dend ← SOMA ; dend_material, dend_energy ← SOMA(NIGHT)
//   NOTE      DEND endurance fires only on FUEL-limited propagation, not structural attenuation;
//             own-state proxy (strong branch activity); no arrived feedback term.

DAY | bAP:
    // ADJUST    (propagation strength from structure — inside propagate())
    // BEHAVE    (propagate bAP; distinguish fuel-limited vs structure-limited shortfall)
    if dend_budget < prop_cost:
        // FUEL shortfall → endurance (branch was strongly active)
        if dend_fast_trace > traj_thr:
            dend_endurance_need += dend_fast_trace
        bAP_local, reached = propagate_partial(dend_budget)
    else:
        bAP_local, reached = propagate(SOMA.fired, dend_structure.bAP_fidelity, geometry)
        // reached < full here is structural attenuation (distance), NOT endurance
    dend_budget -= prop_cost × reached
    // TRACE
    dend_fast_trace += bAP_Ca(bAP_local) + spine_spillover();  dend_budget -= branch_Ca_cost
    // EMIT      (integrated voltage to soma ; propagated bAP already reached spines)
    branch_Vm = integrate(POST.Vm, spines);  dend_budget -= integrate_cost

DAY | NOT_bAP:
    // TRACE     (strength)
    if dend_fast_trace > elig: dend_possible_tag += dend_fast_trace
    if dopamine > dop_thr and dend_possible_tag > tag_thr:
        dend_tag += dopamine × dend_possible_tag
    // ADJUST    (commit threshold lowered by attention)
    commit_threshold *= 1/(1 + ACh·ACh_gain)
    // BEHAVE    (local translation if tagged — fills dend capacity faster)
    if dend_tag > tag_expiry and dend_budget > translate_cost: dend_budget -= translate_cost
    // EMIT      (ship budget to spines; demand = post tag)
    dend_ship_post = ship(dend_budget, post_demand, post_ship_frac, ship_cost)
    // RECOVER   (refill budget from contested supply)
    dend_budget += refill(dend from astro_lactate[branch] + transit(soma_ship_dend, τ_transport_dend))
    // DECAY
    //   FAST   (mss)
    dend_fast_trace *= decay(300ms)
    //   MEDIUM (smin)
    dend_possible_tag *= decay(s);  dend_endurance_need *= decay(min)
    //   SLOW   (hr)
    dend_tag *= decay(hr)
    //   (PERSISTENT: dend_structure, dend_budget_ceiling — no DAY decay; NIGHT only)

SOMA

The soma is the neuron's integrating center and the root of its structural material. It sums the branch inputs, fires when they exceed a threshold it sets from its own adaptation and the neuromodulators, and ships material and budget out to the dendrites and axon. Its timing — refractoriness, adaptation, rhythm alignment — emerges bottom-up from local traces, never from a represented clock. Its behavior unfolds across two DAY contexts and the NIGHT scope.

During DAY, during AP — the soma integrates and fires. It computes its firing threshold from its baseline (structure), its accumulated adaptation, and the neuromodulators, and checks its refractory state; if the integrated branch input clears the threshold and fuel allows, it fires. One spike deposits three traces at three timescales — sodium inactivation (refractory), slow-potassium adaptation (threshold rise), and nuclear calcium (toward CREB and the tag). A fuel shortfall while nuclear calcium was climbing is endurance evidence; being refractory or sub-threshold is a timing limit, not endurance.

During DAY, during NOT_AP — the soma recovers, aligns, and supplies. It self-replenishes from its own mitochondria (its private root), integrates the latest branch inputs, deposits a refractory-alignment trace when suprathreshold input arrived during its refractory period (so it aligns to its input rhythm bottom-up), ships budget to dendrites and axon (demand-weighted by their tags), recovers from refractoriness at a rate its alignment trace speeds up, and lets its traces decay.

During NIGHT — the soma's ceilings are rewritten, and it gates the whole neuron's material. NIGHT raises structure (excitability, synthesis capacity) and budget capacity from the shared pool; crucially the soma's own tag gates CREB-driven synthesis, so how much material all downstream components receive depends on the soma having been tagged.

// PARAMETERS  ap_cost · nuclear_cost · creb_cost · mito_output · inactivation · ap_amp · ap_contrib
//             base_recovery · τ_Na · τ_adapt · τ_nuclear · τ_align
// INTERFACE
//   EMIT      fired → AXON (propagate) + DEND (bAP) ; soma_ship_dend → DEND ; soma_ship_axon → AXON
//   RECEIVE   (signals) branch_Vm ← DEND ; dopamine ; NE ; ACh
//   READ      dopamine ; NE ; ACh
//   OWN       soma_structure{baseline_threshold, AP_reliability, synthesis_ceiling} ; soma_budget_ceiling
//   SUPPLY    self (mitochondria, ROOT — private)
//   NOTE      SOMA endurance fires only on FUEL shortfall (budget < ap_cost);
//             refractory / sub-threshold are timing limits, not endurance. Own-state proxy.

DAY | AP:
    // ADJUST    (threshold from structure + adaptation + neuromodulators ; refractory gate)
    threshold = soma_structure.baseline_threshold × (1 + soma_adaptation) × neuromod(NE, ACh)
    can_fire  = soma_Na_inactivation < inactivation
    // BEHAVE    (fire if able)
    if branch_Vm > threshold and can_fire:
        if soma_budget < ap_cost:
            // FUEL shortfall → endurance (firing was approaching CREB)
            if soma_fast_trace > traj_thr and soma_fast_trace_rising:
                soma_endurance_need += soma_fast_trace
            exit
        // EMIT      (fired → AXON, DEND)
        fired = True;  soma_budget -= ap_cost
        // TRACE     (three traces from one AP — FAST nuclear-Ca, MEDIUM adaptation, refractory)
        soma_Na_inactivation += ap_amp                     // → refractory (emergent)
        soma_adaptation      += ap_contrib                 // → threshold rise
        soma_fast_trace      += nuclear_Ca();  soma_budget -= nuclear_cost
        // TRACE     (strength)
        if soma_fast_trace > elig: soma_possible_tag += soma_fast_trace
        if dopamine > dop_thr and soma_possible_tag > tag_thr:
            soma_tag += dopamine × soma_possible_tag
        soma_budget -= creb_cost

DAY | NOT_AP:
    // RECEIVE   (integrate latest branch input — signal)
    branch_Vm = integrate(DEND.branch_Vm, branches)
    // TRACE     (bottom-up refractory alignment: suprathreshold input during refractory)
    if branch_Vm > threshold and soma_Na_inactivation > inactivation:
        soma_refractory_alignment += (branch_Vm - threshold) × soma_Na_inactivation
    // EMIT      (ship downstream into transit; demand = propagated tags)
    soma_ship_dend = ship(soma_budget, dend_demand, dend_ship_frac, ship_cost)
    soma_ship_axon = ship(soma_budget, axon_demand, axon_ship_frac, ship_cost)
    // RECOVER   (self-replenish from private root ; inactivation recovery sped by alignment)
    soma_budget += fill(soma_budget, soma_budget_ceiling, mito_output, 0, soma_budget)
    recovery = base_recovery × (1 + soma_refractory_alignment)
    soma_Na_inactivation *= decay(τ_Na / recovery)
    // DECAY
    //   FAST   (mss) — refractory + nuclear-Ca + alignment (sub-second to seconds)
    soma_fast_trace *= decay(τ_nuclear);  soma_refractory_alignment *= decay(τ_align)  // self-limiting
    //   MEDIUM (smin) — adaptation + tagging evidence
    soma_adaptation *= decay(τ_adapt)
    soma_possible_tag *= decay(s);  soma_endurance_need *= decay(min)
    //   SLOW   (hr)
    soma_tag *= decay(hr)
    //   (signals)
    dopamine *= decay(ms)
    //   (PERSISTENT: soma_structure, soma_budget_ceiling — no DAY decay; NIGHT only)

AXON

The axon carries the soma's spike out to its boutons and is the presynapse's supply line. It propagates reliably or not depending on its myelination and its recent load, and ships material and budget to the boutons. Its behavior unfolds across two DAY contexts and the NIGHT scope.

During DAY, during AP — the axon propagates the spike. Reliability is set by structure (myelination) and degraded by recent high-frequency load (sodium inactivation at branch points — axonal short-term depression). A fuel shortfall while carrying a strong train is endurance evidence; load-driven failure is short-term depression, a consequence, not endurance.

During DAY, during NOT_AP — the axon supplies and recovers. It maintains its tag, ships budget to its boutons (demand-weighted by their tags), refills its own budget from somatic shipment and astrocytic lactate, and lets its traces decay.

During NIGHT — the axon's ceilings are rewritten. NIGHT raises structure (myelination, transport capacity) and budget capacity from the shared pool, both competing; unmaintained ceilings drift down.

// PARAMETERS  prop_cost · budget_factor
// INTERFACE
//   EMIT      APs_delivered → PRE (propagation) ; axon_ship_pre → PRE
//   RECEIVE   (signals) SOMA.fired ; dopamine
//   READ      SOMA.fired ; dopamine
//   OWN       axon_structure{propagation, transport_ceiling, mito_density} ; axon_budget_ceiling
//   SUPPLY    soma_ship_axon ← SOMA ; astro_lactate[shaft] ← ASTRO ; axon_material, axon_energy ← SOMA(NIGHT)
//   NOTE      AXON endurance fires only on FUEL shortfall; load-driven failure fail(fast_trace)
//             is axonal STD (a consequence), not endurance. Own-state proxy.

DAY | AP:
    // ADJUST    (reliability from structure  load-driven failure)
    reliability = axon_structure.propagation × (1 - fail(axon_fast_trace))   // fail() = STD, not endurance
    // BEHAVE    (propagate; FUEL shortfall degrades + flags endurance)
    if axon_budget < prop_cost:
        reliability *= budget_factor
        if axon_fast_trace > traj_thr:                     // FUEL-limited → endurance
            axon_endurance_need += axon_fast_trace
    delivered = fired × reliability;  axon_budget -= prop_cost × delivered
    // EMIT      (delivered APs reach boutons)
    // TRACE
    axon_fast_trace += delivered;  axon_fast_trace *= decay(s)

DAY | NOT_AP:
    // TRACE     (strength)
    if axon_fast_trace > elig: axon_possible_tag += axon_fast_trace
    if dopamine > dop_thr and axon_possible_tag > tag_thr:
        axon_tag += dopamine × axon_possible_tag
    // EMIT      (ship to boutons; demand = pre tag)
    axon_ship_pre = ship(axon_budget, pre_demand, pre_ship_frac, ship_cost)
    // RECOVER   (refill budget from contested supply)
    axon_budget += refill(axon from soma_ship_axon + astro_lactate[shaft])
    // DECAY
    //   FAST   (mss)
    axon_fast_trace *= decay(s)
    //   MEDIUM (smin)
    axon_possible_tag *= decay(s);  axon_endurance_need *= decay(min)
    //   SLOW   (hr)
    axon_tag *= decay(hr)
    //   (PERSISTENT: axon_structure, axon_budget_ceiling — no DAY decay; NIGHT only)

ASTRO

The astrosynapse is the synapse's gatekeeper and energy hub. It clears glutamate, supplies the D-serine that gates postsynaptic NMDA, and distributes lactate across its territory by demand. Unlike the others it runs in a single continuous context rather than spiking, and its structure reshapes the synapse's operating point rather than just its range.

During DAY, continuously — the astrosynapse clears, gates, and fuels. It produces energy at its cell body (glycolysis from glucose, the system's energy root), then allocates lactate across its astrosynapses weighted by each one's clearance demand. At each astrosynapse it clears spillover glutamate (EAAT) and supplies tonic D-serine; when spillover is high it adds a demand-driven D-serine pulse, brakes nothing of the presynapse directly (the presynaptic brake is PRE reading its own cleft), deposits its calcium trace, and accumulates a dopamine-gated tag. A D-serine pulse cut short by low budget while demand was high is endurance evidence; one cut short by precursor/material exhaustion is a material limit, not endurance. Excess overflow triggers the protective shockwave lockdown.

During NIGHT — the astrosynapse's ceilings are rewritten. NIGHT raises structure (perisynaptic wrap, EAAT density, tonic D-serine) where a validated tag accumulated and budget capacity where budget-limited synthesis recurred; astro_structure is self-reinforcing in both directions, so it amplifies whatever trajectory the synapse is already on.

// PARAMETERS  K_Dserine · Ds_max · Ds_frac · Ds_cost · EAAT_cost · lactate_cost · spillover · overload
// INTERFACE
//   EMIT      astro_lactate[i] → pre/post/dend budgets ; astro_Dserine[i] → POST (gate)
//   RECEIVE   (signals) glutamate ← PRE (clearance + spillover) ; dopamine
//   READ      glutamate ; dopamine
//   OWN       astro_structure{perisynaptic_distance⁻¹, EAAT, Dserine_tonic, ECM} ; astro_budget_ceiling
//   SUPPLY    glucose (ROOT) ; astro_material, astro_energy ← cell body (NIGHT)
//   NOTE      ASTRO endurance fires on BUDGET-limited synthesis (got<want via low budget);
//             material/precursor-limited synthesis is a material limit, not endurance. Own-state proxy.
//   EMERGENCY emits shockwave_lockdown on overload

DAY | CONTINUOUS:                                          // per astrosynapse i
    // RECEIVE   (root production, capped by glucose)
    astro_central_budget += glycolysis(glucose)·Δt
    // ADJUST    (demand weights across territory)
    for each i: demand[i] = clearance_load[i] × astro_structure[i].delivery_eff
    factor = min(1, astro_central_budget / (Σ demand·lactate_cost + ε))
    // EMIT      (demand-weighted lactate to all components)
    for each i:
        astro_lactate[i] = demand[i] × factor;  astro_central_budget -= astro_lactate[i]·lactate_cost
    // BEHAVE    (clear glutamate ; supply tonic D-serine)
    glutamate[i] -= astro_structure[i].EAAT × glutamate[i]·Δt;  astro_central_budget -= clearance·EAAT_cost
    astro_Dserine[i] += astro_structure[i].Dserine_tonic·Δt
    if glutamate[i] > spillover:
        // TRACE
        astro_fast_trace[i] += mGluR_Ca();  astro_fast_trace[i] *= decay(s)
        // ADJUST    (D-serine demand from spillover)
        want = sat(astro_fast_trace[i], K_Dserine) × Ds_max
        got  = min(want, astro_central_budget × Ds_frac)
        // BEHAVE + EMIT  (D-serine pulse to POST gate)
        astro_Dserine[i] += got;  astro_central_budget -= got·Ds_cost
        // TRACE     (endurance: BUDGET-limited synthesis under high own demand)
        if got < want and astro_central_budget low and astro_fast_trace[i] > traj_thr:
            astro_endurance_need[i] += (want - got)
        // TRACE     (strength)
        if astro_fast_trace[i] > elig: astro_possible_tag[i] += astro_fast_trace[i]
        if dopamine > dop_thr and astro_possible_tag[i] > tag_thr:
            astro_tag[i] += dopamine × astro_possible_tag[i]
    // DECAY
    //   FAST   (mss) — astro_fast_trace already decayed above (intra-step)
    //   MEDIUM (smin)
    astro_possible_tag[i] *= decay(s);  astro_endurance_need[i] *= decay(min)
    //   SLOW   (hr)
    astro_tag[i] *= decay(hr)
    //   (PERSISTENT: astro_structure, astro_budget_ceiling — no DAY decay; NIGHT only)
    // EMERGENCY
    if astro_fast_trace[i] > overload: emit(shockwave_lockdown)

Special — Shockwave Lockdown

DAY or NIGHT | OVERLOAD:
    Vm = HYPERPOLARIZED;  AMPA_surface = mass_internalize() → post reserve
    axon_fast_trace += overdrive();  astro_central_budget -= emergency_cost


NIGHT

Same grammar on ceilings, once per cycle.

NIGHT | 1  RECEIVE + ADJUST + EMIT  (replenish, weight, distribute)
    // RECEIVE  overnight production at roots (capped by glucose; gated by soma_tag)
    astro_central_{budget,energy,material} += overnight_*(glucose, …)·Δt
    soma_{budget,energy} += overnight_*()·Δt ; soma_material += CREB_synth(soma_tag)·Δt
    // ADJUST   tag-weighted shares
    for each i with astro_tag[i] > tag_expiry:  w = astro_tag[i]/Σastro_tag
    // EMIT     distribute material + energy down the supply chains
        astro_energy[i] += astro_central_energy·w;  astro_material[i] += astro_central_material·w
    dend_material += soma_material·f_dend ; axon_material += soma_material·f_axon ; soma_material -= …
    post_material += dend_material·f_spine ; pre_material += axon_material·f_bouton
    {pre,post,dend,axon}_energy += soma_energy·{·}_energy_frac
    {pre,post,dend,axon}_budget += astro_lactate_reserve·{·}_frac·Δt

NIGHT | 2  TRACE + BEHAVE  (strength commits → raise structure)
    // ADJUST   coherence bonus when pre, post, astro tags align
    coherence = (pre_tag, post_tag, astro_tag all > tag_expiry) ? coherence_factor : 1
    // TRACE+BEHAVE  build structure for tagged components
    for each c with c_tag > tag_expiry:
        Δ = min(slot_cost, c_material, c_energy·f_cap)
        c_structure += Δ × (coherence if c in {pre,post,astro} else 1)
        c_material -= Δ;  c_energy -= Δ·assembly_cost;  if Δ < slot_cost: queue(→ next NIGHT)

NIGHT | 2b TRACE + BEHAVE  (endurance commits → raise budget_ceiling ; no dopamine ; competes w/ 2)
    for each c with c_endurance_need > endur_thr:
        Δ = min(cap_cost, c_material·f_cap, c_energy·f_cap)
        c_budget_ceiling += Δ;  c_material -= Δ;  c_energy -= Δ·biogenesis_cost;  if Δ<cap_cost: queue

NIGHT | 3  DECAY + RECOVER  (both ceilings decay by neglect ; material recovered)
    maint = (total_material - consumed) × maint_frac / synapse_count
    for each synapse:                                                                   // DECAY
        {pre,post,dend,astro}_structure      -= decay_rate·Δt
        {pre,post,dend,astro}_budget_ceiling -= capacity_decay_rate·Δt
        if maint ≥ maint_cost: structure += full_maint ; budget_ceiling += full_cap_maint
        else:                  structure += maint·frac ; budget_ceiling += maint·cap_frac
    for each synapse with net_change < 0:                                               // RECOVER
        {pre,post,astro}_material += |net_change|·recycle·frac          // material recovered, energy not

NIGHT | 4  BEHAVE  (homeostatic scaling)
    if soma_tag > homeostatic_ceiling:
        s = homeostatic_ceiling / soma_tag
        for each synapse: post_structure.slot_ceiling *= s ; pre_structure.slot_ceiling *= s
        soma_material += Σ reduction·recycle

NIGHT | 5  DECAY  (clear traces)
    all fast_trace, possible_tag, endurance_need = 0
    soma_Na_inactivation = soma_adaptation = soma_refractory_alignment = 0
    for each tag: if tag < tag_expiry: tag = 0             // else carry forward
    // structure and budget_ceiling PERSIST

One-view summary

SEVEN-GROUP GRAMMAR, TWO TIMESCALES
  RECEIVE · TRACE · ADJUST · BEHAVE · EMIT · RECOVER · DECAY

DAY    grammar on OCCUPANCY within two ceilings (structure=strength, budget_ceiling=endurance)
       TRACE yields two evidence streams from local state + arrived signals:
         fast_trace + dopamine             → tag            (strength)
         FUEL shortfall + interrupted LOCAL success → endurance_need (endurance)
       OCCUPANCY/structure/timing shortfalls → short-term depression (NOT endurance)
NIGHT  same grammar on the CEILINGS:
         tag → structure ; endurance_need → budget_ceiling ; both draw one pool (compete)
       unmaintained ceilings decay → recovered material funds the rest
FLOWS  every flow has a timescale: decay relaxes toward 0 over τ, arrival toward a target
       over τ; shipment is transit-delayed; rate-limited inflows carry τ implicitly.
LOCAL  every group uses only own state + arrived signals; RECEIVE/EMIT are the only crossings.