Home › Glossary › Systems › Context Management

Beginner · Systems

Context Management

Visual diagram · (in preparation) · Math · (in preparation) · Worked example · 3 difficulty levels.

TL;DR. The engineering practice of controlling what goes into a model's context window, in what order, and at what cost.

Technical Definition

The engineering practice of controlling what goes into a model's context window, in what order, and at what cost.

How it works

Context management covers assembly (which segments to include), ordering (recency and salience effects mean position matters), budgeting (dividing a fixed token allowance between instructions, tools, retrieval, and history), and pruning (what to drop when the budget is exceeded). It is the operational core of prompt and agent engineering: two systems using the same model and the same tools can differ enormously in reliability purely through how they manage context.

Related Concepts

  • Agentic Context Management (ACM) — The discipline of deciding what an AI agent knows at each step — assembling, curating, compacting, and securing its working context.
  • Context Compaction — Compressing accumulated history into a smaller, higher-density representation so an agent can keep working within its token budget.
  • Context Lifecycle — The stages a piece of context passes through: acquisition, validation, injection, use, compaction, persistence, and expiry.
  • Context Window — The maximum number of tokens a model can process in a single input, determining information capacity.