Skip to content

About

Drives an interactive Claude Code session in tmux on another machine over ssh, and starts claude.ai/code cloud sessions from it.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

A pair of white 3D glasses with see-through red and blue gel lenses.A pair of white 3D glasses with see-through red and blue gel lenses.

remote-session

CI license: Apache-2.0 release CodeQL neckbeard: 0.5.26 · read in full

remote-session lets one Claude Code session start, message, watch and stop another on a second machine, over ssh. The other session runs in tmux, so a long job keeps going while your laptop sleeps.

Use it for a long job, a review or a test run that should happen on a second computer.

What changed in each release: CHANGELOG.md

Set up

Paste this into Claude Code (in the terminal, or in the Code tab of the Claude desktop app):

Install the plugin remote-session from the marketplace jerrydboonstra/remote-session: run claude plugin marketplace add jerrydboonstra/remote-session, then claude plugin install remote-session@remote-session. Then ask me to type /reload-plugins and wait. After I have, run REMOTE_SESSION_HOST=local remote-session preflight (or the same with the host I mean to use) (it makes one small paid model call, on Haiku) and tell me in plain words what is missing and how to fix each item.

The host needs tmux, python3 and a logged-in claude, version 2.1.296 or later (tested on 2.1.328). A remote host also needs an ssh login that asks for no password; local, the machine you are on, needs no ssh. More setup has the rest.

Use it from your agent

An agent can call every command in this plugin. Five ways people use it:

  • A second opinion: start a reviewer on another machine, send it a diff, and read its verdict.
  • Long jobs off the laptop: start the job on a host, close the lid, and come back to the result.
  • A launcher for a program that runs many sessions: it calls start, send and idle instead of driving tmux itself.
  • Clean, repeatable runs and evals: each run starts a fresh session in a fresh folder, so no run inherits another's state.
  • Steering from anywhere: send, screen and approve work from any shell, and rc turns on Remote Control for an idle session (Claude Code's way to steer a session from claude.ai or the phone app). rc <name> on|off|state takes the session's short name (review-1), not its tmux name. The skill's Remote Control page has the edge cases.
Command What it does
preflight Checks the host before a run that costs something. It makes one small paid call itself, on Haiku unless you name a model.
start Begins a session. --mode is required, so nothing picks a permission mode for you.
send Gives a running session a message.
idle Says whether the session has finished.
screen Shows what the session shows.
approve, deny Answer a permission prompt.
stop Ends the session.
cloud, reload, list cloud starts a Claude Code session on claude.ai/code from a folder on the host, reload sends /reload-plugins to idle sessions, and list shows what is running.

To test a plugin without installing it, start a session with --plugin-dir PATH. PATH is an absolute folder or .zip on the host the session runs on. For that session it silently replaces an installed plugin of the same name.

remote-session help lists every command. skills/remote-session/SKILL.md is the full contract: every option, exit code and refusal. docs/integrating.md has the exit codes an agent reads, how to wait on a session, and a launcher example.

How it works

remote-session is two programs in one plugin. One runs on your machine and the other is sent to the host each time, so no part of the plugin is installed there: the host needs only what the setup page lists. lib/README.md says what each file does.

How it works. On your machine, bin/remote-session loads lib/caller-1-helpers.sh and then lib/caller-2-commands.sh, and joins lib/host-0-mod.sh, lib/host-1-helpers.sh, lib/host-2-screen.sh and lib/host-3-commands.sh into one script. The script is sent over ssh to the host, where bash runs it and drives tmux.How it works. On your machine, bin/remote-session loads lib/caller-1-helpers.sh and then lib/caller-2-commands.sh, and joins lib/host-0-mod.sh, lib/host-1-helpers.sh, lib/host-2-screen.sh and lib/host-3-commands.sh into one script. The script is sent over ssh to the host, where bash runs it and drives tmux.

On Claude Code 2.1.287 or later, sessions that start makes also load a small mod that records what they are doing, and idle reads that before the events file and the screen. REMOTE_SESSION_STATE_SOURCE=screen on the host leaves it out. idle <name> --why says which source answered.

Why not just ssh and tmux?

You could script it by hand. remote-session adds the parts that are tedious to get right:

  • A permission mode you choose, and a check before you spend: start needs --mode, so nothing picks one for you, and preflight checks the host before a run that costs money (with one small paid call of its own, on Haiku unless you name a model).
  • Knowing when a session is done: idle reads the session and prints one word (idle, busy, permission and more), with an exit code for each, so a script can wait on it.
  • One contract: start, send and stop take the same arguments and give the same exit codes on any host.
  • Tests that run offline: the test suite drives a fake claude, so it needs no network and makes no paid call.

More setup

Next steps

Safety

  • Every preflight makes one small paid call, on Haiku unless --model or REMOTE_SESSION_MODEL names another. start uses Claude Code's own default model unless you pass --model or set REMOTE_SESSION_MODEL. cloud refuses to start without --model.
  • Remote Control stays off unless you pass --remote-control.
  • On the host, remote-session keeps its state in ~/.local/state/remote-session. start makes the start folder if missing, and start and cloud record trust for the session's folder in ~/.claude.json. stop never deletes your work. What it leaves and how to remove it.
  • approve answers "Yes" to a permission prompt, so use it only for a prompt you have read and agreed to.
  • To report a security problem, read SECURITY.md.

Contributing and license

Issues and pull requests are welcome: CONTRIBUTING.md says how to run the tests.

remote-session is released under the Apache License 2.0 (LICENSE).

neckbeard, by the same author, reads a plugin the way a stranger would. It read all of remote-session; its report lists what the plugin adds to a session.

Logo made with imagegen

About

Drives an interactive Claude Code session in tmux on another machine over ssh, and starts claude.ai/code cloud sessions from it.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages