Browse AI Agents & MCP SECTION 5: Memory, State & Context Management

The Context Window Strategy

3 fill-in slots · from The AI Prompt Handbook for AI Agents & MCP

Your details

0/3 filled

The Context Window Strategy

Design a context management strategy for a long-running agent.

Expected run length: [TURNS, TOOL CALLS, DURATION]
Context consumers: [SYSTEM PROMPT, TOOLS, HISTORY, TOOL RESULTS,
DOCUMENTS]
Roughly how much each consumes: [ESTIMATE]

Produce:
1. What consumes context and in what proportion
2. What grows unboundedly and will eventually exhaust the window
3. Strategy for each growing element: keep, summarise, clear, or
   externalise
4. When to trigger each strategy — the threshold and the signal
5. What must survive any compaction: the goal, key decisions,
   constraints
6. What can be safely dropped: old tool results, superseded
   reasoning, exploratory dead ends
7. What to externalise to files or a store rather than holding in
   context
8. How the agent knows something was compacted, and what it should
   do differently afterwards
9. Failure mode: what breaks when compaction drops something
   important, and how to detect it

Distinguish clearly between:
- CLEARING (removing stale content — cheap, lossy in a predictable
  way)
- SUMMARISING (compressing content — costs a call, lossy in an
  unpredictable way)
- EXTERNALISING (writing to a file or store the agent can re-read —
  cheapest at read time, requires the agent to know it is there)

Mark any platform-specific feature as [VERIFY CURRENT] — the
available context management mechanisms differ by provider and
change.

Highlighted [slots] are still empty. Downloads are plain .txt — paste into any AI assistant.