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 pynltp PyPI neckcompass PyPI necksight PyPI neckcord NeckSense v1.1.0 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.4.0) Cervical connective Loss-healing GF(2^8) Cauchy FEC file & priority-command transport with ChaCha20-Poly1305 per-session encryption over UDP (incl. 4G CGNAT traversal) or routerless ESP-NOW across ESP32 & ESP8266, in Python, C99, JS/TS (Node.js), Java 11+, and Arduino (216/216 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 packages/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.3.2 + v1.1.0 organ suite):

  • Live on PyPI (pynltp 1.3.2, neckcompass 1.1.0, necksight 1.1.0, neckcord 1.1.0):
    • NLTP 1.3.2 (pynltp): Confirmed priority reflex lane (PT_REFLEX_ACK), C/ESP mid-stream anti-stall takeover guard, hardened multi-peer ESP-NOW hub (pre-auth slot gate + LRU 20-peer table), and live off-Wi-Fi ESP32 (encrypted, ~7 Mbps typical, 17.75 Mbps best) + cross-chip ESP8266EX (NodeMCU) 3-board mesh verification.
    • Organ Suite 1.1.0 (neckcompass, necksight, neckcord, necksense): Audited against strong classical baselines, with real sensor-noise re-anchoring and drift fixes in NeckCompass, gyro derotation + Python 3.9 compatibility in NeckSight, thruster recovery probing in NeckCord, and sparser novelty codes in NeckSense.
  • necksense 1.1.0 and the necklink umbrella installer are pending PyPI's new-project creation quota reset; install necksense directly from this repository as shown below.
  • NLTP 1.4.0 (this repository, not yet on PyPI) is a security release: encrypted sessions now use per-session keys from a 1-RTT handshake, which fixes accepting recorded traffic after a restart and nonce reuse between sessions. Encrypted 1.4 and 1.3.x devices do not interoperate, so upgrade them together; see the NLTP security model.

Install

pip install --upgrade pynltp neckcompass necksight neckcord
pip install "git+https://github.com/indian-aman/necklink.git#subdirectory=packages/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.4.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.4.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 and NeckSight:

  • 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.4.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.4.0
File Size Uploaded Provenance Actions
necklink-1.4.0.tar.gz 7.2 kB Without provenance Details for necklink-1.4.0.tar.gz

Built distribution (wheel)

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

Total release size: 13.9 kB

Security for necklink 1.4.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