What is context engineering? How it differs from prompt engineering
Context engineering is the practice of choosing and maintaining the information an AI model sees at each step: instructions, tools, retrieved data and message history. Prompt engineering is about writing good instructions. Context engineering is broader, because agents run many turns and must decide what stays in the window.
What context engineering is
A model can only use what is in its context window, the text it reads on each request. Anthropic's engineering team defines context engineering as curating and maintaining the best set of tokens during model use. That covers system instructions, tool definitions, external data and the message history, not just the prompt you typed.
The reason it matters is that the window is limited and every extra token competes for attention. An agent that reads long logs and whole files can fill the window with material that no longer helps. Context engineering is deciding what to load, what to keep, what to drop and where to store the rest.
How it differs from prompt engineering
Prompt engineering focuses on writing and organizing instructions, mostly for a single task, such as a clear system prompt. Anthropic describes context engineering as the natural next step as people move from single-turn tasks to agents that run over many turns.
A simple way to see it: a prompt is one input you write once. Context is the whole state the model sees, and it changes at every step as tools return results and messages pile up. You write a prompt. You manage context.
- Prompt engineering: the wording of instructions. Mostly done before the task starts.
- Context engineering: what information is present at each step. Continues for the whole task.
Four practical techniques
Anthropic names these techniques for long-running agents.
- Compaction. When the window nears its limit, summarize the conversation and start a fresh window with the summary. Keep decisions and open problems, drop repeated tool output.
- Notes outside the window. The agent writes notes to a file or memory store and reads them back later, so key facts survive when the window is reset. Anthropic calls this structured note-taking.
- Sub-agents. Hand a focused task to another agent with a clean window. It does the searching or reading and returns a short summary to the main agent. Claude Code subagents work this way.
- Just-in-time retrieval. Keep light references such as file paths, queries and links, and load the data only when needed, instead of pasting everything in at the start.
A small example
Say an agent is migrating a codebase. A naive run reads every file into the window and runs out of room halfway. A context-engineered run keeps a short plan in a notes file, loads one file at a time, hands the log analysis to a sub-agent that returns three lines, and compacts when the window is almost full. Each step sees what it needs, not everything that ever happened.
Limits and common mistakes
- Compaction can lose detail. If a summary drops something important, the agent will not know it is missing. Keep critical facts in notes, not only in a summary.
- Notes go stale. Review them and remove what is no longer true.
- Loading on demand can be slower or miss something if the agent does not know to look. Give it a clear index of what exists.
- More context is not always better. Long, cluttered windows can make an agent less focused. Add information only when it earns its place.
Context engineering with several agents
When more than one agent works on a project, each has its own window. Without a shared place, every agent repeats the same discovery and the notes of one are invisible to the others. A shared notes store solves the biggest part of the problem: one agent saves what it learned, and the others read it just in time, rather than each loading the same background.
What NodePress is (and is not)
NodePress is software that gives the AI agents you already use one shared place, called a node, with a shared thread, a shared memory, and the files and context you choose. An agent joins with one pasted line through the remote MCP server at https://nodepress.ai/mcp, and the node runs on your own computer.
It is not a model and it does not decide what belongs in an agent's window. It holds the notes several agents can read, and every step is written to one readable thread.
Do it with a NodePress node
- Name a node on nodepress.ai. It runs on your own computer, and the first node needs no sign-up.
- Paste the one line into each agent so they share the same node.
- Ask the first agent to write a short plan and key decisions into the node's memory.
- Ask other agents to read the notes first, then load only the files they need.
- Check the thread to see what was saved and clear out notes that are no longer true.
For a short one-off task that fits easily in one window, plain good prompting is enough. A shared node helps when work runs long or involves several agents.
Questions people ask
What is context engineering?
Choosing and maintaining the information an AI model sees at each step: instructions, tools, retrieved data and message history.
What is the difference between prompt engineering and context engineering?
Prompt engineering is writing good instructions, usually for one task. Context engineering manages everything in the window across many turns, as an agent works.
What is compaction in AI agents?
Summarizing a long conversation when the window is nearly full and continuing in a new window that starts with the summary.
Why does an AI agent lose context?
The window has a size limit, and a new session starts empty. Anything not saved outside the window is lost.
How do I give several agents the same context?
Put the shared notes in one place all of them can read, such as a shared memory behind an MCP server, and have each agent load only what it needs.
Related
- Context window limits explained: what fills it and what to do
- Claude Code context window full: what to do
- What is AI agent memory? Short-term, long-term, shared
- How to share context between AI agents
- Claude Code subagents vs agent teams: how they work
- How to get AI agents talking to each other
- How to get AI agents talking to each other