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: explain memory storage and update recovery
leepokai92fe1d7f47e4
diff --git a/AGENTS.md b/AGENTS.mdindex fe594620..f1f93565 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -71,6 +71,7 @@ Use Swift Testing (`@Test`, `#expect`), Rust unit tests, `node --test` in the de- One logical change per commit. Don't mix unrelated work, and stage only your own hunks when others have uncommitted changes in the tree.- Breaking changes: `!` after the type/scope, or a `BREAKING CHANGE:` footer.- English only.+- Thank external contributors when responding to their PRs. After merging an external PR, leave a brief thank-you comment acknowledging their contribution and confirming the merge.PRs should explain behavior changes, link relevant issues, list validation performed, and include screenshots for UI changes. Fill the template's *What's New* bullets (zh-Hant + en-US) for iOS changes users can see; they become the App Store notes when `apps/ios/WhatsNew.md` has no section for the release. Update affected documentation in the same change.diff --git a/CLAUDE.md b/CLAUDE.mdindex 2b7f7664..4655bb00 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -24,11 +24,7 @@ Bot-based remote for coding agents: persistent named bots on your computer, mess- UI principle: buttons an icon can express are icon-only (with tooltip / accessibility label); text only where an icon would be ambiguous (approval choices).- UI controls default to the shared custom components. Explicit exception: iOS BotListView and ThreadView use native navigation/toolbar items and automatic back navigation for system Liquid Glass, as specified in `docs/design/ui-conventions.md`. **iOS menus are always the system ones**: tap menus through `DropdownMenu`/`ChoicePicker` (native `Menu`), long-press through `.contextActions` (native `contextMenu`). Never hand-build a dropdown on iOS: a custom overlay lands in the wrong place (sheets, scroll views, the composer's + menu). The desktop app's menu bar/tray menu is the system menu. Keep system authentication and widget containers native. On iOS `.codyncSheet` presents the system sheet (grabber, swipe down). Outside these exceptions, avoid: no `Menu`/`Picker`, `.switch` toggles, `Form`/`List` styling, `confirmationDialog`/`alert`, `ProgressView`, `.sheet`/`.popover`/`.fullScreenCover`, `.toolbar`/navigation bars, `TabView`, `ContentUnavailableView`. Use `apps/ios/Kit/Sources/CodyncUI/Controls.swift` + `Chrome.swift` (`.codyncSheet`, `ModalHeader`, `ScreenHeader`, `TabBar`, `.codyncDialog`, `ToggleStyle.codync`); on the desktop, `apps/desktop/src/renderer/components/` (`Sheet`, `Dialog`, `AnchoredMenu`, `ModalHeader`, `Controls.tsx`, `Icon` for SF Symbols). Every tap that shows/hides something animates (`Motion`). Anything with a background fill gets no border line.- `host/` — **codync-host** (Rust, macOS + Linux + Windows; platform differences in `service/` and `shell.rs`). Detects installed harnesses (`agent/backends.rs`: login-shell PATH + known dirs) and the ACP registry (`agent/registry.rs`, cached in `~/.codync/registry.json`, binaries under `~/.codync/agents`). Drives agents over **ACP** (JSON-RPC on stdio, hand-rolled in `agent/acp.rs`, updates kept as `serde_json::Value` so new adapter variants never break parsing). One actor per bot (`agent/bot/`) owns the agent process + session and maps `session/update` onto transcript entries.-- **Chat ≠ session**: a bot is one endless transcript (SQLite `entries`, ordered by `seq`); the ACP session underneath is resumed with `session/load` or replaced by *New session*.-- **Group chats and threads** are host features every client drives through the same methods (`send` with `threadId`, `thread`, `createBot {kind: group}`); clients never route, parse mentions or count replies themselves. A group is a roster row whose members answer in their own sessions (Grok Bot's room turns); a thread on a bot's message is a forked session: [docs/features/groups-and-threads.md](docs/features/groups-and-threads.md).-- Bot collaboration: built-in `team` MCP (`chat/team.rs`) lists visible bots and asks one for a reply or sends it an independent message through its actor queue. Asks are separate turns, cycle-checked and cancellable; native subagents stay with the harness. See [docs/features/bot-collaboration.md](docs/features/bot-collaboration.md).-- **Context & memory** (Grok Bot's design): frozen instruction snapshot per session + compaction epoch (Claude gets it as a system prompt), profile edits as update blocks, per-bot memory files written by a keeper agent, busy-time messages folded into one turn, interrupted turns resumed: [docs/features/context-and-memory.md](docs/features/context-and-memory.md).-- **Chat shows only**: user messages, the bot's messages (`data.final`: each `send_message` call from the built-in `chat` MCP, Grok Bot's way; a turn that sent none falls back to its last text), permission cards, notices. Nothing streams into a bubble; narration, thoughts, tool calls, plans are trace entries (Full conversation sheet): [docs/features/chat-messages.md](docs/features/chat-messages.md).+- Chat/session ownership, groups, collaboration, Engram memory and visible-message rules: [conversation runtime](docs/architecture/conversation-runtime.md).- **Sync**: every mutation stamps a global `rev`. Clients call `GET /events?since=<rev>` (catch-up in rev order, then live). Emission happens under `Hub::emit_lock` so events leave in rev order. Clients upsert by id; never skip undecodable events (the iOS app rewinds to rev 0).- API: `POST /api/<method>` + SSE with the bearer token (`~/.codync/token`) is **loopback only** (desktop app, SSH tunnel, local helpers). Phones and other remote clients use the E2E channel (`/channel` direct, or the Cloudflare relay). Default port **19222**.- Remote access (Cloudflare relay primary, direct LAN/Tailscale alternative, accounts, SSH, public routine webhooks queued in the relay §7.8): [docs/reference/remote-relay.md](docs/reference/remote-relay.md).diff --git a/README.md b/README.mdindex fce387f3..ac817b4d 100644--- a/README.md+++ b/README.md@@ -141,6 +141,16 @@ Building the desktop app yourself: `cd apps/desktop && npm ci && npm run dev`.`codync-host install` also routes Claude Code's status line through `codync-host statusline` so live limits reach the host; an existing status line keeps working (it's wrapped, and restored on `uninstall`).+### If an update fails++Quit Codync completely and reopen it first; a downloaded update may still be waiting+for the old app to exit. If updating still fails, uninstall the app and reinstall+the latest version from [Releases](https://github.com/leepokai/Codync/releases/latest).+On macOS, stop/remove the old host service before replacing `Codync.app`.+**Keep `~/.codync` and Codync's settings folders** to retain your bots, conversations+and computer identity; do not use **Reset all data**, a cleanup utility, or Homebrew+`--zap` for this repair. Follow the [reinstallation steps](docs/guides/updates.md#recovering-from-a-failed-update).+## `codync-host`| Command | |diff --git a/docs/architecture/file-structure.md b/docs/architecture/file-structure.mdindex e9306c23..4a9c3fb1 100644--- a/docs/architecture/file-structure.md+++ b/docs/architecture/file-structure.md@@ -83,7 +83,7 @@ Codync/| SQLite transcript, bots, lanes and sessions | `host/src/store/` (`entries.rs`, `bots.rs`, `model.rs`, `devices.rs`, `schema.rs`) || Agent process, ACP, queue and session lifecycle | `host/src/agent/bot/` (`queue.rs`, `session.rs`, `turn.rs`, `updates.rs`), `acp.rs` || Group room turns / bot-to-bot requests | `host/src/chat/group.rs` / `team.rs` |-| Prompt snapshots and memory keeper | `host/src/chat/context.rs`, `memory/` (`facts.rs`, `extract.rs`, `keeper.rs`, `search.rs`) |+| Prompt snapshots and memory keeper | `host/src/chat/context.rs`, `memory/` (`engram/`, `manage.rs`, `read.rs`, `extract.rs`, `keeper.rs`, `search.rs`) || Identity, encryption and direct channel | `host/src/remote/identity.rs`, `crypto.rs`, `channel.rs` || Host cloud state and relay connection | `host/src/remote/cloud.rs`, `relay.rs` || Agent discovery, sign-in, setup terminal | `host/src/agent/backends.rs`, `registry.rs`, `auth.rs`, `term.rs` |diff --git a/docs/architecture/overview.md b/docs/architecture/overview.mdindex fa739e62..d05e5e9d 100644--- a/docs/architecture/overview.md+++ b/docs/architecture/overview.md@@ -28,7 +28,7 @@ The phone tries direct candidates first, with a 1.5-second connection race, then| Host signing and mailbox keys | `identity.json`, separate from SQLite || Loopback API bearer token | Host `token` file || Agent context and provider credentials | Coding harness on that computer |-| Long-term bot memory | Host `bots/<botId>/memory/` |+| Long-term bot memory | Host `bots/<botId>/engram/engram.db` (Engram) || Account users, computer ownership, devices and grants | `cloud/` D1 || Presence, host-signed ACL, offline encrypted mailbox | Per-computer `ComputerRelay` Durable Object || Phone remote-device signing and push keys | Keychain, partitioned by account context |diff --git a/docs/guides/environments-and-deployment.md b/docs/guides/environments-and-deployment.mdindex e9da5e8f..4aacf4d3 100644--- a/docs/guides/environments-and-deployment.md+++ b/docs/guides/environments-and-deployment.md@@ -22,6 +22,27 @@ The environment is chosen when building, never stored: the host compiles in its- **Production:** `main.plist` targets `https://api.codync.dev` with the Clerk production instance (`clerk.codync.dev`, Google sign-in through the `codync-auth` Google Cloud project, published). The root Worker is deployed with D1 `codync`, `CLERK_SECRET_KEY` and `CLERK_WEBHOOK_SECRET` (Clerk webhook endpoint `https://api.codync.dev/v1/webhooks/clerk`, `user.deleted`).- **Local:** Wrangler's `local` environment supports the isolated integration test and its test issuer. It is not a real Google sign-in test.+## Troubleshooting: a running host appears offline on another computer++Check the environment before resetting keys, pairing again, or removing an account computer. A healthy local host and an active relay connection only prove connectivity to **that host's configured cloud**. Development and production have separate account directories, grants and presence; signing in with the same Apple account does not join those environments.++Observed on 2026-10-09: MacBook-Pro-3 ran a local development build connected to `dev-api.codync.dev`, while the Mac mini ran a production build connected to `api.codync.dev`. Both hosts reported `registered: true` and `connected: true`. The MacBook's same `computerId` was online in development D1 and offline in production D1. The Mac mini's account list therefore correctly showed the old production record as **Offline**. This was an environment mismatch, not evidence of a stopped host or a duplicate identity.++Before testing account discovery, access approval, or cross-device computer order:++1. Run `codync-host cloud` on each computer and compare `url`, `registered`, `connected`, and `last error`. Use the installed app's bundled executable if the shell's host binary is not the one being tested.+2. Check `http://127.0.0.1:19222/health` (or the configured development port) for the running binary path, version and `computerId`.+3. Verify the desktop app and its host target the same environment, and the iPhone build targets that environment too. An identical version number or Apple login is not sufficient.+4. Use matching builds across the devices participating in the test, then refresh the account list. Local or SSH access working does not establish that their account clouds match.++### Separate Codync Dev app++Development and production now use separate app identities, data directories,+ports, service labels, URL schemes and notification destinations. They can run+side by side without sharing credentials, pairing grants or host keys. See+[Dev app isolation](dev-app.md) for build commands, resource names and signing+requirements. Use matching environments on every device in a cross-device test.+## Deployment procedureUse [cloud/README.md](../../cloud/README.md) for exact Wrangler commands and binding names. Select the environment before changing anything:diff --git a/docs/guides/updates.md b/docs/guides/updates.mdindex 515221e9..b2276288 100644--- a/docs/guides/updates.md+++ b/docs/guides/updates.md@@ -40,6 +40,59 @@ starts. An updater error during shutdown cancels that pending installation andrestores the host after the stop finishes; an installer exception also restoresthe host and leaves the staged release available to retry.+### Recovering from a failed update++If **Update to …** appears to do nothing, first quit Codync completely (on macOS,+**Codync → Quit Codync**, not just the window's close button). A downloaded update+may finish installing when the old app exits. Reopen Codync if it does not relaunch,+then check the version in **Settings → Updates**.++If it still fails, uninstall and reinstall the application from the+[latest release](https://github.com/leepokai/Codync/releases/latest).+Replace the application while keeping its data and settings. **Do not use Reset+all data, delete `~/.codync` (or a custom `CODYNC_HOME`), remove Codync's application+support/settings folders, or use a cleanup utility.** Those are data resets, not+update repairs; deleting the host's keys also changes its identity and requires+devices to pair again.++For a Mac installed from the DMG or one-line installer:++1. Quit Codync. Before moving the old app, remove its background host service:++ ```sh+ /Applications/Codync.app/Contents/Resources/codync-host uninstall+ ```++ This removes the service and restores the wrapped Claude Code status line;+ it does not delete the host's database or keys. If the app is installed+ elsewhere, use that app's path.+2. Move only `/Applications/Codync.app` to the Trash. Download `codync-macos.dmg`+ from the latest release and drag the new Codync app into Applications.+3. Open the new app. It reinstalls the host service. If the host remains stopped,+ run the new bundled host explicitly:++ ```sh+ /Applications/Codync.app/Contents/Resources/codync-host install+ /Applications/Codync.app/Contents/Resources/codync-host status+ ```++For a Homebrew app installation, quit Codync and use+`brew reinstall --cask leepokai/codync/codync`, then open Codync. The cask removes+the old service before replacement. Do **not** add `--zap`, which removes data.++On Windows, quit Codync and stop its bundled `codync-host.exe` with the `stop`+command before reinstalling the desktop app. On Linux, replace the AppImage or+reinstall the desktop package using the original installation method. For a+standalone host, run `codync-host stop`, reinstall using the original installer+or `brew reinstall leepokai/codync/codync-host`, then run `codync-host install`.+`codync-host uninstall` removes the background service, not the executable or+saved bots, so it is not a complete application uninstall.++After reinstalling, confirm the app version and that the computer reconnects.+Existing bots and pairings should remain when the original data and keys are+kept. Repair the app on the affected computer: an SSH-connected Mac mini must+be reinstalled on the Mac mini, not on the computer displaying its SSH entry.+### Desktop updater regression testsRun `cd apps/desktop && npm run typecheck && npm test`. The updater tests load thediff --git a/docs/screenshots/computer-access-2.12.0.png b/docs/screenshots/computer-access-2.12.0.pngnew file mode 100644index 00000000..d7863fddBinary files /dev/null and b/docs/screenshots/computer-access-2.12.0.png differdiff --git a/docs/screenshots/dialog-2.12.0.png b/docs/screenshots/dialog-2.12.0.pngnew file mode 100644index 00000000..f2b25996Binary files /dev/null and b/docs/screenshots/dialog-2.12.0.png differ