Feature request: Allow UserPromptSubmit hooks to modify prompt text
Problem
UserPromptSubmit hooks can currently only block a prompt or add context via additionalContext. There is no way to modify the original prompt text before it is processed by Claude.
This limitation makes it impossible to build input preprocessing pipelines — such as auto-spacing, autocorrect, or macro expansion — that cleanly transform user input before it reaches the model.
Use Case: Korean Voice Input
When using voice mode with Korean, the STT engine often produces text with no word boundaries:
음성모드를테스트하는중이야띄어쓰기가안되는데
A hook that can modify the prompt would fix this:
음성 모드를 테스트하는 중이야 띄어쓰기가 안 되는데
Other use cases:
- Auto-correcting common typos or abbreviations
- Expanding shorthand/macros in prompts
- Normalizing input from various input methods
Proposed Solution
Add an optional modifiedPrompt field to UserPromptSubmit hook output:
{
"hookSpecificOutput": {
"hookEventName": "UserPromptSubmit",
"modifiedPrompt": "The corrected/transformed prompt text"
}
}
When present:
- Claude processes
modifiedPromptinstead of the original - The UI could show the modified text (or both original and modified, for transparency)
When absent, behavior remains unchanged (backward-compatible).
Current Workaround
Using additionalContext to pass a corrected version of the text. Claude sees the correction and responds correctly, but the original unspaced text remains visible in the conversation, making it harder for the user to read their own input.
Environment
- Claude Code CLI (latest)
- macOS
- Voice mode with Korean STT
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗