Drop a .rampart/policy.yaml file in any git repository to add project-specific rules. These rules load automatically on top of your global policy when you work in that directory.
# In your repo root
rampart init --project
This creates .rampart/policy.yaml with a starter template:
version: "1"
policies:
- name: project-example
match:
tool: ["exec"]
rules:
- action: deny
when:
command_matches:
- "*--env=production*"
message: "Production operations require human review"
Commit it:
git add .rampart/policy.yaml
git commit -m "Add Rampart project policy"
When Rampart evaluates a tool call:
~/.rampart/policies/*.yaml) is loaded first.rampart/policy.yaml in cwd or parent) is merged on topThe project policy adds rules — it cannot remove or override global denies. This ensures your global security baseline is never weakened by a malicious or misconfigured project policy.
[Project Policy] PrefixWhen a project policy blocks a command, the deny message includes a prefix so you know the rule came from the repo:
[Project Policy] Production migrations blocked — use staging first
This distinguishes project-level rules from global Rampart rules:
Destructive command blocked # ← global policy
[Project Policy] No direct DB access # ← project policy
# .rampart/policy.yaml
version: "1"
policies:
- name: staging-first
description: "Require staging deployment before production"
match:
tool: ["exec"]
rules:
- action: deny
when:
command_matches:
- "*kubectl apply*production*"
- "*terraform apply*prod*"
- "*deploy*--env=prod*"
message: "Deploy to staging first, then get approval for production"
# .rampart/policy.yaml
version: "1"
policies:
- name: protect-prod-db
match:
tool: ["exec"]
rules:
- action: deny
when:
command_matches:
- "*psql*prod*DROP*"
- "*mysql*production*DELETE*"
- "*mongosh*prod*db.*.remove*"
message: "Direct production database modifications are not allowed"
- action: ask
when:
command_matches:
- "*psql*prod*"
- "*mysql*production*"
message: "Production database access — proceed?"
# .rampart/policy.yaml
version: "1"
policies:
- name: protect-project-secrets
match:
tool: ["read"]
rules:
- action: deny
when:
path_matches:
- "**/.keys/**"
- "**/secrets/**"
- "**/config/credentials.*"
message: "This project's secrets directory is protected"
In some cases you may want to skip project policy loading:
# Disable for a single command
RAMPART_NO_PROJECT_POLICY=1 rampart wrap -- my-agent
# Or in CI where you want only the global CI policy
export RAMPART_NO_PROJECT_POLICY=1
Use cases:
When both global and project policies have rules that match:
priority: 0 to ensure your rule is checked early# This project policy allows something, but if the global policy denies it,
# the deny wins:
policies:
- name: try-to-allow-rm
rules:
- action: allow
when:
command_matches: ["rm -rf /"] # ← still denied by global policy
# See if a project policy is active
rampart doctor
# Output includes:
# ✓ Project policy: .rampart/policy.yaml (3 rules)
# Test a command against all active policies
rampart test "kubectl apply -f prod.yaml"
description field liberallyrampart policy check .rampart/policy.yaml