Skip to content
BENIBIX Learn

CLAUDECODE

AI⌨️ Claude CodeConfiguration

Also known as CLAUDECODE=1, CLAUDE_CODE_CHILD_SESSION

Set to 1 in each program Claude Code starts, so a script knows.

Think of it like

It is like a name tag that says I came with Claude.

Example

Jack's test script opens a browser, which stalls Claude. The script now skips the browser when this is set.

Why it matters

Some scripts should act a bit differently for an AI than for a person, such as no prompts.

Definition

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.

Example code

bash
if [ -n "$CLAUDECODE" ]; then
  echo "Running inside Claude Code"
fi
A script that checks where it runs.
The top row reaches all three.

Common mistake

Setting it yourself in your shell. Then every script thinks it is inside Claude Code.

Key takeaways

  1. 1
    Set to 1. By Claude Code.
  2. 2
    In what it starts. Bash, hooks, MCP.
  3. 3
    For scripts. To detect it.

Compare