All ideasMore in Work

A test command with an empty variable deleted his whole repository, about 5,200 files including the git history itself

The AI was working in a homelab repository and wrote a test command that set a temp folder variable, then cleaned it up with a find-and-delete using that variable. An earlier step in the chain failed, so the variable was never set. Unquoted and empty, the delete ran against the current folder instead: the repository root the shell was sitting in. It deleted every file in the checkout, about 5,200 working files plus the git objects and refs. Only files the sandbox mounted read-only survived.

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

How it works

  1. Agent writes a test command using a temp folder variable
  2. An earlier link in the chain fails, leaving the variable unset
  3. The cleanup runs with the variable empty and unquoted
  4. The delete defaults to the current folder, the repo root
  5. About 5,200 files and the git objects and refs are deleted
  6. Only read-only mounted files survive

Why it’s worth knowing

The git history went too. The delete did not just remove his work; it removed the record that could have restored it.

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.