Configure policy, gate, and approval settings for AI-generated code control.
Guardian configuration is focused on one goal: control AI-generated code before it ships. This guide covers policy, gate, and runtime settings.
Guardian uses a version-controlled policy file in your repository root:
guardian.policy.yaml
Minimum gate fields:
schema_versionpacks[]gate.pass_max_warningsgate.block_on_criticalgate.require_human_approval_on_ai_heavygate.require_override_reasonUse this file as the single source of truth for desktop, CLI, and CI release decisions.
Click the gear icon (⚙️) in the header to open the Settings modal.
Choose your AI provider from the dropdown:
| Provider | API Key Required | Local Option |
|---|---|---|
| Ollama | No (Local) / Yes (Cloud) | Yes (http://localhost:11434) |
| OpenAI | Yes | No |
| Anthropic (Claude) | Yes | No |
| Google Gemini | Yes | No |
| GitHub Models | Yes | No |
After selecting a provider, choose a model. Available models are fetched automatically from the provider.
Choosing a model:
ollama pull <model>).For providers requiring API keys:
Security: API keys are stored in platform-native secure storage (Keychain, Credential Manager, or Secret Service).
Toggle between Light and Dark themes:
Scan Scope controls which files Guardian includes during monitoring (cost vs coverage).
Open Settings > General > Scan Scope and choose:
| Profile | What you get |
|---|---|
| Source (default) | Code-focused monitoring. Skips docs/tests/scripts/lockfiles by default. |
| Extended | Adds infra and security surfaces (Docker/CI/workflows/config/shell/locks). Still skips docs/tests by default. |
| Full | Most text files (including docs/tests/scripts/workflows). Highest coverage and highest cost. |
Changes apply the next time monitoring starts (restart monitoring to apply).
Enable AI-powered web search for Guru:
In Settings > Web Search, you can control how deep the search should go:
If your question includes a URL, Guru will prefer URL extraction to pull the most relevant chunks from that page (instead of doing a broad search first).
You can force web search for a single question by adding:
/web prefix (for example: /web explain the latest Node.js LTS changes)@web tag anywhere in the questionThis works even if Web Search is off, but it still requires a Tavily key.
site:example.com when you already know the best source domain.Guardian checks for updates automatically. You can also:
Advanced users can configure a custom update feed URL for self-hosted update servers via the GUARDIAN_UPDATE_FEED_URL environment variable.
Guardian stores configuration in platform-specific locations:
| Platform | Location |
|---|---|
| macOS | ~/Library/Application Support/Guardian/ |
The guardian.lock file ensures reproducible scans across different machines and time periods.
your-project/
├── guardian.lock # Auto-generated
├── .guardian/
│ ├── AGENT_INSTRUCTIONS.md
│ ├── baseline.json
│ ├── critiques.json
│ ├── critiques.md
│ ├── history.jsonl
│ ├── agent_queue.jsonl
│ ├── chat.md
│ ├── chat_queue.md
│ ├── STALL # Only while stalled
│ └── undo/ # Only after applying a fix
└── .agent/rules/
{
"schema_version": 1,
"created_at": "2026-02-10T12:00:00Z",
"updated_at": "2026-02-10T12:00:00Z",
"guardian_version": "1.2.3",
"workspace_id": "sha256-hash",
"rules_hash": "abc123...",
"rules_source": ".agent/rules"
}
When using guardian-cli, you can enforce lock compliance:
# Warn mode (default): Warn on mismatch but continue
guardian-cli scan --root . --lock-mode warn
# Strict mode: Fail scan on any mismatch
guardian-cli scan --root . --lock-mode strict
# Off mode: Ignore lock file
guardian-cli scan --root . --lock-mode off
If upgrading from older releases (before guardian.lock existed):
Configure semantic search behavior:
Choose how code embeddings are generated:
# Environment Variables
GUARDIAN_EMBED_MODE=auto # "auto", "openai", "ollama", "local"
GUARDIAN_EMBED_MODEL=text-embedding-3-small
GUARDIAN_EMBED_MODEL_OLLAMA=nomic-embed-text
GUARDIAN_OFFLINE=1 # Forces local hash mode
Auto mode behavior
| Mode | Quality | Latency | Offline |
|---|---|---|---|
| OpenAI | ⭐⭐⭐ | ~500ms | ❌ |
| Ollama | ⭐⭐ | ~200ms | ✅ |
| Local Hash | ⭐ | ~10ms | ✅ |
Guardian filters semantic matches at a minimum similarity score of 0.72.