Two new host-controlled environment variables, CLAUDE_CODE_DIFF_COPY_ROOT and CLAUDE_CODE_FOUND_REPOSITORY_GIT, are added to Claude Code's protected set
Group of 2Under the hoodNo documentation foundInternal Changes
Under the hoodTier: how much it should matter to you
3Useful: my rating, 1 to 5
3Signal: worth watching, 1 to 5
Environment VariablesArea: what it touches
Internal ChangesKind: in v2.1.307,
Internal ChangesSection of the release
Unclear Whether setting these variables yourself is blocked, allowed or passed through is not clear.
What
An environment variable is a named value set in the environment a program starts in. Claude Code keeps a protected set of environment variable names that only the starting environment or Claude Code itself may set. That set previously held only CLAUDE_STAGE_FILE_ROOT. It now also holds two new variables:
CLAUDE_CODE_DIFF_COPY_ROOT names the folder for a checked copy of the repository's git settings. Claude Code reports an error if the value is not an absolute path, meaning a full path starting from the root of the file system.
CLAUDE_CODE_FOUND_REPOSITORY_GIT is set to "1" in the environment Claude Code uses when it runs git. That environment also sets gitStartsIn to the file system root.
The set feeds a check on environment variable names that also treats CLAUDE_CODE_REMOTE_TOOLS_FORWARD specially. A new message says a protected variable "is unchanged: only the environment Claude Code starts with, or Claude Code itself, may give it this value (host rule)".
Why
If something else tries to set one of these variables, it is left unchanged and the message above explains why. In practice these values come from whatever launches Claude Code, not from a project or its settings.