# Sessions, tabs & panes

Organize work, preserve the layout, and reconnect from another terminal.

Canonical page: https://thebestterminal.com/docs/sessions-and-panes

Harness 2.3.2 · Documentation reviewed 2026-10-13

## The workspace model

| Object | What it means |
| --- | --- |
| Workspace | A collection of sessions. |
| Session | A named context with a list of tabs. |
| Tab / window | A split layout containing one or more panes; CLI window commands generally refer to tabs. |
| Pane / surface | One running terminal. The CLI accepts either pane or surface identifiers for pane targets. |
| Daemon | The background process that owns the sessions and terminal processes. |

Use the sidebar (⌘\), sessions popover (⌃⌘S), or Workspace Overview (⌘⇧O) to move between contexts without guessing which window contains the work.

## Build and adjust a layout

Use ⌘D and ⌘⇧D to split, ⌥⌘Arrow to move between panes, and ⇧⌘Return to zoom. Comfortable pane density gives each pane a header; compact density uses narrow borders.

**Create a project layout**

```shell
harness-cli ls
harness-cli new-session --cwd ~/Code/my-project
harness-cli new-tab --cwd ~/Code/my-project
harness-cli split-window -h
```

The commands act on the calling pane’s context when run inside Harness. Outside it, omitted targets generally use the active GUI context. Use explicit targets in unattended scripts.

Split and close transitions preserve the surviving terminal view and keyboard focus. Rapid changes continue from their current pane positions; divider gestures retain the latest ratio. Closing a pane retires its terminal connection while its last frame completes the animation.

## Save a repeatable arrangement

Save the active tab’s split tree, pane directories, and running command lines as a named layout. A restore creates a new session; it does not resume the old processes.

**Terminal**

```shell
harness-cli save-layout --name development
harness-cli restore-layout --name development --dry-run
harness-cli restore-layout --name development
```

> **Review commands before restoring**
>
> A saved layout may contain commands that launch services or perform other work. Inspect the dry run before replaying a layout from an unfamiliar source.

## Attach from another terminal

Use attach for one pane, or attach-window to render the session’s split layout in a terminal client. Several clients can connect to the same session.

**Terminal**

```shell
harness-cli attach-window
# Or choose a session explicitly:
harness-cli attach-window --session "my-project"
```

In the compositor, the default Ctrl-A prefix followed by d detaches the client. Detaching is not killing the session. The compositor’s navigation is not identical to the native GUI; consult its command reference for advanced bindings.

## When multiple clients have different sizes

The default smallest sizing mode lets every attached client vote on the terminal size. Owner mode follows the client that owns the surface’s size; other clients adapt their view. Use Take Size in the pane menu when you need control.

**Terminal**

```shell
harness-cli size-mode smallest
# Alternative policy:
harness-cli size-mode owner
```

Layout persistence, scrollback persistence, and keeping a live process running are separate concerns. A daemon restart can restore saved history and recreate a layout, but is not a guarantee that a build, editor, or shell process continues uninterrupted.

## Reusable setups and closed layouts

Saved Setups captures the current session’s tabs, split ratios, directories, and shell paths. It deliberately does not capture running command arguments; startup commands are entered explicitly. Open returns to an existing setup session, while Open New Copy creates another.

Recently Closed retains the last 20 closed layouts per host and restores fresh shells. These new workspace tools are separate from the legacy save-layout and restore-layout commands above, which can capture running command lines.

## Source references

- [README.md](https://github.com/robzilla1738/harness-terminal/blob/2f843e5625086fbd33e58a724c632e47bfe66d1d/README.md)

- [docs/MODES.md](https://github.com/robzilla1738/harness-terminal/blob/2f843e5625086fbd33e58a724c632e47bfe66d1d/docs/MODES.md)

- [docs/COMMANDS.md](https://github.com/robzilla1738/harness-terminal/blob/2f843e5625086fbd33e58a724c632e47bfe66d1d/docs/COMMANDS.md)

- [docs/MULTIPLEXER_GUIDE.md](https://github.com/robzilla1738/harness-terminal/blob/2f843e5625086fbd33e58a724c632e47bfe66d1d/docs/MULTIPLEXER_GUIDE.md)

- [docs/WORKSPACE-WORKFLOWS.md](https://github.com/robzilla1738/harness-terminal/blob/2f843e5625086fbd33e58a724c632e47bfe66d1d/docs/WORKSPACE-WORKFLOWS.md)

- [docs/SESSION-SERVICE-UPDATES.md](https://github.com/robzilla1738/harness-terminal/blob/2f843e5625086fbd33e58a724c632e47bfe66d1d/docs/SESSION-SERVICE-UPDATES.md)

## Related guides

- https://thebestterminal.com/docs/saved-setups

- https://thebestterminal.com/docs/recently-closed

- https://thebestterminal.com/docs/remote-sessions

