Hook-based filtering of agent output
Parent: Instruction-file hygiene for LLM lexical tics: linting, mirroring, hook filtering · Published reference · snapshot 2026-09-23
↓ Facts as markdownall context files
Source-anchored research for Hook-based filtering of agent output. Run status: COMPLETED.
These notes link each claim to its source. Some citations identify archived research reports that are no longer hosted on this site. A published reference means the content is available; it does not certify independent review or accuracy.Read the editorial policy and follow the sources before relying on a claim.
Problems, failure modes and limitations
- Hooks cannot directly modify assistant message text. Stop can only prevent stopping and continue the conversation, and last_assistant_message on Stop/SubagentStop is read-only input for analysis. (medium confidence) (verified as of 2026-09-23) [source]
Facts and statements
- A Stop hook can act as a post-generation filter: it inspects the final response and blocks with a reason, forcing the model to revise before the user sees the result. (medium confidence) [source]
- A regex-only Stop hook produces false positives; combining the regex with a second condition (e.g. prior tool-call activity) removes most of them. (low confidence) [source]
- A Stop hook that re-blocks without checking stop_hook_active can loop indefinitely; one reported case ran about 50 minutes and consumed the session quota. A nag-once pattern (block the first violation, let an identical repeat pass) avoids it. (medium confidence) (verified as of 2026-05-03) [source]
- PostToolUse can replace a tool's output before the model sees it (updatedToolOutput), so filtering applies to tool results but not to the model's own prose. (medium confidence) (verified as of 2026-09-23) [source]
Children
- No children recorded.