[BUG] SessionStart hook doesn't receive CLAUDE_ENV_FILE when installed by a plugin

Resolved 💬 3 comments Opened Nov 14, 2025 by gabelevi Closed Dec 14, 2025

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

The https://code.claude.com/docs/en/hooks#persisting-environment-variables explains that a CLAUDE_ENV_FILE should be available to SessionStart hooks. I can verify this works for project hooks or personal hooks, but this does not work for plugin hooks.

What Should Happen?

The plugin hook should be passed CLAUDE_ENV_FILE

Error Messages/Logs

Steps to Reproduce

Put a repro here: https://github.com/gabelevi/claude_session_start_env_bug (it's basically the test plugin from the docs)

It has two hooks:

  1. A local hook which does echo $CLAUDE_ENV_FILE > /tmp/CLAUDE_ENV_FILE_project.txt
  2. A plugin hook which does echo $CLAUDE_ENV_FILE > /tmp/CLAUDE_ENV_FILE_plugin.txt

If I install the marketplace & plugin and restart claude, I can see that both /tmp/CLAUDE_ENV_FILE_plugin.txt and /tmp/CLAUDE_ENV_FILE_project.txt were created at the same time. But /tmp/CLAUDE_ENV_FILE_plugin.txt is always empty while /tmp/CLAUDE_ENV_FILE_project.txt contains the absolute path of my session's env file (e.g. /Users/username/.claude/session-env/c76b6e6b-25ce-453c-81e0-de5bc413ca2f/hook-0.sh)

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.0.36

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗