Troubleshooting
Agent Deleted Files by Mistake?
A fast containment + recovery workflow for accidental deletes, with safer defaults to prevent it happening again.
If an agent ran a delete command you didn’t expect, move fast but stay calm. Most damage gets worse from panic retries. This guide gives you a deterministic recovery sequence.
First rule: stop issuing new write/delete commands until you verify what changed. Extra commands can overwrite recovery evidence.
1) Contain immediately (60 seconds)
- Pause the workflow and stop retries.
- Ask the agent for the exact command it executed.
- Capture path(s), timestamp, and whether it used
trash or permanent delete.
2) Ask for proof of what changed
Before doing anything else, return:
1) exact delete command executed
2) absolute path(s) affected
3) whether files were moved to Trash or permanently removed
4) current directory listing for parent folder
5) git status --short output (if repo)
Do not run more write/delete commands.
3) Recover based on delete type
- If moved to Trash: restore from Trash first (fastest and safest).
- If git-tracked file: recover from git history/checkout.
- If untracked + permanent delete: stop writes and escalate quickly with evidence packet.
Do not run cleanup commands (like broad resets or cache cleaners) before you verify recoverability. They can make recovery harder.
4) Known-good recovery prompt
Recovery mode ON.
Goal: Restore accidentally deleted files safely.
Rules:
- No new delete commands.
- No broad cleanup/reset.
- Show command + path proof before each recovery step.
Steps:
1) Identify deleted file list with absolute paths.
2) Attempt Trash restore where possible.
3) If git-tracked, restore from git and show diff/status.
4) After each restore, verify file exists and show first 3 lines.
5) Stop and summarize what was restored vs still missing.
5) Prevent repeat incidents
- Use explicit guardrails: "Never use rm for routine cleanup; use trash."
- Require dry-run plans before destructive actions.
- Require path confirmation for every delete target.
- For multi-step refactors, require a backup/snapshot before cleanup.
Copy/paste prevention block
Destructive Action Safety Policy
- Never run rm -rf or permanent delete without explicit approval.
- Prefer recoverable delete (trash) for normal cleanup.
- Before any delete: show absolute path(s) + why each file is safe to remove.
- If uncertain, stop and ask.
- After delete: return proof list of removed files and current folder state.
Bottom line: contain first, recover with proof, then add guardrails so delete mistakes become rare and recoverable.