Guide · Remote SSH

Run AI coding agents on a remote machine over SSH

Baton stays on your computer. Agents, terminals, Git, and worktrees run on a Linux or macOS machine you can reach with ssh, and they keep running when you close your laptop.

Keeps running Agents run in tmux on the remote machine. Lose Wi-Fi or quit Baton, then reattach to the same session.
Pick up anywhere Workspaces sync through the host, so another computer can open them and attach to the running agents.
Feels local Notifications, MCP, live Git status, file editing, and browser previews all work over SSH.
Nothing to expose Plain SSH from your computer. No Baton server on the remote machine and no open ports.
On this page
  1. How it works
  2. Requirements
  3. Connect a machine
  4. Working in an SSH workspace
  5. Notifications, MCP, and previews
  6. Use it from several computers
  7. Local copy
  8. Security
  9. Troubleshooting

How it works

Baton keeps the workspace list, terminal rendering, and settings on your computer. The remote machine holds the repository and runs everything that touches the code: agents, shells, builds, tests, and Git. Baton connects with your system's ssh, so the hosts, keys, and jump hosts in ~/.ssh/config work as they do in your terminal.

Your computer

Baton app Workspace list, terminals, settings
Notifications and MCP Answered by Baton on loopback
Local copy Optional one-way copy of the files

Remote machine

Agents in tmux Claude Code, Codex, Antigravity CLI, OpenCode
Repository and worktrees ~/.baton/repos and ~/.baton/worktrees
Remote Companion Watches Git status, runs the baton CLI
Every connection runs over SSH. The data tunnel listens only on the remote machine's loopback interface, and source files stay on the remote machine unless you use a Local copy.

Requirements

Remote machine Linux or macOS x86_64 or arm64. Windows machines can't be used as hosts.
Remote tools Git, tmux, and curl or wget Plus standard Unix tools such as awk, sed, and base64. Baton checks for them.
Access Working SSH login If ssh you@host works in your terminal, Baton can use it.
Optional rsync on both machines Only needed for a Local copy.

Baton itself can run on macOS, Windows, or Linux. On Windows it uses the built-in OpenSSH client or WSL, and Local copies aren't available.

Connect a machine

  1. Make sure SSH works.

    From a terminal on your computer, run ssh you@host. Load your key into ssh-agent if it has a passphrase.

  2. Add the machine.

    Open Settings → SSH Hosts → Connect machine and enter a name, host or IP address, user, and port. Advanced SSH options holds the identity file, extra ssh arguments, saved port forwards, and the remote Baton path (~/.baton by default, fixed once connected).

  3. Check the machine.

    Check machine tests SSH access, Git and your Git identity, tmux, the required utilities, and rsync. Password, passphrase, and host key prompts appear in Baton.

  4. Set it up.

    Set up machine creates Baton's folders under the remote Baton path and installs small helper scripts. If the remote machine has no Git name and email, Baton copies yours.

  5. Enable agent integrations.

    On Remote machine ready, click Enable next to Notifications and MCP Server for each agent you use, then Finish setup. For Codex, run /hooks once on the remote machine to approve Baton's hooks.

  6. Create a workspace.

    The new machine becomes the default environment in the New Workspace dialog. Pick a project and branch. The first workspace clones the repository on the remote machine, and later ones reuse that clone.

Forward SSH agent is on by default, so agents can clone private repositories and push with the keys on your computer. Read Security before you connect a machine you don't fully trust.

Working in an SSH workspace

Agents keep running
Every terminal runs in a tmux session on the remote machine. If your connection drops, your laptop sleeps, or you quit Baton, the agents carry on. Select the workspace to reattach. To reattach a single pane without stopping it, use More → Reconnect SSH Session in the pane's context menu.
Join from your own terminal
Hover the host pill in a pane header and choose Copy tmux attach command. It joins the same session from any terminal without detaching Baton.
Files and Git
Browse, edit, and save remote files in the file tree and editor, and review diffs as usual. Commit, pull, push, merge, rebase, and switch branches from the toolbar. Git runs on the remote machine, and the sidebar's change counts update as files change.
Setup steps and links
Workspace setup steps run on the remote machine. The Upload .env to SSH recipe copies a local .env into each new workspace. Linked workspaces work between workspaces on the same machine.
Baton CLI and port forwards
The baton command is on the PATH in SSH terminals, so agents can open tabs, start workspaces, and open previews. For services you always want forwarded, add port forwards in either direction under the host's Advanced SSH options. They bind to 127.0.0.1 only.

Notifications, MCP, and previews

While a workspace is connected, Baton keeps a data tunnel open to the remote machine. It's an SSH reverse forward from a port on the remote loopback interface (in the 62000–63999 range) back to Baton.

Integrations are per machine. Change them in Settings → Integrations & MCP on the tab named after the host. Baton shows Update available there when a newer hook is ready.

Use it from several computers

Start an agent on your desktop, then check on it from your laptop. Each SSH workspace keeps a small manifest on the host, and every computer with Sync with other devices turned on (the default) picks up the others' workspaces.

To choose by hand instead, open the host's Workspaces panel in Settings → SSH Hosts, turn off Sync with other devices, and use Add here on the workspaces you want.

Local copy

Some work needs the files on your own disk: building a desktop or mobile app, running a simulator, or a tool that only works locally. For that, Baton can keep a Local copy of an SSH workspace.

Treat the Local copy as disposable. Make changes on the remote machine, where the agents and Git are. A Local copy needs rsync on both machines and isn't available when Baton runs on Windows.

Security

Only SSH crosses the network
Baton opens no ports on either machine. The data tunnel's remote end listens on 127.0.0.1 on the remote machine and leads to a gateway on your computer's loopback interface. The gateway labels each request with the host it came from before passing it to Baton.
Use a machine you trust
Anything on the remote machine that can reach its loopback port can send requests to Baton for that host, including notifications and MCP calls. Anyone who can act as your remote user can also read the code and Baton's helper files. Use a machine and account you control, and avoid hosts shared with people you don't trust.
SSH agent forwarding

Forward SSH agent is on by default. Your private keys stay on your computer, but while you're connected, any process running as your remote user can ask your ssh-agent to sign with them. Turn it off in the host's settings for machines you don't fully trust, and give the remote machine its own, narrowly scoped Git credentials instead.

Forwarded keys go away when the connection drops. Agents keep running in tmux, but they can't push until you reconnect, unless the remote machine has its own credentials.

Removing a machine
When you delete a host, Delete all Baton data from this host is on by default. It's off when other computers may still be using workspaces there.

Troubleshooting

Check machine can't connect

Run the same ssh command in a terminal on your computer. Baton uses your system ssh and ~/.ssh/config, so put jump hosts and aliases there or add them under Extra SSH args, one per line.

"tmux is required" or a tool is missing

Install it on the remote machine, for example sudo apt install tmux or brew install tmux, then click Check again.

Cloning a private repository fails

Turn on Forward SSH agent for the host and make sure your key is loaded in ssh-agent, or set up Git credentials on the remote machine.

Notifications or MCP don't arrive

Check that the integration is enabled for that agent on the host's tab in Settings → Integrations & MCP, and apply any update shown there. For Codex, approve Baton's hooks with /hooks.

A terminal shows as disconnected

Select the workspace or click Reconnect session. The agent keeps running in tmux while Baton is disconnected, so nothing is lost.

A preview doesn't open

Make sure the dev server listens on localhost on the remote machine, then use Forward Remote Port in the preview panel and enter its port.

Run your agents on a bigger machine

Free to download for macOS, Windows, and Linux.

Download Baton

Need an SSH setup Baton doesn't support yet? Get in touch.