CLAUDECODE
A Claude Code environment variable, read out of the shipped bundle. It has been in the build since v2.1.160, including the newest one read.
What it is
Set to 1 in subprocesses Claude Code spawns (Bash and PowerShell tools, tmux sessions, [hook](/docs/en/hooks) commands, [status line](/docs/en/statusline) commands, stdio [MCP server](/docs/en/mcp) subprocesses). IDE extensions also set this in their integrated terminals. Use to detect when a script is running inside a subprocess spawned by Claude Code. To check whether the current process was spawned directly by a tool call or hook, rather than inside a stdio MCP server that Claude Code started, use CLAUDE_CODE_CHILD_SESSION instead
Anthropic's own wording. Read off Environment variables, captured 2026-08-28.
Presence across releases
| Releases | Reading | Declared type | Default |
|---|---|---|---|
| 2.1.245 – 2.1.250 5 releases | never mined | — | — |
| 2.1.160 – 2.1.243 75 releases | in the build | bool | — |
A row reading never mined is a release with no archived bundle behind it. Nothing was read out of it, so nothing here says whether the name was in it. A declared type or a default is only ever what that release's own bundle stated.
Changelog entries naming it
No changelog entry here has ever named it. That is a statement about what has been written, not about the name: it has been in the build since v2.1.160 without anybody writing a line about it.
Documentation pages
- Environment variables reference table Claude Code CLI
- Admin mentions it Claude Developer Platform
- Usage Report mentions it Claude Developer Platform
- Get Claude Code Usage Report mentions it Claude Developer Platform
- Set up Claude Code for your organization mentions it Claude Code CLI
- Migrate to Claude Agent SDK mentions it Claude Code CLI
- Quickstart mentions it Claude Code CLI
- Track todos mentions it Claude Code CLI
- Agent SDK reference - TypeScript mentions it Claude Code CLI
- Claude Code changelog mentions it Claude Code CLI
- Claude apps gateway configuration mentions it Claude Code CLI
- Connect Claude Code to an LLM gateway mentions it Claude Code CLI
- Control MCP server access for your organization mentions it Claude Code CLI
A reference table page is one whose own table defines this name, and it is where the description above came from. A page that mentions it carries the name somewhere in its text and may say nothing about it at all. Every page carrying it.
Read out of the published npm bundle release by release, and out of Anthropic's own documentation as this site captured it. Nothing on this page is a description anybody here wrote about what the environment variable does. All environment variables.