Architecture · November 2026

One Window for Terminals on Every Machine: Fibo’s Multi-Host Architecture and Slow-Link Sync Design

Once you run more than a dozen Coding Agents (Claude Code, Codex, OpenCode) in parallel, terminal workflows quickly outgrow a single computer. Fibo is built around a simple premise: many machines, one window. Wherever a terminal runs, you open tabs, split panes with ⌘D, drag split dividers, type directly, and press ⌘J to jump to the next agent waiting for you across every machine. This post breaks down the five core architectural problems behind that experience: why we abandoned a dedicated remote UI after 11 seam bugs, how forwarding a Unix domain socket over a single ssh -L tunnel unified 85 native RPCs, how we decoupled 448 single-host state reads, and how we shrank workspace refreshes 5,400× from 3.59 MB to 660 bytes on a 54 KB/s link.

One Window for Terminals on Every Machine: Fibo Architecture Overview
Many machines, one window: the left sidebar groups every machine and highlights who is waiting; the right main area operates the active machine’s native tabs and split tree.

01 Protocol Choice: Why “Summary Cards + a Separate Remote UI” Fractured at the Seams

In Fibo’s single-machine architecture, terminals do not live inside the GUI window (fibo-app). They live in a persistent background daemon (fibo serve), while the window acts as a stateless client connected over a local Unix domain socket (workbench.sock). Before building desktop multi-machine support, Fibo already had a lightweight remote protocol designed for its mobile companion app (ssh host fibo remote --stdio), which summarized each terminal into a flat Card containing only its title, state, and working directory.

Flat cards are enough for checking status and approving prompts on a phone, but the desktop app requires full tab bars, arbitrary split trees, and 85 native RPC requests. Our initial attempt (PR #340) took the seemingly pragmatic shortcut: keep the phone card protocol and rebuild whatever UI pieces the desktop was missing—a remote start page, a remote main area, and a client-side remote split container.

Local Native UI vs Attempt 1 Remote Overlay UI
Local terminals use the native socket protocol (85 RPCs and host-persisted split trees); our first attempt (PR #340) stacked a phone-protocol overlay on top of the local workspace, triggering 11 seam bugs in a single day.

Because local and remote terminals ran on two different data models and two UI layers, behavioral divergence was immediate:

Worse, mounting the remote UI as an overlay on top of the local workspace created a fragile seam between two state machines. Automated review (Codex) flagged 11 bugs on PR #340 in a single day, every one of them at that seam:

Comparing existing developer tools confirmed the architectural lesson:

ProductWhere state livesConnection & protocol model
VS Code Remote-SSHRemote VS Code ServerLocal UI connects over SSH using the same protocol as local
Zed Remote DevelopmentRemote zed-remote-serverSpawns system ssh, sharing the native workspace model
WezTerm MultiplexingRemote mux serverConnects over SSH to a remote Unix socket; local and remote tabs coexist
iTerm2 + tmux -CCRemote tmuxTranslates tmux’s control protocol into native tabs (prone to seam bugs)

VS Code, Zed, and WezTerm all keep state on the remote machine and speak the exact same protocol locally and remotely. Translating a foreign summary protocol into native UI was the root cause of our seam bugs. We closed PR #340 and established our first architectural rule: one native protocol and one UI code path for both local and remote hosts.

02 Protocol Unification & Boundary Isolation: Eliminating Implicit Localhost Assumptions

Unlike VS Code and Zed—which install an isolated headless server (such as ~/.vscode-server) locked to the client version—Fibo has a stricter requirement: tabs and splits opened on a remote machine from your local window must appear live in that machine’s own desktop window too. Both windows must connect to the same fibo serve daemon.

Because Fibo already separates client and daemon over workbench.sock, we didn’t need a new protocol. OpenSSH natively forwards Unix domain sockets over a single connection:

ssh -N -o Compression=yes -o StreamLocalBindUnlink=yes \
    -L ~/.local/share/fibo/m/<id>/workbench.sock:<remote workbench.sock> remote

Every terminal pane opens its own stream over that single ssh -L tunnel. Once the window manages this forward automatically, all 85 RPC requests, tabs, and draggable splits work identically to local (PR #342).

Forwarding the Native Socket and Isolating 6 Localhost Assumptions
OpenSSH maps the remote workbench.sock locally so all 85 RPCs work unchanged; the real engineering work was isolating 6 implicit “localhost” assumptions in the client.

The prototype took an hour. The real engineering work was finding every place in the client that silently assumed the daemon ran on the same OS—none of which threw errors:

03 Decoupling View Chrome from Data Sources: Why the Sidebar Mutated

Moving from "one window per machine" to switching machines inside a single window exposed the largest structural coupling in the codebase: the Workbench struct held both one machine’s data (448 reads of self.workspace, 66 of self.store, 50 of self.layout.panes) and the entire window’s UI.

To avoid rewriting 448 call sites at once, our first multi-host switch (commit 12d9cea4) instantiated a complete Workbench per remote machine and delegated the entire window render to whichever host was selected.

Sidebar Jump Before and After Architectural Split
Left: Delegating the whole window to a remote Workbench caused the sidebar to mutate into a single-machine layout while maintaining two parallel SSH connections. Right: PR #349–#356 separated per-host data sources from per-window view chrome over a single ssh -L.

That shortcut immediately exposed two architectural flaws (shown above left):

Across PR #349 through #357, we split the architecture cleanly into two layers without touching the 448 internal self.workspace reads:

Per-Host Data Source (One per Machine)Per-Window View Chrome (One per Window)
Socket connection, request queue & backoff stateSidebar: multi-machine tree, filters, folding & scroll offset
Complete Workspace snapshot & delta baseOverview board, search palette & global ⌘J ordering
Terminal pane instances (layout.panes)Peek overlay, theme, font size & keybindings
Selected space, active tab & focus on that hostWhich machine the main area is currently showing

The top-level window always renders its own unified sidebar and passes the sidebar’s pixel width (beside) to the active host’s workbench, which draws only the right-hand main area (PR #349). Moving the card-projection rules into fibo_core::remote_cards (PR #353) allowed the sidebar to compute rows directly from each host’s native Workspace connected at startup (PR #352), eliminating the phone-protocol SSH link (PR #356, ~580 lines removed) and leaving one ssh -N -L connection per machine.

04 Slow-Link Sync Protocol: Content-Addressed Deltas from 3.59 MB to 660 Bytes

On a local Unix socket, pushing a revision counter and fetching a full 1.6 MB Workspace JSON takes under 10 ms. When our network link to the remote host dropped to roughly 54 KB/s, full-snapshot polling broke down in two ways:

Three-Stage Delta Sync and Kept Base Isolation on a 54 KB/s Link
Across PR #358, #362 (Brief), and #380 (BriefAll), refresh payloads on a 54 KB/s link shrank 5,400× from 3.59 MB to ~660 bytes while isolating local UI drag previews from the clean host base (Kept).

Layer 1: Stream Compression, Zero-Progress Timeouts & Adaptive Pacing (PR #358 / #362)

Enabling Compression=yes on ssh -L shrank the 3.59 MB payload to 893 KB on the wire (~11s instead of ~35s), and raising the daemon’s write timeout to 30 seconds of zero byte progress stopped mid-reply disconnects (PR #358). We also added adaptive pacing for remote refreshes: if a refresh takes T, the window waits min(T, 10s) before the next refresh so interactive typing always gets at least half the link.

Layer 2: Session-Level Content-Addressed Deltas & Production Data Skew (PR #362 Brief)

On our dev machine, 98% of the workspace JSON lived in sessions and session_contents. In PR #362, we introduced Brief(last_stamp, Request) so the daemon diffs sessions against an LRU ring of the last 16 snapshots it sent (using a 64-bit FNV-1a content hash rather than revision, which resets if the daemon restarts) and returns only changed sessions.

On the dev box, refreshes dropped from 1.68 MB to 14–22 KB. Yet when we deployed to the production remote machine and measured again, a refresh with zero session changes still transmitted 352 KB (81 KB compressed):

Largest top-level fields in restProduction remote size
terminals (677 historical & live terminal records)186 KB
task_logs81 KB
outcome_history66 KB
tasks39 KB
agent_launches36 KB

The dev box only had 4 terminals (rest < 3 KB); the production remote host had 677 terminals, making the un-diffed rest payload 352 KB on every poll.

Layer 3: Top-Level Field Hashing & Clean Base Isolation (PR #380 BriefAll)

Before writing item-level diffing for 677 terminals, we sampled the remote workspace 12 times over 2 minutes. None of those five fields changed once—they only mutate when a terminal opens/closes or a task finishes. Hashing each top-level field in rest and omitting unchanged fields (BriefAll, PR #380) was sufficient.

To prevent local UI mutations (such as live split-divider drag previews on self.workspace) from surviving across sparse replies where unchanged fields are omitted, the client stores an untouched copy of the host’s state (Kept) and applies deltas strictly onto Kept before handing a fresh copy to the UI. On the real remote host, a refresh dropped from 3.59 MB → 352 KB → ~660 bytes (~420 bytes compressed, a 5,400× reduction), completing in milliseconds on a 54 KB/s link.

05 Multi-Host Concurrency & OS Lifecycle: Input Leases, Live Handoff & Signal Inheritance

Three Systems Bugs That Only Surfaced on Real Machines
Undrawn background workbenches stealing input lease (#367), zero-downtime live handoff of 43 running terminals (--takeover), and macOS AppKit SIG_IGN inheritance across fork + exec (#360).

1. Multi-Window Input Lease & Visibility Gating (PR #367)

When both the remote machine’s own window and a local window view the same terminal, simultaneous typing would interleave keystrokes. Fibo enforces an exclusive input lease ("last-opened window takes input; the other shows Read only · click to take over"). Right after shipping that rule, launching the local window caused the remote machine’s own window to flip to read-only before the user ever clicked the remote machine. Why? Startup created a hidden background Workbench per machine to feed the sidebar, and its initializer attached to the remote’s first tab and claimed the input lease. Gating pane creation and lease acquisition on drawn_last_frame (PR #367) ensured undrawn background workbenches never steal focus.

2. Zero-Downtime Handoff of 43 Live Terminals (--takeover)

Upgrading both machines to BriefAll couldn’t interrupt the 43 live terminals running on the remote host. Launching the new binary with fibo serve --takeover transfers every live PTY file descriptor and scrollback buffer from the old daemon before it exits (logged as handed 43 terminals to a newer host). We also avoid building and signing over SSH on macOS: locked SSH Keychains block Developer ID signing, while ad-hoc signing (codesign -s -) changes the binary identity on every build and triggers endless TCC permission prompts.

3. Why Orphan ssh -L Processes Ignored SIGTERM (PR #360)

During upgrades, we noticed an orphaned ssh -N -L process left by a crashed window ignored SIGTERM and needed kill -9, and stopping an old daemon always waited the full 5-second timeout. The root cause: macOS AppKit sets SIGTERM to SIG_IGN on the GUI process, and under POSIX, fork + exec resets caught signals but inherits SIG_IGN across exec. Resetting SIGTERM to SIG_DFL in the child’s pre_exec hook (PR #360) fixed both.

Summary: Five Engineering Principles for Multi-Host Desktop Apps

Still ahead: local predictive echo when typing p95 exceeds 200 ms (similar to WezTerm); opening remote terminal file links in a local editor; and computing context rings and Git ahead/behind counts on the remote daemon. Verified between Macs; as of v0.1.3, Windows x64 and Ubuntu 24.04 have preview packages.