Principle:23blocks OS Ai maestro Host Identity
| Knowledge Sources | |
|---|---|
| Domains | Mesh_Networking, Identity |
| Last Updated | 2026-10-26 10:00 GMT |
Overview
A host identity pattern where each machine is identified by its canonical hostname (lowercase, no .local suffix), with self-detection centralized in one function that checks hostname, IPs, and legacy values.
Description
Host identity in the mesh is based on the machine's hostname, normalized to lowercase with the `.local` suffix stripped (macOS Bonjour/mDNS). The `getSelfHostId` function returns this canonical ID. The `isSelf` function is the only place where self-detection happens — it checks the hostname, all local IPs, and the legacy 'local' value.
Centralizing self-detection prevents the class of bugs where one module thinks a host is self and another doesn't (e.g., when hostname changes due to dock/WiFi switching). `getPublicUrl` detects the host's public URL, preferring Tailscale IPs (100.x.x.x) over LAN, never returning localhost.
Usage
Use this principle when designing a peer-to-peer mesh where:
- Host identity must be consistent across all modules
- A machine's identity changes with network configuration (dock, WiFi, Tailscale)
- Self-detection must handle multiple signals (hostname, IPs, legacy values)
Theoretical Basis
The identity is canonical hostname with centralized self-detection:
getSelfHostId() = os.hostname().toLowerCase().replace(/\.local$/, '')
isSelf(hostId) =
hostId == getSelfHostId()
|| hostId == 'local' // legacy
|| hostId in localIPs() // IP match
|| hostId in hostAliases() // configured aliases
The principle is single source of self-detection: every module that needs to know "is this me?" calls `isSelf`, and `isSelf` alone handles the multi-signal matching. This eliminates the divergence class.