# Guard > A CLI tool that lets developers lock file permissions to prevent AI coding agents from modifying files without explicit permission. 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 ` and `guard enable file ` 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 -i` to 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`, and `rwx` permissions in `.guardfile` and 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 cleanup` to remove stale registry entries and `guard reset` to 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`, and `just install` into `$GOPATH/bin`.* - **Comprehensive test suite** — *Includes unit tests, property-based tests (gopter), and integration tests covering real filesystem operations.* ## 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 ## Integrations Claude, Cursor, GitHub Copilot ## Platforms WINDOWS, MACOS, LINUX, API, CLI ## Pricing Open Source ## Links - Website: https://github.com/florianbuetow/guard - Documentation: https://github.com/florianbuetow/guard - Repository: https://github.com/florianbuetow/guard - EveryDev.ai: https://www.everydev.ai/tools/guard-file-permissions