Skip to content
BENIBIX Learn

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.

AI⌨️ Claude Code

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.

Example
Lucy's hook broke each time Claude moved into a subfolder. She starts the path with this variable. Now it finds the script every time.
Why it matters
A relative path depends on where Claude is. This one does not.
Full entry
AI⌨️ Claude Code

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.

Example
Jack ships a plugin with a format script. Its hook calls the script through CLAUDE_PLUGIN_ROOT, so it works on every user's machine.
Why it matters
Each user installs the plugin in a different place. This finds it.
Full entry

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.