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
