[PR #4773] Added: Ability to hide subagents from primary agents system prompt. #11112

Closed
opened 2026-02-16 18:15:54 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/4773

State: closed
Merged: Yes


Summary

Add hidden and permission.task options to control subagent visibility and invocation permissions.

Changes

  • Add hidden: true option to hide subagents from the @ autocomplete menu
    • 📓 This is already in dev branch
  • Add permission.task config to control which subagents an agent can invoke via the Task tool (supports allow/deny/ask with glob patterns)
  • Filter denied subagents from the Task tool description so the model doesn't attempt to invoke them
  • Bypass permission checks when users explicitly invoke subagents via @ autocomplete

Purpose

Enables orchestrator-style agent architectures where internal helper subagents should only be invoked programmatically by other agents, not directly by users, while also providing fine-grained control over which agents can call which subagents.

Modified Files

  • src/agent/agent.ts - Add hidden property and permission.task merging logic
  • src/config/config.ts - Add schema for new config options
  • src/session/prompt.ts - Track user-invoked agents, regenerate Task tool description with filtered subagents
  • src/tool/task.ts - Enforce task permissions with user override bypass
  • src/cli/cmd/tui/component/prompt/autocomplete.tsx - Filter hidden agents from autocomplete
  • test/permission-task.test.ts - Tests for subagent filtering
  • packages/sdk/js/src/v2/gen/types.gen.ts - Updated SDK types
  • packages/web/src/content/docs/agents.mdx - Documentation for new features
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/4773 **State:** closed **Merged:** Yes --- ## Summary Add `hidden` and `permission.task` options to control subagent visibility and invocation permissions. - fixes #4764 - fixes #4267 ## Changes - Add `hidden: true` option to hide subagents from the `@` autocomplete menu - 📓 This is already in `dev` branch - Add `permission.task` config to control which subagents an agent can invoke via the Task tool (supports allow/deny/ask with glob patterns) - Filter denied subagents from the Task tool description so the model doesn't attempt to invoke them - Bypass permission checks when users explicitly invoke subagents via `@` autocomplete ## Purpose Enables orchestrator-style agent architectures where internal helper subagents should only be invoked programmatically by other agents, not directly by users, while also providing fine-grained control over which agents can call which subagents. ## Modified Files - `src/agent/agent.ts` - Add `hidden` property and `permission.task` merging logic - `src/config/config.ts` - Add schema for new config options - `src/session/prompt.ts` - Track user-invoked agents, regenerate Task tool description with filtered subagents - `src/tool/task.ts` - Enforce task permissions with user override bypass - `src/cli/cmd/tui/component/prompt/autocomplete.tsx` - Filter hidden agents from autocomplete - `test/permission-task.test.ts` - Tests for subagent filtering - `packages/sdk/js/src/v2/gen/types.gen.ts` - Updated SDK types - `packages/web/src/content/docs/agents.mdx` - Documentation for new features
yindo added the pull-request label 2026-02-16 18:15:54 -05:00
yindo closed this issue 2026-02-16 18:15:54 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#11112