CLAUDE_PROJECT_DIR vs CLAUDE_PLUGIN_ROOT
People think both point at the folder you are working in. Only one does. CLAUDE_PROJECT_DIR is the root of your project, so a hook in your settings uses it to find its script. CLAUDE_PLUGIN_ROOT is the folder a plugin was put in, so a plugin's hook uses it to find its own files. That folder can change on an update, so a plugin keeps data that must last somewhere else.
CLAUDE_PROJECT_DIR
The path to the top folder of a project, for hook scripts.
CLAUDE_PROJECT_DIR is a variable that holds the top folder of the project, where the session began. Hooks put it at the start of a script's path, so they find their own scripts. That still works when Claude moves to a subfolder with cd. Claude Code also sets it for local MCP servers.
CLAUDE_PLUGIN_ROOT
The path to the folder a plugin is in, for its hooks.
CLAUDE_PLUGIN_ROOT is a variable that holds the folder a plugin is put in. A plugin's hooks use it to find the scripts that ship with it, wherever it was put. That folder can change when the plugin updates. For data that must last, such as packages, use CLAUDE_PLUGIN_DATA. That is the plugin's own data folder.
In one line
- CLAUDE_PROJECT_DIR
- The path to the top folder of a project, for hook scripts.
- CLAUDE_PLUGIN_ROOT
- The path to the folder a plugin is in, for its hooks.