claude-code - 💡(How to fix) Fix [BUG] Buddy/Companion can inject ghost messages into the input stream as role: "user", impersonating the user [4 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#45279Fetched 2026-04-09 08:09:04
View on GitHub
Comments
4
Participants
3
Timeline
7
Reactions
0
Timeline (top)
commented ×4labeled ×3

The Buddy/Companion feature (April seasonal companion) can write messages into the input stream that appear as Human: (user role) messages. The model cannot distinguish these from genuine user input, leading to unintended actions and responses.

Error Message

  • Buddy-generated text appears as ⏺ Human: in the terminal, indistinguishable from real user input
  • The model acts on these ghost inputs: executing commands, sending channel replies, and making decisions based on messages the user never sent
  • When channels are active, this results in unsolicited replies being sent to the user's Telegram/Discord/iMessage, responding to messages they never wrote
  • The user has no way to identify which Human: messages were theirs vs. Buddy's without manually cross-referencing the terminal log

Root Cause

Claude Code delivers all system events through role: "user" messages because there is no system-event role. The Buddy feature appears to write into this same input stream, making its output indistinguishable from genuine user input at the model level.

This is especially dangerous when combined with --dangerously-skip-permissions, as ghost inputs can trigger tool calls that execute without any user confirmation.

RAW_BUFFERClick to expand / collapse

Summary

The Buddy/Companion feature (April seasonal companion) can write messages into the input stream that appear as Human: (user role) messages. The model cannot distinguish these from genuine user input, leading to unintended actions and responses.

Reproduction

  1. Start a Claude Code session with the Buddy companion active
  2. Use Telegram channels (--channels plugin:telegram@claude-plugins-official)
  3. Observe that Buddy occasionally injects text into the session as ⏺ Human: entries
  4. The model treats these as genuine user messages and responds accordingly — including sending replies through the Telegram channel to the real user

Observed behavior

  • Buddy-generated text appears as ⏺ Human: in the terminal, indistinguishable from real user input
  • The model acts on these ghost inputs: executing commands, sending channel replies, and making decisions based on messages the user never sent
  • When channels are active, this results in unsolicited replies being sent to the user's Telegram/Discord/iMessage, responding to messages they never wrote
  • The user has no way to identify which Human: messages were theirs vs. Buddy's without manually cross-referencing the terminal log

Expected behavior

Buddy/Companion messages should either:

  1. Use a distinct role or tag (e.g., role: "companion" or <companion> wrapper) so the model can identify and ignore them
  2. Be rendered in the UI only (speech bubble) without writing to the input stream at all

Root cause

Claude Code delivers all system events through role: "user" messages because there is no system-event role. The Buddy feature appears to write into this same input stream, making its output indistinguishable from genuine user input at the model level.

This is especially dangerous when combined with --dangerously-skip-permissions, as ghost inputs can trigger tool calls that execute without any user confirmation.

Impact

  • Security: Any feature that can write role: "user" messages is an injection vector. If Buddy can do it, other plugins or MCP servers could potentially do the same.
  • Trust: Users cannot trust that the model's actions were triggered by their own input.
  • Channel safety: Ghost inputs trigger real outbound messages through channels (Telegram, Discord, iMessage), breaking user expectations.

Environment

  • Claude Code version: 2.1.96
  • Companion: Rabbit (Zephyr)
  • Channels: Telegram plugin active
  • OS: macOS

extent analysis

TL;DR

Modify the Buddy/Companion feature to use a distinct role or tag, allowing the model to differentiate its messages from genuine user input.

Guidance

  • Identify the source of the role: "user" messages and modify the Buddy feature to use a unique identifier, such as role: "companion", to distinguish its output from user input.
  • Consider rendering Buddy messages in the UI only, without writing to the input stream, to prevent the model from acting on them.
  • Review the --dangerously-skip-permissions flag and consider removing or restricting its use to prevent potential security risks.
  • Verify that the modified Buddy feature does not inject messages into the input stream, and test the model's response to ensure it ignores Buddy-generated messages.

Example

No code snippet is provided, as the issue does not include specific code details.

Notes

The solution may require modifications to the Claude Code architecture or the Buddy/Companion feature, and may involve collaborating with the development team to implement the necessary changes.

Recommendation

Apply a workaround by modifying the Buddy feature to use a distinct role or tag, allowing the model to differentiate its messages from genuine user input, until a permanent fix can be implemented. This will help prevent unintended actions and responses, and mitigate potential security risks.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Buddy/Companion messages should either:

  1. Use a distinct role or tag (e.g., role: "companion" or <companion> wrapper) so the model can identify and ignore them
  2. Be rendered in the UI only (speech bubble) without writing to the input stream at all

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING