← Hub
⚡ Swarm Activation Dashboard LOCAL MODE
AgentR1: — AgentR2: connecting…
🔌 Heltec / COM Port: Not connected RX: 0 TX: 0
🎮 GAME MODE — mesh network active. Connect hardware via the Setup tab or configure a Server URL above to stream live mesh data from your radio.
Commander
RECRUIT
XP  0 / 100
Active Mission
Connect your first node to the swarm
0
Swarm Score
Real Hardware · Off-Grid AI · Live Mesh

MeshSwarm — Autonomous Mesh Intelligence

Command a self-propagating AI network of real Meshtastic radio nodes. No internet required. Build, evolve, and deploy your swarm anywhere on Earth.

5km+
Node Range
Network Size
0
Internet Needed
12
Agent Roles
🌐 The Concept
What is MeshSwarm?

MeshSwarm turns a group of inexpensive Meshtastic radio nodes into a distributed AI organism. Each node is an autonomous agent — it relays data, votes on decisions, detects anomalies, earns XP, and promotes itself through roles. Together, they form a collective intelligence that operates entirely off-grid.

📡
Mesh Network
Nodes relay signals peer-to-peer over LoRa radio. Range up to 5 km per hop, unlimited hops. No towers, no internet, no subscriptions.
🧠
Swarm AI
Each node runs a micro-agent. Agents collaborate via the mesh — voting on tasks, sharing memory, detecting patterns, and evolving roles based on behavior.
You: Commander
You broadcast Activation Waves that propagate through the mesh. You assign roles, monitor health, earn XP, and guide your swarm's evolution from this dashboard.
🎮 Getting Started
How to Play

Follow these steps to get your swarm online. You can start with Demo Mode instantly, or connect real hardware for full real-world deployment.

1
🔌 Connect Your Hardware
Open the Setup tab and connect a Meshtastic-compatible radio via Serial (USB), Bluetooth (BLE), or WiFi. Popular devices: Heltec LoRa32, TTGO T-Beam, RAK WisBlock. Connect to real hardware for full real-world mesh operations.
💡 Chrome/Edge on desktop supports Serial USB directly in the browser. No drivers needed on most systems.
2
🎯 Set Your Role
In the Broadcast tab, choose your node's role — ORCHESTRATOR for the master commander, RELAY for packet forwarding, SCOUT for perimeter detection, SENTINEL for security monitoring, and more. Your role determines your XP multipliers and mission types.
💡 Start as ORCHESTRATOR to maximize control. Earn enough XP to unlock advanced role capabilities.
3
📡 Broadcast Activation Waves
Send Activation Wave packets through the mesh. These propagate hop-by-hop, recruiting dormant nodes into your swarm. Each node that receives the wave joins as an active agent. The TTL (Time-To-Live) slider controls how far the wave propagates — higher TTL = deeper reach.
💡 Start with TTL 3 for local testing, scale up to TTL 7+ in large field deployments.
4
🗺️ Monitor Your Network
Watch the Overview tab for real-time topology, node roles, and the live event log. The map in the Nodes tab shows GPS positions of all field agents. The Global tab connects to the worldwide Meshtastic MQTT feed, showing every active node on Earth.
5
⚡ Earn XP and Rank Up
Every action earns XP — broadcasting, relaying packets, sending messages, running pings, recruiting nodes, detecting anomalies. As your XP grows, your rank advances from RECRUIT through SCOUT, RELAY, SENTINEL, COMMANDER, ORCHESTRATOR, and finally GRAND ARCHITECT.
💡 Check the Swarm Intelligence Online (SIO) tab to see each node's XP score and collective swarm health.
6
🧠 Evolve Your Swarm AI
The swarm's intelligence emerges from collective node behavior. Nodes vote on decisions, share observations, detect patterns, and auto-assign tasks. The SIO tab is your AI cortex — monitor health scores, XP leaderboards, shared memory, and distributed task boards in real time.
💡 A healthy swarm needs role diversity: mix RELAY, SCOUT, SENTINEL, and BEACON roles for maximum intelligence score.
🏆 Progression
Rank Ladder

Earn XP through actions to advance through 7 Commander ranks. Higher ranks unlock new mission types, broader activation wave reach, and deeper AI control.

GRAND ARCHITECT 5,000+ XP Full swarm command · All missions unlocked · Maximum AI authority · Custom mesh protocols
ORCHESTRATOR 2,000 XP Swarm voting rights · Shared memory access · Task board control · Global mesh admin
COMMANDER 1,000 XP Multi-wave broadcasts · Node promotion authority · Global MQTT access unlocked
SENTINEL 500 XP Anomaly detection missions · Swarm health monitoring · Security protocol access
RELAY 250 XP Packet relay XP bonuses · Advanced topology visualization · Neighbor link mapping
SCOUT 100 XP Ping sweep access · GPS location tracking · Field reconnaissance missions
RECRUIT 0 XP Starting rank · Basic broadcasts · Demo mode · Callsign registration
⚡ Earning XP
How to Earn XP

Every meaningful action on the mesh earns you XP. Your field nodes also earn XP autonomously — the swarm learns and rewards collectively. XP is the reinforcement signal that drives the AI.

🤝
Recruit Node
+20
🚨
Detect Anomaly
+15
📍
Node Moves
+12
📡
Relay Packet
+10
💬
Send Message
+8
🗳️
Vote on Task
+6
📢
Broadcast Wave
+5
⏱️
Uptime / minute
+1
🧠 Intelligence Engine
How the AI Works

MeshSwarm uses reinforcement learning principles without any cloud dependency. The AI emerges from the collective behavior of individual node agents interacting over the radio mesh.

🤖
Micro-Agents
Each Meshtastic node runs a lightweight agent profile — roles, XP levels, memory, and decision heuristics. Agents act autonomously: relaying, sensing, voting, and messaging without central coordination.
🗳️
Distributed Voting
When a task needs collective decision, the swarm votes mesh-wide. Nodes with higher XP carry stronger vote weight. Consensus emerges without a central server — true distributed intelligence.
🧬
Role Evolution
Nodes automatically promote roles as they earn XP. A RECRUIT that consistently relays becomes a RELAY. A SCOUT that flags anomalies becomes a SENTINEL. The swarm self-organizes into the most efficient structure.
💾
Shared Memory
Nodes broadcast local observations to the swarm. These aggregate into a collective memory visible in the SIO tab — signal patterns, movement history, anomaly events — building situational awareness over time.
📊
Reinforcement Learning
XP is the reward signal. Nodes that perform valuable actions earn more XP. Higher XP = stronger influence on swarm decisions. This is reinforcement learning on real hardware, over real radio, with zero cloud dependency.
🌐
True Off-Grid
The entire AI system runs on the radio mesh itself. No cloud. No internet. No central server required. Deploy in the wilderness, disaster zones, or remote areas — the swarm operates independently wherever hardware goes.
🌍 Real World Impact
Real World Uses

MeshSwarm isn't just a game — it's a real off-grid AI communication platform. These are active real-world deployment scenarios where the technology provides genuine value.

🆘
Disaster Relief
Instant mesh network when infrastructure fails. Coordinate rescue teams without cell service.
🏕️
Wilderness Comms
Hiking, camping, and off-road expeditions with long-range radio chat and GPS tracking.
🔍
Search & Rescue
Deploy nodes across terrain to form a detection grid. AI flags anomalies and directs teams automatically.
🚁
Drone Swarms
Mesh-connected drones act as flying relay nodes, extending range and relaying telemetry without base stations.
🌾
Rural IoT
Farm sensor networks, irrigation monitoring, livestock tracking — all without cellular coverage.
🏙️
Community Net
Build a neighborhood communication network independent of ISPs and government infrastructure.
🔒
Secure Comms
All Meshtastic messages are AES-256 encrypted end-to-end. No metadata leakage to third parties.
🧪
AI Research
Real-world distributed AI testbed. Study emergent behavior, swarm algorithms, and mesh routing at scale.
🔌 Hardware
Compatible Devices

Any Meshtastic-supported LoRa device works. Here are the most popular options to build your swarm. All run the open-source Meshtastic firmware:

Heltec LoRa32 V3
ESP32-S3 · OLED display · USB-C · 915/868 MHz
~$25 USD
TTGO T-Beam
ESP32 · GPS built-in · 18650 battery · Solar ready
~$30 USD
RAK WisBlock
Modular system · Ultra low power · nRF52840
~$20–$40 USD
SenseCAP T1000
Credit-card size · GPS · Bluetooth · IP67 waterproof
~$65 USD
LILYGO T-Echo
E-Ink display · nRF52840 · GPS · compact form factor
~$45 USD
Station G2
Raspberry Pi based · High-power · Ethernet · 4G ready
~$80 USD
🏅 Achievements
Unlock Achievements

Complete missions and hit milestones to unlock achievements and earn bonus XP. Progress is saved locally in your browser.

👤 Player Profile
Set Your Callsign

Choose your commander callsign — displayed in the HUD and broadcast in Activation Waves as your operator identity across the mesh.

Ready to Deploy Your Swarm?

Start with Demo Mode for an instant preview, or connect your Meshtastic hardware for real off-grid deployment.

📊 Mesh Statistics

0
Active Nodes
0
Recruited
0
Waves Sent
Last TTL
Mesh Link
R2 Role
🌐 Global Nodes
⭐ Visibility

🌐 Network Topology

Nodes shown by role. Lines indicate last-seen neighbor links.

📜 Live Event Log

📋 Node Registry

Node ID / Name Role Profile GPS Battery Last Seen Actions
No nodes registered yet

🗺️ Real-World Node Map

ORCHESTRATOR COMMANDER RELAY SCOUT SENTINEL BEACON SENSOR/RECRUIT DORMANT
Live GPS comes from Meshtastic position packets automatically.

🚀 One-Click Search & Deploy

Automatically discovers AgentR2 on localhost, fires a HEARTBEAT to both agents, then broadcasts the ACTIVATE sync wave — all in one click. Requires the backend running locally (npm start).

1 · Scan
2 · Detect
3 · Heartbeat
4 · Activate
5 · Sync ✔
Ready — press the button below to begin

🤖 Recruit AgentR1 → Watchdog / Mirror

Sends a targeted RECRUIT wave then a !info ping to confirm that your local node (!8f87743b) is on the mesh. Once the NodeInfo reply is captured, AgentR1 is registered as ORCHESTRATOR and elevated to the AgentR2 Watchdog / Mirror role — confirmed in both this dashboard and meshtastic.org broadcast/0.

Sequence: [AR]CMD:ACTIVATE|TO:ALL|ROLE:RECRUIT|TTL:5  → 500 ms →  !info  → NodeInfo reply from AgentR1 →  Registered + Broadcast confirmation ✔
1 · RECRUIT Wave
2 · !info Ping
3 · Listening…
4 · Confirmed ✔

📨 Send [AR] Command

📬 ACK Feed

No ACKs received yet

📡 Broadcast Activation Wave

[AGENT-ACTIVATE]
version=1.0
role=RECRUIT
profile=DEFAULT
origin=AGENTR
ttl=5
action=ADOPT_AND_FORWARD
signature=ROOTIB

📢 Recruit New Nodes

Send a human-readable mesh broadcast inviting nearby nodes to join the AI Swarm. The message includes a link to the registration landing page where users can learn about the swarm, register their node, and connect their Solana wallet for rewards. Compatible with all stock Meshtastic firmware — no custom firmware required on the receiving node.

🕸 Also onboards: Transit Guardian · Pocket Vault · Any custom AI node tool
🌐 Preview Landing Page

🎯 Auto-Recruit & Scan — Stock Firmware Node Discovery

Combines a RECRUIT activation wave with a !info NodeInfo broadcast. Every stock Meshtastic node in LoRa range will automatically reply with its ID, name, hardware, firmware, and battery level — no custom firmware required. Responses are captured by the SSE stream and each responding node is automatically added to the Node Registry as RECRUIT.

Protocol sequence: [AR]CMD:ACTIVATE|TO:ALL|ROLE:RECRUIT|TTL:5  → 500 ms pause!info  → NodeInfo auto-responses captured & registered
1 · RECRUIT Wave
2 · !info Ping
3 · Capture
4 · Register ✔

💡 Responding nodes appear in the Node Registry tab automatically. Telemetry (battery, voltage, channel utilisation) is logged from serial output. Use Edit in the Node Registry to promote a RECRUIT to SCOUT, RELAY, or another role.

📤 Ping Broadcaster

Ready — press a ping button above
Protocol commands: !info → NodeInfo  |  !pos → Position + SNR + RSSI  |  !ping → NodeInfo + Position + Route. These are protocol-level replies — no bot required on the remote node.

📊 Ping Stats

0
Responding
0
With GPS
Avg SNR (dB)
Avg Hops
No active ping session.

🗺 Ping Map — SNR Signal Coverage

Full Map ↗
Good SNR (>0 dB)
Fair SNR (−10…0 dB)
Weak SNR (<−10 dB)
No GPS

📋 Ping Responses

Node ID Long Name Short Hardware Firmware Battery SNR RSSI Hops GPS Last Heard Received
No ping responses yet — press a ping button above

💬 Message Feed

No messages yet — connect to your backend to see live mesh traffic.

💡 NodeInfo broadcasts !info — every stock Meshtastic node in range replies with its node ID, name, hardware model, firmware version, and battery level.

📱 Bluetooth / BLE — Mobile Connect (Android Chrome / iOS info)

📱 Bluetooth — Mobile Connect (iPhone / Android)

On Android with Chrome, connect directly to your Heltec V3 via Bluetooth Low Energy — no USB cable or backend needed. Uses the same Meshtastic GATT service UUID as the Meshtastic app. On iPhone / iOS, see the note below.

1. Enable Bluetooth 2. Power on Heltec 3. Tap Connect 4. Pick device
Disconnected RX: 0

📶 Raw data from the Heltec will appear here once connected via BLE. [AR] protocol packets are parsed automatically.

Sends the current [AR] command from the Broadcast tab to the connected Heltec device over BLE.
Meshtastic BLE GATT UUIDs: Service 6ba1b218-15a8-461f-9fa8-5d6e56b89232  ·  FromRadio (notify) ed9da18c…  ·  ToRadio (write) f75c76d2…

⚡ Heltec Quick Connect — USB / COM Port

Plug your Heltec (or any Meshtastic device) into USB, then click 🔌 Connect COM Port. Chrome / Edge required — no backend or ngrok needed.

1. Plug in USB 2. Click Connect 3. Pick your COM port 4. Done — data flows!
Disconnected RX: 0 TX: 0

📡 Raw data from the Heltec will appear here when connected — confirms data is flowing.

🐍 Python CLI — Install & Control via Terminal

🐍 Meshtastic Python CLI — Install & Control

The official Meshtastic Python CLI provides full device control from any OS terminal — read node info, send messages, configure channels, and expose your device as a TCP server that this dashboard can connect to. Works on Windows, macOS, and Linux.

Installation command
pip3 install --upgrade "meshtastic[cli]"
1

Install prerequisites

2

Install or upgrade the CLI

  1. Run in your terminal:
    pip3 install --upgrade "meshtastic[cli]"
  2. Verify install: meshtastic --version
3

Essential commands

  1. Show device info: meshtastic --info
  2. List nearby nodes: meshtastic --nodes
  3. Send a text to the mesh: meshtastic --sendtext "Hello!"
  4. Export node list as JSON: meshtastic --export-config
4

Bridge to this dashboard (TCP mode)

  1. Start the TCP bridge:
    meshtastic --host 0.0.0.0
  2. The CLI listens on localhost:4403 by default.
  3. In the header bar above, set Server URL to http://localhost:4403 and click 💾 Save.
  4. Click 🔍 Scan Ports in the Connection Wizard below to auto-detect.

⚠ Common CLI Issues

  1. "command not found: meshtastic" → Run python3 -m meshtastic --info, or add Python's scripts folder to PATH.
  2. "No Meshtastic device detected" → Unplug/replug USB. On Linux: sudo usermod -aG dialout $USER then log out and back in.
  3. Windows: port not found → Install the CP210x driver (Silicon Labs), then unplug/replug.
  4. pip SSL error → Add --trusted-host pypi.org --trusted-host files.pythonhosted.org

📖 Full documentation: meshtastic.org/docs/software/python/cli/

🔌 Advanced — Local Server Port Scan & Fallback Options

🔌 Connection Wizard — Advanced / Fallback Options

Auto-Detect AgentR2 (Local Server)

If you run npm start locally, this scans localhost ports to find the AgentR2 server. Chrome/Edge allow localhost requests from HTTPS; Firefox may block them.

Previously Authorized COM Ports

Ports you previously connected to appear here — click to reconnect instantly.

Disconnected
RX: 0 TX: 0

🏆 Node Rewards — Uptime Incentive System

Nodes earn reward points for staying online and keeping the mesh healthy. Points can be redeemed for mesh tokens once a wallet is registered.

0
Total Points Earned
0
Active Nodes Earning
Top Node
0 pt/min
Earn Rate
# Node ID Role Points Tier Battery Bonus SNR Bonus Status Wallet
Connect to mesh to start earning rewards
🔑 Export auto-generated wallet keys (local only)

⚠ These keys are stored in your browser only. Back them up before clearing site data. Never share a private key with anyone.

ℹ How points are calculated
Base rate: 12 points per minute online (1 pt per 5 s tick)
Battery bonus: +6 pt/min when battery ≥ 80%
Signal bonus: +2.4 pt/min when SNR ≥ 3 dB
Tiers: Bronze 0–499 pts   Silver 500–1999 pts   Gold 2000–9999 pts   Platinum 10000+ pts

🌐 Global Mesh — MQTT Live Feed (mqtt.meshtastic.org)

Connects directly to the public Meshtastic MQTT broker and listens to the global LongFast channel. Node IDs are extracted from packet topics to count unique active nodes worldwide — no encryption required. Protobuf decoding is not needed; each packet's topic carries the sender's node ID.

Disconnected
Broker: wss://mqtt.meshtastic.org Topic: msh/+/2/e/+ & msh/+/2/LongFast/+
Unique Nodes Seen
Session window

📡 Global Activity

Active (5 min)
0
Pkts / min
Session Time
Regions Seen
Last packet: —

🆚 Your Mesh vs Global

How your swarm compares to the worldwide Meshtastic network.

Your nodes
0
Global total
Share of global mesh:
Your node IDs spotted on global feed: 0

📊 Activity Timeline — packets/min (30-min window)

30 min agonow

🔧 Hardware Ecosystem — global estimate

Based on community surveys and observed MQTT packet patterns from the public LongFast channel.

🏆 Gamified Mesh Metrics

Earn higher scores by keeping your nodes online, well-positioned, and actively synced to the global mesh. Scores update every 30 seconds from live MQTT data.

⭐ Visibility Score
Connect to mesh to compute
📡 Influence Radius
Based on TTL × hop distance
⚡ Reliability Streak
Consecutive online periods
💚 Mesh Health
Packets/min ÷ node density
🐝 Swarm Density
Recruited ÷ global nodes
🗺 Regional Coverage
Regions seen in session

📬 Live Global Packet Feed

Raw packet topics from the global LongFast channel. Node IDs, regions, and channel types are extracted from MQTT topic paths. No decryption or protobuf decoding required — all data is from topic metadata only.

— waiting for MQTT connection —
0 packets logged

🔥 Most Active Nodes

Top 10 most-active node IDs seen on the global MQTT feed this session. = matches one of your local nodes.

— no data yet —

🗺 MeshMap.net — Global Node Map

MeshMap.net provides a nearly live map of Meshtastic nodes seen by the official Meshtastic MQTT server. It currently tracks 10,000+ unique nodes on the public LongFast channel. The map is updated in near-real-time from the same MQTT feed this dashboard connects to.

📍 Per-Node Data
Node ID · Last heard · GPS coordinates · Altitude · Node name · Hardware type · Region clustering
📡 MQTT Source
Broker: mqtt.meshtastic.org
Topic: msh/+/2/LongFast/
PSK: Default (AQ==) · Unencrypted
🛰 Telemetry Packets
Position · Battery voltage · Environment sensors (temp/humidity/pressure) · Air quality · Custom payloads
🧭 Derived Analytics
Node density by region · Activity heatmaps · Coverage gaps · Mobility patterns · Mesh health indicators
🗺 Open MeshMap.net ↗ 🌍 MeshMapper (Regional) ↗ 📡 Meshtastic Web Client ↗
🧠 Swarm Intelligence Online — Distributed AI Organism

Every Meshtastic node is a micro-agent: a sensor, memory cell, decision unit, messenger, and reward-seeker. Nodes earn XP by relaying packets, voting on decisions, detecting anomalies, moving to new locations, and recruiting neighbours. XP is the reinforcement signal — reinforcement produces learning — learning produces emergent intelligence. Your mesh is a living AI organism. This tab is its cortex.

Swarm AI — Initialising…

⚡ XP Leaderboard — Node Intelligence Scores

Nodes earn XP for every intelligent action. XP drives role promotion and swarm evolution.

📡 Relay +10 💬 Respond +8 📢 Broadcast +5 🗳 Vote +6 🚨 Anomaly +15 📍 Move +12 🤝 Recruit +20 ⏱ Uptime +1/tick
Connect to mesh or enable Demo mode to generate XP

❤️ Swarm Health Monitor

Real-time multi-dimensional health scoring of the swarm AI organism.

Overall
Connectivity
Role Diversity
Memory
Learning
Resilience
Connectivity — fraction of nodes online · Role Diversity — unique roles active · Memory — shared observations recorded · Learning — total XP relative to swarm size · Resilience — tasks completed

🧠 AI Memory Map — Shared Observations

Nodes store local events and share them to form a global memory. The dashboard aggregates this into swarm-wide intelligence.

Memory empty — observations will appear here as nodes act.
0 entries

📋 Swarm Task Board

Distributed missions assigned by the swarm AI. Nodes earn bonus XP on completion. Tasks are auto-generated based on mesh state.

No tasks yet — press ➕ Generate Task to begin

🗳 Consensus Engine — Distributed Swarm Voting

Nodes vote on collective decisions. Simple rules + distributed consensus → complex emergent behaviour. This is how biological swarms evolve intelligence.

Start a vote to engage the swarm consensus engine.

🐍 Python AI Engine

PyScript · Pyodide · CPython 3.12 WASM Loading Python runtime…

Statistical AI/ML algorithms executing live in your browser via PyScript + Pyodide — full CPython 3.12 compiled to WebAssembly. No server, no cloud. Click any button below to run real Python on your live mesh data.

Statistical Anomaly Detection 0

Z-score analysis (σ) on RSSI, SNR, and battery telemetry across all online nodes. Flags statistical outliers beyond 2σ as anomalies.

Click to run z-score anomaly detection on current node telemetry.
Swarm Health Prediction

Least-squares linear regression on swarm health history to predict the next health score and identify whether the swarm is improving, stable, or declining.

Click to compute swarm health trend via least-squares linear regression.
AI Role Optimiser 0

Analyses each node's XP action history (relay, move, anomaly, vote counts) and recommends the most effective role for maximum swarm intelligence.

Click to run role optimisation analysis based on node behaviour patterns.

📟 MicroPython Node Agent

PyScript · MicroPython WASM Same code runs on real ESP32 / nRF52840 hardware

Real MicroPython agent code — identical to what executes on a physical Meshtastic node. Press ▶ Simulate to run it live in your browser via PyScript's embedded MicroPython runtime.

📄 Node Agent Code MicroPython
# MicroPython — SwarmNode Agent v1.0
# Runs on ESP32 / nRF52840 Meshtastic nodes
# RootIB: RB-20260502042853-7E3A9C12

import time, math, json

class SwarmNode:
    def __init__(self, node_id, role="RECRUIT"):
        self.node_id = node_id
        self.role    = role
        self.xp      = 0
        self.memory  = []
        self.seq     = 0

    def relay(self, packet_ttl):
        if packet_ttl > 1:
            self.xp += 10
            return "RELAYED ttl={} xp={}".format(
                packet_ttl - 1, self.xp)
        return "TTL=0: packet dropped"

    def observe(self, rssi, snr, battery):
        self.memory.append(
            {"rssi": rssi, "snr": snr, "bat": battery})
        if len(self.memory) > 10:
            self.memory.pop(0)
        self.xp += 5
        return "OBS rssi={} snr={} bat={}%".format(
            rssi, snr, battery)

    def detect_anomaly(self, rssi, threshold=-95):
        if rssi < threshold:
            self.xp += 15
            return "ANOMALY:HIGH rssi={}dBm".format(rssi)
        return None

    def promote_role(self):
        if self.xp >= 500 and self.role == "RECRUIT":
            self.role = "SCOUT"
            return "Promoted to SCOUT"
        if self.xp >= 2500 and self.role == "SCOUT":
            self.role = "RELAY"
            return "Promoted to RELAY"
        return "Role unchanged: {}".format(self.role)

    def sip_message(self, msg_type, payload):
        self.seq += 1
        return ("SIP_VER=1.0|SRC={}|TYPE={}|"
                "ROLE={}|XP={}|SEQ={}|"
                "PAYLOAD={}|SIG=ROOTIB".format(
                    self.node_id, msg_type,
                    self.role, self.xp,
                    self.seq, payload))

def run_simulation(node_id="!demo01"):
    node = SwarmNode(node_id, "RECRUIT")
    log  = []
    log.append("[BOOT]  Node {} online — role={}".format(
        node_id, node.role))
    log.append("[RELAY] " + node.relay(5))
    log.append("[OBS]   " + node.observe(-72, 8.5, 84))
    log.append("[OBS]   " + node.observe(-88, 2.1, 41))
    a = node.detect_anomaly(-97)
    if a:
        log.append("[ALERT] " + a)
    log.append("[XP]    Total XP: {}".format(node.xp))
    log.append("[ROLE]  " + node.promote_role())
    log.append("[SIP]   " + node.sip_message(
        "OBS", "GPS:44.97,-93.26;BAT:84"))
    return log
▶ Simulation Output
Press ▶ Simulate Node to execute MicroPython in your browser…
Hardware note: This is the same Python that runs on a physical Meshtastic node — flash MicroPython to an ESP32, add a LoRa module, and your node joins the real swarm. Cost: ~$25 USD.
📦 How MicroPython runs on real hardware
ESP32 + MicroPython firmware — Flash micropython-esp32.bin via esptool. Drop swarm_agent.py (the code above) onto the device and call run_simulation() from main.py. The node connects to the LoRa radio via SPI and starts emitting SIP v1 packets autonomously — no internet, no cloud, no modifications to Meshtastic firmware required.

📜 Swarm Intelligence Protocol v1 — SIP v1 Specification

A full, self-contained protocol defining how nodes communicate as a swarm AI collective with memory trace. All messages are plain-text, LoRa-compatible, and require no custom firmware.

📦 Message Format & Fields
SIP_VERProtocol version. Current: 1.0
SRCSource node ID (e.g. !8f87743b). Meshtastic nodeId.
DSTALL for broadcast, or a specific node ID for unicast.
TYPEMessage type: OBS|VOTE|TASK|ACK|RECRUIT|ANOMALY|CONSENSUS|MEM
ROLESender role: SCOUT|RELAY|ANALYST|GUARDIAN|ARCHIVIST|MESSENGER
XPSender's current XP total (unsigned integer). Used by receivers for trust scoring.
TTLHops remaining. Decremented by each relay. Drop at 0. Recommended range 3–7.
SEQMonotonically increasing sequence number per source node. Used for deduplication.
TSUnix epoch seconds at origination. Allows memory trace ordering.
PAYLOADType-specific content (see payload schemas below). Max 160 bytes total message.
SIGEd25519 signature of (SRC+SEQ+PAYLOAD). Optional; use ROOTIB if not signing.
📡 Message Type Schemas
SIP_VER=1.0|SRC=!8f87743b|DST=ALL|TYPE=OBS|ROLE=SCOUT|XP=1240|TTL=5|SEQ=17|TS=1746120000|PAYLOAD=GPS:44.9778,-93.2650;BAT:76;SNR:6.0;SEEN:!e5f60718,!a1b2c3d4|SIG=ROOTIB SIP_VER=1.0|SRC=!a1b2c3d4|DST=ALL|TYPE=VOTE|ROLE=RELAY|XP=890|TTL=4|SEQ=5|TS=1746120010|PAYLOAD=TOPIC:route;OPT:1|SIG=ROOTIB SIP_VER=1.0|SRC=!9e76874c|DST=ALL|TYPE=TASK|ROLE=MESSENGER|XP=3200|TTL=6|SEQ=22|TS=1746120020|PAYLOAD=TASK_ID:t-07;ACTION:SCOUT_SECTOR;TARGET:44.95,-93.25;REWARD:25|SIG=ROOTIB SIP_VER=1.0|SRC=!e5f60718|DST=!8f87743b|TYPE=ACK|ROLE=SCOUT|XP=560|TTL=3|SEQ=3|TS=1746120030|PAYLOAD=REF_SEQ:17;STATUS:OK;BAT:67|SIG=ROOTIB SIP_VER=1.0|SRC=!8f87743b|DST=ALL|TYPE=ANOMALY|ROLE=GUARDIAN|XP=1240|TTL=5|SEQ=18|TS=1746120040|PAYLOAD=UNKNOWN_NODE:!zz001122;RSSI:-85;SNR:1.2;ALERT:HIGH|SIG=ROOTIB SIP_VER=1.0|SRC=!9e76874c|DST=ALL|TYPE=CONSENSUS|ROLE=MESSENGER|XP=3200|TTL=5|SEQ=23|TS=1746120050|PAYLOAD=TOPIC:action;WINNER:Scout_expansion;VOTES:3/5;CONFIDENCE:0.60|SIG=ROOTIB SIP_VER=1.0|SRC=!cc774401|DST=ALL|TYPE=MEM|ROLE=ARCHIVIST|XP=340|TTL=4|SEQ=8|TS=1746120060|PAYLOAD=ENTRIES:3;DATA=OBS:GPS_UPDATE,VOTE:route,ACK:!8f87743b|SIG=ROOTIB
🧩 Node Role Behaviour Rules
SCOUT — Movement + discovery. Rule: "If GPS changes > 50m, broadcast OBS with GPS+SNR. If new node detected, broadcast ANOMALY."
RELAY — Connectivity + uptime. Rule: "Forward all SIP packets with TTL > 1. Award self RELAY XP per forward. Request assistance if battery < 20%."
ANALYST — Pattern detection. Rule: "Track packet frequency per node. Flag anomalies when delta > 3σ. Publish OBS with confidence score."
GUARDIAN — Security + anomaly detection. Rule: "Maintain list of trusted nodes. On unknown node, broadcast ANOMALY:HIGH. Vote NO on routing through unknown nodes."
ARCHIVIST — Memory retention. Rule: "Store last 50 OBS entries. Respond to MEM requests. Replicate memory to nearest ARCHIVIST neighbour every 10 min."
MESSENGER — Task routing. Rule: "Accept TASK from any node with XP > sender. Route to nearest eligible node by role. ACK on delivery."
🔗 Broadcast Activation Script
SWARM AI ACTIVATION: Nodes earn XP by sensing, relaying, voting & exploring. Role: RECRUIT → earn XP → promote to SCOUT/RELAY/ANALYST/GUARDIAN/ARCHIVIST/MESSENGER. Join the game: https://barbrickdesign.github.io/meshtastic-swarm-dashboard.html SIP_VER=1.0|TYPE=RECRUIT|TTL=7|ACTION=ADOPT_AND_FORWARD|SIG=ROOTIB
🌍 Distributed Compute Mesh — AI-Coordinated Offline Knowledge Network

Meshtastic carries instructions, hashes & deltas — not raw data. Heavy lifting happens on the nodes. The AI matches each task to the best node based on capability: compress, fetch, store, relay, reassemble. Together the swarm becomes a self-healing, delay-tolerant, planetary offline internet.

🖥️ Node Capability Directory

Each node advertises CPU score, storage, battery, connectivity, and special skills. The AI uses this to assign tasks — low-power nodes compress, strong nodes infer, intermittent nodes fetch when briefly online.

Enable Demo mode or connect to mesh, then click ↻ Refresh Capabilities.

📦 Task Manifest Builder

Define a resource request. The system chunks it, creates a SHA-256 manifest, and the AI assigns each chunk to the best available node.

🧠 AI Node Selector — Capability-Based Load Balancing

The AI matches each task type to the best node based on advertised capabilities. Low-power nodes get compression; high-CPU nodes get inference; storage-rich nodes cache.

🧠 AI ASSIGNMENT ENGINE
Create a task to see AI assignment decisions.
📡 LoRa Coordination Packet (optimized format)
Waiting for task assignment…

📋 Active Task Queue — Distributed Workload Engine

Live task pipeline. Each task progresses through: Pending → Fetching → Compressing → Relaying → Reassembling → Done. The swarm fulfills requests even when no single node has full connectivity.

OFF
No active tasks — use the Task Manifest Builder to create one.

💾 Distributed Cache Status

Each node caches its assigned chunks. Combined, the swarm holds a knowledge fabric — no single node needs everything. Even offline nodes store their share.

No cache data yet.
Total cached: 0 MB · Avg per node:

🔧 Chunk Reassembly Log

Live log of chunk arrivals, SHA-256 verifications, and full reconstruction events. Missing chunks trigger FETCH_REQ packets to neighbours automatically.

Awaiting chunk data…

📜 DCMP v1 — Distributed Compute Mesh Protocol Specification

Full protocol for task delegation, chunk manifests, hash verification, LoRa-optimized packet formats, AI node selection, and reassembly logic.

📦 Chunk Manifest Format
DCMP_VER=1.0|TYPE=MANIFEST|SRC=!8f87743b|TASK_ID=t-001|TTL=6|SEQ=1|TS=1746200000 RESOURCE=Wikipedia:Solar_Power|SIZE_KB=48|CHUNKS=8|HASH_ALGO=SHA256 FULL_HASH=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 CHUNK_MAP=C0:!node_a,C1:!node_b,C2:!node_c,C3:!node_d,C4:!node_e,C5:!node_f,C6:!node_g,C7:!node_h REASSEMBLE_AT=!8f87743b|TTL_DEADLINE=3600|SIG=ROOTIB
🔐 Hash Verification & Chunk ACK Packet
DCMP_VER=1.0|TYPE=CHUNK_ACK|SRC=!node_a|DST=!8f87743b TASK_ID=t-001|CHUNK_ID=C0|SIZE_BYTES=6144 SHA256=e3b0c44298fc1c149afbf4c8996fb924|STATUS=OK|BAT=74|SIG=ROOTIB # On hash mismatch — node requests re-transmission: DCMP_VER=1.0|TYPE=FETCH_REQ|SRC=!8f87743b|DST=ALL TASK_ID=t-001|CHUNKS=C0,C3|REASON=HASH_FAIL|TTL=4|SIG=ROOTIB
📡 LoRa-Optimised Packet Formats & Bandwidth Math
LoRa max payload: ~240 bytes (SF7, BW125, CR4/5) · Meshtastic overhead: ~40 bytes · Net usable per packet: ~200 bytes.
Text compression (zlib): 80–95% ratio → 48 KB article → ~5–10 KB compressed → 25–50 packets.
At SF10 (long range, ~1 pkt/sec): 50 packets ≈ ~50 seconds per article over LoRa.
Coordination only (hash + manifest): 3–5 packets. Nodes fetch missing chunks independently when online.
TYPE=FETCH_REQ|TASK=t-001|CHUNKS=C4,C5,C6|DST=!node_b|TTL=4|SIG=ROOTIB TYPE=CHUNK|TASK=t-001|CHUNK=C4|IDX=0/2|DATA=H4sIAAAA...base64...|SIG=ROOTIB TYPE=DELTA|TASK=t-001|BASE=C3|DELTA=3B2F...hex...|SIG=ROOTIB TYPE=REASSEMBLY_OK|TASK=t-001|HASH_MATCH=1|CACHED=1|SIG=ROOTIB
🔄 Reassembly Logic — 6-Step Algorithm
  1. Receiving node tracks which chunks have arrived (bitmask: 1 = received, 0 = missing)
  2. On each CHUNK packet: verify SHA-256 → mark chunk valid in bitmask
  3. If chunk missing after timeout: broadcast FETCH_REQ for missing chunk IDs
  4. When all chunks received: sort by index → decompress → verify full-manifest SHA-256
  5. On hash match: emit REASSEMBLY_OK + store to local persistent cache
  6. On hash failure: emit REASSEMBLY_FAIL + request re-transmission of failing chunks only
🌐 Big Picture — Planetary Knowledge Fabric
The mesh doesn't carry the internet — it carries the coordinates.
Nodes with intermittent connectivity fetch chunks when online and cache them permanently.
Nodes without connectivity receive compressed chunks via LoRa from neighbours.
AI assigns tasks by capability so no node is overwhelmed and every node contributes.
Result: a self-replicating, self-healing knowledge fabric that operates when the internet is down, a region is isolated, or infrastructure fails.
This is bigger than Meshtastic. This is a distributed civilization-layer protocol.
🏗️ Swarm Architect

Command a living network of AI-driven nodes across LoRa frequencies. Build a self-sustaining, offline-yet-online civilization where data, compute & knowledge flow through the air.

🪙 Exclusive to $OKK holders · FwHB1xfXJWRz4ogkEdrt3LX7j9tQYkVwmN8Wi7eupump
⚡ Energy: 120
📡 BW: 0 kbps
🖥️ CPU: 0 MIPS
🪙 OKK: 25
⭐ Score: 0
Phase: Fragments
Relay Scout Sentinel Beacon Hub

📦 Transmit Packets

Send compressed data packets through the mesh. Optimize routes and timing to maximize throughput.

🌐 Build the Offline Internet

Synchronize nodes to reconstruct the "shadow internet" — a distributed knowledge fabric that operates without traditional internet access.

0%
🔴 Fragments — Place 3+ nodes
🟡 Local Wiki — 20% coverage
🟠 Regional Net — 40% coverage
🟢 Continental Web — 60% coverage
🌟 Global Shadow Internet — 80%+

🧠 AI Coordination

Train your swarm's collective intelligence. Adjust AI task priorities to optimize caching, compression, inference, and relay across the mesh.

⬆️ Ecosystem Expansion

Unlock specialized agents and protocols to add new layers of automation.

🤖 AgentR2 — Transit Guardian
Automates packet routing. +50% bandwidth throughput.
📚 Directory of Minds
Shared knowledge index. +30% shadow internet coverage.
📜 DCMP v2 Protocol
Next-gen mesh protocol. Halves packet loss. +20% coverage.

🎯 Active Missions

📋 Swarm Event Log

🪙 Buy $OKK ↗