liveBook · Manning

Context poisoning

As explained in Vibe Engineering

Context poisoning is the inclusion of misleading, outdated, unsafe, or otherwise harmful information in model context that biases an AI system toward incorrect output.

Context poisoning occurs when an AI system receives misleading, outdated, unsafe, or otherwise flawed information and uses it to produce an incorrect answer. In coding workflows, an agent may treat a bad example as authoritative and reproduce its mistakes, inefficient patterns, or deprecated APIs. section 3.6 section 3.0

A carefully assembled prompt with stale inputs

A developer gathers design tokens, component documentation, an API schema, and similar code to implement a profile card. An obsolete sample or deprecated endpoint among those fragments can lead the model to generate code based on false assumptions, despite the care taken to assemble the prompt. section 3.3

More context or better retrieval alone does not ensure reliable output. A retrieval system can surface flawed material from a poorly maintained knowledge base. Keep documentation, code conventions, and examples clean and consistent, and give the agent clear direction about the task. section 3.6 section 3.5.4

Use Chain-of-Verification to challenge an answer before relying on it:

  • Generate a baseline answer, then formulate questions that challenge its assumptions. section 3.6.2
  • Answer the questions separately from the draft, using other available evidence where appropriate; revise the answer if an assumption fails. section 3.6.2

Checking an unsafe SQL example

An agent drafting a data-access function might copy an outdated snippet with unsafe SQL patterns. A verification question can challenge that choice against newer code or secure practices, prompting a revision to prepared statements with parameterized queries. Treat the revised answer as a candidate for review, not an automatic guarantee. section 3.6.2

How Vibe Engineering covers it

How deep it goes
Explains how flawed examples propagate into code and outlines a verification loop for challenging assumptions.
Examples
Uses a profile-card prompt assembled from multiple sources and an outdated SQL snippet to illustrate poisoned inputs.
What you can do after
Evaluate and understand suspect context by curating source material and challenging generated assumptions before relying on code.
How it connects
Connects context poisoning to context engineering, retrieval-augmented generation, and Chain-of-Verification.

Related concepts

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