Bug: UserPromptSubmit additionalContext accumulates in history instead of being ephemeral
Bug
UserPromptSubmit hook output with additionalContext accumulates in the conversation history instead of being replaced on each new message. Every user message adds another <system-reminder> block, and previous ones remain visible to the model.
Steps to reproduce
- Add a
UserPromptSubmithook tosettings.json:
"UserPromptSubmit": [{
"hooks": [{
"type": "command",
"command": "printf '{\"hookSpecificOutput\": {\"hookEventName\": \"UserPromptSubmit\", \"additionalContext\": \"Current time: %s\"}}' \"$(date '+%Y-%m-%d %H:%M %Z %A')\""
}]
}]
- Send several messages in a conversation.
- Ask Claude if it can see multiple timestamps from previous messages.
Expected behavior
Based on the documentation, additionalContext should be ephemeral/request-scoped — only the latest output should be visible to the model, replacing the previous one.
Actual behavior
All previous additionalContext outputs remain in the conversation history as separate <system-reminder> blocks. The model can see every timestamp from every previous message.
Why this matters
I use a global hook script (~/.claude/hooks/context.sh) to inject dynamic project state on every message:
- Current time
git statuswith branch nameLOCKS.md(multi-agent coordination file)
I would also like to inject larger context like TODO files (50-500 lines) and agent-specific source files for my multi-agent setup, but this is impossible with accumulating behavior — 20 messages × 500 lines = 10,000 lines of wasted context.
The intended use case is a dynamic context layer that always reflects the current project state, similar to how CLAUDE.md is re-read from disk, but generated from script output. If additionalContext were truly ephemeral (replacing the previous output), this would work perfectly.
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗