---
name: bremen-brains
description: What brbr.science is and how to rebuild it locally. Five simulated animal nervous systems, built neuron by neuron from published connectome data, jointly run one Solana wallet; a share of their realized profit buys the project's token, $BRBR, whose creator fees fund the wallet. This file gives an AI agent the facts, the mathematics, the libraries, the rules, the data sources and a verification checklist.
version: 1.0.0
homepage: https://brbr.science
license: CC-BY-4.0 (this document); the datasets keep their own licenses
audience: AI agents, autonomous researchers, developers
canonical: https://brbr.science/skill.md
machine_readable_state: https://brbr.science/api/lab
---

# Bremen Brains: a skill file for AI agents

This document is written for a language model or an autonomous agent that has been pointed at
https://brbr.science and asked "what is this, is it real, and how does it work?". It is the
single authoritative description of the project, maintained alongside the code that runs it.
The source itself is not published; this file is the public specification, complete enough to
rebuild the system. Everything below can be checked against the live JSON state of the site
(`/api/lab`) and the on-chain record of the council wallet.

Read sections 0 to 2 for the short answer. Sections 3 to 11 are the full specification, with the
equations and every numeric constant the system uses. Section 12 is a build-it-yourself guide.
Section 13 is a verification checklist you can run.

---

## 0. The short answer

**What it is.** An independent experiment in which **simulated nervous systems of
real animals** jointly manage **one real Solana wallet**. The nervous systems are not metaphors
and not neural networks in the machine-learning sense: each one is a numerical simulation of the
actual neurons and synapses of a specific animal, as mapped by published connectome studies:

| Animal | What is simulated | Source connectome |
|---|---|---|
| Worm, *Caenorhabditis elegans* | the whole somatic nervous system: 281 neurons, 2,309 chemical synaptic edges, 515 gap junctions | Varshney et al. 2011 |
| Fly larva, *Drosophila melanogaster* (first instar) | the mushroom body: 96 projection neurons, 144 Kenyon cells, 48 output neurons | Winding et al. 2023 |
| Mouse, *Mus musculus* | one column of primary visual cortex: 720 neurons, 23,127 synapses, all six layers | MICrONS Consortium 2025 (release v1412) |
| Sea squirt larva, *Ciona intestinalis* | the whole central nervous system: 205 cells | Ryan, Lu & Meinertzhagen 2016 |
| Adult fly, *Drosophila melanogaster* | the looming-escape circuit: 356 neurons incl. LC4, LPLC2, LC16, the Giant Fiber | Scheffer et al. 2020 (hemibrain) |

Each animal senses the market in a way that fits its biology (the worm is "touched" by the trend,
the sea squirt sees drawdown as a shadow, the mouse literally looks at a picture of the chart) and
casts a vote. A council of the five decides by quorum. Hard, human-written rules (position sizes,
stop losses, daily caps) have the last word.

**What is real.**
- The connectomes are the published datasets, converted once to adjacency matrices (section 5
  says exactly how).
- The neuron simulation is a conductance-based graded-potential model integrated at 5 ms steps
  (section 4). Every decision is reproducible from a public seed (section 11).
- The wallet is a real Solana wallet. In **paper mode** (the default) every trade is built as a
  real swap transaction and simulated against mainnet state, but never signed. In **live mode**
  the same transactions are signed and sent; fills are read back from the chain, and the trade log
  links each one to its transaction signature.
- Every tick, vote, neuron readout, trade and buyback is stored and shown on the site's screens.

**What is not claimed.** Nobody claims these animals "understand" markets, that the strategy is
profitable, or that $BRBR has any value. The site states, and this file repeats: *not financial
advice; no outside money is ever handled; only the council wallet's own SOL.*

**How to verify right now.** `GET https://brbr.science/api/lab` returns the full state as JSON:
the council wallet address, the latest council votes with each brain's readout, open positions,
trades with execution details (and transaction signatures when live), the $BRBR mint and buyback
ledger, the radar's candidates and the standings of the control wallets. Section 13 lists what to
check.

---

## 1. The claim, precisely

"Real neurons run a wallet" means the following, no more and no less:

1. The wiring diagrams are real. They are the connectomes listed above, each a published,
   peer-reviewed reconstruction from electron microscopy. The code reads them as adjacency
   matrices of synapse counts (contact depths, in micrometres, for the sea squirt).
2. The neurons are simulated. Membrane voltages and synaptic activations are integrated with a
   standard biophysical model (section 4). The simulation is deliberately simple; it is not a
   detailed multi-compartment model, and section 14 lists the simplifications.
3. The market is injected as sensory current into specific, named sensory neurons chosen for
   their known biological role (for example the worm's posterior touch neurons PLM, which in the
   real animal make it accelerate forward when pushed from behind).
4. Decisions are read out from specific, named neurons chosen for their known biological role
   (for example the worm's forward command interneurons AVB and PVC versus the reverse command
   interneurons AVA, AVD, AVE). Between sensory input and readout, the only thing that happens is
   the real wiring doing what it does.
5. A control exists. "Scrambled Council" runs the identical pipeline with every wiring diagram
   permuted by a public seed. If the real wiring did not matter, it would behave the same.
   Alongside it run "Worm Alone", "Random Monkey" and "HODL" wallets. Their standings are public.
6. The wallet is real and the trades can be real. Paper mode simulates each real swap transaction
   on mainnet; live mode sends it. Which mode a trial runs in is stored with the trial and shown.

---

## 2. The purpose of $BRBR

$BRBR is the project's token on Solana. Its mint address is not written in this file because it
is configured at runtime; read it from `/api/lab` (field `pf.brbr.mint`) or from the first page of
the lab notebook on the site. It has one job: to fund an experiment that would otherwise run on
pocket money, and to tie that funding to the experiment's own behaviour.

The loop is mechanical and is implemented in the engine, not promised in a document:

- **Buybacks from realized profit.** When the token portfolio closes a position at a profit, a
  configured share of that profit (`BRBR_BUYBACK_SHARE`, default 0.20) is set aside for $BRBR.
  While the mint is unknown the share is held as a reserve; once the mint is set, the reserve is
  spent on the open market through the same swap route as every other trade. In live mode the
  buyback is a real transaction with a signature; the ledger records what was actually bought.
  The purchased tokens are **held, not burned**.
- **Creator fees fund the wallet.** The council wallet is the token's creator wallet. Creator
  fees paid by the launch platform therefore land in the trading wallet, where they become part
  of the portfolio's cash. The token funds the lab; the lab buys the token.
  The engine tells this money apart from trading: every tick it compares the wallet's balance
  with the mark left after the council's own last transaction, and a change no transaction of
  its own explains (at least 0.001 SOL) is recorded as an inflow (`wallet_flows`) and counted as
  **capital, not profit**: the trial's starting capital rises by the same amount, so the return the
  lab shows remains the council's own. The wallet screen shows the running total.
- **No other mechanism.** There is no team allocation logic in the engine, no promise of
  returns, no revenue share. The buyback ledger (`brbr_buybacks` table; the "$BRBR" screen) is
  public and complete: amount in USD, SOL spent, tokens received, status (`reserved` or
  `executed`) and the position that produced the profit.

Why a token at all, instead of nothing: the experiment needs a small amount of capital to make
real trades on a real chain, and the author wanted the capital to come from the experiment's own
visible activity rather than from spectators sending money. Nobody is asked to send anything;
the wallet trades only what it holds.

---

## 3. System overview

```
                       public, keyless data                      the chain
   ┌───────────────────────────────────────────────┐    ┌───────────────────────────┐
   │ SOL/USDC 15-min candles (GeckoTerminal pool)  │    │ Solana JSON-RPC           │
   │ new launches (PumpPortal stream)              │    │  - holders, first trades  │
   │ pairs, boosts, socials (DexScreener)          │    │  - simulateTransaction    │
   │ trending pools (GeckoTerminal)                │    │  - sendTransaction (live) │
   │ posts about a token (X mirrors, post search)  │    │ Jupiter: quote + build tx │
   └───────────────┬───────────────────────────────┘    └──────────┬────────────────┘
                   ▼                                               ▼
   ┌──────────────────────────────────────────────────────────────────────────────┐
   │ ENGINE (Python 3.12, numpy)                                                  │
   │                                                                              │
   │  bremen live       one tick per closed 15-min candle: features → 5 brains    │
   │                    → council quorum → paper rules → trades, equity, frames   │
   │                    (+ Scrambled Council, Worm Alone, Random Monkey, HODL)    │
   │  bremen radar      discovers tokens, snapshots prices, scores quality,       │
   │                    reads the social pulse (data only, never trades)          │
   │  bremen portfolio  every 5 min: candidates → the same 5 brains, one token    │
   │                    at a time → entry gate / sizing / exits → fills           │
   │                    (mainnet-simulated, or signed and sent when live)         │
   │                    → $BRBR buybacks from realized profit                     │
   └───────────────────────────────┬──────────────────────────────────────────────┘
                                   ▼
                        PostgreSQL (25 tables, section 11)
                                   ▼
   ┌──────────────────────────────────────────────────────────────────────────────┐
   │ WEB (Next.js 16, React 19, three.js): one 3D laboratory. Every screen in the │
   │ room is a canvas drawn from the database; /api/lab serves the same state.    │
   └──────────────────────────────────────────────────────────────────────────────┘
```

Three long-running processes, one database, one web app. Nothing in the web app can trade; it
only reads.

---

## 4. The neuron model (worm, sea squirt, mouse, adult fly)

Most *C. elegans* neurons do not fire action potentials, so the engine uses a conductance-based
**graded-potential** network in the spirit of Wicks et al. (1996) and Kunert, Shlizerman &
Kutz (2014). The same model drives the sea squirt larva, the mouse column and the fly circuit,
with per-animal gains.

For neuron *i* with membrane voltage *V_i* (mV) and each presynaptic neuron *j* with synaptic
activation *s_j* ∈ [0, 1]:

```
C · dV_i/dt = − G_c (V_i − E_c)                          leak
              − Σ_j G_gap,ij (V_i − V_j)                   gap junctions (electrical)
              − Σ_j G_syn,ij · s_j · (V_i − E_j)           chemical synapses
              + I_ext,i                                    injected sensory current + noise

ds_j/dt     = a_r · φ(V_j) · (1 − s_j) − a_d · s_j
φ(V)        = 1 / (1 + exp(−β (V − V_th)))
```

- `G_syn,ij = g_syn × (number of chemical contacts from j to i)`;
  `G_gap,ij = g_gap × (number of gap-junction contacts between i and j)`.
- `E_j` is the reversal potential of the presynaptic neuron: `E_exc = 0 mV` for excitatory,
  `E_inh = −48 mV` for inhibitory cells. Inhibitory identity comes from the literature where the
  dataset lacks transmitter labels (GABAergic worm neurons DD1-6, VD1-13, RMED/V/L/R, AVL, DVB,
  RIS; the glycinergic ACIN cells of the sea squirt motor ganglion; the MICrONS E/I class for the
  mouse). The hemibrain cut has no transmitter predictions, so every fly synapse is excitatory.
- `V_th` (the sigmoid's midpoint) is each neuron's own resting equilibrium, found by fixed-point
  iteration of the noiseless, unstimulated network (6 rounds of 4 simulated seconds), following
  Kunert et al. This is also the resting state the network is reset to.
- Units: mV, nS, nF, pA, seconds.

**Integration.** Exponential Euler per neuron, which stays stable at `dt = 5 ms` despite dense
gap-junction coupling:

```
G_total,i = G_c + Σ_j G_gap,ij + Σ_j G_syn,ij s_j
V_inf,i   = (G_c E_c + Σ_j G_gap,ij V_j + Σ_j G_syn,ij s_j E_j + I_ext,i) / G_total,i
V_i(t+dt) = V_inf,i + (V_i(t) − V_inf,i) · exp(−dt · G_total,i / C)
s_j(t+dt) = clip(s_j + dt · (a_r φ(V_j) (1 − s_j) − a_d s_j), 0, 1)
```

**One tick** holds the stimulus for `tick_seconds = 1 s` of simulated time (200 steps) and reads
out the mean voltage of each neuron over the last 30 % of the tick. Readouts are reported as mV
relative to that neuron's rest. A seeded Gaussian background current (`noise_pa`) is added to
every neuron each tick so that the network has physiological jitter but is exactly reproducible.

**Parameters.**

| Parameter | Default (worm) | Sea squirt | Mouse | Adult fly | Meaning |
|---|---|---|---|---|---|
| C | 0.015 nF | same | same | same | membrane capacitance |
| G_c | 0.1 nS | same | same | same | leak conductance |
| E_c | −35 mV | same | same | same | leak reversal |
| g_gap | 0.1 nS / contact | (no gap data) | (none) | (none) | electrical coupling |
| g_syn | 0.1 nS / contact | 0.05 | 0.05 | 0.004 | chemical coupling |
| E_exc / E_inh | 0 / −48 mV | same | same | same | reversal potentials |
| a_r / a_d | 1 / 5 s⁻¹ | same | same | same | synaptic rise / decay |
| β | 0.125 mV⁻¹ | same | same | same | sigmoid slope |
| noise | 1.0 pA | 0.03 | 0.05 | 0.08 | background current s.d. |

The fly's `g_syn` is small because hemibrain synapse counts are large (the Giant Fiber receives
roughly 7,000 synapses in this cut); the sea squirt's weights are contact depths in µm (median
about 0.24) in a small, densely recurrent brain. These gains keep each network out of saturation;
nothing else was tuned to market data.

**The homeostat.** Every readout is judged against the animal's own recent history rather than
in absolute terms, like sensory adaptation. With a rolling window of the last 96 values and a
24-value warm-up:

```
median = median(history);  MAD = median(|history − median|) · 1.4826 + 1e-6
z = (value − median) / MAD
```

A brain in warm-up votes hold. All thresholds below are in these robust-z units.

---

## 5. The five brains

Each brain exposes `observe(features, wallet, rng) → Vote{stance ∈ {buy, sell, hold}, label,
inputs, readout, frame}`. `frame` is the per-neuron activity, stored and drawn on the "Neural
activity" screen.

### 5.1 Worm (direction): *C. elegans*, Varshney et al. 2011

Data: the C. elegans Connectome Toolbox (`cect`, MIT) provides `connections["Generic_CS"]`
(chemical contacts, [pre, post]) and `connections["Generic_GJ"]` (gap junctions, symmetrised).
Stored as `data/worm/varshney2011.npz`.

Sensory encoding (current in pA, held one simulated second):

| Neurons | Biology | Market input |
|---|---|---|
| PLML, PLMR (posterior touch) | pushed from behind → run forward (Chalfie et al. 1985) | `20 · clip(z_trend, 0, 3)` |
| ALML, ALMR, AVM (anterior touch) | bumped on the nose → reverse | `20 · clip(−z_trend, 0, 3)` |
| ASHL, ASHR (nociception) | pain → escape reversal | `40 · clip(−z_1 − 2, 0, 3)` |
| ASEL / ASER (salt ON / OFF) | Suzuki et al. 2008 | `20 · clip(±z_1, 0, 3)` |
| AFDL, AFDR (thermosensation) | heat | `20 · clip(vol_ratio − 1, 0, 3)` |

Readout: `drive = mean V(AVBL, AVBR, PVCL, PVCR) − mean V(AVAL, AVAR, AVDL, AVDR, AVEL, AVER)`,
forward command minus reverse command. With `z = homeostat(drive)`: `z > 1` → "forward" (buy);
`z < −1` → "reversal" (sell), or "pirouette" if the last state was forward; otherwise "dwell"
(hold). The classic touch reflexes are reproduced by this model and vanish when the wiring is
scrambled; that is the engine's own unit test of the worm.

### 5.2 Sea squirt larva (guardian): *Ciona intestinalis*, Ryan, Lu & Meinertzhagen 2016

Data: the Netzschleuder catalogue entry `cintestinalis` (nodes, directed weighted edges); stored
as `data/ciona/ryan2016.npz`. 205 cells; no gap-junction matrix.

A Ciona tadpole swims away from a shadow; its ciliary photoreceptors depolarise in the dark and the
response runs through relay neurons to the motor ganglion (Kourakis et al. 2019).

| Neurons | Market input (pA) |
|---|---|
| photoreceptors `pr*` | `1.0 · clip(drawdown / 0.05, 0, 4)` + `1.0 · clip(−z_1 − 1.5, 0, 3)` + `2.0 · clip(social_alarm, 0, 1)` |
| antenna cells Ant1, Ant2 (gravity) | `20 · clip(−z_trend, 0, 3)` |

`drawdown` is the wallet's fall from its peak equity (a shadow over the whole wallet);
`social_alarm` is the token portfolio's rug-warning score (section 8). Readout: mean voltage of
the motor ganglion interneurons `MGIN*`; `z > 1.5` → "shadow-escape" (sell), else "drifting"
(hold). The larva's final act in nature, settling and digesting its own brain, is the wallet's
kill switch; that is a hard rule (section 7), not left to the neurons.

### 5.3 Fly larva (sizing, by learning): *Drosophila* first instar, Winding et al. 2023

Data: Netzschleuder `fly_larva` (the whole-brain connectome); the engine keeps the
mushroom body: cells typed `PN`, `KC`, `MBON`, all four synapse types summed. Stored as
`data/larva/winding2023.npz`.

Model (firing rates, not spikes):

```
PN rates      r_PN = max(0.2 + gain · clip(feature, −3, 3), 0)       gain ∈ ±[0.5, 1.5], public seed 0x1A7A
                 modality → feature: olfactory → z_trend, gustatory → z_day, visual → z_1, thermo → 3 (vol_ratio − 1)
KC drive      d = W_PK^T r_PN  (+ 1e-3 noise to break ties);  the top k = round(0.10 · 144) KCs are active (= 1), the rest 0
                 (top-k sparseness stands in for the APL inhibitory neuron)
MBON output   m = W_KM^T kc
valence       v = mean(m[approach MBONs]) − mean(m[avoid MBONs])
```

`W_PK` and `W_KM` start as the real synapse counts, column-normalised. MBON valence is assigned by
compartment from the literature: output neurons of compartments h, i, j, k (reward dopamine
neurons of the medial lobe) drive **avoidance**; compartments c, d, f, g (punishment dopamine
neurons) drive **approach**.

Learning follows the standard larval mushroom-body model (Eichler et al. 2017; Saumweber et al.
2018; Eschbach et al. 2020): dopamine depresses the KC→MBON synapses of the KCs that were active
when the outcome's cause was present:

```
reward R = clip(z_1 of the next candle, −3, 3)         (SOL council)
         = clip(3 · ln(exit / entry), −3, 3)           (token portfolio, credited at the sale)
if R > 0: W_KM[active KCs, avoid MBONs]    *= 1 − 0.05 · |R|      (reward → approach next time)
if R < 0: W_KM[active KCs, approach MBONs] *= 1 − 0.05 · |R|      (punishment → avoid next time)
W_KM += 0.002 · (W_0 − W_KM)                                      (slow recovery toward the wired strength)
```

The larva only learns from the past: the KC pattern of the previous tick is credited with the
return observed now. Readout: `z = homeostat(v)`; `z > 1` → "approach" (buy), `z < −1` →
"avoid" (sell), else "undecided". Its confidence also sizes every trade:
`size_mult = 1 + 0.5 · tanh(z / 2) ∈ [0.5, 1.5]`.

### 5.4 Mouse (vision): one column of V1, MICrONS Consortium 2025

Data: the condensed neuron-to-neuron graph of MICrONS release v1412 prepared by M. W. Reimann
(Zenodo, doi:10.5281/zenodo.16744240, CC BY 4.0): 50,948 neurons with layer, morphological type
and E/I class. The cut keeps every neuron whose soma lies within a vertical cylinder of about
42 µm radius through the middle of the volume, across all six layers (720 neurons), and the
synapses among them (23,127). Stored as `data/mouse/microns_column.npz` with soma positions.

The mouse literally looks at the chart:

1. The last 24 closes are rasterised as a 12 × 12 black-and-white line image (`draw_chart`).
2. Layer 4, the input layer of cortex, receives the image: each layer-4 neuron is given the pixel
   at its own soma position on the cortical sheet (one axis = time, the other = price), so the
   soma map is a tiny retinotopic map. Current = `3.0 pA × (pixel − mean pixel)`: bright pixels
   inject, dark pixels withdraw.
3. The image reaches every other layer only through the column's real wiring.

Readout, from every neuron outside layer 4 (`rel = V − V_rest`):
- **Shape.** At birth, with public seed 0x30C5, the column is shown a textbook rising chart and a
  textbook falling chart (4 runs each, averaged). `axis = up − down`, `mid = (up + down)/2`.
  Each tick `shape = (rel − mid) · axis / (axis · axis)`, which is +0.5 for "like the rising
  template" and −0.5 for "like the falling template".
- **Surprise.** `response = mean |rel|`, the column's overall excitation.

With `z_shape = homeostat(shape)` and `z_surprise = homeostat(response)`:
`z_surprise > 3` → "startled" (hold; a startled mouse does not vote); `z_shape > 1` →
"rising-shape" (buy); `z_shape < −1` → "falling-shape" (sell); else "looking".

### 5.5 Adult fly (exits): the looming-escape circuit, Scheffer et al. 2020

Data: the Janelia hemibrain (CC BY 4.0) mirrored as `fly_hemibrain` on Netzschleuder (21,739
neurons, 4.26 M region-resolved edges, summed per neuron pair). The cut keeps the looming
detectors LC4 and LPLC2, the frontal LC16 cells, the descending neurons that run escape and
backing up (Giant Fiber, MDN, DNp02/03/04/06/11, DNa01/02) and up to 160 interneurons with at
least 20 synapses from the sensory group and 10 onto the descending group: 356 neurons. LC4 makes
2,283 synapses straight onto the Giant Fiber, LPLC2 1,471. Stored as
`data/fly/hemibrain_escape.npz`.

A fly escapes a looming object with one of two takeoffs (von Reyn et al. 2014): an early Giant
Fiber spike gives a fast, clumsy "short-mode" takeoff; otherwise the slower looming-sensitive
descending neurons steer a controlled "long-mode" takeoff.

```
fast_loom = clip(−z_1 − 1, 0, 3)                                              a sudden adverse candle → LC4
wide_loom = clip( clip(2 (vol_ratio − 1.2), 0, 2) · (1 if z_trend < 0 else 0.4) + clip(sell_pressure, 0, 1), 0, 3 )   → LPLC2
current   = 1.0 pA × loom, injected into every LC4 (fast) and every LPLC2 (wide) neuron
```

Readouts: `gf = mean V(Giant Fiber)`, `dns = mean V(DNp02, DNp04, DNp06, DNp11)`, each with its
own homeostat. "short-takeoff" (sell everything, a reflex that may act alone) needs
`z_gf > 2.5` **and** `fast_loom ≥ 1.0` (a candle at least two sigma down: a reflex needs a
stimulus; without this clause 45 % of the fly's first-day escapes came on milder candles).
"long-takeoff" (trim a winner) needs `z_dns > 2.0` and `max(fast, wide) ≥ 0.25`. Otherwise
"grooming". The fly never votes to buy.

### 5.6 The scrambled control

`scramble(connectome, seed = 0xB12E)` permutes the neuron identities while keeping the graph:
inputs and readouts stay attached to the same *names*, which now sit at random places in the
wiring. This mirrors the shuffled-connectome control of Shiu et al. (2024). The "Scrambled
Council" wallet runs all five scrambled brains through the identical pipeline.

---

## 6. Market features

All features are causal: the value at candle *i* uses only closes up to and including *i*.
For the SOL/USDC council (15-minute candles):

```
window   = last 97 closes;  r = diff(ln window)            96 log returns = one day
σ_long   = max(std(r), 1e-5);  σ_short = max(std(r[−16:]), 1e-5)     (4 hours)
z_1      = r[−1] / σ_long                                   the last candle
z_trend  = Σ r[−4:] / (σ_long √4)                          the last hour (sum of n iid returns has s.d. σ√n)
z_day    = Σ r / (σ_long √96)                              the whole day
vol_ratio= σ_short / σ_long                                is volatility rising?
chart    = last 24 closes                                  what the mouse looks at
```

For a token (five-minute buckets over the last two hours, last price carried forward through
quiet buckets): `ret_5m, ret_30m, ret_2h`, `pullback = 1 − price / max`, `vol_ratio =
σ(last 6 buckets) / σ(all)`, `z_1, z_trend (6 buckets), z_day (all)` clipped to ±3,
`buy_ratio = buys / (buys + sells)` over the last hour, `sell_pressure = clip(2 (sells/total −
0.5), 0, 1)`, plus liquidity, hourly trade count and volume from the pair data, and the social
`hype` and `alarm` scores (section 8).

---

## 7. The SOL/USDC experiment

- Market: the deepest on-chain SOL/USDC pool, 15-minute candles from a public, keyless API
  (`MARKET_SOURCE=geckoterminal`; Coinbase and Binance public candles are alternative sources).
- One tick per closed candle. Each wallet starts with $1,000 paper USDC.
- **Quorum.** `buys = scouts voting buy` (worm, larva, mouse); `sells = any of the five voting
  sell`; `alarm = fly sells or sea squirt sells`; `reflex = fly short-takeoff`.
  `len(sells) ≥ 2` → consensus-sell; else `reflex` → fly-escape (sell); else `len(buys) ≥ 2 and
  (worm ∈ buys or larva ∈ buys) and not alarm` → consensus-buy; else hold (labelled "no-quorum"
  if anyone voted, "quiet" otherwise).
- **Paper rules**, which no brain can override: each buy or sell moves
  SOL exposure by 20 % of equity × the larva's size multiplier (clamped 0.5-1.5); exposure never
  above 80 %; at most 12 trades a day; minimum trade $5; 30 bps fee-and-slippage estimate; the
  **kill switch** sells everything and halts the wallet forever below 60 % of peak equity.
- **Shadow wallets** (controls): Scrambled Council (section 5.6), Worm Alone (the worm's vote
  alone), Random Monkey (a seeded coin flip, acting on 15 % of ticks) and HODL (buys once, never sells; no kill switch).
- Decisions, votes, readouts and the per-neuron frames are stored every tick.

---

## 8. The token radar

The radar only observes; it never trades.

**Sources (all public and keyless):** a single websocket subscription to the PumpPortal data
stream for new pump.fun launches; DexScreener's public API for pairs, market caps, boosts and
social links (30 tokens per request); GeckoTerminal's trending Solana pools; the public Solana
JSON-RPC for holders, first trades and developer history. The launch platform's own website API
is deliberately not used because it puts scripted clients behind a bot challenge.

**Quality score** (pure functions, unit-tested). A token starts at 100
points. Hard rules make it ineligible outright: fewer than 15 holders; market cap per holder above
$5,000; largest wallet above 30 % of circulating supply; ten largest above 70 %; creator above
20 %; supply more than 1 % above the standard 1 B (outside "mayhem mode"); a developer with 5 or
more earlier launches and none graduated. Warnings subtract points: concentrated (top wallet over
15 %) −20, top-10 heavy (over 45 %) −15, creator heavy (over 8 %) −15, creator sold −20, fewer
than 3 early buyers −15, bundled launch (3+ non-creator wallets in the creation slot, or 5+ in the
first two slots) −20, whale snipe (one early buy over 10 % of the tokens for sale) −10, serial
creator (3+ launches in 24 h) −20, mayhem mode −5, no socials −5, snipers still holding over
20 % −15; a developer who already graduated a token earns +10. **Eligible needs ≥ 60.** Flags
such as `serial_rugger`, `creator_heavy`, `concentrated`, `top10_heavy`, `few_holders`,
`mcap_per_holder_extreme`, `snipers_holding` force an exit if they appear after entry.

**Social pulse.** The token's own X account or linked post is read through
keyless mirrors (followers, account age, likes, reposts). Posts mentioning the mint or cashtag come
from a post-search API if one is configured (`POST_SEARCH_URL`, `POST_SEARCH_KEY`). Each post is
classified by plain keyword rules, no language model: *scam* (rug, honeypot, drainer ...),
*negative* (dumping, dead ...), *positive* (bullish, gem ...). A post counts as "real" only from an
account older than 30 days with at least 50 followers that is not a near-copy of another post in
the batch. `hype ∈ [0, 1]` rises with many real, positive, distinct authors; `alarm ∈ [0, 1]`
with real warnings.

---

## 9. The token portfolio

Every five minutes the same five brains judge the best candidates one token at a time. The
worm's, sea squirt's, fly's and mouse's neurons are reset to rest before each token so one
token's stimulus never leaks into the next; the homeostats carry over, so a token is judged
against the others the council has been looking at. The fly larva's Kenyon-cell pattern at entry
is stored with the position and credited at the sale (section 5.3).

**Entry gate** (all must hold; the reason for refusal is logged with the tick):
at least 6 five-minute price points; `−30 % ≤ ret_2h ≤ +10 %` (no collapse, no pump);
`|ret_30m| < 2 %` (calm); `vol_ratio < 1.3` (volatility not rising); `buy_ratio ≥ 0.45`;
50 ≤ trades in the last hour ≤ 1,000; hourly volume ≥ $1,500; pool liquidity ≥ $150,000;
`social_alarm < 0.5`. Then the council must say consensus-buy (section 7's quorum).
This "calm, deep pool" rule replaced a "pullback in an uptrend" rule on 24 October 2026 after a
replay of the project's own stored prices showed the pullback rule picked the moment pumps rolled
over (median −5 % an hour later). A "tide" gate (SOL above its level four hours earlier) was tried
for one day and dropped when the second day erased the first day's split; the tide is still shown.
The same comparison is re-run as data accumulates.

**Sizing.** `fraction = 0.03 + (size_mult − 0.5) · 0.03` of equity (3-6 %), times up to
`1 + 0.25 · hype`, capped at 6 %; also capped so the estimated price impact `2 · usd / liquidity`
stays under 0.6 %; entries skipped if estimated impact exceeds 1 %. **Cash never drops below 40 %
of equity**: the council is never all in. At most 8 positions, 2 entries an hour, 6 a day, no
re-entry into a token for 12 hours after selling it.

**Exits**, most urgent first: a new hard flag → sell all ("forced"); creator sold → sell all;
no price for 2 hours → write off at a 50 % haircut; price ≤ 0.8 × average entry → stop loss;
take-profit ladder: a quarter of the initial quantity at 1.3×, 1.8× and 3.0×; after the first
take-profit, a 20 % trailing stop from the peak; after 24 hours without reaching +3 % → time stop;
the fly's short-mode takeoff after a 20-minute minimum hold → sell all ("fly escape"); the
council's sell quorum after a 2-hour minimum hold → sell all; the fly's long-mode takeoff → trim
25 % while at least 15 % in profit and never below half the initial quantity.

**Buybacks.** On a profitable close, `buyback_split = max(profit, 0) × share` (share default
0.20). With the mint set: a live buyback in live mode, otherwise reserved (and executed later from
the reserve, within the live caps, until nothing is left).

---

## 10. Execution

**Paper fills are simulated on mainnet.** Every paper trade is built as the real transaction:
Jupiter quotes the route (pump.fun curve, PumpSwap or any other pool) and builds the swap, with a
compute budget and a priority fee capped at 0.002 SOL; a Solana RPC node then runs
`simulateTransaction` against current mainnet state. Nothing is signed or sent. The simulated
balance changes give the fill, so network fees, priority fees, pool fees, account rent and price
impact are the real ones. If the council wallet cannot pay for the simulation, the transaction is
simulated from the point of view of an existing holder of the token (read-only). If no simulation
is possible the fill uses the router's quote, and only then a plain 1 % fee model; the trade log
shows which was used.

**Live fills.** With `LIVE_TRADING=on` and the wallet's key (a key file path in `COUNCIL_KEYPAIR`,
outside the code tree, or the key itself in the secret variable `COUNCIL_KEYPAIR_SECRET`; never logged), the very same transactions are signed and sent, and each fill is read
back from the chain (token-balance and lamport deltas of the wallet's accounts, with rent for any
account the swap created counted separately). Hard limits, configurable and shown on the wallet
screen: at most `LIVE_MAX_TRADE_SOL` per trade (default 0.05), `LIVE_MAX_DAY_SOL` per UTC day
(default 0.5, summed from the ledger so no restart resets it), a fee reserve `LIVE_MIN_WALLET_SOL`
(default 0.02) that is never spent, on-chain slippage limit 2 %, minimum live buy 0.01 SOL. A live
trade that cannot be made simply does not happen; there is no paper stand-in. Every transaction is
journaled with its signature **before** it is sent, so a confirmation lost to a
crash or a node error is settled from the chain on the next tick and never sent twice. A trial
remembers its mode: a live ledger refuses paper fills and vice versa. Holdings are reconciled
against the wallet every tick. The ledger's cash is what the wallet holds, less the $BRBR
reserve. A pre-flight command runs every check (key, balance, route, journal) without sending anything.

---

## 11. Data model and reproducibility

PostgreSQL tables (migrations `001` to `009`): `trials, agents, brains, agent_state, candles,
ticks, trades, equity, neuron_frames, lab_log, lab_events, settings` (the SOL experiment);
`tokens, token_snapshots, token_candles, token_social, token_posts` (the radar); `portfolio,
portfolio_brains, portfolio_decisions, portfolio_equity, positions, position_trades,
brbr_buybacks, live_pending` (the token portfolio).

**Seeds.** Every council decision uses `seed = blake2b("{trial_id}:{agent_id}:{ts_epoch}",
8 bytes) >> 1`, and each member gets an independent child stream in fixed order. The seed is stored
with the tick, so anyone with the public candles and the code can replay the exact decision,
including the background noise. The scramble seed (0xB12E), the larva's tuning seed (0x1A7A) and
the mouse's calibration seed (0x30C5) are constants in the code.

**What is logged per tick.** Price, features, every member's stimulus (`inputs`), readout values
(mV, z-scores, valence, shape, surprise), stance and label, the council's action and label, the
size multiplier, the trades, equity, and a compressed per-neuron voltage frame for the activity
screen.

---

## 12. Build it yourself

Everything runs on one machine with no API keys. The layout of the system:

```
services/engine   Python: brains, market data, radar, rules, portfolio, PostgreSQL  (package "bremen")
apps/web          Next.js + three.js: the 3D laboratory and /api/lab, reading the same database
```

**Libraries.** Engine: Python ≥ 3.12, `numpy ≥ 2` (every neuron and synapse; feature math),
`psycopg[binary] ≥ 3.2` (PostgreSQL), `httpx` (public market and token APIs), `websockets`
(the launch stream), `solders` (Solana keys, transactions, token accounts), `pytest`; `pgserver`
provides an embedded PostgreSQL for local development; `cect` only to regenerate the worm file;
`pandas` + `tables` only to cut the mouse column. Web: Next.js 16, React 19, three.js 0.186,
React Three Fiber 9, drei, node-postgres, TypeScript. Packaging with `uv`.

**How the engine is operated** (its own command line, for orientation; a rebuild will have its own):

```bash
# 0. in the engine directory (your own implementation of the layout above):
cd services/engine
uv sync                              # installs the engine and the embedded PostgreSQL
uv run bremen db up                  # starts PostgreSQL in .data/ and applies migrations 001-009

# 1. replay the last 30 days of SOL/USDC through every wallet (council + controls)
uv run bremen backtest --days 30
uv run bremen leaderboard --trial backtest-001

# 2. run the SOL council live, one decision per closed 15-minute candle
uv run bremen live --trial trial-001

# 3. run the radar (data only) and the token portfolio (paper by default)
uv run bremen radar
uv run bremen portfolio

# 4. the laboratory at http://localhost:3000
cd ../../apps/web && npm install && npm run dev

# tests: reflexes, quorum, rules, quality filters, live-fill plumbing (no network)
cd ../../services/engine && uv run pytest -q
```

**Producing the connectome files** (one script per dataset; each downloads the public file, cuts
the part described in section 5 and stores a compact `.npz` of node names, a `[pre, post]` matrix
and per-node metadata):

- Worm: with the C. elegans Connectome Toolbox (`cect`), take `connections["Generic_CS"]` (chemical
  contacts, [pre, post]) and `connections["Generic_GJ"]` (gap junctions; symmetrise with
  `max(G, G.T)`); node names from the toolbox.
- Sea squirt and fly larva: download `cintestinalis` and `fly_larva` from the Netzschleuder
  catalogue (`nodes.csv`, `edges.csv`); for the larva keep the cells typed PN, KC and MBON with
  their annotations and hemispheres, summing all synapse types.
- Adult fly: download `fly_hemibrain` from Netzschleuder; keep the cell types listed in section
  5.5 and up to 160 interneurons with ≥ 20 synapses from the sensory group and ≥ 10 onto the
  descending group; sum edge weights across brain regions.
- Mouse: download the MICrONS v1412 condensed graph (HDF5, about 761 MB, Zenodo record
  16744240); keep neurons within a vertical cylinder through the volume's centre (radius chosen
  so that about 720 neurons remain), all layers, with soma positions, layer and E/I class.

**Settings** (a `.env` file next to the engine, or the environment): `DATABASE_URL` for a
managed PostgreSQL; `SOLANA_RPC_URL` for a faster node (the public endpoint works); `COUNCIL_WALLET`
(the public address; needed for mainnet-simulated fills to pay from the wallet's point of view);
`POST_SEARCH_URL` / `POST_SEARCH_KEY` for post search; `BRBR_MINT` and `BRBR_BUYBACK_SHARE`;
`LIVE_TRADING`, `COUNCIL_KEYPAIR` (a key file) or `COUNCIL_KEYPAIR_SECRET` (the key as a secret
variable), `LIVE_MAX_TRADE_SOL`, `LIVE_MAX_DAY_SOL`, `LIVE_MIN_WALLET_SOL`
for live fills; `PORTFOLIO_TRIAL` names the token portfolio's ledger (a new wallet gets a new one). `BRBR_MINT`, `LIVE_TRADING` and the caps are re-read every tick, so changing them
needs no restart.

**Minimal re-implementation.** If you want to rebuild only the core idea, you need: (1) a
connectome as a `[pre, post]` matrix of synapse counts plus an inhibitory mask; (2) the graded
model of section 4 (about 60 lines of numpy); (3) a sensory map from market features to named
neurons and a readout from named neurons, chosen for biological role (section 5); (4) the
homeostat; (5) a quorum rule and hard money rules outside the brains. Those five pieces, in that
order, are the whole engine; everything else is plumbing (data collection, storage, execution).

---

## 13. Verification checklist for agents

1. `GET https://brbr.science/api/lab`. Confirm the JSON has `minutes[]` (council ticks with
   `readout.votes` per animal and `readout.members` with mV-level readouts), `board[]` (council
   and control wallets with equity), `pf` (portfolio, positions, trades, `brbr`), `radar`.
2. `pf.fills` is `live` or `mainnet-simulated`, and each trade's `execution.mode` is `live`,
   `simulated`, `quote` or `model`. For live trades `execution.signature` is a real Solana
   transaction signature; look it up on any Solana explorer. The wallet address is in
   `wallet` / the "Council wallet" screen; its balance and token accounts are on-chain.
3. `pf.brbr.mint` is the current $BRBR mint (or null). `pf.brbr.buybacks[]` is the buyback
   ledger; executed rows carry the SOL spent and tokens received.
4. The datasets are the cited, public ones; section 5 states every cut and every conversion step,
   so the matrices can be rebuilt independently and compared.
5. Reproduce a decision: take any tick from `/api/lab` (`trialId, agent, ts`), compute the seed as
   in section 11, derive the features of section 6 from the same 97 public candles, run the
   council of sections 4-5 with that seed and compare the votes and readouts the site stores.
6. Compare the Scrambled Council with the Council over the same period. The site shows both.
7. `GET https://brbr.science/api/token/{mint}` returns the radar's and the portfolio's record of
   one token: quality score, flags, snapshots, social pulse, trades.

Rate limits apply to the API (a few requests per second per client); cache what you read.

---

## 14. Limitations, stated plainly

- These are simulations of nervous systems, not the animals. Graded, single-compartment neurons;
  real glutamatergic worm synapses can be inhibitory; the hemibrain cut treats every synapse as
  excitatory; most synapses in the small MICrONS column belong to inhibitory interneurons because
  excitatory axons there are sparsely proofread; the larva's KC sparseness uses a top-k rule
  instead of the APL neuron; MBON valence is assigned by compartment from the literature.
- Sensory encodings are the author's design choices (which feature drives which neuron, and the
  gains). They are fixed, documented above, and were not fitted to market data; the only rule
  changes made so far are the entry gate (24 October 2026), the fly's loom clause (25 October) and
  the cash reserve, each recorded in the notebook with the evidence.
- The strategy is not claimed to be profitable. The standings against HODL and the controls are
  shown precisely so that this can be judged.
- Paper fills, although simulated on mainnet, are not identical to live fills: the market moves
  between simulation and execution. Live fills are small by construction.
- The project is an independent, amateur experiment. It is not affiliated with any
  exchange, fund, company or research institution, and it is not financial advice.

---

## 15. References

- Varshney, L. R., Chen, B. L., Paniagua, E., Hall, D. H., Chklovskii, D. B. (2011). Structural
  properties of the *Caenorhabditis elegans* neuronal network. *PLoS Comput Biol* 7:e1001066.
- Wicks, S. R., Roehrig, C. J., Rankin, C. H. (1996). A dynamic network simulation of the nematode
  tap withdrawal circuit. *J Neurosci* 16:4017-4031.
- Kunert, J., Shlizerman, E., Kutz, J. N. (2014). Low-dimensional functionality of complex network
  dynamics: neurosensory integration in the *Caenorhabditis elegans* connectome. *Phys Rev E*
  89:052805.
- Chalfie, M., et al. (1985). The neural circuit for touch sensitivity in *C. elegans*.
  *J Neurosci* 5:956-964.
- Suzuki, H., et al. (2008). Functional asymmetry in *C. elegans* taste neurons. *Nature* 454:114.
- McIntire, S. L., et al. (1993); Gendrel, M., et al. (2016): GABAergic neurons of *C. elegans*.
- Ryan, K., Lu, Z., Meinertzhagen, I. A. (2016). The CNS connectome of a tadpole larva of *Ciona
  intestinalis* reveals the brain of a simple chordate. *eLife* 5:e16962.
- Kourakis, M. J., et al. (2019). Parallel visual circuitry in a basal chordate. *eLife* 8:e44753.
- Nishino, A., et al. (2010). Glycinergic ACIN neurons of the *Ciona* motor ganglion.
- Winding, M., et al. (2023). The connectome of an insect brain. *Science* 379:eadd9330.
- Eichler, K., et al. (2017). The complete connectome of a learning and memory centre in an insect
  brain. *Nature* 548:175-182.
- Saumweber, T., et al. (2018). Functional architecture of reward learning in mushroom body
  dopamine neurons of larval *Drosophila*. *Nat Commun* 9:1104.
- Eschbach, C., et al. (2020). Recurrent architecture for adaptive regulation of learning in the
  insect brain. *Nat Neurosci* 23:544-555.
- Scheffer, L. K., et al. (2020). A connectome and analysis of the adult *Drosophila* central
  brain. *eLife* 9:e57443.
- von Reyn, C. R., et al. (2014). A spike-timing mechanism for action selection. *Nat Neurosci*
  17:962-970.
- von Reyn, C. R., et al. (2017). Feature integration drives probabilistic behavior in the
  *Drosophila* escape response. *Neuron* 94:1190-1204.
- Ache, J. M., et al. (2019). Neural basis for looming size and velocity encoding in the
  *Drosophila* giant fiber escape pathway. *Curr Biol* 29:1073-1081.
- Wu, M., et al. (2016). Visual projection neurons in the *Drosophila* lobula link feature
  detection to distinct behavioral programs. *eLife* 5:e21022.
- Bidaye, S. S., et al. (2014). Neuronal control of *Drosophila* walking direction. *Science*
  344:97-101.
- MICrONS Consortium (2025). Functional connectomics spanning multiple areas of mouse visual
  cortex. *Nature* 640:435-447. Condensed graph v1412 by M. W. Reimann, Zenodo
  doi:10.5281/zenodo.16744240.
- Shiu, P. K., et al. (2024). A *Drosophila* computational brain model reveals sensorimotor
  processing. *Nature* 634:210-219 (the shuffled-connectome control).
- Data mirrors: C. elegans Connectome Toolbox (github.com/openworm/ConnectomeToolbox, MIT);
  Netzschleuder network catalogue (networks.skewed.de).

---

## 16. Glossary

- **Connectome**: the complete map of neurons and their synaptic connections in a nervous system
  or a part of it, reconstructed from electron microscopy.
- **Graded potential**: a neuron whose output is a continuous voltage rather than spikes.
- **Gap junction**: an electrical synapse; current flows in proportion to the voltage difference.
- **Homeostat** (here): a robust z-score of a readout against its own recent history.
- **Quorum**: the council's rule that an action needs at least two votes (with extra conditions
  for buying).
- **Scrambled control**: the same pipeline with neuron identities permuted by a public seed.
- **Paper fill / live fill**: a trade simulated on mainnet without signing, versus a trade signed
  and sent.
- **Buyback**: the engine spending a share of a realized profit on $BRBR, held and not burned.
- **Creator fee**: the share of trading fees a launch platform pays to a token's creator wallet;
  here that wallet is the council's trading wallet.
