UserPromptSubmit hook systemMessage not injected into context

Resolved 💬 3 comments Opened Jan 21, 2026 by JohnVonDrashek Closed Jan 24, 2026

Bug Report: UserPromptSubmit Hook systemMessage Not Injected Into Context

Summary

The UserPromptSubmit hook executes successfully and returns a systemMessage, but Claude Code does not inject this message into the assistant's conversation context. The hook shows "success" but the returned content is ignored.

Expected Behavior

When a UserPromptSubmit hook returns:

{
  "systemMessage": "⚡ **CHECK FOR AVAILABLE SKILLS FIRST**\n\nBefore doing ANY work..."
}

This message should be injected into the assistant's context as a <system-reminder> so Claude can see and respond to it.

Actual Behavior

The hook executes (confirmed by "UserPromptSubmit:Callback hook success: Success"), but the systemMessage content is never shown to Claude. Only the success confirmation appears:

<system-reminder>
UserPromptSubmit:Callback hook success: Success
</system-reminder>

The actual message body from the hook is missing.

Reproduction Steps

  1. Create .claude/hookify.test.local.md:
---
name: test-prompt-hook
enabled: true
event: prompt
conditions:
  - field: user_prompt
    operator: regex_match
    pattern: .*
---

🔔 **THIS MESSAGE SHOULD APPEAR IN CLAUDE'S CONTEXT**
  1. Submit any user prompt
  1. Observe that Claude only sees:
  • <system-reminder>UserPromptSubmit:Callback hook success: Success</system-reminder>
  • But NOT the actual message content
  1. Manually test the hook script:
CLAUDE_PLUGIN_ROOT=/Users/gfelter/.claude/plugins/cache/claude-plugins-official/hookify/6d3752c000e2 \
python3 /Users/gfelter/.claude/plugins/cache/claude-plugins-official/hookify/6d3752c000e2/hooks/userpromptsubmit.py <<'EOF'
{
  "user_prompt": "test message",
  "hook_event_name": "UserPromptSubmit"
}
EOF

Output (correctly returns systemMessage):

{
  "systemMessage": "🔔 **THIS MESSAGE SHOULD APPEAR IN CLAUDE'S CONTEXT**"
}

Evidence

  • Hook script executes without errors
  • Hook returns valid JSON with systemMessage field
  • Manual testing confirms hook output is correct
  • Claude Code shows "success" but doesn't inject the message
  • Other hooks (PreToolUse, Stop) work correctly and their messages DO appear

Environment

  • OS: macOS (Darwin 24.6.0)
  • Claude Code Version: [Current version as of 2026-01-20]
  • Hookify Plugin: Version 6d3752c000e2

Comparison with Working Hooks

PreToolUse hooks correctly inject systemMessage:

  • Hook returns {"systemMessage": "...", "hookSpecificOutput": {...}}
  • Claude sees the message in context

UserPromptSubmit hooks fail to inject systemMessage:

  • Hook returns {"systemMessage": "..."}
  • Claude only sees "success" confirmation, not the actual message

Root Cause Hypothesis

Claude Code's UserPromptSubmit hook handler may be:

  1. Ignoring the systemMessage field in the hook response
  2. Only checking for success/failure without processing returned data
  3. Missing implementation for injecting UserPromptSubmit messages into context

Impact

This breaks the hookify plugin's ability to:

  • Show reminders/checklists when users submit prompts
  • Enforce workflow requirements at prompt time
  • Guide Claude's behavior based on user input patterns

Workaround

None currently. The only hooks that work are PreToolUse, PostToolUse, and Stop events.

Suggested Fix

Update Claude Code's UserPromptSubmit hook handler to:

  1. Parse the JSON response from the hook
  2. Extract the systemMessage field if present
  3. Inject it into the conversation context as a <system-reminder> tag
  4. Follow the same pattern as PreToolUse/Stop hooks

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗