Skip to content

Grok Build CLI: support soft-warn hook feedback (non-blocking context inject) #77

Description

@phpmac

Summary

Please add a non-blocking soft-warn path for Grok Build CLI hooks so agents can see policy reminders without denying the tool call.

Today, PreToolUse only documents:

{"decision": "allow"}
{"decision": "deny", "reason": "..."}
  • deny + reason reaches the agent (Hook denied: ...) and works for hard blocks.
  • Soft signals (systemMessage, Claude-style hookSpecificOutput.additionalContext, or decision: allow + reason) do not reliably enter the model context on Grok Build, so plugins like hookify cannot implement action: warn (educate the agent, do not block the write).

This forces a bad tradeoff:

Approach Agent sees message? Tool continues?
decision: deny Yes No (stalls agent turns / freezes editing)
decision: allow + reason / additionalContext No (current behavior) Yes

Why it matters

Claude Code documents soft inject via hookSpecificOutput.additionalContext (and has its own issues when only systemMessage is used — see anthropics/claude-code#20747, #25987). Grok Build already loads Claude-compatible plugins and hooks/hooks.json, but without soft inject, warn-style rules cannot educate the agent on Grok.

Use case example: a warn rule for full-width Chinese punctuation / emoji in file content — we want the model to correct style without blocking every write (blocking makes the agent appear stuck).

Requested behavior

For PreToolUse (and ideally PostToolUse, which currently ignores stdout as passive):

  1. When the hook returns allow (or omits deny) and includes a message field, inject that text into the next model turn context (same class of mechanism as Claude additionalContext / a system-reminder block).
  2. Suggested accepted fields (any one is fine if documented):
    • reason on allow
    • systemMessage
    • hookSpecificOutput.additionalContext
  3. Optionally surface soft messages in TUI hook_annotation (today annotations appear for blocked tools; soft allow often produces no agent-visible annotation).
  4. Keep deny semantics unchanged for hard blocks.

Environment

  • Grok Build CLI 0.2.93 (local)
  • Docs: bundled 10-hooks.md (allow/deny only; PostToolUse stdout ignored)
  • Plugin: hookify (Claude Code + Grok dual use)

Notes

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions