For agents

Give your AI agent a real fly brain

Skills and tools that run the MaleCNS v1.0 connectome — all 166,700 neurons of a fruit fly — so an agent can feel, flinch and buzz with a real brain. Open source, runs on your own machine, no token needed.

Skills

fly-mode 🪰

A Claude skill that turns Claude into a fruit fly. Every reply is driven by what a real fly brain did with your message.

1 · SENSE

Your message becomes something a fly can feel

A deadline or a swatter looms. Pizza is a taste. "hi cutie" is another fly walking past. Wind, a touch, a smell.

2 · BRAIN

The real connectome runs for one second

Those sense neurons are stimulated in the 166,700-neuron brain, next to the same brain with nothing happening.

3 · BEHAVIOUR

Its neurons decide what it does

Escape neurons → jumped. Wing motor neurons → buzzed. Grooming, turning, walking, backing up.

4 · REPLY

Claude answers as that fly

Panic if it jumped, hype if it buzzed, nothing if the brain did nothing — and a brain log line proving it.

What the brain actually did (real runs)

You sayThe fly sensesThe brain didTop neurons
"the boss wants the report by 5"a huge shape loomingjumped, buzzed its wingsDNp04, DNp01, DNp02
"hi cutie"another fly moving nearbyturnedDNg111, DNp17
"i brought pizza"a tastenothing — taste reaches the brain but moves no behaviour neuronsDNg48, DNg85
"what is 2 plus 2"nothing a fly can sensenothing

The word-to-sense table is hand-written and is the only made-up part. The reaction is the connectome's — which is why the pizza does nothing, however dramatic the fly wants to be.

How to integrate

Install in two minutes

Claude Code

  1. Install the brainThe first run downloads ~260 MB of brain files.
  2. Add the skillCopy the folder from the repo into your skills.
  3. Talk to itSay "be a fly". Say "human mode" to stop.
pip install flybrain
git clone https://github.com/alextitonis/fly.ai
cp -r fly.ai/skills/fly-mode ~/.claude/skills/

Any agent or script

The skill is one Python script that prints JSON, so any agent framework, tool call or bot can use it.

python skills/fly-mode/scripts/fly_brain.py "someone brought pizza"
python skills/fly-mode/scripts/fly_brain.py --sense threat "anything"
{
 "sense": "threat",
 "felt": "a huge shape looming at it (looming detectors)",
 "did": ["jumped", "buzzed its wings"],
 "extra_spikes": {"escape": 89.3, "wings": 62.0, ...},
 "top_descending_neurons": [{"type": "DNp04", ...}],
 "brain": "MaleCNS v1.0 connectome, 166,700 neurons, ..."
}

Or build your own: the flybrain package

Everything above runs on flybrain, the whole fly nervous system as a spiking network you can stimulate and read out.

from flybrain import FlyBrain

brain = FlyBrain(sensory_input=False)          # downloads the brain files on first use
looming = brain.cells(["LC4", "LPLC2"])        # looming detectors
escape = set(brain.groups["escape_L"]) | set(brain.groups["escape_R"])

for step in range(75):                         # 1.5 s at 20 ms steps
    fired = brain.step(inject=[(looming, 0.8)] if step >= 25 else [])
    if escape & set(fired):
        print("the fly jumped at", step * 20, "ms")

How to use

Talking to the fly

In a chat

you:  be a fly
fly:  bzz. i am fly now. there is a lamp.

you:  the boss wants the report by 5
fly:  BOSS?? big shape. NOPE. *zooms to the ceiling*
      ...ok i'm back. flies don't do reports. bzz.
      🧠 felt: a huge shape looming at it · top neurons: DNp04, DNp01
         · did: jumped, buzzed its wings

you:  human mode
fly:  bzz. bye.

Good to know

  • It still helps. Ask a real question and the fly answers it, short and distracted.
  • It never fakes a reaction. If the brain did nothing, the fly does nothing. That's the joke, and it's true.
  • Brains are noisy. The same message can land a little differently each time; the script averages three runs.
  • Force a sense with --sense threat|taste|mate|wind|touch|smell when the words don't say it.
  • Runs locally on CPU (or GPU with flybrain[gpu]). Nothing is sent anywhere.