Bug: `beforeSubmitPrompt` hook `updated_input` is silently stripped — modified prompt never reaches the model

Thanks for the detailed report and the minimal reproducer.

This is actually expected behavior rather than a bug. The beforeSubmitPrompt hook currently only supports two output fields:

  • continue (boolean) — block or allow the submission

  • user_message (string) — message shown to the user when blocked

It does not support updated_input or any field that modifies the prompt text. The updated_input field is supported on preToolUse (for modifying tool parameters), which may be where the expectation came from. Because the hook validator doesn’t reject unknown fields, the JSON passes without error but the extra fields are ignored.

For your use case of injecting context based on prompt content, a couple of alternatives:

  1. .cursor/rules with alwaysApply: true — this is the most reliable way to inject context into every prompt today. It lacks per-prompt selectivity, but the context does reach the model end-to-end.

  2. sessionStart hook with additional_context — can inject context at the start of a conversation. Better suited for session-level context than per-prompt, and there are currently some known gaps in this path as well.

There’s an existing feature request thread for exactly what you’re describing — adding context-injection support to beforeSubmitPrompt:

Add additional_context to beforeSubmitPrompt hook output

I’d recommend adding your use case there. Community engagement on that thread helps our product team gauge demand and prioritize accordingly.

For the full reference on what each hook supports, see the Hooks documentation.