,

tmux, Zellij, herdr and friends: terminal multiplexers for remote work and AI agents, and their supply-chain risks

LEARN · MODERN DATA ENGINEERING

A terminal multiplexer is one of the most useful tools you can add to a remote development environment. It transforms an ordinary terminal connection into a persistent workspace containing shells, editors, test runners, monitoring dashboards and AI coding agents.

Disconnect from SSH, close your laptop, switch networks or move to another computer. As long as the remote multiplexer server and its processes remain alive, your workspace stays available.

In 2026, terminal multiplexers are particularly relevant to AI-assisted software development. Running several coding agents simultaneously creates a new organizational challenge: managing independent tasks, monitoring progress, responding to approval requests and preventing agents from interfering with one another.

However, multiplexers also introduce a significant security consideration. Software capable of reading terminal output, controlling interactive applications and loading third-party extensions occupies a privileged position in your development environment.

This guide covers both sides: building productive terminal workspaces and protecting them against supply-chain attacks, unsafe automation and accidental credential exposure.

1. What is a terminal multiplexer?

A terminal multiplexer manages multiple virtual terminals independently of the terminal connection used to access them.

Without a multiplexer, losing an SSH connection can terminate interactive shells and their associated processes. With a multiplexer running remotely, the connection becomes an interface to an independently managed workspace.

Developer laptop
       |
       | SSH
       |
Remote development server
       |
       +-- Multiplexer server
            |
            +-- Session: development
            |    |
            |    +-- Window: application
            |    |    +-- Pane: editor
            |    |    +-- Pane: tests
            |    |
            |    +-- Window: monitoring
            |         +-- Pane: application logs
            |
            +-- Session: agents
                 +-- Pane: implementation agent
                 +-- Pane: review agent

Essential terminology

  • Session: A collection of terminal workspaces that can remain active without an attached client.

  • Window or tab: A logical group of terminals.

  • Pane: An individual terminal occupying part of a window.

  • Detach: Disconnect the interface while leaving the session running.

  • Attach: Connect to an existing session.

  • Server: The background process managing terminal environments.

  • Client: The interface through which you interact with those environments.

  • PTY: A pseudoterminal that allows interactive applications to behave as though they were connected to a conventional terminal.

Unlike simply launching background commands, multiplexing preserves interactive terminal environments. Editors, debuggers, language REPLs and coding agents can remain available for continued interaction.

Persistence is not checkpointing

A multiplexer protects against client disconnections, not every possible failure.

Closing your laptop generally does not interrupt a multiplexer running on a remote server. Rebooting that server, however, terminates its running processes.

Session restoration features may reconstruct layouts, working directories and application commands, but they cannot generally restore the arbitrary in-memory state of running applications.

For production services and critical unattended workloads, use a service manager such as systemd, a job scheduler or an appropriate orchestration platform.

A multiplexer is a persistent interactive workspace, not a replacement for production process supervision.

2. Choosing a terminal multiplexer in 2026

Versions and documentation

The version baseline for this guide is November 26, 2026:

The practical recipes target Linux, Bash, Git and GNU coreutils. The tmux configuration and every shell recipe in sections 3 and 4 were run on Linux with Bash and Git (the agent recipe with a stub in place of the agent CLI); the Zellij, Herdr and WezTerm snippets were checked against each project’s current documentation and release notes.

Distribution packages may differ from these upstream versions. Distributions also backport security fixes, so an older package version does not automatically indicate an unpatched vulnerability.

2.1. tmux — the standard for remote development

Written in C, tmux uses a client/server architecture. Its background server manages sessions, windows, panes and their associated processes. Clients communicate with that server through a Unix-domain socket.

Its greatest strength is programmability: almost everything you can do interactively can also be automated using tmux commands.

Install the distribution-provided package on Debian or Ubuntu:

sudo apt update
sudo apt install tmux
tmux -V

Create your first named session:

tmux new-session -s development

The default command prefix is Ctrl+b. Press it, release it, and then press the desired command key.

Default shortcuts are case-sensitive:

Shortcut

Action

Ctrl+b, c

Create a window

Ctrl+b, %

Split into side-by-side panes

Ctrl+b, “

Split into vertically stacked panes

Ctrl+b, arrow key

Navigate between panes

Ctrl+b, z

Toggle pane zoom

Ctrl+b, d

Detach

Ctrl+b, [

Enter copy mode

Ctrl+b, ?

Display keybindings

After detaching, list and reconnect to sessions:

tmux list-sessions
tmux attach-session -t development

You can reconnect from another computer without interrupting the applications running inside the session.

A minimal, security-conscious tmux configuration

The following command creates a configuration for tmux 3.3 or later and backs up any existing configuration first.

if [[ -f "$HOME/.tmux.conf" ]]; then
    cp -p "$HOME/.tmux.conf" \
        "$HOME/.tmux.conf.backup.$(date +%s)"
fi

cat > "$HOME/.tmux.conf" <<'EOF'
# Enable mouse-based navigation and resizing.
set -g mouse on

# Raise scrollback to 5000 lines (default 2000); lower it if secrets may appear.
set -g history-limit 5000

# Number windows and panes from 1.
set -g base-index 1
setw -g pane-base-index 1
set -g renumber-windows on

# Disable OSC 52 clipboard integration.
set -s set-clipboard off

# Disable escape-sequence passthrough.
set -g allow-passthrough off

# Reload configuration with prefix + r.
bind r source-file ~/.tmux.conf \; display-message "Reloaded"

# Dependency-free status bar.
set -g status-left '[#S] '
set -g status-right '%Y-%m-%d %H:%M'
EOF

chmod 600 "$HOME/.tmux.conf"

For tmux 3.7 and later, including the 3.8 baseline, get-clipboard already defaults to off; set it explicitly so a later change cannot silently enable clipboard queries:

printf '\nset -s get-clipboard off\n' >> "$HOME/.tmux.conf"

Reload the configuration when a server is running:

tmux source-file "$HOME/.tmux.conf"

The allow-passthrough option requires tmux 3.3 or later. The separate get-clipboard option was introduced in tmux 3.7. Do not add unsupported options to older distribution packages.

This configuration intentionally avoids third-party plugins.

Advantages: Excellent scripting, widespread availability, low resource requirements and a mature ecosystem.

Weaknesses: A learning curve, specialized configuration syntax and no native understanding of coding-agent lifecycle states. Restoration after a server restart requires additional tooling or scripts.

Best use case: Remote development, infrastructure administration and reproducible terminal automation.

2.2. GNU Screen — the dependable fallback

GNU Screen remains useful on minimal servers, older infrastructure and systems where installing additional software is undesirable.

Its interface is less discoverable than newer alternatives, but its core purpose remains the same: maintaining interactive terminal sessions independently of a client connection.

sudo apt install screen
screen -v
screen -S maintenance

Detach using Ctrl+a followed by lowercase d.

Reconnect later:

screen -ls
screen -r maintenance

Screen uses Ctrl+a as its default command prefix, and its conventional user configuration file is ~/.screenrc.

Screen is not abandoned software. Version 5.0.3 is a security-fix release announced in November 2026.

Advantages: Established, lightweight and suitable for basic session persistence.

Weaknesses: Less intuitive region management, fewer modern extensions and no built-in coding-agent monitoring.

Best use case: Remote administration and maintenance on infrastructure where Screen is already available.

2.3. Zellij — a modern terminal workspace

Zellij is a Rust-based terminal multiplexer focused on discoverability, declarative layouts and extensibility.

Its visible interface helps users discover keyboard shortcuts without first memorizing an extensive command vocabulary.

Features include tiled and floating panes, KDL-based layouts, WebAssembly plugins, plugin permission prompts, session resurrection and an attention inbox introduced in the 0.46 release series.

Version 0.46.1 also introduces a CLI event subscription mechanism that allows external programs to receive structured workspace events.

Creating a declarative layout

Rather than issuing a sequence of commands to arrange terminals, Zellij lets you describe the desired workspace.

Create a layout containing four shells across two tabs:

mkdir -p "$HOME/.config/zellij/layouts"

cat > "$HOME/.config/zellij/layouts/development.kdl" <<'EOF'
layout {
    tab name="Development" {
        pane split_direction="vertical" {
            pane name="Editor" size="60%"
            pane split_direction="horizontal" {
                pane name="Tests"
                pane name="Terminal"
            }
        }
    }
    tab name="Monitoring" {
        pane name="Logs"
    }
}
EOF

Start the workspace from outside an existing Zellij session:

zellij --session development \
    --layout "$HOME/.config/zellij/layouts/development.kdl"

The logical arrangement of the development tab is:

+----------------------------------------------+
| Development             | Monitoring         |
+--------------------------+-------------------+
|                          | Tests             |
| Editor                   |                   |
|                          +-------------------+
| 60% width                | Terminal          |
|                          |                   |
+--------------------------+-------------------+

The layout creates shells, not automatically running editors or test suites. This makes it independent of the project’s programming language.

Because the workspace is declarative, you can version-control it alongside your source code.

Session resurrection

Zellij can serialize session layouts and application commands, optionally including terminal content, and reconstruct the workspace after a restart.

This does not restore process memory. An interrupted migration, debugger session or coding-agent operation may still require manual recovery.

Advantages: Discoverable controls, floating panes, declarative layouts, integrated resurrection and permission-aware plugins.

Weaknesses: Less universally installed than tmux, evolving plugin interfaces and additional privacy considerations associated with session serialization.

Best use case: Developers who value structured layouts and a modern terminal experience without maintaining extensive shell automation.

References: Layouts, plugin permissions and the v0.46.1 configuration source.

2.4. Herdr — multiplexing designed for AI coding agents

Herdr TUI is a Rust-based multiplexer designed around autonomous and semi-autonomous coding workflows.

This section concerns the terminal-based Herdr project, rather than its separate graphical application.

The fundamental difference between tmux and Herdr is agent awareness. A conventional multiplexer manages terminal processes; Herdr also attempts to understand what supported coding agents are doing.

Its lifecycle indicators include:

  • Working: The agent is actively processing a task.

  • Blocked: The agent appears to need input or approval.

  • Done: The agent has completed activity that has not yet been acknowledged.

  • Idle: The agent is available for another task.

  • Unknown: Its state cannot be determined reliably.

Imagine managing four coding agents:

Workspace: ecommerce-platform

Agent         Task                    State
------------------------------------------------
Codex         Implement pagination    Working
Claude Code   Review authentication   Blocked
OpenCode      Investigate tests       Done
Gemini CLI    Explore documentation   Idle

Instead of repeatedly checking every terminal, you can focus on agents requiring attention.

These indicators are not correctness guarantees. An agent marked as done may still have introduced regressions or misunderstood its assignment.

The socket API

Herdr exposes a local socket API allowing scripts and agents to interact with its workspace.

Documented capabilities include pane management, reading terminal output, sending input, reporting agent state and waiting for events.

The installed application can describe its own API:

herdr --version
herdr api schema

Export its machine-readable schema:

herdr api schema --json > herdr-api-schema.json

This is preferable to copying API examples written for an unidentified development build.

Herdr combines process detection, terminal-output heuristics and supported agent integrations. Its 0.9.5 release, for example, changed how Codex activity is detected and corrected handling of blocked Claude Code sessions.

Advantages: Native agent monitoring, persistent workspaces, programmable pane orchestration and integrations with existing terminal-based coding agents.

Weaknesses: A young, pre-1.0 project, evolving interfaces, imperfect agent detection and a larger security-sensitive automation surface. Local executable plugins also introduce ordinary executable-code risks.

Best use case: Developers supervising several coding agents concurrently who want better visibility without implementing their own orchestration system.

The official documentation now lives under the Herdr TUI documentation path. Consult its API, configuration, agent and session-state guides alongside the 0.9.5 release notes.

2.5. WezTerm — multiplexing inside the terminal emulator

WezTerm takes a different architectural approach. It is a GPU-accelerated terminal emulator written in Rust that also implements terminal multiplexing.

Instead of necessarily running a separate multiplexer inside your terminal emulator, WezTerm can manage panes, tabs, windows and multiplexer domains directly.

A domain represents a collection of multiplexed terminals. Domains can be local or remote, with SSH, Unix-domain socket and TLS connection mechanisms.

Check your installed build:

wezterm --version

You can connect to an SSH host alias using:

wezterm ssh devbox

An ordinary SSH connection is not itself a persistent remote multiplexer domain. For remote persistence, configure an SSH multiplexing domain with the necessary remote WezTerm components.

The November 2026 development build used as this article’s reference corresponds to upstream commit e1eae81a. It is a development snapshot, not a newly published stable release; the most recent stable release is still 20240203-110809-5046fc22.

That distinction matters: a recent nightly build can contain fixes and improvements while also introducing regressions. Pin and test an exact build rather than treating the moving nightly channel as a reproducible dependency.

Advantages: Integrated desktop experience, Lua configuration, GPU-accelerated rendering and local or remote multiplexing domains.

Weaknesses: Greater dependence on a particular terminal ecosystem, additional remote-server configuration and no dedicated coding-agent lifecycle monitoring.

Best use case: Developers who prefer an integrated desktop terminal experience over separate terminal and multiplexer applications.

Reference: WezTerm multiplexing documentation.

2.6. Multiplexer comparison

Feature

tmux

GNU Screen

Zellij

Herdr TUI

WezTerm

Language

C

C

Rust

Rust

Rust

Configuration

tmux.conf

screenrc

KDL

TOML

Lua

Extensions

Shell plugins

Scripts

WebAssembly

Executable plugins

Lua plugins

Detach/reattach

Yes

Yes

Yes

Yes

Persistent domains

Restart restoration

External tooling

Limited layout recreation

Built-in

Built-in, agent resume

External tooling

Remote access

SSH

SSH

SSH, web client (token)

SSH, remote clients

SSH/TLS domains

Agent features

Scriptable panes

Basic automation

Attention inbox, CLI events

Native agent monitoring

General automation

Maturity

Established

Established

Active, pre-1.0 but widely used

Young, pre-1.0

Established

For conventional remote development, tmux remains an excellent starting point. Zellij is attractive when discoverability and declarative configuration matter. Herdr is particularly interesting when supervising coding agents becomes a substantial part of your workflow.

3. Practical terminal multiplexer recipes

3.1. A resilient development environment over SSH

Suppose you have a Linux development server that you access from multiple computers.

The objective is to reconnect to the same workspace automatically whenever you open an interactive SSH shell.

On the remote machine, append the following configuration to ~/.bashrc once:

cat >> "$HOME/.bashrc" <<'EOF'

# Automatically attach during interactive SSH logins.
if [[ $- == *i* ]] &&
   [[ -n "${SSH_CONNECTION:-}" ]] &&
   [[ -z "${TMUX:-}" ]] &&
   [[ -t 0 && -t 1 ]] &&
   command -v tmux >/dev/null 2>&1; then
    tmux new-session -A -s remote-dev
fi
EOF

This assumes your Bash login configuration sources .bashrc, as is customary on many Linux distributions.

The conditions prevent the automation from interfering with noninteractive SSH commands and recursively starting tmux inside itself.

From your local computer, connect to the server:

read -rp "SSH destination (user@hostname): " destination
ssh "$destination"

The -A option makes tmux attach to the named session if it exists or create it otherwise.

Inside tmux, start a harmless long-running task:

for i in $(seq 1 300); do
    printf '%s iteration=%s\n' "$(date -Is)" "$i"
    sleep 2
done

Detach using Ctrl+b, d. Log out of SSH, reconnect and observe that the task has continued running.

This works provided the remote host’s session-management policies permit user processes to survive logout.

For an occasional connection without modifying shell configuration, explicitly request a remote tmux session:

read -rp "SSH destination (user@hostname): " destination
ssh -t "$destination" 'tmux new-session -A -s remote-dev'

Use this alternative instead of automatic attachment if you prefer conventional SSH behavior.

3.2. Launch a complete project workspace with one command

A reproducible development workspace should contain the same logical terminals every time it starts.

The following launcher creates four named panes and derives its session name from the project’s canonical directory path. Different repositories therefore receive different sessions, even when their directory names are identical.

Install the launcher:

mkdir -p "$HOME/bin"

cat > "$HOME/bin/project-workspace" <<'EOF'
#!/usr/bin/env bash
set -euo pipefail

PROJECT="$(cd "${1:-$PWD}" && pwd -P)"
HASH="$(printf '%s' "$PROJECT" | sha256sum)"
SESSION="project-${HASH:0:16}"

if ! tmux has-session -t "=$SESSION" 2>/dev/null; then
    MAIN="$(tmux new-session -d -P -F '#{pane_id}' \
        -s "$SESSION" -n development -c "$PROJECT")"

    RIGHT="$(tmux split-window -h -P -F '#{pane_id}' \
        -t "$MAIN" -c "$PROJECT")"

    TESTS="$(tmux split-window -v -P -F '#{pane_id}' \
        -t "$RIGHT" -c "$PROJECT")"

    LOGS="$(tmux split-window -v -P -F '#{pane_id}' \
        -t "$MAIN" -c "$PROJECT")"

    tmux select-pane -t "$MAIN" -T editor
    tmux select-pane -t "$RIGHT" -T terminal
    tmux select-pane -t "$TESTS" -T tests
    tmux select-pane -t "$LOGS" -T logs

    tmux set-option -w -t "$MAIN" pane-border-status top
    tmux set-option -w -t "$MAIN" \
        pane-border-format '#{pane_title}'

    tmux select-pane -t "$MAIN"
fi

if [[ -n "${TMUX:-}" ]]; then
    tmux switch-client -t "=$SESSION"
else
    exec tmux attach-session -t "=$SESSION"
fi
EOF

chmod 700 "$HOME/bin/project-workspace"

Run it from your project directory:

"$HOME/bin/project-workspace" "$PWD"

The resulting workspace looks approximately like this:

+----------------------+----------------------+
| editor               | terminal             |
|                      |                      |
| Source code          | Interactive shell    |
+----------------------+----------------------+
| logs                 | tests                |
|                      |                      |
| Application output   | Test execution       |
+----------------------+----------------------+

The launcher captures pane identifiers directly from tmux instead of assuming particular pane numbers.

Repeated execution reuses the corresponding project session. Launching it from another project creates a separate workspace.

3.3. Run multiple AI coding agents with Git worktrees

Running agents in separate terminal panes does not prevent them from overwriting one another’s files.

Git worktrees address this by providing independent working directories and branches backed by the same repository history.

This example launches two independent Codex CLI agents, one implementing tests and the other improving documentation.

Prerequisites:

  • Linux with Bash, Git, GNU coreutils and tmux installed.

  • An existing, trusted Git repository containing at least one commit.

  • An installed and authenticated Codex CLI.

  • Sufficient account access to run two concurrent agent sessions.

Use the official installation instructions for your platform, select an appropriate release and record the installed version.

Check the installation and authenticate interactively if necessary:

git --version
tmux -V
codex --version
codex

Complete authentication, verify that the agent starts successfully and exit before continuing.

Create the agent workspace

Run the following block from your repository:

(
    set -euo pipefail

    ROOT="$(git rev-parse --show-toplevel)"
    RUN="$(date -u +%Y%m%dT%H%M%S)-$$"
    SESSION="agents-$RUN"
    BASE="${ROOT}-agent-worktrees/$RUN"

    command -v codex >/dev/null

    mkdir -p "$BASE"
    chmod 700 "$BASE"

    printf 'Run ID: %s\nWorkspace: %s\n' "$RUN" "$BASE"

    git -C "$ROOT" worktree add \
        -b "agents/$RUN/tests" "$BASE/tests" HEAD

    git -C "$ROOT" worktree add \
        -b "agents/$RUN/docs" "$BASE/docs" HEAD

    MAIN="$(tmux new-session -d -P -F '#{pane_id}' \
        -s "$SESSION" -n agents -c "$BASE/tests")"

    DOCS="$(tmux split-window -h -P -F '#{pane_id}' \
        -t "$MAIN" -c "$BASE/docs")"

    tmux select-pane -t "$MAIN" -T tests
    tmux select-pane -t "$DOCS" -T documentation

    tmux set-option -w -t "$MAIN" pane-border-status top
    tmux set-option -w -t "$MAIN" \
        pane-border-format '#{pane_title}'

    tmux select-layout -t "$MAIN" even-horizontal
    tmux select-pane -t "$MAIN"

    if [[ -n "${TMUX:-}" ]]; then
        tmux switch-client -t "=$SESSION"
    else
        tmux attach-session -t "=$SESSION"
    fi
)

Each invocation creates a unique run identifier, avoiding collisions with branches and worktrees from previous runs.

Launch the agents

In the tests pane, start:

codex "Inspect this repository and add focused regression tests. Do not change production code. Explain your changes."

Switch to the documentation pane and start:

codex "Review and improve the project documentation. Do not modify application code or tests. Explain your changes."

Both commands launch interactive coding-agent sessions using the documented positional prompt interface. Neither disables sandboxing nor automatically approves elevated operations.

Review each agent’s permissions before approving its actions.

Review and clean up

After both agents finish, inspect their changes. From the original repository:

git worktree list

Select the run identifier printed during setup:

read -rp "Agent run ID: " RUN

ROOT="$(git rev-parse --show-toplevel)"
BASE="${ROOT}-agent-worktrees/$RUN"

git -C "$BASE/tests" status --short
git -C "$BASE/tests" diff

git -C "$BASE/docs" status --short
git -C "$BASE/docs" diff

Review untracked files as well, because ordinary Git diffs do not display their contents.

Commit accepted changes in their respective worktrees and integrate them into your primary branch using your normal Git review process.

Exit both agents and close their panes before removing the worktrees. Once you have preserved the desired changes:

git worktree remove "$BASE/tests"
git worktree remove "$BASE/docs"

git branch -d "agents/$RUN/tests"
git branch -d "agents/$RUN/docs"

rmdir "$BASE"

Git normally refuses to remove dirty worktrees or delete unmerged branches. Treat those refusals as safety checks rather than bypassing them automatically.

If setup fails halfway through, use git worktree list to identify what was created and remove only the unused worktrees and branches after reviewing their contents. The next invocation creates a new run, so partial setup does not prevent future attempts.

Important: Git worktrees prevent many accidental editing conflicts, but they are not security sandboxes. Agents sharing an operating-system identity may still have access to common files, credentials and multiplexer sockets.

4. Security: the hidden cost of powerful terminal environments

Terminal multiplexers occupy an unusually sensitive position in the software stack. They interact with shells, applications, source code, credentials, remote servers, terminal emulators and increasingly AI agents.

A compromised plugin or insecure control interface can potentially expose everything accessible to your operating-system account.

Understanding these trust boundaries is essential before introducing extensions or autonomous terminal automation.

4.1. The plugin supply chain

Consider the dependency chain behind a customized terminal:

Operating system
    |
Terminal emulator
    |
Terminal multiplexer
    |
Plugin manager
    |
Third-party plugin
    |
Additional dependencies and external services

Each layer introduces software whose behavior you must trust.

A status-bar plugin displaying Git information may appear harmless. However, a shell-based implementation can potentially access your source code, SSH configuration, environment variables and authentication credentials.

Visual simplicity does not imply limited privileges.

4.2. TPM and unpinned tmux plugins

TPM, the tmux Plugin Manager, makes installing community extensions convenient.

Its installation implementation uses Git to clone plugin repositories, including their submodules. Unless a branch or tag is specified, installation retrieves the repository’s default branch.

This means installing the same configuration on different dates can produce different executable code.

Repository contents can change through ordinary development, compromised maintainer accounts, ownership transfers or compromised dependencies.

Dependency maintenance status in 2026

Neither TPM nor tmux-resurrect currently publishes formal GitHub Releases through its respective release page.

GitHub’s repository listings show TPM activity in May 2026, while tmux-resurrect’s last commit dates from March 2023.

These dates are repository activity indicators, not guarantees of active security maintenance.

Neither project publishes GitHub Releases; both have only old Git tags (TPM v3.1.0, tmux-resurrect v4.0.0), and tags can be moved, so the only immutable identifier is a full commit: in November 2026, tmux-resurrect’s default branch pointed at cff343cf9e81983d3da0c8562b01616f12e8d548. Review the code at such a commit before pinning it, as shown below. The recommended workspace configuration deliberately installs neither plugin.

For production environments, maintain your own reviewed dependency manifest rather than assuming that an old, popular plugin is automatically trustworthy.

Pinning a plugin to an exact commit

TPM supports branch or tag selection, but branches are mutable and tags can potentially be moved.

For stronger reproducibility, manually stage a plugin at an independently reviewed full commit identifier.

The following example downloads tmux-resurrect without activating it:

(
    set -euo pipefail
    umask 077

    DIR="$HOME/.local/share/tmux-plugins/tmux-resurrect"

    mkdir -p "$(dirname "$DIR")"

    git clone --no-checkout \
        https://github.com/tmux-plugins/tmux-resurrect.git \
        "$DIR"

    git -C "$DIR" log --all --oneline -n 15

    read -rp "Independently reviewed commit SHA: " COMMIT

    if [[ ! "$COMMIT" =~ ^[0-9a-f]{40}$ ]]; then
        echo "Expected a full Git commit SHA."
        exit 1
    fi

    git -C "$DIR" checkout --detach "$COMMIT"

    test "$(git -C "$DIR" rev-parse HEAD)" = "$COMMIT"

    git -C "$DIR" show --stat HEAD
    git -C "$DIR" ls-files

    git -C "$DIR" rev-parse HEAD > "${DIR}.revision"
)

The recorded revision makes the selected dependency reproducible. The script deliberately refuses to overwrite an existing installation through Git’s normal clone behavior.

Before activating the plugin, inspect its entry points, shell scripts, external downloads, filesystem operations and dependencies.

For signed commits, Git can additionally verify the signature:

git -C "$HOME/.local/share/tmux-plugins/tmux-resurrect" \
    verify-commit HEAD

A valid signature must correspond to an independently trusted signing identity. An unsigned commit is not necessarily malicious, but it lacks that particular authenticity guarantee.

Apply the same review and pinning process to TPM itself if you decide to install it.

Pinning establishes reproducibility, not trustworthiness. A malicious commit remains malicious when pinned.

4.3. Zellij WebAssembly plugins: better boundaries, not automatic safety

Zellij implements plugins using WebAssembly rather than unrestricted shell-based extensions.

WebAssembly provides a structured execution environment in which access to host functionality is mediated through runtime interfaces.

Zellij plugins can originate from local files, built-in identifiers or remote URLs.

Its plugin permission model defines 17 permissions, among them:

  • ReadApplicationState: Inspect workspace state.

  • ChangeApplicationState: Modify workspace state.

  • RunCommands: Execute external commands.

  • WriteToStdin: Send input to terminal applications.

  • OpenFiles: Open files.

  • WebAccess: Make HTTP requests.

  • ReadPaneContents: Access terminal content.

  • FullHdAccess: Read and write the whole filesystem.

  • ReadSessionEnvironmentVariables: Read the session’s environment variables, which often hold tokens.

  • WriteToClipboard: Write to the system clipboard.

  • StartWebServer: Serve HTTP from inside the session.

  • InterceptInput: See the keystrokes typed into the session.

Third-party plugins request protected capabilities through permission prompts. Built-in plugins are granted every permission.

This is a useful security improvement over executing arbitrary shell extensions without a multiplexer-specific permission model.

Nevertheless, a permission prompt is only effective when the user understands the requested authority.

A clock plugin should not ordinarily need to execute commands or read another pane’s output.

For sensitive environments, prefer reviewed local WebAssembly artifacts, verify their checksums and avoid loading plugins from mutable remote URLs.

A WebAssembly sandbox limits certain capabilities; it does not eliminate vulnerabilities in the runtime, host interfaces or permission design.

4.4. Remote installation scripts and unsigned release binaries

Modern command-line tools frequently advertise installation through a downloaded shell script.

The convenience is obvious. A single command detects your operating system, downloads the appropriate binary and configures your environment.

The security drawback is equally important: piping a network response directly into a shell removes the opportunity to inspect the downloaded program before execution.

Prefer authenticated distribution packages whenever they meet your requirements. For newer upstream releases, separate downloading, verification and installation.

Verify a downloaded artifact

The following Linux example verifies a file against an independently obtained SHA-256 digest:

(
    set -euo pipefail

    read -rp "Downloaded file path: " FILE
    read -rp "Trusted SHA-256 digest: " EXPECTED

    if [[ ! "$EXPECTED" =~ ^[0-9a-fA-F]{64}$ ]]; then
        echo "Invalid SHA-256 digest."
        exit 1
    fi

    ACTUAL="$(sha256sum < "$FILE" | cut -d ' ' -f 1)"

    if [[ "${ACTUAL,,}" != "${EXPECTED,,}" ]]; then
        echo "Checksum mismatch. Do not install."
        exit 1
    fi

    echo "SHA-256 checksum matches."
)

A matching checksum confirms that the artifact corresponds to the expected digest.

However, an attacker capable of replacing both a release binary and its published checksum may defeat this protection.

Where available, verify release signatures or provenance attestations against independently trusted identities.

If an upstream release provides neither signatures nor verifiable provenance, acknowledge that limitation when evaluating its suitability.

For nightly builds, including WezTerm development snapshots, record both the source revision and artifact digest. A moving nightly download URL is not a reproducible version reference.

4.5. The multiplexer server socket

The tmux client communicates with its server through a Unix-domain socket.

On Linux, the default socket commonly resembles:

/tmp/tmux-1000/default

Here, 1000 is the user’s numeric UID.

The location can change through TMUX_TMPDIR or explicit socket configuration.

The containing directory is an important security boundary. Unrelated operating-system users should not be able to access it.

Inspect the default socket directory and its contents:

SOCKET_DIR="${TMUX_TMPDIR:-/tmp}/tmux-$(id -u)"

if [[ -d "$SOCKET_DIR" ]]; then
    stat -c '%A %a %U %G %n' "$SOCKET_DIR"

    find "$SOCKET_DIR" \
        -maxdepth 1 \
        -type s \
        -exec stat -c '%A %a %U %G %n' {} \;
else
    echo "No default tmux socket directory found."
fi

A typical private directory looks like this:

drwx------ 700 developer developer /tmp/tmux-1000

Directory permissions matter even when individual socket permission bits appear broader.

Never make the socket directory world-accessible simply to facilitate collaboration.

Shared sessions and pair programming

tmux supports simultaneous clients, allowing developers to observe or interact with the same workspace.

An additional client can attach in read-only mode:

tmux attach-session -r -t development

This restricts that client’s normal interaction. It does not prevent another process with sufficient socket access from establishing a more privileged connection.

Modern tmux also supports server-level access controls for cross-user collaboration. Consult the tmux 3.8 manual before configuring shared access.

Anyone with unrestricted access to a multiplexer server should effectively be treated as someone trusted to operate the terminal environment.

Herdr’s API socket carries the same authority to read pane output and send input. Check its location and permissions, and never mount it into agent containers or share it with other users. Zellij’s browser web client (zellij web, since 0.43) is a similar surface: keep it on localhost or behind TLS or a VPN such as Tailscale, revoke unused login tokens and give observers read-only tokens.

4.6. Agent-driven panes and the confused-deputy problem

Agent-aware multiplexers introduce an additional trust boundary: programs can interact with other interactive programs.

Herdr explicitly exposes this capability through its socket API. Traditional multiplexers such as tmux also provide general-purpose pane automation.

This creates a potential confused-deputy problem.

A confused deputy is a privileged component manipulated into exercising its authority on behalf of an entity that should not possess that authority.

Consider the following environment:

Untrusted repository
        |
        v
Coding agent
        |
        v
Multiplexer control interface
        |
        +-- Test environment
        +-- Developer shell
        +-- Production administration shell

An agent reviewing repository content should not automatically receive authority over a production administration shell.

Indirect prompt injection makes this particularly important. Repository documentation, application logs, issue descriptions and terminal output may contain instructions designed to influence an agent.

Those instructions are untrusted data, not legitimate authorization.

If an agent can both interpret untrusted text and control other panes, the consequences of an incorrect trust decision become more significant.

Defensive measures include:

  • Separate production administration from agent workspaces.

  • Restrict cross-pane automation to explicitly authorized tasks.

  • Use dedicated operating-system accounts for different trust levels.

  • Avoid mounting unrestricted multiplexer sockets into agent containers.

  • Preserve human approval for consequential administrative operations.

  • Keep credentials out of agent-accessible terminal output.

Separate organizational boundaries from security boundaries

You can create independent tmux servers using named sockets:

tmux -L development new-session -A -s dev

After detaching, create a separate server for agent experiments:

tmux -L agents new-session -A -s experiments

These servers maintain different session namespaces and socket names.

However, both remain accessible to processes running under the same operating-system identity unless additional isolation is introduced.

Separate sessions and socket names reduce accidental interference. Dedicated accounts, restricted containers or virtual machines provide stronger security boundaries.

Git worktrees, panes and agent lifecycle indicators are organizational tools, not privilege-separation mechanisms.

4.7. Terminal escape-sequence injection

Terminal output is not necessarily passive text.

Terminal emulators interpret control sequences that can change colors, reposition the cursor, modify window titles and activate terminal-specific integrations.

Consequently, displaying untrusted output can have effects beyond rendering ordinary characters.

Potential sources include application logs, downloaded files, repository-controlled build scripts, filenames and AI-generated content.

Control sequences may manipulate the visual presentation of information, obscure warnings or interact with clipboard features.

OSC 52 and clipboard access

OSC 52 is a terminal control mechanism associated with clipboard operations.

It is particularly useful over SSH because remote terminal applications can request clipboard operations from a supporting local terminal emulator.

Depending on the terminal implementation and configuration, applications may be able to modify clipboard contents or request existing clipboard data.

This creates confidentiality and integrity concerns.

For example, unexpected clipboard modification may cause a developer to paste content different from what they intended.

For tmux 3.8, the following commands disable clipboard integration, clipboard-query forwarding and general escape-sequence passthrough:

tmux set-option -s set-clipboard off
tmux set-option -s get-clipboard off
tmux set-option -g allow-passthrough off

These settings were included in the earlier configuration recipe.

Remember the minimum versions:

  • set-clipboard: Available throughout the versions relevant to this guide.

  • allow-passthrough: tmux 3.3 or later.

  • get-clipboard: tmux 3.7 or later.

These restrictions sacrifice some clipboard convenience and do not disable every integration exposed by the outer terminal emulator.

Review that emulator’s clipboard and escape-sequence settings separately.

Reference: Official tmux clipboard documentation.

Safely inspect suspicious terminal output

When inspecting untrusted text, render control characters as printable representations rather than sending them directly to the terminal.

The following Python utility reads a maximum of 8 KiB and escapes non-ASCII and control characters.

Create the utility:

mkdir -p "$HOME/bin"

cat > "$HOME/bin/safe-preview" <<'EOF'
#!/usr/bin/env python3

import sys
from pathlib import Path

if len(sys.argv) != 2:
    raise SystemExit("Usage: safe-preview FILE")

path = Path(sys.argv[1])

with path.open("rb") as handle:
    data = handle.read(8192)

text = data.decode("utf-8", errors="backslashreplace")

for line in text.split("\n"):
    print(ascii(line))
EOF

chmod 700 "$HOME/bin/safe-preview"

Test it against an ordinary system file:

"$HOME/bin/safe-preview" /etc/os-release

The utility produces printable representations of the file’s contents instead of interpreting embedded terminal controls.

It requires Python 3 and no third-party dependencies.

This is a lightweight inspection technique, not a comprehensive terminal security solution.

4.8. Secrets in scrollback and session-restoration files

Terminal output often survives much longer than developers expect.

A credential printed into a pane may remain accessible after the application that produced it has exited.

Common examples include API tokens, environment variable dumps, authentication responses, database connection strings and deployment credentials.

Multiplexers retain terminal history. Persistence plugins and session-resurrection features may additionally write workspace information to disk.

Zellij supports session serialization and optional terminal-content serialization.

For sensitive environments, review the relevant options supported by your installed version before enabling resurrection.

For example, generate the installed configuration reference:

zellij setup --dump-config

Inspect its serialization settings without modifying your active configuration:

zellij setup --dump-config | grep -i -C 3 serializ

The installed configuration reference is preferable to blindly copying settings from an older release or development branch.

Even when terminal-content serialization is disabled, restored command information may contain sensitive command-line arguments.

Avoid placing secrets directly in commands. Prefer appropriate credential stores or secure authentication mechanisms.

In tmux, clearing the visible terminal and the current pane’s retained history can help remove accidental exposure:

clear
tmux clear-history

Text you copied is also kept in tmux paste buffers: list them with tmux list-buffers and remove one with tmux delete-buffer -b NAME.

This does not erase shell history, application logs, other terminal-emulator buffers, backups or previously serialized session files.

If a credential was exposed, revoke or rotate it rather than relying exclusively on history deletion.

5. Case study: a real terminal vulnerability from 2026

CVE-2026-49864 — when terminal output becomes executable browser content

A particularly relevant security vulnerability affected WeTTY, a browser-based terminal application providing remote terminal access.

The vulnerability concerned filename handling during terminal-driven file downloads.

Affected versions processed attacker-controlled filename information without appropriate HTML escaping, creating a DOM-based cross-site scripting vulnerability.

Under the documented conditions, malicious terminal output could lead to browser-side JavaScript execution and compromise the integrity of an active SSH session.

The important details are:

  • CVE identifier: CVE-2026-49864.

  • Product: WeTTY.

  • Vulnerability: DOM-based cross-site scripting.

  • Affected versions: Versions earlier than 3.0.4.

  • First patched version: 3.0.4.

  • GitHub advisory published: July 1, 2026.

  • CVE publication date: August 13, 2026.

  • CVSS 4.0 score: 8.6 — High.

Sources: NVD — CVE-2026-49864 and upstream GitHub security advisory GHSA-p26j-h7wj-r568.

What makes this vulnerability particularly instructive is the crossing of several trust boundaries:

Untrusted terminal output
           |
           v
Terminal application's download handler
           |
           v
Unsafe browser rendering of filename data
           |
           v
JavaScript execution in the browser context
           |
           v
Compromised SSH session integrity

The lesson extends beyond WeTTY.

Terminal software frequently interprets information rather than merely displaying it. Clipboard integration, browser rendering, notifications, plugins and agent automation all introduce additional interfaces where untrusted data may cross into a privileged context.

Terminal software therefore deserves the same security attention as browsers, IDEs and remote administration tools.

6. Terminal multiplexer hardening checklist

Before introducing multiplexers into sensitive development environments or autonomous coding workflows, complete this security audit:

  • Install software from authenticated repositories or verified upstream artifacts.
  • Keep both the terminal emulator and multiplexer updated.
  • Check distribution advisories for backported security fixes.
  • Remove unnecessary plugins and integrations.
  • Pin external plugins to independently reviewed revisions.
  • Verify release checksums, signatures and available provenance.
  • Avoid executing unreviewed remote installation scripts.
  • Keep multiplexer socket directories private.
  • Separate agent workspaces from production administration.
  • Restrict cross-pane automation and agent privileges.
  • Disable unnecessary clipboard operations and escape-sequence passthrough.
  • Avoid exposing credentials in terminal output.
  • Review scrollback retention and session-restoration settings.
  • Rotate credentials following accidental exposure.

The underlying principle is least privilege: provide each component with the capabilities necessary for its purpose, without automatically granting access to the entire development environment.

7. Which terminal multiplexer should you choose?

Choose tmux for mature, portable and highly scriptable remote development. Its command interface makes it particularly suitable for reproducible infrastructure and project-specific launchers.

Choose GNU Screen when you need straightforward persistence on minimal infrastructure where it is already available.

Choose Zellij when declarative layouts, discoverable controls, floating panes and integrated session resurrection are important.

Choose Herdr when monitoring multiple coding agents is central to your workflow. Its agent-awareness features are compelling, but its young release history warrants deliberate version pinning and upgrade testing.

Choose WezTerm when you want multiplexing integrated directly into your desktop terminal emulator, provided you understand the stability implications of using its recent development builds.

These tools can also complement one another. WezTerm can serve as your local terminal emulator while tmux maintains persistent development sessions on remote infrastructure.

Avoid combining multiple orchestration layers unless each solves a clearly identifiable problem.

Conclusion

Terminal multiplexers originally addressed a straightforward problem: keeping interactive terminal applications available independently of a particular connection.

In 2026, they increasingly function as programmable development environments capable of organizing repositories, supervising AI coding agents and coordinating persistent remote workflows.

That evolution makes their security properties increasingly important.

Plugins are executable dependencies. Socket APIs are privileged control interfaces. Scrollback can contain credentials. Terminal output can activate integrations. Agent lifecycle indicators do not establish correctness or trust.

Your next step: Install tmux or Zellij from a trusted source, create a persistent SSH workspace and deliberately disconnect to test its resilience. Build a reproducible project layout, launch two coding agents in separate Git worktrees, review their changes and clean up their environments.

Then complete the security hardening checklist before introducing third-party plugins, unrestricted cross-pane automation or production credentials.

Build a terminal environment that is not only productive, but reproducible, observable and secure.