Skip to main content

Module compression

Module compression 

Source
Expand description

Deterministic output compression for tool results entering model context.

This module implements MEM-007 active context compression, starting with bash tool output. Compression applies only to the model-facing representation; raw output is preserved on the UI event/export surface.

§Design Constraints

  • Deterministic: same input always produces same compressed bytes. No timestamps, no random state, no session-dependent ordering.
  • Default OFF: compression must be explicitly enabled via [Agent::with_bash_compression].
  • Stable prefix safe: compression applies only to tool results entering the dynamic suffix, never to cached-prefix messages.
  • bash only: other tools are unaffected by this module.

Structs§

BashOutputCompressor
Deterministic compressor for bash tool output.
CompressedOutput
Result of compressing bash tool output.
CompressionMetrics
RetrievalMetrics

Constants§

DEFAULT_BASH_LINE_THRESHOLD
Default line threshold for bash output compression.