Context engineering
Choose what goes in front of Claude, put it in the right order, trim what doesn't change the answer, and carry state across sessions with a file.
-
What Is Context Engineering, and How Do You Do It in Claude? Context engineering means choosing what's in front of Claude when it answers: instructions, files, history, tool definitions and tool results. Level 4: Multi-tool systems1M-token window
- System prompt
- Messages
- Tool results
- Images and documents
- Tool definitions
- Output, including thinking
-
How Do You Give Claude Memory Across a Long Project? Keep a short file with what's done, what's next and what was decided, and have each session read it first and update it last. Level 4: Multi-tool systems
- 1Read the progress notes
- 2Do one feature
- 3Verify it end to end
- 4Update the notes
The next session starts here -
Where Should Important Context Go in a Claude Prompt? With long inputs, put the documents at the top of the prompt and your question at the end. Level 4: Multi-tool systems
- 1Long documents, in tagstop
- 2Instructions and examplesafter the data
- 3Your specific questionlast
-
How Do You Trim Context Without Hurting Claude's Answer? For each thing in your prompt, ask whether the answer would change without it. Level 4: Multi-tool systemsCutno change in the answer
- old tool output
- pleasantries and history
- unused fields in data
Keepthe answer depends on it- constraints and numbers
- the audience
- the section being asked about
The problem has changed
Older advice focused on fitting into the window. With a 1M-token window on current models, and compaction handling long sessions, running out of room is now rare. The problem now is quality. Anthropic's docs warn that accuracy and recall degrade as tokens grow, which they call context rot. So the question has moved from what fits to what deserves to be there.
Where context actually comes from
Much of it isn't what you typed. Project knowledge, memory, CLAUDE.md, tool definitions, tool results, earlier thinking and uploaded files can all be in play. Before tuning a prompt, work out what else Claude can already see. On the API, the usage field shows what each request consumed. In a chat, the simple test is to open a new one and see whether the answer improves.
What is the difference between prompt engineering and context engineering?
Prompt engineering is about wording your instructions. Context engineering is about everything else the model sees, including files, history, memory and tools. Anthropic's engineering guide treats it as the next step beyond prompt engineering, especially for agents.
What happens when a Claude chat gets too long?
On paid plans, automatic context management summarizes earlier messages to make room, if code execution is on. Your full history is preserved, but longer chats use more of your usage limit. Starting a new chat with a short summary is often better.
Should I put my question before or after a long document?
After. Anthropic's guidance for inputs of about 20k tokens or more is to place long documents near the top and your query at the end, which it says can improve response quality by up to 30 percent in tests.
How do I make Claude remember things between sessions?
In the apps, use memory and project knowledge. In Claude Code, use CLAUDE.md for your instructions, and auto memory for Claude's own notes. For a long project, keep a short progress file that each session reads first and updates last.