Mid-turn injection text too aggressive — forces redundant responses
Problem
When a user sends a message while Claude is mid-turn processing, the CLI injects it as a <system-reminder> at the next tool boundary with this text:
The user sent a new message while you were working:
{message}
IMPORTANT: After completing your current task, you MUST address the user's message above. Do not ignore it.
The "MUST address" phrasing forces the model to respond to the new message even when it was already fully addressed by the work in progress.
Example
User sends two messages in quick succession:
- "Preschool gate code"
- "?"
The turn starts with message 1. Claude sends the answer ("2243"). Then message 2 ("?") arrives mid-turn and gets injected with the "MUST address" language. Claude interprets this as requiring a separate response, so it sends a redundant follow-up: "You gave it to me a while back — 2243. That right?"
From the user's perspective, the bot double-responded to a simple question.
Suggested Fix
Change the injection text to:
The user sent a new message while you were working:
{message}
IMPORTANT: After completing your current task, you MUST address the user's message above, UNLESS it was completely handled by the work you're already doing. Do not ignore it.
This gives the model permission to skip redundant responses while still ensuring genuinely new messages aren't dropped.
Context
This was discovered in a production Claude Agent SDK application where each conversation runs as a long-lived query() session. Mid-turn messages are injected via client.query() on the running session. The aggressive injection language causes unnecessary double-responses, especially for impatient follow-ups like "?" or "hello?" that arrive while the original question is already being answered.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗