AI Engineering (2026) · CONTEXT · Anthropic & OWASP Standard · 2026

Just-in-Time Retrieval & Compaction vs Dumping 150k Tokens into Context

Quick Decision Rule: When A long-horizon agent accumulates raw tool dumps and logs across 40 turns and begins missing instructions or contradicting earlier facts, choose Treat context as a finite attention budget: use just-in-time retrieval, concise tool outputs, and structured compaction.

Trigger ConditionA long-horizon agent accumulates raw tool dumps and logs across 40 turns and begins missing instructions or contradicting earlier facts
Recommended ChoiceTreat context as a finite attention budget: use just-in-time retrieval, concise tool outputs, and structured compaction
Classic TrapEven with large context windows, flooding the prompt with low-signal history causes Context Rot and degrades model recall and reasoning precision.
VerificationAudited on 2026-11-23 · Anthropic & OWASP Standard · 2026

30-SECOND DECISION TRAP CHECK · CONTEXT

Test your instinct

Your coding agent appends every raw 30 KB test log directly into the chat history. By turn 18, it ignores system constraints and hallucinates file paths despite staying under the 200k token limit. What is happening and how do you fix it?

Primary Engineering Documentation

Related Context Decision Guides