Redact secrets and rewrite agent output in flight with the new MessageDisplay and PostToolUse hooks
Claude Code Docs·medium signal
A new MessageDisplay hook event lets you transform or hide assistant message text as it renders, and PostToolUse can now replace tool output for ALL tools (previously MCP-only) via `hookSpecificOutput.updatedToolOutput`. Together they let you scrub API keys, PII, or internal hostnames from both model responses and tool results before they ever hit the screen or transcript. Wire a regex/secret-scanner into these hooks so leak prevention happens deterministically at the display/output layer instead of relying on the model to behave.