VS Code Remote-SSH + AI Coding Assistants on HPC

Introduction

This page walks through setting up a robust, persistent AI-assisted development workflow against OSU HPC clusters (ASC, Unity, OSC) through the ASC jumphost — using VS Code Remote-SSH as the editor and terminal host.

Audience: BuckAI students, postdocs, and collaborators who want to develop code (with help from an AI coding assistant) against files and compute resources living on a cluster reachable only through the ASC jumphost.

Prerequisites: A working SSH setup (see SSH Setup and SSH Keys) — you should already be able to ssh unity from a plain terminal with one Duo prompt and connection multiplexing in place.

AI assistants covered: Claude Code (Anthropic), GitHub Copilot (Microsoft/GitHub), and Gemini Code Assist (Google). OSU students typically have institutional access to several of these — see Section 7.1 below.


Why this setup?

Running an AI coding assistant directly inside a plain SSH session on the cluster works, but has three real problems:

  1. SSH disconnects lose state. Network blips, laptop sleep, or VPN hiccups kill your session and discard your conversation history mid-task — sometimes leaving files half-edited.
  2. tmux has rough edges. Scrolling degrades over time; alternate-screen-buffer issues require manual reset; the learning curve is steep.
  3. Duo MFA is painful. Every new SSH connection through the jumphost triggers a separate Duo push, and parallel connections (like VS Code makes) can race each other and time out.

This guide solves all three by combining:

  • SSH connection multiplexing (already set up in SSH Setup) — authenticate once, get every subsequent connection for free
  • VS Code Remote-SSH — automatic reconnection, persistent server-side state, native terminal scrollback
  • An AI coding assistant VS Code extension — visual diff review, inline completions, integrated chat — shared with the cluster-side terminal

The end result:

✔ You authenticate with one Duo tap ✔ Your editor and terminals live on the cluster but render locally ✔ Files are real (not mounted), and execution happens where the data lives ✔ Your session survives laptop sleep and network interruptions


Prerequisites checklist

Before starting, you should have:

  • A Mac (these instructions are macOS-specific in places; Linux is analogous)
  • An ASC account with SSH access to the jumphost and Unity
  • A working ~/.ssh/config from the SSH Setup page, including the Host * multiplexing block
  • An SSH key generated and installed on ASC (SSH Keys)
  • An account with at least one AI assistant provider (Anthropic, GitHub, or Google). For Claude Code specifically, the cluster-side CLI must also be installed — confirm with ssh unity which claude. GitHub Copilot and Gemini Code Assist don’t need a cluster-side CLI; they live entirely in the VS Code extension.

Section 7 below covers each AI assistant separately — pick whichever fits your access.


1. Install VS Code

If you don’t have it:

brew install --cask visual-studio-code

Or download from code.visualstudio.com.


2. Install the Remote-SSH Extension

  1. Open VS Code
  2. Click the Extensions icon in the left sidebar (or Cmd+Shift+X)
  3. Search for Remote - SSH
  4. Install the one published by Microsoft (verified publisher)

3. Configure VS Code Timeouts

VS Code’s default SSH timeout is tight when Duo is in the loop. Bump it.

  1. Cmd+Shift+P → type Preferences: Open User Settings (JSON) → Enter
  2. Your settings file opens. It may already contain something like:
{
    "workbench.colorTheme": "Default Light Modern"
}
  1. Add the following keys, paying careful attention to commas:
{
    "workbench.colorTheme": "Default Light Modern",
    "remote.SSH.connectTimeout": 120,
    "remote.SSH.useLocalServer": true,
    "remote.SSH.showLoginTerminal": true,
    "remote.SSH.remotePlatform": {
        "unity": "linux"
    }
}

JSON comma rule: every entry needs a comma after it except the last one before the closing }. If VS Code shows red squiggly underlines, you broke this rule.

  1. Save the file (Cmd+S).

What these settings do

Setting Effect
remote.SSH.connectTimeout: 120 Wait up to 2 minutes for the SSH handshake (accommodates Duo)
remote.SSH.useLocalServer: true Use your local SSH binary, so ~/.ssh/config is honored
remote.SSH.showLoginTerminal: true Show the SSH login terminal during connect, so Duo prompts and errors are visible (invaluable for debugging)
remote.SSH.remotePlatform.unity: "linux" Pre-declare the OS so VS Code skips a detection step

4. Connect to the Cluster

  1. Cmd+Shift+PRemote-SSH: Connect to Host…
  2. Select unity from the list (VS Code reads your ~/.ssh/config)
  3. VS Code opens a new window and starts connecting
  4. Watch your phone for one Duo push → approve
  5. VS Code will download and install its server component on the cluster (one-time, takes ~30 seconds)
  6. The bottom-left corner of the VS Code window should show:
✅ SSH: unity

in green when connected.

If the connection fails with “Connecting with SSH timed out”

  • Cmd+Shift+PRemote-SSH: Show Log and read the actual error
  • Most often this means SSH multiplexing isn’t working; re-verify Section 7 of SSH Setup (ssh unity twice should give one Duo and one instant connect)
  • Try increasing connectTimeout to 180

5. Open Your Project Directory

Once connected:

  1. File → Open Folder…
  2. Navigate to your project on the cluster, e.g. /fs/project/<group>/<username>/my_project
  3. Click Open
  4. You may get one more Duo prompt the first time the file browser walks the filesystem — approve it

VS Code remembers recently-opened remote folders, so subsequent sessions are faster.


6. Verify Your Shell Environment

This is the step everyone skips and then regrets. VS Code’s integrated terminal on the remote host needs to source your .bashrc so your aliases, conda env, PATH, and ANTHROPIC_API_KEY are all available.

6.1 Open the integrated terminal

Ctrl+` (control + backtick) opens the terminal panel. This terminal runs on the cluster, not on your Mac. You should see your usual cluster prompt.

6.2 Check that your config is loaded

echo $ANTHROPIC_API_KEY    # should print your key
alias                       # should list your aliases
which claude                # only if you'll use Claude Code — should print a path on Unity

If any of these are missing, your shell startup files aren’t being sourced correctly.

6.3 Common fix: source .bashrc from .bash_profile

Edit ~/.bash_profile on the cluster to ensure it sources .bashrc:

# At the end of ~/.bash_profile, add:
[ -f ~/.bashrc ] && source ~/.bashrc

The reason this matters: VS Code’s integrated terminal usually starts as a login shell on Linux, which reads ~/.bash_profile but not ~/.bashrc unless the former explicitly sources the latter.

6.4 Force a login shell (if needed)

If your aliases still aren’t appearing, force the terminal to run as a login shell. In VS Code’s settings JSON, add:

"terminal.integrated.profiles.linux": {
    "bash (login)": {
        "path": "bash",
        "args": ["-l"]
    }
},
"terminal.integrated.defaultProfile.linux": "bash (login)"

7. Install an AI Coding Assistant VS Code Extension

VS Code Remote-SSH plus an AI coding assistant is the productive combination this guide is really about. Pick whichever assistant matches your access — all three work over Remote-SSH following the same general pattern.

7.1 OSU institutional access to enterprise-privacy AI tools

OSU students typically have access to multiple AI assistants through their institutional accounts, often with enterprise privacy guarantees stronger than what consumer/free accounts provide (no use of your prompts for model training, retention limits, audit guarantees, etc.):

Tool OSU access route
Microsoft Copilot (M365 + GitHub) Through your OSU Microsoft 365 / buckeyemail.osu.edu account. GitHub Copilot is free for verified students via GitHub Education — sign up with your .osu.edu email.
Google Gemini / Gemini Code Assist Through your OSU Google Workspace account (most OSU buckeyemail addresses are linked to Google services).
Claude Code (Anthropic) Anthropic’s consumer plans (free or paid). OSU may have institutional access — check OCIO / OSU IT services.

Whichever tool you choose, prefer the institutional/enterprise account when working with sensitive data — privacy terms there are stricter than consumer-tier ones. Check OSU IT services for the most current list of institutional AI options.

7.2 The universal pattern: install on the REMOTE side

All three extensions follow the same critical rule when used via Remote-SSH:

You must install the AI extension on the remote (cluster) side, not just locally.

After installing any extension, open the Extensions panel (Cmd+Shift+X) and look at the two sections:

  • Local - Installed
  • SSH: unity - Installed

The AI extension must appear under SSH: unity - Installed. If it’s only local, click the extension’s gear icon and select Install in SSH: unity.

Without this, the extension can’t see the files, terminals, or code on the cluster — it’ll behave as if it’s editing your local (empty) home directory.

7.3 Option A: Claude Code (Anthropic)

Claude Code is a CLI tool that integrates with VS Code via a companion extension. The extension is not a replacement for the CLI — it’s a bridge that exposes the CLI’s session through VS Code’s diff viewer, selection-prompting, and problems panel.

Install

  1. On the cluster: install the Claude CLI per Anthropic’s instructions. Confirm: which claude should print a path.
  2. In a VS Code integrated terminal (remote side), run claude in your project directory. The extension auto-detects this and prompts to install itself — accept.
  3. Verify: in the Extensions panel, Claude Code should appear under SSH: unity - Installed.

If auto-install didn’t trigger: search “Claude Code” in the Extensions panel and explicitly Install in SSH: unity.

What the extension adds

  • Inline diff review: when Claude edits a file, VS Code’s native side-by-side diff viewer pops open. Accept or reject changes with a click.
  • Selection-based prompting: highlight code, press Option+K (Mac), and an @file.py#L23-L45 reference is inserted into your Claude prompt.
  • Terminal output references: use @terminal:name in your prompt to share a terminal’s output with Claude without copy-pasting.
  • Problems panel access: Claude sees VS Code’s linter/compiler errors.
  • Dedicated chat panel: alternative to the terminal interface, accessed via the Claude icon in the sidebar.

7.4 Option B: GitHub Copilot

GitHub Copilot is widely used and free for students through GitHub Education.

Install

  1. Make sure you’ve activated your GitHub Education student benefits (one-time, via your .osu.edu email).
  2. In VS Code’s Extensions panel (Cmd+Shift+X), search for GitHub Copilot and GitHub Copilot Chat.
  3. Install both in SSH: unity (not local — same rule as Section 7.2).
  4. When prompted, sign in with your GitHub account.

What the extension adds

  • Inline completions: as you type, Copilot suggests grey “ghost text” that you accept with Tab.
  • Chat sidebar: multi-turn conversations with /explain, /fix, /tests, etc. slash commands.
  • Inline chat: Cmd+I (Mac) opens an inline chat box right where your cursor is.
  • Workspace context: Copilot can read your open files and recent edits for context.

7.5 Option C: Gemini Code Assist (Google)

Gemini Code Assist (formerly Duet AI for Developers) is Google’s AI coding assistant.

Install

  1. Make sure you’re signed into a Google account with Gemini access (your OSU buckeyemail.osu.edu typically works through Google Workspace).
  2. In VS Code’s Extensions panel, search for Gemini Code Assist.
  3. Install in SSH: unity (not local).
  4. Sign in with your Google account when prompted.

What the extension adds

  • Inline completions as you type (similar to Copilot).
  • Chat sidebar for multi-turn conversations.
  • Code transformations via right-click menu (refactor, comment, generate tests).
  • Smart actions in Google Cloud-related code.

7.6 Comparing the three (briefly)

Feature Claude Code GitHub Copilot Gemini Code Assist
Inline completions Indirect (via CLI) ✅ Strong ✅ Strong
Chat sidebar ✅ Yes ✅ Yes ✅ Yes
File-editing diff viewer ✅ Excellent ✅ Yes ✅ Yes
Cluster-side CLI required ✅ Yes (claude) ❌ No ❌ No
Free tier Limited Free for verified students Limited
Tab-completion-driven UX Less so Primary UX Primary UX
Agent-style multi-step edits ✅ Strong Growing Growing

Most users settle on the one matching their dominant institutional account. You can also have more than one installed — they don’t conflict, though Tab-completion may compete (you can disable one’s inline completions and use it only for chat).

7.7 Optional: enable auto-save

Whichever assistant you use: in VS Code settings (Cmd+,), search auto save and set Auto Save to afterDelay with delay 1000. This ensures that when the assistant edits a file, your open editor reloads the changes cleanly without conflicting with unsaved buffer state.


8. Connecting Directly to Compute Nodes (Advanced)

For interactive sessions on a specific compute node — e.g. running a Jupyter notebook with GPU access, or attaching to a long-running job’s allocated node — you can SSH straight through the jumphost to the node. No need to hop through the login node manually.

8.1 The pattern

Each compute node gets its own Host block in ~/.ssh/config that uses Unity as a ProxyJump:

### Template for a compute node. On Unity, real node hostnames follow
### the pattern `uXXX` (a `u` followed by a number, e.g. u101, u250, u500).
### Replace `mynode` below with the actual node hostname you have access to.
Host mynode
    HostName mynode.asc.ohio-state.edu
    User yourname.##
    IdentityFile ~/.ssh/buckai_key
    IdentitiesOnly yes
    HostKeyAlgorithms +ssh-rsa
    PubkeyAcceptedAlgorithms +ssh-rsa
    ProxyJump unity

See SSH Setup §8 for the multi-hop multiplexing details.

8.2 Opening VS Code directly on a compute node

You can use VS Code Remote-SSH to connect to a compute node directly: in the Remote-SSH: Connect to Host dialog, type your node alias (e.g. mynode) instead of unity. This gives you the full VS Code experience — editor, integrated terminal, your AI assistant — running on the compute node, with no port forwarding ceremony.

8.3 Port-forwarding shortcuts for Jupyter

If you’re running Jupyter on a compute node and want to view it in a browser on your laptop, a handy shell alias is:

alias jup='ssh -L 9099:127.0.0.1:8888 mynode'

This forwards your laptop’s port 9099 to the compute node’s port 8888 (where Jupyter listens). Open http://127.0.0.1:9099 in your browser to use the notebook.

8.4 When you don’t know the node in advance

Slurm assigns interactive nodes dynamically, so for one-off sinteractive sessions you can’t pre-write a config block. In that case, do the allocation from a VS Code integrated terminal connected to Unity:

sinteractive -m 48000 -t 48:00:00 -g 1   # request a GPU node, say

Once allocated, you’re SSH’d to the compute node inside that terminal pane. For lighter-weight tools (Jupyter on the node, etc.), srun and port forwarding from inside the VS Code terminal is usually enough.


9. Daily Workflow

9.1 Starting a session

  1. Open VS Code
  2. Click the green corner in the bottom-left → Connect to Hostunity (or Cmd+Shift+PRemote-SSH: Connect to Host)
  3. Approve one Duo push
  4. File → Open Recent → your project
  5. Ctrl+` to open the integrated terminal
  6. Start your AI assistant (e.g. claude for Claude Code, or open the Copilot/Gemini chat sidebar from the VS Code activity bar)

You’re now editing files on the cluster, with your AI assistant running against the same cluster files, with diff review and chat integration wired up.

9.2 The interaction model

You have two views of every file:

  • Editor pane (top): the file as you see it. Edit by hand, scroll, search, use language features.
  • AI assistant interface (bottom or sidebar): the conversational interface — either Claude Code’s terminal, or Copilot’s / Gemini’s chat sidebar. Ask the assistant to read, write, edit, or run things.

When the assistant edits a file:

  1. The diff viewer appears
  2. Review the proposed change
  3. Accept (your file is updated on disk) or reject (file untouched)
  4. If you have auto-save on and the file was already open in an editor pane, the editor reloads automatically

Each assistant has its own shortcut for selection-based prompting — highlighting code in an editor pane and adding it to your prompt:

  • Claude Code: Option+K (Mac) inserts an @file#L23-L45 reference
  • GitHub Copilot: Cmd+I opens an inline chat at the selection
  • Gemini Code Assist: right-click → “Ask Gemini” sends the selection to the chat panel

9.3 Running cluster jobs

Slurm commands work identically — they’re just running in a terminal on the cluster. From the integrated terminal:

sinteractive -m 48000 -t 48:00:00     # request an interactive node
squeue -u $USER                       # check your queue
sbatch myjob.slurm                    # submit a batch job

For long-running interactive work on a compute node, you can:

  • Open a second integrated terminal (click the + in the terminal panel), request an interactive node there, and run your AI assistant on the compute node while the first terminal stays on the login node for monitoring
  • Or wrap sinteractive in tmux so the allocation survives disconnects

9.4 Pausing work

You can safely:

  • Close your laptop lid — VS Code’s remote server keeps running on the cluster. Reopen, the connection re-establishes automatically, terminals are still there with full state.
  • Disconnect from WiFi — same as above. VS Code reconnects when the network returns.
  • Quit VS Code entirely — your terminals on the cluster die, so any CLI-based assistant session (e.g. claude) ends. To survive a full quit, run your assistant inside tmux on the cluster (which works fine inside VS Code’s terminal too). Chat-sidebar assistants (Copilot, Gemini) lose their conversation context on full quit either way.

9.5 Ending a session

  1. Save any open files (Cmd+S, or with auto-save it’s already done)
  2. End your AI assistant session cleanly: for Claude Code, type /exit in its terminal. For Copilot/Gemini, just close the chat sidebar (nothing to “exit”).
  3. File → Close Window — VS Code keeps the remote server running for ~10 minutes in case you reconnect, then shuts it down

To force immediate disconnect: Cmd+Shift+PRemote-SSH: Kill VS Code Server on Host.


10. Troubleshooting

❌ “Connecting with SSH timed out” during Remote-SSH connect

Likely cause: SSH multiplexing isn’t working, so each of VS Code’s parallel sub-connections triggers a separate Duo prompt and they race.

Diagnostic steps:

  1. Cmd+Shift+PRemote-SSH: Show Log → check the log for the actual error
  2. From Terminal.app, run ssh unity and ssh unity again — the second one should be instant with no Duo. If not, multiplexing is broken — see SSH Setup §7.
  3. Check ~/.ssh/sockets/ exists and is writable
  4. With "remote.SSH.showLoginTerminal": true, the SSH terminal is visible during connect — watch what it actually says

❌ “no matching host key type found. Their offer: ssh-rsa”

The cluster uses a key type modern OpenSSH disables by default. Add to the relevant Host block in ~/.ssh/config:

HostKeyAlgorithms +ssh-rsa
PubkeyAcceptedAlgorithms +ssh-rsa

❌ Aliases / env vars not available in integrated terminal

Shell startup files not being sourced. See Section 6 above.

❌ Claude Code can’t find the project root

You started claude without cd-ing to the project directory first. Exit Claude (/exit), cd to the right place, restart. (Copilot and Gemini infer the workspace from VS Code’s open folder, so they don’t have this problem — but they do need you to have opened a folder in VS Code, not just a single file.)

❌ Duo prompt appears repeatedly

Likely causes:

  • Multiplexing not configured (most common)
  • ControlPersist timeout expired (default 10m — bump it if you want longer)
  • Different Host aliases pointing to the same machine — each triggers a separate Duo because SSH treats them as different connections

❌ VS Code crashes or hangs on connect

Try a clean slate:

# On your Mac
rm -rf ~/.ssh/sockets/*

# On the cluster (via plain SSH)
rm -rf ~/.vscode-server

Then retry the connection from VS Code. The cluster-side cleanup forces VS Code to reinstall its server, which fixes most weird state.

❌ Frozen terminal after running a full-screen program

Symptom: scrolling stops working, terminal seems stuck. Cause: alternate screen buffer not cleaned up (less, vim, etc. exited uncleanly). Fix: type reset (blind — you may not see it) and press Enter.

❌ Compute-node SSH works once, then hangs

Likely cause: the node’s Slurm allocation expired, but the SSH config block still points at the node. SSH connects to sshd but the node won’t let you in without a current allocation. Fix: request a fresh allocation via sinteractive on Unity, note the node hostname, and either edit the config block or use the new node directly.


11. Architecture Summary

┌─────────────────┐                            ┌──────────────────┐
│      Mac        │                            │     Cluster      │
│                 │                            │   (Unity, OSC)   │
│  ┌───────────┐  │                            │                  │
│  │  VS Code  │  │   SSH (multiplexed)        │  ┌────────────┐  │
│  │    UI     │  │◄──────────────────────────►│  │  VS Code   │  │
│  │           │  │   via ASC jumphost         │  │   Server   │  │
│  │  Editor   │  │   (one Duo prompt)         │  └─────┬──────┘  │
│  │  panes    │  │                            │        │         │
│  │           │  │                            │  ┌─────▼──────┐  │
│  │ Terminal  │  │                            │  │   bash     │  │
│  │   pane    │◄─┼─────── shared session ─────┼──│   shell    │  │
│  │           │  │                            │  └─────┬──────┘  │
│  └───────────┘  │                            │        │         │
│                 │                            │  ┌─────▼──────┐  │
└─────────────────┘                            │  │   claude   │  │
                                               │  │    CLI     │  │
                                               │  └─────┬──────┘  │
                                               │        │         │
                                               │  ┌─────▼──────┐  │
                                               │  │ Filesystem │  │
                                               │  └────────────┘  │
                                               │                  │
                                               └──────────────────┘

The UI runs locally on your Mac. Everything else — editor server, shell, Claude Code, file I/O, execution — runs on the cluster. The diff viewer and extension features bridge the UI to the CLI through VS Code’s extension API, all over the same multiplexed SSH connection.


12. Quick Reference Card

Action How
Connect Cmd+Shift+PRemote-SSH: Connect to Hostunity
Open integrated terminal Ctrl+`
Start AI assistant cd /path/to/project && claude (Claude Code) or open the Copilot/Gemini chat sidebar
Selection prompting Claude: Option+K   ·   Copilot: Cmd+I   ·   Gemini: right-click → Ask
Force reconnect click SSH: unity in bottom-left → Reload Window
Kill remote server Cmd+Shift+PRemote-SSH: Kill VS Code Server on Host
View logs Cmd+Shift+PRemote-SSH: Show Log
Clear stuck multiplex sockets rm ~/.ssh/sockets/*

13. Files Modified by This Guide

On your Mac:

  • ~/.ssh/config — multiplexing, keepalives, host definitions (SSH Setup)
  • ~/.ssh/sockets/ — connection sockets (auto-managed)
  • ~/Library/Application Support/Code/User/settings.json — VS Code Remote-SSH timeouts and login-terminal display

On the cluster:

  • ~/.bash_profile — ensure it sources .bashrc
  • ~/.bashrc — AI-tool API keys (e.g. ANTHROPIC_API_KEY), PATH, aliases
  • ~/.vscode-server/ — VS Code server (auto-managed)
  • ~/.claude/ — Claude Code state if you use it (auto-managed)
  • ~/.config/github-copilot/, ~/.config/gemini/, etc. — analogous state for other assistants (auto-managed)

Nothing in /etc or other system locations is modified.


14. When NOT to Use This Setup

This workflow is optimized for active development against cluster files. For other use cases:

  • Pure data analysis on your Mac: use your AI assistant locally, no cluster involved
  • Long-running unattended jobs: submit Slurm jobs the normal way; AI assistants are for the development phase, not the run phase
  • Brief ad-hoc commands: plain SSH or Mosh is faster to fire up
  • Offline work: none of this works without network — bring code home in a git repo