Context Manager
OptimizationContext window optimization and management system. Monitors utilization, implements modular rules, performs intelligent resets, and coordinates context transfer between agents.
Context Architecture
The context window is organized into distinct layers:
- System Layer: Protected - core instructions and tool definitions
- Persistent Layer: Managed - preferences, decisions, active rules
- Session Layer: Prunable - conversation history, tool results
- Task Layer: Ephemeral - current task context, working memory
Core Operations
- Monitor: Track context utilization and performance metrics
- Optimize: Selective pruning and summarization
- Inject: Add relevant context for specialized tasks
- Reset: Intelligent context reset preserving critical state
- Coordinate: Transfer context between agents
Modular Rules
Configurable rules control context behavior:
- Protect: Prevent content from being pruned
- Summarize: Replace with summary on prune
- Expire: Remove after time/condition met
- Inject: Add context when triggered
- Delegate: Pass to memory for long-term storage
Health Monitoring
- Utilization: Current percentage of context window used
- Relevance Score: How relevant is current context (0-100)
- Redundancy Score: Duplicate/overlapping content (0-100)
- Efficiency Score: Value per token metric (0-100)