Use VS Code and Claude Code on a Lens Agents sandbox Lens Agents 0.34.0 added SSH access to its sandboxes, letting developers run VS Code Remote-SSH and the Claude Code extension inside a sandbox with default-deny egress instead of on their laptops. The setup uses `nexusctl sandbox ssh-proxy` as an OpenSSH ProxyCommand, so each SSH session becomes one exec in the sandbox authenticated with the user's Lens Agents login, with no sshd in the image and no open port; the sandbox requires the ADMIN role on the project and a fine-grained GitHub token scoped to the agent's repositories. The VS Code server, extensions, repositories and Claude Code login persist on a 30Gi home volume, and the sample policy allows only GitHub, Anthropic and Visual Studio Marketplace domains before a catch-all allow rule. TL;DR - VS Code Remote-SSH runs the editor UI on your laptop and the rest, including the terminal and most extensions, on the remote host. - A Lens Agents sandbox speaks SSH through nexusctl , so it can be that remote. No sshd in the image, no open port. - The result: the Claude Code extension works as usual, but it runs in a sandbox with default-deny egress, not on your laptop. A coding agent in your editor is convenient. It also runs with everything your editor can reach: your files, your SSH keys, your cloud credentials, and an open network. VS Code already knows how to put the work somewhere else. This post puts it in a Lens Agents sandbox. How the pieces fit With Remote-SSH, VS Code installs a small server on the remote host. The window on your laptop draws the UI. The terminal, the file system, language servers, and most extensions run in that server. The Claude Code extension is one of them, so the agent, its tools, and its commands all run on the remote side. Remote-SSH uses plain OpenSSH, and a Lens Agents sandbox doesn't run an SSH server. Instead, nexusctl sandbox ssh-proxy acts as one on your machine, as an OpenSSH ProxyCommand . Each SSH session becomes one exec in the sandbox, authenticated with your Lens Agents login. Remote-SSH also needs a local port forward to its server, and the proxy supports that too. What you need - Lens Agents 0.34.0 or later. SSH access to sandboxes arrived in that release. If you don't have a platform yet, follow the getting started guide https://docs.lenshq.io/lens-agents/getting-started/ . - nexusctl , installed from your Lens Agents platform and logged in with nexusctl auth login . - The ADMIN role on the project where the sandbox lives. SSH access requires it. - VS Code with the Remote - SSH https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh extension. - A fine-grained GitHub token https://github.com/settings/personal-access-tokens/new with access to only the repositories the agent works on. Step 1: Define the sandbox The sandbox is a home directory on a persistent volume. The VS Code server and its extensions install into $HOME , so they survive a restart, and so do your repositories and the Claude Code login. name: VS Code Box image: ubuntu:24.04 command: sleep infinity cpu: "4" memory: 16Gi user: ubuntu workdir: /home/ubuntu/work volumes: - mountPath: /home/ubuntu size: 30Gi scripts: - when: pre-start description: install base packages user: root run: | apt-get update -qq DEBIAN FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends \ curl git ca-certificates unzip xz-utils less /dev/null - when: pre-start description: give the home volume to the agent user user: root run: chown ubuntu:ubuntu /home/ubuntu - when: pre-start description: set up the shell run: " -f ~/.bashrc || cp -rT /etc/skel ~" policy: name: VS Code Box networkDefaultVerdict: deny allowedDomains: - { pattern: github.com, verdict: allow, transport: direct } - { pattern: " .github.com", verdict: allow, transport: direct } - { pattern: " .githubusercontent.com", verdict: allow, transport: direct } - { pattern: api.anthropic.com, verdict: allow, transport: direct } - { pattern: console.anthropic.com, verdict: allow, transport: direct } - { pattern: claude.ai, verdict: allow, transport: direct } - { pattern: platform.claude.com, verdict: allow, transport: direct } - { pattern: mcp-proxy.anthropic.com, verdict: allow, transport: direct } - { pattern: update.code.visualstudio.com, verdict: allow, transport: direct } - { pattern: " .vscode-cdn.net", verdict: allow, transport: direct } - { pattern: marketplace.visualstudio.com, verdict: allow, transport: direct } - { pattern: " .vsassets.io", verdict: allow, transport: direct } - pattern: " " verdict: allow transport: direct description: Read-only internet rules: - { method: GET } - { method: HEAD } credentials: - { credentialName: gh-token, envVarKey: GH TOKEN } credentials: gh-token: value: ${GH TOKEN} injections: - domain: api.github.com headerName: Authorization headerFormat: "Bearer {value}" - domain: github.com headerName: Authorization headerFormat: "Basic {base64:x-access-token:{value}}" A few things to note: - command: sleep infinity keeps the sandbox up. VS Code starts its own server the first time you connect. - ubuntu:24.04 is the official image. It has no curl or git, so the first script installs them as root. The agent user must exist in the image, and ubuntu does. - The VS Code domains let the server download itself and let you install extensions from the Marketplace. The Claude Code extension brings its own copy of Claude Code, so the image needs nothing else. - mcp-proxy.anthropic.com carries the connectors of your Claude account, such as Slack or Google Drive. Without it, Claude Code works, but those connectors fail. With it, the agent in the sandbox can use those connectors with your access, so add it only if you want that. - The policy denies by default. For the rest of the internet, only GET and HEAD pass, which cuts off the obvious upload paths. You will see VS Code and extension telemetry denied in the sandbox log. That's expected, and nothing breaks. - The GitHub token never enters the sandbox. $GH TOKEN inside the sandbox holds a placeholder. The real token is added to requests to GitHub at the platform boundary. Step 2: Create the sandbox read -rs GH TOKEN && export GH TOKEN nexusctl sandbox create --project