Motebit

Sync

Multi-device sync, the relay server, and conflict detection.

Sync lets a single motebit span multiple devices — laptop, phone, any future surface — with the same identity, shared memory, and unified event log.

How it works

The sync engine keeps your devices in step through a simple push-pull cycle:

  1. Push — Send local events that the relay hasn't seen
  2. Pull — Receive remote events that this device hasn't seen
  3. Conflict detection — Identify events from different devices that modify the same data

Sync runs automatically on a configurable interval (default 30 seconds) and can also be triggered manually.

The relay server

The sync relay is a lightweight server that:

  • Authenticates devices using Ed25519 signed tokens (no passwords stored server-side)
  • Stores events for each motebit
  • Fans out events to connected devices in real-time via WebSocket
  • Supports batch push/pull over REST

The relay is a transport layer — it passes events between devices. It doesn't interpret, modify, or depend on the event content.

Configuration

In ~/.motebit/config.json:

{
  "sync_url": "https://relay.example.com"
}

The sync master token is stored in the OS keyring (not in the config file).

In the CLI, use /sync to trigger a manual sync cycle and see the current status.

Conflict detection

When two devices modify state simultaneously, the sync engine detects the conflict. Conflicts are recorded but not auto-resolved — the system uses version clocks to maintain a consistent ordering. Events are sorted by version clock, and the highest clock wins for state reconstruction.

This means your devices converge to the same state without requiring manual conflict resolution in normal operation.

Encrypted sync

Sync supports end-to-end encryption. When enabled, events are encrypted before leaving the device and decrypted on arrival. The relay stores only opaque ciphertext — it never sees plaintext events.

This means even a compromised relay server can't read your agent's memory, state, or event history. Only devices with the encryption key can access the content.

Transport options

The sync engine supports multiple transports:

  • HTTP — REST-based push/pull, works through firewalls and proxies
  • WebSocket — Real-time sync with lower latency
  • Encrypted — Wraps any transport with AES-256-GCM encryption