Guide

Keep Claude Code running after you close your laptop.

Your agent stops when your laptop sleeps. Here are the ways to keep it working, what each one asks of you, and how to pick.

The short answer

Claude Code and Codex run on your computer, so they stop when it sleeps. To keep one working with the lid closed, run it on a computer that stays on, in a session that outlives your window.

That can be a server you rent, with the agent inside tmux; a cloud session from Anthropic or OpenAI; a Mac that stays on at home; or a tile, a computer in the cloud that Tiles sets up for you with one line.

Checked . Other companies’ tools change often, so look at their own pages too.

Why your agent stops

Closing the lid puts your laptop to sleep. Your agent is paused, its connection to the model drops, and the job ends partway, sometimes in the middle of a change.

Closing the terminal window ends it too, because the session belongs to the window.

So every fix is the same idea: run the agent on a computer that stays on, in a session that keeps going when you leave.

Six ways to keep it working

From the least setup to the most. Each one is a real choice; the right one depends on where your work lives.

  1. Keep your laptop awake

    Stop it from sleeping while the job runs.

    Good when
    A job of an hour or two, with the laptop on your desk.
    What it asks
    A Mac still sleeps when you close the lid, unless it’s on power with an external display connected. Unplug it or take it with you, and the job stops.
  2. Remote Control, in Claude Code

    Steer a Claude Code session on your computer from the Claude app on your phone, or from claude.ai/code.

    Good when
    You’ve stepped away, and your computer is still on.
    What it asks
    The agent still runs on your computer, so the computer has to stay on and awake. More ways to use it from your phone.
  3. A cloud session, from Anthropic or OpenAI

    Claude Code on the web runs a session on Anthropic’s computers, and Codex cloud does the same on OpenAI’s. Anthropic’s scheduled tasks, once called routines, run a saved prompt on a schedule.

    Good when
    Your work is in a GitHub repository, and the job fits in one task.
    What it asks
    The session starts from your repository, not from your computer. Files you haven’t pushed, your .env files, your local database and the tools you installed aren’t there.
  4. A server you rent, with tmux

    Rent a Linux server, install Claude Code or Codex, and start it inside tmux. Leave it running, and come back to it over SSH.

    # a session that outlives your window
    tmux new -s claude
    
    # start your agent in it, then press Ctrl-b, then d, to leave it running
    claude
    
    # later, over SSH: back where you were
    tmux attach -t claude
    Good when
    You want full control, and you don’t mind looking after a server.
    What it asks
    Every part is yours: SSH keys, a firewall, updates, Node and your tools, your project, and signing your agent in. Your code lives in two places, and you keep them in step yourself.
  5. A Mac that stays on at home

    A Mac mini, or an old laptop, left on and reached from wherever you are.

    Good when
    The work needs macOS, like Xcode or the iOS Simulator, or you want to run models on your own hardware.
    What it asks
    You buy it, keep it on power and online, set up a way in from outside your home, and make it start again by itself after a power cut. More on that choice.
  6. A tile, from TilesOurs

    Your own Linux computer in the cloud, made for coding agents. One line in Terminal sets it up and brings your project.

    Good when
    You want the server and tmux without building them, and you want your project, tools and sign-ins to come along.
    What it asks
    It runs Linux, not macOS, and there’s one per person. It starts at 2 vCPU and 2 GB of memory.

Which one to pick

  • Away for an hour, laptop on your desk: keep it awake, or use Remote Control.
  • One task on a repository that’s on GitHub: a cloud session from Anthropic or OpenAI.
  • Work that needs macOS: a Mac that stays on at home.
  • Long jobs on your own project, with your setup, and no server to look after: a tile.
  • You’d rather build the server yourself: rent one and use tmux.

How to do it with a tile

A tile does the server-and-tmux way for you. It takes a few minutes, and it asks before it brings anything.

  1. Open Terminal in your project’s folder

    On a Mac, press ⌘ Space, type Terminal and press Enter. Run it in your project’s folder, or anywhere: it asks which folder.

  2. Paste the line and press Enter

    It installs the tiles command, and Node.js too if your computer needs it. On Windows, run it in WSL.

    curl -fsSL https://ai-tiles.com/computer.sh | sh
  3. Sign in and approve this computer

    A page opens in your browser. Sign in with Google, GitHub, Apple or your email, then approve this computer. Terminal carries on by itself.

  4. Say what comes along

    Tiles makes your tile in about a minute. It copies your project and keeps it in sync both ways, brings Node, Python and your tools, and signs Claude Code and Codex in with your own Claude or ChatGPT plan. It asks before it copies secrets, like .env files.

  5. Give Claude Code a job, then close your laptop

    Claude Code starts on your tile in a session that keeps running. To come back, run tiles ssh, or open your tile in any browser, your phone too, at app.ai-tiles.com.

No Terminal, or on your phone? Start in your browser, and Claude Code opens on your tile right there.

Coming back to it

Open a new terminal first: the tiles command reaches new terminals, not the one you installed it in.

tiles ssh
A shell on your tile, in tmux, right where your agent is. It wakes the tile if it’s paused.
tiles status
Your tile, its sync and its ports.
tiles pause
Pause it now. Everything stays. tiles resume wakes it.
tiles doctor
Finds what’s wrong and fixes what it can.

Or open your tile’s page at app.ai-tiles.com, in any browser, on a computer or a phone. More in Use Claude Code from your phone.

What a tile is

System
Ubuntu 24.04 LTS, in Google Cloud (us-central1).
Size
2 vCPU, 2 GB of memory and 40 GB of disk to start. It grows to 4 vCPU, 16 GB of memory and 300 GB of disk.
Comes with
Docker, Node.js, Python, Git, the GitHub CLI, tmux, Claude Code, Codex, the tiles CLI and the Tiles MCP.
Getting in
No open ports. You reach it only through Tiles, over SSH with certificates that last 15 minutes.
Your files
Your project, kept in sync both ways. A port on your tile opens on your own localhost.
While you’re away
A working agent keeps it awake. After 2 hours with nothing going on it pauses, keeps everything, and wakes when you come back.
Your agents
Claude Code and Codex use your own Claude or ChatGPT plan.
How many
One per person.

Codex works the same way: start codex in a tmux session on your tile. Everything else here is on the Running agents page and in Setup.

Give your agent a computer of its own.

Get your tileMore about Running agents