Skip to content

Plugin hooks not loaded from external hooks.json file #16288

Description

@ImproperSubset

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

  1. Create a plugin with this structure:
my-plugin/
├── .claude-plugin/
│   └── plugin.json
└── hooks/
    └── hooks.json
  1. In plugin.json, reference the hooks file:
{
  "name": "my-plugin",
  "version": "1.0.0",
  "hooks": "./hooks/hooks.json"
}
  1. In hooks/hooks.json, define a hook:
{
  "hooks": {
    "SubagentStop": [
      {
        "matcher": "*",
        "hooks": [
          {
            "type": "command",
            "command": "echo 'Hook fired' >> /tmp/hook-test.log"
          }
        ]
      }
    ]
  }
}
  1. Install and enable the plugin
  2. Trigger a subagent (Task tool)
  3. 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

Metadata

Metadata

Assignees

Labels

area:corebugSomething isn't workinghas reproHas detailed reproduction stepsplatform:linuxIssue specifically occurs on Linux

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions