Overview
Policies are codified rules that govern agent behavior. Define them in your squad’sSQUAD.md file, and critic agents automatically enforce them on PRs, issues, and agent actions.
Why policies matter:
- Prevent mistakes before they reach production
- Maintain consistency across agents
- Build trust through predictable behavior
- Enable compliance and auditability
How Policies Work
Defining Policies
Add apolicies: section to your squad’s SQUAD.md:
Policy Fields
| Field | Required | Description |
|---|---|---|
id | Yes | Unique identifier (e.g., SEC-001, MY-001) |
name | Yes | Human-readable title |
description | Yes | What the rule enforces |
severity | Yes | blocker or warning |
exceptions | No | Paths or patterns that bypass this rule |
Severity Levels
| Level | Meaning | PR Action |
|---|---|---|
blocker | Must fix before merge | Request Changes |
warning | Should fix, can proceed | Comment only |
Creating Critic Agents
Critic agents review work against your policies. Create one in your squad:Process
- Fetch PR: gh pr view —json files,body,title
- Check each policy in your policy_file
- Output review:
Policy Review: ❌ Changes Requested
| Policy | Violation |
|---|---|
| PREFIX-XXX | Description |
Policy Review: ✅ Approved
No policy violations found. “Common Policy Categories
Organize policies by domain. Use consistent prefixes:| Prefix | Category | Example Rules |
|---|---|---|
SEC-* | Security | No hardcoded secrets, input validation |
CODE-* | Code Quality | No any types, error handling required |
API-* | API Standards | Versioning, deprecation notices |
DOC-* | Documentation | README required, help text |
OPS-* | Operations | Health checks, logging |
ORG-* | Governance | PR requirements, review rules |
Example: Security Policies
Example: Code Quality Policies
Example: Governance Policies
Triggering Policy Reviews
Automatic (Recommended)
Set up a smart trigger to run critics on PR events:Manual
Handling Violations
Blocker Violations
PR cannot merge until fixed:Warning Violations
PR can merge, but should address:Exceptions
Some files or patterns can bypass specific policies:Multiple Critics
For comprehensive coverage, use multiple specialized critics:Best Practices
1. Start Small
Begin with 5-10 critical policies. Add more as needed.2. Use Blockers Sparingly
Onlyblocker for things that absolutely cannot ship. Most rules should be warning.