Skill 2.2.1
Design and implement context management in single agents and between agents, including context accumulation, retrieval, injection, and compaction
Key Concepts
Accumulation is the growth of messages, tool results and retrieved passages over a run. Retrieval fetches relevant stored context on demand instead of keeping everything in the window, and injection places it into the prompt at the right position with delimiters. Between agents, context is passed as a structured hand-off message or shared state rather than the whole transcript.
Compaction reduces context when it grows too large: summarizing older turns, dropping tool outputs once their facts are extracted, keeping a pinned state object with key entities and decisions, and truncating with a sliding window only for content that can be re-retrieved. Agent Framework and Foundry conversations provide hooks and settings for compaction; custom code can trigger it when the token count crosses a threshold.