fix: emit hookSpecificOutput JSON on ZCode so rules reach the model - #799
Open
Arteiimis wants to merge 1 commit into
Open
fix: emit hookSpecificOutput JSON on ZCode so rules reach the model#799Arteiimis wants to merge 1 commit into
Arteiimis wants to merge 1 commit into
Conversation
ZCode parses hook stdout as strict JSON; the native-Claude raw-text SessionStart output fails validation and is silently discarded, so the ponytail ruleset never reaches the model there (DietrichGebert#798). Detect ZCode via the ZCODE_APP_VERSION env var it injects into child processes and reuse the Qoder hookSpecificOutput shape. Skip the bare-OK off-mode output and the statusline nudge on ZCode for the same reason.
Author
|
Verified end-to-end on the reporter's install (ZCode 3.10.2, Windows 11, ponytail 4.9.0 with this patch applied to the installed plugin): on a fresh session the SessionStart hook fires and the full ruleset reaches the model as injected additionalContext — no manual |
ffernandodr11-art
approved these changes
Sep 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #798
ZCode parses hook stdout as strict JSON and injects only
additionalContext; the native-Claude raw-text output fails validation and is silently discarded, so the ponytail ruleset never reaches the model there. The hook itself runs fine — the state flag is written at session start — which is what makes the failure so quiet.Changes
ZCODE_APP_VERSION, which ZCode injects into every child process, hooks included. A Claude-compat variable alone (CLAUDE_PLUGIN_ROOT) can't distinguish the two.hookSpecificOutputshape for ZCode inwriteHookOutput. Unlike Qoder, ZCode has SessionStart, soponytail-activate.jskeeps handling startup injection — only the output shape differs from Claude Code.off-mode early exit inponytail-activate.js, where the bareOKtext would also fail ZCode's strict JSON parse.settings.json.SubagentStartchange: ZCode drops that event at registration time, which is already the desired behavior there.tests/hooks.test.js: SessionStart injection, mode switch, deactivation.Verification
node --test tests/hooks.test.jsandtests/hooks-windows.test.jspass;scripts/check-rule-copies.jsandscripts/check-versions.jspass.hookSpecificOutput.hookEventName+additionalContext, cf. ZCode: SessionStart rules never injected — raw-text stdout fails ZCode's JSON validation #798 diagnostics: an event-specific output naming the wrong event fails validation).