blog /
Claude Code tmux Remote Setup, and What It Leaves Out
Two things get confused on a server: keeping Claude Code alive and knowing what it is doing. tmux solves the first and says nothing about the second. A Claude Code tmux remote setup is short: ssh -t into the server, open a named tmux session, run claude, detach, and come back with the same line. This post walks through those steps, adds the one tmux option that decides whether alerts reach you, and then does the same job with qoop, which covers the second thing.
Before you start
You need four things.
- A server you can reach with
ssh, withtmuxinstalled there.tmux -Vprints its version. For a broader tour of the server side, see running Claude Code on a remote server. - Claude Code installed on that server, and the project checked out there too. The agent reads and writes the server's disk, not your laptop's.
- A terminal on your laptop. By default Claude Code sends a desktop notification only from Ghostty, Kitty and iTerm2. Other terminals can ring the bell instead (step 4).
- For step 5 only, a qoop account: sign up at qoop.si with Google, Apple, GitHub or email.
Step 1: Set up tmux on the server
tmux runs a server process on the machine, and your terminal is only a client of it. The tmux manual says each session survives an accidental disconnection such as an ssh timeout. That is the persistence story, and tmux does it well.
Open a session from your laptop with one command:
ssh -t devbox tmux new -A -s claude
Use your own ssh host name for devbox. -t forces a pseudo-terminal, which a full-screen program needs. new -A -s claude creates a session named claude, or attaches to it when it already exists, because the manual says -A makes new-session behave like attach-session in that case. So one line serves the first start and every return.
Step 2: Run Claude Code in a session
You are now inside tmux, with a status line at the bottom. Start the agent in the project:
cd ~/projects/api
claude
Work as usual. tmux listens for a prefix key, ctrl-b by default, then one more key:
ctrl-bthenddetaches. The session keeps running.ctrl-bthencopens a new window,ctrl-bthennmoves to the next one.ctrl-bthen[enters copy mode to scroll the history.ctrl-bthen?lists every key binding.
Step 3: Reattach after a drop
Close the laptop or kill the terminal tab, then run the same line again:
ssh -t devbox tmux new -A -s claude
To look around first, log in normally, run tmux ls to list sessions, then tmux attach -t claude. Claude Code kept going in the meantime, because the process belongs to the tmux server on the machine, not to your ssh connection. The manual also says any number of clients can attach to one session, so a second laptop can watch the same screen, and ctrl-b then D lets you choose a client to detach. More on that failure mode in keeping Claude Code running after an SSH disconnect.
If the server itself restarted, the session is gone. Start claude --continue in the project directory: Claude Code resumes the most recent interactive session in the current directory.
Step 4: Set allow-passthrough on
By default, when Claude Code runs inside tmux, desktop notifications and the progress bar never reach your outer terminal. The Claude Code terminal docs give this block for ~/.tmux.conf. It goes on the server, since tmux runs there:
set -g allow-passthrough on
set -g focus-events on
set -s extended-keys on
set -as terminal-features 'xterm*:extkeys'
Apply it with tmux source-file ~/.tmux.conf, then detach, attach again and restart Claude Code, as the docs say. The first line is the one for alerts: it lets notifications and progress updates reach the outer terminal. The two extended-keys lines let tmux tell Shift+Enter from plain Enter. The focus-events line is part of the same docs block.
Three details decide whether an alert actually shows up:
- Outside Ghostty, Kitty and iTerm2, set
"preferredNotifChannel": "terminal_bell"in~/.claude/settings.jsonon the server to ring the bell instead. - In iTerm2, open Settings, Profiles, Terminal, tick "Notification Center Alerts", click "Filter Alerts" and enable "Send escape sequence-generated alerts".
- The tmux manual says that with
on, passthrough sequences are allowed only while the pane is visible, and withallthey pass even from an invisible pane. By that definition, an agent in a window you are not looking at is covered only byall. Try it if alerts from background windows go missing.
What a Claude Code tmux remote setup leaves out
The process now survives. What you still lack is state.
- tmux is not agent-specific. It knows sessions, windows, panes and bells. It does not know whether Claude Code is working, waiting on a permission prompt or finished. The closest thing it has is a marker for windows with a bell or activity, and
M-n(Meta plus n) jumps to the next marked window. - Claude Code's Notification hook has delays:
permission_promptfires after a prompt has waited about six seconds,idle_promptabout 60 seconds after Claude finished. - Claude Code can report working, waiting and done to a terminal that implements the OSC 7501 status protocol. Inside tmux it checks tmux for that support instead, and
allow-passthroughhas no effect on it. The docs say to start the session outside tmux, and ask for Claude Code v2.1.295 or later. - Every server is its own ssh login and its own tmux, so four servers mean four sessions to open one at a time.
The price of this setup is small and paid once per server: a few lines of config, a terminal on the Ghostty, Kitty or iTerm2 list (or the bell), and the habit of opening windows to see where each agent stands. If you run one agent on one server and the bell is enough, steps 1 to 4 are the answer. Stop there.
Step 5: Do the same job with qoop
qoop runs on your laptop and reaches the server through the system ssh and your ~/.ssh/config, so your keys and jump hosts carry over. Add the server once, then start qoop:
qoop remote add devbox me@devbox
qoop
If the server has no qoop, remote add offers to install it there and waits for your yes. On a Linux server, enable lingering once with sudo loginctl enable-linger <user> so the agents outlive your login. The server's spaces then sit beside yours, named like devbox:api, and anything you open in one runs on the server. On a bare server, pick the default space it lists and open a tab there (its + starts an agent and asks for its name). Later, ctrl-a w from a server space names a new space, which is made on that server. Leave with ctrl-q; qoop again returns you to the same space, tab and pane. With the lid closed the agents keep working. If the connection drops, those spaces turn offline in about fifteen seconds and come back by themselves.
Each agent has a dot mark: the centre breathes while it works, an empty ring means it wants you, the full square means it finished. One row at the top names the agent waiting for an answer, and ctrl-a tab jumps to it. When an agent is blocked, failed or finished and you are not looking, qoop sends a desktop notification naming it, or rings the bell when it cannot. Over ssh it uses only terminal escapes, so the note appears on your side. If your laptop terminal runs tmux, put the same allow-passthrough on line in the laptop's own ~/.tmux.conf.
For the phone, run qoop login on the laptop and sign in at https://qoop.si/app with the same account. To reach the server with the laptop off, pair the server itself: ssh -t devbox '~/.local/bin/qoop pair', then scan the code in the qoop app (Android today; a browser cannot pair by code). Costs: qoop is early access and needs installing on both ends. Longer comparison: qoop vs tmux, hooks and SSH.
| Job | tmux on the server | qoop |
|---|---|---|
| Start | ssh -t devbox tmux new -A -s claude, then claude | qoop remote add devbox me@devbox once, then qoop |
| Leave and return | ctrl-b then d; the same ssh line | ctrl-q; qoop |
| Which agent needs you | open each window and read it | dot marks, the top row, ctrl-a tab |
| Alert | set -g allow-passthrough on plus a terminal that shows it | desktop notification, bell as fallback |
Check it worked
For tmux:
- Start a long task, detach, close the terminal, and run the ssh line from step 3. The same screen is back, task still running.
- Trigger a permission prompt, then switch to another app. A notification or a bell should reach your laptop.
For qoop:
- Run
qoop remote ls: one line per remote, name then target. - Open
qoop, start an agent in adevbox:space, switch apps, and wait for the notification.
When it does not work
- No alert in your Claude Code tmux remote session: confirm
set -g allow-passthrough onis in~/.tmux.confon the server, that you rantmux source-file ~/.tmux.conf, and that you detached, attached again and restarted Claude Code. - Still nothing, or alerts only from one window: allow your terminal app to send notifications in the OS settings, turn Do Not Disturb off, and try
allinstead ofon. qoop remote addrefuses the target: it accepts only the ssh options-p -l -i -J -4 -6and a short list of-okeys, and prints the list when it refuses one.- No desktop note from qoop:
qoop settingsshows which path a note from this terminal takes, or why there is none.
For the agent list and the alert on your own screen across servers, sign up at qoop.si.