Remote & Predictive Echo
Because loomtty is split into a client and a server, the client doesn't have to run on the same machine as your shells. You run loomtty-server on a remote host, and attach to it from your laptop — the panes render locally on the GPU, while the shells live on the remote and survive disconnects.
How it works
The client talks to the remote server over loomtty's binary protocol, carried inside an SSH tunnel. Concretely, the client runs:
ssh -p <ssh_port> -W 127.0.0.1:<remote_port> -- <user@host>ssh -W forwards the protocol stream to the remote's loopback address, where loomtty-server is listening. That has two consequences worth understanding:
- The remote TCP listener binds to
127.0.0.1only and has no authentication of its own — it is reachable solely through the SSH tunnel (or from localhost on the remote). It is never exposed to the network directly. - Authentication and encryption are just SSH. loomtty adds nothing on top; it reuses your SSH keys,
known_hosts, and config.
Step 1 — Enable the listener on the remote host
On the remote machine, install loomtty and turn on the remote listener in ~/.config/loom/config.toml:
[remote]
enabled = true
port = 7890 # optional; 7890 is the defaultThen start the server by creating a session and detaching from it, so the server keeps running with the listener open:
loomtty work # start a session named "work" on the remote
# press Alt q to detach — the session (and the server) stay aliveA detached session keeps loomtty-server running, so the listener stays up and ready for you to attach from elsewhere. (With no sessions and no clients, the server shuts down after server.idle_timeout_secs, 5 minutes by default.)
TIP
[remote] enabled belongs on the remote host (the machine running the server). You do not set it on your laptop just to connect out.
Step 2 — Connect from your local machine
Option A — one-off, from the CLI
loomtty remote user@remote-host workArguments and flags:
| Argument | Default | Meaning |
|---|---|---|
user@remote-host | — | SSH target, or the name of a saved [[remote.hosts]] entry (required). |
[session] | — | Session to attach to / create on the remote. |
--port <n> | saved host's port, else 7890 | The remote's [remote] port. |
--ssh-port <n> | saved host's ssh_port, else 22 | SSH port for the tunnel. |
--transport <t> | saved host's transport, else [remote] transport (auto) | auto, kcp or ssh — see UDP transport. |
Option B — saved hosts + the session palette
On your local machine, list the remotes you connect to under [[remote.hosts]] — this is purely client-side, to populate the palette:
[[remote.hosts]]
name = "devbox"
host = "[email protected]"
port = 7890 # the remote's [remote] port
ssh_port = 22Then run loomtty remote devbox (the entry's port / ssh_port are used unless you pass the flags), or open the session palette with Alt Shift+p. loomtty probes each saved host for its running sessions and lets you pick one to attach to (you can also type a host into the connect prompt). See the [remote] reference.
Requirements & gotchas
sshmust be on your PATH. loomtty shells out to the system OpenSSH client.- Use key-based auth. The client drives
sshnon-interactively (its stdin is the protocol stream), so password prompts can't be answered. Set up an SSH key orssh-agent. A good check:ssh user@hostshould connect without typing a password. - Accept the host key first. If the host is new, run a plain
ssh user@hostonce so its key lands inknown_hosts; otherwise the tunnel fails host-key verification. - Don't collide ports. If the remote also runs the web gateway,
[remote] portand[web] portmust differ (defaults are7890/7891); the server refuses to start otherwise.
UDP transport (KCP)
On a long or lossy path a single TCP stream (which is what ssh -W is) is a poor fit for an interactive terminal: one lost packet stalls everything behind it for a retransmission timeout, and a busy pane can fill SSH's buffers so that keystrokes queue behind seconds of stale output. loomtty can therefore move the data path to UDP, mosh-style, while SSH stays the trust and bootstrap channel:
- The client connects over the usual
ssh -Wtunnel and asks the server for an upgrade, sending the local UDP address it will use. - The server creates a session with a fresh random 256-bit key and answers (inside the SSH tunnel) with the key and its UDP port.
- Both ends start sending sealed probe packets to each other ("punching"), so stateful firewalls on both hosts admit the flow without any inbound rule.
- Once a probe has made the full round trip, the client closes the SSH tunnel and the loomtty protocol runs over KCP on that UDP flow.
Every datagram is encrypted and authenticated with ChaCha20-Poly1305 under the session key and checked against replays; anything that fails is dropped silently, so the UDP port answers nothing to scanners. Small, latency-critical datagrams (keystrokes, acknowledgements, small screen updates) are sent a second time ~15 ms later, which hides most single-packet losses without retransmission delay; bulk output is never duplicated.
Enabling it
UDP is off by default on the server. On the remote host:
[remote]
enabled = true
port = 7890
[remote.kcp]
enabled = true
# bind = "100.64.0.1" # optional: listen on one interface only (e.g. a VPN)
# udp_port = 0 # 0 = pick a free port at server startRestart the server for [remote.kcp] to take effect. Clients need no changes: the default client transport is auto, which tries UDP and falls back to the SSH stream. To choose per host or per connection:
[remote]
transport = "auto" # default for all hosts: "auto" | "kcp" | "ssh"
kcp_punch_timeout_ms = 3000 # how long auto/kcp try to bring UDP up
[[remote.hosts]]
name = "devbox"
host = "[email protected]"
transport = "kcp" # optional per-host override
udp_host = "" # optional, see belowor loomtty remote devbox --transport ssh.
| Transport | Behaviour |
|---|---|
auto | Try UDP; if the server has it disabled, UDP does not come up within kcp_punch_timeout_ms, or the server is too old, continue over SSH. A host that fell back is not retried over UDP for 10 minutes. |
kcp | UDP only. If it cannot be established the connection fails with a "UDP transport unavailable" error instead of retrying. |
ssh | Never attempt UDP (the behaviour of earlier versions). |
Reachability and firewalls
The client sends UDP to the address ssh itself connects to (it asks ssh -G for the effective host name, so ~/.ssh/config aliases work). When that name is not reachable over UDP — a jump host, a ProxyCommand, a bastion — set udp_host on the saved host to an address that is.
Because both ends send first, host firewalls on either side normally need no inbound rule: the outbound packets create the state that admits the replies. What is required is that the two hosts can reach each other directly: same LAN, public addresses, or an overlay VPN. Two hosts both behind NAT without a VPN fall back to SSH. Only IPv4 is used for the UDP path.
On Windows the server binding a UDP socket may make Windows Firewall ask whether to allow loomtty-server; pinning udp_port lets you add an explicit rule instead.
Liveness and reconnects
Each side sends a keepalive after one idle second. If no authenticated packet arrives for 15 seconds the session is considered dead: the client reconnects through SSH with a new key and the server sends a full refresh, exactly as after any other disconnect. Shells are unaffected. If the client's address changes (e.g. Wi-Fi to wired), the server follows the newest authenticated packet.
Security notes
- Anyone who can open the remote's loopback listener can request a UDP session — the same set of users who can already attach over the tunnel (anyone with SSH access to the host, and local users on it). The UDP path does not widen that.
- An observer on the UDP path cannot read or inject terminal data, but does see packet timing and sizes. Recent OpenSSH versions add keystroke-timing chaff on the SSH path; the UDP path does not. Use
transport = "ssh"if that matters for a host.
Predictive echo
Over a high-latency link, waiting a full round-trip to see each keystroke is painful. loomtty borrows mosh's predictive echo: it echoes your typing locally and reconciles with the server as updates arrive, so input stays responsive even when the connection is slow.
It's off by default — enable it (on the client) under [prediction]:
[prediction]
mode = "adaptive" # "never" (default) | "always" | "adaptive"
threshold_ms = 30 # adaptive: latency above which prediction kicks in
show_underline = true # underline not-yet-confirmed charactersadaptivepredicts only when measured latency exceedsthreshold_ms— the recommended setting for mixed local/remote use.alwayspredicts unconditionally;neverdisables it.
See the [prediction] reference.
Troubleshooting
When a connection drops, loomtty classifies the SSH failure and shows the reason:
| Symptom | Likely cause |
|---|---|
ssh binary not found | OpenSSH isn't on your PATH. |
Permission denied | SSH auth failed — set up key-based auth (password prompts can't be answered). |
Connection refused | No loomtty-server listening on the remote, or [remote] enabled is false / the wrong port. |
Host key verification failed | The remote's host key is unknown or changed — ssh user@host once to resolve. |
Could not resolve hostname | DNS / hostname typo. |
connection timed out | Network/firewall, or the wrong --ssh-port. With the UDP transport: no packets for 15 s (the client reconnects automatically). |
UDP transport unavailable: … | transport = "kcp" was forced but the server has [remote.kcp] disabled, UDP is blocked between the hosts, or no IPv4 address was found — use auto, fix the path, or set udp_host. |
The client log notes which data path each connection uses ("data path on UDP (KCP)" or "data path on the SSH stream") and, every minute, the UDP session's round-trip time and packet counters. If auto keeps landing on SSH, run once with --transport kcp to see why UDP is not coming up.
Work in progress
loomtty is early (v0.1) and remote attach is among the rougher edges. Expect the setup flow and options to change.