Skip to main content
NeckLink

Fruit-fly brain edge autonomy, in Python and zero-heap ANSI C99

Five open-source modules modelled on the adult Drosophila central nervous system, built for lossy radios, GPS-denied vehicles, micro-drones and low-cost microcontrollers.

Website PyPI necklink PyPI pynltp PyPI neckcompass PyPI necksight PyPI neckcord PyPI necksense License: MIT

Website · Products · Install · Repository layout · Development

The five NeckLink modules mapped onto the fruit-fly nervous system


Products

NeckLink is the brand; each product translates one subsystem of the fruit-fly nervous system into a standalone library. Every product has a Python package on PyPI and a zero-heap, zero-float ANSI C99 core for microcontrollers (hardware-tested on ESP32 and ESP8266EX; portable ANSI C99 for other targets), and each one is benchmarked against a strong classical baseline, including where the baseline still wins.

Product Fly circuit What it does Package
NLTP (v1.6.0) Cervical connective Loss-healing GF(2^8) Cauchy FEC file & priority-command transport with X25519 + PSK forward-secret ChaCha20-Poly1305 encryption, zero-dependency LZ4 compression, and a 4.76 KB MCU sensor profile over UDP (incl. 4G CGNAT traversal) or routerless ESP-NOW across ESP32 & ESP8266, in Python, C99, JS/TS (Node.js), Java 11+, and Arduino (248/248 cross-language checks + 100% SHA-256 @ 35% RF loss verified) pynltp
NeckCompass (v1.1.0) Central complex (E-PG / CPU4) Ring-attractor compass that rejects 70°–150° magnetometer spikes as well as a 3σ-gated EKF (0.44° vs 0.41° RMSE), re-anchors after a 90° heading upset where the gated EKF stays stuck, and homes without GNSS (324 B RAM in C99) neckcompass
NeckSight (v1.1.0) Optic lobe (T4/T5 + LPLC2) Glare-adapted motion detection and a four-quadrant looming reflex: 0.9988 AUROC on synthetic clutter vs 0.875 for compensated pyramidal Lucas-Kanade, gyro derotation so obstacles are still caught during fast turns, ~12,000 FPS at 32×32 in C99 (desktop) necksight
NeckCord (v1.1.0) Ventral nerve cord (BANC / MANC) 4-byte motor command frame, self-healing six-leg gait generator, and a fault-tolerant thruster allocator that isolates a failed thruster in ~42 ms (on par with pseudo-inverse + threshold FDI) and can return it to service (322 B in C99) neckcord
NeckSense (v1.1.0) Antennal lobe & mushroom body Concentration-invariant normalisation, multiplication-free FlyHash, one-shot novelty detection (0.994 AUROC in 4 KB) and one-shot classification, with Q16.16 C99 that is bit-identical to Python necksense

Each product's README has its full benchmarks, its API and a "when not to use it" section. Each benchmark compares against the strongest simple classical baseline we could build: a gated EKF, threshold FDI, baseline-corrected k-NN, or compensated pyramidal optical flow. Where that baseline ties or wins, the README says so.

November 2026 release notes (NLTP v1.6.0 + v1.1.0 organ suite):

  • NLTP 1.6.0 (pynltp, compression + MCU RAM & speed release): Adds zero-dependency standard LZ4 raw block compression (--compress / -z, 4.29× fewer wire bytes and 3.32× faster delivery on real telemetry under 25% tc netem loss with smart auto-bypass on incompressible payloads), a 4,760 B (4.65 KB) -DNLTP_TX_ONLY=1 C99/Arduino sensor RAM profile (15.0× smaller than ESP32 default) + 24.3 KB ESP8266 TX+RX profile, branchless 4×-unrolled GF(2^8) row-table coding (956 MB/s), and BDP clean-link inflight window capping (4.31× lower 64 KB warm clean-link latency: 0.224 s -> 0.052 s).
  • NLTP 1.5.0 (pynltp, forward secrecy & reflex parity): Upgrades encrypted 1-RTT HELLO / HELLO_ACK handshakes to ephemeral X25519 + PSK Perfect Forward Secrecy (96 B control frames, backward-compatible with 1.4.0 peers via 40 B legacy fallback), expands anti-replay protection to a 512-packet sliding bitmap (2.57× higher goodput under 10% packet reordering), and brings full confirmed out-of-band reflex retries to C99 & Arduino; see the NLTP security model.
  • Confirmed reflex lane, ESP-NOW mesh & Organ Suite 1.1.0 (neckcompass, necksight, neckcord, necksense): Live off-Wi-Fi ESP32 (~7 Mbps typical, 17.75 Mbps best) + cross-chip ESP8266EX (NodeMCU) 3-board mesh verification, alongside all four organ modules audited against strong classical baselines (NeckCompass sensor-noise re-anchoring, NeckSight gyro derotation + Python 3.9 support, NeckCord thruster recovery probing, and NeckSense 2%-sparse novelty codes).

Install

pip install --upgrade necklink
# or install individual modules:
pip install --upgrade pynltp neckcompass necksight neckcord necksense

Every package supports Python 3.9+ and depends only on NumPy (pynltp also uses cryptography). Each one's C99 core is self-contained inside csrc/ so you can copy it directly into firmware.

Run all five together

The necklink command ships with pynltp. With all five packages installed:

necklink products                  # List the installed NeckLink products and versions
necklink suite-demo --loss 0.15    # Closed-loop five-module reflex mission over encrypted, lossy UDP
from necklink import run_autonomous_reflex_demo

report = run_autonomous_reflex_demo(loss=0.15)
print(report)

Repository layout

necklink/
├── packages/
│   ├── nltp/          NLTP wire protocol (v1.6.0): Python, C99, JS/TS (Node.js), Java 11+, Arduino, ESP32/ESP8266
│   ├── neckcompass/   Central-complex compass and path integrator (v1.1.0)
│   ├── necksight/     Optic-lobe motion and looming reflex (v1.1.0)
│   ├── neckcord/      Ventral-nerve-cord motor codec and thruster allocator (v1.1.0)
│   └── necksense/     Antennal-lobe and mushroom-body odour engine (v1.1.0)
├── umbrella/          The `necklink` PyPI meta-package (v1.6.0) that installs all five
├── web/               Source of the website (deployed to the gh-pages branch)
└── assets/            NeckLink logo, brand banner and shared images

Every folder under packages/ is a self-contained project with its own pyproject.toml, tests, C99 core, benchmarks, README and licence, and is released to PyPI on its own. Python import names are import nltp, import neckcompass, import necksight, import neckcord, and import necksense.


Development

Work inside the package you are changing:

cd packages/neckcompass
pip install -e . pytest
python -m pytest                     # unit tests, plus every README example
make -C csrc clean all test          # zero-heap C99 core and its self-tests
python scripts/benchmark_neckcompass.py   # regenerates results/ and the chart (needs matplotlib)

CI (.github/workflows/packages-ci.yml) runs the following on Python 3.9 and 3.13 for NeckCompass, NeckCord, NeckSense, NeckSight and NLTP (including ASan/UBSan C99 + 4.76 KB NLTP_TX_ONLY checks, Node.js 20, Java 11+, and 248/248 4-language wire interop):

  • builds each package's wheel and installs it;
  • runs its CLI;
  • runs its tests, including the README examples;
  • builds the C core with -Werror and runs its self-tests.

NLTP also has JavaScript (packages/nltp/js), Java 11+ (packages/nltp/java) and ESP32/ESP8266 (packages/nltp/arduino, packages/nltp/esp32, packages/nltp/esp32_mesh) SDKs; see its README.

History

NeckCompass, NeckSight, NeckCord and NeckSense started in their own repositories and were merged here with their full commit history on 4 November 2026. The old repositories are archived and read-only.


License

Released under the MIT License. Copyright (c) 2026 Amandeep Singh Bains.

Metadata

Release files for necklink 1.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for necklink 1.6.0
File Size Uploaded Provenance Actions
necklink-1.6.0.tar.gz 7.6 kB Without provenance Details for necklink-1.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for necklink 1.6.0
File Interpreter ABI Platform Actions
necklink-1.6.0-py3-none-any.whl Python 3 none any Details for necklink-1.6.0-py3-none-any.whl

Total release size: 14.6 kB

Security for necklink 1.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page