{"version":"2.0.22","anchor":"session-environment-hooks","canonical_anchor":"session-environment-hooks","heading":"Session Environment Hooks","tier":null,"area":null,"scope":null,"heads_up":null,"url":"https:\/\/changelogs.core-directive.com\/v\/2.0.22\/e\/session-environment-hooks","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.0.22","markdown":"### Session Environment Hooks\n\n**What:** Shell environment can now be customized per session through hook scripts that persist throughout the session lifecycle.\n\n**How to use:**\n\n`# 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:**\n\n- Hook scripts stored in `~\/.claude\/session-env\/hook-{N}.sh` directories\n- Multiple hooks are concatenated and sourced in numerical order\n- SessionStart hooks receive `CLAUDE_ENV_FILE` environment variable pointing to persistent env file\n- Environment modifications persist for entire session across all Bash tool executions\n- Automatic cleanup of old session environment directories\n- Cache invalidation supported for dynamic updates\n- **Evidence**: `bNA()` at line 72216, `Vh1()` at line 247855, `ia0()` at line 454456"}