Guard
A CLI tool that lets developers lock file permissions to prevent AI coding agents from modifying files without explicit permission.
At a Glance
Pricing
Fully free and open source under Creative Commons Attribution-NonCommercial-ShareAlike 4.0.
Engagement
Available On
Alternatives
Developer
Listed Mar 2026
About Guard
Guard is a command-line tool designed for developers who use AI coding agents and need to prevent unintended file modifications. It works by toggling Unix file permissions, ownership, and immutable flags to protect files from being changed by AI tools like Claude, Cursor, or GitHub Copilot. Guard stores original permission states in a .guardfile and can restore them on demand, giving developers precise control over which files an AI can touch.
- Individual file protection — Run
guard add file <path>andguard enable file <path>to lock a specific file against AI modifications. - Collection management — Group related files into named collections and toggle protection for the entire set with a single command.
- Interactive TUI mode — Launch
guard -ito open a terminal UI with a file tree, fuzzy search, and keyboard shortcuts for the fastest possible workflow. - Fuzzy search — Press
/in interactive mode to instantly filter the file tree and find files to guard or unguard. - Permission state memory — Guard records each file's original
owner,group, andrwxpermissions in.guardfileand restores them exactly when protection is disabled. - Immutable flag support — Sets the immutable flag so even the file owner cannot change permissions without
sudo, ensuring AI agents cannot silently bypass protection. - Safe cleanup utilities — Use
guard cleanupto remove stale registry entries andguard resetto disable all active protections while preserving registrations. - Unix-only design — Supports Linux, macOS, and BSD variants; Windows users are directed to WSL, Docker, or a Linux VM.
- Cobra-based CLI — Built with Go and the Cobra framework; install via
git clone,just build, andjust installinto$GOPATH/bin. - Comprehensive test suite — Includes unit tests, property-based tests (gopter), and integration tests covering real filesystem operations.
Community Discussions
Be the first to start a conversation about Guard
Share your experience with Guard, ask questions, or help others learn from your insights.
Pricing
Open Source
Fully free and open source under Creative Commons Attribution-NonCommercial-ShareAlike 4.0.
- Protect individual files
- Named file collections
- Interactive TUI mode with fuzzy search
- Immutable flag support
- Permission state memory via .guardfile
Capabilities
Key Features
- Protect individual files by toggling Unix permissions and ownership
- Named file collections for bulk protection toggling
- Interactive TUI mode with fuzzy search
- Immutable flag support to block even owner-level changes
- Permission state stored and restored via .guardfile
- Guard reset and cleanup maintenance commands
- Cobra-based CLI with full command reference
- Works with AI agents: Claude, Cursor, GitHub Copilot, etc.
- Supports Linux, macOS, and BSD variants
