[FEATURE] Allow UserPromptSubmit hook to transform message content

Resolved 💬 3 comments Opened Apr 15, 2026 by kidow Closed Apr 19, 2026

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

Summary
Currently, the UserPromptSubmit hook can only allow/block a message and inject additionalContext. It would be very useful if this hook could also modify the user's message content before it reaches the model.

Use Case
Prompt preprocessing: Automatically expand abbreviations, inject templates, or rewrite prompts based on project-specific rules
Translation/normalization: Transform shorthand commands into full instructions (e.g., expanding "fix ts" into "fix all TypeScript type errors in the current file")
Context enrichment: Dynamically rewrite prompts to include relevant file paths or context that the user would otherwise have to type manually

Environment
Claude Code CLI
Hooks system (settings.json)

Proposed Solution

Proposed Behavior
The UserPromptSubmit hook output could support an optional transformedPrompt field:

{
"hookSpecificOutput": {
"transformedPrompt": "the modified message to send to the model"
}
}
If transformedPrompt is present, Claude Code would use it in place of the original user message. If absent, behavior remains unchanged (backward compatible).

Current Workaround
additionalContext can inject supplementary instructions, but it cannot alter the original message. This limits use cases where the message itself needs to be rewritten before the model sees it.

Alternative Solutions

_No response_

Priority

Critical - Blocking my work

Feature Category

CLI commands and flags

Use Case Example

_No response_

Additional Context

_No response_

View original on GitHub ↗

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