Skip to main content Module compressor Copy item path Source aggressive_compress Strips comments, blank lines, and normalizes indentation for maximum token savings. ansi_density Returns the ratio of ANSI escape characters to total string length. diff_content Produces a compact unified diff between old and new content with line numbers. lightweight_cleanup Lightweight post-processing cleanup: collapses consecutive closing braces,
removes whitespace-only lines, and limits consecutive blank lines to 1. safeguard_ratio Safeguard: prevents compression from inflating output or destroying small outputs.
For small outputs (<2000 tokens), rejects extreme compression (>95% reduction)
that likely lost important content. For large outputs, trusts the pattern. strip_ansi Removes ANSI escape codes from a string, returning clean text. task_aware_compress Compresses content using the active task intent to preserve task-relevant sections. verbatim_compact Deduplicates repeated lines, strips boilerplate, and normalizes timestamps/hashes.