Global context budget manager (Layer 3)
Global context budget manager (Layer 3)
Details
Tracks total estimated token usage across all turns and replaces the
largest tool results with a placeholder when the soft ceiling is exceeded.
This mirrors Claude Code's ContentReplacementState.
Methods
Method new()
Create a new state object.
Usage
ContentReplacementState$new(soft_ceiling = .RESOURCE_SOFT_CEILING)Method maybe_replace()
Check usage and replace large old results if over ceiling.
Arguments
chatAn
ellmer::Chatobject (modified in place).