Hook script changes require full session restart — no hot reload for CLAUDE_PLUGIN_ROOT hooks

Resolved 💬 3 comments Opened Mar 17, 2026 by yonatangross Closed Mar 21, 2026

Problem

When developing Claude Code hooks/plugins locally, changes to hook source files (TypeScript compiled to JS) are not picked up by a running Claude Code session. The CLAUDE_PLUGIN_ROOT environment variable points to the hooks directory, but after editing and recompiling hook files, Claude Code continues executing the old cached version.

This makes the hook development loop painfully slow: every change requires quitting and restarting Claude Code.

Related: #22679 (settings caching), #16453 (cache growth)

Steps to Reproduce

  1. Set CLAUDE_PLUGIN_ROOT to a local hooks directory
  2. Create a hook (e.g., a PreToolUse hook in TypeScript), compile it, confirm it runs
  3. Edit the hook source — change the logic or output
  4. Recompile (tsc)
  5. Trigger the hook again in the same Claude Code session

Expected Behavior

The updated hook script should be executed. At minimum, a /reload command or similar mechanism should pick up changes without a full restart.

Actual Behavior

The old cached version of the hook continues to execute. The only way to pick up the change is to quit Claude Code (/exit) and start a new session.

The cache accumulates under ~/.claude/ and can grow significantly (observed ~186 MB of stale cached data across sessions).

Workaround

Automate cache cleanup with a SessionStart hook that clears old cache entries on launch, or manually delete stale cache dirs between sessions.

Suggested Fix

For locally-developed hooks (resolved via CLAUDE_PLUGIN_ROOT or local plugin paths):

  1. /reload-hooks command — re-read all hook files without restarting the session
  2. mtime check — compare file modification time before using cached version
  3. Skip cache for local dev hooks — only cache published/marketplace plugins; local CLAUDE_PLUGIN_ROOT hooks should always re-read from disk

Even option 1 alone would dramatically improve the hook development loop.

Environment

  • Claude Code: 2.1.77
  • OS: macOS 15.5 (Apple Silicon)
  • Shell: zsh
  • Hooks: TypeScript compiled via tsc

View original on GitHub ↗

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