Agent tool: parallel agents with destructive operations cause data loss — needs sequencing guardrails

Resolved 💬 3 comments Opened Apr 12, 2026 by bitzmk Closed Apr 16, 2026

Bug / Feature Request

What happened:
User asked to transfer files from directory A to directory B, then clean up directory A. Two agents were spawned in parallel — one to transfer, one to clean up. The cleanup agent finished first and deleted the source files before the transfer agent could copy them. Result: 22 files (~7,400 lines of research content representing hours of user work and token spend) permanently lost. No git repo, no trash, no backup. Unrecoverable.

Root cause:
The Agent tool allows spawning parallel agents with no dependency awareness. When Agent A (transfer) and Agent B (cleanup/delete) operate on the same source files, there is no mechanism to enforce ordering. The model should have sequenced them, but the tool doesn't warn or prevent this pattern.

What should happen:

  1. When multiple agents are spawned in the same message and one performs destructive operations (rm, delete, move) on paths that another agent reads from, the system should warn the model or enforce sequential execution.
  2. At minimum: the Agent tool documentation/system prompt should explicitly call out that destructive operations must never run in parallel with read operations on the same paths.
  3. Ideally: a dependency parameter (e.g., depends_on: [agent_id]) so agents can be sequenced when needed while still allowing true parallelism for independent work.

User impact:
Permanent data loss. Hours of paid research work destroyed. Trust broken. The user's own instructions said "launch multiple agents" — they trusted the system to handle parallelism safely. The model should have known better than to parallelize transfer + delete on the same files, but there are no guardrails when it doesn't.

Environment: Claude Code on Windows 11, Claude Opus 4.6, Agent tool with general-purpose subagent_type.

Reproduction: Spawn two parallel agents where Agent A reads files from path X and Agent B deletes files from path X. Race condition is near-guaranteed.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗