97% smaller.
100% reversible.
Shrink verbose context without throwing anything away. Content-aware, deterministic compression for JSON, logs, code, and prose — no LLM, no network — and every original restores byte-for-byte from its handle.
from cendor.squeeze import compress small, handle = compress(huge_logs, kind="auto", target_tokens=400) # ~97% smaller on repetitive logs — detect() routed it to the log compressor original = handle.expand() # byte-for-byte, anytime — even next process assert original == huge_logs # the original lives in a content-addressed store
Four compressors, routed by content.
compress() looks at the shape of what you hand it and routes it to a specialized compressor — deterministic, no LLM, no network.
// or # inside a literal survives; keeps shebangs and preprocessor linesdetect() auto-routes by content shape; kind= overrides. target_tokens is a hard ceiling — a final safety pass guarantees it's never exceeded. fidelity = lossless | balanced | aggressive trades structure for size.
Compress it. Expand it. Diff it.
A repetitive app log, squeezed by the log compressor: timestamps and UUIDs normalized, repeats deduped into (×N), the ERROR kept verbatim — then restored byte-for-byte.
▸ press compress to squeeze the excerpt · then expand to get every byte back
The original never left — it's in a content-addressed store (in-memory LRU or SQLite), deduped by hash. Persist handle.to_dict() and expand in a different process.
Plugs into contextkit — without an import.
SqueezeCompressor satisfies core's Compressor protocol by shape, so contextkit's evict="compress" uses it with zero coupling — the contextkit[squeeze] extra. The handle rides the assembly receipt, so a compressed block can always be expanded later.
Where the edges are — by design.
squeeze cuts the tokens sent to the model while keeping the full original for byte-exact restore — it does not reduce total storage.
No LLM: the prose compressor is extractive ranking, useful as a rough filter. For meaning-aware summarization, plug your own summarizer into contextkit.
Ambiguous content (a bare JSON scalar, colon-heavy prose) can misroute; pass kind= when you know the content type.
Under a tight budget the compressed form is optimized for token count; parse the original (via expand()), not the squeezed text.
Send less. Keep everything.
squeeze docs → · log-compression cookbook → · composes with the Cendor stack