CLAUDECODE vs CLAUDE_CODE_REMOTE
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.
CLAUDECODE
Set to 1 in each program Claude Code starts, so a script knows.
CLAUDECODE is set to 1 in the programs Claude Code starts. That means Bash commands, hooks, the status line and local MCP servers. IDE plugins also set it in their own terminals. A script reads it to know it is running inside Claude Code, and can act on that.
CLAUDE_CODE_REMOTE
Set to true when Claude Code runs as a cloud session.
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.
In one line
- CLAUDECODE
- Set to 1 in each program Claude Code starts, so a script knows.
- CLAUDE_CODE_REMOTE
- Set to true when Claude Code runs as a cloud session.