# Tripartite Synapse — Pseudocode v17

> Companion: `tripartite_synapse_v17_biology.md` · principle: `logic_principles_v5`.
> Model — every component runs the SAME THREE CATEGORIES in two directions:
>   (ACTION ⇄ RECOVERY) × many, then PREPARATION — outward by DAY (world), inward by NIGHT (economy).
>   ACTION = the defining deed (day: release/fire/respond/propagate ; night: build ⇄ release structure).
>   RECOVERY = fast alter-ego, restore the ability to act (day: refill ; night: import + free material).
>   PREPARATION = shape what's next, facing this scope AND the other; night PREPARATION REPLAYS the day
>   ACTION (same machinery, no dopamine) to measure PARTICIPATION. "Evaluation" retired — a trace is a
>   provision, not a judgment. Each category spans FAST · MEDIUM · SLOW.
>  (1) NINE actors: LOCAL components (soma·pre·post·dend·axon·astrosynapse) · CELL actors (neuron over
>      soma/pre/post/dend/axon ; astrocyte over astrosynapses) · SYSTEM actors (hypothalamus: DAY/NIGHT
>      + wake ; brainstem: the within-night NON_REM/REM sub-phase rhythm).
>  (2) DAY/NIGHT is a TOP-DOWN context BROADCAST by the hypothalamus, which integrates FATIGUE
>      (astrocyte-reported metabolic debt) ⇄ REST and emits the scope. Earned, not clocked; not local.
>  (3) NIGHT ACTION is BUILD ⇄ RELEASE, participation-arbitrated: build (tag stands + participation ≥
>      MEDIUM; tag funds a slice, persists across cycles) vs release (participation LOW; frees material;
>      tag untouched). Build/release compete WITHIN a component; material competes BETWEEN components.
>      Two forgettings: structural pruning (low participation) · intention decay (tag unspent).
>      TWO PATHWAYS: STRENGTH (possible_tag → dopamine → tag → structure) is dopamine-gated and belongs
>      only to the significance-deciding sites — POST (primary), PRE, SOMA. ENDURANCE (endurance_need →
>      budget_ceiling) is homeostatic, load-driven, NO dopamine. The relays AXON and DEND and the glial
>      ASTROSYNAPSE are ENDURANCE-ONLY (no reward-validated strength tag); the astrosynapse's coverage
>      build is driven by coverage_need (spillover coincident with postsynaptic NO), a homeostatic signal.
>  (4) DAY collaborates (non-rival information; each acts so the next can act); NIGHT competes (rival
>      conserved material) — but the competition is ADJUDICATED by collaborative replay (participation).
>  (5) ASTROCYTE is the metabolic sensor (drives the switch, permits waking) and DAY primer (alpha-driven
>      localized neuromodulation). Higher actors INTEGRATE emissions and BROADCAST — never reach in.
>  (6) governing rule: NO actor authorizes its own restructuring — each is PUT IN POSITION by the actor
>      above (holds an aggregate it cannot see, opens a window it cannot open). Act locally, consolidate
>      hierarchically. Material recycles; ENERGY does not (the arrow of time).
> ASTROSYNAPSE now converted: D-serine = POST gain (not gate) ; astrocyte Ca-spike = territory-coincidence
>   broadcast (integrate-and-fire) ; astrosynapse = volume/gain modulator, build⇄release coverage.

---

DAY AND NIGHT ARE A TOP-DOWN CONTEXT, BROADCAST BY THE HYPOTHALAMUS. The alternation is NOT a local
per-component decision — it is a single context signal emitted from above and received by every
component, the way the neuron's renormalization or the astrocyte's priming is broadcast. The
hypothalamus integrates two competing drives — FATIGUE (metabolic debt, reported chiefly by the
ASTROCYTE, which runs the energy economy) and REST (restoration accumulated during quiet) — and
emits the DAY/NIGHT context according to which dominates:

```
SCOPE CONTEXT (computed by HYPOTHALAMUS, broadcast to all; CONTINUOUS — the one actor that never sleeps):
    fatigue  ← integrate metabolic debt + unspent demand emitted by components (astrocyte-reported)
    rest     ← integrate restoration accumulated while quiet
    emit DAY   while rest dominates fatigue        (behave outward)
    emit NIGHT while fatigue dominates rest        (restructure inward)
  The context is EARNED, not clocked: it is the integrated outcome of the fatigue⇄rest competition,
  not a wall-clock schedule. Components do not each decide when to cross; they receive the context.
```

Why top-down and not local: behaving and restructuring compete for the same substrate (a component
cannot restructure while busy), so the crossing must be coordinated across the coupled components —
a pattern can only replay at night if its whole loop is in NIGHT together. A per-component local
crossing could not guarantee that coherence; a broadcast context does. The switch is top-down; what
each component DOES within the context (behave / replay / build) remains fully local.

THE FATIGUE⇄REST LOOP. Activity generates fatigue (the astrocyte accrues and reports metabolic
debt); rising fatigue tips the hypothalamus to broadcast NIGHT; restructuring discharges debt and
accrues rest; rising rest tips it back to DAY. DAY and NIGHT are the two phases of one homeostatic
competition the hypothalamus integrates and broadcasts — the astrocyte is the metabolic sensor that
feeds it, and (see ASTROCYTE) the discharge of debt during night is what permits waking.

```
  every component  →  emits fatigue (metabolic debt, unspent demand)     ↑
  ASTROCYTE        →  integrates territory energy debt → reports fatigue  ↑ (the metabolic sensor)
  HYPOTHALAMUS     →  integrates fatigue ⇄ rest → BROADCASTS DAY/NIGHT    ↓ (CONTINUOUS)
  every component  →  receives the DAY/NIGHT context (top-down)
```

ACTORS ARE PEERS AT EVERY SCALE; EACH IS PUT IN POSITION BY THE ONE ABOVE. No actor authorizes
its own restructuring. Each holds an aggregate its constituents cannot see and opens a window
they cannot open, then BROADCASTS — it never reaches into a constituent's interior.

```
  HYPOTHALAMUS   integrates fatigue ⇄ rest → broadcasts DAY/NIGHT context  (system, CONTINUOUS)
       ↓ signal
  NEURON         integrates its components' activity/weight → broadcasts    (cell actor)
  ASTROCYTE      reports fatigue upward ; primes (day) + reallocates (night) (cell actor)
       ↓ signal   (NEURON over soma/pre/post/dend/axon ; ASTROCYTE over astrosynapses)
  COMPONENTS     soma · pre · post · dend · axon · astrosynapse — each restructures ITSELF
                 within the broadcast DAY/NIGHT context
  [ ASSEMBLY / NETWORK ]  replay is INTERNALLY generated (spontaneous firing, below); the external
                          replay_reweight only BIASES which internal patterns are favored (cross-neuron
                          coordination), arriving like dopamine/glucose — it is not the replay itself
```

The two cell actors are structurally identical — same integrate-and-broadcast role, different
constituents and conserved quantity: NEURON conserves activity/weight, ASTROCYTE conserves
territory demand/load. Both have their own DAY (integrate, allocate in the gaps) and NIGHT
(broadcast the restructuring window). The HYPOTHALAMUS alone has no night: it runs CONTINUOUS,
always integrating fatigue and emitting sleep-pressure, spanning every other actor's day and
night — the clock that never sleeps.

EVERY SCOPE RUNS THE SAME THREE CATEGORIES: (ACTION ⇄ RECOVERY) × many, then PREPARATION.
  ACTION      the scope's defining deed (DAY: release/fire/respond/propagate — the cleft exchange;
              NIGHT: change structure — the irreversible build).
  RECOVERY    the fast alter-ego of the action — restore the ability to act again (DAY: vesicle
              refill, refractory de-inactivation, Ca clearance; NIGHT: import material/energy, prime).
  PREPARATION shape what comes next — faces BOTH the next same-scope action AND the other scope.
              This is where what earlier drafts called "evaluation" lives: depositing a trace is not
              judging, it is provisioning. DAY-preparation stocks the tag (for NIGHT) and sets
              occupancy/thresholds (for the next action). NIGHT-preparation REPLAYS the action —
              re-runs the SAME machinery as DAY ACTION (same capacity/vesicle checks, same endurance
              deposit into the SAME trace), but with NO dopamine and the release as a PROBE, read as
              participation, not transmitted.

NIGHT IS A SEQUENCE OF REPLAY CYCLES (dual of DAY). DAY loops until energy/material is exhausted;
NIGHT loops until the tag is exhausted. The rotation across scopes: the SAME physical release/fire
is ACTION by DAY (the deed) and PREPARATION by NIGHT (the probe that replays it); the structural
change is only MARKED by day (the inert tag) and ENACTED by night (its action). SOMA is the ignition
point: its night-PREPARATION replay-fire propagates a replay_AP through the DAY PATHWAYS
(soma→axon→pre→glutamate→post→dend→soma), self-igniting the tagged pattern.

COHERENCE IS MECHANICAL, not a checked flag: a pattern re-evokes only where EVERY link in its
recurrent loop is primed (each component's own tag lowered its own threshold in RECOVERY); one
un-primed link breaks the loop at the gap, so only patterns significant all the way around carry.
The assembly that replays is NOT an actor — it is the coincidence of many components' own lowered
thresholds propagating through recurrent coupling.

WHAT PERSISTS MUST HAVE EARNED PERSISTENCE. Night-RECOVERY drives occupancy (VGCC_active,
AMPA_surface, possible_tag) toward baseline; night-ACTION's homeostatic lowering trims all
structure; only what is rebuilt from a still-standing tag with confirmed participation carries
forward. NIGHT ends when the tag is exhausted (well-rested — every significant pattern replayed and
its structure rebuilt) OR energy is spent (overloaded — unspent tags carry to the next night).

---

## Conventions

```
SCOPE = {DAY, NIGHT}   DAY CONTEXT = {AP, REFRACTORY⊂NOT_AP, NOT_AP, NOT_SPIKE_TRAIN, CONTINUOUS}   NIGHT CONTEXT = {NON_REM_1, NON_REM_2, REM}

THE THREE CATEGORIES (see logic_principles "The Ring"):  (ACTION ⇄ RECOVERY) × many, then PREPARATION
  ACTION       the component's defining deed; deposits the fast trace. ALWAYS LOCAL to the acting
               component (cannot be done on another's behalf — that would be signalling, not acting).
  RECOVERY     the fast alter-ego of action — restore the ability to act again (refill, de-inactivate,
               clear). Day: restock private pools. Night: import material/energy, free trimmed material.
  PREPARATION  shape what comes next; faces BOTH the next same-scope action AND the other scope.
               Stocks the tag (for NIGHT) and tunes occupancy/thresholds (for the next action). What
               earlier drafts called "evaluation" is here: depositing a trace is provisioning, not
               judging. RECOVERY and PREPARATION may be LOCAL or CONTEXTUAL (a neighbor supplies them);
               ACTION is always local. A near-pure-action component (e.g. a channel) is ACTION-only.
  A category names a KIND of work, not a timescale: each spans FAST · MEDIUM · SLOW.

CONTEXT LICENSES PHASE (context = the imposed condition; phase = the work it permits).
  The context is what other components impose (a spike delivered or not, a train present or not);
  the category annotation says which work runs. Contexts can NEST, and nested contexts run
  ON TOP of their parent — a behavior is written in exactly ONE context, so nothing double-runs:
    AP               spike this step            → ACTION
    NOT_AP           no spike this step         → RECOVERY (restock)      (in-train gaps AND quiet)
    NOT_SPIKE_TRAIN  no spike AND no train  ⊂ NOT_AP  → adds PREPARATION  (runs on top of NOT_AP)
  A process runs in the SHORTEST quiet its timescale fits: fast-trace decay and partial pool refill
  in NOT_AP (they ride the train and set short-term depression); tag formation, full refill, and
  occupancy read-out in NOT_SPIKE_TRAIN. (Components without trains use continuous flow.)

  WHO EMITS THE CONTEXT (a context is a signal from ABOVE, not self-generated):
    AP, REFRACTORY   emitted by SOMA — its own firing state (AP = it fired; REFRACTORY = the recovery
                     window after, when it cannot fire again yet). What was "NOT_AP" is REFRACTORY.
    NOT_SPIKE_TRAIN  emitted by the NEURON — sustained absence of soma spikes can only be tracked from
                     ABOVE the soma (a component cannot easily know "I have not fired for a while");
                     the neuron keeps count of the gap and broadcasts it down.
    NON_REM_1/2, REM emitted top-down within the NIGHT context (see DAY/NIGHT switch) — the night's
                     sub-phases: NON_REM_1 → ACTION (build⇄release), NON_REM_2 → RECOVERY
                     (import+free), REM → PREPARATION (replay+measure+prime).

  POST INVERTS THE DAY MAP. For the postsynapse the deed is RECEIVING, which happens whenever no
  descending spike is arriving, so: NOT_AP → ACTION (open AMPA/NMDA, respond), AP → RECOVERY (the
  brief descending spike, driven from above, restore + boost traces), NOT_SPIKE_TRAIN → PREPARATION.
  POST's ACTION continues through the soma's REFRACTORY (refractory is the soma's state, not POST's;
  from POST it is NOT_AP), which is how the spine charges up to ready the next spike.

VARIABLE TIERS (timescale = meaning; see logic_principles "The Timescale Ladder")
  FAST       (ms–s)   immediate response     fast_trace
  MEDIUM     (s–min)  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)

THE DAY STRENGTH CLIMB (same three-tier averaging in every component):
  1. each ACTION leaves a fast_trace (FAST).
  2. the running AVERAGE of fast_traces over SECONDS fills occupancy → short-term strength
     (VGCC_active in PRE, AMPA_surface in POST, …); a LOW average lets occupancy drift back (STD).
  3. the AVERAGE-OF-THE-AVERAGE over MINUTES (possible_tag), in coincidence with dopamine, raises
     the TAG (SLOW) — the token passed to NIGHT. At night the tag is spent to modify structure
     (the persistent version of the same strength the occupancy held transiently).
  So occupancy is the fast/medium memory of participation; the tag is its dopamine-validated,
  night-consolidatable distillate. Same climb, same three tiers, in all six components.

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.

CUT SIGNPOSTS (@cut) — an INDEX into the possibility, not part of it. The pseudocode expresses the
  POSSIBILITY of verifying behaviours in time/space/quantity; a CUT is a reading WE impose from the
  outside to construct an object, and cuts are UNBOUNDED, so they are NOT in the code — they live in
  the companion `logic_of_aggregations` (there, a "cut" fixes levels on time/space/quantity + scope,
  and an OBJECT is a name over the behaviours so read). A signpost only marks a STORE where such an
  outside reading can be TAKEN — what it affords us, at what grain. It is NOT a mark on the
  component's own local decisions: thresholds, tags, and bucketings like level() are the component
  BEHAVING (expression), not us reading (a cut), and carry no signpost. The test is whose act it is:
  the component's own decision is expression; our reading-to-build-an-object is a cut. A signpost
  computes nothing and privileges no reading; deleting every @cut leaves the expression unchanged.
  Form:
      <store> ...    // @cut affords: <behaviours readable here> [grain]
  Rules: one per load-bearing store (the traces, tags, occupancies, coincidence sites — not every
  line); names affordances, never computes them; must be deletable with zero effect. For the worked
  readings, see logic_of_aggregations.

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)
replay_reweight[·]                        // assembly/network replay re-weighting (external, NIGHT)
glucose  geometry                         // physical (external)
scope_context ∈ {DAY, NIGHT}              // BROADCAST by HYPOTHALAMUS (top-down; the switch, read by all)
sub_phase ∈ {NON_REM_1,NON_REM_2,REM}     // BROADCAST by BRAINSTEM within NIGHT (the sub-phase rhythm)
circuit_recruitment  unspent_participation  // NEURON/ASTROCYTE → BRAINSTEM (REM recruit ; participation not yet acted on)
summed_tag_remaining  night_fatigue       // → HYPOTHALAMUS wake (tag-exhaustion) ; BRAINSTEM → HYPO (REM cost)
fatigue_gain  rest_gain                   // hypothalamus fatigue⇄rest integration weights
elig  dop_thr  tag_thr  tag_expiry        // strength gates (universal)
traj_thr  endur_thr                       // endurance gates (universal)
ship_cost                                 // transport overhead (all shipments)
{dend,axon,pre,post}_ship_frac            // DAY budget-shipment fractions
τ_transport_{dend,axon,spine,bouton}      // shipment transit times (distance-dependent)
ε
```

## NIGHT parameters (consolidation only)

```
slot_batch  cap_batch  f_cap              // per-CYCLE commit/allocation sizes / endurance fraction
night_energy_ceiling                      // total energy a single night can spend (supply bound)
Δt_cycle                                  // duration of one NIGHT cycle (recovery→preparation→action)
maint_frac  cap_frac                      // maintenance allocation
decay_rate  capacity_decay_rate  recycle  // passive ceiling decay + material recovery
homeostatic_ceiling  assembly_cost  biogenesis_cost  maint_cost
f_dend  f_axon  f_spine  f_bouton         // per-cycle material/energy ship fractions (down the chain)
downscale_factor                          // per-cycle multiplicative occupancy reset (<1), night RECOVERY
neuron_weight_ceiling                     // renormalization target (broadcast constraint)
// ── NIGHT (RECOVERY = import/prime · PREPARATION = replay probe · ACTION = restructure) ──
spont_thr_base  thr_gain                  // spontaneous threshold = base − gain×own_tag (night RECOVERY prime)
prime_thr  prime_gain                     // tag threshold to raise VGCC, and the gain (night RECOVERY)
release_rate  homeostatic_floor           // night RELEASE: shed rate + floor structure never pruned below
intrinsic_fluctuation()                   // intrinsic sub-threshold noise (the night's ignition source)
mini_flux  mini_Ca()                      // spontaneous mini release size + its Ca deposit (REM probe)
level(·) → {LOW, MEDIUM, HIGH}            // reads fast_trace as circuit participation (REM, no dopamine)
replay_AP                                 // propagated re-evocation spike (soma → axon/dend, self-igniting)
```

---
---
# LOCAL COMPONENTS
> Each behaves within the broadcast DAY context and restructures within the broadcast NIGHT context
> (see Conventions: the transition rule). `DAY | …` / `NIGHT | …` label local states, not a clock.
---

## PRE

The presynaptic bouton releases neurotransmitter and gathers evidence about whether that
release was worth strengthening and worth sustaining. Like every component it runs the three
categories — (ACTION ⇄ RECOVERY) × many, then PREPARATION — in two directions: outward by DAY
(against the cleft), inward by NIGHT (against the economy).

**DAY · ACTION (the AP) — the bouton releases.** The amount released depends on residual
**calcium** (the fast trace, set by this spike), the current **VGCC coupling occupancy** (how
tightly channels are coupled right now, bounded by structure), the two **retrograde messages**
(`retro_eCB` brakes, `retro_NO` confirms release reached a responsive target), and the
availability of **fuel and vesicles**. The action deposits the fast trace the rest of the turn
reads. Two shortfalls read differently: a fuel shortfall on a succeeding release is *endurance*
evidence; an empty pool with fuel to spare is ordinary short-term depression.

**DAY · RECOVERY (between spikes) — restock to release again.** In the inter-spike gaps the bouton
refills its vesicle pool and lets the fast trace relax — the fast alter-ego of release, riding the
train, and the release-vs-refill race is what sets short-term depression.

**DAY · PREPARATION (train passed) — shape the next release AND the night.** Reading the accumulated
fast trace, the bouton climbs eligibility (`possible_tag`) and, on the dopamine coincidence, the
`tag` — the token stocked for the night (this is provisioning, not judging). It also latches the
retrograde messages, tightens its VGCC coupling from eligibility (reversible short-term potentiation,
no dopamine, bounded by structure), and refills budget toward the next demand.

**NIGHT — the same three categories as DAY, at a slower timescale, turned inward.** Every scope
runs the same shape: an alternation of ACTION ⇄ RECOVERY (many times), then PREPARATION. By DAY
that is (release ⇄ vesicle-refill) × many spikes, then preparation (climb the tag, set VGCC,
refill, thresholds). By NIGHT it is (restructure ⇄ material-import) × many cycles, then preparation
(the probe-release that measures participation to shape the next restructuring). ACTION is the
scope's defining deed; RECOVERY is its fast alter-ego, restoring the capacity to act again;
PREPARATION follows the alternation to shape what comes next — and faces both the next same-scope
action and the OTHER scope (which is where what earlier drafts called "evaluation" lives: stocking
the tag is preparing for night, not judging the present). Note the rotation: NT release is ACTION
by day and PREPARATION by night; the structural change is only marked by day (the tag) and enacted
by night. The bouton is not a sink — by night it emits inward and upward.

```
// 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 in PREPARATION; pools refill in RECOVERY/PREPARATION)
//   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
//
// TRACE CREATION MODES (every trace: trace += input·Δt − trace·(Δt/τ_decay))
//   impulse    input = quantum·δ(event)  — a point event; no rise time, τ = decay only   (FAST)
//   accumulate input = rate(condition)·Δt — ramps while a condition holds; τ = rise AND decay (MEDIUM/SLOW)
//
// THE THREE CATEGORIES (same at DAY and NIGHT; here at the DAY timescale, subject = the cleft):
//   ACTION      release NT (the defining deed) — context AP
//   RECOVERY    restore the ability to release again: vesicle refill — the fast alter-ego of AP,
//               runs in the inter-spike gaps (NOT_AP), riding the train, setting STD depth
//   PREPARATION shape what comes next — climb the tag (for NIGHT), set VGCC, refill budget,
//               thresholds, decay — runs once the train subsides (NOT_SPIKE_TRAIN ⊂ NOT_AP)
//   Pattern per scope: (ACTION ⇄ RECOVERY) × many spikes, then PREPARATION.
//   Contexts nest (NOT_SPIKE_TRAIN ⊂ NOT_AP); each behavior in exactly ONE block.

// ===== ACTION =====
DAY | AP:                                                  // release into the cleft (the defining deed)
    // deposit the fast trace THIS action leaves  (FAST · impulse)
    pre_fast_trace += spike_Ca(pre_structure.VGCC_coupling)·δ(spike)   // @cut affords: NT-emission frequency, recency (elapsed-since-release) [ms]
    drive = sat(pre_fast_trace × VGCC_active, K_release) × (1 - retro_eCB_local)
    if pre_budget < release_cost:                          // FUEL shortfall → endurance evidence
        suppress(NT_flux)
        if pre_fast_trace > traj_thr:                      // MEDIUM · accumulate (a PREPARATION deposit)
            pre_endurance_need += pre_fast_trace × (1 + retro_NO_local)·Δt   // @cut affords: stamina / sustained-load need (endurance pathway) [min]
        exit
    if RRP == 0:  suppress(NT_flux);  exit                 // OCCUPANCY shortfall → STD (not endurance)
    NT_flux = RRP × drive;  RRP -= NT_flux·Δt;  pre_budget -= NT_flux·fusion_cost
    glutamate += NT_flux·Δt                                // EMIT glutamate → POST, ASTRO   // @cut affords: NT flow into cleft; joint pre-post coincidence read downstream at POST.NMDA [ms]
    if glutamate > spillover: drive *= brake               // own-cleft autobrake

// ===== RECOVERY (alter-ego of ACTION; runs in the inter-spike gaps, rides the train) =====
DAY | NOT_AP:                                              // restore the ability to release again
    RRP += fill(RRP, pre_structure.slot_ceiling, pre_structure.refill_ceiling, vatpase_cost, pre_budget)
    pre_fast_trace *= decay(100ms)                         // FAST — the trace relaxes between spikes
    // (partial refill vs release is the STD race — this is recovery keeping pace with action)

// ===== PREPARATION (shape what comes next; faces the next train AND the NIGHT) =====
DAY | NOT_SPIKE_TRAIN:                                     // sustained quiet; ⊂ NOT_AP
    retro_NO_local = retro_NO;  retro_eCB_local = retro_eCB     // latch arrived signals
    // for NIGHT: climb the tag (stock the token the night-action will spend)  (MEDIUM→SLOW accumulate)
    if pre_fast_trace > elig: pre_possible_tag += pre_fast_trace·Δt        // @cut affords: participation / consistency-of-co-activity (running average) [min]
    if dopamine > dop_thr and pre_possible_tag > tag_thr:
        pre_tag += dopamine × pre_possible_tag·Δt                          // @cut affords: structural-consolidation need (spent overnight; precision pathway) [hr→night]
    // for the NEXT TRAIN: STP read-out (eligibility → coupling readiness; 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 = un-honored decay
    // for the NEXT TRAIN: full budget refill toward next demand (forward-facing)
    pre_budget += refill(pre from astro_lactate[syn] + transit(axon_ship_pre, τ_transport_bouton))
    // settle the medium/slow stocks (fast-trace decay already ran in RECOVERY; not repeated)
    pre_possible_tag *= decay(s);  pre_endurance_need *= decay(min)         // MEDIUM
    pre_tag *= decay(hr)                                                    // SLOW
    dopamine *= decay(ms);  retro_NO *= decay(s);  retro_eCB *= decay(s)

// ── NIGHT: SAME three categories, consolidation timescale, subject = the pattern. The rhythm is
//    (ACTION ⇄ RECOVERY) × many, then PREPARATION, then again — like DAY's (release ⇄ refill) × many
//    → prep. Two competitions at two loci: WITHIN action, build vs release contend over the
//    component's own structure (participation is the arbiter); WITHIN recovery, THIS component vs
//    OTHERS contend for shared material/energy. A category spans all THREE timescales (fast/med/slow).
//      ACTION      change structure — BUILD (participation high + tag stands; tag funds it, a slice
//                  per cycle so the tag persists across cycles) ⇄ RELEASE (participation LOW; frees
//                  material; tag untouched). Both always possible; participation selects direction.
//      RECOVERY    restore the ability to build: acquire material/energy from the shared pool AND
//                  receive freed material — in CONTENTION with other components.
//      PREPARATION replay the release as a probe (SAME machinery as day ACTION) to measure
//                  participation; itself multi-timescale: probe⇄restock (fast), VGCC/threshold
//                  prime from the tag (medium), tag settle (slow).
//    Two independent forgettings: structural pruning ← low participation (release); intention decay
//    ← tag decaying unspent. Loops until the tag is spent.

// ===== ACTION (build ⇄ release; participation gates direction; tag funds build, persists across cycles) =====
NIGHT | build or release:                                  // the night's defining deed (both directions)
    // BUILD (participation confirmed AND tag stands): spend a SLICE of the tag — persists next cycle
    if rest_permission and pre_tag > tag_expiry and pre_participation ≥ MEDIUM:
        Δ = min(slot_batch, pre_material, pre_energy·f_cap, pre_tag) × pre_participation
        pre_structure += Δ;  pre_material -= Δ;  pre_energy -= Δ·assembly_cost   // @cut affords: overnight build⇄release, structural persistence [night]
        pre_tag -= Δ                                       // SLICE only — tag survives for successive cycles
        if pre_endurance_need > endur_thr:                 // endurance capacity builds on the same act
            Δ' = min(cap_batch, pre_material·f_cap, pre_energy·f_cap)
            pre_budget_ceiling += Δ';  pre_material -= Δ';  pre_energy -= Δ'·biogenesis_cost
            pre_endurance_need -= Δ'
    // RELEASE (participation LOW): shed structure, FREE material back to the shared pool; tag untouched
    else if pre_participation == LOW:
        shed = release_rate × max(pre_structure - homeostatic_floor, 0)
        pre_structure -= shed;  pre_freed_material += shed·recycle       // freed → contested pool (RECOVERY)
        pre_budget_ceiling -= capacity_decay_rate·Δt_cycle
    // else (tag present but participation not confirmed this cycle): HOLD — tag waits for its pattern

// ===== RECOVERY (acquire material/energy in CONTENTION with other components; receive freed material) =====
NIGHT | import + free:                                     // alter-ego of the night ACTION (inter-component)
    pre_material += transit(pre_material_ship, τ_transport_bouton)   // import build material (contested pool)
    pre_energy   += transit(pre_energy_ship,   τ_transport_bouton)   // import build energy (contested pool)
    pre_material += pre_freed_material;  pre_freed_material = 0       // reclaim what release freed
    if renorm_signal arrived:                                        // descended constraint → free structure
        freed = pre_structure × (1 - renorm_signal);  pre_structure *= renorm_signal
        emit(freed → recycled material pool)                         // freed material re-enters contention
    pre_material += pre_ceiling_shrinkage·recycle                    // energy NOT recovered
    pre_maintain: pre_structure += min(pre_maint, maint_cost)        // hold up what is used

// ===== PREPARATION (REPLAY the release as a probe — SAME machinery as day ACTION; multi-timescale) =====
//   Replay re-runs the release exactly as by day: same drive, same capacity + vesicle checks, same
//   endurance deposit into the SAME pre_endurance_need trace. Differs from DAY ACTION: no dopamine,
//   and the glutamate is a PROBE — drives the pattern onward and its own trace is read as participation.
NIGHT | replay + measure + prime:                          // release here is PREPARATION, not the deed
    // FAST: probe-release ⇄ restock (the replay, run repeatedly to measure participation)
    spont = intrinsic_fluctuation()
    if spont > pre_spont_thr or arrived_replay_AP:         // ignite: spontaneous, or recruited by the pattern
        pre_fast_trace += mini_Ca(VGCC_active)·δ(replay)   // SAME trace deposit as DAY ACTION
        drive = sat(pre_fast_trace × VGCC_active, K_release)
        if pre_budget < release_cost:                      // SAME capacity check → endurance evidence
            suppress(replay_flux)
            if pre_fast_trace > traj_thr:
                pre_endurance_need += pre_fast_trace·Δt     // SAME trace, fed by replay too
        else if RRP > 0:                                   // SAME vesicle check
            replay_flux = RRP × drive;  RRP -= replay_flux·Δt;  pre_budget -= replay_flux·fusion_cost
            glutamate += replay_flux·Δt                    // real glutamate → POST: carries the pattern onward
    RRP += fill(RRP, pre_structure.slot_ceiling, pre_structure.refill_ceiling, vatpase_cost, pre_budget)  // restock
    pre_participation = level(pre_fast_trace)              // read the replayed response as participation
    // MEDIUM: prime excitability + VGCC from the standing tag (readies the next probe AND next build)
    pre_spont_thr = spont_thr_base − thr_gain × pre_tag
    if pre_tag > prime_thr:
        VGCC_active = min(VGCC_active + prime_gain × pre_tag, pre_structure.VGCC_coupling)
    pre_possible_tag *= occupancy_downscale                // apply descended constraint to self
    // SLOW: settle
    pre_fast_trace *= decay(100ms);  pre_tag *= decay(hr);  pre_endurance_need *= decay(slow)
    emit(pre_fatigue, pre_demand → upward)                 // not a sink: emits inward/upward by night
```

---

## 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.

**POST's ACTION is the synaptic response (context NOT_AP).** Integration is graded and ongoing
rather than spike-punctate, so POST's action-context is "no descending AP arriving": it opens its
channels and responds to whatever glutamate has arrived. Three calcium sources feed the fast trace —
AMPA current (small Ca, begins ejecting the NMDA Mg block) and NMDA (large Ca, scaled by the local
coincidence of depolarization + astrocyte D-serine + glutamate). The action deposits the calcium
trace and emits **NO** — the fast retrograde, tracking the NMDA calcium transient, confirming the
response reached a responsive target. (The other retrograde, **eCB**, is slow — produced from
*accumulated* depolarization and emitted in PREPARATION as an integrated brake on the next release,
not per-response.) Crucially POST's ACTION **continues through the soma's
refractory period**: the refractory belongs to the soma, not to POST — from POST it is simply NOT_AP,
so the spine keeps responding and integrating, charging up so the neuron is ready to fire again once
its refractory ends.

**POST's RECOVERY is the descending AP (context AP) — a brief event.** When the soma's spike arrives
it adds depolarization and calcium, supralinearly boosts an existing candidate (the soma's
confirmation that it fired), and resets the spine: calcium extrudes, the NMDA Mg-block re-establishes
as Vm falls, and the trace relaxes — restoring the ability to respond again. This is the *alter-ego*
of the response, and it is short (the spike event), not the whole refractory window.

**EVALUATION FOLDS INTO PREPARATION (context NOT_SPIKE_TRAIN).** PREPARATION shapes what comes next:
it fills AMPA surface toward the slot ceiling from accumulated calcium (short-term potentiation, no
dopamine — for the next response), climbs the tag on the dopamine coincidence (for the night),
refills budget, and settles. A fuel shortfall while calcium was climbing toward a tag is endurance
evidence (a preparation deposit made during action); a surface already at its ceiling is a
structural limit, not endurance.

**During NIGHT — the same three categories, turned inward, in sleep-stage contexts.** NON_REM_2
(RECOVERY) imports material/energy and primes AMPA responsiveness from the standing tag. REM
(PREPARATION) replays: POST responds to the re-evoked glutamate exactly as it responds by day (same
AMPA/NMDA machinery, same endurance deposit into the same trace), reading the response as
participation rather than transmitting — no dopamine. NON_REM_1 (ACTION) is the structural change:
rebuild where the tag stands and participation was confirmed (consuming the tag) ⇄ release where
participation was low. Both ceilings draw the same finite pool and compete; unmaintained ceilings
drift down.

```
// PARAMETERS  K_AMPA · AMPA_Ca · AMPA_cost · NMDA_cost · AP_cost · pka_cost · traffic_cost
//             req_cost · Mg_eject · K_Ds · 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 ; AP (descending) ← DEND/SOMA ; dopamine
//   READ      glutamate ; astro_Dserine (GAIN, not gate) ; AP via 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.

// THE THREE CATEGORIES (same at DAY and NIGHT; here DAY, subject = arrived glutamate / AP):
//   ACTION      (NOT_AP) respond: open AMPA/NMDA channels, integrate glutamate, detect the
//               instantaneous coincidence, emit retro. This is POST's defining deed and it happens
//               ALWAYS EXCEPT during an arriving AP — INCLUDING through the soma's refractory period:
//               refractory is the SOMA's state, not POST's; from POST it is simply NOT_AP, so POST
//               keeps responding and integrating, charging the spine so the neuron is ready to fire
//               again once refractory ends.
//   RECOVERY    (AP) the BRIEF descending-spike arrival (ms): POST is driven from above, restores its
//               ability to respond (Ca extrusion, Mg-block re-establishes as Vm falls), and deposits/
//               boosts traces. Short event, not a long window.
//   PREPARATION (NOT_SPIKE_TRAIN) shape what comes next: AMPA fill (next response) + tag climb (NIGHT)
//               + refill + settle.
//   Coincidences sort by timescale: D-serine detected IN ACTION (instantaneous); dopamine in PREPARATION.

// ===== ACTION (NOT_AP: open channels, respond — continues through the soma's refractory) =====
DAY | NOT_AP:                                             // respond to arrived input (the defining deed)
    a = sat(glutamate, K_AMPA)
    AMPA_current = a × AMPA_surface;  Vm += AMPA_current;  post_budget -= AMPA_cost   // SOURCE 1 AMPA
    post_fast_trace += AMPA_Ca·AMPA_current                                          // @cut affords: channel-opening frequency, response magnitude (quantity of response) [ms]
    if Vm > Mg_eject and glutamate > 0:                                              // SOURCE 2 NMDA (Mg relieved)
        post_fast_trace += NMDA_Ca(glutamate) × sat(astro_Dserine, K_Ds)·rise_speed();  post_budget -= NMDA_cost   // @cut affords: THE pre-post-astro COINCIDENCE — joint three-component read (glutamate × depolarisation × D-serine gain); the meeting-site owning none of its inputs [ms, three-component space]
        // D-serine sets the GAIN (how strongly POST responds), not a coincidence gate — dialed by the astrocyte
        retro_NO += NO_emit(post_fast_trace);  post_budget -= NO_synth_cost           // EMIT + "responsive target" (fast: tracks the NMDA Ca transient)
    // (eCB is NOT emitted here — it is slow/integrated, produced in PREPARATION from accumulated depolarisation)

// ===== RECOVERY (AP: brief descending-spike arrival — restore + boost traces) =====
DAY | AP:                                                  // soma's spike arrives (ms event), driven from above
    Vm += AP_depol × dend_structure.bAP_fidelity;  post_budget -= AP_cost
    if post_possible_tag > Ca_TAG: post_fast_trace += AP_Ca_boost()   // boost only if a candidate is present
    post_fast_trace *= decay(ms)                           // Ca extruded, trace relaxes — ready to respond again
    // (NMDA Mg-block re-establishes as Vm falls — implicit in the Vm>Mg_eject gate next response)

// ===== PREPARATION (NOT_SPIKE_TRAIN: shape the next response AND the NIGHT) =====
DAY | NOT_SPIKE_TRAIN:                                     // sustained quiet (emitted by NEURON — above SOMA)
    // slow retrograde: eCB is produced from ACCUMULATED depolarisation (integrated, not per-response) —
    // a brake on the NEXT release, so it is prepared here, not deposited in the action
    if post_fast_trace > eCB_thr:
        retro_eCB += eCB_emit(post_fast_trace);  post_budget -= eCB_synth_cost         // EMIT − brake (slow, integrated)
    // for NIGHT: climb the tag; dopamine is the integrable coincidence (#3)
    if post_fast_trace > Ca_TAG: post_possible_tag += post_fast_trace;  post_budget -= pka_cost   // @cut affords: participation / consistency of co-activity (running average) [min]
    if dopamine > dop_thr and post_possible_tag > tag_thr:
        post_tag += dopamine × post_possible_tag           // token minted for NIGHT   // @cut affords: structural-consolidation need (precision pathway; dopamine-gated) [hr→night]
    // for the NEXT RESPONSE: STP fill / STD drift
    if post_fast_trace > Ca_STP:
        if post_budget < traffic_cost:                     // FUEL shortfall → endurance (a PREPARATION deposit)
            if post_fast_trace > traj_thr and post_fast_trace_rising:
                post_endurance_need += post_fast_trace     // @cut affords: stamina / sustained-load need (endurance pathway) [min]
        else if AMPA_surface < post_structure.slot_ceiling:
            AMPA_surface += Ca_insert(post_fast_trace);  post_budget -= traffic_cost
        // else: surface at slot_ceiling → structure-limited (not endurance)
    else:
        AMPA_surface = max(AMPA_surface - drift·Δt, baseline)   // STD = un-honored decay
    post_budget += refill(post from astro_lactate[syn] + transit(dend_ship_post, τ_transport_spine))
    post_possible_tag *= decay(min);  post_endurance_need *= decay(min)     // MEDIUM
    post_tag *= decay(hr);  dopamine *= decay(ms)                           // SLOW + signals

// ── NIGHT: SAME three categories, consolidation timescale, subject = the pattern.
//    Rhythm: (ACTION ⇄ RECOVERY) × many, then PREPARATION. Build⇄release contend WITHIN (participation
//    arbitrates); material contends BETWEEN components (recovery). Night PREPARATION replays the DAY
//    ACTION (same AMPA/NMDA machinery, same endurance trace), read for participation not significance.

// ===== ACTION (build ⇄ release; participation gates direction; tag funds build, persists across cycles) =====
NIGHT | NON_REM_1:
    if rest_permission and post_tag > tag_expiry and post_participation ≥ MEDIUM:      // BUILD (slice)
        Δ = min(slot_batch, post_material, post_energy·f_cap, post_tag) × post_participation
        post_structure += Δ;  post_material -= Δ;  post_energy -= Δ·assembly_cost
        post_tag -= Δ                                       // SLICE — tag persists across cycles
        if post_endurance_need > endur_thr:
            Δ' = min(cap_batch, post_material·f_cap, post_energy·f_cap)
            post_budget_ceiling += Δ';  post_material -= Δ';  post_energy -= Δ'·biogenesis_cost
            post_endurance_need -= Δ'
    else if post_participation == LOW:                       // RELEASE: shed, free material; tag untouched
        shed = release_rate × max(post_structure - homeostatic_floor, 0)
        post_structure -= shed;  post_freed_material += shed·recycle
        post_budget_ceiling -= capacity_decay_rate·Δt_cycle
    // else: HOLD — tag waits for its pattern

// ===== RECOVERY (acquire material/energy in CONTENTION with other components; receive freed material) =====
NIGHT | NON_REM_2:
    post_material += transit(post_material_ship, τ_transport_spine)   // import (contested pool)
    post_energy   += transit(post_energy_ship,   τ_transport_spine)
    post_material += post_freed_material;  post_freed_material = 0     // reclaim what release freed
    if renorm_signal arrived:
        freed = post_structure × (1 - renorm_signal);  post_structure *= renorm_signal
        emit(freed → recycled material pool)
    post_material += post_ceiling_shrinkage·recycle        // energy NOT recovered
    post_structure += min(post_maint, maint_cost)          // hold up what is used

// ===== PREPARATION (REPLAY the response — SAME machinery as day ACTION; multi-timescale) =====
NIGHT | REM:
    // FAST: replay the response to the re-evoked input (probe)
    if arrived_glutamate_replay or arrived_replay_AP:
        a = sat(glutamate, K_AMPA)
        post_fast_trace += AMPA_Ca·(a × AMPA_surface)      // SAME AMPA machinery as DAY ACTION
        if Vm > Mg_eject:
            post_fast_trace += NMDA_Ca(glutamate) × sat(astro_Dserine, K_Ds)   // SAME NMDA machinery (D-serine = gain)
        if post_budget < traffic_cost:                     // SAME capacity check → endurance evidence
            if post_fast_trace > traj_thr: post_endurance_need += post_fast_trace   // SAME trace, fed by replay
    post_participation = level(post_fast_trace)            // read replayed response as participation
    // MEDIUM: prime responsiveness (AMPA occupancy) from the standing tag
    post_spont_thr = spont_thr_base − thr_gain × post_tag
    if post_tag > prime_thr:
        AMPA_surface = min(AMPA_surface + prime_gain × post_tag, post_structure.slot_ceiling)
    post_possible_tag *= occupancy_downscale
    // SLOW: settle
    post_fast_trace *= decay(ms);  post_tag *= decay(hr);  post_endurance_need *= decay(slow)
    emit(post_fatigue, post_demand → upward)               // not a sink: emits inward/upward by night
```

---

## 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.

**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.

// THE THREE CATEGORIES (same at DAY and NIGHT; here DAY, subject = soma's bAP / spine input):
//   ACTION      propagate the bAP to spines + integrate spine voltage to soma (context bAP)
//   RECOVERY    restore branch excitability: Ca clearance (fast alter-ego of propagation)
//   PREPARATION shape the next: tag climb (NIGHT), attention threshold, ship to spines, refill, settle
//   ONE fuel shortfall that cuts propagation short = endurance; distance attenuation = structural limit.

// ===== ACTION =====
DAY | bAP:                                                 // propagate + integrate (the defining deed)
    if dend_budget < prop_cost:
        if dend_fast_trace > traj_thr:                     // FUEL shortfall → endurance (a PREPARATION deposit)
            dend_endurance_need += dend_fast_trace         // @cut affords: stamina / sustained-propagation need (endurance pathway; DEND is endurance-only) [min]
        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
    dend_fast_trace += bAP_Ca(bAP_local) + spine_spillover();  dend_budget -= branch_Ca_cost   // @cut affords: branch propagation activity, recency [ms]
    branch_Vm = integrate(POST.Vm, spines);  dend_budget -= integrate_cost   // EMIT integrated Vm → SOMA   // @cut affords: SPATIAL EXTENT — summed spine input over the branch (space made present at one site); the branch-grain read no spine has [ms, branch space]

// ===== RECOVERY (restore branch excitability; alter-ego of propagation) =====
DAY | NOT_bAP · recovered:                                 // Ca clearance
    dend_fast_trace *= decay(300ms)                        // FAST — branch Ca relaxes

// ===== PREPARATION (shape the next propagation AND the NIGHT) =====
DAY | NOT_bAP:
    // DEND is an ENDURANCE-ONLY relay: NO dopamine-gated strength tag. Its consolidation is load-driven
    // (endurance_need, deposited in ACTION on fuel-limited propagation) — not reward-validated potentiation.
    // (structural strengthening of a branch is emergent from its spines' tags, not an independent dend tag.)
    // for the next: attention lowers commit threshold; local translation; ship to spines; refill
    commit_threshold *= 1/(1 + ACh·ACh_gain)
    if dend_budget > translate_cost and dend_endurance_need > endur_thr: dend_budget -= translate_cost
    dend_ship_post = ship(dend_budget, post_demand, post_ship_frac, ship_cost)   // EMIT down to spines
    dend_budget += refill(dend from astro_lactate[branch] + transit(soma_ship_dend, τ_transport_dend))
    dend_endurance_need *= decay(min)                                       // MEDIUM (the only pathway)

// ── NIGHT: SAME three categories, subject = the pattern. DEND is an intermediate RELAY: its
//    PREPARATION replay relays replay_AP onward to spines IF primed (carrying SOMA→DEND→POST).
//    ENDURANCE-ONLY: night ACTION builds CAPACITY (from endurance_need) ⇄ releases where participation
//    is low — no dopamine strength tag. Rhythm: (ACTION ⇄ RECOVERY) × many, then PREPARATION.

// ===== ACTION (build CAPACITY ⇄ release; participation gates direction; endurance funds build) =====
NIGHT | build or release:
    if dend_endurance_need > endur_thr and dend_participation ≥ MEDIUM:      // BUILD capacity (load-driven, no dopamine)
        Δ' = min(cap_batch, dend_material·f_cap, dend_energy·f_cap)
        dend_budget_ceiling += Δ';  dend_material -= Δ';  dend_energy -= Δ'·biogenesis_cost
        dend_endurance_need -= Δ'
    else if dend_participation == LOW:                       // RELEASE: shed, free material
        shed = release_rate × max(dend_structure - homeostatic_floor, 0)
        dend_structure -= shed;  dend_freed_material += shed·recycle
        dend_budget_ceiling -= capacity_decay_rate·Δt_cycle
    // else: HOLD

// ===== RECOVERY (acquire/free material in CONTENTION; ship down to feed spine links) =====
NIGHT | import + free:
    dend_material += transit(soma_material_to_dend, τ_transport_dend)
    dend_energy   += transit(soma_energy_to_dend,   τ_transport_dend)
    dend_material += dend_freed_material;  dend_freed_material = 0     // reclaim what release freed
    if renorm_signal arrived:
        freed = dend_structure × (1 - renorm_signal);  dend_structure *= renorm_signal
        emit(freed → recycled material pool)
    dend_material += dend_ceiling_shrinkage·recycle        // energy NOT recovered
    dend_structure += min(dend_maint, maint_cost)          // hold up what is used
    post_material_ship += ship(dend_material, post_demand, f_spine, ship_cost)   // ship to feed spine links
    post_energy_ship   += ship(dend_energy,   post_demand, f_spine, ship_cost)

// ===== PREPARATION (REPLAY the propagation — SAME machinery as day ACTION; relays the pattern; multi-timescale) =====
NIGHT | replay + measure + prime:
    // FAST: relay the replay_AP onward to spines IF primed (probe)
    if arrived_replay_AP and dend_spont_thr < recruit_thr:
        bAP_local = propagate(replay_AP, dend_structure.bAP_fidelity, geometry)   // SAME propagate machinery
        emit(bAP_local → POST)                            // carries the pattern to the spines
        dend_fast_trace += bAP_Ca(bAP_local)
        if dend_budget < prop_cost and dend_fast_trace > traj_thr:   // SAME capacity check → endurance
            dend_endurance_need += dend_fast_trace         // SAME trace, fed by replay
    dend_participation = level(dend_fast_trace)            // read replayed response as participation
    // MEDIUM: a relay stays recruitable at baseline (no tag to prime from — it carries whatever reaches it)
    dend_spont_thr = spont_thr_base
    // SLOW: settle
    dend_fast_trace *= decay(300ms);  dend_endurance_need *= decay(slow)
    emit(dend_fatigue, dend_demand → upward)
```

---

## 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.

**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.

// THE THREE CATEGORIES (SOMA is an INITIATOR — it fires from its OWN integration crossing its OWN
//   threshold, so nothing external licenses its ACTION. It runs CONTINUOUS and the ACTION⇄RECOVERY
//   alternation is decided INTERNALLY by its own condition. It EMITS AP and REFRACTORY as signals of
//   these internal phases — it cannot be contextualized by them, since it is their source. Only its
//   PREPARATION is externally contextualized, by the NEURON's NOT_SPIKE_TRAIN. See logic_principles §1.):
//   ACTION      (CONTINUOUS; internal guard: branch_Vm > threshold and can_fire) fire — the defining
//               deed. Self-triggered. Emits AP.
//   RECOVERY    (CONTINUOUS; internal: not firing) restore the ability to fire again: refractory
//               de-inactivation + mito replenish — the alter-ego of the spike. Emits REFRACTORY.
//   PREPARATION (NOT_SPIKE_TRAIN, from the NEURON) shape the next spike: alignment, adaptation,
//               tag-climb (for NIGHT), ship, decay.
//   Pattern: (ACTION ⇄ RECOVERY) × many spikes, then PREPARATION.
//   ONE spike's fast trace feeds TWO preparation destinations: nuclear-Ca → tag (for NIGHT),
//   inactivation/adaptation/alignment → next-spike timing (this scope).

// ===== ACTION (CONTINUOUS — self-triggered by internal threshold-crossing; emits AP) =====
DAY | CONTINUOUS · action:                                 // integrate + fire (the defining deed)
    threshold = soma_structure.baseline_threshold × (1 + soma_adaptation) × neuromod(NE, ACh)
    can_fire  = soma_Na_inactivation < inactivation
    if branch_Vm > threshold and can_fire:                 // INTERNAL guard licenses the action (no external context)
        if soma_budget < ap_cost:                          // FUEL shortfall → endurance (a PREPARATION deposit)
            if soma_fast_trace > traj_thr and soma_fast_trace_rising:
                soma_endurance_need += soma_fast_trace
            exit
        fired = True;  soma_budget -= ap_cost              // EMIT fired → AXON, DEND   // @cut affords: THE DISCRETE FIRE EVENT — continuous branch integration read out as one all-or-nothing spike [ms]; over a train, the neuron's own FIRING FREQUENCY [sec]
        // deposit the THREE traces from one AP (all PREPARATION content, deposited in the action):
        soma_Na_inactivation += ap_amp                     // → refractory (recovery will undo this)
        soma_adaptation      += ap_contrib                 // → threshold rise (next-spike timing)
        soma_fast_trace      += nuclear_Ca();  soma_budget -= nuclear_cost   // → tag (for NIGHT)   // @cut affords: cell-wide activity accumulation (nuclear integral → consolidation) [min→hr]
        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       // @cut affords: cell-wide structural-consolidation need (precision pathway; dopamine-gated) [hr→night]
        soma_budget -= creb_cost
        soma_emitted_activity += 1;  soma_emitted_structure = soma_structure   // NEURON sums these

// ===== RECOVERY (CONTINUOUS — self-entered when not firing; emits REFRACTORY) =====
DAY | CONTINUOUS · recovery:                               // de-inactivate + replenish (soma's own refractory dynamics)
    soma_budget += fill(soma_budget, soma_budget_ceiling, mito_output, 0, soma_budget)   // mito replenish
    recovery = base_recovery × (1 + soma_refractory_alignment)
    soma_Na_inactivation *= decay(τ_Na / recovery)         // refractory recovery (sped by alignment)
    soma_fast_trace *= decay(τ_nuclear)                    // FAST — nuclear-Ca relaxes

// ===== PREPARATION (shape the next spike AND the NIGHT; ⊂ NOT_AP, sustained quiet) =====
DAY | NOT_SPIKE_TRAIN:
    branch_Vm = integrate(DEND.branch_Vm, branches)        // RECEIVE latest branch input   // @cut affords: SPATIAL CONVERGENCE — all branches summed at the whole-cell grain (the neuron's total input, one level above the branch) [ms, cell space]
    // for next-spike timing: refractory alignment (suprathreshold input during refractory)
    if branch_Vm > threshold and soma_Na_inactivation > inactivation:
        soma_refractory_alignment += (branch_Vm - threshold) × soma_Na_inactivation
    // for downstream: ship budget to dendrites + axon (demand-weighted)
    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)
    // settle medium/slow stocks
    soma_refractory_alignment *= decay(τ_align);  soma_adaptation *= decay(τ_adapt)
    soma_possible_tag *= decay(s);  soma_endurance_need *= decay(min)
    soma_tag *= decay(hr);  dopamine *= decay(ms)

// ── NIGHT: SAME three categories, consolidation timescale, subject = the pattern. SOMA is a ROOT
//    (produces material each cycle) AND the IGNITION POINT: its PREPARATION replay-fire propagates a
//    replay_AP down axon + dendrites. Rhythm: (ACTION ⇄ RECOVERY) × many, then PREPARATION. Build⇄release
//    contend WITHIN (participation arbitrates); material contends BETWEEN components (recovery).

// ===== ACTION (build ⇄ release; PARTICIPATION arbitrates; tag + material fund build, persist) =====
NIGHT | NON_REM_1:
    // participation (traced in REM) is the signal: components that took part in circuits, and have
    // material, are strengthened; those that did not participate drift down. No separate need-trace.
    if soma_participation ≥ MEDIUM and soma_tag > tag_expiry:              // BUILD (slice) — participated + tagged
        Δ = min(slot_batch, soma_material, soma_energy·f_cap, soma_tag) × soma_participation
        soma_structure += Δ;  soma_material -= Δ;  soma_energy -= Δ·assembly_cost
        soma_tag -= Δ                                       // SLICE — tag persists across cycles (day-fuel depletes)
        if soma_endurance_need > endur_thr:
            Δ' = min(cap_batch, soma_material·f_cap, soma_energy·f_cap)
            soma_budget_ceiling += Δ';  soma_material -= Δ';  soma_energy -= Δ'·biogenesis_cost
            soma_endurance_need -= Δ'
    else if soma_participation == LOW:                       // RELEASE: did not take part → shed, free material
        shed = release_rate × max(soma_structure - homeostatic_floor, 0)
        soma_structure -= shed;  soma_freed_material += shed·recycle
        soma_budget_ceiling -= capacity_decay_rate·Δt_cycle
    // else: HOLD
    soma_participation *= decay(cycle)                      // participation relaxes; re-earned each REM

// ===== RECOVERY (ROOT production + acquire/free material in CONTENTION; ALLOCATE energy for REM) =====
NIGHT | NON_REM_2:                                          // (SOMA also ROOT-produces here)
    soma_material += CREB_synth(soma_tag)·Δt_cycle         // ROOT: produce material — recoverable
    soma_energy   += mito_synth()·Δt_cycle                 // ROOT: produce energy — NOT recoverable
    night_energy_spent += mito_synth()·Δt_cycle
    // ALLOCATE the REM energy store: all get a base, tagged components get MORE (more chance to participate)
    soma_energy += energy_base + energy_tag_gain × soma_tag   // past participation (tag) → more energy for REM
    soma_material += soma_freed_material;  soma_freed_material = 0     // reclaim what release freed
    soma_material_to_dend += ship(soma_material, dend_demand, f_dend, ship_cost)   // ship to feed pattern links
    soma_material_to_axon += ship(soma_material, axon_demand, f_axon, ship_cost)
    soma_energy_to_dend   += ship(soma_energy,   dend_demand, f_dend, ship_cost)
    soma_energy_to_axon   += ship(soma_energy,   axon_demand, f_axon, ship_cost)
    soma_material += soma_ceiling_shrinkage·recycle
    soma_structure += min(soma_maint, maint_cost)          // hold up what is used

// ===== PREPARATION (REPLAY the fire — SAME machinery as day ACTION; ignites the pattern; multi-timescale) =====
NIGHT | REM:                                               // (SOMA replay-fires: participates in circuits)
    // REM is PARTICIPATION under a limited ENERGY store (replenished tag-weighted in NON_REM_2 RECOVERY).
    // Participating (igniting in a circuit) SPENDS that store; when it runs low the soma can no longer
    // sustain participation and GIVES WAY, letting other circuits (other somas with energy) recruit.
    spont = intrinsic_fluctuation()
    driven = branch_Vm                                     // convergent replay input = a circuit ARRIVING at me
    if (spont > soma_spont_thr or driven > soma_spont_thr) and soma_energy > participate_cost:  // can I take part?
        replay_AP = TRUE
        soma_energy -= participate_cost                    // PARTICIPATION SPENDS THE STORE (the scarce resource)
        soma_fast_trace += nuclear_Ca()·δ(replay)          // SAME trace deposit as DAY ACTION
        soma_participation += soma_fast_trace·Δt           // TRACE participation (accumulates across the night)
        if soma_budget < ap_cost:                          // SAME capacity check → endurance evidence
            if soma_fast_trace > traj_thr: soma_endurance_need += soma_fast_trace
        else:
            soma_budget -= ap_cost
            emit(replay_AP → AXON, DEND)                   // propagate: AXON/DEND relay onward IF primed
        emit(emitted_replay_fired → NEURON)                // → circuit_recruitment (a circuit is recruiting now)
    // else: no energy (or not driven) → give way this pass; another circuit's somas recruit instead
    // pattern carries link by link, primed→primed (mechanical coherence):
    //   SOMA →[replay_AP]→ AXON →→ PRE →[glutamate]→ POST →→ DEND →→ SOMA ; one un-primed link breaks it
    emit(emitted_participation = soma_participation → NEURON)   // → recruitment falls as stores deplete
    emit(emitted_tag_remaining = soma_tag → NEURON)            // → summed_tag_remaining (wake signal)
    // MEDIUM: prime firing excitability from the standing tag
    soma_spont_thr = spont_thr_base − thr_gain × soma_tag
    // SLOW: settle
    soma_fast_trace *= decay(τ_nuclear);  soma_tag *= decay(hr);  soma_endurance_need *= decay(slow)
```

---

## 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.

**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.

// THE THREE CATEGORIES (same at DAY and NIGHT; here DAY, subject = soma's spike):
//   ACTION      propagate the delivered spike to boutons (context AP)
//   RECOVERY    restore axon excitability: ionic re-equilibration (fast alter-ego of propagation)
//   PREPARATION shape the next: tag climb (NIGHT), ship to boutons, refill, settle
//   fail(fast_trace) is load-driven axonal STD (a consequence); FUEL shortfall is endurance.

// ===== ACTION =====
DAY | AP:                                                  // propagate the spike (the defining deed)
    reliability = axon_structure.propagation × (1 - fail(axon_fast_trace))   // fail() = STD, not endurance
    if axon_budget < prop_cost:
        reliability *= budget_factor
        if axon_fast_trace > traj_thr:                     // FUEL-limited → endurance (a PREPARATION deposit)
            axon_endurance_need += axon_fast_trace
    delivered = fired × reliability;  axon_budget -= prop_cost × delivered    // EMIT delivered → boutons
    axon_fast_trace += delivered                           // deposit fast trace   // @cut affords: propagation reliability / conduction fidelity over distance [ms]. (AXON is a near-pure relay: it integrates almost nothing, so it affords very few reads — the sparseness is the point.)

// ===== RECOVERY (restore axon excitability; alter-ego of propagation) =====
DAY | NOT_AP · recovered:                                  // ionic re-equilibration
    axon_fast_trace *= decay(s)                            // FAST — shaft relaxes

// ===== PREPARATION (shape the next propagation AND the NIGHT) =====
DAY | NOT_AP:
    // AXON is an ENDURANCE-ONLY relay: NO dopamine-gated strength tag. Structural change (myelination,
    // propagation reliability) is LOAD-driven — built from endurance_need where it repeatedly propagated
    // hard — not reward-validated. An axon needs no signal that a memory was rewarding to know it ran hard.
    // for the next: ship to boutons, refill toward next demand
    axon_ship_pre = ship(axon_budget, pre_demand, pre_ship_frac, ship_cost)
    axon_budget += refill(axon from soma_ship_axon + astro_lactate[shaft])
    axon_endurance_need *= decay(min)                                       // MEDIUM (the only pathway)

// ── NIGHT: SAME three categories, subject = the pattern. AXON is an intermediate RELAY: its
//    PREPARATION replay relays replay_AP onward to boutons IF primed (carrying SOMA→AXON→PRE).
//    ENDURANCE-ONLY: night ACTION builds CAPACITY (from endurance_need) ⇄ releases where participation
//    is low — no dopamine strength tag. Rhythm: (ACTION ⇄ RECOVERY) × many, then PREPARATION.

// ===== ACTION (build CAPACITY ⇄ release; participation gates direction; endurance funds build) =====
NIGHT | build or release:
    if axon_endurance_need > endur_thr and axon_participation ≥ MEDIUM:      // BUILD capacity (load-driven, no dopamine)
        Δ' = min(cap_batch, axon_material·f_cap, axon_energy·f_cap)
        axon_budget_ceiling += Δ';  axon_material -= Δ';  axon_energy -= Δ'·biogenesis_cost
        axon_endurance_need -= Δ'
    else if axon_participation == LOW:                       // RELEASE: shed, free material
        shed = release_rate × max(axon_structure - homeostatic_floor, 0)
        axon_structure -= shed;  axon_freed_material += shed·recycle
        axon_budget_ceiling -= capacity_decay_rate·Δt_cycle
    // else: HOLD

// ===== RECOVERY (acquire/free material in CONTENTION; ship down to feed bouton links) =====
NIGHT | import + free:
    axon_material += transit(soma_material_to_axon, τ_transport_dend)
    axon_energy   += transit(soma_energy_to_axon,   τ_transport_dend)
    axon_material += axon_freed_material;  axon_freed_material = 0     // reclaim what release freed
    if renorm_signal arrived:
        freed = axon_structure × (1 - renorm_signal);  axon_structure *= renorm_signal
        emit(freed → recycled material pool)
    axon_material += axon_ceiling_shrinkage·recycle        // energy NOT recovered
    axon_structure += min(axon_maint, maint_cost)          // hold up what is used
    pre_material_ship += ship(axon_material, pre_demand, f_bouton, ship_cost)   // ship to feed bouton links
    pre_energy_ship   += ship(axon_energy,   pre_demand, f_bouton, ship_cost)

// ===== PREPARATION (REPLAY the propagation — SAME machinery as day ACTION; relays the pattern; multi-timescale) =====
NIGHT | replay + measure + prime:
    // FAST: relay the replay_AP onward to boutons IF primed (probe)
    if arrived_replay_AP and axon_spont_thr < recruit_thr:
        reliability = axon_structure.propagation × (1 - fail(axon_fast_trace))   // SAME reliability machinery
        delivered = reliability × axon_structure.propagation
        emit(replay_AP → PRE)                             // carries the pattern to the boutons
        axon_fast_trace += delivered
        if axon_budget < prop_cost and axon_fast_trace > traj_thr:   // SAME capacity check → endurance
            axon_endurance_need += axon_fast_trace         // SAME trace, fed by replay
    axon_participation = level(axon_fast_trace)           // read replayed response as participation
    // MEDIUM: a relay stays recruitable at baseline (no tag to prime from — it carries whatever reaches it)
    axon_spont_thr = spont_thr_base
    // SLOW: settle
    axon_fast_trace *= decay(s);  axon_endurance_need *= decay(slow)
    emit(axon_fatigue, axon_demand → upward)
```

---

## ASTROSYNAPSE

> The astrosynapse is the perisynaptic astrocytic process — the LOCAL component at one synapse,
> the astroglial peer of pre/post and a constituent of the ASTROCYTE actor (which integrates
> across all of them, just as the NEURON integrates over the soma). The astrosynapse behaves
> locally here; the astrocyte integrates and broadcasts (see CELL ACTORS).

The astrosynapse is the synapse's **modulator** — the third party that tunes all three dimensions
of transmission without performing the deed itself. It clears glutamate (setting how long
transmitter dwells → **timing**), releases D-serine that dials the *gain* of the postsynaptic
response to a given release (**intensity**, via POST's sensitivity — not a coincidence gate but a
volume knob on POST), and its perisynaptic coverage sets spillover and isolation (**space**). Its
one error signal is **spillover**: when PRE outpowers the current coverage, glutamate escapes — the
direct physical sign that this astrosynapse is too small for its presynapse. Spillover coincident
with a real postsynaptic response (read from the eavesdropped retrograde NO) is what it tags; its
absence means the coverage can shrink. It reads the cleft it sits in: glutamate from PRE (spillover),
the retrograde eCB/NO from POST (postsynaptic pressure and success), and — from above — the
ASTROCYTE's territory-wide Ca²⁺ spike, which arrives at ALL the astrocyte's astrosynapses at once
when enough of them were co-active (a territory-scale coincidence broadcast, the astrocytic analog
of the soma's AP).

**DAY · ACTION — clear + prime.** The defining local deed: take up glutamate (EAAT clearance) and
release D-serine to set POST's gain, biased by the astrocyte's slow priming field and pulsed up by
an arriving territory Ca²⁺ spike. Spillover deposits its Ca²⁺ fast trace.
**DAY · RECOVERY — restock clearance + D-serine capacity**, so it can service the next release (its
recovery speed *is* the synapse's timing resolution).
**DAY · PREPARATION — stock the volume/gain evidence.** Accumulate the tag: how often spillover
occurred coincident with a real postsynaptic response — "this synapse repeatedly outgrew its
coverage on genuine co-activation." Read the descended spike/prime that will bias the next action.

**NIGHT — build ⇄ release coverage.** Build perisynaptic coverage / clearance capacity / tonic
D-serine where the tag stands (repeated spillover → enlarge to clear faster, sharpen timing, contain
spillover — the build cancels the very spillover that signalled it) ⇄ release coverage where no
spillover occurred (over-provisioned → shrink, free material). Astrosynapses compete for the
astrocyte's produced material and energy.

```
// PARAMETERS  K_Dserine · Ds_max · Ds_frac · Ds_cost · EAAT_cost · spillover · overload · spike_gain
// INTERFACE
//   EMIT      astro_Dserine[i] → POST (GAIN primer, not a gate) ; astro_localCa[i] → ASTROCYTE (integrated up)
//             astro_fatigue, astro_demand → upward
//   RECEIVE   (signals) glutamate ← PRE (spillover) ; retro_NO, retro_eCB ← POST (eavesdropped) ;
//             astro_prime[i] ← ASTROCYTE (slow gain field) ; astro_Ca_spike ← ASTROCYTE (territory broadcast)
//   READ      glutamate ; retro_NO ; retro_eCB ; astro_prime[i] ; astro_Ca_spike
//   OWN       astro_structure{coverage, EAAT, Dserine_tonic, ECM} ; astro_budget_ceiling ; astro_fast_trace
//   SUPPLY    astro_material, astro_energy ← ASTROCYTE (root) ; lactate distributed by ASTROCYTE
//   NOTE      D-serine is POST's GAIN, dialed by this astrosynapse × the astrocyte's prime/spike.
//             Error signal = SPILLOVER (PRE outpowering coverage), tagged when coincident with retro_NO.
//   EMERGENCY emits shockwave_lockdown on overload
//
// CONTINUOUS (no spike of its own): each step runs ACTION ⇄ RECOVERY, then PREPARATION, in graded flow.

// ===== ACTION (clear glutamate + release D-serine = POST's gain; the defining local deed) =====
DAY | CONTINUOUS · action | per astrosynapse i:
    glutamate[i] -= astro_structure[i].EAAT × glutamate[i]·Δt;  astro_budget[i] -= clearance·EAAT_cost  // clear (timing)   // @cut affords: TIMING — dwell time / temporal window (how long transmitter persists; clearance sets it) [ms, cleft space]
    gain = astro_structure[i].Dserine_tonic × astro_prime[i] × (1 + spike_gain × astro_Ca_spike)        // prime POST gain
    astro_Dserine[i] += gain·Δt                                                                          // → POST (intensity)
    if glutamate[i] > spillover:                            // SPILLOVER = PRE outpowered coverage (error signal)
        astro_fast_trace[i] += mGluR_Ca()                  // deposit Ca fast trace (this action's residue)   // @cut affords: SPATIAL containment — spillover extent (coverage adequacy: contained vs shared) [ms, cleft space]
        want = sat(astro_fast_trace[i], K_Dserine) × Ds_max
        got  = min(want, astro_budget[i] × Ds_frac)
        astro_Dserine[i] += got;  astro_budget[i] -= got·Ds_cost         // phasic D-serine (extra gain on spillover)
        astro_localCa[i] = astro_fast_trace[i]                            // EMIT own Ca upward → ASTROCYTE integrates   // @cut affords: this synapse's contribution to TERRITORY-scale coincidence (read one level up at the astrocyte spike) [ms→sec, territory space]
        if got < want and astro_budget[i] low and astro_fast_trace[i] > traj_thr:
            astro_endurance_need[i] += (want - got)         // FUEL-limited synthesis → endurance
    if astro_fast_trace[i] > overload: emit(shockwave_lockdown)          // EMERGENCY

// ===== RECOVERY (restore clearance + D-serine capacity; alter-ego — its speed IS the synapse's timing) =====
DAY | CONTINUOUS · recovery | per astrosynapse i:
    astro_budget[i] += refill(astro[i] from lactate ← ASTROCYTE)         // restock (contested territory supply)
    astro_fast_trace[i] *= decay(s)                                       // Ca relaxes — ready to detect next spillover

// ===== PREPARATION (stock the volume-need tag; read descended spike/prime; faces the NIGHT) =====
DAY | CONTINUOUS · preparation | per astrosynapse i:
    // ENDURANCE-TYPE tag (NO dopamine): the volume-need is homeostatic, like fuel-shortfall endurance.
    // It accumulates directly from spillover COINCIDENT with a real postsynaptic response (eavesdropped
    // NO) — "I repeatedly outgrew my coverage on genuine co-activation" — not from reward validation.
    // (dopamine reaches glia only as slow tone, folded into the astrocyte's prime — not a per-event gate.)
    if astro_fast_trace[i] > elig and retro_NO > NO_thr:
        astro_coverage_need[i] += astro_fast_trace[i] × (1 + retro_NO)·Δt        // the volume tag, self-gated
    astro_coverage_need[i] *= decay(hr)                                          // SLOW (persists across cycles)
    astro_endurance_need[i] *= decay(min)                                        // MEDIUM (synthesis capacity)

// ── NIGHT: SAME three categories, subject = the pattern. Astrosynapses compete for the ASTROCYTE's
//    produced material/energy (the astrocyte is their root). ENDURANCE-TYPE: coverage build is driven by
//    coverage_need (homeostatic spillover signal), NOT a dopamine strength tag. Build ⇄ release COVERAGE,
//    participation from the Ca response to re-evoked spillover. (ACTION ⇄ RECOVERY) × many, then PREPARATION.

// ===== ACTION (build ⇄ release COVERAGE; participation gates direction; coverage_need funds build) =====
NIGHT | build or release | per astrosynapse i:
    if astro_coverage_need[i] > tag_expiry and astro_participation[i] ≥ MEDIUM:      // BUILD coverage (slice)
        Δ = min(slot_batch, astro_material[i], astro_energy[i]·f_cap, astro_coverage_need[i]) × astro_participation[i]
        astro_structure[i] += Δ                            // enlarge coverage → faster clearance, less spillover
        astro_material[i] -= Δ;  astro_energy[i] -= Δ·assembly_cost;  astro_coverage_need[i] -= Δ
        if astro_endurance_need[i] > endur_thr:
            Δ' = min(cap_batch, astro_material[i]·f_cap, astro_energy[i]·f_cap)
            astro_budget_ceiling[i] += Δ';  astro_material[i] -= Δ'
            astro_energy[i] -= Δ'·biogenesis_cost;  astro_endurance_need[i] -= Δ'
    else if astro_participation[i] == LOW:                  // RELEASE coverage: shed, free material
        shed = release_rate × max(astro_structure[i] - homeostatic_floor, 0)
        astro_structure[i] -= shed;  astro_freed_material[i] += shed·recycle
        astro_budget_ceiling[i] -= capacity_decay_rate·Δt_cycle
    // else: HOLD

// ===== RECOVERY (acquire material/energy from the ASTROCYTE in CONTENTION with sibling astrosynapses) =====
NIGHT | import + free | per astrosynapse i:
    astro_material[i] += astro_alloc[i]·astro_central_material   // receive this cycle's share (contested)
    astro_energy[i]   += astro_alloc[i]·astro_central_energy
    astro_material[i] += astro_freed_material[i];  astro_freed_material[i] = 0   // reclaim what release freed
    astro_structure[i] += min(astro_maint[i], maint_cost)       // hold up what is used

// ===== PREPARATION (REPLAY: respond to re-evoked spillover — SAME mGluR machinery — measure participation) =====
NIGHT | replay + measure | per astrosynapse i:
    if arrived_glutamate_replay[i]:                        // re-evoked spillover arrives (probe)
        astro_fast_trace[i] += mGluR_Ca()                  // SAME mGluR machinery as DAY ACTION
    astro_participation[i] = level(astro_fast_trace[i])    // read replayed response as participation
    astro_fast_trace[i] *= decay(s);  astro_coverage_need[i] *= decay(hr);  astro_endurance_need[i] *= decay(slow)
    emit(astro_fatigue, astro_demand → upward)
```

---

## 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-BLOCK UNIFORMITY (three categories). PRE, SOMA, POST, DEND, AXON now run both DAY and NIGHT
> chunked as (ACTION ⇄ RECOVERY) × many, then PREPARATION, under explicit `// ===== =====` separators:
> (a) NIGHT-RECOVERY imports/produces supply, primes its OWN threshold from its OWN standing tag,
> applies the descended constraint to itself, recycles, and — for intermediate nodes AXON/DEND —
> ships downstream so the pattern's links are fed; (b) NIGHT-PREPARATION REPLAYS the day action —
> re-runs the SAME release/fire/respond/propagate machinery (same capacity/vesicle checks, same
> endurance deposit into the SAME trace), read as participation (level: high/medium/low), NO dopamine;
> AXON/DEND/SOMA also propagate the replay_AP onward IF primed (carrying SOMA→AXON→PRE and
> SOMA→DEND→POST); (c) NIGHT-ACTION lowers structure homeostatically, then rebuilds where the tag
> still stands AND participation ≥ medium, consuming the tag. Roots (SOMA material) additionally
> PRODUCE each cycle. The replay pattern propagates entirely through the DAY PATHWAYS, self-igniting,
> carrying only where every link is primed.
> ASTROSYNAPSE is now converted too (all six local components uniform): its ACTION is clear+prime
>  (D-serine = POST gain), RECOVERY restocks clearance/D-serine, PREPARATION stocks the volume tag;
>  NIGHT builds⇄releases COVERAGE. The ASTROCYTE adds a third role — a regenerative Ca spike that
>  integrates astrosynaptic Ca and broadcasts territory-coincidence to all astrosynapses at once.

---
---
# CELL ACTORS — NEURON and ASTROCYTE
Two structurally identical peers. Each integrates its constituents' EMITTED activity by its DAY
(never reading their interiors), detects when its aggregate has gone quiet, and BROADCASTS the
restructuring window + renormalization/reallocation by its NIGHT. Each component then restructures
ITSELF in response. The cell actor's own DAY/NIGHT follows the same transition rule, on its own
aggregate activity.

## NEURON

The neuron is the whole-cell actor over soma, pre, post, dend, axon. It cannot fire or release —
it integrates what its components emit and grants them the restructuring window none of them can
grant itself. The soma is one of its constituents, a peer of the bouton; the neuron is not the soma.

```
// PARAMETERS  neuron_weight_ceiling · downscale_factor
// INTERFACE
//   EMIT      rest_permission, renorm_signal, occupancy_downscale → own components (broadcast)
//             neuron_fatigue → HYPOTHALAMUS
//             circuit_recruitment, unspent_participation, summed_tag_remaining → BRAINSTEM / HYPOTHALAMUS
//   RECEIVE   (signals) component activity emissions (summed) ; scope_context ← HYPOTHALAMUS
//             sub_phase ← BRAINSTEM ; replay_reweight ← assembly/network (external)
//   OWN       neuron_activity · neuron_total_weight  (aggregates aggregated from emissions)
//   NOTE      never reads a component interior; sums emitted activity, broadcasts signals only.
//             It is the neuron (above the soma) that judges recruitment: the soma emits whether it
//             was driven-and-fired vs near-missed; the neuron sums these into the circuit signal.

DAY | active:                                              // (within broadcast DAY context → integrate only)
    // TRACE     integrate the cell's emitted activity + committed weight (aggregators)
    neuron_activity     += Σ component emitted_activity·Δt
    neuron_total_weight  = Σ component emitted_structure        // from emissions, not interiors
    // EMIT      fatigue upward (metabolic debt of the whole cell)
    neuron_fatigue = f(neuron_activity, unspent demand)
    // (no restructuring permission while the cell is active — components are busy)

NIGHT | cycle:                                             // (within broadcast NIGHT context + sub_phase)
    // the neuron acts ONLY by signalling; components prime/measure/rebuild themselves. Each
    // component's cycle is RECOVERY→PREPARATION→ACTION; the neuron just supplies the constraint.
    occupancy_downscale = downscale_factor                     // → components reset own occupancy (in RECOVERY)
    if neuron_total_weight > neuron_weight_ceiling:
        renorm_signal = neuron_weight_ceiling / neuron_total_weight   // → components scale own structure
    rest_permission = TRUE                                      // → components may restructure this cycle
    // REPORT to the BRAINSTEM (sub-phase switch) and HYPOTHALAMUS (wake) — sums of emitted signals only:
    circuit_recruitment    = Σ soma emitted_replay_fired      // strength of REM recruitment (falls as energy depletes)
    unspent_participation   = Σ soma emitted_participation     // participation not yet acted on by NON_REM_1
    summed_tag_remaining    = Σ component emitted_tag_remaining // day-tags still unspent (wake signal)

CODA | on waking (scope_context → DAY):
    neuron_activity = 0;  neuron_total_weight = recomputed from surviving emissions
```

## ASTROCYTE

The astrocyte is the territory actor over its astrosynapses — the parallel of the neuron, with
three roles. First, it is the ROOT of synaptic energy and ECM material, and therefore the system's
METABOLIC SENSOR: it accrues territory energy debt and reports it upward as the fatigue that drives
the hypothalamus's DAY/NIGHT switch, and its discharge of that debt during night permits waking.
Second, it has its own ACTION — a regenerative Ca²⁺ SPIKE: it integrates the local Ca²⁺ emitted by
its astrosynapses, and when the sum crosses threshold it fires a Ca²⁺ wave that reaches ALL its
astrosynapses at once. This is the astrocytic analog of the soma's action potential — an
integrate-and-fire event that detects and broadcasts a TERRITORY-SCALE COINCIDENCE (many synapses
co-active), transiently boosting D-serine gain across the whole territory and marking every
participating astrosynapse. Third, by DAY it PRIMES its territory: reading its own slow calcium
wave (alpha-band), it sets a localized, slow, neuromodulator-like gain field on D-serine —
dialing postsynaptic response strength across a field of synapses.

```
// PARAMETERS  (territory reallocation) · alpha_gain · Ca_spike_thr · lactate_cost
// INTERFACE
//   EMIT      astro_prime[·] (DAY gain field) ; astro_Ca_spike (territory broadcast) ; astro_lactate[·] ;
//             astro_alloc[·] + rest_permission (NIGHT) → astrosynapses ; astro_fatigue → HYPOTHALAMUS
//   RECEIVE   (signals) astro_localCa[·] (integrated up from astrosynapses) ; scope_context ; replay_reweight ; glucose
//   OWN       astro_integrated_Ca ; astro_slow_Ca (alpha wave) ; astro_central_{energy,material}
//   NOTE      THREE roles: ROOT (energy+material) · integrate-and-FIRE (Ca spike = territory coincidence) ·
//             PRIME (alpha gain field). Metabolic sensor: reports fatigue that drives the day/night switch.

DAY | active:
    // integrate the local Ca emitted by astrosynapses (aggregator) + own slow alpha wave
    astro_integrated_Ca += Σ astro_localCa[i]·Δt
    astro_slow_Ca = integrate_slow(territory activity)        // alpha-band astrocytic calcium
    // ACTION: regenerative Ca SPIKE when integrated Ca crosses threshold → broadcast to ALL astrosynapses
    if astro_integrated_Ca > Ca_spike_thr:
        astro_Ca_spike = 1;  astro_integrated_Ca = 0          // fire + reset (territory-coincidence event)
        // → every astrosynapse reads astro_Ca_spike this step (boosts its D-serine gain; marks its tag)
    else:
        astro_Ca_spike = 0
    // PRIME: alpha-driven localized gain field on D-serine (dials POST response strength territory-wide)
    for each astrosynapse i: astro_prime[i] = 1 + alpha_gain × astro_slow_Ca
    // SUPPLY: distribute lactate across the territory by clearance demand (day metabolic support)
    factor = min(1, astro_central_energy / (Σ clearance_load·lactate_cost + ε))
    for each i: astro_lactate[i] = clearance_load[i] × factor;  astro_central_energy -= astro_lactate[i]·lactate_cost
    // EMIT      report metabolic debt upward — the fatigue that drives the DAY/NIGHT switch
    astro_fatigue = f(territory energy debt, unmet demand)

NIGHT | cycle:                                                // (within broadcast NIGHT context)
    // PRODUCTION (root): this cycle's energy + ECM batch, capped by glucose
    astro_central_energy   += overnight_glycolysis(glucose)·Δt_cycle     // NOT recoverable
    astro_central_material += astro_cellbody_synth()·Δt_cycle            // recoverable
    night_energy_spent     += overnight_glycolysis(glucose)·Δt_cycle
    // ADJUST    allocation weights across the territory (tag × replay) — astrosynapses APPLY these in their RECOVERY
    for each i: astro_alloc[i] = (astro_coverage_need[i] × replay_reweight[i]) / Σ(astro_coverage_need × replay_reweight)
    rest_permission[i] = TRUE                                  // → each astrosynapse builds/releases itself
    // RECOVER   reclaim material from decayed astrosynapse ceilings (returned to central pool)
    astro_central_material += astro_ceiling_shrinkage·recycle
    // discharge: producing + distributing energy repays territory debt → astro_fatigue falls → wake permitted
    astro_fatigue -= discharge × astro_central_energy·Δt_cycle

CODA | on waking:
    astro_integrated_Ca = 0
```

## HYPOTHALAMUS

The system actor. Unlike every other actor it has NO night: it runs CONTINUOUS, integrating the
FATIGUE⇄REST competition and BROADCASTING the DAY/NIGHT context that every other actor receives. It
is the clock that never sleeps — but not a wall-clock: the context it emits is the earned outcome of
the competition, not a schedule. Fatigue is reported chiefly by the ASTROCYTE (the metabolic sensor
that runs the energy economy); rest accrues while quiet. If the hypothalamus stopped, nothing would
integrate the competition and the scope could never switch. It owns only DAY/NIGHT; the within-night
sub-phases (NON_REM_1/NON_REM_2/REM) are owned by the BRAINSTEM.

The WAKE condition (NIGHT → DAY) has two signals, combined as tag-primary-with-a-fatigue-cap: the
night's job is consolidation, so the normal end is **tag exhaustion** — when the day's tags (summed,
reported up) are spent, there is nothing left to consolidate and the system wakes. But a distinct
**night_fatigue** — driven by REM, since replay is the expensive phase — is a hard cap that forces
waking early if replay burned too much, protecting against endless exploration. So: wake when tags
are exhausted, OR when night_fatigue crosses its cap, whichever comes first.

```
// PARAMETERS  fatigue_gain · rest_gain · hysteresis · tag_floor · night_fatigue_cap
// INTERFACE
//   EMIT      scope_context ∈ {DAY, NIGHT} → ALL actors (broadcast; the switch)
//   RECEIVE   (signals) fatigue from components + ASTROCYTE (metabolic debt) ; rest (restoration) ;
//             summed_tag_remaining ← NEURON/ASTROCYTE ; night_fatigue ← BRAINSTEM (REM-driven)
//   OWN       fatigue · rest · scope_context
//   NOTE      the switch is TOP-DOWN: components receive the context, they do not each decide it.
//             DAY→NIGHT on fatigue; NIGHT→DAY on tag-exhaustion OR night_fatigue cap.

CONTINUOUS:                                                // spans every other actor's day and night
    // integrate the two competing drives
    fatigue += fatigue_gain × (Σ component_fatigue + astro_fatigue)·Δt   // rises with activity (astrocyte-reported)
    fatigue -= discharge × consolidation_progress·Δt                     // night restructuring discharges debt
    rest    += rest_gain × quiet·Δt                                      // restoration accrues while quiet
    rest    -= rest_drain × activity·Δt
    // DAY → NIGHT when fatigue dominates (earned, hysteresis avoids chatter)
    if scope_context == DAY and fatigue > rest + hysteresis:  scope_context = NIGHT
    // NIGHT → DAY: tag-exhaustion (the work is done) OR night_fatigue cap (replay too costly)
    if scope_context == NIGHT and (summed_tag_remaining < tag_floor or night_fatigue > night_fatigue_cap):
        scope_context = DAY
    broadcast(scope_context)                              // every actor behaves/restructures within it
```

How it runs without a driver. There is no loop that orchestrates the actors. The hypothalamus
continuously integrates fatigue (astrocyte-reported metabolic debt) against rest and broadcasts the
DAY/NIGHT context; every component and cell actor receives it and behaves or restructures within it.
Night restructuring discharges debt (fatigue falls) while quiet accrues rest — so a rested system's
context flips back to DAY (waking) and an overloaded one wakes with tags unspent (they carry
forward). The astrocyte is the sensor that makes this loop turn: it accrues and reports the debt
that drives the switch, and its discharge during night is what permits waking.

---

## BRAINSTEM

The other system actor, and a minimal one: within the NIGHT that the hypothalamus declares, the
BRAINSTEM owns the sub-phase rhythm — it emits the context NON_REM_1 / NON_REM_2 / REM that the
night elements run in. But it decides nothing on its own: it reads two levels reported up by the
NEURON and ASTROCYTE and switches context accordingly. The night is a self-contained loop; the
brainstem only checks and switches.

The loop it closes. REM (PREPARATION) is participation under a limited energy store — but the
brainstem does not know which circuits (they are unexpressed objects). Each soma participates in a
circuit by igniting, which **spends its energy store** (replenished in NON_REM_2, tag-weighted: all
somas get a base, the day-tagged get more, so past participation buys present chance). As a circuit's
somas spend down their stores they can no longer sustain participation and **give way**, letting other
circuits — other somas with energy still to spend — recruit; so REM sweeps the repertoire, circuit by
circuit, as stores deplete. The brainstem reads only **circuit recruitment** (summed participation):
while it stays strong, stay in REM. When it falls across the board (stores spent, no circuit can
recruit), switch to NON_REM_1. NON_REM_1 (ACTION) **strengthens the participants** — the somas whose
participation trace is high, and which have material, build up; those that did not take part drift
down — while NON_REM_2 (RECOVERY) re-supplies energy and material, cycling many times (the competition
over who is potentiated and who is depotentiated takes many action⇄recovery rounds). When the
participation has been acted on and energy re-supplied, the brainstem switches back to REM, which
participates again on the newly strengthened structure. Around and around: REM selects by
participation, NON_REM consolidates the participants, each fueling the other.

REM is the expensive phase, and its cost is the night's clock. Replay burns energy —
**night_fatigue** accumulates during REM (only) — and because REM lengthens across the night (early,
on raw structure, circuits break fast and REM is short; late, on consolidated structure, circuits
sweep long and REM is long), night_fatigue accelerates toward the night's end. It is reported up to
the hypothalamus as the fatigue-cap that can force waking. Meanwhile building consumes the day's
tags, so as consolidation completes REM finds fewer near-misses and generates fewer needs; when the
tags are exhausted the loop quiesces and the hypothalamus wakes the system. Two fuels run down: tags
(informational — what to consolidate) and night energy (metabolic — how much replay costs), and the
night ends when either is spent.

```
// PARAMETERS  recruit_thr · settle_floor · rem_fatigue_gain
// INTERFACE
//   EMIT      sub_phase ∈ {NON_REM_1, NON_REM_2, REM} → night elements (broadcast, within NIGHT) ;
//             night_fatigue → HYPOTHALAMUS (REM-driven, the wake cap)
//   RECEIVE   (signals) circuit_recruitment ← NEURON/ASTROCYTE (summed REM participation, falls as
//             energy stores deplete) ; unspent_participation ← NEURON/ASTROCYTE (participation not yet
//             acted on by NON_REM_1) ; scope_context
//   OWN       sub_phase · night_fatigue
//   NOTE      pure context-switch: senses nothing itself; NEURON/ASTROCYTE do the sensing, the
//             brainstem reads two levels and flips. Owns the within-night rhythm; HYPOTHALAMUS owns
//             DAY/NIGHT and the wake.

DAY | active:                                             // minimal by day: accumulate, emit nothing
    night_fatigue = 0                                     // reset for the coming night

NIGHT | active:                                           // within the hypothalamus's NIGHT
    if sub_phase == REM:
        night_fatigue += rem_fatigue_gain·Δt              // REPLAY IS EXPENSIVE — the night's energy clock
        if circuit_recruitment < recruit_thr:             // energy stores depleted → no circuit recruits
            sub_phase = NON_REM_1                          // → strengthen the participants, re-supply energy
    else:                                                  // NON_REM_1 ⇄ NON_REM_2 run as the elements' ACTION⇄RECOVERY
        if unspent_participation < settle_floor:           // participation acted on, energy re-supplied
            sub_phase = REM                                // → participate again on the newly strengthened structure
    broadcast(sub_phase)                                  // night elements restructure/replay within it
```

Why the brainstem is separate from the hypothalamus. Two different clocks, two different sensings.
The hypothalamus integrates a *metabolic* competition (fatigue vs rest) to decide DAY vs NIGHT —
when to sleep. The brainstem reads *circuit recruitment* and *restructuring-need* to decide the
sub-phase — what phase of sleep. Loading both on one actor would conflate a metabolic decision with
a completion-sensing one. Separated, each is a clean context-switch on its own signal, and together
they compose: the night is a sequence of brainstem-driven REM⇄NON_REM cycles, running until the
hypothalamus judges (by tag-exhaustion or night_fatigue) that the night is over.

---

## One-view summary

```
THREE CATEGORIES · NINE ACTORS · ONE FATIGUE⇄REST SWITCH (+ BRAINSTEM sub-phase rhythm)
  Every component runs (ACTION ⇄ RECOVERY) × many, then PREPARATION — same shape at DAY and NIGHT.
  ACTION      the defining deed (day: release/fire/respond/propagate ; night: change structure)
  RECOVERY    the fast alter-ego — restore the ability to act (day: refill ; night: import + free material)
  PREPARATION shape what's next; faces this scope AND the other. "Evaluation" was preparation all along:
              depositing a trace is provisioning, not judging. Each category spans FAST·MEDIUM·SLOW.

ACTORS local: soma·pre·post·dend·axon·astrosynapse   cell: neuron·astrocyte   system: hypothalamus
       higher actors INTEGRATE constituents' emissions and BROADCAST — never reach in

DAY    (broadcast context: rest dominates) ring turned OUTWARD against the world — COLLABORATION
       each acts so the next can act (pre→post→dend→soma→axon→pre) ; currency: information (non-rival)
       fast_trace → (avg/seconds) occupancy → (avg/minutes + dopamine) TAG, passed to NIGHT
NIGHT  (broadcast context: fatigue dominates) ring turned INWARD against the economy — COMPETITION
       PREPARATION replays the day ACTION (same machinery, no dopamine) → measures PARTICIPATION
       ACTION = BUILD (participation high + tag stands; tag funds a slice, persists) ⇄ RELEASE
                (participation LOW; frees material; tag untouched) — build vs release compete WITHIN
       RECOVERY = contend WITH OTHER components for shared material/energy ; currency: material (rival)
       competition is ADJUDICATED BY COLLABORATION: you build in proportion to replay participation
       two forgettings: structural pruning (low participation) ; intention decay (tag decays unspent)
SWITCH DAY/NIGHT is a TOP-DOWN context. HYPOTHALAMUS integrates FATIGUE (astrocyte-reported metabolic
       debt) ⇄ REST (restoration) and BROADCASTS the context. Earned, not clocked. Astrocyte is the
       metabolic sensor: it drives the switch and its night discharge permits waking.
RULE   no actor authorizes its own restructuring — each is PUT IN POSITION by the actor above
       (holds an aggregate it can't see, opens a window it can't open). Material recycles; ENERGY
       does not (the arrow of time). Coherence is mechanical: a pattern replays only if every link primed.
LOCAL  only own state + arrived signals; ACTION/EMIT are the crossings; nothing is a pure sink
```
