Sync two devices with a relay
Sync two devices with a relay
Section titled “Sync two devices with a relay”This tutorial keeps the same eden-memory database in sync across two devices through a lightweight relay. You will install the binary on both devices, pair them with a relay-mediated PAKE invitation, start a sync loop, and verify that memories propagate.
Prerequisites
Section titled “Prerequisites”- Two devices running Linux or macOS.
- eden-memory installed on both (or the ability to run the install script).
- A relay URL. You can run your own relay or use one provided by your team.
- A fleet
account-idshared by both devices. - A strong root-key passphrase to encrypt the sidecar files.
1. Install the binary on both devices
Section titled “1. Install the binary on both devices”On each device, run:
curl -fsSL https://0d3sa.com/eden-memory/install.sh | shConfirm the install:
eden-memory versioneden-memory healthBoth devices should return a version string and a status: ok health report.
2. Set up or locate a relay
Section titled “2. Set up or locate a relay”If you are running your own relay, start it on a reachable host:
eden-memory relay-server \ --relay-db /var/lib/eden-relay/relay.db \ --addr :8787 \ --confirmOr deploy the dedicated eden-relay binary on an always-on host or VPS. It has no MCP or memory subcommands and starts without --confirm:
eden-relay \ --db /var/lib/eden-relay/relay.db \ --addr :8787The relay needs a persistent SQLite database path and a listen address. Default port is 8787. For a production relay, see Run your own relay server.
If someone else is hosting the relay, write down the base URL (for example, http://relay.example.com:8787).
3. Create a pairing invitation on the first device
Section titled “3. Create a pairing invitation on the first device”On the device that already has data (or that you want to treat as the source), run:
eden-memory --db ~/.eden-memory/device.db \ pair create-invitation \ --relay-url http://relay.example.com:8787 \ --account-id your-account \ --password "correct-horse-battery-staple" \ --device-name "Studio Desktop" \ --root-key-passphrase "$(cat passphrase.txt)" \ --confirmThe command prints an invitation code and a short rendezvous code. The pairing password must be at least 10 characters long and have at least 40 bits of estimated entropy. Share the invitation code and the password with the second device through a trusted channel.
4. Accept the invitation on the second device
Section titled “4. Accept the invitation on the second device”On the joining device, run:
eden-memory --db ~/.eden-memory/device.db \ pair accept-invitation \ --code INVITATION_CODE \ --root-key-passphrase "$(cat passphrase.txt)" \ --start-sync-loop \ --confirmReplace INVITATION_CODE with the code from step 3. The --start-sync-loop flag starts a foreground sync loop in the same process. Without it, the device records the initiator as a peer and you can start the loop separately.
Accepting the invitation does three things:
- Receives the account root key.
- Records the initiator as a peer.
- Registers the joining device with the relay.
5. Start the sync loop on the first device
Section titled “5. Start the sync loop on the first device”If you did not use --start-sync-loop on the source device, start the loop there:
eden-memory --db ~/.eden-memory/device.db \ sync loop start \ --relay-url http://relay.example.com:8787 \ --account-id your-account \ --root-key-passphrase "$(cat passphrase.txt)" \ --confirmThis runs in the foreground until you press Ctrl+C or send SIGTERM. For a background loop, run the command inside a service manager such as systemd.
Check the loop status at any time:
eden-memory --db ~/.eden-memory/device.db sync loop status6. Verify sync
Section titled “6. Verify sync”- Store a memory on the first device through your MCP client or the CLI fallback.
- On the second device, force a single sync round:
Terminal window eden-memory --db ~/.eden-memory/device.db \sync loop once \--relay-url http://relay.example.com:8787 \--account-id your-account \--root-key-passphrase "$(cat passphrase.txt)" - Recall the same memory on the second device.
If both devices run continuous loops, the memory should appear within one loop interval (default 30 seconds). You can also check health on either device:
eden-memory --db ~/.eden-memory/device.db healthA peer_count greater than zero means the relay has registered peers.
Expected output
Section titled “Expected output”- Both devices show
status: okfromeden_health. pair create-invitationreturns aninvitation_code.pair accept-invitationfinishes without errors and, with--start-sync-loop, begins syncing.- A memory stored on one device is recallable on the other.
Troubleshooting
Section titled “Troubleshooting”- Relay is unreachable — check the relay URL and firewall rules. The relay listens on the address you passed to
--addr. - Password rejected — ensure the password is at least 10 characters with enough entropy.
- Root-key passphrase prompt — store the passphrase in a file or environment variable. The command falls back to
EDEN_ROOT_KEY_PASSPHRASEif set. - Pending key changes — if a peer key rotation is staged, approve it with
sync approve-key-change. See Approve a peer key rotation. - Loop not registering — confirm both devices use the same
--account-idand relay URL, and that each device has a unique device identity sidecar. See Sidecar files and How sync works.