Feature request: Stop hook should receive assistant response text for output validation
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:
- Stop hook payload extended to include the assistant final response text (most useful)
- New event type
PreUserDisplayorBeforeRenderthat fires before output reaches user, with text available - 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
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗