Skip to content

Scope policies to resources

Tool-level policies answer “may this agent merge PRs?”. Resource scoping answers the sharper question: “may it merge PRs in this repo?” These recipes combine repo/channel restrictions and resource conditions; pickers are populated from your harvested entities.

GitHub

Confine an agent to one org (future repos included)

FieldValue
EffectPermit
Toolsthe tools you allow
Repo restrictionsowner: my-org (leave repo empty)

Owner-level restrictions are structural — repos created in the org tomorrow are covered without re-editing the policy.

Public repositories only

FieldValue
EffectPermit
Toolsread tier
Resource conditionsvisibility: public

Add archived: false to also exclude archived repos. With multiple conditions, set match = all (AND) — the default.

Protect default and protected branches

FieldValue
EffectForbid
Toolspush_files, create_or_update_file
GitHub resource scopebranch
Resource conditionsisDefaultBranch: true, isProtected: truematch = any (OR)

match = any makes the forbid fire if either attribute holds. The resource scope guard keeps the policy from accidentally matching non-branch resources.

Keep agents out of draft PRs

FieldValue
EffectForbid
Toolsmerge_pull_request, pull_request_review_write
GitHub resource scopepull_request
Resource conditionsisDraft: true

Pin a policy to specific PRs or issues

Use the entity pickers — conditions of type pullRequest / issueRef with values like my-org/api#142. Multiple picked entities OR together. Useful for tightly-scoped incident or release agents.

Slack

Public channels only

FieldValue
EffectPermit
Toolsslack_send_message, slack_reply_to_thread
Resource conditionsisPrivate: false

Allow posting only in approved channels

FieldValue
EffectPermit
Toolsmessage-sending tools
Channel restrictionspick the channels

Linear

One team, nothing else

FieldValue
EffectPermit
Toolsissue read/write tools
Resource conditionsissueTeamId via the team picker (multiple teams OR together)

Hands off completed work

FieldValue
EffectForbid
Toolssave_issue
Resource conditionsissueStateType: completed

Label-gated automation

Permit save_issue only where issueHasLabelId matches your ai-allowed label (picked, stable across renames). Manual issueHasLabel matches by name — handy for ad-hoc labels, but renames break it.

Vercel

Production is read-only

FieldValue
EffectForbid
Toolsanything mutating
Resource conditionsvercelTarget: production

Preview and staging stay workable; production deployments are untouchable.

Verify before enforcing

Resource-scoped policies are exactly where simulation pays off — replay last week’s traffic and check the flipped rows are the ones you expect: Preview and simulate.