AS-201b · Module 3

Context Window Hygiene

3 min read

Everything in the context window is available to the model. Read that sentence again. Every piece of data you put into the context window — system prompt, conversation history, retrieved documents, tool outputs, user messages — becomes information the model can reference, quote, summarize, and potentially reveal. The context window is not a secure vault. It is a shared workspace where everything is visible to everything else.

Context window hygiene is the practice of controlling what enters the context window with the same rigor you would apply to database access control. Before adding any data to the context, ask three questions. Does the model need this data to perform its task? Does this data contain information that should not be revealed to the user? Is there a redacted or summarized version that preserves utility while removing sensitivity? If the model does not need it, do not include it. If it contains sensitive data, redact first. If a summary works, use the summary.

Do This

  • Minimize the data in the context window — include only what the model needs for the current task
  • Redact PII, credentials, and sensitive fields before adding documents to context
  • Use summarized or aggregated data instead of raw records whenever possible
  • Clear conversation history regularly to prevent accumulation of sensitive context

Avoid This

  • Dump entire documents into context "just in case the model needs it"
  • Include raw database records with all fields when the model only needs two or three
  • Let conversation history grow indefinitely — every past message remains accessible to the model
  • Trust the model to "not mention" sensitive data in the context — the model has no concept of data classification