.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.
Why Use Project Policies
- Team consistency — everyone gets the same rules without per-developer config
- Context-aware security — stricter rules for production repos, relaxed rules for experiments
- Version controlled — policy changes go through code review like everything else
- Zero friction — commit the file, push, done
Quick Start
.rampart/policy.yaml with a starter template:
How It Works
When Rampart evaluates a tool call:- Global policy (
~/.rampart/policies/*.yaml) is loaded first - Project policy (
.rampart/policy.yamlin cwd or parent) is merged on top - Both are evaluated; deny always wins
The [Project Policy] Prefix
When a project policy blocks a command, the deny message includes a prefix so you know the rule came from the repo:
Example: Staging-First Workflow
Example: Database Safety
Example: Secrets in This Repo
Example: No Production Migrations
Disabling Project Policies
In some cases you may want to skip project policy loading:- Security testing — verify global policy catches things without project overrides
- Untrusted repos — cloning a repo shouldn’t change your security posture
- Debugging — isolate whether an issue is global vs project policy
Policy Precedence
When both global and project policies have rules that match:- Deny always wins — if any rule denies, the action is denied
- Lower priority number = evaluated first — use
priority: 0to ensure your rule is checked early - Project rules can’t weaken global rules — they can only add restrictions or allow things the global policy doesn’t cover
Discovering Active Policies
Best Practices
- Keep project policies focused — don’t duplicate global rules
- Document why — use the
descriptionfield liberally - Test before committing —
rampart policy lint .rampart/policy.yaml - Review policy PRs carefully — they affect everyone on the team
- Use deny for hard requirements — never allow production DB drops
- Use ask for context-dependent operations — deployments may be safe sometimes
Session-Aware Rules
Project policies can usesession_matches to apply rules based on the current branch:
reponame/branch (e.g., myapp/main). Override with RAMPART_SESSION=my-label.
Combining with Global Profiles
Project policies merge with your global profile:ci profile in CI/CD:
See Also
- Writing Policies — Full YAML schema reference
- Profiles — Built-in policy presets
- Testing Policies — Validate with
rampart testandrampart bench