•
🌱 budding
Context Engineering

Context Engineering

Context Engineering is new term gaining traction in the AI world. The conversation is shifting from “prompt engineering” to a broader, more powerful concept: Context Engineering.

Tobi Lutke describes it as “the art of providing all the context for the task to be plausibly solvable by the LLM.” and he is right.

Four Strategies for Agent Context Engineering

From LangChain’s Context Engineering for Agents (July 2025), a clean taxonomy for managing agent context windows:

  1. Write — save context outside the window (scratchpads, long-term memories) so it’s available later without consuming tokens now
  2. Select — pull the right context in at the right time (RAG for knowledge, semantic search for tool descriptions, memory retrieval)
  3. Compress — retain only tokens needed (trajectory summarization, tool output compression, message trimming)
  4. Isolate — split context across sub-agents or sandboxes so each has a focused window (multi-agent architectures, code agent sandboxes, state schemas)

Context failure modes (via Drew Breunig): poisoning (hallucination enters context), distraction (context overwhelms training), confusion (superfluous context influences response), clash (parts of context disagree).

This maps directly to the context hygiene concepts in Agent Harnesses — the “dumb zone” (~40% context fill degradation) from Dex Horthy is the empirical observation; Write/Select/Compress/Isolate is the engineering response.

Three-Tier Context Loading (Team OS pattern)

From Build a Team OS with Claude Code - Hannah Stulberg (April 2026) — a practical tiering system for repo-based context:

  1. Tier 1 — Always loaded (<500 tokens): root CLAUDE.md, team roster, channel map. Loaded every session.
  2. Tier 2 — Loaded on query (200-500 tokens each): folder-level CLAUDE.md indexes. Only loaded when Claude navigates to that folder.
  3. Tier 3 — Loaded on demand (hundreds-thousands tokens): actual content files (PRDs, transcripts, SQL). Only loaded when specifically needed.

“Thinking room” = gap between loaded info and window size. Same concept as the “dumb zone.” A customer query consumed only 3% of context window because nested CLAUDE.md files navigated directly to the right files. Without them, explore agents burn thousands of tokens just navigating.

Counter-argument: the discipline is scaffolding around a closing gap

Context engineering exists because models handle long context badly. That is a property of a model generation, not a law, and it has been improving every release. The “dumb zone” at ~40% window fill was measured on specific models; effective context has been rising as windows grow past a million tokens and long-context retrieval improves.

If that trend continues, elaborate context pipelines are capital invested in a depreciating asset. This is the Bitter Lesson applied to harnesses: hand-engineered scaffolding tends to be outrun by general methods plus more compute. Harness Simplification as Models Improve makes the argument directly — the harness code that a weaker model needed becomes dead weight once a stronger one ships.

The four strategies also carry costs the framing understates. Compression discards signal you cannot know you needed. Isolation across sub-agents breaks exactly the cross-cutting reasoning that made the task hard, and Distilling the Distillation - Why Western Open Weights Trail China notes the related failure that delegated contexts drop the standing instructions their parent had. Each strategy is a lossy trade, not a free win.

Context engineering is the core skillContext engineering is transitional
The 40% degradation pointA durable property of attentionAn artifact of one model generation
Correct investmentBuild the pipeline; it compoundsKeep the harness thin; let the model absorb the work
What happens on the next model releasePipeline gets more valuablePipeline gets partially obsolete
Failure mode to fearContext poisoning, distraction, clashSunk engineering in scaffolding nobody needs

The empirical tell. Track the usable fraction of the window per model generation rather than the nominal size, and track whether your own harness code grows or shrinks across releases. A pipeline that keeps getting longer while models keep getting better is the signature of scaffolding fighting the trend. The honest middle is that Write and Select — persisting and retrieving knowledge — look durable, because they solve a data problem rather than a model limitation; Compress and Isolate are the two most exposed to being absorbed by the next model.


Related Notes

  • Agent-Native Architecture - Five Principles for Building After Code Ends — context injection maps to agent-native principles; Write/Select pattern implements the interface layer
  • Spec-Driven Development and AI-Native SDLC - 2026 Analysis — specs are context artifacts; context engineering is the meta-skill of the AI-native SDLC
  • The Folder Is the Agent - Context Accumulation as Specialization — folder context is accumulated context engineering applied at the project level
  • The Bitter Lesson for Agent Frameworks - Browser Use — ephemeral messages pattern: mark tool outputs with a retention window to evict stale browser state, a practical Compress strategy
  • Humanising LLM Outputs is Actually Dumb — argues Compress is being applied at the wrong layer: style instructions (“short sentences”, Simplified Technical English) sit alongside task instructions, so compression runs continuously instead of once at the human boundary

Twitter Insights (Jan 2026)

→ Full index: Twitter Bookmarks Insights#Context Engineering

Deep Dives

  • @akoratana - How to build a context graph
  • @JayaGup10 - Context Graphs AI Trillion Dollar Opportunity
  • @KirkMarple - The Context Layer AI Agents Actually Need

Key Insight

“The real moat in the agent era may be the workflow memory the agent accumulates over time.” — @levie


References


2026-09 Update

Context has a formal definition now, and it is not the prompt. The systematic analysis of over 1,400 research papers (arXiv 2507.13334) defines it as “the complete information payload provided to a LLM at inference time, encompassing all structured informational components that the model needs to plausibly accomplish a given task.” Everything the model sees at inference, structured, not just the user’s turn. That definition is what makes Write / Select / Compress / Isolate operations on a single object rather than four unrelated tricks.

A measured gain from modular reasoning primitives. IBM Zurich’s cognitive tools — reasoning patterns supplied as modular prompt templates rather than as one monolithic instruction — moved GPT-4.1 from 26.7% to 43.3% on AIME2024, a 16.6-point gain. Reported via a survey repository summarizing the underlying paper, not reproduced independently here. It is one of the few context-engineering numbers in circulation attached to a public benchmark rather than an internal eval.

The mental model for advanced AI is that the models will be highly generalizable, but they need to be paired with very specific context. Precise prompts, subagents divided up by task, agent-friendly docs, knowledge access. Even as models improve, this doesn’t change.

That capture is the vault owner’s own, recorded on the “context engineering is the core skill” side of the table above. It stakes out the strong position: generality rises, specificity of context stays load-bearing, and the pipeline does not become obsolete. Worth holding against the empirical tell in the section above, which is designed to falsify exactly this claim if harness code keeps growing.

Open tension — is retrieval the right primitive at all?

Napkin - A Local-First Memory System for Agents attacks the Select strategy at its foundation. Its argument: retrieval by embedding puts the decision in the wrong model. “You have a model that understands semantics, and you bolt on a smaller, dumber model to pre-filter information before the smart one ever sees it. The embedding model makes the retrieval decisions. That’s backwards.” Its alternative gives the large model a TF-IDF keyword map of the corpus and lets it navigate, with BM25 search underneath and no embeddings anywhere.

This note treats Select as the most durable of the four strategies because it solves a data problem rather than a model limitation. Napkin agrees that the problem is real — the model does not know the corpus taxonomy — and disagrees about who should solve it. If the map is enough for the model to navigate itself, the durable part of Select is the map, and the vector pipeline is scaffolding of the kind the right-hand column of the table predicts gets absorbed.

Neither side has the evidence to close this. Napkin’s author published no benchmarks and no comparison against a RAG baseline. The counter-position rests on the general observation that embeddings surface material whose vocabulary the requester could not have guessed, which a keyword map by construction cannot do. Both claims remain open, and the disagreement is the useful artifact.

Sources added 2026-09-07

  • Simon Willison - Agentic Engineering Patterns — collects chapters on durable context, subagent isolation, and executable evidence
  • Hermes Agent Master Class Part 1 - How Hermes Agent Actually Processes Work — source account of prompt assembly, cached session context, compression, and tool-result reinjection
  • Hermes Agent Master Class Part 3 - The Learning System — source account of bounded memory, on-demand history, progressively disclosed skills, and curation
  • Stable Prompts Trade Immediate Memory Visibility for Cache Efficiency — applies write and compress boundaries to the tension between prompt caching and newly persisted memory
  • Agent Learning Is Curated Context, Not Model Training — shows how selective durable context creates agent improvement without model retraining
  • Cost Per Right Answer as the Metric for Agentic Data Pipelines — what context quality buys in a research pipeline: a higher share of correct answers per dollar spent
  • Running a Software Factory Efficiently at Uber Scale — context engineering as a cost lever: schema overhead and cache TTL measured at scale
  • Understanding Spec-Driven Development - Kiro, spec-kit, and Tessl — the specs-versus-memory-bank distinction, which is a context-scoping question
  • AI Style Guides - How to Help AI Write Like You — a style guide is reusable context, not a prompt — the same distinction applied to voice
  • Hermes Agent Master Class Part 8 - Delegation and Subagents — puts Isolate into practice: each child gets a private context, so its brief must be self-contained and its compressed return still needs parent verification
  • How to Build a Custom Agent Harness — shows how lifecycle middleware can implement context selection, persistence, compaction, and isolation inside the agent loop
  • Program Design Is the Missing Layer Between Architecture and Implementation — turns architecture into task-specific structural context before code generation
Connected Notes