Skip to content

Browse catalog

Search catalog

[READY] Type a title, tag, or description.

NOTES // snippet

CLAUDE_CODE_REMOTE env gate

LAST_MODIFIED
2026.10.26
CATEGORY
snippet

CLAUDE_CODE_REMOTE is set when a Claude Code session runs in the cloud (claude --cloud) and unset on your machine. Check it inside a repo hook when a step should run only in the cloud VM.

Use

Repository hooks live in .claude/settings.json, so they run the same way locally and in the cloud. Gate the cloud-only part:

#!/usr/bin/env bash
# SessionStart hook
if [ -n "$CLAUDE_CODE_REMOTE" ]; then
  npm install   # fresh VM: install deps; locally they already exist
fi

Running processes do not survive the cloud environment cache, so start services in this hook rather than in a setup script. More in claude —cloud: the GitHub token never enters the VM.

Sources

  1. Claude Code in the cloud: a field guide to cloud sessionsclaude.dev
claude-codecloud-sessionshooks

Related_Notes