[Bug] Environment Variable Not Propagated in Plugin Hooks

Resolved 💬 4 comments Opened Oct 12, 2025 by gpambrozio Closed Nov 18, 2025

Bug Description
I'm trying to use the $CLAUDE_PROJECT_DIR environment variable in a plugin hook and it doesn't seem to be filled. Consider this hook configuration:

{
  "hooks": {
    "SessionStart": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "echo \"${CLAUDE_PROJECT_DIR}\" > ~/claude-debug.txt"
          }
        ]
      }
    ]
  }
}

This works as expected when I have this hook as part of my global ~/.claude/settings.json file or the project-specific .claude/settings.local.json file, but when I put it in a plugin's hooks.json file, the CLAUDE_PROJECT_DIR variable is empty so my debug file is also empty.

Changing the variable to CLAUDE_PLUGIN_ROOT does populate the file with a proper path but I do need the project path.

Environment Info

  • Platform: darwin
  • Terminal: iTerm.app
  • Version: 2.0.14
  • Feedback ID: 1a029692-a434-47f4-935a-b2ff351f017a

Errors

[]

View original on GitHub ↗

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