Skip to main content

Module output_compress

Module output_compress 

Source
Expand description

Conscious compression of noisy shell output.

The goal is token economy without losing context. We never summarize, paraphrase, or drop unique information. The only thing collapsed is mechanical repetition, which carries no extra meaning:

  • runs of byte-identical consecutive lines -> one line + an [×N] marker
  • runs of 3+ blank lines -> a single blank line

Deliberately conservative choices so we never eat real context:

  • lines that merely differ (e.g. “Test 1 passed” / “Test 2 passed”, or a compiler’s per-file diagnostics) are left untouched — those are content;
  • progress bars that redraw with \r are already collapsed upstream by the PTY ring buffer, so there’s nothing speculative to guess at here;
  • an [×N] marker is fully reversible information — the reader knows the exact line and how many times it repeated.

Set WINX_NO_COMPRESS=1 to disable entirely.

Functions§

compress_output
Collapse mechanical repetition in output. Returns None when compression is disabled, the output is too short, or there’s nothing meaningful to save — callers should fall back to the original text in that case.