Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Subagents Realization Report


title: Subagents Realization Report authors:


Subagents Realization Report

Methodological Note: Defining “Subagent” Realization

Before analyzing specific implementations, it is critical to establish a taxonomy of what constitutes a “subagent.” In the current AI engineering landscape, the term “subagent” is used loosely to describe any form of task delegation. However, the architectural reality varies significantly across three distinct paradigms of realization.

To maintain technical rigor, this report distinguishes between Physical, Logical, and Asynchronous isolation.

1. Physical Isolation (The “Fork” Pattern)

Realization: The creation of a separate API session, a new context window, or a distinct process.

2. Logical Isolation (The “Persona” Pattern)

Realization: A role-shift within the same continuous API session.

3. Asynchronous Isolation (The “Headless” Pattern)

Realization: Execution decoupled from the main interaction loop, often triggered by system-level events.


Comparative Analysis of Implementations

1. Physical Isolation: The “Fork” and “Worker” Patterns

Coding agents (Claude Code, Qwen Code, Gemini CLI) predominantly use Physical Isolation to ensure that sub-tasks do not corrupt the main session’s state or introduce unstable mutations.

A. Calling Mechanisms and Routing

AI coding agents use a declarative tool-based dispatcher, but their routing strategies vary based on the desired level of session continuity:

B. State Isolation and Mutation Guarding

To prevent subagents from accidentally altering the parent’s environment, these systems implement various isolation guards:

C. Prompt Cache Optimization

A critical engineering constraint for physical subagents is the token cost of duplicating the parent’s context. Claude Code and Qwen Code solve this through Verbatim Prefix Mirroring:

D. Observability and Steering

The “black box” nature of separate sessions is mitigated through structured telemetry:

E. Context Management and Pollution

Physical isolation provides the strongest guarantee against pollution:

FeatureClaude CodeQwen CodeGemini CLIOpenCodeOpenClaudeOpenClaw
RealizationForked AgentHybrid (Fork+Spec)SupervisorRecursiveCoordinatorGateway
IsolationNo-op stubsALS GuardToolInvocationPermission GateTask RegistryLanes/Channels
CachingMirroringMirroringRegistrySessionIDDisk-backedSession-Key
ObservabilitySidechainsEvent-UIActivity Bridgetask_resultXML NotifySession-Keys
SteeringResult-basedResult-basedInjectionsResume TaskBackgroundingSteer/Cascade

2. Logical Isolation: The “Persona” Pattern

Unlike Physical Isolation, Logical Isolation does not create a new session. Instead, it shifts the agent’s operational mode within the same continuous dialogue.

A. Virtual Subagents (Superpowers)

Superpowers implements a 3-role subagent orchestration pipeline (Implementer →\rightarrow Spec Reviewer →\rightarrow Code Quality Agent).

B. Context Management and Pollution

In a single-session model, pollution is a constant risk:

3. Asynchronous Isolation: The “Headless” Pattern

Asynchronous isolation decouples the subagent’s execution from the main user-agent interaction loop.

A. Headless Bookkeeping (MemPalace)

MemPalace implements subagent-like behavior through an Agentic MCP Server.

B. Context Management and Pollution

Asynchronous subagents avoid pollution through temporal and structural decoupling:

Summary: Taxonomy of Subagent Realizations

ParadigmRealizationIsolation LevelOverheadPrimary ExampleKey Trade-off
PhysicalNew Session / ForkHigh (State Boundary)High (Tokens/Latency)Claude Code / Qwen CodePrevents pollution ↔\leftrightarrow Expensive
LogicalRole-Shift / PromptLow (Shared State)ZeroSuperpowersInstant ↔\leftrightarrow Persona Leakage
AsynchronousBackground / HeadlessMedium (Temporal)Zero (Main Loop)MemPalaceInvisible ↔\leftrightarrow No real-time steering

References

For detailed technical walk-throughs and implementation patterns, refer to the following guides: