Context engineering means deciding what information an AI model sees when it answers, and when it sees it. That includes your instructions, the documents you share, examples, the tools it can call and anything it remembers from before. The aim is to give the model what it needs and little else.
If prompt engineering is about how you ask, context engineering is about what is on the table when you ask. This article explains the idea with a plain example, then looks at why more is not always better. The terms in this field are young and still moving, so use this as a guide rather than a rulebook.
What "context" means
An AI model answers based on the text in front of it at that moment. Anthropic's engineering team defines context as the set of tokens included when sampling from a large language model. In plain words, tokens are small pieces of text. Context is all the text the model can look at while it writes its reply.
That text can come from several places.
- Instructions: the system prompt or the message you type.
- Documents and data: files, web pages or records you attach or the tool retrieves.
- Examples: samples that show the style or format you want.
- Tools: descriptions of what the model can do, and the results those tools send back.
- History and memory: earlier messages in the conversation, or notes saved from earlier sessions.
Why this became its own topic
In the early days, most use of AI was a single question and a single answer, so the wording of the prompt was the main thing. Anthropic's article on context engineering says that as people build more capable agents that work over many steps, they need strategies for managing the whole context state, not just the prompt. An agent running in a loop produces more and more material that might be useful next time, and someone has to decide what stays.
The article describes context engineering as the art and science of curating what goes into the limited context window from a constantly changing universe of possible information. It also notes that, unlike writing one prompt, this is iterative, because the choice is made again each time the model is called.
Why more is not always better
It is tempting to paste everything in "just in case". Anthropic's engineering article argues against that. It says the context should be treated as a finite resource, and that models, like people, can lose focus when there is too much to hold. It uses the term "context rot" for the observation that as the amount of text grows, the model's ability to recall information accurately can drop. It adds that this is a gradual slope, not a sudden cliff, and that models differ.
Its guiding principle is to find the smallest possible set of high-signal information that makes the desired result most likely. The article is careful to say that minimal does not necessarily mean short. You still need to give enough detail for the job.
A non-code picture helps. Imagine briefing a new colleague before a meeting. If you hand over a single clear page, they can act. If you hand over a filing cabinet, they will spend the meeting searching it. Both briefs contain the facts, but only one is usable.
What it looks like in everyday use
You already do context engineering when you use an AI tool, even if you never use the term.
- Attach the one relevant document instead of the whole folder.
- Say who the answer is for and what to ignore.
- Add a short sample of the style you want.
- Start a new conversation when the old one has drifted, and paste in a short summary of what matters.
- Keep a small "about me and my work" note you can reuse, rather than retyping the background each time.
Be careful about what you share. Leave out private personal data, passwords and anything your organisation does not allow in an AI tool.
What it looks like for developers
For people building AI products, the same idea shows up as design choices. Anthropic's article walks through several of them.
- System prompts should be clear and pitched at the "right altitude": specific enough to guide behaviour, but not a brittle pile of hard-coded rules and not so vague that it assumes shared knowledge.
- Tools should be few, clear and not overlapping. The article says that if a human engineer cannot say which tool fits a situation, an agent cannot be expected to do better.
- Examples should be a small set of varied, representative cases rather than a long list of every edge case.
- Retrieval can happen "just in time". Instead of loading everything first, an agent keeps light references such as file paths or links, and loads the data when it needs it.
- For long tasks, the article describes compaction, which summarises older content, and keeping notes outside the context window so the agent can pick them up later.
Limits and cautions
Good context does not remove the need for checking. A model can still misread a document or invent a detail. Also, the advice itself is changing. The same Anthropic article says that smarter models need less prescriptive engineering, which means some tricks that matter today may matter less later. Features and limits differ by tool and plan, and they change over time.
If you want a starting rule, use this one. Before you add something to the conversation, ask whether the model needs it for this step. If the answer is no, leave it out.
Sources used for this article, as they stood when we read them. Pages may change after we publish.
- Anthropic, Effective context engineering for AI agents: https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents
- Anthropic, Prompting best practices: https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices
Common questions
Is context engineering the same as prompt engineering?
No. Prompt engineering is about writing a good instruction. Context engineering is wider. It covers everything the model sees when it answers: instructions, documents, examples, tool results, earlier messages and memory. Anthropic describes it as the natural progression of prompt engineering.
What is a context window?
It is the amount of text an AI model can take in and work with at one time. Everything in your conversation, including documents you add and the tool's own earlier replies, has to fit inside it.
Can I do context engineering without coding?
Yes. When you choose which document to attach, trim a long chat, start a fresh conversation, or write a short brief of facts, you are doing it by hand. Developers do the same thing with software.
Official pages to check
AI tools change quickly. Check the vendor's current help page before you act, and review anything an AI tool produces before you rely on it.