Four Isolation Dimensions of Sub-Agents
Analyzing isolation boundaries across context source, recovery mode, worktree, and task state
THE QUESTION THIS PAGE ANSWERS
ANSWER FIRSTWhat is the key idea behind “Four Isolation Dimensions of Sub-Agents”?
Analyzing isolation boundaries across context source, recovery mode, worktree, and task state
Make the claim earn its place. Use this page as a decision aid, not a definition to memorize. Connect the idea to one real task, one observable result, and one failure that would change your mind.
Write one question you could answer with evidence after trying this idea.
A conclusion that sounds complete but leaves the key assumption untested.
Be able to accurately explain ContextSource::New / Resumed、ResumeSourceData、SubagentIsolationMode, and select new sessions, resumption, and worktrees based on the task.
Isolation is a Set of Orthogonal Dimensions
The same Resumed sub-agent can reuse a worktree or inherit the ordinary cwd. Context continuity and file-space isolation must be evaluated independently.
ContextSource::New
A new session does not inherit history. The spawn process establishes a new system prompt and prompt context, then receives the current task input. It does not imply an independent file space — that still depends on isolation and cwd.
ContextSource::Resumed
Continues from a completed peer subagent. Source code copies the original transcript and tool state; the model reuses the source model. System prompt and prompt context are re-rendered according to the current AgentDefinition.
Identity Validation
- subagent_type must match the source.
- An explicit Persona must match the source; if not explicitly provided, the source persona is inherited.
- model is not part of the identity gate. A model override in the request is soft-ignored and pinned to the source model.
Resumption Constraints
- If copying the transcript or reading it fails, an explicit resume will fail and close.
- Resumption is rejected if the source transcript exceeds 80% of the target model's context window.
- Resumption copies tool state but not plan state, plan mode state, or signals.
None
The sub-agent uses the resolved cwd, typically the same as the parent workspace. The context window is still an independent child session. None describes file workspace isolation — it does not mean shared conversation history.
Worktree
The sub-agent uses an independent worktree path. On resumption, the source worktree is reused first; if the path has been removed and a snapshot_ref exists, it can be rehydrated from the persistent git ref. This enum has no "sandbox" member.
pub enum SubagentIsolationMode {
#[default]
#[serde(alias = "None")]
None,
#[serde(alias = "Worktree", alias = "work_tree", alias = "work-tree")]
Worktree,
}
Snapshot Note: The enum is fully preserved to show wire aliases. The concentric circles above are course visuals emphasizing dimension orthogonality — they do not represent object hierarchy in the source code.
Classroom Exercise: Choose Boundaries for Two Tasks
Task A needs to continue a half-finished refactor from yesterday and keep the original worktree's uncommitted changes. Task B only needs to independently analyze the current repository. For each, choose New or Resumed and None or Worktree, and explain how transcript, model, cwd, and file change scope are handled.
Why “Isolation is a Set of Orthogonal Dimensions” depends on the operation
“Be able to accurately explain ContextSource::New / Resumed 、 ResumeSourceData 、 SubagentIsolationMode , and select new sessions, resumption, and worktrees based on the task” makes the structure concrete. The useful comparison is not which name sounds more advanced, but how the data is arranged and how far the most common operation has to travel.
Read a structure through access and change
“The same Resumed sub-agent can reuse a worktree or inherit the ordinary cwd.” exposes a trade-off that is easy to miss: reading by position, looking up by key, adding at either end, inserting in the middle, and traversing relationships do not favor the same organization. A structure that is fast for one operation is not automatically fast for all of them.
- subagent_type must match the source
- An explicit Persona must match the source; if not explicitly provided, the source persona is inherited
- model is not part of the identity gate. A model override in the request is soft-ignored and pinned to the source model
Count scale and update frequency together
Use “Task A needs to continue a half-finished refactor from yesterday and keep the original worktree's uncommitted changes.” as a boundary check. Write down the data size, the dominant operation, and the latency you can accept before deciding whether an AI-generated structure actually fits.
From “Isolation is a Set of Orthogonal Dimensions” to “ContextSource::New”
“Isolation is a Set of Orthogonal Dimensions” grounds the problem in “The same Resumed sub-agent can reuse a worktree or inherit the ordinary cwd. Context continuity and file-space isolation must be evaluated independently”. “ContextSource::New” then moves it toward “A new session does not inherit history. The spawn process establishes a new system prompt and prompt context, then receives the current task input. It does not imply an independent file space — that still depen…”. Together, they show that the lesson is not just a conclusion to remember, but a claim with conditions.
Carry the judgment into the next situation
When you meet a new data structure, do not begin by memorizing its definition. Write down the most frequent operation, estimate scale and update behavior, and check whether the structure satisfies all three conditions.
- “Isolation is a Set of Orthogonal Dimensions”: The same Resumed sub-agent can reuse a worktree or inherit the ordinary cwd. Context continuity and file-space isolation must be evaluated independently
- “ContextSource::New”: A new session does not inherit history. The spawn process establishes a new system prompt and prompt context, then receives the current task input. It does not imply an independent file space — that still depen…
- “The closing point”: Resumption is rejected if the source transcript exceeds 80% of the target model's context window
The final “The closing point” brings the discussion to “Resumption is rejected if the source transcript exceeds 80% of the target model's context window”. The useful thing to carry forward is knowing which judgments must be revisited when input, scale, or risk changes.
I turned one judgment from this article into a small experiment I could run today. Knowing what to observe next is more useful than simply remembering the conclusion.
After reading this, I first looked for the conditions behind the idea instead of copying the method into a project. That order made the later trade-offs much clearer.
When this judgment reaches real work, which constraint should be added first? I am curious which step matters most between reading and the first practical attempt.
No discussion on this article yet.