Skip to content
This repository was archived by the owner on Sep 2, 2026. It is now read-only.
This repository was archived by the owner on Sep 2, 2026. It is now read-only.

[Spec] Multi-machine sync #29

Closed

Description

@64ix

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

  1. As a user, I want my board state to appear on every machine I pair, so that I can continue anywhere.
  2. As a user, I want the relay to store only ciphertext, so that even a compromised relay reveals nothing.
  3. As a user, I want to deploy the relay myself, so that my fork stays independent of the upstream cloud.
  4. As a user, I want to pair a machine with a QR or deep link, so that setup is one gesture.
  5. As a user, I want a devices screen listing paired machines, so that I can see and revoke access.
  6. As a user, I want conflicting edits to resolve as last-write-wins without dialogs, so that syncing never nags me.
  7. As a user, I want deleted things to stay deleted via tombstones, so that a stale machine can't resurrect them.
  8. As a user, I want offline edits to queue and flush on reconnect, so that working offline costs nothing.
  9. As a user, I want terminal sessions and settings to stay machine-local, so that sync never drags heavyweight state around.
  10. 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://pair flow + 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions