> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stackshift.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# Computers CLI reference

> Every `stackshift computers` command: open a shell, create, list, run commands, move files, publish ports, fork, pause, snapshot and manage keys.

> [!TIP]
>
> **Live.** This area is documented as current, user-reliable behavior.

## Goal

Find the command for a task and its main flags.

## Prerequisites

* The StackShift CLI, signed in with `stackshift auth login`, or STACKSHIFT\_TOKEN set to a computers key.
* Nothing else. Without `--project` or a project in your CLI profile, the CLI uses your latest project, or makes one named Computers if you have none yet.

## Workflow

**Step 1**

Run `stackshift computers sh` to create a computer and open a terminal on it. When the shell ends the computer pauses; run `stackshift computers sh NAME` to carry on.

**Step 2**

Run `stackshift computers list` to see computers and their state.

**Step 3**

Use `exec`, `files`, `port`, `fork`, `pause`, `snapshot` and `restore` as needed.

**Step 4**

Run `stackshift computers COMMAND --help` for the full flags of any command.

## Commands

* `sh [COMPUTER]`: open a terminal, creating a computer when none is named. Pauses it on exit. It signs you in if needed and installs the StackShift skills into `~/.claude/skills`, `~/.agents/skills` and `~/.gemini/config/skills`; `--no-skills` skips them. `stackshift sh` is the same command.
* `stackshift skills install -y`: install only the skills, with no sign-in.
* `stackshift login --agent` and `stackshift claim CODE`: an agent asks for a computers key, and you approve it with the scopes you choose.
* `create NAME`, `list`, `get COMPUTER`, `delete COMPUTER`: manage computers. `--wait` waits until the change is finished.
* `exec [FLAGS] COMPUTER [COMMAND...]`: run a command. `--shell` runs a shell line, `--background` returns a process ID, and `--cwd`, `--env KEY=VALUE`, `--user` and `--exec-timeout` set how it runs.
* `run [FLAGS] -- COMMAND`: create a fresh computer, copy a folder into it with `--push`, run one command and delete the computer, unless `--keep`. The exit code is the command’s own.
* `history`, `output` and `jobs ls|logs|wait|kill`: read past commands and their output, and follow or stop background commands, also while the computer is paused.
* `ssh [FLAGS] COMPUTER [SSH-ARGS...]`: SSH through the StackShift gateway at `ssh.stackshift.cloud` port 2222 with a short-lived certificate. `ssh-token COMPUTER` prints a shareable SSH line that works without the CLI.
* `files ls|cat|get|put|mkdir|rm`: work with files under `/workspace`. `cp`, `push` and `pull` copy files and folders in parallel, checked chunks, scp style (`COMPUTER:PATH`).
* `setup COMPUTER` and `import IMAGE --name NAME`: show or run a setup script or devcontainer, and import a Docker or OCI image as a snapshot.
* `agent prompt|ls|events|steer|interrupt|providers|models|login|result|fanout|keep`: run Claude Code, Codex, Gemini CLI, OpenCode, Cursor, GitHub Copilot, Amp or Qwen Code inside a computer, and follow, redirect or stop it. `prompt` takes `--attach FILE`, `--forks N` and `--prompts FILE`; `providers` shows who is signed in, `models` lists the models an agent can use (`--provider`, and `--secret BINDING_ID` for a key’s models), `login` signs an agent in, `result` prints the summary (add `--json` for scripts), and `fanout` and `keep` list and choose among copies. `secrets set NAME` keeps a model key that computers can use without seeing it.
* `port publish|unpublish COMPUTER PORT`: give a port an HTTPS address. `--private` limits it to signed-in owners.
* `pause`, `resume`, `fork`, `snapshot`, `snapshots`, `restore`: lifecycle.
* `watch COMPUTER`: stream events until interrupted.
* `keys create|list|revoke` and `mcp`: keys for agents, and the MCP server address with ready-to-paste settings. `mcp --create-key NAME` also creates a key.

## Create and shell flags

* `--template agent-desktop|coding|android|ci-runner` (the default is `agent-desktop` for `create` and `coding` for `sh`), `--vcpus`, `--memory-gib`, `--disk-gib`, `--region`. The vCPU and memory pair must be one the template offers; leave both out for its first size.
* `--repo URL` (or `--source`), `--revision` and `--source-path` start from a repository and apply its devcontainer.json or `.stackshift/setup.sh`. `--from-snapshot ID` starts from a snapshot. `--setup-file` runs a script once the computer is up, `--devcontainer` pushes your folder and applies its devcontainer.json, and `--wait-setup` waits for the setup and exits with its code.
* `--max-run 8h`, `--archive-after 7d` and `--delete-after 30d` pause or delete the computer for you.
* `--internet open|allowlist` with `--allow-domain` for each allowed domain.
* `--pause-after 30m` and `--pause-mode memory|disk` set the idle policy. `--pause-after 0` never pauses.
* `--login NAME` allows a saved login, `--approvals` lets the computer ask you, `--no-keys` stops keys driving it and `--no-recording` turns screen recording off.

```bash Examples theme={null}
stackshift computers sh --template coding --repo https://github.com/acme/app
stackshift computers exec --shell "npm ci && npm test" build-box
stackshift computers fork build-box --count 3 --name a --name b --name c --wait
stackshift computers files put build-box ./report.pdf reports/report.pdf
stackshift computers mcp --create-key claude-code
```

## Expected result

> [!TIP]
>
> You can run every computer workflow from a terminal or a CI job without calling the API by hand.

## Common failures

> [!WARNING]
>
> * A flag after COMPUTER is treated as a command argument. For `exec` and `ssh`, put flags before the computer name.
> * Output is a table in a script. Add `-o json` or `-o name` for machine-readable output.
> * A command times out while waiting. Raise the global `--timeout`, or wait with `--wait` and poll `stackshift computers get NAME`.

## Related guides

> [card] [Create and manage computers](https://docs.stackshift.cloud/computers/create-and-manage.md)
>
> Create a computer from a template, a snapshot or a repository, open it, run commands, move files, publish ports and delete it.

> [card] [Pause, snapshot and fork](https://docs.stackshift.cloud/computers/pause-snapshot-and-fork.md)
>
> Pause a computer to stop paying for running time, snapshot it to keep a copy, and fork it up to 20 times to try many things from one starting point.

> [card] [Computers REST API](https://docs.stackshift.cloud/computers/rest-api.md)
>
> Every computer action is an endpoint under /api/v1/computers, with idempotent mutations, a typed error format, live sessions and an event stream.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.