Skip to content
The AI Agent Factory

The sandbox and its state

Approved by
Panaversity ·
21 min read

The session cloud workspace

[Vendor-documented] Each cloud session runs in its own temporary sandbox, on computers that Anthropic manages. No state is shared between sessions or between organizations.1 That covers the running computer. The stored session data sits on Anthropic's shared storage, the same systems that hold chat data.2 [Observed] In the session examined, the sandbox was a Linux microVM with Python, Node, a shell and file tools. This is the borrowed desk from Where the work happens.

AspectHow it worksBasis
ScopeOne sandbox for each session, not shared with other chatsVendor-documented
PersistenceFiles and installed packages last from one turn to the next within the sessionObserved
Lifetime (end of session)Destroyed when the session ends. Saved sandbox state and snapshots expire 30 days after the session was createdVendor-documented1,2
Lifetime (idle time)Claude Code cloud sessions: paused and later restored, or reclaimed and replaced. Cowork and combined chat sessions: snapshotted after about 5 minutes and restored into a fresh VMVendor-documented3,2
Background workA process the shell detaches (with nohup or &) usually stops a few minutes after a reply ends. The harness's own background jobs run until their time limitTool-documented (the session's environment notes)
NetworkOutbound traffic goes through a proxy, to allowed places only (an allowlist). Web lookups use separate toolsVendor-documented and observed
Your computerReached only through the Claude desktop app, while it is online. A linked computer offers the folders you grant, a shell in the computer's local VM (the desktop workspace below), its screen and browser, and local MCP serversVendor-documented2

[Vendor-documented] Availability depends on the product and plan. Cloud tasks in a conversation are available on Pro, Max and Ultra, in beta on Team, and on Enterprise once an owner turns them on.1 Claude Code cloud sessions are available on Pro, Max and Team plans, and for Enterprise users with premium seats or Chat + Claude Code seats.3 The desktop app's Code tab also lets you choose Local, Cloud, SSH or WSL for each session.4 The settings that shape a cloud sandbox are in Cloud environments and self-hosted runners.

The desktop workspace: a second VM on your computer

[Vendor-documented] A conversation can use a second machine. On your own computer, "code execution runs in an isolated virtual machine (VM)", separated from the host by Apple Virtualization on macOS or Hyper-V on Windows. The VM "enforces its own network egress filtering, syscall restrictions, and per-session user isolation". A cloud session reaches it only "through the Claude Desktop app on that device", and only while the app is online.1 Reading and editing files in your connected folders happens on your computer. The VM runs a signed system image that sessions cannot change. If the VM cannot start, for example on a locked-down work laptop, Claude does the work with file operations only.2

[Observed] In the session examined, the two machines looked like this.5

AspectCloud workspaceDesktop workspace
Where it runsAnthropic's servers, a Firecracker microVMA Linux VM the desktop app runs on your computer (a Mac with Apple Silicon in the test)
The tool Claude usesBashdevice_bash
What we sawUbuntu 24.04, x86_64, 2 vCPU, 7.8 GiB RAM, about 31 GB free, user rootUbuntu 22.04, arm64, 4 vCPU, 3.8 GiB RAM, about 8 GB free, a per-session user, commands wrapped in a bwrap sandbox
Your filesOnly what you attach, or what Claude stages inOnly connected folders, mounted at ~/mnt/<folder>
NeedsNothing. It starts with the sessionThe desktop app open and online, and at least one connected folder
Each commandRuns in a persistent shell for the sessionA fresh bash -c: no working directory or variables carry over, only files. 120 seconds by default, 180 at most
LifetimeRemoved when the session ends. Files handed back to you are keptScratch space outside ~/mnt/ is removed with the session. Changes in connected folders are already in your real folder

[Vendor-documented] The desktop workspace's network is set in Settings > Capabilities, or by an admin in Organization settings > Capabilities on Team and Enterprise. With egress off, commands reach only anthropic.com and claude.com hosts. Package managers only adds the common package registries and github.com. All domains allows any host. Unless all domains are allowed, registries and GitHub are download-only: git clone, git fetch and git pull over HTTPS work, but git push, Git LFS and SSH remotes are blocked. Anthropic adds that "these limits aren't a security boundary."6 Deleting a file needs your explicit permission.7 [Observed] Until it was granted, rm in a connected folder failed with "Operation not permitted". So did git, which deletes its own lock files.5

How files cross between the two

[Observed] The two VMs share no disk. Files cross only in two named steps.5

  1. Stage (desktop to cloud). Claude copies files from a connected folder into the cloud workspace, under /mnt/user-data/uploads/<folder>/. The limits seen were 50 files, 400 MB per file and 500 MB per call. The copy is a snapshot taken at that moment.
  2. Commit (cloud to desktop). Claude writes a result from /mnt/user-data/outputs/ back into the connected folder. If the file on your computer changed since it was staged, the write is refused rather than overwriting your edit.

When a job needs only the desktop shell, such as renaming files or editing a CSV in place, nothing is staged. Claude edits the file where it sits. Work that needs heavy tools, the web, or viewing an image or a PDF page goes to the cloud workspace.

[Inferred] Local sessions share one VM on your computer, where each cloud session gets its own. "Nothing shared between sessions" is a rule for cloud sandboxes. Do not assume it on your own computer. On Pro, Max and Ultra, a task runs entirely in the local VM only if it was started there before October 6, 2026. Newer tasks run in the cloud and use the local VM as their shell on your computer.1

Demo: a Python program in the VM

[Observed] On November 8, 2026, a script named hello_vm.py was created, saved and run inside the session workspace.8 It printed:

Hello from the session VM!
Python: 3.13.18
OS: Linux-6.18.44-fc-v310-x86_64-with-glibc2.39
Working dir: /home/claude
Time (UTC): 2026-11-08 04:34
Squares 1-10: [1, 4, 9, 16, 25, 36, 49, 64, 81, 100] sum = 385

[Observed] Between writing the file and running it, the session was interrupted and resumed. The run had not happened. The file came back as a read-only copy from the conversation. [Inferred] The workspace had been replaced, because a restored VM keeps its own files. So anything installed or running was lost. A second change on November 9 is weaker evidence, as explained below.

The lesson: treat the VM as scratch space, a place for temporary work. Keep anything that matters in a delivered file, an artifact, Drive or a repository.

Where chat history lives

[Vendor-documented] Sessions and files are saved to the user's Claude account.1 [Observed] The harness held its own working copy of the conversation in the VM. [Inferred] The browser also holds only a copy. The saved record is the one on the account.

PlaceWhat it holdsSurvives a replaced VM?
Anthropic backendThe stored conversation, reachable from any deviceYes
Browser or appA cached copy, kept for displayIt reloads from the backend (inferred)
Harness in the VMThe working context for each model call, plus a transcript on diskNot if the VM is replaced. It is rebuilt from the backend (inferred)

The chat survived the replaced VM in the demo, because the backend copy counts. In local Claude Code, the transcript lives on your machine.

When the VM is paused, restored or replaced

[Vendor-documented] The sandbox is destroyed when the session ends.1 For Claude Code cloud sessions, Anthropic also documents what happens to an idle VM. "After a few minutes without activity, a session's VM pauses with its files saved. Your next message restores the same VM and starts Claude Code again." But "if the paused VM has since been reclaimed, reopening the session provisions a fresh VM." Reclaiming also stops background work that was still running.3,9

[Vendor-documented] Anthropic's security guide describes a different idle rule for Cowork cloud sessions and the combined chat and Cowork experience. After about 5 minutes of idle time, the VM is snapshotted, encrypted and torn down. A new message "restores the files into a fresh VM and restarts the session". Sandbox state and snapshots "expire 30 days after the session was created", and they cannot be exported.2

[Observed] In the session examined here, two things were seen. During the demo, the file came back only as a read-only copy from the conversation. On November 9, PID 1 had been running for about 19 minutes, after a long idle gap.

[Inferred] The session reported ENTRYPOINT=remote_cowork, so the Cowork rule is the more likely one. Under it, a long idle gap ends in a fresh VM, which fits the short uptime of PID 1. The uptime alone is still not proof, because a paused and restored VM may not count paused time. The Cowork rule does not fully explain the demo, where the file came back only as a read-only copy, because a snapshot restores files. The reason is not documented. [Unknown] Exactly which idle rule this chat followed, and how long a paused Claude Code VM is kept before it is reclaimed.

[Inferred] Pausing and reclaiming save computing power and keep each session clean.

Survives a reclaimed VMLost when the VM is reclaimed
The chat itselfInstalled packages
Files from the conversation (restored as copies)Running servers and background jobs
Artifacts and docsEnvironment variables and temporary files
Memory and connected appsAnything not written back into the conversation
Anything saved to your computer, Drive or a repository

In practice, plan for a fresh VM after a break, even though a short break may only pause it. Scripts should check for what they need and install it. Save important output outside the VM. Projects build this habit into the product.

Stateful sessions on a stateless model

The model is stateless, but the session around it remembers. The harness makes the difference.

  • Stateless model. The model keeps no memory between calls. For each call, the harness builds the context from instructions, the relevant history, tool results and the current state. When the context grows too large, the harness may compact it, summarize it, or fetch only what it needs. The session examined was configured to auto-compact at 80%. Prompt caching makes repeated context faster to process, but it is not memory.
  • Stateful session. Between calls, the harness holds a transcript, the VM's files, packages and tool results.
LayerState it holdsLifetime
Anthropic backendThe conversationSaved to the account (vendor-documented). How long it is kept is not covered here
Harness and VMWorking files, the environment, the transcript on diskUntil the VM is reclaimed or the session ends
Outside stores (memory, artifacts, Drive, repositories)Whatever you save thereAs long as you keep it

How long each layer keeps state. Each layer keeps state longer than the one above it. Relative lifetimes, not to scale, drawn as bars along an arrow labeled longer-lived. One model call: a tiny bar, nothing kept between calls. Harness and VM: a short bar, until the session ends or the VM is replaced. Backend conversation: a longer bar, saved to the account. Outside stores: the longest bar, highlighted, as long as you keep them. Design for this layer.

The model is a stateless function. The harness turns it into a stateful agent. With the API or the Agent SDK, your own code holds that state.

Check yourself

Question 1 / 6

0 answered

In the Python demo, what happened when the session was interrupted and resumed?

  1. As verified on November 9, 2026, and for the local VM and local sessions on November 16, 2026. Claude Cowork architecture overview, Anthropic.↑↑2↑3↑4↑5↑6↑7
  2. As verified on November 16, 2026. Unified Claude Security Best Practices, version 1.3.6, November 7, 2026, Anthropic. The guide is written for Claude Enterprise administrators.↑↑2↑3↑4↑5↑6
  3. As verified on November 9, 2026. The page quotes the idle pause and restore. Configure cloud environments, Anthropic.↑↑2↑3
  1. Claude Desktop: Code tab docs, Anthropic.↑
  2. Panaversity's inspection of a Claude conversation linked to a Mac with one connected folder, November 16, 2026. The commands are in the appendix. Anthropic does not publish machine sizes, folder paths, tool names or staging limits, and they can change without notice.↑↑2↑3
  3. As verified on November 16, 2026. Network access for shell commands, Anthropic.↑
  4. As verified on November 16, 2026, Anthropic says Cowork "requires your explicit permission before permanently deleting any files". Use Claude Cowork safely, Anthropic.↑
  5. Panaversity's inspection of a cloud Claude session. The method is in the appendix.↑
  6. As verified on November 9, 2026. "Cloud sessions stop after a period of inactivity and the session's VM is reclaimed." Use Claude Code in the cloud, Anthropic.↑
Owner
Panaversity