STAKEFLY / docs watch it live

The show

element source of truth label on the page
the fly (web/src/scene.ts) built in code; wings and legs follow the MN9/DNp09 rate, head turn follows DNa02 right−left, electrode glow follows PAM11 Hz, each through a bounded response (100 ms attack, 700 ms release); the foreleg tap is choreography on the spin event "body: engineered readout of measured rates"
the phone the JPEG the loop captured from the browser the fly is looking at (frame events, 360×640, ~18 KB, one per observation) "phone: the pixels the retina gets"
the inset (web/src/brain.ts) real MaleCNS skeletons filtered to 173 cells: 150 Kenyon cells, MBON07 ×4, MBON11 ×2, PAM11 ×15, DNa02 ×2; vertex colour from that cell's spike count in the last observation (display_counts, mapped by bodyId) "orange = spikes this observation"
PAM11 chart (web/src/chart.ts) mean PAM11 spikes per neuron per neural second over the last 120 observations, real bounds, no smoothing; shaded where the reward current was on axis labels
bankroll tile (web/src/bankroll.ts) the driver's balance and the loop's totals; observed return vs the game's published return; expected loss = wagered × (1 − RTP) "rules: engineered" block lists every number we chose
log (web/src/log.ts) one line per spin with reels, payout, the reward current it caused, PAM11 Hz and edges moved at that moment; process log lines dimmed
lore cards (web/src/lore.ts) six cards, each tagged measured / engineered / learned

The phone is the retina

The image on the phone in the scene is the JPEG the loop captured from the browser the fly is looking at, sent once per observation. The 90 × 160 frame that drives the photoreceptors is that same capture, downscaled. Nothing about a win or a loss reaches the retina except through those pixels.

The body is a readout, not a puppet

Wing and leg motion follow the measured MN9/DNp09 rate; head turning follows DNa02 right minus left; the electrode's glow follows PAM11. Each goes through a bounded response with a 100 ms attack and a 700 ms release so a brief burst stays visible. None of it feeds back into the model. The foreleg tap on a spin is choreography triggered by the spin event.

How it reaches you

  • web/server.js gains a relay mode, on when INGEST_TOKEN is set: the box's uplink connects out to wss://<site>/ingest?token=…, the server fans every event out to /ws viewers, replays the latest config and bankroll to a viewer on connect, and drops frame events for any viewer with more than 512 KB unsent so a slow connection loses pictures rather than falling behind. /healthz reports upstream, viewers, events received and frames dropped. Without the token the old proxy mode stays. Dependency: ws (the production image now runs npm ci --omit=dev).
  • live/uplink.py: reads the loop's local websocket and pushes it up, both sides with reconnect and backoff, dropping frames when its own queue backs up.