The Four Core Strategies of Context Engineering

The Four Core Strategies of Context Engineering

The Four Core Strategies of Context Engineering: Write, Select, Compress, Isolate

Nearly every production context system relies on the same four strategies. Given clean names by the LangChain team but emerging independently across many teams, they form the foundation of how serious agents manage context. Here is what each does.

When you study how production AI systems actually manage context, a striking pattern emerges: they all converge on the same four strategies. Different teams, different products, different frameworks, yet the same underlying moves. The LangChain team gave them clean names, Write, Select, Compress, and Isolate, but the strategies themselves arose independently because they address the fundamental constraints of working with context windows.

Write: Persisting Context Externally

Writing context means saving information outside the context window so it is available without consuming tokens in the message history. The classic implementation is a scratchpad: as an agent works, it writes notes, intermediate results, and discoveries to external storage, keeping only a reference in the active context. This directly attacks the token-accumulation problem that plagues long-running agents.

The human analogy is taking notes. When you solve a complex problem, you do not hold every detail in your head; you write things down and refer back. Agents gain the same capability through the write strategy, persisting what they learn so it survives beyond the immediate window.

Context Engineering: The Complete Guide

Want each strategy explained in implementable depth?

40 pages covering the four core strategies, the context window anatomy, all four failure modes, RAG, memory systems, multi-agent isolation, 20 production patterns and a complete 30-day mastery plan.

Get the Complete Guide →

Select: Pulling Only What Matters

Selecting context means retrieving only the information relevant to the current step, rather than including everything that might conceivably help. This is where RAG, semantic search, and relevance scoring live. A striking example: one insurance company found that curating a targeted schema of relevant policy data reached over 95% accuracy, while feeding the full document corpus achieved far less. Signal-to-noise matters more than total information.

Compress: Shrinking Without Losing Meaning

Compressing context means reducing its size while preserving what matters. The most common technique is summarisation: when a conversation or set of tool outputs grows token-heavy, summarise it into a compact form that retains the essential facts while discarding verbose detail. The challenge is avoiding lossy summarisation that discards something critical, which is why good compression is structured rather than free-form.

Isolate: Separating Context Cleanly

Isolating context means separating different types or domains of context to prevent interference. In multi-agent systems, each sub-agent operates with its own clean context relevant only to its sub-task, rather than sharing one enormous polluted context. Isolation is what makes multi-agent architectures work: rather than one agent drowning in combined context, a coordinator spawns focused sub-agents, each with a clean scope.

Combining All Four

The strategies are not mutually exclusive; the best systems combine all four. A well-engineered agent writes intermediate results to a scratchpad, selects only relevant documents via retrieval, compresses conversation history when it grows long, and isolates sub-tasks into focused sub-agents. Mastery is knowing which strategy each problem calls for, and most real problems call for several at once.

Ready to engineer context deliberately?

Context Engineering: The Complete Guide covers everything: the anatomy of a context window, the four core strategies (Write, Select, Compress, Isolate), RAG and memory systems, multi-agent isolation, the four failure modes and how to diagnose them, what the research says about formats, 20 production patterns, 12 common pitfalls, and a 30-day plan that takes you from the concepts to real production systems.

Get the Complete Guide →

Instant PDF download · 40 pages · Current as of 2026