Agent Permissions

Rules for what an agent may do alone and what needs approval.

checkout-web

What the coding agent may do in this repository without asking.

  • Read code and historyFiles, commits and blame
  • Read issues
  • Comment on issues and pull requestsOverrides Organization
  • Create branches
  • Push to its own branches
  • Open pull requestsFrom Organization
  • Merge pull requests
  • Force pushBlocked by your organization
  • Delete branches
  • Install dependencies
    Block: Sessions need it to set up
  • Run tests
  • Reach the internetPackage registries are always allowed
  • Read repository secrets

Pushing to main always asks, whatever is set here.

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/rules

Usage

import type { Outcome } from "./ui/uicontext/components/domain/Outcome.ts"import { ToolRules, type ToolRule } from "./ui/uicontext/components/kit/Rules.ts"
const Message = UiSchema.TaggedEnum({	RequestedToolMode: { id: Schema.String, mode: Schema.String },	RequestedToolReset: { id: Schema.String },})// your app saves each change, answers with an outcome per tool id, and passes the new rules backexport const AgentToolRules = (	h: Html.H<typeof Message.Type>,	rules: ReadonlyArray<ToolRule>,	outcomes: ReadonlyArray<Outcome>,) =>	ToolRules(h, {		props: { label: "Tools", rules, outcomes, can: ["edit"] },		onEmit: {			RequestedMode: ({ id, mode }) => Message.RequestedToolMode({ id, mode }),			RequestedReset: ({ id }) => Message.RequestedToolReset({ id }),		},	})

Examples

Rules in your words

Sentences in Allow and Ask first lists. A new rule shows at once while it saves; a refused one comes back to edit. Ctrl+Enter adds, Escape cancels.

Support assistant rules

When an Ask first rule and an Allow rule both match, it asks.

Allow

2 / 10

It does these without asking.

  • Reply in threads it was mentioned in

    Added by Mira Patel · Nov 3

  • Add labels and priorities to new tickets

    Added by Ben Okafor · Nov 20

Ask first

1 / 10

It stops and asks someone before these.

  • Anything that spends money, including refunds and credits

    Added by Ben Okafor · Oct 12

Recently held or stopped

Post the daily ticket summary to #support · Held for approval, 2 hours ago

Email every customer about the outage · Stopped by Ben

Read-only

Someone who can't change the rules still sees every mode, and why they can't change it.

Calendar

What the personal assistant may do with Ada's calendar.

Only Ada can change what her assistant may do.

  • Read events
  • Create events
  • Accept invitations
  • Cancel events with other peopleOverrides Workspace

API reference

ToolRulesComponent

Props

ToolRules props
NameTypeDescription
agentIdstringThis editor's id for agents, unique on the page: "rules-github"
labelrequiredstring"Tools", "GitHub server"
descriptionstringA line under the heading: what these rules control
modesRuleMode[]The modes a tool can be in; Ask first, Allow and Block by default
rulesrequiredToolRule[]Each tool, with its mode or the mode it inherits
canrequiredCan(["edit"])What the viewer may do: "edit" changes modes
readOnlyReasonstringWhy the viewer can't edit, shown instead of the controls
notestringWhat still asks no matter what: "Sending money always asks."
outcomesOutcome[]The app's answers to requests, one per request; the request id is the rule's id (RequestedMode, RequestedReset). A pending rule is busy; the newest refusal shows its reason.

Events

ToolRules events
EventPayloadDescription
RequestedMode{ id: string; mode: string }The person picked a mode for a tool
RequestedReset{ id: string }Stop setting a mode here and inherit

Agent actions

What agents can do with ToolRules
ActionDescription
ChoseModeasks firstSet a tool's mode (one of modes). Target: { id, mode } as in the snapshot.
ClickedResetasks firstStop setting a tool's mode here, so it inherits. Target: { id, mode }.

PlainRulesComponent

Props

PlainRules props
NameTypeDefaultDescription
agentIdstring—The id agents see this by; plain-rules:<label> when left out
labelrequiredstring—"Permission rules"
descriptionstring—A line under the heading: what these rules control
listsrequiredRuleList[]—The lists of rules in plain words, such as Allow, Ask first and Never
maxLengthnumber000Longest rule, in characters; 1,000 by default
precedencestring—Which list wins when two match: "Ask first wins over Allow."
recentRuleCase[]—Recent held or stopped actions, to write a rule from
canrequiredCan(["edit"])—What the viewer may do: "edit" adds and removes rules
readOnlyReasonstring—Why the viewer can't edit, shown instead of the controls
outcomesOutcome[]—The app's answers to requests, one per request; the request id is the list's id for RequestedAdd and the rule's id for RequestedRemove. A pending rule is busy; the newest refusal shows its reason.
localestring—For the dates rules were added
timeZonestring—The time zone for the dates rules were added; the reader's own when left out

Events

PlainRules events
EventPayloadDescription
RequestedAdd{ list: string; text: string }The person wrote a new rule into a list
RequestedRemove{ list: string; id: string }The person removed a rule

Agent actions

What agents can do with PlainRules
ActionDescription
SubmittedRuleasks firstAdd a rule, as a sentence, to a list. Target: { list, count } with the list's current rule count.
ClickedRemoveasks firstRemove a rule. Target: { list, id, text } as in the snapshot.

Accessibility

  • Each tool is a fieldset whose modes are radio buttons; a mode that can't be chosen says why, read as its description.
  • A read-only list says why above it, and a refused change is announced.
  • Plain-language rules are a list with a labelled field to add one, and each Remove button names its rule. Agents must name the rule or tool they change.

Source