Context Escape Velocity
Context Escape Velocity
In physics, escape velocity is the speed you need to break free from a planet's gravitational pull. The closer you get to a massive object, the stronger its gravity becomes—eventually making it nearly impossible for anything to escape.
Conversations with AI agents work the same way. As context accumulates, new information struggles to break through. The context window fills up, and your latest inputs get drowned out by everything that came before. That's context escape velocity—the point where adding more context makes responses worse, not better.
TL;DR
Reset when the model repeats itself, ignores recent instructions, or loses track of earlier decisions. Write code that filters data before returning it, extract current state and begin a new conversation, or design tools that maintain their own state outside the context window.
When It Happens
Multi-turn debugging sessions that accumulate tool outputs are the most common trigger. Each tool call adds to context:
# Turn 1: read authentication module
cat src/auth.py
# Returns: 500 lines
# Turn 2: search error logs
grep "AuthError" logs/app.log
# Returns: 1000 matching lines
# Turn 3: read session handler
cat src/sessions.py
# Returns: 800 lines
# Turn 4: compare configurations
diff config/staging.yml config/prod.yml
# Returns: 600 lines of differences
# Turn 5: model struggles to synthesize
# Total context: 2,900 lines of tool outputBy turn 5, you've added 2,900 lines of tool output. The model's attention is distributed across all of it, diluting focus on what actually matters.
Better approach: Write code that filters before returning results:
# Single tool call with focused output
import re
from datetime import datetime
def analyze_auth_errors():
# Read and filter in one pass
with open("logs/app.log") as f:
errors = [
line for line in f
if "AuthError" in line
]
# Return summary, not raw logs
return {
"total_errors": len(errors),
"first_seen": errors[0].split()[0]
if errors else None,
"recent_sample": errors[-5:]
}
# Result: 10 lines of focused data
# vs 2,900 lines of raw outputContext escape velocity also happens when pivoting between different topics in long conversations—each new topic adds context without clearing the old.
Reset Strategies
Start fresh with state extraction: Summarize the current state and decisions, then start a new conversation with just that summary.
New conversation:
"We're debugging authentication. Confirmed: JWT validation works, database connection stable. Issue is in session middleware. Pick up from here."Explicit summarization: Ask the model to summarize progress, then reference that summary in subsequent turns.
Stateful tools: Design tools that maintain state outside the context window. The tool tracks errors and returns summaries.
# Tool maintains state
error_tracker.add(errors)
# Returns summary, not full logs
return error_tracker.summary()Context budgeting: Limit tool outputs from the start. Use filtered, structured outputs that consume minimal space.
Prevention
Design workflows that assume conversations will reset. Store important state outside the conversation—files, databases, tool memory. The context window is workspace for the task at hand.
References
- Anatomy of a Context Window - What fills the context window and how it affects behavior
- Tool Output Design for Context Efficiency - Designing tools that preserve context space