Skip to content

Context Reduction

Context reduction trims oversized tool output before it pollutes later turns. Large tool responses can dominate the context window without adding proportional value.

Reduction Pipeline

TokenPilot's reduction runs a pipeline of passes on each tool result:

PassDescriptionConfigurable
readStateCompactionCompact stale or superseded read results before they bloat later contextYes
toolPayloadTrimTrim oversized tool payloadsYes
htmlSlimmingCompact noisy HTML contentYes
execOutputTruncationTruncate long execution outputsYes
agentsStartupOptimizationApply agent startup optimization passYes

Controlling Reduction

bash
# Toggle reduction
lightmem2 reduction on
lightmem2 reduction off

# Switch mode
lightmem2 reduction mode balanced

# Enable/disable specific passes
lightmem2 reduction pass toolPayloadTrim off
lightmem2 reduction pass toolPayloadTrim on

# Check current status
lightmem2 reduction status

Next

Released under the MIT License.