How it works
The web UI is the remote entry point for the desktop assistant: all AI processing, session storage, and file operations happen inside your own desktop client (the pi-agent sidecar). Once remote access is on, the desktop serves the web UI (HTTP) and the conversation channel (WebSocket) on the same port — no separate web deployment needed.First pairing
1
Turn on the remote gateway
Settings → Remote access → enable the gateway.
2
Scan or enter the pairing code
Scan the QR code on the settings page, or open the shown address
(e.g.
http://192.168.1.5:8787) — the pairing code is pre-filled. You can also type
the 6-digit code manually.3
Trade the pairing code for a token
Pairing issues a long-lived token, so you don’t need it afterwards. On the desktop the
token is encrypted at rest in SQLite; in the browser it lives in localStorage
(key
pi.remote). The pairing code exists only in memory and expires when the gateway
restarts; five wrong attempts lock that connection (you can “rotate” it on the desktop).Disconnects and recovery
- Reconnect with exponential backoff starting at 3s, capped at 30s; mobile retries immediately when returning to the foreground.
- After reconnecting, the client realigns to a desktop snapshot: transcripts, in-flight replies, queued messages, and pending approvals are filled in. Snapshots are authoritative — no promise of frame-by-frame replay.
- Messages sent while offline go into a local outbox and are replayed on reconnect; the
gateway deduplicates by
requestId, so nothing executes twice. - If the desktop revoked the token, only re-pairing helps.
Four network paths
The desktop gateway only listens on the local machine, so something must make it reachable:On the same Wi-Fi, scan the QR code or open the address shown on the settings page.
On Windows, the firewall prompt must be allowed the first time.
Settings → Remote access → “Public access”, one switch: the app launches cloudflared
itself (downloads and verifies it if missing), gets a temporary public address, and
needs no Cloudflare account. The address changes each start; stopping the gateway
tears the tunnel down.
Create a named tunnel and point it at
http://localhost:8787 — see the cloudflared
commands in docs/remote-access.md.Both the desktop and the device sign into the same Tailscale account and use the
private network address over WireGuard.
ws://<IP>:8787/ws; see the header comment in apps/electron/main/remote.ts.
Security notes
What the remote web client can do
Abort is global: aborting on the web also interrupts the desktop reply, and vice versa.
SSH remote projects
Beyond “desktop execution + remote viewport” there is another remote shape: local runtime + remote executor. The agent loop, model calls, UI, and sessions stay local;bash/read/write/edit tool calls go over the system ssh command to the
remote machine. No daemon is deployed — the remote only needs sshd and the code.
- Sessions with a remote target route tool execution through
ssh(no extra dependency; ProxyJump,~/.ssh/configaliases, and agent auth come for free). Connection reuse usesControlMaster. - Keys never reach the sidecar: key/agent auth is read by the ssh CLI from
~/.ssh/; password auth goes through ssh2, with the password decrypted and injected by the main process only (the renderer sees a “has password” flag). - The approval gate stays in the sidecar: remote commands still pass the approval levels, and write roots converge on the remote project directory with checks on both sides.
- Remote sessions degrade honestly: sandboxing and per-file checkpoints are skipped; the local file tree, Git panel, and local directory picker are hidden; remote git snapshots go over ssh and fall back to “no git info” on failure.
Mobile app
Stack
Expo + React Native +
@assistant-ui/react-native. It reuses the desktop gateway’s
/ws protocol — the same origin as the browser web client, not a separate client.Dev commands
Start the desktop remote gateway and allow LAN access first, then:
bun run dev:mobile · bun run typecheck:mobile ·
bun run test:mobile · bun run build:mobile:web.apps/mobile/node_modules
(install.hoistingLimits = "workspaces"): RN pins a specific react version, so the two
sides keep separate copies to avoid a double Metro instance.
The agent always runs on the desktop
This is what remote access means in practice: model calls, tool execution, and file I/O all happen in the desktop sidecar. The phone is a viewport, not a degraded second implementation. Screen off, backgrounding, or losing Wi-Fi does not affect work running on the desktop; on reconnect you resume the same turn.Today approval cards appear on the client you are using. Starting on desktop and
approving on desktop is safe; approving on the phone requires knowing exactly what you
approve. This layer trusts the paired device rather than re-authenticating every time.
Not there yet
The real gap in mobile is “leaving the computer”; currently missing:- Push notifications (task done, waiting for approval, automation results);
- Biometric unlock and token rotation;
- Offline drafts and queued sending / stream resume on weak networks;
- Narrow-screen polish (gestures, attachment picking, session list layout).
Next
See which layer each capability runs in.
