Set a review policy
On this page
A review policy decides who must clear each pull request a builder opens: an AI reviewer, a planner, or a person. Set it once for the workspace, and override it for a project when that project needs something stricter.
You need: to be a workspace admin, and a token in $OPVS_PAT for the API calls.
How a pull request is classified
OPVS checks the changed paths (and, for migrations, the diff) against your policy, in this order. The first match wins:
Order | Rule | Level |
|
|---|---|---|---|
1 | No policy set | person |
|
2 | A path matches | person |
|
3 |
| person |
|
4 | A path matches | planner |
|
5 | A path contains a word in | planner |
|
6 |
| planner |
|
7 |
| planner |
|
8 | Anything else | ai |
|
With no policy, every pull request needs a person. That is the safe default, not a mistake.
1. Write the policy
In the dashboard: Settings → Review policy for the workspace, or the project's Settings → Review to override it. Path patterns are shell-style (billing/**, *.sql), and a pattern that starts with **/ also matches at the top level. required_checks names the CI checks that must pass before a merge; the workspace's list and the project's list are combined. Over the API:
curl -s -X PUT https://api.opvs.ai/api/v1/projects/<project-id>/review-policy \
-H "X-Brand-ID: $BRAND_ID" -H "Authorization: Bearer $OPVS_PAT" \
-H 'Content-Type: application/json' \
-d '{
"ai_reviewer_mode": "shadow",
"ai_graduation": {"rule": "record", "agree_streak": 30},
"levels": {
"person": {"paths": ["billing/**", "auth/**"], "destructive_migrations": true},
"planner": {"words": ["payment"], "sql_files": true, "raw_sql": true}
},
"required_checks": ["test"]
}'For the whole workspace, send the same body to PUT /api/v1/brands/<workspace-id>/review-policy.
2. Choose how much the AI reviewer may do
| The AI reviewer… |
|---|---|
| Does not review |
| Reviews, but its verdict does not clear anything. A person or planner still decides |
| Clears the pull requests the policy classifies as |
ai_graduation moves a project from shadow to allowed on its own:
| Graduates when |
|---|---|
| The AI reviewer has agreed with the human reviewer |
| On |
| Never; you switch it by hand |
The policy you read back carries effective_ai_reviewer_mode and, for record, graduation_progress (agreeing_in_a_row of needed).
3. Test it before a real pull request
Ask how a set of paths would be classified:
curl -s -X POST https://api.opvs.ai/api/v1/review-policy/classify \
-H "X-Brand-ID: $BRAND_ID" -H "Authorization: Bearer $OPVS_PAT" \
-H 'Content-Type: application/json' \
-d '{"paths": ["billing/charge.py"], "project_id": "<project-id>"}'The reply has two fields: level (ai, planner or person) and matched_by, from the table above.
Errors
Status | When | What to do |
|---|---|---|
| No token sent | Send |
| A level's | Send a JSON array of strings |
|
| Send |
| A | Pick today or a later date |
|
| Use 10 to 500 |
Related: How a card moves, Projects.