# Rex-on-exe

> Source: <https://blog.exe.dev/rex>
> Published: 2026-11-19 19:20:00+00:00

**Key takeaway:** Run `rex server install ssh://<your-vm-name>.exe.xyz` on an exe.dev VM to move Rex sessions to the remote host, and fetch the server's `llms.txt` over its Unix socket to let an agent drive the session.

## Using Rex to Access exe

If you’re one of the “lucky few” who’s running Rex as their daily shell, adding exe.dev hosts to Rex is easy. Create a new vm with `ssh exe.dev new`, and then, from inside a Rex terminal, run:

```
rex server install ssh://<your-vm-name>.exe.xyz
```

This installs the Rex server on your exe VM. After that, you can connect using the `ssh://` URLs, and you’re all set.

With that out of the way, it's kind of fun to look under the hood to see how it all works.

## What's All the Fuss About?

In an agentic world, what's old is new again, and many of us are doing work on remote machines rather than our laptops. Some of the reasons for this are:

- VMs isolate agents
- VMs facilitate parallelism
- We can do "dev-is-prod" in VMs by developing and deploying on the same machine

Working on remote machines kinda stinks, without [rich affordances](https://exe.dev/mac). If you SSH to a remote machine and you close your laptop, your session will drop, taking all of its state with it. This is not a new problem. Tailscale abstracts away the network so that your session doesn't drop. `mosh` introduces a terminal synchronization protocol and is resilient to drops. Eternal Terminal is similar to Mosh. `tmux` and `screen` virtualize your sessions, so you can reconnect to them. `zmx`, `tmate`, `dtach`, `atch`, `abudco`, `reptyr`... so many options in this space. Perhaps the most common approach is **tmux**, but it comes with one major downside: you have to use tmux, and now things as simple as splitting your terminal into two panes become `Ctrl-B "`, and who's got time for all that?

Rex splits up the problems nicely. The Rex server runs on the remote machine, and manages multiple sessions (which in their [terminology](https://www.superlogical.com/rex/docs/automate/cli#taxonomy) contain windows, which contain blocks, which are terminals). The Rex server listens locally on a Unix socket. The protocol is HTTP. If the server is killed, all its sessions go with it. That's not supposed to happen very often. This Unix socket is forwarded over SSH to your Mac, where the client app runs. The client app displays whatever sessions are available. The state lives on the Rex server on the remote machine, so when you create a split from the command line on your Linux machine, it is reflected in the client app.

If you (or your agent) want to do some advanced trickery, Rex ships with an `llms.txt` which you can pull out with something like `curl -s --unix-socket /run/user/$(id -u)/rex/server.sock http://rex/llms.txt`. It explains the protocols at quite some length and enables giving your session to an agent.

## Session Persistence, Terminals, Apples, and Oranges

There are several interwoven concerns at play when doing session persistence. Different tools solve different subsets of the problems. The table below highlights which tools solve which bits of the problem. I'm delighted that Rex is trying to solve many of the problems in one tool, rather than forcing me to cobble together solutions from multiple. Here at exe, we've felt many of the same problems and it's no surprise that [`exe-scroll`](https://blog.exe.dev/exe-scroll) and our Mac, iOS, and web apps share similar underpinnings (e.g., `ghostty` for terminal emulation and a unix socket on the server).

I want to highlight "good for agents" in the table below: When [the pi coding agent](https://mariozechner.at/posts/2025-11-30-pi-coding-agent/#toc_17) came on the scene, I realized that tmux wasn't just a terminal multiplexer. It was a CLI (`tmux capture-pane`, `tmux send-keys`) to let an agent manipulate a terminal session.

As you look through the table, note how much SSH is doing. I think there's a lot of space for more approaches to auth and connectivity; SSH is showing its age. I'm particularly excited about systems like [`tailcat`](https://github.com/n0-computer/iroh) and [` iroh`](https://github.com/n0-computer/iroh) and web-based solutions. There are enough dimensions here that you can combine tools to get great experiences, but not all bundling combinations have been tried yet.

|  | Plain SSH | SSH over Tailscale | Mosh | tmux | dtach | Terminal apps | Rex | exe-scroll | exe.dev apps | 
|---|---|---|---|---|---|---|---|---|---|
| Auth | SSH | Tailscale identity | SSH | Unix socket | Unix socket | n/a | Unix socket via SSH or Tailscale | Unix socket | HTTP cookies or SSH | 
| Transport | TCP | WireGuard (UDP) | TCP to initiate, then UDP | Unix socket | Unix socket | Local pty | SSH or Tailscale | Unix socket | HTTPS or SSH | 
| Process model | 1/connection | 1/connection | 1/session | 1 process, N terminals | 1/session | 1 app process, N terminals | 1/machine, N terminals | 1/terminal | exe-scroll | 
| Switching networks | No | Yes | Yes | Partly <sup>1</sup> | Partly <sup>1</sup> | n/a | Yes | Yes | Yes | 
| Multiple clients to same terminal | No | No | No | Yes | Yes | n/a | Yes | Yes | Yes | 
| Outlives the connection | No | Yes | Yes <sup>2</sup> | Yes | Yes | n/a | Yes | Yes | Yes | 
| Scrollback after reconnect | No | No | No | Yes | No | n/a | Yes | Yes | Yes | 
| Splits | n/a | n/a | n/a | Yes | n/a | Yes | Yes | n/a | n/a | 
| Native affordances | Yes | Yes | Partly <sup>3</sup> | No | n/a | Yes | Yes | n/a <sup>4</sup> | Yes | 
| Good for agents | Partly <sup>5</sup> | Partly <sup>5</sup> | No | Yes <sup>6</sup> | No | No | Yes | Yes | Yes | 
| Scriptable | Partly <sup>7</sup> | Partly <sup>7</sup> | No | Yes | No | n/a | Yes | Yes | Not sure | 
| Speculative local echo | No | No | Yes | No | No | n/a | No | No | No | 
| Viewing remote port | Yes | Yes | No | n/a | n/a | n/a | Yes | n/a | Yes | 

1. Reattach
2. Same client only
3. No scrollback
4. Via the apps
5. One-off commands
6. `send-keys` and`capture-pane`
7. Commands only

## One Last Thing

Vincent was kind enough to record a demo; check it out!
