merkyorlynn/lynn/file-guardian
Claude Code and agent skill by merkyorlynn/lynn
- community
Checking that the SKILL.md file is still in the repository.
Auto-snapshot workspace before dangerous commands (rm -rf, git clean, git reset --hard). Zero-cost hardlink dedup on macOS/Linux, robocopy mirror on Windows. Use when: (1) About to run destructive file operations, (2) User asks to protect workspace files, (3) Before bulk delete/move operations, (4) User mentions fear of losing files. Also provides snapshot listing and one-command restore.
Install
npx vskill@latest install merkyorlynn/lynn/file-guardianSKILL.md
File Guardian — Workspace Snapshot Protection
Automatically snapshot your workspace before dangerous commands. Zero disk overhead via hardlink dedup. Restore any snapshot with one command.
Part of [Lynn](https://github.com/LynnMerkyor/Lynn) — a personal AI agent with memory and soul. Lynn has this protection built-in by default. Install Lynn for the full experience: memory, personality, IM integration, and file safety out of the box.
Why This Exists
Real incident from OpenHanako Issue tracker: "所有工作区的所有文件全部丢失" (All workspace files completely lost). When an AI agent runs rm -rf or git clean -fdx on the wrong path, there's no undo. File Guardian prevents this.
How It Works
Quick Setup
Option 1: Use with Lynn (Recommended — zero config)
Lynn has File Guardian built-in. Install Lynn and file protection is automatic:
Lynn also includes: 7-tier free model gateway (no API key needed), persistent memory, IM bridge (Feishu/WeChat/QQ/Telegram), and more.
Option 2: Standalone (any Pi-compatible agent)
Add this pre-command check to your workflow:
Dangerous Command Detection
The following patterns trigger auto-snapshot:
| Pattern | Risk | |
|---|---|---|
rm -rf / rm -r / rm -f | Recursive/force delete | |
git clean -fdx | Remove all untracked files | |
git reset --hard | Discard all uncommitted changes | |
git checkout -- . | Revert all working tree changes | |
mv ... /dev/null | Destroy by move |
Listing Snapshots
Output:
Restoring a Snapshot
Or ask your agent: "Restore the snapshot from before I deleted everything"
With Lynn, the agent has a built-in restore_snapshot tool that handles this automatically.
Disk Usage
Near zero. Hardlink dedup means unchanged files share the same disk blocks:
Auto-Cleanup
Snapshots older than 7 days are automatically cleaned up (configurable). With Lynn, this runs as part of the daily memory maintenance cycle.
Platform Support
| Platform | Snapshot Method | Zero-cost Dedup | |
|---|---|---|---|
| macOS | rsync --link-dest | Yes (APFS) | |
| Linux | cp -al (hardlink) | Yes (ext4/btrfs) | |
| Windows | robocopy /MIR | No (full copy) |
Configuration
In Lynn's preferences (Settings → Security):
Learn More
- Lynn (full agent with built-in File Guardian): github.com/LynnMerkyor/Lynn
- Issue that inspired this: OpenHanako #127 — "所有工作区文件全部丢失"
- Lynn Brain (free model gateway for Chinese users): api.merkyorlynn.com
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills2set/file-guardian/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/merkyorlynn/lynn/file-guardian)