Lv.1 0 XP

Context Isolation Patterns — Keeping Agent Sessions Clean

Core 6 min +25 XP
💡
THE ANALOGY

Clean rooms in semiconductor manufacturing. Contamination from one process doesn't affect the next. Each agent session is a clean room — what happened in the last session doesn't contaminate the current one unless you explicitly bring it in.

⚠️ EXAM TRAP — The Wrong Answer People Choose

Assuming context isolation happens automatically. It doesn't — you must actively design for it. Without explicit design, tool results, conversation history, and stale facts bleed between sessions and phases.

KEY POINTS
1 Session isolation: each new session starts with only what you explicitly pass — no automatic carry-over.
2 Phase isolation: within a long session, use subagents to isolate exploratory phases from implementation phases.
3 Tool result isolation: trim and extract before adding to conversation — don't let full results accumulate.
4 Stale context prevention: when environment changes, don't resume stale sessions — start fresh with a briefing.
5 The Explore subagent is the primary isolation mechanism for verbose discovery within a session.