# CLAUDE_CODE_REMOTE

> Set to true when Claude Code runs as a cloud session.

**Field:** Artificial Intelligence  
**Category:** Claude Code  
**Also known as:** CLAUDE_CODE_REMOTE=true

## Think of it like

It is like a sign that tells you that you are on a boat, not at home.

## Definition

CLAUDE_CODE_REMOTE is set to true when Claude Code runs as a cloud session, not on your own computer. A hook or setup script reads it to know where it runs. It can then skip steps that only make sense on a laptop, or add ones a fresh cloud machine needs.

## Example

Lucy's SessionStart hook installs packages. On her laptop that is slow and not needed, so the hook only does it in the cloud.

## Example code

```bash
if [ "$CLAUDE_CODE_REMOTE" = "true" ]; then
  npm ci
fi
```

Install packages only on a fresh cloud machine.

## Why it matters

A cloud machine starts empty, and a laptop does not. One hook can serve both.

## Common mistake

Checking CLAUDECODE instead. That is set on your laptop too.

## Three principles

- **true in the cloud.** Set for you.
- **For hooks.** And setup scripts.
- **Not CLAUDECODE.** That is everywhere.

## Related terms

- [Cloud Session](https://learn.benibix.com/term/ai/cloud-session)
- [CLAUDECODE](https://learn.benibix.com/term/ai/claudecode-variable)
- [/hooks Command](https://learn.benibix.com/term/ai/hooks-command)

## Told apart from

- [CLAUDECODE vs CLAUDE_CODE_REMOTE](https://learn.benibix.com/compare/claudecode-variable-vs-claude-code-remote-variable): People think CLAUDECODE tells a script it is in the cloud. It only says the script was started by Claude Code, and that is true on your laptop too. CLAUDE_CODE_REMOTE is the one set to true only in a cloud session. A hook that should act only on a fresh cloud machine checks the second.

---

Source: https://learn.benibix.com/term/ai/claude-code-remote-variable
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-16
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
