From 14ac0b774376b1235bd5f58c8b9d08bde57658cb Mon Sep 17 00:00:00 2001 From: Kenneth Ng Date: Fri, 27 Nov 2026 16:28:14 +0000 Subject: [PATCH 1/5] feat: add stackone-policies agent skill Teaches reading, writing, testing and retiring runtime policies with the management MCP's policy tools (ENG-4648). Cedar examples checked with @stackone/policy checkText. Co-Authored-By: Claude Opus 5.5 --- skills/stackone-policies/SKILL.md | 150 ++++++++++++++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 skills/stackone-policies/SKILL.md diff --git a/skills/stackone-policies/SKILL.md b/skills/stackone-policies/SKILL.md new file mode 100644 index 0000000..2ee5254 --- /dev/null +++ b/skills/stackone-policies/SKILL.md @@ -0,0 +1,150 @@ +--- +name: stackone-policies +description: Use when the user wants to restrict, block, guard or limit what their AI agents can do in a connected app, control who can run which actions, mask or hide fields such as emails or salaries, or enforce, disable, change or remove an existing runtime policy (rule). Covers reading, writing, testing and retiring Cedar policies and who they apply to. Not for linking or reconnecting accounts (stackone-connection), not for running a provider action, and not for reading logs to diagnose a failed call. +--- + +# Managing runtime policies + +A runtime policy is a rule, written in Cedar, that decides what a project's agents may do on a tool +call: let it through, refuse it, or mask fields in the response. Each policy also says who it covers. +A wrong rule either blocks real work or leaves a gap the user believes is closed, so read first, +confirm every write in plain words, and test the rule before and after saving it. + +If this session has no policy tools (`stackone_get_policies`, `stackone_create_policy` and the +rest), policies are not available here: tell the user to manage them in the StackOne dashboard at +app.stackone.com, and do not attempt the steps below. Every policy tool needs a project admin; when +one is refused, tell the user to ask a project admin. + +## Read before you write + +- List what exists with `stackone_get_policies`, or `stackone_get_policies {id}` for one. Find + every id this way; never ask the user for a policy id. +- If an existing rule already does what is asked, say which one and change nothing. If one nearly + does, propose changing it rather than adding a second rule. +- Policies marked organization-wide also bind this project, but only an organization admin can + change them. + +## Say who it reaches + +A policy only decides calls made by a signed-in StackOne user: an AI client connected through OAuth +(Claude, Cursor, ChatGPT and similar), the dashboard playground and agent, or a person's own +personal API key. Calls made with a project API key, or through a connect session belonging to a +customer's end user, are never checked, even by a rule assigned to `everyone`. Tell the user this +whenever their request is about those callers or could be read that way. + +## Build the rule from what the actions do + +1. Find the connector key with `stackone_get_connectors` and the accounts with + `stackone_get_accounts {connector_key: [""], expand: "connector,connector_profile"}`. +2. List the actions that can run: `stackone_get_connector_profiles {connector_key: [""]}`, then + `stackone_get_connector_profiles {id}` for each profile, which returns its enabled action ids. + Where `stackone_search_actions` is available, use it to read an action's description and inputs. +3. Choose actions by effect, not by a word in the name. "Block deletes" means every action that + destroys or ends something: delete, remove, terminate, archive, cancel, deactivate, purge and the + like. List each chosen id to the user, and say which near misses you left out and why. +4. Cover every part of the request: each connector, each person, and each action that reaches the + same outcome (a record created by two different actions needs both). +5. Name tools by exact id. Never match with a name glob such as `resource.name like "*delete*"`: it + misses actions named differently and catches ones it should not. Tell the user the rule covers + the listed ids only, so an action enabled later must be added. + +Deny wins over allow, and a `permit` on its own restricts nothing, so a restriction is a `forbid`. +One statement per check. The policy's name goes in `name`, never in an annotation such as `@name`. + +```cedar +// Stop agents deleting or ending records in HiBob +forbid (principal, action == StackOne::Action::"invokeTool", resource) +when { resource in [StackOne::Tool::"", StackOne::Tool::""] }; +``` + +To reach every action of one connector use `context.account in StackOne::Connector::""`, +and for one account `context.account == StackOne::Account::""`. + +## Conditions on what the call sends + +When the restriction depends on a value in the call, read the action's input names first, then test +them through `context.args`. Each value needs both guards, `hasTag` and `has`, or the save is +refused. Text is under `str`, a whole number under `num`, any number under `dec` (compare amounts +with `dec` and `decimal("1000.0")`), a boolean under `bool`. A nested input is keyed by its path, such +as `compensation.amount`. If the user defines a category by several fields together, the condition +tests all of them, not one field that looks similar. + +```cedar +forbid (principal, action == StackOne::Action::"invokeTool", resource) +when { resource == StackOne::Tool::"" + && context.args.hasTag("employment_type") && context.args.getTag("employment_type") has str + && context.args.hasTag("country") && context.args.getTag("country") has str + && context.args.getTag("employment_type").str == "contractor" + && context.args.getTag("country").str == "US" }; +``` + +## Who it covers + +`principals` on create, and on `stackone_replace_policy_assignments`, is `[{type: "everyone"}]` or +users and groups by id: `{type: "user", id}`, `{type: "group", id}`. No management tool lists users or +groups, so ask the user for the StackOne user id or group id (an admin can copy it from the +dashboard). Never put a name or an email where an id goes. "Only Jessica may use UKG" is a rule for +everyone with Jessica left out: + +```cedar +forbid (principal, action == StackOne::Action::"invokeTool", resource) +when { context.account in StackOne::Connector::"" } +unless { principal == StackOne::User::"" }; +``` + +Replacing assignments replaces the whole set: send everyone who should stay, not just the change. + +## Masking or refusing fields + +To mask what a response returns use `readField`; to refuse a write use `writeField`. Look up the exact +label with `stackone_get_policy_labels` and never invent one. If no label fits, or the list is empty, +say so. A client condition needs its guard: + +```cedar +forbid (principal, action == StackOne::Action::"readField", resource) +when { resource in StackOne::Label::"