Description
Hooks defined in an external hooks.json file referenced from a plugin's plugin.json are not being loaded or executed.
Steps to Reproduce
- Create a plugin with this structure:
my-plugin/
├── .claude-plugin/
│ └── plugin.json
└── hooks/
└── hooks.json
- In
plugin.json, reference the hooks file:
{
"name": "my-plugin",
"version": "1.0.0",
"hooks": "./hooks/hooks.json"
}
- In
hooks/hooks.json, define a hook:
{
"hooks": {
"SubagentStop": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "echo 'Hook fired' >> /tmp/hook-test.log"
}
]
}
]
}
}
- Install and enable the plugin
- Trigger a subagent (Task tool)
- Check
/tmp/hook-test.log - file does not exist
Expected Behavior
The hook should fire and write to the log file when a subagent completes.
Actual Behavior
The hook never fires. The log file is never created.
Workaround
Defining the same hook directly in ~/.claude/settings.json works correctly - the hook fires as expected. This confirms:
- The hook event (SubagentStop) works
- The hook command is valid
- Only plugin-based hook discovery is broken
Environment
- Claude Code version: Latest
- OS: Linux (WSL2)
- Plugin installed via marketplace
Description
Hooks defined in an external
hooks.jsonfile referenced from a plugin'splugin.jsonare not being loaded or executed.Steps to Reproduce
plugin.json, reference the hooks file:{ "name": "my-plugin", "version": "1.0.0", "hooks": "./hooks/hooks.json" }hooks/hooks.json, define a hook:{ "hooks": { "SubagentStop": [ { "matcher": "*", "hooks": [ { "type": "command", "command": "echo 'Hook fired' >> /tmp/hook-test.log" } ] } ] } }/tmp/hook-test.log- file does not existExpected Behavior
The hook should fire and write to the log file when a subagent completes.
Actual Behavior
The hook never fires. The log file is never created.
Workaround
Defining the same hook directly in
~/.claude/settings.jsonworks correctly - the hook fires as expected. This confirms:Environment