Rex is a self-hostable developer terminal and server architecture that decouples terminal presentation layers from backend execution multiplexers. This design enables persistent background processes, multi-device session recovery, and programmatic agent interaction via specialized protocols.
Read original on The New StackThe Rex architecture separates the native user-facing client interface from the backend server runtime that executes commands and manages process lifecycles. By decoupling the presentation layer from the execution layer, client applications can gracefully disconnect, crash, or switch devices (such as moving from a desktop to an iPhone) without disrupting active background processes or unattended AI coding agents.
Architectural Trade-off
Separating stateful execution from stateless clients simplifies mobility and fault tolerance, but introduces significant security considerations. Storing resume commands and environment variables requires strict file-system permissions, authentication layers, and sandboxing to prevent unauthorized privilege escalation when autonomous agents execute shell commands.
To support AI coding agents, Rex provides a CLI and server API that give agents programmatic access to partitioned terminal panes. Agents can dispatch builds or test suites asynchronously, wait for execution completion, and parse output buffers directly. This architecture shifts the terminal from a purely interactive human interface to an orchestration plane for autonomous distributed agents.
Want the fundamentals behind stories like this? Take the free System Design Academy course with certificate.