Skip to Content
DocsArchitectureProcess-control protocols

Attach, Detach, Reattach

TL;DR

The session surface is the small set of things a client does to work with a live session, independent of any one wire protocol: attach to an existing session without owning the underlying process, share the live output every other attached client sees, and detach and reattach without losing the session. The surface is defined over session identity, so a client can drop and come back to the same session rather than starting cold.

The attach/detach surface

Attaching binds a client to an existing, addressable session; detaching releases the client without destroying the session. A client attaches by resolving the session’s identity and joining its live stream; it detaches by leaving that stream. The session is unaffected by how many clients are attached — zero attached clients is a valid, live state, and the session survives a client disconnect rather than dying with the connection.

Shared live output

On attach, a client joins the session’s live output and begins seeing its events. Every attached client sees the same live state — output and results show up the same way for all of them, so what one operator sees is what the others see. Multiple heterogeneous clients — Desktop, CLI, mobile, SDK — can attach to one session at the same time and each shares that one live view.

Many operators, one live session

Several operators can be attached to a session at once. They take turns steering it: an operator’s input lands and is reflected in the shared live state that every attached client is watching, and each operator’s actions are recorded in the audit log, so the session has a clear, auditable record of what happened and which operator did it. Authority is asymmetric but transferable — a human can take control at any time. The user-facing behavior is documented in multi-client sessions.

Session continuity

Because the surface is keyed to session identity rather than to one socket, a client can disconnect and reattach to the same session. The agent dials out to the relay — outbound only, no inbound port to forward — and clients reach the session through the relay, not directly to the host. A returning client reattaches within the grace window and resynchronizes against the live session rather than rebuilding from a cold start. See Sessions for the grace-period model, and Interactive Attach for the CLI reattach flow.

Why transport-agnostic?

Because the surface is defined over session identity rather than over an SSH/WebSocket/HTTP socket, the same attach, detach, share, and reattach behavior holds regardless of carrier. This is precisely what makes transport-independent sessions possible: the control surface never assumes a particular wire protocol.