claude-code - 💡(How to fix) Fix [BUG] [Cowork / Plugins] hooks.json silencieusement ignoré en mode Cowork

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Error Messages/Logs

Root Cause

N/A — bug is in Claude Desktop Cowork mode (MSIX package Claude_pzs8sxrjxfjjc), not Claude Code CLI. Filing here because plugins and hooks are shared infrastructure and I could not find a Cowork-specific issue tracker. Please reroute if needed.

Fix Action

Fix / Workaround

Demandes :

  1. Clarifier officiellement si les hooks plugin sont censés fonctionner en Cowork.
  2. Si non, le documenter dans la doc SDK plugin (qui laisse entendre la parité avec Claude Code).
  3. Si oui, corriger le silent failure — au minimum logger un warning quand un hooks.json est chargé mais non exécutable par le runtime.
  4. À terme, exposer une surface observabilité équivalente (post-tool callback, session-start callback) pour permettre aux plugins de type budget-tracker d'être déterministes sans workaround.

Workaround en place de mon côté : logging orchestrateur via budget.py log-total appelé après chaque Agent(), en parsant la balise <usage>total_tokens</usage> retournée par Cowork. Fonctionnel mais fragile (dépend de la discipline de l'orchestrateur à chaque tour).

Code Example



---

{
     "hooks": {
       "PostToolUse": [
         {
           "matcher": ".*",
           "hooks": [
             {"type": "command", "command": "${CLAUDE_PLUGIN_ROOT}/scripts/trace.cmd"}
           ]
         }
       ]
     }
   }

---

@echo off
   echo [%date% %time%] hook fired >> "%~dp0..\hook-trace.log"
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

Bonjour,

J'ai identifié et documenté en détail un comportement non documenté de Claude Desktop en mode Cowork : les hooks définis dans hooks/hooks.json d'un plugin sont chargés mais jamais invoqués au runtime, alors qu'ils fonctionnent correctement sous Claude Code CLI.

Le rapport complet (matrice de tests, environnement MSIX Windows, logs, reproduction minimale) est en pièce jointe : cowork-hooks-repro.md.

Demandes :

  1. Clarifier officiellement si les hooks plugin sont censés fonctionner en Cowork.
  2. Si non, le documenter dans la doc SDK plugin (qui laisse entendre la parité avec Claude Code).
  3. Si oui, corriger le silent failure — au minimum logger un warning quand un hooks.json est chargé mais non exécutable par le runtime.
  4. À terme, exposer une surface observabilité équivalente (post-tool callback, session-start callback) pour permettre aux plugins de type budget-tracker d'être déterministes sans workaround.

Workaround en place de mon côté : logging orchestrateur via budget.py log-total appelé après chaque Agent(), en parsant la balise <usage>total_tokens</usage> retournée par Cowork. Fonctionnel mais fragile (dépend de la discipline de l'orchestrateur à chaque tour).

Merci pour votre temps.

Sébastien ([email protected])

cowork-hooks-repro.md

What Should Happen?

Plugin hooks declared in hooks/hooks.json (PreToolUse, PostToolUse, SessionStart) should execute at runtime in Cowork mode with the same behavior as under Claude Code CLI — each matching tool call should invoke the configured command with the tool payload on stdin.

At minimum, if Cowork parity is not planned, Claude Desktop should emit a visible warning when loading a plugin's hooks.json to signal the runtime will not invoke them. Today it is a silent failure — the plugin loads, skills and MCPs work, but hooks never fire and no log entry mentions them.

Error Messages/Logs

Steps to Reproduce

  1. Install Claude Desktop on Windows 11 (MSIX package Claude_pzs8sxrjxfjjc) and enable Cowork mode.

  2. Create a minimal local plugin with this structure:

my-plugin/ ├── .claude-plugin/ │ └── plugin.json (metadata only — name, version, description) ├── hooks/ │ └── hooks.json └── scripts/ └── trace.cmd

  1. hooks/hooks.json content (UTF-8 without BOM):
   {
     "hooks": {
       "PostToolUse": [
         {
           "matcher": ".*",
           "hooks": [
             {"type": "command", "command": "${CLAUDE_PLUGIN_ROOT}/scripts/trace.cmd"}
           ]
         }
       ]
     }
   }
  1. scripts/trace.cmd content (just appends a timestamp to prove it ran):
   @echo off
   echo [%date% %time%] hook fired >> "%~dp0..\hook-trace.log"
  1. Install the plugin in Cowork and restart Claude Desktop.

  2. Run any prompt that triggers a tool call (e.g. "list the files in my documents folder").

  3. Observe:

    • trace.cmd never executes
    • hook-trace.log is never created
    • %LOCALAPPDATA%\Packages\Claude_pzs8sxrjxfjjc\LocalCache\Roaming\Claude\logs\main.log contains no hook-related entries (no registration, evaluation, invocation attempt or failure)
  4. For contrast: same plugin archive installed under Claude Code CLI → hooks fire normally and trace.cmd runs on every tool call.

Verified across 8 combinations (PreToolUse / PostToolUse / SessionStart × matchers "Bash", "Task", "Agent|Task", ".*", plus .sh and .cmd wrappers). None fire. Full test matrix in attached cowork-hooks-repro.md.

Claude Model

Opus

Is this a regression?

No, this never worked

Last Working Version

No response

Claude Code Version

claude cowork

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

N/A — bug is in Claude Desktop Cowork mode (MSIX package Claude_pzs8sxrjxfjjc), not Claude Code CLI. Filing here because plugins and hooks are shared infrastructure and I could not find a Cowork-specific issue tracker. Please reroute if needed.

extent analysis

TL;DR

The issue can be addressed by either officially documenting that plugin hooks are not supported in Cowork mode or by implementing the necessary changes to invoke hooks at runtime.

Guidance

  1. Clarify plugin hook support: Officially document whether plugin hooks are intended to work in Cowork mode to avoid confusion and silent failures.
  2. Implement hook invocation: If plugin hooks are supposed to work, modify the Cowork mode to invoke hooks at runtime, ensuring parity with Claude Code CLI behavior.
  3. Add logging for silent failures: If hooks are not intended to work, add a visible warning when loading a plugin's hooks.json to signal that the runtime will not invoke them.
  4. Expose observability surface: Consider exposing an equivalent observability surface (e.g., post-tool callback, session-start callback) to allow plugins like budget trackers to function deterministically without workarounds.

Example

No code snippet is provided as the issue focuses on the behavior of plugin hooks in Cowork mode rather than a specific code implementation.

Notes

The provided workaround using budget.py log-total is functional but fragile, relying on the orchestrator's discipline at each turn. A more robust solution would involve addressing the root cause of the issue.

Recommendation

Apply a workaround by using the provided budget.py log-total method until an official fix or documentation update is available, as the root cause of the issue is not fully addressed.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] [Cowork / Plugins] hooks.json silencieusement ignoré en mode Cowork