Open a task's working copy in VS Code

A task's working copy is the folder the agent works in: the checked-out code and the agent's working files. It lives in the task's sandbox, a container on one of your team's hosts. You can open it in VS Code or Cursor over SSH, edit files and use a terminal there, while the agent works or after it stops.

You need:

  • To be a member of the workspace that has the task. For a planning chat, you must be the person who started the chat.
  • A host of a pull pool or a runner trust that can take the task's runs. See Install a host.
  • VS Code or Cursor on your computer, with the Remote - SSH extension.

Set up your computer once

Install the spotlight command:

curl -fsSL https://app.usespotlight.ai/api/install.sh | sh

On a self-hosted Spotlight, use your deployment's address in place of https://app.usespotlight.ai in this step, and add --url <address> to the commands in the next two steps.

Log in:

spotlight login

Approve the login in the browser. See Log in from the command line.

Configure SSH:

spotlight ssh setup

The command writes ~/.ssh/spotlight/config and adds a line to the top of ~/.ssh/config that includes it. Nothing else in ~/.ssh/config changes.

If it asks Set remote.SSH.connectTimeout to 600 in <path>? (y/N), answer y. A stopped sandbox can take minutes to start, and the editor stops a slower connection. The command changes only that setting.

It shows a list of checks, then Open a task in VS Code or Cursor from Spotlight, or run: ssh task-<id>.<workspace>.spotlight. If you did not log in, the command logs you in first. It asks for the Spotlight address, then opens the login page. If the login stops, the command writes nothing. If a check still says There is no login for <address>, do the previous step again. If you have logins for more than one address, add --url <address>.

In VS Code or Cursor, install the Remote - SSH extension.

If spotlight ssh setup did not set the connect timeout, open the editor's user settings as JSON (Preferences: Open User Settings (JSON) in the command palette) and add:

"remote.SSH.connectTimeout": 600

If you move the spotlight binary, run spotlight ssh setup again.

Open the working copy

Open the task, the run or the planning chat in Spotlight.

On a task, select Open in VS Code under Properties, below View traces. To use Cursor, point at the row, select … at its end, and select Open in Cursor.

On a run or a planning chat, select Open in VS Code at the top of the page. To use Cursor, open the menu beside the button and select Open in Cursor.

Spotlight remembers the editor you choose in this browser. The row on the task and the button on runs and chats then show that editor.

Let the browser open the editor. The editor connects to the task's sandbox and opens the folder /workspace, with each repository checked out in it.

If this computer has no login for Spotlight, or the login expired, the browser opens the page Approve the Spotlight CLI?. Select Approve. The editor then connects.

If no sandbox is up for the task, Spotlight starts one and restores the working copy the task's last run left. The editor waits until the sandbox is ready. This can take a few minutes. The editor's log shows Starting the sandbox. This can take some minutes. while it waits.

If the editor does not open within about two seconds, Spotlight shows Set up this computer once, which reads "If VS Code did not open, this computer needs…", with the setup steps. Do the steps, then open the working copy again.

If the editor opens but does not connect to Spotlight within 20 seconds, Spotlight shows VS Code did not connect to Spotlight, with the same steps. If a login page opened in the browser, approve it. Spotlight closes the message when the editor connects.

Work in the working copy

You and the agent see the same files. You can edit them and run commands in the editor's terminal, while the agent works or while it waits for an answer. The agent sees your changes in its next step, and you see its changes as it makes them. Changes that neither of you commits stay in the working copy, and the task's next run starts from them.

Commands in the editor's terminal run as the agent's user, in the sandbox. They reach the network through the sandbox's egress, like the agent's commands. See Limit where sandboxes can connect.

Between runs, Spotlight stops the processes the agent left running. Processes you started from the editor keep running.

Close the working copy

Close the editor window. When no run and no editor uses the sandbox, it stays up for 10 minutes, then Spotlight stores the working copy with your changes and removes the sandbox. An open editor keeps the sandbox up for at most 12 hours after the task's last run ended. Then the editor loses its connection, and the next time you open the working copy, Spotlight starts a new sandbox. A self-hosted Spotlight can change both times; see Sandbox lifetime.

If the connection fails

The editor shows the error that ssh or spotlight ssh proxy prints. The most common ones:

MessageDo this
Connection timed out during banner exchangeThe editor stopped before the sandbox was ready. Set "remote.SSH.connectTimeout": 600 in the editor's settings, or run spotlight ssh setup --editor-timeout, then reconnect.
Sorry, the login to <address> did not finish: <reason>. Run: spotlight loginRun spotlight login, then reconnect.
Sorry, your login for <address> expired. Run: spotlight loginRun spotlight login, then reconnect.
Sorry, there is no task <id> in workspace <workspace> that you may openCheck that you are a member of the workspace, and, for a chat, that you started it.
Sorry, the sandbox did not start in 10 minutes. Please try againCheck that a host that can take the task's runs is online, on the Runners page under Settings.
The sandbox stopped. Connect again to start itReconnect.

Every message is in The spotlight command.

On this page