Add displayContext hook field for human-visible, agent-hidden output
Problem
Hooks support additionalContext — output injected into the agent's context but hidden from the human in the terminal. There's no inverse: a way for hooks to display output to the human without adding it to the agent's context.
This matters for observability. When the agent runs tests, linters, or builds via Bash, the human loses visibility into results unless they read through tool output. A hook could surface a formatted summary directly in the conversation thread — but today, any hook output that reaches the thread also lands in the agent's context, which is wasteful when the agent already has the full tool result.
Use cases:
- Test run summaries after test commands
- Lint/typecheck results after file edits
- Deploy status after push commands
- Any "FYI" output where the human benefits from visibility but the agent doesn't need the extra context
Proposed solution
Add a displayContext field symmetric to additionalContext:
| Field | Terminal (human) | API context (agent) |
|---|---|---|
| additionalContext | Hidden | Included |
| displayContext | Rendered | Excluded |
Example
A PostToolUse hook on Bash that surfaces a test summary to the human:
#!/bin/bash
INPUT=$(cat)
COMMAND=$(echo "$INPUT" | jq -r '.tool_input.command // empty')
[[ "$COMMAND" == *"test"* || "$COMMAND" == *"spec"* ]] || exit 0
STDOUT=$(echo "$INPUT" | jq -r '.tool_result.stdout // empty')
SUMMARY=$(echo "$STDOUT" | tail -5)
if [ -n "$SUMMARY" ]; then
jq -n --arg ctx "$SUMMARY" '{"displayContext": $ctx}'
fi
The human sees the summary inline in the conversation. The agent doesn't.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗