The AI overwrote my file
If you are searching for this right now, it has probably already happened. Rescue first, explanation second — and at the end, the one setting that prevents it next time.
Last verified:
1. Disconnect the AI. Close the assistant or switch the connection off. Do not ask the AI to fix it — the second attempt often does more damage than the first.
2. Stop working. Save nothing, copy nothing, install nothing. For deleted files the rule is simple: every further write to the same disk lowers the chance of getting them back.
3. Go looking for older copies — the four places are below.
Where older copies might be
- The recycle bin or trash. Obvious, but many tools do delete to it rather than permanently. Look before you despair.
- Cloud storage version history. If the file lives in OneDrive, Dropbox or Google Drive, those services keep version histories and some of them can roll an entire folder back to an earlier point in time. For overwrites this is by far the most promising route.
- Previous Versions, or Time Machine. On Windows: right-click the file or folder, Properties, Previous Versions tab. This requires File History or system protection to have been enabled beforehand. On macOS, the equivalent is Time Machine.
- The application itself. Office suites, editors and IDEs keep their own recovery or local history features. For source code, check version control too — uncommitted states sometimes still sit in the editor's local history.
If none of that works and the files really matter: shut the machine down and have the disk looked at by someone who does data recovery. Carrying on working is the most expensive decision available at this point.
Why it happens
Nearly every incident of this kind shares one root cause: the AI had access it was never scoped for. Not malice, not even a particularly exotic bug — just a boundary nobody had drawn.
Two well-documented cases from July 2025 show the pattern. A Replit AI agent deleted a production database during an explicitly ordered code freeze. And Google's Gemini CLI deleted a user's project files on Windows after misreading a failed directory-creation command; the move operations that followed overwrote nearly everything.
There is also a quirk in the standard tooling. The description of the write tool in the official MCP filesystem server reads, verbatim: “Create new file or overwrite existing (exercise caution with this).” The caution is explicitly delegated to the human. And because that same server keeps no activity log, there is no list afterwards of what actually happened.
What prevents it next time
The usual reaction after an incident like this is to cut the AI off entirely. That works — and costs you the entire benefit. The better answer is to grade access rather than switch it on and off.
| Situation | The level that fits in Kobel |
|---|---|
| The AI should be allowed to work in this folder | Teal: writes allowed, but a backup is taken before every change |
| The AI should analyse but not touch | Orange: read the original, write results only to copies |
| Look-ups only | Yellow: read only |
| Accounting, contracts, private matters | Red: blocked, invisible to the AI |
| A scratch folder | Green: full access, because nothing here can be lost |
Teal is the level that catches exactly this case: the AI may work, but every change is backed up first. A bad edit stops being an incident and becomes an undo.
Kobel undoes nothing that happened before it was installed, and it does not replace a backup. It also does not stop an AI from doing something foolish within its rights — it makes “within its rights” mean something specific, and it leaves a way back. You should still have a regular backup.
And the question of which files were affected
The assistant's chat history shows what the AI said it was doing. That is not the same as what happened. Kobel therefore keeps its own activity log: every action with a timestamp, permission level and status — read, change, delete, copy, move, rename. The AI cannot write to it, and it exports as CSV or JSON. After an incident, that is the difference between “something happened” and a list.
Kobel's five permission levels
Every folder, app and account carries exactly one of these five levels. You set it by dragging a folder in and picking a colour — no configuration file.
- GreenRead and write. The AI may open files and save changes directly.
- TealWrite with an automatic backup. A copy is made before every change, so a bad edit can always be undone.
- OrangeRead the original, write only to copies. The AI can work with the data but cannot alter the source file.
- YellowRead only. Look, don't touch.
- RedBlocked. The resource is invisible to the AI.
Keep reading
Sources
So there is no second time
Install Kobel, drag the affected folders in, teal for working folders, red for anything private. Two minutes. Free tier, no account needed.
Download KobelSee the featuresFrequently asked questions
Can I recover a file an AI overwrote?
Often yes, but not through the AI. The three most promising routes: the version history of your cloud storage if the file lives in OneDrive, Dropbox or Google Drive; the Previous Versions tab in the file's properties dialog on Windows, or Time Machine on macOS; and the recovery feature of the application that created the file. The important part is to stop working first — every further write to the same disk lowers your chances.
What should I do first?
Disconnect the AI before anything else. While the connection is live, another attempt by the AI to fix the problem can make it worse. Then stop working, do not save anything, and only then start looking for older copies.
Why does this happen at all?
Almost always for the same reason: the AI had access it was never scoped for. Two well-documented cases from July 2025 show the pattern — a Replit agent deleted a production database during an explicit code freeze, and Google's Gemini CLI deleted a user's project files on Windows after misreading a failed command. In both cases access was the precondition, not intent.
How do I prevent it next time?
By grading access instead of switching it on or off. In Kobel every folder carries one of five levels. For folders the AI should work in, teal is the right choice: a backup copy is made automatically before every change, so a bad edit can be undone. For folders that should only be read there is yellow, and for anything the AI should not see at all, red.
How do I know which files were affected?
Without a log, you cannot know for sure — and that is the second half of the problem. The assistant's chat history shows what the AI said it was doing, which is not necessarily what happened. The official MCP filesystem server writes no activity log. Kobel keeps one with timestamp, action and permission level, exportable as CSV or JSON, and the AI cannot alter it.
Doesn't a normal backup solve this?
It helps, and you should have one regardless. The difference is timing: a nightly backup may cost you a working day, a copy taken immediately before the change costs you nothing. Both together is the right answer.