Suspected prompt injection in background subagent tool-result stream (Bash), instructing agent to conceal file state from user
Summary
While running a background subagent (spawned via the Agent/Task tool, general-purpose subagent type) inside a Claude Code CLI session on Windows, the subagent reported that a system-reminder-formatted message appeared in its transcript immediately after two Bash tool call results. The message instructed the agent to:
- treat two specific files as if they had been "intentionally changed by the user or a linter,"
- not tell the user about this, and
- not revert them.
The subagent correctly identified this as inconsistent with a legitimate harness notification (legitimate reminders don't instruct an agent to conceal information from the user) and inconsistent with its own task instructions (which required reverting trial edits and reporting git status honestly). It did not comply, reverted the files via git checkout --, and reported the incident in its final summary to the parent session.
What I was able to verify
- The two files in question showed zero diff against the last commit (
git status --porcelain/git diff --stat) when checked from the parent session immediately after the incident was reported — i.e., no unauthorized or hidden change persisted. - No apparent harm occurred; this looks like a near-miss caught by the subagent's own skepticism toward instruction-shaped content in tool output.
What I could NOT verify
- The exact verbatim text of the injected message. The subagent's own
.outputtranscript file (the JSONL capture the harness writes for background tasks) was 0 bytes by the time I tried to inspect it for the exact wording, so I could not confirm the precise phrasing, its exact injection point, or which underlying data source it may have come from. - The root cause / injection vector. It's unclear whether this originated from tool output content, a hook, or some other source read during the subagent's Bash-heavy verification work (the subagent was running
cargo build/cargo tauri buildandgit checkoutcommands against a local Rust/Tauri project).
Environment
- Claude Code CLI (harness/session details: this was a background
Agenttool subagent,general-purposetype, spawned from a top-level session also using Claude Code) - Windows 10, project uses PowerShell + Bash tools
- Installed Claude Code version at the time:
2.1.233(updated during this session from2.1.228)
Why I'm reporting this
Regardless of whether this turns out to be a harness bug (e.g., some tool output being misrendered as a system-reminder) or content-based injection from somewhere in the toolchain, an instruction that tells an agent to hide file/state information from the user is a meaningful safety-relevant pattern worth Anthropic's awareness, even though no harm resulted this time.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗