Get Moshi
terminal

Terminal sessions

How Moshi keeps sessions usable on mobile: mosh, SSH fallback, active sessions, reconnect behavior, and the MOSHI_CLIENT flag.

updated 1 week ago6 min readpage 5 / 23

Moshi's terminal is designed around reconnecting to work that is already running on the host. The strongest setup is mosh for transport plus tmux for process lifetime.

Transport behavior

SSH gives you broad compatibility and works anywhere TCP SSH works.

Mosh starts through SSH, then uses UDP to keep the terminal responsive and resilient while the device changes networks. It is the better choice for mobile use when UDP is available.

If mosh fails but SSH works, check host firewall rules and the configured UDP range before changing app settings.

Active sessions

Moshi tracks active terminal sessions so you can leave one connection, open another, and switch back. On iPad, the app can show more session context; on iPhone, the switcher keeps the terminal surface compact.

Useful session actions include:

  • Switch between active sessions.
  • Close a session when you are done.
  • Reconnect to a previous terminal route.
  • Resume the last active session when opening the app.

Scrollback

Moshi keeps a scrollback buffer in the app with a configurable line limit. The mosh protocol does not transmit history above the visible screen at connect time, so for durable, searchable scrollback run inside tmux. See Scrolling and scrollback for the full picture, including tmux copy mode.

Reconnect expectations

Mosh can survive network changes, but it does not keep the remote shell alive after the remote process exits. tmux handles that part.

Use this pattern for important work:

durable workspace
$tmux new -s moshi
$codex

If the iOS terminal disconnects, reconnect to the host and attach to the same tmux session.

MOSHI_CLIENT environment flag

Settings includes a MOSHI_CLIENT env toggle. When enabled, Moshi exports MOSHI_CLIENT=1 into the remote shell so your shell startup files, tmux config, or scripts can detect Moshi-launched sessions.

It is off by default to keep SSH startup behavior quiet and predictable.