Source Intelligence

DisclaimerUnofficial, and not affiliated with Anthropic. Nearly all of this is read straight out of what ships: npm bundles, captured prompts, published docs. Anthropic's own notes go in verbatim, marked as theirs. The rest is my reading, and every entry carries the strings behind it. If one looks wrong, vote it down and say why.

All of v2.0.22 Home All releases olderv2.0.21 v2.0.23newer
Claude Code v2.0.22

Session Environment Hooks

What: Shell environment can now be customized per session through hook scripts that persist throughout the session lifecycle.

How to use:

# SessionStart hooks can create environment files:
# Hook creates: ~/.claude/session-env/hook-1.sh

# Environment is automatically sourced before each Bash command
# Access the env file path via: $CLAUDE_ENV_FILE

Details:

  • Hook scripts stored in ~/.claude/session-env/hook-{N}.sh directories
  • Multiple hooks are concatenated and sourced in numerical order
  • SessionStart hooks receive CLAUDE_ENV_FILE environment variable pointing to persistent env file
  • Environment modifications persist for entire session across all Bash tool executions
  • Automatic cleanup of old session environment directories
  • Cache invalidation supported for dynamic updates
  • Evidence: bNA() at line 72216, Vh1() at line 247855, ia0() at line 454456

See this entry in the whole of v2.0.22 →