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.rsThe 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 refactorOnly 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.rsWithout 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 --resumeRecovery 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
| Situation | Use | What happens |
|---|---|---|
| Terminal or SSH disconnect | red --attach NAME | Reconnects to the same live editor owner |
| Editor or machine stopped | red --resume | Loads the newest valid atomic snapshot |
| Normal clean exit | red in the same directory | Restores clean file-backed buffers, views, and split layout |