# Run AI Coding Agents on Remote Linux Servers

> A single Canban desktop or mobile client connects directly to your local Mac (`This Mac`) and one or more remote Linux or macOS `canband` hosts with **mandatory `Noise_XX` end-to-end encryption and zero relay servers** — over direct LAN/VPN TCP, optionally paired with **Tailscale** (zero-QR WhoIs auto-auth) or managed **SSH** tunnels.

## Simultaneous multi-host & offline editing with 3-way sync

Each host runs a self-contained `canband` + local `herdr-core` (`hc`) pair owning its own SQLite WAL database, per-host encrypted Vault, Projects, Cards, Workflows, Scheduler, and Git worktrees:

- **24/7 Autonomous Progression**: When your laptop sleeps or goes offline, remote `canband` hosts keep running agents, collecting reports, executing FIFO Queue Merge, and polling linked GitHub repositories.
- **Push-Based `HostRegistry` & Notifications**: `Canban.app` merges local and remote Projects into one `HostRegistry` subscribed to async Tokio `app.subscribe` push streams (eliminating fixed polling intervals), routing operations by `host_id` and surfacing remote `Needs you` / `Updates` items in `⌘I`.
- **Offline Editing & 3-Way Sync (`canban-sync`)**: Cached remote snapshots (`<local-home>/cache/hosts/<host_id>.json`) remain **editable while offline**. Create Cards (`Local` badge), edit titles/bodies, post `@agent` or plain comments, move stages, and resolve/archive Cards into a durable per-host outbox (up to 500 ops), while a 64 MiB per-host LRU read cache retains Card timelines and cached read-only Git diffs. On reconnect, queued mutations replay FIFO with idempotent `request_key`s—auto-merging disjoint field changes and opening the `Sync` modal (`Use server`, `Use mine`, `Edit merged`, `Retry`, `Discard`) if the same field changed on both sides. Online-only gates, delivery, and live PTY input re-enable automatically on reconnect.

## Installing headless Linux canband

On headless Linux (`x86_64` or `aarch64`) servers without a desktop session, install standalone `canban` (no GTK4 or GStreamer required) and register a persistent `systemd --user` service:

```sh
curl -fsSL https://canban.dev/install.sh | bash -s -- --headless
canban service install --tailscale --port 7680
canban service status
```

`canban service install` enables `loginctl enable-linger` when available so user services and active `herdr-core` PTYs persist across logouts. Tailscale is optional: to bind any LAN, WireGuard, ZeroTier, or custom interface directly without Tailscale, run `canban serve --listen <ip>:<port>` (all TCP traffic is end-to-end encrypted by default).

## Direct Noise_XX E2EE, X25519 public-key auth & optional Tailscale / SSH

Canban uses a direct, relay-free transport (`canban-transport`) that encrypts and mutually authenticates every TCP connection end to end:

- **Mandatory `Noise_XX` End-to-End Encryption (Zero Relay Servers)**: Every TCP connection starts with the `CBN1` wire preface followed by a mutual `Noise_XX_25519_ChaChaPoly_BLAKE2s` handshake (pure Rust `snow`, zero silent plaintext downgrade — legacy plaintext clients receive `-32002` and disconnect). Once established, JSON-RPC calls, `app.subscribe` push streams, live `herdr.connect` PTY relays, and Global Secrets replication all multiplex inside a single encrypted `yamux/1` stream. Secrets remain encrypted at rest in each host's SQLite `vault_entries` under `<CANBAN_HOME>/vault.key` (`XChaCha20-Poly1305`) and never touch `.outbox.json`.
- **X25519 Public-Key Auth, Single-Use Pairing & Host Key Pinning**: Servers persist a static X25519 keypair in `<home>/noise.key` (`0600`) and clients persist their static keypair in `client_noise.key` / `CredentialStore`. Run `canban pair [--port 7680]` to issue a 5-minute single-use pairing URI `canban://<addr>:<port>?pk=<server_pubkey>#pair_...` (stored in `pairing_codes.json`). Non-Tailscale TCP endpoints strictly require `?pk=<base64url>` and verify the server's static key before Noise Message 3 (aborting on mismatch without leaking client identity or consuming the code). Authorized client keys are stored in `<home>/authorized_devices.json` (`0600`) and managed live via **Settings → Hosts** or `canban device list` / `invite` / `authorize --pubkey <b64> --name <name>` / `revoke <id>`.
- **Optional Tailscale WhoIs Auto-Auth & On-Demand Tailnet Discovery**: When optionally paired with Tailscale (`canban serve --tailscale`, persisting `"trust_tailscale_self": true` in `<home>/config/server.json`), desktop (`Connect a Machine → Tailscale`) and iOS/Android clients on the **same personal Tailscale account** connect directly (even via bare `host.ts.net` or `100.x.y.z` with first-connect TOFU key pinning) verified server-side via `tailscale whois --json`. Tagged nodes and shared-in nodes (`IsShareeNode`) are rejected automatically; set `"trust_tailscale_self": false` to require explicit pairing everywhere. Active WhoIs sessions appear in **Settings → Hosts** with a `Tailscale` badge and `Managed in Tailscale Admin`. Connected clients can also invoke `host.discover_canban` on demand (never background-polled) to find sibling `canband` hosts across the Tailnet.
- **Managed SSH Tunnel Fallback**: For pure-SSH hosts without Tailscale or direct TCP access, `Canban.app` discovers `~/.ssh/config` peers in **Connect a Machine** and manages a background `ssh -L` Unix-socket forwarder into a mode-`0600` local socket directory.

## Built-in Diagnostics & remote daemon upgrades

Open **Settings → Diagnostics** to verify and repair local or remote hosts end to end:

- **Transport & Latency**: Socket, direct `Noise_XX` + `yamux/1` TCP (LAN/Tailscale), or SSH tunnel state, RTT (`ms`), and reconnect history.
- **Canban Service & Storage**: Daemon PID, platform, version, `DESKTOP_API` compatibility, `systemd --user` / `launchd` state, and SQLite DB/WAL sizes.
- **Herdr & Toolchain**: Resolved `hc` binary, Core ID, active PTY count, `git`, `python3`, `tailscale`, and resolved paths for enabled Agent profiles.
- **Live Logs & Updates**: Stream `server.log` and `updater.log`, or trigger a remote `update.daemon` directly from the UI when `ApiMismatch` is detected.

## Frequently asked questions

### Do remote coding agents pause when I close my laptop?

No. Each remote Linux host runs its own canband daemon and local herdr-core (hc) supervisor, so coding agents, tests, FIFO Queue Merge, and GitHub polling continue 24/7 while your laptop sleeps.

### How does Canban encrypt and authenticate remote connections?

Canban connects directly to your host with zero relay servers and wraps every TCP connection in mandatory Noise_XX_25519_ChaChaPoly_BLAKE2s end-to-end encryption (zero plaintext downgrade) with yamux/1 multiplexing and pure X25519 public-key authentication. Non-Tailscale pairing URIs pin the server public key (?pk=...) before completing the handshake and authorize devices via 5-minute single-use pair_... codes stored in authorized_devices.json. Optionally, devices on the same personal Tailscale account can authenticate automatically via tailscale whois (trust_tailscale_self: true, rejecting tagged or shared-in peers) with first-connect host-key pinning and access managed in Tailscale Admin.

### Can I keep creating or editing Cards if my laptop loses connection to a remote server?

Yes. With canban-sync, cached remote Projects stay editable offline: you can create Cards, edit titles or descriptions, post comments, move stages, and resolve Cards into a durable 500-op outbox. When the host reconnects, Canban replays changes in order, auto-merges non-overlapping fields, and lets you resolve any same-field conflicts in the Sync dialog.

### Can I connect to a Linux server that does not have Tailscale installed?

Yes. Tailscale is completely optional: you can connect directly over LAN or any private VPN using canban serve --listen with mandatory Noise_XX E2EE and ?pk= host-key pinning, or use Canban's managed SSH tunnel fallback (background ssh -L Unix-socket forwarding) and SSH bootstrap from Connect a Machine.
