Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:23blocks OS Ai maestro Mesh Host Registration

From Leeroopedia
Knowledge Sources
Domains Mesh_Networking, Peer_Sync
Last Updated 2026-10-26 10:00 GMT

Overview

A mesh registration pattern where adding a host triggers back-registration, peer exchange, and gossip propagation with a depth limit to prevent infinite loops.

Description

When a new host joins the mesh, `addHostWithSync` performs a four-step dance:

  1. Local add: add the host to the local config (with duplicate URL/IP detection)
  2. Back-registration: register ourselves with the remote host
  3. Peer exchange: exchange known hosts lists
  4. Propagation: propagate newly discovered peers to existing hosts, with a propagation depth limit to prevent infinite loops

Each propagation carries a unique ID (`generatePropagationId`) and is deduplicated (`markPropagationProcessed`) so a host doesn't reprocess a gossip message it has already seen.

Usage

Use this principle when designing a gossip-based mesh where:

  • Adding a peer triggers reciprocal registration
  • Peer lists must converge across the mesh
  1. Gossip must terminate (depth limit + dedup)

Theoretical Basis

The registration is a four-step sync with gossip dedup:

addHostWithSync(host):
  1. addHost(host)               // local, with dup detection
  2. registerWithPeer(host.url, self)  // back-registration
  3. exchangePeers(host, knownHosts)   // peer list exchange
  4. for each newPeer: propagate(newPeer, depth+1, propId)
     // depth-limited, deduped by propId

The propagation depth limit prevents infinite gossip loops (A→B→A→B...). The propagation ID dedup ensures a host doesn't reprocess the same gossip trace.

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment