Skip to content

Session Persistence

Terminal sessions in MoltShell persist across browser closes, network interruptions, and device switches. You never lose your work because of a dropped connection.

How it works

MoltShell uses tmux on the server to manage terminal sessions. When you open a terminal pane, the browser connects to a tmux session via WebSocket. If the connection drops, tmux keeps running on the VM. When you reconnect, the browser reattaches to the same tmux session and you see everything exactly as you left it.

This means:

  • Long-running commands continue even if you close your laptop
  • Your shell state is preserved -- working directory, environment variables, running processes
  • Output you missed is still in the scrollback buffer (up to 5000 lines per pane)

Scenarios that preserve sessions

ScenarioSession preserved?
Close the browser tabYes
Lose network connectionYes
Switch to a different deviceYes
VM suspends after idle timeoutYes (RAM saved to disk)
VM resumes after suspensionYes (all processes restore)
Reboot the VMNo (processes terminate, but files persist)

Reconnection

When the WebSocket connection drops, the terminal shows a "Disconnected" indicator. MoltShell automatically attempts to reconnect every 2 seconds. Once reconnected, the terminal reattaches to the same tmux session.

If your VM was suspended due to inactivity, you will need to start it again from the dashboard. After the VM resumes (~30 seconds), your sessions will be exactly as you left them.

Scrollback history

Each pane retains up to 5000 lines of scrollback history. You can scroll up to see previous output. On desktop, use the mouse wheel. On mobile, swipe up and down.

The scrollback limit is set to balance usability with memory usage. If memory gets critically low, the memory watchdog may clear scrollback buffers to free RAM.

Layout persistence

Beyond individual sessions, your split pane layout is also saved. The terminal server stores the layout tree (which panes exist, how they are split, and their sizes) on the VM's filesystem at ~/.moltshell/layout.json. When you reconnect, the frontend fetches this layout and restores your pane arrangement.

MoltShell - Your Linux VM in the browser.