# Build Anything with Tmux, Here's How
<!--
ref: @content/youtube/david-ondrej/build-anything-with-tmux-here-s-how
tags: [tmux, terminal multiplexer, persistent sessions, VPS, coding agents, long-running agents, SSH]
version: 2
updated_at: 2026-11-24T07:17:21.856Z
-->

**[Watch on YouTube](https://www.youtube.com/watch?v=z7xyZQVK4Dg)**

# Build Anything with Tmux, Here's How

*Synthesized from David Ondrej, 2026-05-25.*

David Ondrej presents this tutorial alone, first showing tmux on a local Mac and then setting it up on a remote Linux server reached over SSH. The source is an automatic caption track with frequent misspellings (it renders tmux as "T-Max" and ChatGPT as "CHBT"), so tool names here are normalized.

## Core Thesis
David Ondrej argues that tmux is a basic tool for agentic engineers because a tmux session keeps running after the terminal disconnects, so long coding-agent runs survive a closed laptop, a battery drain or a dropped connection. He recommends hosting those sessions on a small remote VPS and reaching them over SSH, so agents can work for hours or days while the local machine stays free.

## Key Insights
- **Why persistence matters for agents.** He contrasts runs of about 5 to 10 minutes a year earlier with goal-style features in Codex and Hermes that can run for days, which would otherwise require a laptop kept awake and plugged in.
- **Three building blocks.** A session is the whole workspace, windows act like browser tabs, and panes are split screens inside one window. Because tmux can create, read and write panes programmatically, agents in one pane can read what agents in other panes are doing.
- **Core commands he demonstrates.** Start a named session with `tmux new -s <name>`, detach with Ctrl-B then D, reattach with `tmux attach -t <name>`, list with `tmux ls`, split horizontally with Ctrl-B then `%` and vertically with Ctrl-B then `"`, and stop everything with `tmux kill server`. He calls enabling mouse support non-negotiable, since without it panes cannot be clicked or scrolled.
- **VPS setup.** He uses a small Ubuntu VPS, which he describes as the "KVM2" tier with about 2 GB of RAM, and says that is enough for several agents in parallel. He connects with the SSH command from the provider panel and the root password, checks whether tmux is already installed, and installs it if not (he reports version 3.4).
- **Installing the agents.** Codex CLI is installed from OpenAI's documented one-line command and signed in with device-code login. Claude Code is installed with its one-line installer and signed in with a subscription account. He runs each agent inside its own tmux pane or session, and he uses a skip-permissions launch flag for the demo only.
- **Demo output.** Agents built a flight-monitoring web app in SvelteKit with Vite and a single-file 3D browser game, each in its own tmux session. He detaches, kills the SSH connection entirely, reconnects, runs `tmux ls`, and reattaches to find the app still running.
- **Reaching a dev server.** The app runs with its dev server bound to all interfaces on port 5173, and the Mac opens it through an SSH tunnel at localhost on that port.
- **Stated limits and tips.** Work keeps running if the internet drops, the laptop runs out of memory, or the lid closes. On a Mac, holding Option while dragging selects text instead of tmux's pane selection once mouse mode is on. He estimates 40 to 60 minutes for a first-timer to set everything up.

## Actionable Takeaways
1. Install tmux locally (he uses Homebrew on macOS) and practice new, detach (Ctrl-B then D), attach and `tmux ls` before running any agent under it.
2. Turn on tmux mouse support so panes can be clicked and scrolled.
3. Provision a small Ubuntu VPS, SSH in, confirm or install tmux, and give each coding agent its own named session.
4. Start the agent inside tmux before giving it a long goal; he says he launched Claude Code outside tmux by mistake and had to redo it.
5. Test persistence by closing the SSH connection and reattaching to the same session.
6. Run dev servers bound to all interfaces and reach them from the local browser through an SSH tunnel; hold Option to select text while mouse mode is on.

## Notable Quotes
> "keeps your terminal alive even when you disconnect" — David Ondrej

> "T-max on a VPS is non-negotiable." — David Ondrej

> "If my internet gets disconnected, my agents keep running." — David Ondrej

---

*Related: `@protocol/memento` · `@content/youtube/yifan-bth/claude-code-beat-cursor-4-2-heres-why-im-still-using-both` · `@content/youtube/david-ondrej/hermes-agent-is-crazy-180-000-github-stars` · `@content/youtube/david-ondrej/tailscale-clearly-explained-beginners-guide` · `@content/youtube/cole-medin/ai-makes-us-way-faster-but-fries-our-focus-heres-what-i-do-about-it`*

---

*You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).*

*Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*