This repository was archived by the owner on Sep 2, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Sep 2, 2026. It is now read-only.
[Spec] Multi-machine sync #29
Copy link
Copy link
Closed
Labels
ready-for-agentready-for-agent
Description
Part of the wayfinder map. Decisions: #12.
Blocked by: #21.
Problem Statement
The board lives in one file on one machine. The user works on several machines, and nothing carries over — stages, links, orders, dismissals are all stranded.
Solution
Sync board + worktree state between the user's machines through a self-hosted relay that never sees plaintext:
- A Cloudflare Worker + D1 relay (emdash pattern), deployed by the user, configured in the fork's settings.
- Opaque E2E-encrypted rows only; the relay stores ciphertext it cannot read.
- Key/value last-write-wins over the app state: one sync unit per worktree meta, per-project order list, per-repo dismissed list; server-versioned LWW, tombstones for deletes.
- Offline: local write queue, push + pull on reconnect.
- Pairing via the existing QR / deep-link flow, with a devices screen and per-device revocation.
User Stories
- As a user, I want my board state to appear on every machine I pair, so that I can continue anywhere.
- As a user, I want the relay to store only ciphertext, so that even a compromised relay reveals nothing.
- As a user, I want to deploy the relay myself, so that my fork stays independent of the upstream cloud.
- As a user, I want to pair a machine with a QR or deep link, so that setup is one gesture.
- As a user, I want a devices screen listing paired machines, so that I can see and revoke access.
- As a user, I want conflicting edits to resolve as last-write-wins without dialogs, so that syncing never nags me.
- As a user, I want deleted things to stay deleted via tombstones, so that a stale machine can't resurrect them.
- As a user, I want offline edits to queue and flush on reconnect, so that working offline costs nothing.
- As a user, I want terminal sessions and settings to stay machine-local, so that sync never drags heavyweight state around.
- As a user, I want remote-host workspaces untouched by sync (they stay host-authoritative), so that the two mechanisms never fight.
Implementation Decisions
- Sync scope: worktree meta (stage, links, orders, archived/pinned) and board UI keys (per-project column order, dismissed ghost ids). Machine-local: sessions/tabs, settings, automation runs.
- Relay: self-hosted Cloudflare Worker + D1, dumb storage of opaque rows; per-row E2E encryption reusing Orca's existing crypto (NaCl box + HKDF key schedule); AAD bound to table/row/version/keyId.
- Client shape: key/value LWW layer over the app data file — sync units are plain per-key values (the shapes spec 1 defines), server-versioned, tombstones for deletes; existing rekey primitives remain the identity mechanism.
- Transport: WS/long-poll to the worker; capability-negotiated protocol per the remote-wire-compatibility rules.
- Pairing: existing QR/
orca://pairflow + device registry + revocation screen; two-half pairing secret. - No upstream Orca Cloud involvement.
Testing Decisions
- Test the LWW layer (version ordering, tombstones, offline queue replay) and the crypto envelope (relay sees only ciphertext; wrong-key decode fails).
- Seams: the sync layer (pure, over the per-key shapes), the crypto envelope, the relay client.
- Prior art: profile project-transfer merge tests; e2ee crypto tests; device-registry tests.
Out of Scope
- Relay hosting automation (the worker is deployed manually, like emdash).
- Syncing terminal sessions, settings, or automation runs.
- Remote-host meta sync (hosts stay authoritative).
Further Notes
- The derivation engine (spec 2) is deterministic over synced facts, so a paired machine re-derives the same stages from GitHub — facts themselves don't need syncing.
Metadata
Metadata
Assignees
Labels
ready-for-agentready-for-agent
Activity
Merge code-review fixes for spec #29
feat(sync): sync the feature board card order now that spec #24 defin…