Inspiration In 2024 the FlyWire consortium published the complete wiring diagram of an adult fruit fly brain: about 139,000 neurons, every one of them traced. Researchers showed that a simple spiking model running on that wiring reproduces real fly behaviour. We wondered what it would feel like if that brain were the one telling you a story, and whether it would be frightening.
What it does Fly in a Jar is a browser-playable text horror game in English and Chinese. It is midnight at a neuro-imaging institute that sliced one fly brain into 7,000 sections and rebuilt it. The power is out, the doors are locked, and something in the building is thinking with that brain.
You type free-text actions into a retro terminal. Each turn: • A decision model (Gemini Decision 1) judges only whether your action is possible. It returns typed answers (probability, reason, category, target, danger) and never writes prose. • Your action becomes a stimulus to real, named neuron groups in the FlyWire v783 connectome, and a leaky integrate-and-fire simulation runs. • The spikes decide what happens next: whether the swarm approaches, which anomaly appears, when a clue surfaces. The text is assembled from a hand-written bilingual fragment library. No language model writes story text at runtime. • A brain log shows which cell types were stimulated and how many spikes each readout group fired, so you can watch the story come out of neural activity.
Synaptic Sync replaces sanity and runs the other way: failures, strong anomalies and swarm attacks push it up. At high sync, last turn's spikes can hijack your action with a fly instinct. There are four endings: escaped, consumed, absorbed (hidden) and disconnected.
Why Frankenstein Three parts that were never meant to meet: a neuroscience dataset, a typed AI judge that cannot write, and a hand-written horror script. The fly brain is the storyteller, Gemini is the referee, and the fragments are the stitches.
How we built it Python, FastAPI and numpy on the backend, with a plain HTML/CSS/JS terminal on the front. The connectome is preprocessed into a compact sparse matrix, and the LIF model follows Shiu et al. (2024). The server is stateless: the game state lives in the browser and is sent with every turn. Runs are reproducible, because the Poisson seed is derived from the game seed and turn number, and fragments are picked by spike count rather than random(). The judge can fail safely: if it times out, the state stays unchanged. The live build runs on an Instabox cloud sandbox.
Challenges Getting a fly brain to react meaningfully to a human's typed actions. Absolute spike counts were too noisy, so we compare each turn against a per-room baseline and use thresholds on specific groups (for example the giant fibre neurons for the swarm's approach). We also switched decision models several times along the way because of quota and pricing, so the judge sits behind one interface and can be swapped with a single setting.
Accomplishments A full playable loop where the horror is genuinely driven by connectome activity and you can see it in the brain log. 159 automated tests, a content validator that refuses to start the server if any fragment is broken, and a fragment library that meets its coverage targets in both languages.
What we learned Spec-first development pays off for a project with this many moving parts. Writing the requirements, design and task list before any code gave every later change, including changes made by a different agent, a clear contract to check against.
What's next A branch where the decision model still rules on what is possible while a language model writes the consequences, so we can compare the two approaches.