Skip to content

[FEATURE]: Granular Agent-to-Agent Visibility Control #7350

@macastro9714

Description

@macastro9714

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 user
  • all = 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

  1. Schema: Add agent?: PermissionRuleConfig to the permission object
  2. Inventory filtering: Filter agent inventory by both mode AND permission.agent
  3. Runtime enforcement: Reject calls to agents not in the allowlist

Metadata

Metadata

Assignees

Labels

discussionUsed for feature requests, proposals, ideas, etc. Open discussion

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions