package main // Shared by the plugin's hooks (novox/hq ADR 0489 §5): a notice on exit 0 — the stop hook failing open or // letting a wait through, the session-start hook unable to use a session id — reaches the operator's screen, // not only the log. Claude Code shows a hook's top-level "systemMessage" field to the person; stderr alone, // on an allowed (exit 0) outcome, is never shown there. import ( "encoding/json" "fmt" "io" ) // writeSystemMessage prints message as the one JSON object Claude Code shows the operator, falling back to // the plain words on the one error that cannot happen (a string always marshals). func writeSystemMessage(w io.Writer, message string) { raw, err := json.Marshal(map[string]string{"systemMessage": message}) if err != nil { fmt.Fprintln(w, message) return } fmt.Fprintln(w, string(raw)) }