How Claude Code cloud environments cache setup scripts to speed up sessions

Claude Code cloud sessions start in a fresh virtual machine whose contents are determined by the environment's network access, variables, secrets, and setup script. The setup script runs once and its filesystem is saved as a snapshot, which later sessions reuse, so setup time is paid only occasionally. Changing the setup script or allowed network hosts triggers a rebuild, as does cache expiry after about seven days. Only file-based results such as installed packages and pulled images are cached, while running services and scripts exceeding roughly five minutes are not, which is why those should be handled by a SessionStart hook instead. Network access can be set to none, trusted (the default), full, or a custom domain list, and secrets can be stored as network secrets that are injected by a proxy rather than exposed as environment variables.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in