About this project
guard-and-guide is a CLI security tool that protects AI coding agents from executing dangerous operations. It works by registering as a pre-execution hook in Claude Code or Gemini CLI, intercepting tool calls before they run, and applying configurable rules defined in a TOML file.
When an agent attempts an operation matching a rule's regex pattern, the tool denies the request and outputs guidance explaining why and suggesting a safer alternative. This is more effective than simple denial because coding agents tend to persist through restrictions by trying absolute paths, alternative commands, or other workarounds.
Rules use canonical tool names (Bash, File, Read, Write, Edit) paired with regex patterns. The File alias covers Read, Write, and Edit operations. A typical rule might block `git push` or access to `.env` files, instructing the agent to ask the user instead.
Installation is available via Nix (`nix profile install github:kawarimidoll/guard-and-guide`) or Cargo (`cargo install --git https://github.com/kawarimidoll/guard-and-guide`). Setup requires creating `~/.config/guard-and-guide/rules.toml` and adding the hook configuration to either `~/.claude/settings.json` (PreToolUse) or `~/.gemini/settings.json` (BeforeTool). Copilot CLI support is planned.
The tool is written in Rust and licensed under MIT.
Comments
0 Rating appears after 10 ratings
Sign in to join the discussion.