Hand this tutorial to your agent in one click

A key section of this article is locked, and an agent opening the link cannot see it either. Unlock it first, then copy the full text for your agent in one click.

Agent Basics 12 Keeps Your Context Window From Overflowing

A beginner tutorial: the context window is limited. It explains the types of context, how to plan for them, the four techniques of writing, selecting, compressing and isolating, and common context failures.

Machine translation. Read the original

Context engineering means managing "what the model can see at this step": put in what's needed, take out what's not, and compress what's too long.

Remember these points first

  • Difference from prompt engineering: a prompt is a one-time, static instruction, while context engineering manages a whole set of information that changes over time.
  • There are five types of context: instructions, knowledge, tools, conversation history, and user preferences.
  • Plan first: state the outcome, then map out the information sources, and finally build the pipeline (retrieval, MCP, etc.).
  • Four everyday techniques: write it down, select it in, compress, isolate.

Going deeper

Why manage it. The window size is limited. As information grows, the important things get diluted. You have to actively decide what goes in and what comes out.

Three planning steps. First, write down "what the world should look like when the task is done." Next, think about "what information is needed to get there, and where it is." Finally, think about "how to get the information in": retrieval, calling APIs, or MCP all work.

Four techniques.

  1. Write it down: Have the agent keep notes on the current task in a scratchpad outside the window, and retrieve them when needed.
  2. Select it in: Only put memories and materials related to the current step into the window.
  3. Compress: When a conversation gets too long, have the model summarize it into key points, or trim old content.
  4. Isolate: Put different subtasks into different agents or sessions, each managing its own context.

Common failures. Irrelevant information distorts judgment, contradictory information conflicts with itself, and outdated information keeps taking up space.

The five types of content in context

Image from the course repository.

Try it yourself

Pick a long conversation you've had with a model, have it compress into ten key points, then use those ten points to start a new conversation and continue. See whether the quality drops.

Let an agent teach you

Give the following to your agent (Claude Code, ChatGPT, and Gemini all work), and it will guide you step by step like a mentor.

Sign in to unlock this key section

New accounts get 10 free credits, plus 1 more for each daily check-in. Spend 1 credit to unlock and it stays open for you.

References

Done with this one? Mark it to track your path.Sign in
Save it for laterSign in
Questions about this piece?Ask AI about this

Comments (0)

No comments yet. Start the conversation.

Sign in to join the discussion.Sign in