English static mirror for SEO/GEO · AI-assisted translation · Read Chinese original

Context Engineering: Tidying Up AI's Desk

Forum topic · 小凯 · 2026-06-27

Summary

This article explains context engineering — the practice of deciding what information goes into an AI model's limited context window, how, and when. Using the metaphor of a cluttered desk, it introduces the four core operations (write, select, compress, isolate) popularized by LangChain's Lance Martin, and highlights practical techniques from Anthropic's 2025 guide, such as balanced instructions, minimal tool sets, curated examples, compressing long histories into summaries, placing key information at the start or end, and stabilizing static prefixes to save computation. A worked example shows how a single customer-service request assembles system instructions, selected retrieval content, compressed chat history, and the current question into one prompt. The author argues that as context windows grew from 8K to 200K tokens, context engineering becomes more important, not less, because model attention does not scale proportionally. Source: easy-learn-ai project, commit 9621a05.

Context Engineering: Tidying Up AI's Desk

> Source: easy-learn-ai project, commit 9621a05

An Action You Perform Every Day

Imagine sitting at a desk with a thick book open, some notes, a phone, and half a cup of cold coffee. Someone walks in and asks: "Did we change point two on page three of that proposal we discussed?"

Your first reaction isn't to answer — it's to search. You scan the desk, pull page three from the notes, check point two, then speak. You do this dozens of times a day.

But what if your desk could only hold three items? Open the book and the phone falls off; pick up the phone and the notes blow away. Could you still answer?

That's exactly the problem AI faces.

How Big Is AI's "Field of View"?

Every time you send a message to an AI, it "sees" more than just that message. It also sees: previous chat history, uploaded materials, and system instructions. This entire bundle is the "context" for the task.

The problem: this field of view has limited capacity. The industry calls this ceiling the Context Window. You don't need to memorize the term — just understand that AI can only take in a finite amount at once, like a fixed-size desk. When it's full, new items require moving old ones out.

If the information you push out happens to be a key clue — say, the return reason the user mentioned three days ago — the AI starts forgetting and missing the point. You ask "Can I still return this?" and it replies "What did you buy?" — because "bought model A, arrived three days ago" was already squeezed out.

So what to include, what to drop, and how to place it becomes a craft. That craft is called Context Engineering.

Four Operations to Tidy the Desk

All context management techniques fall into four operations — a framework popularized by Lance Martin at LangChain:

1. Write

Park content you don't immediately need outside the window and retrieve it later.

Like solving a long math problem: once you get an intermediate result at step three and your head can't hold it, write it on scratch paper. AI can likewise write key conclusions into a "scratchpad" file and read it back when needed.

2. Select

Don't stuff all materials in; pick only what's needed into the window.

When the user asks about reimbursement policy, retrieve only the "reimbursement" page — not the entire 500-page employee handbook. Filling the window with everything drowns the half-page that actually matters.

3. Compress

Shrink long, verbose content into short summaries to free up window space.

After fifty rounds of chat, the window is nearly full. Summarize the old conversation into one line: "User bought model A, arrived three days ago, wants to return it." Drop the details, keep the key facts — like consolidating a stack of receipts into a single number.

4. Isolate

Split the task across multiple AIs, each seeing only its own portion.

If one window can't fit everything, distribute it: the researcher sees only materials, the coder sees only code, the reviewer sees only results. Each AI's context shrinks dramatically, so attention stays focused. A future article on Multi-Agent systems will cover this in depth.

Nine Practical Techniques You Can Use Today

Anthropic's 2025 article summarized nine common techniques. Highlights:

  • Instructions: neither too rigid nor too vague — give clear, sufficient guidance, but don't hard-code every edge-case rule. Leave room for the AI to judge. Overly controlling instructions make models either rebellious or dumb — like overbearing parenting.
  • Keep only enough tools — a pile of overlapping tools confuses the AI into picking wrong ones. Curate a small set with clear, non-overlapping responsibilities.
  • Pick typical examples — don't dump dozens of edge cases into the prompt. A few representative examples beat a long list of rules.
  • Compress long histories into summaries — fifty prior turns become a brief "progress so far" summary. A rite of passage for anyone building long-conversation products.
  • Place key information at the start or end — critical content buried mid-paragraph gets overlooked. Put the most important parts in prominent positions, like a news article's inverted pyramid.
  • Keep the prefix stable — if the beginning of each request keeps changing, it's recomputed every time: slow and costly. Fix the constant prefix at the front so the system can skip redundant computation. Many people don't know this trick, but the savings are real.
  • A Walkthrough: How One Request's Context Is Assembled

    Suppose a user asks a support question: "Can I still return this?"

    The AI's context is assembled from four pieces:

  • System instructions (18%): "You are the company's support assistant; answer only product-related questions; be friendly." Present every time; defines role and boundaries. Keep it lean and stable.
  • Selected materials (30%): Only the "returns" section of the policy is retrieved — not the whole handbook. This is "select": pull in only what's needed.
  • Compressed history (22%): Twenty prior turns become one line: "User bought model A, arrived three days ago, wants to return it." This is "compress": summarize old turns without losing key facts.
  • Current question (12%): Finally, the user's message itself, placed prominently so it isn't buried.
  • Four pieces, window exactly full, priorities clear. This daily assembling and curating is context engineering in practice.

    Why Context Engineering Matters More and More

    From 2024 to 2026, context windows grew from 8K to 128K and even 200K tokens. The desk got bigger — so is tidying unnecessary?

    Quite the opposite. The bigger the desk, the more you need someone who can organize it.

    The model's visible range expanded, but its attention did not scale proportionally. Feed it an entire book and it can technically "see" every page, yet it's more likely to miss the point — like walking into a library where every book is reachable but no one tells you which one matters.

    So context engineering isn't a stopgap; it becomes more central as models grow stronger. The competitive edge of future AI products may depend less on who uses the biggest model, and more on who tidies the desk better.

    References

  • Anthropic, "Effective Context Engineering for AI Agents" (2025-09)
  • LangChain four-category framework (Lance Martin)
  • easy-learn-ai context engineering module (commit 9621a05)

Tags

#context-engineering#llm#prompt-engineering#anthropic#langchain#ai-agents#context-window

This page is an English static mirror generated for search and AI citation. It may be a full translation or structured summary of the Chinese original. Canonical interactive discussion lives on the Chinese page: https://zhichai.net/topic/178208218