You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Ability to restrict Subagents use to Specific Primary Agents only #2693
One of OpenCode most powerful features is the ability to disable MCPs globally and turn them on for specific agents only.
Similarly the ability to turn off all subagents by default and only enable them on the agent level would allow for greater performance by restricting non necessary context and reducing the choices the primary agent would have to make.
In most cases subagents are only useful for specific primary agent, would make much sense to allow for such use case.
I was quickly imagining how it should work, let me know what you think here imagine the below getting added to agents.mdx as the end result of that PR. I quickly vibe coded those requirements but honestly drowning at the moment to do deep testing let me know if you suggest that I make a PR with these requirements so you can review. Or I just drop my changes.
Subagents access
You can globally disable all subagents and selectively enable them per primary agent. This reduces token usage and decision overhead when most subagents are irrelevant for a workflow.
Global control uses the top-level subagents map. Per-agent overrides use agent.<name>.subagents.
If you do nothing, current behavior is unchanged: all subagents are available.
Activity
rekram1-node commentedon Sep 19, 2025
Definitely makes sense @malhashemi!
We have been planning to merge our concepts of tools + permissions and we should support this as part of that change
malhashemi commentedon Sep 19, 2025
I was quickly imagining how it should work, let me know what you think here imagine the below getting added to
agents.mdxas the end result of that PR. I quickly vibe coded those requirements but honestly drowning at the moment to do deep testing let me know if you suggest that I make a PR with these requirements so you can review. Or I just drop my changes.Subagents access
You can globally disable all subagents and selectively enable them per primary agent. This reduces token usage and decision overhead when most subagents are irrelevant for a workflow.
Global control uses the top-level
subagentsmap. Per-agent overrides useagent.<name>.subagents.If you do nothing, current behavior is unchanged: all subagents are available.
{ "$schema": "https://opencode.ai/config.json", "subagents": { "*": false } }Enable one subagent back for a specific primary agent:
{ "$schema": "https://opencode.ai/config.json", "subagents": { "*": false }, "agent": { "build": { "subagents": { "general": true } } } }Use wildcards to enable a group:
{ "$schema": "https://opencode.ai/config.json", "subagents": { "*": false }, "agent": { "plan": { "subagents": { "doc-*": true } }, "build": { "subagents": { "doc-*": true, "git-committer": true } } } }Enable everything except one:
{ "$schema": "https://opencode.ai/config.json", "subagents": { "*": false }, "agent": { "build": { "subagents": { "*": true, "git-committer": false } } } }Refine globally enabled patterns per agent:
{ "$schema": "https://opencode.ai/config.json", "subagents": { "*": false, "general": true, "git-*": true }, "agent": { "plan": { "subagents": { "git-*": false } } } }Resolution rules:
"*": falseis present globally (default deny mode)If a subagent is disabled:
@mentionattempts return a short advisory messagerekram1-node commentedon Sep 25, 2025
This will be addressed as part of: #1961
Should be addressed as part of the move to opentui since dax is working on this