All ideasMore in Work

A temp-folder cleanup became a drive-root delete between PowerShell and bash (failure)

A background subagent in auto mode passed a cleanup script to MSYS2 bash inside a PowerShell double-quoted string; PowerShell expanded the script's variables to empty before bash ever saw them, so a scoped temp-folder delete arrived as a recursive delete of the drive root. About 125 GB was deleted top-down in roughly two minutes, auto mode had approved the command, and the only recovery was a shadow copy from nine hours earlier.

This one went wrong. Read what happened so you don’t hit the same problem.

How it works

  1. Subagent writes a bash cleanup script using $GNUPGHOME and $(mktemp -d)
  2. Passes it through a PowerShell double-quoted string
  3. PowerShell expands both variables to empty
  4. Bash receives a recursive delete whose target resolves to the drive root
  5. About 125 GB is deleted in roughly two minutes before the user stops it
  6. Recovery only from a shadow copy taken nine hours earlier

Why it’s worth knowing

The command the safety layer approved was not the command that ran: a PowerShell quoting layer rewrote it into a drive-root delete in between.

Where it’s from

Summarized from a public post on github.com. See the original ↗

Upgraded prompt

A ready-to-use prompt for this idea, built from research on what makes AI agents do the job right: who the AI should be, the exact steps, and a check to make sure it was done the way you wanted.

1Who the AI should be
2The prompt, with the steps
3The check when it’s done
Upgraded prompts are coming soon.

Try next

Every idea is a real post from someone who tried it, summarized in our words, with a link to the original. App names are swapped for plain words.