Hook output: support native IDE notifications
Summary
Hooks (PreToolUse, PostToolUse, UserPromptSubmit, etc.) can return additionalContext and permissionDecision via JSON stdout. There's no way for a hook to trigger a native IDE notification (VS Code window.showInformationMessage / showWarningMessage / showErrorMessage).
Use Case
Context pressure monitoring: a UserPromptSubmit hook computes context window usage % and wants to show the user a visible notification at threshold crossings (25%, 50%, 80%). Currently the only option is additionalContext which injects text the model sees but the user doesn't see directly.
Proposed API
New hook output field notification:
{
"notification": {
"message": "Context at 50% — consider writing CONTINUITY.md",
"severity": "warning"
},
"additionalContext": "CONTEXT PRESSURE: YELLOW (50%)..."
}
severity values: "info" | "warning" | "error" mapping to the VS Code notification API.
Current Workaround
Using a separate VS Code extension that watches a cache file written by the hook. Works but adds an extension dependency for what could be a built-in hook capability.
---
🤖 Generated with Claude Code
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗