Feature Request: Support Overwriting Prompt via HookUserPromptSubmit

Feature Request: Support Overwriting Prompt via Hook

Problem

Qoder’s UserPromptSubmit Hook currently supports appending context to the user prompt, but does not support overwriting/replacing the original prompt content. This blocks critical use cases like PII redaction, input sanitization, and prompt translation — where modifying the source text is essential.

Solution

Extend the Hook script protocol to support an "overwrite" action:

{
  "action": "overwrite",
  "prompt": "sanitized or modified prompt content"
}

Supported actions:

Action Behavior
pass Use original prompt as-is
append Append content after user prompt (existing)
overwrite Replace user prompt entirely (requested)
block Reject prompt and show reason

After overwrite, system-level append (e.g., auto-injected project rules) should still apply to the new prompt.

Use Case

  • PII Redaction: Replace real IPs, tokens, or passwords with placeholders before sending to the model.
  • Input Sanitization: Clean up garbled text copied from PDFs or web pages.
  • Prompt Optimization: Auto-translate vague user input into precise technical prompts.

Priority

:red_circle: High — Blocking issue

Sensitive data in the original prompt cannot be effectively protected by appending disclaimers. Source-level modification is required for security compliance.

Additional Info

  • Existing capability: Auto-inject context (append mode)
  • Similar pattern: Git pre-commit hooks can modify staged content via stdout