You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Native ZCode Agent does not trigger hooks configured in ~/.zcode/cli/config.json #32
The hook script writes to a debug log on entry (before any stdin read), so if it were invoked at all, the log would appear. After multiple ZCode Agent sessions with prompts and tool use, the log file is never written.
What was also tried
Registering hooks via the plugin system (~/.zcode/cli/plugins/) — same result, hooks not triggered for ZCode Agent sessions
Hook command executes correctly when invoked manually via PowerShell
Expected behavior
Hooks in hooks.events should fire for ZCode Agent sessions (SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, Stop, etc.) the same way they work for external CLI subagents.
Question
Is this a known limitation? Is there a supported way to receive lifecycle events from ZCode Agent sessions externally (e.g., a local HTTP/WebSocket API, IPC, or log file)?
Adding to the original report — I ran into the same core issue (hooks not firing), but was able to get them working after changing the format. Leaving notes in case useful.
Diagnosis
When using exec form with a separate args field (as described in Claude Code docs and Discussion #9), ZCode marks the entire config.json as invalid and no hooks are registered at all:
Found in ZCode logs at ~/.zcode/cli/log/zcode-YYYY-MM-DD.jsonl.
The args field appears to no longer be recognized by the validator (schema?). Notable behavior: a single invalid entry disables the entirehooks section, including any other valid hooks.
Workaround — shell form only
Using a single command string with quoted paths (instead of args) makes everything work end-to-end:
The node script reads JSON from stdin and returns {hookSpecificOutput: {hookEventName, additionalContext}} — additionalContext is injected into the model context as documented.
✅ Stop — fires only after the model fully completes its response (not on user interruption)
✅ PreToolUse with matcher: "Bash" — permissionDecision: "deny" blocks the tool call
Possible doc discrepancy
Discussion #9 by @GoooIce mentions args as part of the schema (based on decompile analysis, Jun 14 2026). On my current build (Jul 20 2026), args is rejected with config.file.invalid. Either (a) args was removed/restricted in a build between those dates, or (b) the desktop client validator is stricter than the embedded runtime. Would be useful to know which format is intended canonical.
Working 3-hook setup (for reference)
Deployed three production hooks (node.exe + JS script, shell form as above):
All three work end-to-end after switching to shell form. Hook logs are written, additionalContext shows up in model context, permissionDecision: "deny" properly blocks tool calls.
Hope this helps clarify what works and what doesn't right now.
This is the same problem as #167, and is now tracked there.
Shared root cause: Hooks register successfully in config/plugins and show as loaded in the UI, but several events (Stop, PreToolUse, SubagentStart/Stop, …) never fire at runtime, which breaks any plugin built on hooks (dcg, SAP, and others).
We're consolidating so the team sees one complete picture instead of the same thing split across 4 issues. Nothing is lost — your report is listed in #167, all updates will go there, and you're welcome to subscribe to it.
If you think this is actually a different problem, reply here and we'll split it back out.
Activity
github-actions commentedon Jun 22, 2026
👋 感谢你的反馈,我们已经收到。
status: 待评估,你可以随时补充信息。needs: 更多信息标签并 @ 你。👋 Thanks — we've received your issue.
status: 待评估(Triage); feel free to add context.needs: 更多信息and ping you.Krutov-mcp commentedon Jul 19, 2026
Adding to the original report — I ran into the same core issue (hooks not firing), but was able to get them working after changing the format. Leaving notes in case useful.
Diagnosis
When using exec form with a separate
argsfield (as described in Claude Code docs and Discussion #9), ZCode marks the entireconfig.jsonas invalid and no hooks are registered at all:Found in ZCode logs at
~/.zcode/cli/log/zcode-YYYY-MM-DD.jsonl.The
argsfield appears to no longer be recognized by the validator (schema?). Notable behavior: a single invalid entry disables the entirehookssection, including any other valid hooks.Workaround — shell form only
Using a single
commandstring with quoted paths (instead ofargs) makes everything work end-to-end:{ "hooks": { "enabled": true, "events": { "UserPromptSubmit": [{ "hooks": [{ "type": "command", "command": "\"C:\\Program Files\\nodejs\\node.exe\" \"C:\\Users\\<user>\\.zcode\\hooks\\my-hook.js\"", "timeoutMs": 5000 }] }] } } }The node script reads JSON from stdin and returns
{hookSpecificOutput: {hookEventName, additionalContext}}—additionalContextis injected into the model context as documented.Events verified working (empirically, 2026-07-20)
Desktop build on Windows 10:
SessionStartUserPromptSubmit—additionalContextinjection confirmedStop— fires only after the model fully completes its response (not on user interruption)PreToolUsewithmatcher: "Bash"—permissionDecision: "deny"blocks the tool callPossible doc discrepancy
Discussion #9 by @GoooIce mentions
argsas part of the schema (based on decompile analysis, Jun 14 2026). On my current build (Jul 20 2026),argsis rejected withconfig.file.invalid. Either (a)argswas removed/restricted in a build between those dates, or (b) the desktop client validator is stricter than the embedded runtime. Would be useful to know which format is intended canonical.Working 3-hook setup (for reference)
Deployed three production hooks (node.exe + JS script, shell form as above):
UserPromptSubmit→ workflow-trigger reminder (L-Z069-like pattern)Stop→ verify-before-complete checklist (block if "done" without test markers)PreToolUse(Bash)→ block destructive commands (rm -rf, git push -f, curl|sh)All three work end-to-end after switching to shell form. Hook logs are written,
additionalContextshows up in model context,permissionDecision: "deny"properly blocks tool calls.Hope this helps clarify what works and what doesn't right now.
panda920 commentedon Aug 17, 2026
这条和 #167 是同一个问题,已合并到 #167 统一跟进。
共同根因:hooks 在配置/插件里注册成功、UI 也显示已加载,但运行时多个事件(Stop、PreToolUse、SubagentStart/Stop 等)从不触发,导致依赖 hook 的插件(dcg、SAP 等)整体失效。
合并是为了让研发看到完整上下文,而不是同一件事被拆成 4 条各自跟进。你的反馈没有丢——我已经在 #167 里把这几条一起列了出来,后续进展都会更新在那边,建议去 #167 点一下 Subscribe。
如果你认为这其实是另一个问题,直接回复本条,我们会重新拆开。
This is the same problem as #167, and is now tracked there.
Shared root cause: Hooks register successfully in config/plugins and show as loaded in the UI, but several events (Stop, PreToolUse, SubagentStart/Stop, …) never fire at runtime, which breaks any plugin built on hooks (dcg, SAP, and others).
We're consolidating so the team sees one complete picture instead of the same thing split across 4 issues. Nothing is lost — your report is listed in #167, all updates will go there, and you're welcome to subscribe to it.
If you think this is actually a different problem, reply here and we'll split it back out.
feat(dashboard): budget metering tap — subagent dispatch rows + main-…