Skip to content
Knowledge v1.0

FG-0707 Context Window Management

Description

Strategic management of what information occupies the finite context window available to AI agents during a session. The context window is the single most important technical constraint in AI collaboration. It determines what the agent knows, what it has forgotten, and what it will hallucinate to fill gaps. Effective context window management prioritizes high-value information, compacts or evicts stale context, and structures loading sequences to maximize signal-to-noise ratio within the available token budget.

Implementation

Audit the token cost of every piece of context loaded at session start. Rank context by utility: governance rules and active task state first, reference material and historical context second, supplementary material last. Implement progressive loading: start with essential context and add detail only when the task requires it. Monitor for context window pressure indicators: agents repeating themselves, forgetting earlier instructions, or producing output inconsistent with loaded context.

Success Indicators

  • Agents operate within their effective context window without degradation
  • Context loading is prioritized by task relevance, not loading order habit
  • Stale or irrelevant context is identified and removed between task phases
  • The team can articulate the token cost of their standard context loading

Failure Modes

  • Loading everything: filling the context window with comprehensive but low-relevance material, leaving no room for task execution
  • No prioritization: treating all context as equally important, so critical information is pushed out by volume
  • Ignoring degradation signals: continuing to add context after agents show signs of window pressure
  • Static loading: using the same context regardless of task type

Sub-Methods 3

FG-0707.001 Shallow-First Loading

Load YAML frontmatter and metadata before full document content. A shallow scan of 50 tokens per file can determine relevance before committing 5,000 tokens to the full document. This pattern applies to any context loading: read the index before reading the chapters, read the summary before reading the report, read the frontmatter before reading the post.

FG-0707.002 Traceable Paths

Every shallow reference must point to its deep context. When you load a summary, include the file path to the full document. When you load frontmatter, include the route to the complete content. Traceability means the agent can always go deeper when needed without having to search for where the detail lives.

FG-0707.003 Context Budget

Measure the token cost of your standard context loading and set a budget. If your context window is 200K tokens and your governance plus project state consumes 60K, you have 140K for task execution. Know this number. Track it. When loading decisions compete for budget, prioritize by task relevance. The budget is the constraint that forces prioritization.