Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.
Rust acpagent-client-protocolai-agentsai-assistantclaudeclaude-codecodexcoding-agentscursorgeminigemini-cligrok-bot-alternativeiosiphonelinuxmacosmcpopen-sourcerustself-hosted
docs: design connections and accounts, and plan required sign-in
leepokaid73cf6a7a678
diff --git a/docs/architecture/connections.md b/docs/architecture/connections.mdnew file mode 100644index 00000000..89ea17f7--- /dev/null+++ b/docs/architecture/connections.md@@ -0,0 +1,153 @@+# Connections and accounts++Who may reach a computer, how, and what each state is called. Agreed 2026-11-02 as the target design; [Work](#work) lists what is built and what isn't yet. Wire details stay in [remote relay](../reference/remote-relay.md).++**People sign in; computers join an account.** An app someone uses (iPhone, Android, desktop) signs in. A host never signs in: it is *in* an account, which the cloud records as the computer's owner. The computer keeps no account credentials, so a compromised server gives up its own bots, never the account.++## Terms++| Term | Meaning | Code today |+| --- | --- | --- |+| Account | One person's Codync sign-in (Clerk user) | `userId` |+| App | iPhone, Android or desktop app. Must be signed in | — |+| Computer | One `codync-host`, known by its own key. In at most one account | `computerId`, `signKey` |+| Device | An app instance allowed to use a computer, with its own key | `Device`, `deviceKey` |+| In an account | The account a host belongs to (its owner in the cloud). Joining is a claim the host signs. "The host changed its account" means joining, moving or leaving, never an app signing in to another account | `claim`, `owner_user_id` |+| Manager / managed computer | A desktop app that manages another computer's host over SSH, and that computer | SSH profiles (`ssh-profiles.json`) |+| In person / remote | The two ways a device gets to use a computer: QR (or short code) at the computer, or the account list plus a 6-digit check | `DeviceSource::Local` / `Account` |+| Route | Direct (LAN, Tailscale), Codync relay, private relay, SSH tunnel. A path, not a relationship | `HostRoute` |++The terminal UI and the CLI are the computer's own console, not apps in this sense: they never sign in.++## Relationships++| Relationship | From | To | Granted by | Direction |+| --- | --- | --- | --- | --- |+| **Manage**: settings, approvals, installing | App (on the computer, or over SSH) | Host | The OS account (SSH keys) | One way |+| **Use**: bots, chat, screen | Device | Host | The computer, in person or remote | Device → computer |+| **Network**: bot to bot messages | Host | Host | codync-network invite | Both ways |+| **Sign in** | App | Account | The identity provider | — |+| **In an account** | Host | Account | A claim the host signs | — |++- The account is not a link. It is an address book (find your computers without a QR), a remote doorbell (ask for access, revoke a lost phone) and cloud features (screen relay, custom icons, cloud assistants).+- Manage is between a desktop **app** and a **host**, not between hosts: the SSH list lives in the app's data folder and the app opens the tunnel itself. The manager's own host takes no part, and the managed host doesn't know it is managed. Codync and Codync Dev on one Mac keep separate lists.+- Network is the only host-to-host relationship. A manager adds a managed computer to its network by calling that host's network methods through the SSH tunnel.++## Rules++1. **The computer decides.** The cloud can only shorten access, never grant it.+2. **Every app is signed in.** No signed-out mode remains, on any phone or desktop build that ships.+3. **One account per link.** A device may use a computer only when both are in the same account.+4. **A computer is in at most one account.** Changing accounts means leaving one and joining the other.+5. **Manage comes from the OS account.** Whoever sits at a computer can read `~/.codync/token`; Codync doesn't pretend to stop them. A managed computer keeps every setting of its own.+6. **Signing out affects only that app.** It hands its key back (cloud grant revoked, push stopped, the device removed on computers it can reach) and erases that account's data on the device. The computer stays in its account; leaving takes **Remove from account**.++## Pairing a phone++The phone finds and pairs every computer itself. A computer the phone hasn't paired shows in its account list (greyed, **Ask for access**), never with bots.++| Where you are | How | The computer |+| --- | --- | --- |+| At the computer | Scan the QR it shows (`codync-host pair`, the desktop's **Pair iPhone**, an SSH computer's card), or type its short code when scanning a terminal is awkward | In your account: the phone gets in. In no account: asks once (desktop dialog, terminal `y/N` with a matching code), then joins the phone's account and lets the phone in. In another account: refuses, "This computer is in another account" |+| Away | Tap it in the account list, compare 6 digits on the computer, Allow (or **Skip the 6-digit check**) | Must already be in your account |++- Only a signed-in phone scans, and the host checks the phone's account from a proof the cloud signed, never from what the phone says. The check works offline (a signature), so computers with the cloud off or on a private relay still pair in person.+- A QR pairing records the phone's account on the computer. When a host changes the account it belongs to, it drops every device of the old account, QR-paired ones too.+- Joining an account on the first scan is how a headless computer "signs in": there is no `codync-host login`. A computer may also join through a manager's **Add to account**, which uses the manager app's account.++## When the app and its computer disagree++The desktop app runs on a computer with its own host, so its account and the computer's can differ.++| Computer | Its own app | Shown |+| --- | --- | --- |+| In A | Signed in to A | Nothing |+| In A | Signed in to B | Asked once, **Move this computer to your account?** (*Keep it there* is remembered). After that, one small line in the main window: "This computer is in a•••@gmail.com's account", which opens the same choice |+| In no account | Signed in | Joins on its own (`mayAutoClaim`), unless the cloud is off, it uses a private relay, or the user took it out; then the same small line says why |++The app manages its computer through loopback either way. Only same-account phones can pair with it (rule 3), so a B phone that tries is told which account the computer is in and how to move it.++## Headless computers++A computer with only the host (SSH-only server, VPS) never signs in. It joins an account in one of two ways:++- A manager's desktop app adds it over SSH: add the SSH computer, install the host (one click, planned), then it joins the manager app's account.+- A signed-in phone scans `codync-host pair` (or types its short code) and the terminal confirms.++`codync-host cloud` and the TUI's account screen say which account the computer is in, or how to add it to one.++### Using a Linux VPS++The agents themselves (Claude Code, Codex, …) always sign in over SSH, as the user that runs the host: `claude`, `codex login --device-auth`. Codync can't do that for them. Everything else depends on whether there's a desktop app to manage the VPS.++**With the desktop app (recommended)**++| Step | Where | What | Today |+| --- | --- | --- | --- |+| 1 | VPS | Install the agents and sign them in | Same |+| 2 | Desktop | Settings → Computers → Over SSH → **Add SSH computer**, pick the host from `~/.ssh/config`, compare the host key, **Trust and connect** | Built |+| 3 | Desktop | **Install** on the card: `install.sh --host-only` and `codync-host install` over SSH. `loginctl enable-linger` needs sudo, so when it fails the card shows that one command | Planned: today the card shows a `brew` command to copy, which fails on Linux |+| 4 | Desktop | The VPS joins the desktop app's account on its own | Planned: today **Add to account** is a separate tap |+| 5 | Phone | The VPS appears in the account list: **Ask for access**, then compare the 6 digits on the desktop and Allow. Or open **Pair iPhone** on the VPS card and scan | Built |+| 6 | Desktop | Optionally add it to the network in one click | Built |++**Phone only**++| Step | Where | What | Today |+| --- | --- | --- | --- |+| 1 | VPS | Install the agents and sign them in | Same |+| 2 | VPS | `curl -fsSL …/install.sh \| sh -s -- --host-only`, `codync-host install`, `sudo loginctl enable-linger "$USER"` | Built |+| 3 | VPS | `codync-host pair` prints a QR code and a short code | QR built; short code planned |+| 4 | Phone (signed in) | Scan, or type the code. The terminal asks to add the VPS to this account and let this phone in, with a matching code; answer `y` | Planned: today the scan pairs at once and the VPS stays out of any account |+| 5 | Later | Other phones of the same account scan once and are in. Phones that ask remotely are approved with `codync-host access approve` over SSH or in the TUI, or by turning on **Skip the 6-digit check** (`codync-host cloud approval auto`) | Partly built (same-account rule planned) |++Either way the VPS uses the Codync relay by default, with no port to open; Tailscale on both ends gives a direct route. A headless VPS has no remote screen, and its new bots start without connectors (no credential store). `codync-host tui` over SSH chats on the VPS itself.++## States++| Belongs to | States | Code today |+| --- | --- | --- |+| Computer's account | Not in an account · In your account · In another account; also: Cloud off | `cloud.owner`, `cloud.enabled` |+| App vs its computer | Same · Computer in another account · Computer in no account | — (planned) |+| Manage (SSH) | Idle → Connecting → Check host key → Not installed → Installing (planned) → Connected; on errors: Retrying · Failed | `SSHStatus` |+| Use: access (device × computer) | None → Waiting for OK → Can use (in person / remote); later: Can't confirm right now · Removed | `unpaired`, `pending`, `local` / `account`, `leaseExpired`, `revoked` |+| Use: connection | Connecting · Online · Computer offline · Offline | `Connection` |+| Network role | Not in a network · Member · Admin · Creator | `Role` (`owner` becomes Creator) |++Words retired with this design:++- **Signed-out mode**, the phone's local context.+- **`owner`** in three senses: a computer's account is "in your account", a network's first member is the Creator, and the manager is the manager.+- **`local`** in four senses: loopback stays loopback, QR-paired devices are "in person", the signed-out context goes, the desktop's own computer is "this computer".+- **"{name} can use"** in desktop settings, which lists computers managed over SSH; it becomes Manage.+- **master / slave** never appear in the UI; a managed computer may show "Managed by {name}".++## Not doing++- **Phones over SSH.** SSH grants Manage; a phone needs Use, which the encrypted channel already gives, revocable per device. Tailscale is the direct route.+- **Reverse SSH from a managed computer.** It would make the managed computer a manager of its manager. A managed computer that wants another computer's bots asks to use it, like a phone.+- **Locking a managed computer's settings.** It can't hold against the CLI, and the managed computer stays its own.+- **Managed computers managing others.** A guideline, not enforced: nothing records "I am managed", chains and cycles add no power, and the manager list lives in the app.++## Work++Phases, file-level steps, tests and risks: [require sign-in](../plans/require-sign-in.md).++| Order | Change | Status |+| --- | --- | --- |+| 1 | Delete the account from inside the apps (App Store 5.1.1(v), Google Play). The cloud already cleans up on Clerk's `user.deleted` | Not built: no client has it |+| 2 | Sign-out hands the key back (iPhone, Android) | Not built: iPhone erases locally only; Android tells only the computer it is connected to |+| 3 | Sign-in required in every app; the phone's signed-out pairings move into the account on first sign-in (with their device and push keys when the account context is new on that phone, otherwise a list to scan again). Builds without Clerk keep the signed-out context | Not built |+| 4 | Same-account QR: the cloud-signed account proof, the host recording each device's account, joining an unowned computer on first scan with a confirmation, short codes, the refusal message | Not built: QR pairs any phone holding the code |+| 5 | Changing accounts drops every old-account device; the move dialog's text says so | Not built: QR devices are kept today |+| 6 | The main-window line for an app and computer in different accounts; the phone's refusal text | Not built: Settings and the one-time dialog only |+| 7 | One-click host install over SSH, then **Add to account** on its own | Not built: shows a `brew` command to copy |+| 8 | Honor the 15-minute lease when the relay drops | Not built: account devices are refused until the cloud state syncs again |+| 9 | The renames above, in every client | Not built |+| 10 | Desktop apps as devices (encrypted channel), so one computer can use another's bots | Not built |++## Prior art (checked 2026-11-02)++- **Codex**: remote control needs a ChatGPT sign-in, and the phone still scans a QR from the computer; both must be in the same account and workspace, and the computer approves remote access before it shows the QR ([remote connections](https://learn.chatgpt.com/docs/remote-connections)). Headless machines sign in with `codex login --device-auth` and pair with a short code from `codex remote-control pair`.+- **OpenClaw**: no account. QR or setup codes first, "because that is what most people were trying to find anyway"; new remote devices wait for `openclaw devices approve`, and SSH-tunneled connections are trusted as local ([pairing](https://docs.openclaw.ai/gateway/pairing)).+- **Hermes Agent**: no official phone app; chat users pair with an 8-character code the owner approves; anyone who signs in to the web dashboard acts as the owner ([docs](https://hermes-agent.nousresearch.com/docs/)).diff --git a/docs/architecture/overview.md b/docs/architecture/overview.mdindex 6e008d47..d2a014b7 100644--- a/docs/architecture/overview.md+++ b/docs/architecture/overview.md@@ -75,6 +75,8 @@ Several computers per account are supported: the iPhone and Android apps pair se## Service boundaries+Who may reach a computer and how (sign-in, accounts, pairing, managing over SSH, and the names of each state): [connections and accounts](connections.md).+`cloud/` implements `/v1`, Clerk authentication, computer registration/claim, host-approved access, WebSocket relay and mailbox. `relay/` implements APNs registration tickets and push forwarding. [Remote protocol](../reference/remote-relay.md) defines wire details; [Cloudflare testing](../guides/cloudflare-testing.md) distinguishes these paths during acceptance.Remote screen uses the channel for signaling and WebRTC for media/input. Cloudflare Realtime TURN forwards encrypted media/input when a cloud connection cannot establish a direct WebRTC path. [Remote screen](../features/remote-screen.md) describes the helpers and current limitations.diff --git a/docs/plans/require-sign-in.md b/docs/plans/require-sign-in.mdnew file mode 100644index 00000000..443dfc0a--- /dev/null+++ b/docs/plans/require-sign-in.md@@ -0,0 +1,192 @@+# Require sign-in++Plan agreed 2026-11-02 for [connections and accounts](../architecture/connections.md): every app is signed in, every phone-to-computer link lives in one account, and QR stays as the in-person way to pair. Nothing here is built yet.++## Decisions++- **People sign in; computers join an account.** iPhone, Android and the desktop app require sign-in. The host, the TUI and the CLI never sign in.+- **QR stays.** It is the in-person way to pair, and the only path where the cloud never sees a key. In the last 60 days, 363 people paired by QR and 234 through the account. Codex does the same: it requires sign-in, and the phone still scans a QR, with both devices in the same account.+- **One account per link.** A phone may use a computer only when both are in the same account (phase 2).+- **Headless computers never sign in.** A computer that isn't in an account joins the account of the first signed-in phone that scans it, after the computer confirms (phase 2). There is no `codync-host login`.+- **A managed computer keeps all its own settings.** "Managed computers don't manage others" is a guideline only, not enforced.+- **The desktop app may be signed in to an account other than its computer's.** It is asked once whether to move the computer; after that, one small line in the main window says so.+- **When a host changes the account it belongs to, every device of the old account is dropped**, QR-paired ones included (phase 2). Explain it in those words: the host changed its account, not the app or the phone. Networks are untouched: membership is between hosts, granted by invite, and has its own removal and rules.+- **Builds without Clerk** (no publishable key: source builds, third parties) keep today's signed-out context. It stays only for them and as the migration source; shipping builds never show it.++## Phases++| Phase | Ships | Touches |+| --- | --- | --- |+| 1 | Sign-in required everywhere, signed-out pairings moved into the account, sign-out hands the key back, delete account in the apps, the desktop's account-mismatch line | iPhone, Android, desktop, a small host method, docs |+| 2 | Same-account pairing: account proof on QR, unowned computers join on first scan, refusing other accounts, a host changing its account drops the old account's devices | cloud, host, every client |+| 3 | VPS convenience: one-click host install over SSH, joining the account afterwards on its own, headless hints, short pairing codes | desktop, host, cloud |+| Later | 15-minute lease grace, renames, desktop apps as devices | — |++Each phase is one release with a minor version bump. Phase 1 needs no `minApp` change. Phase 2 does; see below.++## Phase 1: require sign-in++### 1. Delete the account in the apps++App Store 5.1.1(v) and Google Play require in-app deletion for any app that creates accounts. No client has it today.++- **Where:** the account sheet on iPhone (`AccountSwitcherView.swift`) and Android (`AccountSwitcherView.kt`), under **Sign out**; the desktop account menu (`PanelMenus.tsx`).+- **Confirmation dialog**, title "Delete your Codync account?", message: "Your account, its list of computers and every device's access through it are deleted. Your computers keep their bots and chats. This can't be undone." Actions: **Delete account** (destructive), **Cancel**.+- **Steps:**+ 1. Hand back the key, the same way as signing out (section 2).+ 2. Delete the user in Clerk:+ - iOS: `clerk.user.delete()` (ClerkKit `User.delete()`).+ - Android: `User.delete()` from `com.clerk.api.user`.+ - Desktop: FAPI `DELETE /v1/me`, through `apps/desktop/src/main/account.ts`.+ 3. Erase this account's local data, the same as signing out.+- **Cloud: no change.** Clerk's `user.deleted` webhook already revokes every grant, cancels pending requests, removes the account's computers from it and deletes their icons (`cloud/src/routes/webhooks.ts`).+- **Clerk setting:** "users can delete themselves" (`user_settings.actions.delete_self`) is on in the development instance. Check it is on in production before the release.+- **Google Play** also wants a web address for deletion requests: add `codync.dev/delete-account`, listing the in-app steps and a contact address.++### 2. Sign-out hands the key back (iPhone, Android)++Today iPhone erases only local data, and Android tells only the computer it is connected to. New order, in `AppStore.signOut()` (iOS) and `AccountStore.signOut()` (Android):++1. **Computers this phone can reach:** call the new host method `forgetDevice`. It removes the caller's own device row and push tickets.+ - Hosts older than this release answer "unknown method"; then call `unregisterDevice`, which stops the push tickets only.+ - The device key is erased right after, so a row left on an older host is unusable.+2. **Cloud:** `DELETE /v1/devices/{id}` for this phone's own device. Find the id the way `CloudClient.revokeDeviceAccess` already does. This revokes every grant and pending request, and hosts drop the device on their next sync. Add `CloudClient.revokeThisDevice()` and its Android twin.+3. **Clerk:** sign out, switch context, erase (as today).++The two calls are best effort, with a short timeout each. Signing out never fails because a computer or the cloud is unreachable.++**Host (`host/src/api/remote.rs`):** `forgetDevice` is for a device caller only. It removes `caller.device_key()` from devices and push tickets and emits `devices` so the desktop list updates. It is additive, so `minApp` doesn't change.++### 3. Sign-in gate++| Clerk | State | Shown |+| --- | --- | --- |+| Configured | Restoring (`isReady == false`) | The launch splash. The last active context stays loaded, as `AppStore.init` already does, so an offline launch keeps working |+| Configured | Ready, signed out | The sign-in screen |+| Configured | Signed in | Today's flow: pairing when there's no computer, else the tabs |+| Not configured | — | Today's flow, signed-out context |++**iPhone (`RootView.swift`, `WelcomeView.swift`)**+- `WelcomeView` keeps the crew, the chat glimpse and **Watch the demo**.+- With Clerk configured, **Get started** is replaced by `SignInButtons` (Apple, Google) as the primary actions.+- The pairing screen's **Skip** stays: a signed-in user may look around before pairing.+- When the signed-out context has computers, one more line appears: "Sign in to keep using your {n} computers. They move into your account; you won't need to scan again."+- `RootView`'s condition becomes "configured and ready and signed out" instead of `!onboardingCompleted && !welcomed`. Signing out of the last account lands back on this screen.+- `AccountSession.signIn` without Clerk is unreachable once the buttons are hidden. Its message "You can continue using local pairing" goes.++**Android (`WelcomeView.kt`, the root in `CodyncApp.kt`)**+- The same screen and the same rules.+- `NativeAccounts.configured` stands in for `isConfigured`.++**Desktop (`ChatWindow.tsx`, `AccountWelcomeView.tsx`)**+- With Clerk configured, **Continue on this Mac** (the button and the skip link) goes, and the welcome shows only **Continue with Apple** / **Continue with Google**.+- `onboarded` alone no longer opens the chat window. The welcome shows whenever the app is configured, ready and signed out, so signing out from the account menu returns to it.+- The host keeps running while signed out, and so do the tray and menu bar.+- Builds without Clerk keep **Continue on this Mac**.++### 4. Move signed-out pairings into the account++Runs on iPhone and Android when an account becomes active and the signed-out context holds computers or a device key. It runs before that account's stores and identity load: `AppStore.switchAccount` and `AppStore.init` on iOS, `loadContext` on Android.++| This phone's account context | What happens |+| --- | --- |+| **New** (no device key, no computers) | Everything moves: the device and push keys, the computers, order, drafts, shortcut lead, widget snapshot. Hosts see the same key, so nothing is paired again and push keeps working |+| **Already used** (has its own key) | The computer lists merge (the account's entry wins for the same id). Computers paired only with the signed-out key are refused by their hosts; they show the existing "pair again" state (`isStale`) |++After either case the signed-out context is erased, and an analytics event `signed_out_pairings_moved {computers, keys: moved|rescan}` is sent (added to [analytics](../features/analytics.md) and both apps).++**iOS**+- `SharedStore.Context.adopt(from:)` in the Kit:+ - Moves the Keychain items `com.pokai.Codync.device-key` / `push-key` from account `local` to the context id.+ - Moves the `UserDefaults` names in `Context.names` to their `account.<id>.` keys.+ - Moves `ActivityIconCache`.+ - Drops `codync-mirror-local-*` caches, which rebuild.+- Unit tests in `CodyncKitTests` cover both cases.++**Android**+- `LocalStore.adopt(from)`:+ - The identity is sealed with a per-scope Keystore alias and AAD, so the seeds are decrypted with the old key and sealed again under the new scope.+ - Every other file in the folder is copied.+ - In the merge case only `computers.json` merges.+- Unit tests cover both cases.++### 5. Desktop: computer in another account++- **Logic:** a pure function next to `mayOfferMove` in `lib/auto-claim.ts`, `accountMismatch(host, userId)`. It returns one of three values:+ - `other {email}`;+ - `none {reason: cloudOff | privateRelay | keptOut}`;+ - `null` when the accounts match.+ Tested in `auto-claim.test.ts`.+- **One line** in the sidebar footer (`SidebarFooter.tsx`), caption size and secondary color, for example "This computer is in a•••@gmail.com's account". It takes no space when there's no mismatch.+ - Clicking it reopens the move choice (`MoveComputerPrompt`), even after *Keep it there*. For `none`, it opens Settings → Computers.+- **The move dialog** stays as it is in this phase. Its "QR-paired devices keep access" text changes in phase 2.++### 6. Docs and release++- **User manual**+ - `getting-started.mdx:73` and `remote-access.mdx:31`: drop "No account is needed".+ - `linux-servers.mdx`, "Pair your phone": the phone must be signed in.+ - Add account deletion to the account page.+- **Privacy policy** (`web/app/privacy/page.tsx:40`): "Codync works without an account" no longer holds. The maintainer reviews the new wording.+- **Repo docs**+ - `connections.md`: the work table.+ - `remote-relay.md` §3: the phone's contexts.+ - `analytics.md`: the new event.+- **WhatsNew** (iOS and Android, zh-Hant and en-US): sign-in is now required; your computers come with you; deleting your account.+- **App Review notes**: reviewers sign in with Sign in with Apple. The account features are remote access requests, computers across phones, cloud assistants and screen relay (answers 5.1.1(v): why sign-in is needed). The existing pairing demo video stays.+- **Version:** minor bump (2.35.0 from 2.34.2) in every place [versioning](../../CLAUDE.md) lists. The host changes too, because of `forgetDevice`.++### Tests and end-to-end++**Unit tests:** the Kit (`adopt`, both cases), Android (`LocalStore.adopt`), desktop (gate and `accountMismatch`), host (`forgetDevice` removes only the caller).++**End-to-end** on the iOS Simulator, the Android emulator and the desktop `npm run dev` sandbox, with the dev Clerk test accounts (`npm run phone-account`):++| Check | Expected |+| --- | --- |+| Fresh install | The welcome shows only sign-in. Signing in leads to pairing, and a QR pair works |+| Upgrade | With the previous build signed out, pair by QR. Install this build: the gate counts the computer. Sign in: the computer is there and connects without scanning, and push still arrives |+| Merge case | Sign in, sign out, pair signed out, sign in again: the signed-out computer shows "pair again" |+| Sign out | The computer's device list drops the phone, and the cloud lists the device as revoked |+| Delete account | The test user is gone in Clerk, and the computers leave the account (`--prune` cleans up) |+| Desktop | Signed out shows the welcome with no skip. Sign out returns to it. Signed in to a second test account, the footer line shows and reopens the move choice |++### Risks++- **Signed-out regulars may leave.** That is 84 iOS and 9 Android users active on 3 or more days in 30 days. Watch the gate's sign-in rate (`sign_in_started` → `signed_in` from the gate screen) for two weeks after the release.+- **A Clerk outage** stops new installs at the gate. Existing sessions load from the Keychain and keep working.+- **App Review** may question requiring sign-in when QR alone works. The review note above answers it.++## Phase 2: same-account pairing++**Account proof**+- The cloud signs a short-lived device certificate `{deviceKey, userId, exp}` with its own Ed25519 key (`POST /v1/devices/certificate`). It publishes the public key at `/v1/keys`.+- A host pins that key when it joins an account and keeps it with the owner. Checking a certificate is a signature check, so it works offline, with the cloud off or on a private relay.++**`pair` takes the certificate**++| The computer | Result |+| --- | --- |+| Has an owner | The certificate's `userId` must equal the owner. Otherwise the error is `otherAccount`, with the owner's masked email |+| Has no owner | The computer confirms first. The desktop shows a dialog: a new `pairingRequest` event and a `decidePairing` method. `codync-host pair` and the TUI ask `y/N` with a matching code. After that the host joins the phone's account through a new host-signed route that takes the certificate, and pins the cloud key |++**Each device records its account.** Devices get `account_user_id`. When the host changes the account it belongs to (joining one, moving, or leaving with **Remove from account**), devices of any other account are dropped. The move dialog's text then reads: "Every device of {email}'s account loses access." Networks stay as they are: a computer handed to someone else is taken out of a network by the network's creator or an admin, like its SSH key is taken off the manager.++**Phones:** send the certificate when pairing, and explain `otherAccount`: "This computer is in a•••@gmail.com's account. Move it to your account in Codync on that computer, or sign in with that account."++**Compatibility:** apps older than this release can't send a certificate. A host refuses their QR pairing with `unsupportedVersion` ("Update Codync"). That is a new requirement on the phone, so `minApp` rises with this release and [the release gate](../reference/compatibility.md) holds it until both stores have the apps.++## Phase 3: VPS convenience++- **One-click install over SSH** (`apps/desktop/src/main/ssh*.ts`):+ - On `notInstalled`, **Install** runs `install.sh --host-only` and `codync-host install` over the existing SSH connection, with a new `installing` SSH state.+ - `loginctl enable-linger` needs sudo. When it fails, the card shows that one command to run. It replaces today's `brew` command, which fails on Linux.+- **Joining the account after install:** the manager app's **Add to account** runs on its own, because installing shows the intent.+- **Headless hints:** `codync-host cloud` and the TUI account screen say which account the computer is in, or how to add it ([connections: headless](../architecture/connections.md#headless-computers)).+- **Short pairing codes:** `codync-host pair` also prints a code like `QRTX-4821`, which the host registers with the cloud as a pairing offer. The app resolves the code to the pairing link. The terminal's matching code catches a cloud that swaps keys.++## Later++- Honor the 15-minute lease when the relay drops; today account devices are refused until the cloud state syncs again.+- Renames: `local`, `owner`, the desktop's "{name} can use".+- Desktop apps as devices (the encrypted channel on the desktop), so one computer can use another's bots.