Skip to main content

Overview

FERAL instances on the same network automatically discover each other via mDNS and replicate memory using HLC (Hybrid Logical Clock) timestamps + last-write-wins at the row level, backed by a per-node write-ahead log. All sync is peer-to-peer — no cloud relay is involved.

TLS Setup

Generate a CA and peer certificates using OpenSSL:
Configure each FERAL instance:
The passphrase (FERAL_SYNC_PASSPHRASE) is still checked as a belt-and-suspenders layer on top of TLS.

Static Peer List

When mDNS is blocked (enterprise networks, Docker, VPNs), use a static peer list:
FERAL will use mDNS first. If no peers are discovered within 30 seconds, it falls back to the static list. If mDNS is unavailable entirely (zeroconf not installed), static peers are used immediately.

Troubleshooting mDNS

Conflict Resolution

  • Notes / Knowledge: Last-Writer-Wins by HLC timestamp
  • Episodes: Union merge (never delete remote episodes)
  • Execution log: Append-only (INSERT OR IGNORE)
  • Deletes: Tombstoned. A delete records the row id and the HLC of the delete in sync_tombstones (inside memory.db), because the hard DELETE removes the hlc_string the LWW comparison needs. Without the tombstone the row is a blank slate again and the next peer that replays its copy of the original insert re-creates it. An insert whose HLC is newer than the tombstone is a legitimate re-creation: it applies, and retires the tombstone.
Tombstones are pruned after 90 days. That bounds the table, at the cost of one reopened window: a peer that has been offline since before the horizon still holds the original insert, and once the tombstone expires that insert can re-create the row. Re-pair such a node rather than letting it sync back in.

Architecture