# CLAUDE_PLUGIN_ROOT

> The path to the folder a plugin is in, for its hooks.

**Field:** Artificial Intelligence  
**Category:** Claude Code  
**Also known as:** ${CLAUDE_PLUGIN_ROOT}

## Think of it like

It is like a label on a toolbox. It says where the box is kept.

## Definition

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.

## Example code

```json
{
  "type": "command",
  "command": "\"${CLAUDE_PLUGIN_ROOT}\"/scripts/format.sh"
}
```

Run a script that ships with the plugin.

## Why it matters

Each user installs the plugin in a different place. This finds it.

## Common mistake

Saving data next to the scripts. An update can swap that folder out. Keep data in the data folder.

## Three principles

- **The plugin's folder.** Where installed.
- **For bundled scripts.** In hooks.
- **Data goes elsewhere.** PLUGIN_DATA.

## Related terms

- [Claude Code Plugin](https://learn.benibix.com/term/ai/claude-code-plugin)
- [CLAUDE_PROJECT_DIR](https://learn.benibix.com/term/ai/claude-project-dir-variable)
- [CLAUDE_CODE_PLUGIN_CACHE_DIR](https://learn.benibix.com/term/ai/claude-code-plugin-cache-dir-variable)

## Told apart from

- [CLAUDE_PROJECT_DIR vs CLAUDE_PLUGIN_ROOT](https://learn.benibix.com/compare/claude-project-dir-variable-vs-claude-plugin-root-variable): 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.

---

Source: https://learn.benibix.com/term/ai/claude-plugin-root-variable
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-16
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
