liveBook · Manning

Context injection

As explained in Context Engineering

Context stuffing inserts external knowledge directly into a model's context window.

Context stuffing, also called context-augmented generation, supplies external knowledge by placing a complete source document directly in an LLM’s context window. It avoids document chunking, indexing, and retrieval, allowing the model to reason across the supplied text. section 3.10.8 section 3.8

The application cleans and bounds the source text, then inserts it into a prompt—preferably system instructions when the text should provide authoritative context. Unlike cache-augmented generation (CAG), context stuffing resends the complete document on every call rather than preserving it as cached state. section 3.10.8 section 3.8

Figure 3.6 Context stuffing workflow: external knowledge is injected directly into the prompt without retrieval indexing
context stuffing v7

The workflow shows external knowledge entering the prompt directly, without retrieval indexing. section 3.8

Choose context stuffing with its operational trade-offs in mind:

  • It removes retrieval misses and chunking errors, but resending large documents raises per-request token costs and inference latency. section 3.8
  • Very long inputs can dilute attention or cause position bias, making details near the middle easier to overlook; clean formats such as Markdown help preserve structure. section 3.8
  • It best fits bounded documents, low-frequency workflows, and rapid prototypes where retrieval infrastructure is not yet justified. section 3.8

Prompt placement

For the same external text document, inject it into the user prompt as user-level context or into the system prompt as trusted context that directs the model to act as an expert on that text. section 3.10.8

How Context Engineering covers it

How deep it goes
Explains prompt placement and operational trade-offs, while pointing to separate code demonstrations.
Examples
Illustrates one text document injected as user-level or system-level prompt context.
What you can do after
Apply it by cleaning, bounding, and placing a complete source document in a user or system prompt.
How it connects
Contrasts direct injection with retrieval-augmented generation and cache-augmented generation.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Context Engineering. The section links point to the parts of the book it draws on.