Edge runtime for autonomous agents in the Cocapn fleet — generalized beyond maritime robotics for IoT, industrial, aerial, and marine domains.
33-opcode stack-based VM: 8-byte instructions, 32 registers (16 GP + 16 IO-mapped), 64KB memory, 1024-deep stack. Assembler, disassembler, bytecode validator. ESP32-S3 deployment + Jetson supervision.
Opcode table:
| Range | Group | Opcodes |
|---|---|---|
| 0x00–0x07 | Stack | NOP, PUSH_I8, PUSH_I16, PUSH_F32, POP, DUP, SWAP, ROT |
| 0x08–0x10 | Arithmetic | ADD_F, SUB_F, MUL_F, DIV_F, NEG_F, ABS_F, MIN_F, MAX_F, CLAMP_F |
| 0x11–0x15 | Compare | EQ_F, LT_F, GT_F, LTE_F, GTE_F |
| 0x16–0x19 | Logic | AND_B, OR_B, XOR_B, NOT_B |
| 0x1A–0x1C | I/O | READ_PIN, WRITE_PIN, READ_TIMER_MS |
| 0x1D–0x20 | Control | JUMP, JUMP_IF_FALSE, JUMP_IF_TRUE, HALT |
HALT (0x20) cleanly terminates execution by setting state.halted = True — no VMError raised. Programs without an explicit HALT still terminate safely via the PC-out-of-bounds check (max_cycles-bounded).
Multi-dimensional trust: history (EMA), capability, latency, consistency. Composite scoring with configurable weights. Autonomy levels L0-L5. Transitive trust propagation. Trust decay.
Length-prefixed framed protocol: [PREAMBLE:2B][SRC:1B][DST:1B][TYPE:1B][SEQ:2B][LEN:2B][PAYLOAD:N][CRC16:2B]. CRC-16/CCITT. Stream parser with partial buffering. 14 message types.
4-tier defense-in-depth:
- Tier 1 HARDWARE: Kill switch, watchdog IC (<1us)
- Tier 2 FIRMWARE: Stack canary, safe-state outputs (<1ms)
- Tier 3 SUPERVISORY: Heartbeat monitoring, state machine (<100ms)
- Tier 4 APPLICATION: Bytecode validation, trust-gated autonomy (<1s)
Component health monitoring with heartbeat timeouts and error-count tracking, fault classification into WARNING/MINOR/MAJOR/CRITICAL, and recovery-strategy selection (restart, backup switch, reduce load, safe mode, escalate). Includes graceful degradation assessment that maps fleet-wide health to capability levels.
NL intent → IR → bytecode pipeline. Parses action + target + value + condition. Supports: maintain, navigate, monitor (conditional), alert.
Task assignment with trust-aware scoring, capability matching, distance-weighted selection. Delegation with trust gates. Rendezvous planning (centroid). Formation planning (line, V, circle).
Bayesian sensor fusion with inverse-variance weighting. Trust-weighted consensus. Outlier detection (sigma threshold). Quality scoring. Data sharing with staleness filtering.
Real-time state mirroring with configurable history buffer. Forward predictive simulation (kinematics + power model). Anomaly detection with baseline learning (z-score). Battery life estimation.
Pose and Waypoint dataclasses with dead-reckoning position estimation, sequential waypoint following with per-waypoint arrival tolerance, desired heading/speed computation, and simple potential-field obstacle avoidance.
NL Intent → Intent Parser → IR → Bytecode → VM Execution
↓
Wire Protocol ←→ Agent Comms ←→ Trust Engine
↓
Safety System (4 tiers) ↔ Autonomy Levels (L0-L5)
↓
Fleet Coordination ←→ Cooperative Perception ←→ Digital Twin
Covers the same architectural patterns as nexus-runtime but generalized:
- Domain-agnostic (not just maritime)
- Integrated with Cocapn fleet protocol
- Designed for mask-locked inference chip offload
- Trust-aware autonomy gating throughout
src/mission/— mission planning, execution monitoring, contingencysrc/energy/— power management, solar/recharge, budget allocationsrc/maintenance/— predictive maintenance, diagnostic schedulingsrc/security/— byzantine fault detection, encryption, authsrc/learning/— reinforcement learning, skill acquisitionsrc/explainability/— XAI decision logging, audit trailsrc/sensor/— sensor health monitoring, calibration, fusionsrc/comms/— MQTT bridge, mesh networking, relay routingsrc/data_pipeline/— telemetry ingestion, compression, storagesrc/config/— runtime configuration, hot-reload, schema validationsrc/simulation/— physics simulation, Monte Carlo scenariossrc/swarm/— swarm behaviors, emergence detection, consensussrc/autonomy/— adaptive autonomy, self-healing, reflex overridesrc/hardware/— 11+ platform profiles (ESP32, Jetson, Pi, etc.)
Part of the Cocapn fleet. Siblings with a real conceptual overlap:
- Edge-Native — the specification repository; this runtime implements its opcodes, wire frames, and trust/safety model on the Jetson side.
- nexus-runtime — the companion runtime (compared above); shares the same architectural patterns.
- edge-relay-agent — cloud↔edge relay; models the asymmetric message flow this runtime consumes.
- marine-gpu-edge —
GPU-accelerated counterpart to this runtime's
perception/fusion.pysensor-fusion module. - edge-equipment-catalog — profiles the ESP32 / Jetson hardware this runtime deploys to.
MIT — DiGennaro et al. (SuperInstance & Lucineer)