Detach and recover

Sessions

Detach and recover

Keep a live editor across terminal disconnects on macOS and Linux, or restore an atomic snapshot after the editor stops.

Keep a live session running

Detach and attach are available on macOS and Linux. Start a named session:

red --detach=refactor src/main.rs

The terminal attaches immediately. Press Ctrl-\ to leave the TUI while the editor, unsaved buffers, plugins, language servers, running shell jobs, and Codex app-server process stay alive.

red --attach refactor
red --stop refactor

Only one TUI can attach at a time. Sessions are local to the current OS user and use a private Unix socket rather than a TCP port. Windows supports recovery but not detach and attach.

Use the default session name

red --detach src/main.rs

Without an explicit name, Red uses default. Named sessions require the --detach=NAME form so a filename can't be mistaken for a session name.

Restore after a crash

red --resume

Recovery is available on every supported platform. Red restores the newest valid snapshot, including dirty buffers, window layout, cursors, registers, marks, undo history, and Agent conversation state. Restored dirty text stays in memory; Red doesn't write it to disk until you save.

Know which recovery path applies

SituationUseWhat happens
Terminal or SSH disconnectred --attach NAMEReconnects to the same live editor owner
Editor or machine stoppedred --resumeLoads the newest valid atomic snapshot
Normal clean exitred in the same directoryRestores clean file-backed buffers, views, and split layout