Feature request: PreResponse hook event type

Resolved 💬 3 comments Opened Apr 26, 2026 by dyemane-rep Closed Apr 26, 2026

Problem

Hooks currently only fire on tool use (PreToolUse, PostToolUse). This means there's no way to inject guidance or enforcement before the agent starts generating a text response.

Real-world example

I have a CLI toolkit (./lift find) that indexes all available commands, skills, and workflows. My CLAUDE.md says "run ./lift find before doing anything." Hooks enforce this when the agent tries to use tools (Bash, Write, Edit) — the PreToolUse hook catches violations.

But when a user asks "how would you do X?", the agent answers from memory without calling any tool. No tool use = no hook fires = no enforcement. The agent skips the tool discovery step entirely and gives a stale or incomplete answer.

Why existing hooks don't solve this

| Hook | Why it doesn't help |
|------|-------------------|
| PreToolUse | Only fires when a tool is called — the problem is the agent answering without calling tools |
| PostToolUse | Same — requires a tool call to exist |

Proposed solution

A new hook event type — PreResponse (or PreAssistantTurn) — that fires after the user submits a prompt and before the agent generates its response. The hook's stdout would be injected as a system-level reminder, similar to how PreToolUse hook output is treated.

{
  "hooks": {
    "PreResponse": [
      {
        "hooks": [
          {
            "type": "command",
            "command": ".claude/hooks/pre_response_reminder.sh"
          }
        ]
      }
    ]
  }
}

The hook script receives the user's message as input (JSON) and can:

  • Exit 0 with stdout → stdout is injected as a system reminder before the agent responds
  • Exit 0 with no stdout → no injection, agent responds normally
  • Exit 2 → block the response entirely (same semantics as PreToolUse)

Example use case

#!/bin/bash
# .claude/hooks/pre_response_reminder.sh
INPUT=$(cat)
MSG=$(echo "$INPUT" | python3 -c "import sys,json; print(json.load(sys.stdin).get('message','').lower())" 2>/dev/null)

# Detect knowledge/how-to questions
if echo "$MSG" | grep -qE '(how would|how do|how to|walk.*through|what.s the best way|explain how)'; then
  echo "REMINDER: Rule Zero — run ./lift find <keywords> before answering this question."
fi
exit 0

This would let project maintainers enforce "check before you answer" patterns that CLAUDE.md instructions alone can't reliably enforce (especially after context compaction in long sessions).

Alternatives considered

  • CLAUDE.md instructions only — unreliable after context compaction in long sessions
  • Feedback memory — helps across conversations but still soft enforcement
  • Custom slash command (/how-to) — requires user to remember to use it
  • PreToolUse catch-all — doesn't fire when no tool is called

View original on GitHub ↗

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