agent-permissions
БесплатноБез исполняемых скриптовНе проверенComprehensive guide for the agent permissions and approval system. Use when an agent needs to request user approval for sensitive operations, when…
от diegosouzapw★ 68 звёзд на GitHubОб этом скилле
Agent Permissions System
This skill covers the approval/permissions framework that enables agents to request user consent for sensitive operations across all platforms.
Quick Start: Requesting User Approval
When an agent needs approval for a sensitive action, the system automatically:
- Evaluates the tool call against defined policies
- If policy requires approval (
action: 'ask'), sends a prompt via the appropriate platform adapter - Waits for user response (button click, reply, reaction, or dashboard action)
- Returns approval decision to continue or deny execution
Platform-Specific Approval UX
| Platform | Approval Method | Response Format |
|---|---|---|
| Slack | Interactive buttons in message | "Approve" / "Deny" button clicks |
| Reply to message or emoji reaction | Reply "YES"/"NO" or 👍/👎 reaction | |
| Dashboard | Modal with approve/deny buttons | Button click in UI |
Core Architecture
packages/agents/src/permissions/
├── types.ts # Core interfaces (PermissionPolicy, ApprovalRequest, etc.)
├── policyEngine.ts # Policy evaluation and approval coordination
├── approvalStore.ts # In-memory approval store interface
├── drizzlePermissionStore.ts # Database-backed store (persistent)
├── defaultPolicies.ts # Built-in policy definitions
└── adapters/
├── base.ts # PlatformApprovalAdapter interface
├── registry.ts # Adapter registration
├── dashboard.ts # Dashboard approval adapter
├── slack.ts # Slack Block Kit buttons
└── whatsapp.ts # WhatsApp reply/reaction handling
Policy Definition
Policies control which tools require approval:
interface PermissionPolicy {
id: string; // Unique identifier
name: string; // Human-readable name
toolPatterns: string[]; // Glob patterns: 'file_write', 'bash_*', etc.
action: 'allow' | 'deny' | 'ask'; // What to do when matched
granularity: 'per_call' | 'per_session' | 'per_category';
riskLevel: 'low' | 'medium' | 'high' | 'critical';
promptTemplate?: string; // Custom approval message
agentIds?: string[]; // Limit to specific agents
platforms?: Platform[]; // Limit to platforms
priority?: number; // Higher = evaluated first
timeout?: number; // Auto-expire after ms
}
Default Policies
Located in packages/agents/src/permissions/defaultPolicies.ts:
export const DEFAULT_POLICIES: PermissionPolicy[] = [
{
id: 'file-write',
toolPatterns: ['file_write', 'file_delete', 'file_move', 'file_edit'],
action: 'ask',
granularity: 'per_call',
riskLevel: 'medium',
},
{
id: 'shell-execution',
toolPatterns: ['bash', 'shell', 'exec', 'run_command'],
action: 'ask',
granularity: 'per_call',
riskLevel: 'high',
},
{
id: 'external-api',
toolPatterns: ['http_*', 'api_*', 'webhook_*'],
action: 'ask',
granularity: 'per_session', // Once per session
riskLevel: 'medium',
},
{
id: 'sensitive-data',
toolPatterns: ['secret_*', 'credential_*', 'token_*'],
action: 'ask',
granularity: 'per_call',
riskLevel: 'critical',
},
];
Integration with Tool Execution
The toolCallingService.ts integrates with the PolicyEngine:
// Simplified flow in executeToolLoop:
for (const toolUse of toolUseBlocks) {
const decision = await policyEngine.evaluateToolCall(toolUse, context, agentId);
if (decision.action === 'deny') {
return toolDeniedResult(toolUse, decision.reason);
}
if (decision.action === 'ask') {
// This triggers the platform-specific approval UI
const approval = await policyEngine.requestApproval({
tool: toolUse,
policy: decision.policy,
context,
agentId,
});
if (approval.status !== 'approved') {
return toolDeniedResult(toolUse, 'User denied approval');
}
}
// Execute the tool
const result = await executor(toolUse.name, toolUse.input, context);
}
Platform Adapters
Implementing a New Adapter
Each adapter implements PlatformApprovalAdapter:
interface PlatformApprovalAdapter {
platform: Platform;
supportsNativeApproval: boolean;
supportedInteractionTypes: readonly InteractionType[];
// Send approval prompt to user
requestApproval(
request: ApprovalRequest,
context: PlatformContext
): Promise<ApprovalPromptResult>;
// Parse user's response (button click, reply, etc.)
handleApprovalResponse(response: unknown): Promise<ApprovalResult | null>;
// Cancel pending request
cancelRequest(requestId: string): Promise<void>;
// Format messages for display
formatApprovalPrompt(request: ApprovalRequest): unknown;
formatApprovalResult(result: ApprovalResult): unknown;
}
WhatsApp Adapter Example
The WhatsApp adapt
Установить agent-permissions в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл agent-permissions?
Comprehensive guide for the agent permissions and approval system. Use when an agent needs to request user approval for sensitive operations, when implementing new approval policies, when integrating platform-specific approval UIs (Slack buttons, WhatsApp replies, Dashboard modals), or when troubleshooting approval flows. Covers policy definition, platform adapters, and the complete approval lifecycle.
Как установить скилл agent-permissions?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл agent-permissions запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic