Skip to content

SuperInstance/nexus-runtime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

66 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Tests License Python Boards Platforms Opcodes

NEXUS Runtime

LLM agents write the control code. A bytecode VM executes it. A trust engine decides if it's safe.


NEXUS is a distributed intelligence platform for industrial marine robotics where LLM agents β€” not humans β€” are the primary authors of control code. Agents synthesize intent into bytecode, which runs on a deterministic VM embedded on ESP32-S3 microcontrollers, while AI cognition and trust-based safety enforcement run on edge GPUs (Jetson Orin Nano).

The key insight: instead of hand-coding every control loop, NEXUS lets LLM agents express intent (e.g., "maintain 2m depth, avoid obstacles, surface if battery < 15%"), which is compiled into verified bytecode and executed with hardware-enforced safety guarantees.

Animated Pipeline

  Step 1         Step 2            Step 3              Step 4
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  INTENT   β”‚  β”‚   BYTECODE   β”‚  β”‚  SAFETY CHECK  β”‚  β”‚  EXECUTION   β”‚
β”‚           β”‚  β”‚              β”‚  β”‚                β”‚  β”‚              β”‚
β”‚ "Maintain β”‚  β”‚ LOAD_CONST   β”‚  β”‚ βœ“ Validator    β”‚  β”‚ ESP32-S3 VM  β”‚
β”‚  depth    │──│ READ_IO      │──│ βœ“ Watchdog     │──│  β”Œβ”€β” β”Œβ”€β”    β”‚
β”‚  at 2m"   β”‚  β”‚ CMP          β”‚  β”‚ βœ“ Trust gate   β”‚  β”‚  β”œβ”€β”€ β”œβ”€β”€    β”‚
β”‚           β”‚  β”‚ JNZ dive     β”‚  β”‚ βœ“ Kill switch  β”‚  β”‚  β””β”€β”˜ β””β”€β”˜    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
  LLM Agent     Reflex Compiler   4-Tier Safety     Real-time HW

Why NEXUS?

Problem NEXUS Answer
Hand-coded control loops don't scale across 50+ board types LLM-authored bytecode β€” write intent once, deploy everywhere
LLM-generated code is unreliable for safety-critical systems Deterministic VM β€” only 32 verified opcodes, no dynamic memory, cycle-exact
Multi-agent fleets need cooperation without a central controller INCREMENTS trust engine β€” mathematically grounded, multi-dimensional trust
Marine environments destroy electronics 4-tier safety architecture β€” hardware kill switch β†’ firmware ISR β†’ supervisory heartbeat β†’ application trust gate
Fleet heterogeneity makes coordination impossible 3-tier architecture β€” ESP32 for real-time, Jetson for cognition, Cloud for training

Architecture

╔══════════════════════════════════════════════════════════════════════╗
β•‘  Tier 3: CLOUD                                                       β•‘
β•‘  Heavy model training, fleet management, mission planning             β•‘
β•‘  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”             β•‘
β•‘  β”‚  Training    β”‚  β”‚  Fleet Mgmt  β”‚  β”‚  Digital Twin    β”‚             β•‘
β•‘  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜             β•‘
╠═════════β•ͺ════════════════β•ͺ════════════════════β•ͺ═════════════════════╣
β•‘  Tier 2: JETSON (Edge GPU)                                            β•‘
β•‘  AI inference, reflex synthesis, trust engine, swarm coordination      β•‘
β•‘  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β•‘
β•‘  β”‚ Vision   β”‚ β”‚ Trust Eng  β”‚ β”‚ Swarm    β”‚ β”‚ Reflex Compilerβ”‚         β•‘
β•‘  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β•‘
╠══════β•ͺ═════════════β•ͺ══════════════β•ͺ════════════════β•ͺ════════════════╣
β•‘  Tier 1: ESP32-S3 (Microcontroller)                                     β•‘
β•‘  Bytecode VM, real-time sensor/actuator control, safety enforcement    β•‘
β•‘  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β•‘
β•‘  β”‚ 32-op VM β”‚ β”‚ Wire Proto β”‚ β”‚ Safety   β”‚ β”‚ Sensor/Act DRV β”‚         β•‘
β•‘  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

Quick Start

# Install (editable mode)
cd /tmp/nexus-runtime
pip install -e .

# Verify installation
python -c "import nexus; print(f'NEXUS {nexus.__version__}')"

# Run all tests
python -m pytest --tb=short -q

# Hardware discovery (no hardware required)
python -c "from hardware import total_board_count, list_platforms; \
  print(f'{total_board_count()} boards across {len(list_platforms())} platforms')"

# Try an example
python examples/bytecode_playground.py

Supported Hardware (50+ Boards)

NEXUS ships with pre-configured deployment profiles for 11 platform families spanning microcontrollers, edge GPUs, and single-board computers:

Platform Boards Architecture
Arduino Uno, Mega, Nano, Due, MKR WiFi 1010, Nano 33 IoT ATmega328P / AT91SAM3X8E / SAMD21
ESP32 Classic, S3, C3, C6, H2 Xtensa LX6 / RISC-V
ESP8266 ESP-12E NodeMCU, Wemos D1 Mini Xtensa L106
NVIDIA Jetson Nano, TX2, Xavier NX, Orin Nano, Orin NX, AGX Orin ARM A57/A72 + Maxwell/Pascal/Volta/Ampere GPU
Raspberry Pi Zero W, 3B+, 4B, 400, 5, CM4, Pico 2 ARM Cortex-A53/A76 / RP2350
STM32 F4, F7, G0, L4, WL, H7, MP1 ARM Cortex-M0+/M4/M7/A7
Nordic nRF 52810, 52832, 52840, 5340 ARM Cortex-M4/M33 + BLE/Bluetooth Mesh
Teensy 3.6, 4.0, 4.1 NXP i.MX RT1062 / K66
i.MX RT 1050, 1060, 1064, 1170 ARM Cortex-M7 (600MHz-1GHz)
RP2040 Pico, Pico W ARM Cortex-M0+ + PIO
BeagleBone Black, AI-64 ARM Cortex-A8/A15 + DSP + PRU

Modules

Core Runtime (nexus/)

Module Description
nexus.vm 32-opcode bytecode VM with assembler, disassembler, and validator
nexus.trust INCREMENTS multi-dimensional trust engine
nexus.wire COBS/CRC-16 framed wire protocol
nexus.aab Autonomous Agent Behavior codec and roles
nexus.bridge Git-based bytecode deployment bridge
nexus.orchestrator Fleet orchestration and coordination

Jetson SDK (jetson/) β€” 38 Modules

Category Modules
Cognition vision, sensor_fusion, decision_engine, nl_commands
Cooperation swarm, fleet_coordination, cooperative_perception, trust
Autonomy adaptive_autonomy, self_healing, reflex, agent_runtime
Maritime maritime_domain, navigation, mission, compliance
Infrastructure energy, maintenance, security, performance, data_pipeline
Observability explainability (XAI), knowledge_graph, digital_twin, runtime_verification
Learning rl, learning, marketplace, mpc

Hardware (hardware/) β€” 11 Platform Families

Pre-configured deployment profiles with pin maps, clock configs, and peripheral drivers for all supported boards.

Firmware (firmware/)

ESP-IDF C project for ESP32-S3: VM interpreter, wire protocol, safety state machine, sensor/actuator drivers.

Opcode Reference

Core Opcodes (0x00-0x1F) β€” 32 opcodes

Range Category Opcodes
0x00-0x01 Control Flow NOP, LOAD_CONST
0x02-0x03 Memory LOAD_REG, STORE_REG
0x04-0x07 Arithmetic ADD, SUB, MUL, DIV
0x08-0x0D Bitwise AND, OR, XOR, NOT, SHL, SHR
0x0E Compare CMP
0x0F-0x13 Branch JMP, JZ, JNZ, CALL, RET
0x14-0x15 Stack PUSH, POP
0x16-0x17 I/O READ_IO, WRITE_IO
0x18-0x19 System HALT, SLEEP
0x1A-0x1B Comms SEND, RECV
0x1C-0x1F Memory Mgmt ALLOC, FREE, DMA_COPY, INTERRUPT

A2A Opcodes (0x20-0x56) β€” 29 opcodes (NOP on ESP32)

Agent-to-agent opcodes for intent broadcasting, capability negotiation, safety augmentation, and cooperative perception fusion. These opcodes are interpreted at the Jetson tier; on ESP32 they execute as NOPs.

Safety Architecture

Safety is non-negotiable. NEXUS implements a four-tier defense-in-depth model:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  TIER 1: HARDWARE                                           β”‚
β”‚  Kill switch β€’ Watchdog IC β€’ Polyfuses β€’ Power rails        β”‚
β”‚  Response time: <1us                                        β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  TIER 2: FIRMWARE (ESP32-S3)                                β”‚
β”‚  ISR guard β€’ Safe-state outputs β€’ Stack canary              β”‚
β”‚  Response time: <1ms                                        β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  TIER 3: SUPERVISORY (Jetson)                               β”‚
β”‚  Heartbeat monitoring β€’ State machine β€’ Watchdog daemon     β”‚
β”‚  Response time: <100ms                                      β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  TIER 4: APPLICATION                                        β”‚
β”‚  Trust-score-gated autonomy (L0-L5) β€’ Bytecode validation   β”‚
β”‚  Response time: <1s                                         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
  • L0 β€” Manual control only, all automation disabled
  • L1 β€” Assisted mode, human approves every action
  • L2 β€” Supervised autonomy, human can veto
  • L3 β€” Conditional autonomy, trust-score-gated
  • L4 β€” High autonomy, fleet cooperation enabled
  • L5 β€” Full autonomy, emergency-only human intervention

Examples

Example Description
examples/bytecode_playground.py Assemble and execute bytecode in the VM emulator
examples/trust_scenario.py INCREMENTS trust between 5 AUV agents
examples/flocking_simulation.py 10-agent Reynolds flocking simulation
examples/hardware_discovery.py Explore the hardware catalog

Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines. All contributions are subject to our Code of Conduct. For security concerns, see SECURITY.md.

License

MIT β€” Copyright (c) 2025 NEXUS Project

About

No description, website, or topics provided.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors