Show HN:一只被 vibecode 气味吸引的桌面苍蝇
Show HN: A desktop fly drawn to the scent of vibecode

原始链接: https://github.com/kulikov0/desktop-vibe-fly

这是一个适用于 macOS 的 3D 桌面伴侣,其核心是一只由 1kHz 实时脉冲神经网络驱动的果蝇。该项目基于 FlyWire 连接组(v783)构建,果蝇的大脑包含 23,210 个映射神经元,并由一个拥有 668 个神经元的功能性回路来决定其行为。 不同于预设脚本动画,果蝇的行为(如行走、梳理、睡眠或躲避光标)均由模拟神经元决定。它通过“振动码(vibecode)”感知环境,即通过项目标记(如 `.cursor/rules` 或 `.git` 文件)检测打开的项目和文件夹。它会对你的屏幕活动做出反应:光标移动会模拟迫近的威胁,窗口关闭会被视为物理干扰,打字则会触发感觉振动。 用户可以打开交互式 3D 大脑窗口,实时可视化神经脉冲,并通过点击特定神经元区域进行“光遗传学”刺激。这只果蝇拥有昼夜节律,会根据 Mac 的发热状态做出反应,并采用逼真的三脚步态行走。该应用专为 macOS 13+ 设计,无需特殊权限,运行在全透明且可穿透点击的覆盖层上,将你的桌面变成一场基于科学依据的人造生命实验。

“Show HN: 一只会闻着代码味儿飞的桌面苍蝇”是开发者 kulikov0 的一项创意项目。作为原版 *desktop-fly* 项目的衍生版本,这个更新版包含了一只会“嗅探”代码相关文件和窗口的电子苍蝇。 通过扫描屏幕上的代理标记(如 `.cursor/rules`、`AGENTS.md` 和 `CLAUDE.md`),这只苍蝇被设定为会向打开的 IDE、项目文件夹或与 AI 开发环境相关的桌面图标移动。该项目使用了一种基于“气味”的层级机制,活跃的项目比闲置的文件或文件夹散发出更浓烈的“气味”。 该帖子在 Hacker News 上引发了轻松愉快的讨论,用户们称赞了其充满创意的标题并对其运行机制(似乎涉及嵌入 Markdown 的图像)表示好奇,同时也有用户请求为非 macOS 用户提供演示视频。
相关文章

原文

DesktopFly — a 3D fruit fly

A 3D fruit fly that lives on your macOS desktop — driven by a live spiking simulation of the real FlyWire connectome. It walks across your windows, grooms, sleeps, and decides to flee your cursor with the same neurons a real fly uses.

Fork of DenisSergeevitch/desktop-fly — this one gives the fly a sense of smell for vibecode.

It scans your disk for agent markers (AGENTS.md, CLAUDE.md, .cursor/rules, .kiro/steering and ~40 more) and turns anything on screen that leads to them into an odour source: an editor or terminal window with the project open, a row in the front Finder window, a folder icon on the desktop. An open project smells strongest, a closed icon weakest, and the reach of each grows with how much vibecode it holds — a hub of six marked repos is smelled across the whole screen, a single weak folder only from nearby. The steering neurons then walk the fly there, and when the smell is far the population wakes up enough to make it fly.

Live brain window: 23,210 real neuron positions, spikes flashing

The fly's brain window: 23,210 real neuron soma positions from FlyWire v783, with live spikes flashing at real neuron locations. The two glowing yellow markers are the Giant Fibers — the escape command neurons. Click any region to stimulate it.

  • 23,210 neuron soma positions (of 139,255 in FlyWire v783) render the rotating brain window, colored by super-class (FlyWire's coarse cell-type grouping).
  • A 668-neuron circuit with ~19,000 real synaptic connections (synapse counts, signed by neurotransmitter prediction) runs as a 1 kHz leaky-integrate-and-fire (LIF) simulation:
    • LC4 (104) + LPLC2 (210) looming-detector visual neurons
    • DNp01 / Giant Fiber (GF) (2) — the escape command neuron
    • DNa01 + DNa02 (4) steering neurons · DNp09 (2) forward walking
    • DNg11 (6) grooming · MDN (4) backward walking ("moonwalker")
    • DNp02/DNp04/DNp11 (6) escape-maneuver (wing) neurons
    • their 330 strongest partners, including ascending (proprioceptive) and sensory (wind) neurons
  • Escape is not scripted. Your cursor's approach becomes looming input to the real LC4/LPLC2 cells; the fly takes off only when the Giant Fiber actually spikes through its real synapses — ~1,200 synapses of feedforward inhibition push back, which is why slow approaches are tolerated and fast lunges trigger escape in ~4 ms, just like the real animal.

The body itself is procedural (FlyWire is a brain connectome — no body geometry exists), with a tripod gait, visible wing-beat, altitude-scaled flight, grooming, and sleep postures.

Requirements: macOS 13+, Xcode Command Line Tools (Swift 5.9+). No permissions or entitlements needed — everything it senses (cursor, window frames, clicks-as-taps, thermal state) is permission-free.

git clone https://github.com/DenisSergeevitch/desktop-fly.git
cd desktop-fly
./build.sh
./DesktopFly

A 🪰 item appears in the menu bar; quit from there. The fly wanders your desktop on a transparent, click-through overlay — it never intercepts your mouse or keyboard.

item effect
Pause / Resume freeze the world
Show/Hide Brain toggle the live brain window
Escape Test (loom) inject a looming stimulus, watch the GF fire
Move to Next Display hop the fly across monitors (shown when >1 display)
Add / Remove Fly extra flies (only fly #1 carries the brain)
Scare Flies startle everyone

The brain window is interactive: hovering pauses the rotation; clicking a region "optogenetically" stimulates the ~60 nearest circuit neurons for 400 ms. The fly's reaction is whatever the real network does downstream — click the Giant Fiber and it escapes; click DNg11 and it grooms; click one side's DNa01/02 and it turns.

How real neurons drive the body

body behavior driven by
escape takeoff DNp01 giant fiber spike
walk vs. rest, walking speed DNp09 rate
steering DNa01+DNa02 left−right rate difference
grooming DNg11 rate
backward scoot MDN burst
nervous darting LC4/LPLC2 population rate
wing-beat effort, threat wing-raise DNp02/04/11 rate
spontaneous takeoff whole-population arousal

The loop also closes body→brain: the gait rhythm feeds the circuit's real ascending (proprioceptive) neurons in phase with the legs, and fast cursor motion stimulates its sensory (wind) partners.

Desktop ecology (all permission-free macOS senses)

  • Window terrain: window top edges are ledges — the fly lands on them, walks along them, rides a window you drag, and startles when one closes under its feet.
  • Window looms: a window appearing near the fly feeds the looming pathway; the circuit decides whether to flee your dialogs.
  • Clicks are substrate taps; clicking next to the fly startles it through the wind→GF pathway. Typing is vibration (idle-time API — knows when keys were pressed, never which).
  • Circadian rhythm: dawn/dusk activity peaks, midday siesta, night quiescence. Sleep: idle at night → it sleeps, breathing slowly, with raised arousal threshold; it grooms after waking.
  • Temperature: flies are ectotherms — a hot Mac is a faster fly.

data/ ships with compact derived files. To rebuild them from the raw FlyWire Codex dumps (~60 MB download):

mkdir -p /tmp/flywire && cd /tmp/flywire
B=https://storage.googleapis.com/flywire-data/codex/data/fafb/783
curl -O "$B/classification.csv.gz" -O "$B/coordinates.csv.gz" \
     -O "$B/connections.csv.gz" -O "$B/consolidated_cell_types.csv.gz"
cd - && python3 etl.py /tmp/flywire
./DesktopFly --simtest        # circuit invariants: GF silent at rest, 4 ms loom latency, ...
./DesktopFly --behaviortest   # 17 end-to-end checks: stimulate neurons -> body reacts
./DesktopFly --snapshot f.png  # offscreen fly render
./DesktopFly --brainshot b.png # offscreen brain render

What's modeled vs. measured

Honesty section: the connectome gives wiring, not physiology. The LIF dynamics, neurotransmitter signs (ACh+, GABA−, Glu−), the gap-junction boost on LC→GF and wind→GF (documented electrical coupling), synaptic delays, and the sensory transduction (cursor → looming value) are standard modeling choices layered on the real graph. Everything downstream of the sensory neurons — who connects to whom, and how strongly — is FlyWire data.

Code is MIT. The files in data/ are derived from FlyWire (FAFB v783) and are CC BY-NC 4.0 — see data/DATA_LICENSE.md. If you use this, cite:

联系我们 contact @ memedata.com