Quick Start
custom.yaml file is never overwritten by rampart upgrade — your rules persist across updates.
Policy Structure
Schema Reference
Top-Level Fields
Policy schema version. Always
"1".Fallback action when no rules match. Either
allow or deny.List of policy objects. Each policy contains match criteria and rules.
Policy Object
Policy identifier. Used in audit logs and deny messages.
Human-readable explanation of what this policy does.
Evaluation priority. Lower numbers are evaluated first. Default:
100.Scope this policy to specific tools or agents.Fields:
tool: Array of tool names (e.g.,["exec", "read"]). Use["*"]to match all tools.agent: Array of agent names (e.g.,["claude-code"]). Default:["*"].
List of rule objects. First matching rule wins.
Rule Object
What to do when this rule matches:
deny: Block the operationallow: Permit the operationwatch: Log but allow (alias:log)ask: Request human approval (alias:require_approval)
Conditions that must match for this rule to apply.
Message shown when this rule triggers.
Match Conditions
Thewhen block supports these matchers:
Command Matching (tool: exec)
Glob patterns. Matches full command string.Use
** to match paths with slashes (max 2 per pattern).Inverse of
command_matches. Rule only applies if command does NOT match.Substring matching (case-insensitive). Catches shell wrapper bypasses.This is more robust than
command_matches for detecting dangerous substrings in complex shell invocations.Path Matching (tool: read, write, edit)
Glob patterns for file paths.
Inverse of
path_matches. Excludes paths from a broader match.Domain Matching (tool: fetch)
Glob patterns for domains.
Session Matching
Apply rule only to specific sessions (auto-detected as Override with
repo/branch).RAMPART_SESSION=my-label.Inverse of
session_matches. Apply rule to all sessions except listed ones.Response Matching
Regex patterns to scan tool output. Used for credential leak detection.
Rate Limiting
Trigger rule after N calls in a time window.Available time units:
s, m, h.Action Types
deny
Block the operation immediately. Agent never sees it.allow
Permit the operation. Use in combination with adeny-by-default policy.
watch
Log the operation but allow it. Alias:log.
ask
Request human approval. How it works depends on the environment:- Claude Code: Native approval prompt in the UI
- MCP clients: Blocks until approved via API or dashboard
- OpenClaw: Chat message with inline approve/deny
- Webhooks: Signed URL sent to your notification endpoint
audit: true to log user decisions:
headless_only: true to block in CI/headless mode:
Common Patterns
Block Dangerous Commands
Protect Credentials
Require Approval for Privileged Operations
Rate Limit Fetch Calls
Testing Policies
Hot Reload
Policy files are watched for changes. Edit and save — no restart required.Evaluation Order
- Priority — policies are sorted by
priority(lower = first) - First match wins — within a policy, the first matching rule’s action is used
- Deny always wins — if any policy denies, the action is denied
allow-dev-files matches, if credential-protection denies, the action is denied.
See Also
- Profiles — Built-in policy presets
- Project Policies — Team-shared repo-specific rules
- Testing Policies — Validate policies with
rampart testandrampart bench