Cubicles
Cubicles

How to run Claude Code, Codex or OpenCode in the cloud

Coding agents do their best work on long tasks, and long tasks don't fit on a laptop you close at six. Here's how to move them to a computer that stays on, without handing them your keys.

Blog ·

Claude Code, Codex and OpenCode have changed what one developer can get done in a day. Give them a well-scoped task, like fixing a flaky test suite, migrating an API or writing the missing docs, and they'll work through it for an hour or more.

That's exactly the problem with running them on your laptop. This guide shows how to run a coding agent on a cloud computer instead, so it keeps working when you walk away and can't reach anything you didn't give it.

Why move your coding agent off your laptop

  • It stops when you do. Close the lid, lose Wi‑Fi on the train, or restart for an update, and a two-hour task dies halfway.
  • It has your keys. On your laptop the agent runs as you: your SSH keys, your cloud CLI logins, every .env file in your home folder and your browser's saved sessions.
  • It takes over your machine. Builds and test runs eat CPU and battery while you're trying to work.
  • Parallel work gets messy. Two agents on two tasks need two checkouts, two dev servers and two sets of ports.

Your options

There are two broad ways to run a coding agent away from your laptop.

Hosted agent sandboxes. Anthropic and OpenAI both offer hosted versions of their coding agents that run tasks in their own short-lived sandboxes. They're convenient for tasks that start and end inside one repository.

A computer of your own. A remote machine that stays on, keeps its files and lets you install whatever the project needs. This is the better fit when the agent needs a real browser to test a web app, long-running services like a database, tools a sandbox doesn't have, or a model from another provider.

A headless VPS works for terminal-only agents. A cloud computer with a desktop adds a browser the agent can test in and a screen you can watch. The rest of this guide uses a Cubicles computer, but the tmux, worktree and token steps work on any Linux machine.

What a coding agent's computer needs

NeedWhyOn a Cubicles Standard computer
Stays onLong tasks and overnight runsYes, it keeps running when you close the tab
Persistent diskRepos, caches and dependencies survive restarts64 GB NVMe, kept when it sleeps
Enough RAMBuilds, test runners and a dev server at once8 GB, with 4 vCPU
ToolchainsGit, Python, Node.js, DockerInstalled
A real browserEnd-to-end tests and checking the UIChrome and Firefox on a real desktop
Fast networkPackage installs and image pullsUp to 1 Gbps, no data caps

Claude Code, Codex and OpenCode come installed. Heavy monorepos and big builds may want more memory than 8 GB; larger plans are listed under pricing.

Step by step: a coding agent on a cloud computer

1. Sign up

Sign up. Your first computer is free, with no card needed. It's ready in about a minute once you create it.

2. Pick how you'll set up the agent

The quick way: choose New agent, pick Claude Code, Codex or OpenCode, choose your model provider and paste your API key. Connect a chat app such as Telegram or Discord where the agent supports it, and you can send it tasks from your phone. Choose Continue to its computer, and Cubicles creates the computer, sets the agent up on it and keeps it running.

The hands-on way: choose New computer and create it, then Open computer, open the terminal on its desktop and run the agent yourself, the same way you would locally. The rest of these steps assume this route.

3. Give it access to one repository, not your account

Don't copy your personal SSH key onto the agent's computer. Create a fine-grained personal access token on GitHub, limited to the one repository and to contents and pull requests, with an expiry date. Or add a deploy key to that repository only. If the agent's computer is ever compromised, the damage stops at that repo.

Clone over HTTPS: when git asks for a password, paste the token
mkdir -p ~/code && cd ~/code
git clone https://github.com/you/my-app.git
cd my-app
git config user.name "my-app agent"
git config user.email "agent@example.com"

4. Start the agent in tmux

The desktop keeps running when you close your browser tab, so a terminal you leave open keeps working. tmux adds a safety net: if the terminal app is closed by mistake, the session survives, and you can reattach from any terminal on that computer.

Start a named session and launch the agent
tmux new -s my-app
cd ~/code/my-app
claude        # or: codex, or: opencode

# Detach: press Ctrl-b, then d
# Reattach later:
tmux attach -t my-app

5. Ask for a pull request, not a merge

Write the task so the end result is something you review. For example:

“On a new branch, fix the failing tests in packages/billing. Run the full test suite before you finish. Open a pull request that explains the root cause and what you changed. Don't merge, don't touch the deploy config, and stop to ask me if you need a new dependency.”

Turn on branch protection for your main branch so the agent's token can't push to it even if it tries.

6. Walk away, then check in from anywhere

Close the tab. Later, open the computer from your phone's browser to watch the terminal, or read the pull request on GitHub. If you set the agent up with a chat app, it can message you when it's done or stuck.

Running several tasks in parallel

Two agents in one checkout will trip over each other. Git worktrees give each task its own folder and branch from one clone:

One worktree per task, one tmux session per worktree
cd ~/code/my-app
git worktree add ../my-app-login -b fix-login
git worktree add ../my-app-docs -b api-docs

tmux new -s login -c ~/code/my-app-login
tmux new -s docs -c ~/code/my-app-docs

Watch the memory: two test suites and two dev servers on one machine add up. For separate projects or separate clients, give each its own computer so their tokens, files and mistakes stay apart. Our post on running multiple AI agents covers that setup.

Keeping a remote coding agent safe

  • No production secrets. Give the agent test credentials and a local database, never your production .env.
  • Scoped, expiring tokens. One repository, the fewest permissions that work, and an expiry date.
  • Protected branches. Require a pull request and a passing build to merge.
  • A spending limit. Set a monthly budget with your model provider, so a stuck loop stops at a number you chose.
  • Treat issues and docs as untrusted. A README, an issue comment or a dependency's docs can carry instructions aimed at agents. Review what it changed, not just what it says it changed.

The bottom line

A coding agent on its own cloud computer works while you're away, can't reach your personal keys, and hands you a pull request instead of a surprise. The setup is a computer that stays on, a token scoped to one repo, and a tmux session. On Cubicles it takes about five minutes. Create your free computer and give your agent its first overnight task.

Frequently asked questions

Can I run Claude Code on a remote server?

Yes. Claude Code runs in any Linux terminal. Install it on a server or cloud computer, or use one where it comes installed, like Cubicles, and run it inside tmux so it keeps going when you disconnect.

Does Claude Code keep running if I close my terminal?

Not on its own: closing the terminal ends the process. Run it inside tmux or on a remote desktop that stays on, and it keeps working after you disconnect.

Can I use Codex or OpenCode the same way?

Yes. Codex and OpenCode are terminal programs too, and the same setup applies: a computer that stays on, a token scoped to one repository, and tmux. Both come installed on Cubicles computers.

Should I give a coding agent my SSH key?

No. Use a fine-grained access token limited to one repository, or a deploy key for that repository only, with an expiry date. Then a compromised agent can only reach that one repo.

How much computer does a coding agent need?

The model runs at your provider, so the computer only runs git, builds and tests. A Cubicles Standard computer has 4 vCPU and 8 GB of RAM, which suits most projects. Large monorepos may need more memory.

Give your agent a computer