Feature request: hooks that can enforce/block assistant text responses (not just tool calls)

Resolved 💬 3 comments Opened May 12, 2026 by neilelbagly Closed May 16, 2026

Problem

UserPromptSubmit hooks can inject advisory context into every turn, but they cannot enforce compliance — the assistant can (and does) ignore the injected instructions. PreToolUse hooks can block tool calls, but there is no equivalent mechanism for free-text assistant responses.

Use case

I use a UserPromptSubmit hook to inject a language rule ("respond in English by default"). Despite the rule appearing in context on every single turn, the assistant routinely ignores it — sometimes for entire multi-paragraph responses. This requires manual correction ~10 times/day.

The same gap applies to any behavioral rule: style constraints, process compliance, output format requirements. If the rule only applies to free-text output (not tool calls), there is currently no hook that can enforce it.

Current hook architecture

| Hook | Can block? | Scope |
|------|-----------|-------|
| UserPromptSubmit | No — advisory only | Injects context before assistant responds |
| PreToolUse | Yes — can reject tool calls | Tool calls only |
| PostToolUse | No — runs after | Tool calls only |
| SessionStart | No — advisory only | Session init |

Free-text assistant responses have no blocking hook at any stage.

Proposal

Add a hook event that can validate and reject/retry assistant responses:

  • PreAssistantResponse — fires after the assistant generates a response but before it's shown to the user. Hook can inspect the text and return block with a reason, causing a retry with the rejection feedback in context.
  • Or PostAssistantResponse — fires after display, flags violations for the next turn (weaker but simpler).

Either would close the enforcement gap for output-level rules that currently rely on the assistant choosing to comply.

Environment

  • Claude Code CLI (macOS)
  • Model: claude-opus-4-6
  • Hook config: UserPromptSubmit in ~/.claude/settings.json

View original on GitHub ↗

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