How to Give an AI Agent File Access Without Losing Files
Agents are useful because they can act. That's also the risk. Here's what to do if something went wrong, and how to set up access so it's less likely.
Quick Answer
- ✓If files just vanished, stop the agent first. Then check the Trash, version control and backups. Avoid writing to that disk until you know what you need to recover.
- ✓Limit access at the source: run agents in a project folder, keep backups out of reach, use version control, and don't give them production credentials.
- ✓Shell access is the real risk. File tools with limits only protect work routed through them. An agent with a terminal can do anything your account can.
What goes wrong when an agent has file access
Public reports have described agents deleting project folders, wiping home directories and removing production data. Details vary and many are user reports, but the pattern is consistent. The agent ran a command with more reach than the person expected, such as a recursive delete or a cleanup in the wrong folder, usually while permission prompts were being approved quickly or skipped.
Files removed with a shell command usually bypass the Trash. If that happened, check for backups or snapshots first: Time Machine, File History, cloud sync history, or Git. Then stop writing to the disk, since new data can overwrite recoverable files, and consider recovery software on a copy of the drive. Treat any tool promising guaranteed recovery with caution.
A safety checklist before you start
These steps work with any agent and don't require FileHop.
Keep backups out of reach
A backup the agent can delete isn't a backup. Use an offline drive or a versioned service with history the agent has no credentials for.
Use version control
Commit before you start. Git makes changes reviewable and most mistakes reversible, though untracked files aren't protected.
Scope the working folder
Start the agent in one project folder, and use its permission settings to require approval for destructive commands. Consider a container or separate user for riskier work.
Withhold production credentials
Keep real database and cloud keys out of the project. If a key isn't available, no prompt can misuse it.
Don't run agents with permissions bypassed on a folder you can't afford to lose.
Where FileHop fits, and where it doesn't
FileHop gives agents scoped file tools over MCP. That helps, within limits.
What it adds
Access is off by default. Agents reach only folders you share, and .ssh, .aws and Keychains are always denied. Moves and copies pick unique names, renames refuse a taken name, and deleting sends files to the OS Trash.
What it can't stop
FileHop's limits apply only to its own tools. An agent that can also run shell commands can still do anything your account can. Pair FileHop with the checklist above, not instead of it.
What you can see afterwards
Every call is logged, including refused ones, with Stop and Undo on each row. The log is tamper-evident, which makes changes detectable but doesn't prevent them.
Scoped tools vs raw shell
Why routing file work through scoped tools reduces risk.
| What matters | Raw shell | FileHop |
|---|---|---|
| Reach | Everything your account can touch | Only folders you share |
| Delete | Often permanent | Moved to Trash |
| Name collisions | Can overwrite | Unique names, no overwrite |
| Record of actions | Scrollback at best | Activity log with Undo |
Frequently Asked Questions
An AI agent deleted my files. What should I do first?
Stop the agent, check the Trash, then check Git, backups and sync history. Avoid writing to the disk until you've decided on recovery.
Can I undo Claude Code or Cursor changes?
Their own checkpoint or undo features may help, but they don't cover every shell command. Git is the most dependable safety net.
Are files deleted by an agent in the Trash?
Usually not, if a shell command such as rm deleted them. Agents using FileHop's tools send files to the OS Trash.
Is it safe to skip permission prompts?
Only inside a disposable environment. Skipping prompts on your main account means a mistake runs with your full access.
Does FileHop make agents completely safe?
No. It narrows what its own tools can do. It can't restrict an agent's shell access.
Do my files stay on my computer?
FileHop processes files locally, but a cloud agent's provider receives whatever the agent reads. Share folders accordingly.
Which agents does this apply to?
All of them. The checklist applies to Claude Code, Codex, Cursor, Gemini CLI and any other agent with file access.
How do I limit an agent to one folder?
Use your agent's permission settings or a container. With FileHop's tools, only folders you share are reachable.
Give your agent safer file tools
Off by default, limited to the folders you share, and logged with Undo.
Download FileHop Free