EnterWorktree doesn't see WorktreeCreate hooks registered by plugins

Resolved 💬 4 comments Opened Mar 9, 2026 by KingMob Closed Apr 6, 2026

Bug Description

EnterWorktree fails with "Invalid path" in jj (Jujutsu) repositories even when a plugin correctly registers WorktreeCreate/WorktreeRemove hooks via hooks/hooks.json.

Steps to Reproduce

  1. Create a plugin with hooks/hooks.json defining WorktreeCreate and WorktreeRemove hooks
  2. Install and enable the plugin (confirmed via settings.jsonenabledPlugins)
  3. In a non-git repository (jj), call EnterWorktree

Expected Behavior

EnterWorktree should find the plugin-registered WorktreeCreate hook and use it, as documented:

Must be in a git repository, OR have WorktreeCreate/WorktreeRemove hooks configured

Actual Behavior

EnterWorktree returns "Invalid path". It appears to only check ~/.claude/settings.json hooks, not hooks registered through the plugin system.

Evidence

  • The plugin (jj@agent-plugins v0.4.0) is installed and enabled ("jj@agent-plugins": true in enabledPlugins)
  • The plugin's hooks/hooks.json correctly defines WorktreeCreate and WorktreeRemove hooks
  • The hook scripts work perfectly when invoked manually — they create full jj workspaces with all files
  • Other plugin components (skills, agents) from the same plugin work fine

Workaround

Duplicating the WorktreeCreate/WorktreeRemove hooks into ~/.claude/settings.json (pointing to the plugin's scripts) makes EnterWorktree work correctly.

Environment

  • macOS (Darwin 25.3.0)
  • Claude Code (latest as of 2026-03-09)
  • Repository uses Jujutsu (jj) for version control (no .git directory)

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗