# Field: Terminal Multiplexing & Session Persistence (Inspiration Survey)

**Packet**: terminal-workspace-orchestration
**Angle**: Concrete tooling survey — sessions, layouts, workspaces, persistence, and resume UX
**Date**: 2026-05-29
**Status**: Initial — verified sources from live web this session

---

## Canonical Concepts

### GNU Screen
The original multiplexer. Introduced the detach/re-attach contract: a process outlives the controlling terminal, identified by a socket name. Vocabulary: *session*, *window* (full-screen), no native pane splitting (added later as "regions"). Influence: established the idea that a named socket = a resumable context.

### tmux — Server / Session / Window / Pane
Client-server model over a Unix domain socket. One `tmuxd` process manages all objects stored in global red-black trees. Hierarchy: **Server → Session → Window → Pane**.

- **Session**: named, detachable, top-level grouping. Multiple clients can attach simultaneously.
- **Window**: fills the terminal area; one or more panes tiled within it.
- **Pane**: one PTY. Each pane is a rectangle; layout is stored per-window.
- **Grouped sessions**: `tmux new-session -t <existing>` — two sessions share the same window set but each client maintains independent focus. Crucial pattern for multi-monitor or multi-client scenarios where observers see the same content without locking each other to the same pane.

Key design: everything is scriptable via `tmux` commands; mutations are composable shell calls.

### Zellij — Session / Tab / Pane / Layout / Resurrection
Written in Rust; plugin system via WASM. Hierarchy: **Session → Tab → Pane**.

- **Layout**: KDL (Kotlin Data Language) files. Layouts are first-class citizens — not an afterthought.
- **Session resurrection** (v0.39.0, Nov 2023): sessions are serialized to the cache every second. Stores: tab/pane arrangement + command in each pane. Optional: `pane_viewport_serialization` + `scrollback_lines_to_serialize`. On re-attach to an exited session, commands appear behind a **"Press ENTER to run…" banner** — protecting against accidental `rm -rf` replay. `--force-run-commands` skips it.
- Serialized layouts are human-readable files, shareable across machines.
- No "workspace" term; the session itself is the durable unit.

**vs. tmux tradeoffs**:
- Zellij: built-in resurrection, KDL config, independent pane resizing, integrated UI/keybinding legend, growing (but less mature) plugin ecosystem.
- tmux: richer scripting surface, decades of ecosystem (TPM, resurrect, continuum, sessionizers), `new-session -t` grouped sessions, lower overhead.

### WezTerm — Window / Tab / Pane / Workspace
GPU-rendered terminal emulator with built-in multiplexing (no separate server needed for local use). Hierarchy: **Workspace → Window → Tab → Pane**.

- **Workspace**: a *label* on a `MuxWindow`. Switching active workspace swaps the GUI window contents with those belonging to the target workspace. Background workspace windows persist in memory. Closest analog to "project context."
- **Tab**: contains panes in a binary-tree layout.
- Lua-scriptable; layouts can be pre-defined via startup events.
- No persistent cross-reboot state by default; workspaces live in the process.

### abduco / dtach — Session as Socket
Minimal: do one thing — decouple a program from its controlling terminal. A session = a named Unix socket + a server process. No panes, no windows. Design lesson: the minimal viable session store is just *name → running process + socket path*.

---

## Vocabulary Comparison Table

| Tool | Session | Window | Pane | Layout | Workspace |
|---|---|---|---|---|---|
| **GNU Screen** | session (socket) | window (full screen) | region (split, limited) | layout (named) | — |
| **tmux** | session (named, detachable) | window (tabs within session) | pane (PTY rectangle) | layout (tiled arrangement) | — (grouped sessions are the closest) |
| **Zellij** | session (named, resurrectable) | tab | pane | layout (KDL file) | — |
| **WezTerm** | — | MuxWindow | pane | tab layout | workspace (label grouping windows) |
| **tmuxinator/tmuxp/smug** | session (YAML-defined) | window (YAML list) | pane (per-window split) | layout (tiled/even-horizontal/etc.) | project (YAML filename / config file) |
| **sesh** | session (tmux session) | — | — | — | project (directory / git repo) |
| **Wave Terminal** | — | — | — | tab layout | workspace (SQLite-persisted, tabs+blocks) |
| **Warp** | — | — | — | — | drive (shared env + workflows) |

---

## What Makes Resume Feel Good — Concrete Patterns

### 1. Named Sessions as First-Class Identity
Every good tool anchors resumability on a **stable name**, not a PID or port. tmux, Zellij, abduco, sesh: the name is the handle. Corollary: auto-naming from git remote or directory (sesh does this) eliminates the "what did I call it?" friction. For `tide`: session names derived from repo+branch+issue are already aligned with this pattern.

### 2. The "Press ENTER to Run" Consent Banner (Zellij)
Resurrection must not auto-replay destructive commands. Zellij's banner is the right abstraction: the layout and pane positions are restored immediately (visual confirmation of context), but execution is deferred until explicit consent. This separates *re-orientation* (instant) from *re-execution* (intentional). Adapt this for `tide`: restore the workspace visual layout + show pending resumable commands in an approval queue, don't auto-run.

### 3. Incremental / Automatic Save, Manual Restore
tmux-continuum saves every 15 minutes automatically; tmux-resurrect restores on explicit `prefix + Ctrl-r`. Wave Terminal persists all tab/layout/history automatically. The pattern: **saving is invisible, restoring is intentional**. The user never has to think "did I save?" but retains full control over when to apply a snapshot. For the web UI: always-on background serialization + a "Resume Session" affordance (not auto-restore on page load).

### 4. Layout as a Shareable Artifact
tmuxinator/tmuxp/smug: YAML project files live in version control. Zellij: KDL layout files are human-readable and machine-composable. The layout is not ephemeral config but a document that travels. For `tide` "workspaces": a workspace definition (which editors, terminals, browser targets to open per repo/profile/issue) should be a file, not opaque DB state — so it can be committed, shared, and diffed.

### 5. Fuzzy-Find Session Switching (sesh / tmux-sessionizer)
The UX gold standard for session navigation: `prefix + key` pops a fuzzy finder listing live sessions + recent directories (via zoxide), creating the session if it doesn't exist. Zero-latency "where was I?" for any project. For the web UI: a command-palette or quick-switcher over `tide` named sessions, integrating domain detection to surface the most relevant contexts first.

### 6. Grouped / Shared Sessions for Observers
tmux grouped sessions allow a second client to share the window set without locking both to the same pane focus. Maps directly to `tide`'s observer vs. controller mode distinction: an observer attaches to the grouped session (reads state), a controller operates on their own focus within it.

---

## Sources of Inspiration for the Web UI

### Wave Terminal (WaveTerm)
- SQLite-backed persistence for all state (Client/Window/Workspace/Tab/Block).
- Block model: every content unit (terminal, file preview, AI chat, web view) is a typed Block with metadata and a stable ID. Tabs are tiled dashboards of blocks.
- New workspaces are ephemeral until saved; last window is always preserved across restarts.
- **Borrow**: the block-as-typed-widget model for `tide` pane panels. The "save workspace" / "ephemeral vs. pinned" distinction maps cleanly to session lifecycle.
- Stack: Electron + TypeScript/React frontend, Go backend, hot-reloadable block types.

### Warp
- **Blocks**: each command + its output is an atomic unit with stable ID, exit code, duration. Linkable, searchable, diff-able.
- **Warp Drive**: shared workspace for Workflows (parameterized, versioned runbooks), Prompts, Env Vars — converts tribal knowledge into executable artifacts.
- Agent mode vs terminal mode: clean separation between conversational AI interaction and raw terminal.
- **Borrow**: the block-as-atomic-output model for `tide`'s pane content capture. Warp Drive's "workflow as shareable artifact" maps to `tide` workspace definitions.

### sesh TOML Config as Session Blueprint
```toml
[[sessions]]
name = "my-project"
path = "~/repos/my-project"
startup_command = "nvim"
preview_command = "ls"
```
Declarative, minimal, version-controllable. The `startup_command` per session is the executable version of "what I was doing." **Borrow**: `tide` workspace YAML/TOML should include a `startup_commands` list per domain, not just window layout.

### Zellij Layout + Resurrection
Built-in, no plugins needed. KDL layout files as shareable documents. The "Press ENTER" consent pattern. **Borrow** both the always-on serialization architecture and the consent-before-replay UX for `tide`'s approval queue integration.

---

## Cautions — What NOT to Copy

- **tmux-resurrect's program allowlist**: restoring a conservative hardcoded list of programs is brittle. `tide` must have domain-aware command classification, not a static list.
- **tmux's opaque binary state**: resurrect stores state in ad-hoc text files that break across tmux version upgrades. Use a schema-versioned store (SQLite with migrations, as Wave Terminal does).
- **Warp's cloud lock-in**: Warp Drive requires Warp's cloud. `tide`'s workspace definitions must be local-first and git-committable.
- **Zellij's KDL learning curve**: KDL is structurally clean but unfamiliar. For `tide`, prefer YAML/TOML for user-authored workspace definitions; use internal structured representation for the DB.
- **Auto-restore on startup (tmux-continuum default)**: resuming all sessions silently on boot can spawn unexpected processes. Keep restore as an explicit user action.
- **WezTerm's in-process-only workspaces**: no cross-reboot persistence by default. `tide` needs durable persistence as a first-class requirement.

---

## Engineering Implications (for `tide` session/workspace verbs + web UI)

1. **Session verb surface**: `tide session list`, `tide session attach <name>`, `tide session new <name> [--from <profile>]`, `tide session kill <name>`. Mirror tmux/sesh vocabulary where "session" = named resumable unit.

2. **Workspace verb surface**: `tide workspace open <repo> [--profile <p>] [--branch <b>] [--issue <i>]`, `tide workspace save`, `tide workspace list`. Workspace = reproducible layout spec (the YAML/TOML doc); session = a live running instance of a workspace.

3. **SQLite schema**: follow Wave Terminal's pattern — store Client, Session, Workspace, Pane as versioned rows. Serialize pane state (CWD, last command, scrollback excerpt) on a background timer (1–15 s). Include schema_version column for migrations.

4. **Approval queue as resume gate**: on `tide session attach`, present a list of "would re-run" commands with domain classification. User approves subset before execution. This is Zellij's "Press ENTER" pattern scaled to multi-pane, multi-domain context.

5. **Web UI quick-switcher**: command-palette (Cmd+K / Ctrl+K) over live sessions + recent workspaces, sorted by domain relevance (zoxide-style frecency). Session name, domain badge, last-active timestamp, pane count displayed inline.

6. **Block IDs on pane output**: each captured pane snapshot gets a stable ID (timestamp + session + pane). Enables the Warp-style "link to a specific command output" pattern in the web UI.

7. **Workspace-as-file**: workspace definitions live in `~/.config/tide/workspaces/<name>.yaml` (or per-repo `.tide/workspace.yaml`), not only in the DB. DB is the cache; file is the source of truth for sharing/version-control.

---

## Sources

| Title | Project / Author | URL | Verified | Claim Supported |
|---|---|---|---|---|
| Getting Started — tmux Wiki | tmux/tmux | https://github.com/tmux/tmux/wiki/Getting-Started | true | Server/session/window/pane hierarchy; grouped sessions |
| Session Resurrection — Zellij Docs | zellij-org | https://zellij.dev/documentation/session-resurrection.html | true | Serialization interval, viewport/scrollback opts, Press ENTER banner, `--force-run-commands` |
| Zellij 0.39.0 release notes | Aram Drevekenin / zellij-org | https://zellij.dev/news/session-resurrection-ui-components/ | true | First release with built-in resurrection, Nov 2023 |
| tmux-resurrect README | tmux-plugins | https://github.com/tmux-plugins/tmux-resurrect | true | What state is saved, restore flow, program allowlist, idempotent restore |
| tmux-continuum README | tmux-plugins | https://github.com/tmux-plugins/tmux-continuum | true | 15-min auto-save, automatic restore on start |
| Workspaces — WaveTerm Docs | wavetermdev | https://docs.waveterm.dev/workspaces | true | Ephemeral vs saved workspace, SQLite persistence, tab/block model |
| Workspaces Recipes — WezTerm Docs | Wez Furlong / wezterm | https://wezterm.org/recipes/workspaces.html | true | Workspace as label, MuxWindow grouping, focus-swap behavior |
| sesh README | Josh Medeski | https://github.com/joshmedeski/sesh | true | TOML session config, zoxide integration, auto-naming from git remote |
| tmux vs Zellij comparison 2026 | dasroot.net | https://dasroot.net/posts/2026/02/terminal-multiplexers-tmux-vs-zellij-comparison/ | true | KDL vs .tmux.conf, plugin ecosystems, persistence tradeoffs |
| Warp all features | Warp | https://www.warp.dev/all-features | true | Block model, Warp Drive, agent vs terminal mode |
| Session management in WezTerm (without tmux) | Fredrik Averpil | https://fredrikaverpil.github.io/blog/2024/10/20/session-management-in-wezterm-without-tmux/ | true | WezTerm workspace switching workflow |
| abduco project page | Marc André Tanner | https://www.brain-dump.org/projects/abduco/ | true | Minimal session = named socket + server process design |
