Skip to content

Add remote SSH sessions (Phase 1): remote projects, Connect, Browse, host management - #76

Closed
HAN-oQo wants to merge 1 commit into
doctly:mainfrom
HAN-oQo:feat/remote-ssh-phase1
Closed

Add remote SSH sessions (Phase 1): remote projects, Connect, Browse, host management#76
HAN-oQo wants to merge 1 commit into
doctly:mainfrom
HAN-oQo:feat/remote-ssh-phase1

Conversation

@HAN-oQo

@HAN-oQo HAN-oQo commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds remote SSH session support to Switchboard. Today Switchboard is local-only — it reads ~/.claude/projects off the local disk and spawns terminals against local shells. This PR lets you run Claude Code (and shells) on remote hosts over SSH, with remote hosts and directories treated as first-class projects alongside local ones.

Screenshots below use demo hosts (*.example.com); no real infrastructure is shown.

What's new

1. Remote projects — add a host + directory like any project

Add Project now has a Local folder | Remote (SSH) choice. Pick a host, choose a remote directory, and it appears in the sidebar with an SSH badge. Its + launches Claude/shell on that host at that path.

Add Project — Remote (SSH)

2. Interactive Connect — verify/authenticate in place

Connect runs ssh in the background and turns green when established (connection kept warm via ControlMaster, so Browse/sessions are instant afterward). A popup appears only when the host needs interaction — never a raw terminal.

Password / passphrase (masked field):

Password prompt

First-connect host-key verification (Yes/No):

Host key verify

3. Remote directory browser

Navigate the remote filesystem and pick a directory, just like the local folder picker (backed by ls over the shared SSH connection).

Remote directory browser

4. Host management

~/.ssh/config hosts are imported automatically. You can also add hosts manually (identity file + extra ssh -o options for legacy/deprecated servers), test/connect them, and optionally write a manual host into ~/.ssh/config.

Add-host form (with example option chips), and the Remote Hosts settings section:

Add SSH Host Remote Hosts settings

5. Launching remote Claude / shell

A remote project's session dialog offers Start Claude and Open shell at the chosen remote directory:

New remote session

How it works

  • Transport (shell-profiles.js, remote-hosts.js): an SSH profile mirrors the existing WSL "wrapped command" pattern. The remote command runs in a login+interactive bash so the remote PATH is set up. The payload is single-quoted to survive ssh's argv re-join + remote-shell re-parse (handles spaces/quotes in paths).
  • Model (Model A): a project is local or remote. Remote projects persist in settings (remoteProjects) and inject into the sidebar via a synthetic ssh://<host>/<dir> path; live sessions group under them.
  • Auth: interactive sessions use a real PTY, so password / passphrase / FIDO passkey / 2FA / host-key confirmation are answered by the user — Switchboard never stores secrets. ControlMaster multiplexing means one authentication is reused by Browse and subsequent sessions.
  • No IDE/MCP over SSH yet — that's a later phase; remote sessions fall back to the CLI's normal editor behavior.

Testing

  • 25 unit tests (node --test) covering SSH arg assembly, ~/.ssh/config parsing, the quoting/transport (verified against a faithful ssh re-parse), remote-command assembly, host config, and ls parsing.
  • Manual: launched against real hosts (key/agent and password auth), verified Connect → Browse → Start Claude/shell, host add + write-to-config.
  • No DB/schema changes.

Roadmap

Remote SSH support ships in phases, ordered by effort‑to‑value — each is independently useful and lands as its own PR. This PR is Phase 1.

  • Phase 1 — Remote sessions & host management (this PR): launch Claude/shell on remote hosts; remote hosts + directories as first‑class projects; interactive Connect; remote directory Browse; host config (import, manual add, identity/options, write‑to‑~/.ssh/config). No DB/schema changes.
  • Phase 2 — Indexing, search & resume (Add remote SSH sessions (Phase 2): index, search & resume past sessions #77): index a connected host's past sessions (metadata over the existing SSH connection — no transcript copied to disk) so they persist in the sidebar, are searchable, and resume/fork in a terminal on the host. Adds a source column to the cache/search tables.
  • Phase 3 — IDE emulation over SSH: reverse‑forward the IDE MCP socket (ssh -R) so remote proposed diffs / file opens land in Switchboard's side panel (behind a setting).

Why this order: Phase 1 delivers the core "run Claude Code on my server" value with the least new machinery (reuses the node‑pty + shell‑profile path, mirroring how WSL is modeled); Phase 2 unlocks history, search, and resume; Phase 3 adds richer IDE workflows. Nothing later blocks shipping this one.

(Remote Control — claude --remote-control for live cross-device mirroring — is orthogonal to local-vs-remote and is tracked separately, not part of this roadmap.)

@HAN-oQo
HAN-oQo force-pushed the feat/remote-ssh-phase1 branch from 6403e8a to efa6e46 Compare July 13, 2026 09:24
Run Claude Code and shells on remote hosts over SSH. Remote hosts and directories
are first-class projects alongside local ones — no local-only assumption anymore.

- shell-profiles + remote-hosts: SSH shell profiles (mirrors the existing WSL
  wrapped-command pattern), ~/.ssh/config parsing, remote command assembly
  (single-quoted to survive ssh's argv re-parse), ControlMaster multiplexing.
- main.js: open-terminal remote branch (skips local-path checks, local cwd=$HOME,
  no MCP/shim), plus IPC for remote projects, interactive connect, remote dir
  browse, host save/test, and write-to-~/.ssh/config.
- session-cache: persisted remote projects injected into the sidebar; live remote
  sessions group under them (remote Claude reads as a Claude session).
- renderer: Add Project (Local | Remote SSH) with "+ Add new host", inline Connect
  with structured password / host-key popups (no raw terminal), remote directory
  browser, host management in Settings, SSH badges.
- 30 unit tests (node --test).

Auth stays with the user: passwords/passphrases/passkeys/host-key confirmations are
entered by the user; nothing is stored. Remote session indexing/search (Phase 2),
fork/resume on the remote (Phase 3), and IDE-over-SSH (Phase 4) are deferred — see
the PR description.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@HAN-oQo

HAN-oQo commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #78, which combines remote-SSH Phase 1–3 into a single PR for easier review.

@HAN-oQo HAN-oQo closed this Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant