Feature request: Stop hook should receive assistant response text for output validation

Resolved 💬 2 comments Opened Jun 8, 2026 by Alex463-tech Closed Jun 12, 2026

Summary

The Stop hook receives session_id and stop_hook_active flag but not the assistant response text. This makes it impossible to implement automatic output validation hooks (e.g., grep for banned patterns, fact-check claims, lint inferences).

Use case

User wants to enforce deterministic checks on AI text output before it reaches them. Example checks:

  • Scan for vague temporal patterns (stasera, domani, recentemente)
  • Verify all numeric claims have audit table anchors
  • Block confidence overstatement (smoking gun, sicuramente without source)
  • Verify memory citations have corresponding re-read in current turn

Currently none of these are possible because the assistant text is not accessible via hook stdin payload.

Current behavior

Stop hook stdin JSON: {"session_id": "abc", "stop_hook_active": false} — no assistant text.

PostToolUse hook receives tool_input/tool_response — but only when Claude calls a tool. If Claude just emits italian narrative, no PostToolUse fires, so no hook can scan that text.

Expected behavior

Either:

  1. Stop hook payload extended to include the assistant final response text (most useful)
  2. New event type PreUserDisplay or BeforeRender that fires before output reaches user, with text available
  3. Document explicitly that text-output filtering is not supported (currently the user has to read between the lines)

Impact

High for users wanting automated guardrails on AI text. Without this, the only enforcement options are: (a) external LLM review manual copy-paste each turn, (b) self-discipline by the AI which empirically fails.

Verified empirically in session 2026-06-08: AI emitted banned temporal pattern 3+ times despite self-imposed lint rule. External enforcement was unavailable due to this limitation.

Environment

  • macOS Darwin 24.6.0
  • Claude Code current latest 2026-06-08

View original on GitHub ↗

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