This hook fires on the PreToolUse event, before an Edit or MultiEdit change. It checks whether the target file already exists.
When it does, it copies the file into a .backups folder with a timestamp in the name. That way you always keep the version prior to the agent’s change.
When to use
- When you want to be able to revert edits easily.
- When you touch sensitive files and prefer a local safety net.
How to use
After installing, it creates the backup automatically before each edit. Look for the copies in the .backups folder when you need to restore.