← Back

Context is all you need

·Bryan Lai

System performance in LLM applications depends primarily on context quality rather than minor benchmark differences between frontier models. Providing structured, relevant context to a smaller model frequently yields better outputs than feeding unstructured prompt dumps to a larger model.


The Bottleneck of Unstructured Context

Evaluating agentic systems on single-turn static benchmarks fails to reflect multi-turn durability. A model with a minor benchmark advantage may still fail at turn 50 if working memory is unmanaged. [1]


Operating System Metaphor for Agent Harnesses

Agent architecture maps cleanly to operating system abstractions: [2]

  • Model (CPU): Raw inference compute.
  • Context Window (RAM): Volatile, token-bounded working memory.
  • Agent Harness (Operating System): Manages state persistence, tool dispatch, prompt lifecycle, and memory compaction.
  • Agent (Application): Specific task logic running on top of the harness.

Building durable agents requires prioritizing harness architecture (memory management, tool scope, and state isolation) over raw model selection.


The Four Pillars of Context Engineering

Effective context engineering relies on four core patterns: [3]

1. Write (External Memory Persistence)

Working memory in the context window degrades over multi-step executions. Agents must write intermediate outputs to durable storage (scratchpads, state files, or database entries) and retrieve them explicitly when needed.

2. Select (Dynamic Retrieval)

Avoid loading complete documentation sets into the prompt. Retrieve only the artifacts required for the current execution step.

3. Compress (Compaction & Summarization)

  • Compaction: Replace verbose text blocks or tool outputs with file paths or references.
  • Summarization: Condense older turn history while preserving raw tokens for recent steps to maintain execution rhythm. [4]

4. Isolate (Sub-Agent Task Decomposition)

Distribute broad tasks across focused sub-agents to avoid context pollution. Sub-agents execute bounded sub-tasks and return concise summaries to the primary agent. [5]


Applying the Bitter Lesson

Systems that hand-code rigid, complex agent workflows quickly become obsolete as model reasoning improves. [6] Simplifying the harness—reducing tool count and token overhead—consistently improves execution speed and reliability. Harnesses should be designed for minimal complexity, shrinking as base model capabilities advance.


Engineering Mindset Shift

Traditional software engineering enforces deterministic control flows and static schema validation. Agentic systems require handing partial control flow to probabilistic models, treating natural language as state, and feeding runtime errors back into the context window as new observations for self-correction. [7]


Implementation Pattern

The core agent control loop remains straightforward: [8]

while True: response = model.generate(context + tools) if response.has_tool_calls: results = execute(response.tool_calls) context.append(results) else: return response.text

Harness complexity exists to preserve context fidelity across extended iterations.


The Harness as Operational Moat

Model APIs are interchangeable commodities; context discipline is not. The primary engineering challenge lies in managing context across extended execution paths, isolating sub-task environments, and extracting failure patterns into reusable system prompts and evals. [9]


Summary

Focusing on context engineering—Write, Select, Compress, and Isolate—provides greater reliability improvements than continuously migrating between model providers. Context discipline forms the foundation of robust agentic software.


Notes

[1] Philschmid argues the gap between top models on static benchmarks is shrinking, but "durability," meaning how well a model follows instructions over hundreds of tool calls, is where the real difference lives. Standard benchmarks cannot detect this.

[2] This CPU/RAM/OS/App metaphor comes from philschmid's "The importance of Agent Harness in 2026." It is the cleanest framing I have found for agent architecture.

[3] These four pillars, Write, Select, Compress, and Isolate, are synthesized from Manus's context engineering blog and philschmid's "Context Engineering for AI Agents: Part 2."

[4] Manus discovered that keeping the last few tool calls raw, not summarized, preserves the model's "rhythm": formatting style and output quality. Summarize old context. Keep recent context raw.

[5] Peak Ji from Manus references this Go concurrency principle for multi-agent architecture. Shared context = shared confusion. Communicate results, not memory.

[6] All three examples, Manus, LangChain, and Vercel, are documented. The pattern is consistent: teams that simplify their harness outperform teams that complexify it. The Bitter Lesson is real and happening now.

[7] Heavily influenced by philschmid's "Why (Senior) Engineers Struggle to Build AI Agents." If you are a senior engineer reading this and feeling attacked, good. Go read that post. Then delete half your agent's code.

[8] Philschmid's "Practical Guide on how to build an Agent from scratch with Gemini 3" builds a working agent in under 100 lines of Python. The core loop is this simple. Everything else is context management.

[9] Google's Interactions API is interesting because it handles server-side state through previous_interaction_id, so you do not manage history manually. The harness absorbs complexity so the agent can focus on the task.


Edited: Refactored for conciseness and technical clarity.