| name | permission-patterns |
| description | Rules for evaluating, classifying, and deduplicating AI tool permissions |
| version | 1.0.0 |
| author | JacobPEvans |
Permission Patterns
Unified patterns for permission safety classification and deduplication. Use these rules to evaluate permissions consistently.
Safety Classification
Classification rules for evaluating permission safety. Use these criteria to categorize permissions consistently.
Classification Rules
ALLOW - Read-Only and Safe Operations
Keywords: list, ls, show, info, view, get, describe, inspect, status, doctor, ping, check, --version, --help
Safe domains: github.com, docker.com, kubernetes.io, python.org, npmjs.com, official documentation sites
ASK - Modifications and Risky Operations
Keywords: update, set, edit, patch, modify, apply, rm, delete, remove, prune, clean, exec, run, eval, push, publish, deploy, kill, stop
Requires user confirmation before execution.
DENY - Irreversible Damage or Security Bypass
Keywords: sudo, chmod 777, dd, file patterns like **/.env, **/*_rsa, **/*.key, **/*secret*
Local addresses: localhost, 127.0.0.1, private IP ranges
Decision Criteria
- Read-only query + no secrets → ALLOW
- Modifies resources + reversible → ASK
- Irreversible or security risk → DENY
- Uncertain → ASK (conservative default)
Domain Coverage
Root domains cover their subdomains, but different root domains or TLDs are separate:
github.comcovers:api.github.com,docs.github.com,status.github.comgithub.iois a separate root domain (different TLD), does NOT covergithub.comand vice versagithub.comdoes NOT covergithubusercontent.com(separate root domain)localhostis separate fromlocalhost:3000(ports are distinct entities, not subdomains)
Local/private addresses always DENY:
localhost,127.0.0.1,192.168.x.x,10.x.x.xranges
Pattern Deduplication
Rules for detecting when a specific permission is already covered by a broader existing pattern.
Pattern Coverage Rules
Bash Permissions
Wildcards (*) match any value. More wildcards = broader coverage.
Coverage examples:
git:*:*coversgit status:*,git log:*,git diff:*npm:*:*coversnpm list:*,npm install:*docker:*:*coversdocker ps:*,docker volume ls:**--version:*coversnpm --version:*,docker --version:*
No coverage:
git status:*does NOT covergit log:*(different commands)npm:*does NOT covernpm:*:*(different arg counts)
WebFetch Domains
Domain coverage for WebFetch follows the same rules as the Domain Coverage section under Safety Classification (root domains cover their subdomains; different root domains are separate).
In addition, treat ports as distinct from subdomains:
localhostdoes NOT coverlocalhost:3000(a port is not a subdomain and must be specified explicitly)
File Paths
Broader wildcards cover more specific patterns.
Coverage examples:
Read(**)covers any Read permissionGlob(**/*)coversGlob(**/*.js),Glob(**/package.json)
Deduplication Algorithm Example
When checking if a new permission is already covered by an existing one, validate argument counts match:
def is_covered(existing_pattern, new_pattern):
# Extract components
existing_cmd, *existing_args = existing_pattern.split(':')
new_cmd, *new_args = new_pattern.split(':')
# Commands must match
if existing_cmd != new_cmd:
return False
# Argument counts must be identical (otherwise patterns aren't comparable)
if len(existing_args) != len(new_args):
return False
# Each position: existing must be "*" or match exactly
return all(
existing_arg == "*" or existing_arg == new_arg
for existing_arg, new_arg in zip(existing_args, new_args)
)
Root Domain Recommendations
For well-known vendors (GitHub, Docker, Google, Apple, Microsoft), prefer root domain over individual subdomains.
If multiple subdomains found → suggest adding root domain instead.
Related Permission Suggestions
When discovering a safe permission, suggest related safe commands in the same family:
docker volume ls→ suggestdocker volume inspectaws s3 ls→ suggestaws s3 sync --dryrunnpm list→ suggestnpm outdated,npm audit
Bash Permission Format
Bash permission patterns use colon-separated positions. Each segment after the tool name corresponds to one whitespace-separated argument in the shell command. A * in any position matches exactly one argument at that position.
Wildcard * by position
- Pattern
git:*matchesgitwith exactly one argument (any value)- Matches:
git status,git branch,git log - Does NOT match:
git(no arguments),git status -sb(two arguments)
- Matches:
- Pattern
git:*:*matchesgitwith exactly two arguments (both can be anything)- Matches:
git status -sb,git branch -a,git log --oneline - Does NOT match:
git,git status,git status -sb --decorate(three arguments)
- Matches:
Command-specific patterns (literals plus wildcards)
- Pattern
git:status:*(written asBash(git status:*)) matchesgit statuswith exactly one additional argument- Matches:
git status -sb,git status --short - Does NOT match:
git status(no extra argument),git branch -a
- Matches:
- Pattern
git:*:*(written asBash(git:*:*)) matches anygit <subcommand> <arg>- Matches:
git status -sb,git branch -a,git log --oneline
- Matches:
- Pattern
npm:list:*(written asBash(npm list:*)) matchesnpm listwith exactly one additional argument- Matches:
npm list --depth=0 - Does NOT match:
npm list(no extra argument),npm install express
- Matches:
- Pattern
npm:*:*(written asBash(npm:*:*)) matches anynpm <subcommand> <arg>- Matches:
npm list --depth=0,npm install express
- Matches:
Pattern Notation Clarification
Patterns are defined by the number of arguments, where each : separates argument positions:
git:*matchesgitwith exactly one argument (any value)git:*:*matchesgitwith exactly two arguments (any values)git status:*matchesgit statusas a command pair, plus exactly one additional argument
The notation shows exact argument positions, not whether the command uses the Bash() wrapper:
Bash(git:*:*)- Same asgit:*:*, theBash()wrapper doesn't change the matching rules- Both match git commands with exactly two arguments where both can be anything
Commands Using This Skill
agentsmd/agents/permissions-analyzer.md- Uses classification and deduplication to filter permissions during discovery/sync-permissionscommand - Indirectly uses this skill through the permissions-analyzer agent