-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Description
Feature hasn't been suggested before.
- I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Add permission.agent to control which agents appear in an agent's inventory. Currently, permission supports bash, skill, edit, etc., but not agent.
OpenCode uses mode to control agent visibility:
subagent= hidden from inventory (can't be called)primary= visible, directly invocable by userall= visible, can call other agents
Problem: When you set mode: "all" to enable agent-to-agent calls, the agent sees the entire agent inventory. There's no way to restrict visibility to specific agents.
Why This Matters
Context bloat: An agent that only needs 2 subagents sees all 20+ agents in the system, wasting tokens and potentially causing confusion.
Security/correctness: A build agent shouldn't even know that deploy-production exists, preventing accidental or mistaken calls.
Example
deploy (orchestrator)
├── build
├── verify
├── release
└── promote
With mode: "all", the build agent sees ALL agents including deploy-staging, deploy-production, etc. It should only see its 2 relevant subagents.
Proposed Solution
Add permission.agent following the same pattern as permission.skill:
Current (for skills - already works):
{
"permission": {
"skill": {
"git-*": "allow",
"experimental-*": "deny"
}
}
}Proposed (for agents):
{
"agent": {
"build": {
"mode": "all",
"permission": {
"agent": {
"compile": "allow",
"test-unit": "allow"
}
}
}
}
}Result: When build runs, its <available_agents> section only includes agents it's allowed to call.
Implementation
- Schema: Add
agent?: PermissionRuleConfigto thepermissionobject - Inventory filtering: Filter agent inventory by both
modeANDpermission.agent - Runtime enforcement: Reject calls to agents not in the allowlist