Skip to content

Bring subagent system to feature parity with Claude Code #2409

@tanzhenxin

Description

@tanzhenxin

What would you like to be added?

Bring Qwen Code's subagent system to feature parity with Claude Code's subagent capabilities. Currently Qwen Code implements roughly 40-45% of the subagent features. The core structure is in place (markdown frontmatter files, /agents command, plugin subagents, tool allowlists), but many advanced features are missing.

Missing features to add (grouped by priority):

Execution model:

  • Dynamic subagent creation — allow the model to spawn subagents on-the-fly during a conversation without requiring pre-defined markdown files. Currently all subagents must be created beforehand.
  • Concurrent subagent execution — allow multiple subagents to run in parallel. Currently subagents only execute sequentially, blocking the main conversation until each one completes.

Frontmatter fields:

  • disallowedTools — denylist to remove tools from the inherited set (e.g., inherit all but block Write)
  • model — promote to top-level field with alias support (sonnet, opus, haiku, inherit)
  • maxTurns — promote to top-level field (currently nested under runConfig.max_turns)
  • permissionMode — per-subagent permission override (default, acceptEdits, dontAsk, bypassPermissions, plan)
  • skills — preload skill content into subagent context at startup
  • mcpServers — scope MCP servers to specific subagents with inline definitions or references
  • hooks — define PreToolUse, PostToolUse, Stop hooks directly in subagent frontmatter
  • memory — persistent memory directory across conversations with user/project/local scopes
  • background — run subagent as a concurrent background task
  • isolation — run subagent in a temporary git worktree for isolated execution

Built-in subagents:

  • Explore — fast read-only agent for codebase search (quick/medium/very thorough)
  • Plan — research agent for plan mode with read-only tools
  • Bash — isolated context for terminal commands
  • statusline-setup — status line configuration agent
  • Qwen Code Guide — agent that answers questions about Qwen Code features

CLI & runtime:

  • --agents CLI flag — pass JSON agent definitions for session-only use
  • Agent(type) spawn restriction — restrict which subagent types can be spawned
  • Resume subagents — continue a completed subagent's work via agent ID
  • Auto-compaction — automatic context compaction for subagents at configurable thresholds
  • Ctrl+B to background — send a running subagent to background mid-execution
  • CLAUDE_CODE_DISABLE_BACKGROUND_TASKS env var

Permissions:

  • permissions.deny with Agent(name) — disable specific subagents via settings or --disallowedTools

Hooks in frontmatter — allow PreToolUse, PostToolUse, Stop hooks scoped to a subagent's lifetime in the markdown file

Why is this needed?

Subagents are a core capability for managing context, enforcing constraints, and specializing behavior. The current implementation covers the basics but lacks important features for real-world workflows:

  • Dynamic creation and concurrent execution are foundational — without them, the model cannot spawn ad-hoc helpers or parallelize independent work like researching multiple modules simultaneously
  • Persistent memory enables subagents to learn across conversations, building institutional knowledge
  • Background execution and worktree isolation allow parallel workflows without blocking the user
  • MCP scoping keeps irrelevant tool descriptions out of the main context window
  • Permission modes and disallowedTools provide fine-grained security control per subagent
  • Resume avoids re-doing expensive exploration when continuing previous work
  • Built-in subagents (Explore, Plan) improve out-of-the-box experience for common tasks
  • Hooks in frontmatter make subagents self-contained and portable

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions