Sync — your data across your devices

Shipped

View as Markdown

Sync is off until you turn it on. When you do, Bring Your LM replicates your data to a Couchbase Edge Server that you run — there's no BYLM account and no backend we operate. Your agents, conversations, notes, and settings then follow you from one device to another, and each device keeps working offline and catches up when it reconnects.

Why it matters

You bring the model and the keys, so the app's job is to hold your setup and history without shipping it anywhere you didn't choose. Sync keeps that promise: you point the app at a server on your own machine or network, replication runs both ways continuously, and the things that only make sense on one device — or that must never leave it — are deliberately held back.

The one hard rule: Couchbase Lite 3.x

Bring Your LM stores everything in Couchbase Lite 3.x and replicates with that version's protocol. The server you run has to speak the same protocol, and this is the part that trips people up:

If sync connects but immediately errors with a protocol or version complaint, this mismatch is the first thing to check.

What syncs, and what stays on the device

Everything replicates through a single set of collections. When sync is on, the app pushes and pulls all of these:

Some things are created on every device but never handed to the replicator, because they're meaningless — or unsafe — anywhere but where they were written:

Secrets never ride the sync connection

Your provider and fetch-tool API keys live in your device's OS keystore, not in the app's database — so they are simply not among the things that replicate. A synced provider record carries its address and options and only a flag saying a key is set; the key's value stays on the device you typed it into. By default, then, turning on sync shares no secrets at all, and you re-enter a key once on each device.

Sharing a key on purpose

When you do want a key on another device without retyping it, BYLM has a deliberate, per-key path — not a blanket "sync my secrets" switch:

So secrets are private by default and shared only key-by-key, device-by-device, end-to-end encrypted — never dropped into the general sync stream in the clear.

Asking for a key you don't have

Sharing starts on the device that has the key, which is the wrong end when you are sitting in front of the device that needs one. So you can also ask:

Because nothing replicates while an app is closed, this is a "go and open the other device" flow: your ask reaches a device the next time you open BYLM there, and the badge on Settings points you at it.

Managing your devices

Settings → Devices lists every device in your registry — the names that show up in a message's per-device metrics. From here you can rename a device, delete a stale record for one you no longer use, and see each device's trust badge and key fingerprint. Verifying a device means comparing that fingerprint across the two screens; if a device's keys later change, it turns into a loud "Keys changed" badge rather than staying invisible, and a device that changes its name has to be re-verified before it can send or receive keys. Incoming key offers also land here, each with an explicit accept (which verifies the sender first) or decline — as do asks from your other devices for keys this one holds, and the keys this device is still waiting for. A badge points you to whatever is waiting, so nothing sits unnoticed.

Reading the sync status icon

Whenever sync is on, a small status icon rides in the top bar (and in the navigation drawer) so you always have an at-a-glance read on the connection. Tap it to jump straight to the sync settings. When sync is off, the icon isn't shown at all.

Here is every state it can show:

The eleven sync status states, each with its icon, label, and meaning

What sync does while your phone sleeps

An Android phone spends most of its day locked, and a locked phone cuts the network off from apps that aren't in front of you. A replicator left running into that would spend the night retrying a connection it cannot make, once every half minute, burning battery and filling the app's diagnostics buffer with hundreds of identical "can't resolve the server" errors — which then crowd out the records a bug report is actually for.

So Bring Your LM parks it instead. If the connection fails while the app is in the background, sync stops until you come back, and reconnects the moment you open the app again. A connection that is healthy when you switch away is left alone, so a reply that lands while you're in another app still reaches your other devices.

That is also why coming back to the app doesn't greet you with a red icon. The grace window before a problem is called an error counts only the time you could actually see it: a phone that spent the night locked was not watching sync fail, so the attempt made when you unlock it gets the full window to succeed — long enough that a normal reconnect finishes quietly.

The flip side is that the red icon means something specific. It says sync has been unable to reach your server for about forty-five seconds with the app in front of you, which is the question you actually wanted answered: not "is something wrong somewhere" but "is this still just coming up, or is it really broken?" Leave the app open and a genuine outage turns red and stays red.

Turning sync on in the app

Open Settings, then Sync, and fill in the connection:

Use wss:// (TLS) for anything beyond your own trusted LAN — the endpoint carries all your synced data.

Standing up the server

You supply the server; the app is only the client. For a copy-and-run example — a Dockerfile, a docker run command, and the config and users files — see Running a Couchbase Edge Server. The essentials are the same however you run it:

If you manage servers with Ansible, this project's companion role automates all of the above: you provide the admin user's password (from a vault), the public hostname the proxy answers on, and the database-to-collections map shown above, and it renders the config and users files and runs the container for you.

Whenever you add a new collection to the app in a future version, remember the server's collection list has to grow to match, or that new data won't sync.

What it doesn't do yet

Sync is a single endpoint with a single user — there's no per-collection or per-device filtering, no channels, and no selective sync: enable it and the full collection set above replicates. And it only talks to a Couchbase Edge Server (or a compatible Sync Gateway) speaking the Couchbase Lite 3.x protocol — see the version rule above.