Back to blog

Methodology

From Prompt Engineering to Context Engineering

Prompt Engineering is the art of shaping a single text input — the 'prompt' — so that a Large Language Model (LLM) responds as well as possible. Since GPT-3.5 arrived, developers have spent countless hours tweaking wording, reordering prompt parts and refining system instructions. There's a more durable approach.

SvK by Sven von Känel 6 min read
  • KI
  • Prompt Engineering
  • Context Engineering

1 | Understanding the shift: from static prompts to dynamic contexts

1.1 What is Prompt Engineering?

Prompt Engineering is the art of shaping a single text input — the 'prompt' — so that a Large Language Model (LLM) responds as well as possible. Since GPT-3.5 arrived, developers have spent countless hours tweaking wording, reordering prompt parts, or refining system instructions.

Classic Prompt Engineering techniques:

  • Few-Shot Learning: providing examples inside the prompt
  • Chain-of-Thought: encouraging step-by-step reasoning
  • Role Playing: assigning the model a specific role
  • Structured Output: defining a format for the answer

Prompt Engineering techniques

1.2 The wins — and the limits

Prompt Engineering took us a long way. It enabled the first productive LLM applications. But as tasks get more complex — in particular when large external data sources such as company databases come into play — we hit fundamental limits.

2 | The limits of pure Prompt Engineering

2.1 Static and fragile

A carefully tuned prompt often works only under very specific conditions. Small changes — a different user with a different writing style, new data formats, a model update — can degrade performance sharply. What worked yesterday fails today, or no longer produces optimal results.

2.2 Context-window limits

Modern LLMs do have larger context windows (Claude: 200k tokens, GPT-4: 128k tokens, Gemini: 2M), but in practice the requirements explode quickly — especially with coding tools like Cursor, Windsurf, Claude Code and co.:

  • longer conversation histories
  • multiple tool calls with responses
  • extensive document analysis
  • complex code repositories

2.3 Missing tools, missing freshness

Many real tasks need:

  • External knowledge sources: company databases, APIs
  • Current information: web search, news feeds
  • Actions: send emails, create tickets, deploy code

A static prompt usually can't represent this dynamic.

2.4 Scalability and maintainability

A cleverly worded prompt may work for one specific task, but:

  • How does it adapt to different user groups?
  • How does it integrate new features without breaking changes?
  • How does it stay stable across model updates?

2.5 Observability and debugging

Without systematic traceability, troubleshooting becomes guesswork — as so often in IT:

  • Why did the model take that decision?
  • Which information was missing?
  • Where in the process did things go wrong?

3 | The paradigm shift: Context Engineering

3.1 The new definition

Following a concise definition by LangChain (see sources), Context Engineering means:

'Building dynamic systems that give the LLM exactly the right information and tools in the right form at the right time, so it can solve the task reliably and efficiently.'

It's no longer just about the input, but about the entire information ecosystem the model operates in.

3.2 Why Context > Prompt

Recent studies show: when AI agents fail, in over 80% of cases it's because they receive the wrong, incomplete, contradictory or outdated context — not because the model itself is inadequate.

Example from practice: A support agent has to answer a technical customer request. With pure Prompt Engineering, we'd try to cover every possible scenario in the prompt. With Context Engineering:

  1. The agent parses the prompt.
  2. It checks the conversation history ('short-term memory').
  3. It dynamically loads relevant documentation (for example via RAG before the LLM call).
  4. It checks the customer history (for example via an MCP client — 'long-term memory').
  5. It consults the current system status (for example via 'tool use' / 'function calling').
  6. It picks suitable response templates.

In other words: Prompt Engineering is only one piece of Context Engineering.

3.3 The four core strategies of Context Engineering

LangChain (see references below) identifies four fundamental patterns for effective context management:

Strategy Purpose Practical example Implementation
Write Persist context outside the token window Scratchpad for intermediate results in complex calculations LangGraph Memory, Redis, PostgreSQL
Select Load only relevant information dynamically Top-3 relevant code snippets via embedding search Databases for fast, relevant search (e.g. Qdrant, Pinecone, Weaviate), RAG pipelines
Compress Token efficiency through intelligent summarisation Automatic conversation summaries at 80% token utilisation (of the context window) LLM-based summarisation, extractive compression
Isolate Split complex tasks into specialised sub-agents Research agent → analysis agent → writing agent Multi-agent orchestration, LangGraph

Context management strategies

4 | Best practices for modern Context Engineering

4.1 Recommendations

A few options that are relatively easy to adopt to fill an LLM's context window well:

  1. Separate system and role instructions clearly (e.g. as a YAML block).
  2. Retrieval-Augmented Generation (RAG) for current or proprietary data — such as documentation.
  3. Describe tool calls declaratively (e.g. via JSON schemas) so the model uses them reliably.
  4. Introduce memory layers — short-term (thread) vs. long-term (user profile).
  5. Watch for consistency: don't mix versions in library documentation, so that, for example, the LLM doesn't see V4 and V5 docs at the same time.
  6. Use telemetry and evals (e.g. LangSmith) to make token costs and error rates visible.

A few metrics worth tracking:

  • Context Utilisation Rate: how much of the supplied context is actually used?
  • Retrieval Precision: was the retrieved information relevant?
  • Token Efficiency: ratio of information to token consumption.
  • Context Switching Overhead: time taken for context updates.
  • Error Attribution: which part of the context led to errors?

5 | A practical guide: getting started with Context Engineering

A few pointers for a structured approach.

As preparation, work out the context you need:

  • Which information does your system really need?
  • Which data sources are available?
  • How current do the data have to be?

Which use cases do you have in detail?

  • Identify the top 5 use cases.
  • Document the required context per use case.
  • Spot overlaps and patterns.

Steps for implementation:

  • Collect the relevant data ('collect').
  • Prepare the data for the LLM ('transform').
  • Check for completeness, correctness and consistency ('validate').
  • Decide how to deliver the data — e.g. via RAG or via an MCP server?
  • Assemble the final prompt / context ('assemble').

Data preparation for LLMs

Iterative improvement:

  • Start with static context.

  • Add dynamic elements step by step.

  • Measure the impact of each change where possible.

6 | Looking ahead: where is this heading?

Current trends include:

  • Adaptive context windows: models that adjust their context window dynamically.
  • Multi-modal context: integrating text, images, audio, video.
  • Federated context: distributed context sources — but with data protection preserved.
  • Self-organising context: AI systems that optimise their own context.

With a few open challenges:

  • Context coherence: consistency across multiple context sources.
  • Privacy-aware context: GDPR-compliant context processing.
  • Real-time context updates: context refreshes in the millisecond range.
  • Cross-model context: context sharing between different AI models.
  • and so on.

7 | Conclusion: the way forward

Prompt Engineering was the first step — it taught us how to communicate with AI models. Context Engineering is the next evolutionary leap: building intelligent information ecosystems in which AI can reach its full potential.

The future belongs not to the cleverest prompt, but to the smartest context system. Companies that understand and apply this shift will gain a decisive competitive advantage.

The core message: stop thinking in single prompts — think in dynamic context systems. Your AI is only as good as the context you give it.

Note: a follow-up post is coming soon, showing Context Engineering implemented in a .NET solution with MCP servers.

References and further reading

Primary sources

Supplementary reading


Have you worked with Context Engineering already? What challenges do you see in your use case? Let's discuss in the comments.

NEWSLETTER

Four to six times a year, no marketing noise.

One pattern, one case, one recommendation. Signup with double opt-in, unsubscribe at any time.