On this page
  1. What is context engineering?
  2. Why it matters
  3. How to do it
  4. Where AI coding assistants get this wrong
  5. Checklist
  6. FAQ
    1. Is context engineering the same as prompt engineering?
    2. What is a context window?
    3. How does this relate to RAG?
  7. Related topics
  8. Sources
concept

What Is Context Engineering?

Context engineering is the skill of curating what an AI model sees so it produces the right output. Learn why it's replacing prompt engineering.

Quick answer

  • Context engineering is deliberately selecting and structuring the information you give an AI model.
  • It treats the context window — the model’s working memory — as a scarce resource to be curated, not dumped into.
  • As models improve at following instructions, what you show them matters more than how you phrase the instruction.

What is context engineering?

Context engineering is the practice of assembling, ordering, and maintaining the information an AI model receives — files, specs, conversation history, tool output — so that the model produces the right result. Where prompt engineering is about phrasing the instruction, context engineering is about curating the environment the instruction lives in. The term gained currency in 2025–2026 as practitioners realized output quality depends more on context than on clever wording.

Why it matters

A model can only reason about what’s in its context window. Feed it the wrong file, an outdated spec, or a conversation bloated with dead ends, and even a perfect model produces the wrong answer. Feed it the exact relevant slice — the spec, the two files it’s touching, the failing test — and a mediocre prompt still works. Context is the input; the answer is only as good as the input.

How to do it

Curate deliberately. Include the spec and the relevant code, not the whole repo. Prune stale conversation turns and irrelevant files. Keep a living summary of decisions so the model isn’t reconstructing them from scratch. When an agent goes off track, the first question is “what did I put in its context?” — not just “how should I rephrase the prompt?”

Where this bites vibecoders

The vibecoder’s instinct is to paste everything and hope. But a bloated, contradictory context is exactly what causes the assistant to break working code or drift from the goal — context decay, the failure spec-driven development exists to prevent. The skill is curation: small, current, relevant context beats a big, stale one every time.

Where AI coding assistants get this wrong

  • Filling context with irrelevant files because “more is better.”
  • Losing track of decisions across a long session and acting on stale assumptions.
  • Re-reading entire files when a targeted excerpt would suffice.
  • Mis-weighting contradictory information instead of flagging it.

Checklist

  • Include only the context the task actually needs.
  • Keep a current summary of decisions and constraints in context.
  • Prune stale turns and irrelevant files before re-prompting.
  • Give the model the spec, not just the request.
  • When output drifts, audit the context before rephrasing the prompt.

FAQ

Is context engineering the same as prompt engineering?

They overlap but aren’t the same. Prompt engineering is phrasing the instruction; context engineering is selecting and structuring everything around it — files, history, specs. As models get better at following instructions, context engineering is where the leverage is.

What is a context window?

A context window is the maximum amount of text a model can hold in working memory at once — its short-term memory for the conversation and inputs. Everything outside it is invisible to the model, which is why curation matters.

How does this relate to RAG?

Retrieval-augmented generation (RAG) is a form of context engineering: instead of the whole corpus, you retrieve the relevant pieces and place them in context. The principle — curate the input, don’t dump it — is the same.

Sources

Share: