UserPromptSubmit hook systemMessage not injected into context
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
- 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**
- Submit any user prompt
- Observe that Claude only sees:
<system-reminder>UserPromptSubmit:Callback hook success: Success</system-reminder>- But NOT the actual message content
- 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
systemMessagefield - 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:
- Ignoring the
systemMessagefield in the hook response - Only checking for success/failure without processing returned data
- 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:
- Parse the JSON response from the hook
- Extract the
systemMessagefield if present - Inject it into the conversation context as a
<system-reminder>tag - Follow the same pattern as PreToolUse/Stop hooks
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗