How It Works
Quick Start
Optimization Events
| Event Type | Description |
|---|---|
overflow_detected | Context exceeded threshold |
auto_compact | Auto-compaction triggered |
benefit_check | Compression benefit evaluated |
revert | Compression reverted (not beneficial) |
cap_outputs | Tool outputs capped |
prune_tools | Old tool outputs pruned |
sliding_window | Sliding window applied |
summarize | Messages summarized |
snapshot | Context snapshot taken |
OptimizationEvent
History Tracking
CLI Commands
Context Stats
CLI Stats Commands
Monitoring Integration
Events are included in monitor snapshots:Best Practices
Review history after incidents
Review history after incidents
Check which optimisations ran when answers suddenly degrade mid-session.
Watch for reverts
Watch for reverts
A reverted compression means the strategy did not help — try retrieval or summarisation instead.
Track utilisation trends
Track utilisation trends
Rising utilisation across turns signals you need tighter budgets or earlier compaction.
Act on warnings early
Act on warnings early
Treat overflow warnings as action items, not noise — fix before the API rejects the request.
Related
Context Monitor
Real-time context snapshots
Context Strategies
Optimisation strategies and defaults
Gateway Tracing Hook
Emit OpenTelemetry spans across each gateway pipeline stage

