Gemini CLI
Gemini CLI connector wires eleven settings.json lifecycle hooks; five are block-capable, and the native logs/metrics/traces exporter points at the gateway.
The Gemini CLI connector wires DefenseClaw into Google's Gemini CLI hooks and points the agent's native OTLP exporter at the gateway so traces, metrics, and logs land in one place.
Setup
defenseclaw setup geminicliGemini CLI setup is supported on macOS and Linux. The DefenseClaw connector is not certified on native Windows x64, so setup rejects it there.
setup geminicli is the dedicated Gemini CLI alias. It uses the shared
guardrail setup backend, wires hooks against ~/.gemini/settings.json, and
points Gemini's native OTLP exporter at the gateway. There is no
proxy-enforcement path — blocking happens hook-side via BeforeAgent,
BeforeModel, BeforeTool, AfterTool, and AfterAgent. Gemini CLI has no
native ask surface, so confirm verdicts use an immediate alert/context
fallback with raw_action preserved for audit.
What setup geminicli actually does
The table highlights convenience options rather than the complete alias
surface. The alias also accepts --mode, --rule-pack, --fail-mode,
approval, block-message, add/replace, workspace, and rule-pack-directory
options. See the quick-alias reference; use
full guardrail setup for scanner, detection-strategy,
and judge-provider configuration.
| Flag | Default | What it does |
|---|---|---|
--yes / -y | off | Skip the confirmation prompt. |
--restart / --no-restart | --restart | Bounce defenseclaw-gateway after applying changes so the new hooks + OTLP env vars wire in. |
--with-local-stack / --no-local-stack | --no-local-stack | Also run setup local-observability up; follow the command's printed gateway-restart step after it writes the export destination. |
Redaction remains a v8 bucket/profile policy (none for fresh v8). Edit observability.destinations[].routes[].selector.buckets and observability.redaction_profiles; then follow Redaction → Verify policy.
The alias defaults Gemini CLI to observe mode and can join an existing hook-connector roster when you choose Add. To tune Gemini CLI after install, keep using defenseclaw setup guardrail --connector geminicli — see the variations below.
Common variations — pick the recipe that fits your phase
defenseclaw setup geminicliConfirms once, wires the hooks against ~/.gemini/settings.json, points OTLP at the gateway, and restarts the gateway. Findings flow to mandatory SQLite event history and the TUI; configured v8 destinations receive only the buckets/signals their routes select. No traffic is intercepted and no requests are blocked. Pass --yes to skip the confirmation in CI.
defenseclaw setup geminicli --yes --with-local-stackSame as standard but also runs setup local-observability up so Prom/Loki/Tempo/Grafana come up locally — particularly useful for Gemini since native OTLP feeds traces and metrics directly into Tempo and Prometheus. That command writes the export destination after the alias has already restarted the gateway, so run its printed defenseclaw-gateway restart step before expecting exports. See Local observability.
export DEFENSECLAW_LLM_KEY='replace-with-your-key'
defenseclaw setup geminicli # base alias first
defenseclaw setup guardrail \
--connector geminicli \
--rule-pack strict \
--scanner-mode local \
--detection-strategy regex_judge \
--judge-model anthropic/claude-sonnet-4-20250514 \
--judge-api-key-env DEFENSECLAW_LLM_KEY \
--judge-hook-connectors geminicli \
--restartThe alias selects Gemini CLI; the follow-up setup guardrail --connector geminicli swaps in the strict rule pack, keeps scanning local, and turns the LLM judge on as a second-pass adjudicator on regex-flagged events. Configure the remote scanner separately through full guardrail setup, which validates its endpoint and API-key environment variable.
Gemini CLI has no proxy enforcement, but its hooks can enforce directly:
defenseclaw setup geminicli --mode action --fail-mode closedWith mode=action, the declared blocking hooks stop policy-denied work.
Because Gemini CLI has no native ask surface, confirm uses an alert/context
fallback; operators can review the event in audit or the TUI, but cannot
resume it there.
Decision aids — should I turn this on?
Human-in-the-loop (HITL)
Per-connector ask matrix. Gemini CLI has no native ask; confirm uses an alert/context fallback preserved in audit.
Full setup guardrail flag reference
The complete flag surface for `setup guardrail --connector geminicli`.
Defaults & rule packs
What permissive / default / strict actually ship, and which one matches your risk tolerance.
Interactive wizard
Animated terminal demo of the prompt-by-prompt setup flow — the safest path the first time.
Not sure what to pick? Run defenseclaw setup guardrail (no flags) — the interactive wizard walks you through every choice with safe defaults pre-selected and inline help. The Prompt → flag mapping table gives you the CI-shaped command for the same configuration.
Files DefenseClaw will modify
Hook capabilities
Block events
- BeforeAgent
- BeforeModel
- BeforeTool
- AfterTool
- AfterAgent
Native ask events
None — confirm verdicts are downgraded with the raw action preserved.
Gemini CLI has no native human-approval surface. Confirm verdicts fall back to an alert/context response with raw_action preserved in the audit log; the TUI is review-only.
Telemetry channels
Disable
defenseclaw guardrail disable --connector geminicli --yesOmniGent
The OmniGent connector installs a custom Python policy that maps six policy phases to DefenseClaw ALLOW, ASK, and DENY decisions, with optional native OTLP telemetry.
GitHub Copilot CLI
Copilot CLI connector wires global ~/.copilot/hooks by default, with optional workspace .github/hooks. preToolUse supports native ask and blocking; four additional events can block.