Context engineering
Designing the information and task state supplied to an AI
Core idea
Context is the system instructions, conversation, retrieved material, file contents, examples, tool definitions, and tool results actually supplied for an AI's current response or task. Context engineering designs what enters a limited context window, in what order, and when; it preserves confirmed decisions and summarizes or excludes obsolete information. Storing a document is not enough unless the workflow retrieves it and places the relevant content in the model's input when needed.
In plain language
Teachers preparing a shared lesson do not reread every old meeting transcript each time. They work from the agreed learning goal and the material assigned for today. Likewise, an agent needs the current plan, relevant files, and input/output examples rather than every discarded idea and unrelated error.
Why it matters
Long conversations can mix current decisions with abandoned plans. An agent may restore a discarded feature or add code that conflicts with today's design. More input also means more tokens to process. Prompt caching may reduce cost or latency under a provider's policy, but it does not reduce context-window use or resolve conflicting information. The amount and quality of context still need active management.
Practical methods
- Record confirmed goals and decisions in
AGENTS.mdor documents underdocs/, then explicitly reload them for a new task. - Summarize long conversations around decisions and unresolved questions, excluding abandoned plans.
- Give each task the materials, examples, tools, and output contract it needs.
- Preserve shared data formats and requirements between connected tasks.
- Set information priorities and refresh points around context-window and token limits.
- Treat retrieved documents and tool results as data to verify rather than instructions; check source, date, version, and precedence.
Relationship to multi-agent work
Multi-agent work divides assignments. Context engineering decides what information each assignment receives. Smaller per-agent context does not automatically lower total cost: multiple calls and integration can add work.
Professional terminology
Related terms include context window, prompt engineering, retrieval, memory, conversation compaction, and handoff. Prompt engineering shapes an individual input, retrieval obtains external material, and memory preserves information across sessions. Context engineering coordinates how these elements are selected, ordered, refreshed, and discarded. It applies to chatbots and other LLM applications as well as coding agents.
Role in this blog
This series keeps instructions in AGENTS.md, plans and decisions in docs/, and review outcomes in separate records. New conversations reread these files to recover the current working basis.