Start free

Zero to FDE / Blog / Context engineering explained: beyond prompt engineering

Blog

Context engineering explained: beyond prompt engineering

Context engineering is deciding what information a language model sees at each step, so that it has what it needs and little else. Prompt engineering covers the instructions you write. Context engineering covers the whole window: instructions, tool definitions, retrieved documents, conversation history and tool results.

Why the term appeared

A single question and answer has a small, fixed context. An agent that runs for fifty steps does not: every tool result is added to the window, and most of it is no longer relevant by step thirty. Anthropic’s engineering team describes the task as asking what configuration of context is most likely to produce the behaviour you want, and notes that the curation happens again every time something is passed to the model.1

Context rot

More context is not free. The same article uses “context rot” for the effect that as the window fills, “the model’s ability to accurately recall information from that context decreases.”1 A long, cluttered window also costs more and is slower. The aim is the smallest set of high-value tokens.

Four techniques

TechniqueWhat it doesWhen to use it
Just-in-time retrievalKeep a reference such as a file path or query, and load the content with a tool only when neededLarge knowledge bases, codebases
CompactionWhen the window is nearly full, summarise it and continue from the summaryLong conversations
Structured note-takingThe agent writes notes outside the window, such as a to-do file, and reads them back laterMulti-hour tasks
Sub-agentsA specialised agent works in a clean window and returns a short summary to the lead agentResearch and parallel work

All four are described in Anthropic’s article.1

A practical starting list

  • Write a short, specific system prompt. Remove anything the model would do correctly without being told.
  • Keep tool descriptions precise and tool results small. Return the ten rows that matter, not a thousand.
  • Retrieve less, better. Three relevant passages beat twenty loosely related ones.
  • Decide what happens when the window fills before it happens.
  • Measure. Change one thing and run your evals again.

Related: what RAG is, what an AI agent is and agents versus workflows. Memory and context management for agents are Weeks 4 and 5 of the Zero to FDE roadmap.

Zero to FDE is a self-paced 16-week course, ₹2,999 once, with a 7-day full refund. Week 1 is free, and one Week 4 lesson is free if you already write backend code. It has no live classes, no mentors and no accredited certificate.

Sources

  1. Anthropic, “Effective context engineering for AI agents” (29 September 2025)

Zero to FDE is a 16-week path, for working engineers and AIML graduates, to the work Forward Deployed Engineers do: backend basics, LLMs, RAG, agents, evaluation and deployment, with a shipped deliverable every week. Week 1 is free and complete, no card needed.

Start Week 1 free

More from the blog