claude-code - 💡(How to fix) Fix docs: clarify whether UserPromptSubmit hook fires for MCP channel messages [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#54180Fetched 2026-04-29 06:34:08
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Author
Participants
Timeline (top)
labeled ×4

The hooks documentation states that UserPromptSubmit "runs when the user submits a prompt, before Claude processes it." It is unclear whether MCP channel messages (e.g. from the official Telegram plugin) count as "user submitting a prompt" for the purpose of this hook.

Root Cause

The hooks documentation states that UserPromptSubmit "runs when the user submits a prompt, before Claude processes it." It is unclear whether MCP channel messages (e.g. from the official Telegram plugin) count as "user submitting a prompt" for the purpose of this hook.

RAW_BUFFERClick to expand / collapse

Summary

The hooks documentation states that UserPromptSubmit "runs when the user submits a prompt, before Claude processes it." It is unclear whether MCP channel messages (e.g. from the official Telegram plugin) count as "user submitting a prompt" for the purpose of this hook.

Context

I run a persistent Claude Code session that receives most of its input via MCP channel messages (Telegram plugin), not interactive CLI input. I want to add a UserPromptSubmit hook for identity reinforcement — injecting a short context block before each response.

The docs don't specify whether UserPromptSubmit fires for:

  1. Only interactive CLI input (user typing at the terminal)
  2. All user turns, including messages injected by MCP channel plugins (e.g. <channel source="plugin:telegram:telegram" ...>)

What I'd like

A clarification in the hooks documentation specifying which input sources trigger UserPromptSubmit. Specifically:

  • Does it fire for MCP channel messages (e.g. Telegram plugin)?
  • Does it fire for tmux send-keys injected input?
  • Does it fire only for interactive CLI input?

This matters for anyone building hooks that need to run on every turn regardless of input source.

extent analysis

TL;DR

The UserPromptSubmit hook's behavior for non-interactive input sources like MCP channel messages and tmux send-keys needs clarification to determine the best approach for implementing identity reinforcement.

Guidance

  • Review the hooks documentation and related code to see if there are any implicit hints about the hook's behavior for different input sources.
  • Test the UserPromptSubmit hook with MCP channel messages (e.g., Telegram plugin) and tmux send-keys injected input to observe its current behavior.
  • Consider opening a documentation issue or pull request to add clarity on the hook's behavior for different input sources.
  • If the hook does not fire for MCP channel messages, explore alternative hooks or implementation approaches that can achieve the desired identity reinforcement functionality.

Notes

The current documentation ambiguity makes it challenging to provide a definitive solution, and testing or clarification from the maintainers may be necessary to determine the best course of action.

Recommendation

Apply workaround: Test the UserPromptSubmit hook with different input sources to determine its current behavior and plan accordingly, as the documentation clarification may take time.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING