Skip to content

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.

docs: record why phones keep one account and how notifications must behave with several

leepokai2ce85723cad8
diff --git a/docs/architecture/connections.md b/docs/architecture/connections.md
index f21205b1..f871c820 100644
--- a/docs/architecture/connections.md
+++ b/docs/architecture/connections.md
@@ -55,6 +55,26 @@ The phone finds and pairs every computer itself. A computer the phone hasn't pai
- 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.
+## Accounts on a phone
+
+Decided 2026-11-02. A computer is in one account at most; a phone may know several, each with its own device key, push key, computers and drafts (iOS `SharedStore.Context`, Android `LocalStore`), so a computer never sees the phone's other accounts. One account is selected at a time.
+
+| What happens | On the phone | Computers and cloud |
+| --- | --- | --- |
+| The Clerk session ends on its own (expired, revoked elsewhere) | The sign-in screen; the account's key, computers and drafts stay. Signing in to the same account connects as before: no scan, no 6-digit check | Unchanged |
+| **Sign out** | The key is handed back and the account's data erased | The computers it reaches drop the phone (`forgetDevice`), the cloud revokes the device, push stops |
+| Using another account | Only after signing out: both Clerk instances stay single-session (`single_session_mode`) | As signing out. Back on the first account, each computer takes a scan (same account, no question) or **Ask for access** with the 6-digit check |
+
+Signing out hands the key back because it is the phone's one "this phone is done" button (selling, lending, someone else's account), and a key left behind keeps the computers pushing to it. Considered and not taken: a sign-out that keeps the key and only stops push, so the same account comes back without a check. The computers would keep listing a phone that left, and its key would stay on a phone that may have changed hands.
+
+**Multi-session stays off.** Turned on in Clerk, a phone would keep several accounts and switch without handing a key back. The apps already show the switcher and **Add account** then (iOS `authConfig.singleSessionMode`, Android `multiSessionModeIsEnabledFlow`), but no instance has run it. Before turning it on:
+
+- **Only the selected account's notifications show, the same on iOS and Android.** Signed in to B, nothing from A's computers. Android already drops them (`PushService.receive`: `ctx` isn't the active account). iOS shows them, text included: the Notification Service Extension opens any account's push with that account's key, and an extension can't drop a visible notification without Apple's filtering entitlement (`com.apple.developer.usernotifications.filtering`). Get the entitlement and drop it there when `ctx` isn't the active context. Unregistering the old account's push tickets at each switch (`unregisterDevice`) would miss computers offline at that moment.
+- Tapping another account's notification keeps doing nothing (iOS checks `ctx` in `userNotificationCenter(_:didReceive:)`); none should show anyway.
+- End to end with two accounts on the iOS Simulator and the Android emulator: add one, switch, switch back without a check, notifications only from the selected one.
+
+**Open:** after a session ends on its own no account is selected, so Android drops that account's notifications while iOS still shows them with their text.
+
## 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.
diff --git a/docs/design/push-and-live-activity.md b/docs/design/push-and-live-activity.md
index 1333b951..4fbc5e77 100644
--- a/docs/design/push-and-live-activity.md
+++ b/docs/design/push-and-live-activity.md
@@ -17,7 +17,7 @@ Updated: 2026-09-27. This describes the implemented notification contract and it
The encrypted title is limited to 80 characters and the body to 400 characters. The body is an excerpt of the agent's final answer, not a newly generated summary. System notification previews, text truncation, Focus, sounds and delivery timing remain controlled by iOS. There is no invented completion percentage or per-tool notification stream.
-Notification actions open the scoped conversation. Permission approval still requires the normal in-app permission card. An account mismatch does not navigate into another account. Notifications are grouped by computer plus bot. Muted and hidden bots do not alert. The existing host-wide suppression while an iOS event connection is open remains in place; independent foreground suppression for multiple phones is not implemented.
+Notification actions open the scoped conversation. Permission approval still requires the normal in-app permission card. An account mismatch does not navigate into another account. Only the selected account's notifications should show, on iOS as on Android: [accounts on a phone](../architecture/connections.md#accounts-on-a-phone). Notifications are grouped by computer plus bot. Muted and hidden bots do not alert. The existing host-wide suppression while an iOS event connection is open remains in place; independent foreground suppression for multiple phones is not implemented.
Each computer's card in Computer management has a Push notifications switch: off saves it with that computer on this phone and calls `unregisterDevice` on that computer only, so it drops its alert ticket while the others keep theirs (Live Activities are unaffected; Android saves the switch with each computer the same way). Settings → Notifications requests access or opens the system notification settings. Per-bot notification preferences remain in the bot editor. State → Live Activity controls automatic activity creation and shows system authorization. Turning it off ends this phone's activities. State → Dynamic Island shows the same switch: iOS renders one activity in both places and offers no island-only opt-out. Under the bot's row (above Review when the bot needs you), the Lock Screen card shows a progress line, four segments in the state's color that fill as the task moves (one while sending or queued, two while working, three when the bot needs you, four once it ends), the same line as Android's Live update. The expanded island centers the bot name and current step under the camera, between the avatar and the orb (both vertically centered), so no text reaches the island's 44 pt corners. Its bottom row shows the elapsed time (from `startedAt`, counted by the system) or, when the bot needs you, a Review button that opens the conversation.
diff --git a/docs/guides/accounts-and-ssh.md b/docs/guides/accounts-and-ssh.md
index c299e418..d4ec5f07 100644
--- a/docs/guides/accounts-and-ssh.md
+++ b/docs/guides/accounts-and-ssh.md
@@ -198,8 +198,10 @@ instance with bundle ID `com.pokai.Codync.ios` and its own callback
`apps/shared/Config/<env>.plist`. The repository configuration does not prove
that the corresponding Clerk Dashboard registration has been completed.
-To retain several accounts at once, enable multi-session support in the Clerk
-instance. The UI reads `authConfig.singleSessionMode`: with multi-session enabled,
+Both Clerk instances stay single-session: why, and what has to change before
+multi-session is turned on, is in
+[accounts on a phone](../architecture/connections.md#accounts-on-a-phone).
+The UI reads `authConfig.singleSessionMode`: with multi-session enabled,
it lists active SDK sessions and switches with `auth.setActive(sessionId:)`; with
single-session enabled, it asks the user to sign out before using another account.
Signing out passes the current session ID, rather than signing out all accounts.