opencode icon indicating copy to clipboard operation
opencode copied to clipboard

[FEATURE]: Allow configurable subagent-to-subagent task delegation with call limits

Open NamedIdentity opened this issue 1 week ago • 3 comments

Feature hasn't been suggested before.

  • [x] I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Problem Currently, task.ts hardcodes task: false for all subagent sessions (lines 65-69, 132-137), preventing any subagent from delegating to another subagent. This blocks legitimate workflows like:

  • Principal-Partner delegating to Assistants
  • Assistant-Sonnet having Assistant-Flash cross-check its work
  • Assistant-Flash asking Assistant-Sonnet for thorough analysis

The agent config already supports granular task permissions:

assistant-sonnet: { tools: { task: true }, permission: { task: { *: deny, assistant-flash: allow } } }

But this config is ignored because task.ts unconditionally overrides it.

Proposed Solution

  1. Respect agent-level task permissions instead of hardcoding task: false
  2. Add optional task_limit config to prevent infinite loops: assistant-sonnet: { tools: { task: true }, permission: { task: { *: deny, assistant-flash: allow } }, task_limit: 3 // Max task calls per session (0 = current behavior) }

Use Case Building an Agentic Collaboration Framework where:

  • Principal-Opus orchestrates work
  • Principal-Partner (subagent) can delegate to Assistants
  • Assistant-Sonnet and Assistant-Flash can cross-check each other's work

The permission system already expresses "Sonnet can only task Flash" - it just needs to be honored.

Backward Compatibility Default behavior unchanged - task_limit: 0 (or absent) means task tool disabled for subagents, matching current behavior. Only users who explicitly configure permissions get the new capability.

NamedIdentity avatar Jan 08 '26 06:01 NamedIdentity