Skip to content

v0.1.0 — reversible context compression engine

Latest

Choose a tag to compare

@initializ-mk initializ-mk released this 04 Jul 19:10
0288e3e

First release of ctxzip — reversible context compression for AI agents. Lossy on the wire, lossless end-to-end: every chunk dropped is hashed, stored locally, and replaced by an inline <<ctxzip:HASH ...>> marker the model can expand on demand.

Highlights

  • Content-aware crushersJSONCrusher (row selection + dedup), LogCrusher (line selection), TextCrusher (line-mode numeric-insensitive dedup for grep/log output; extractive BM25 sentence selection for prose — verbatim only, never paraphrased)
  • CCR reversibilityccr.Store interface with in-memory and durable bbolt backends; originals survive restarts; 12-hex content-addressed markers (short enough that LLMs transcribe them reliably); marker hash == store key by construction
  • Fidelity floor — errors/anomalies/query anchors never dropped; built-in error vocabulary includes k8s state words (crash, backoff, oomkilled, evicted); callers extend it via Options.MustKeep (union semantics — can only add protection)
  • Prompt-cache discipline — frozen prefix + protected recent turns forwarded byte-identical; fully deterministic output; Options.SkipNames exempts a host's expansion tool from re-compression
  • Pure Go — single third-party dependency (bbolt); no cgo, no ML runtime
  • cmd/ctxzip-demo — pipe any file/output through and watch the compress → store → retrieve round trip

Field-tested

Built and hardened against a live forge agent: 5.6 KB grep output compressed 1,397 → 51 tokens (96%) with the one crashing pod kept verbatim, full original retrievable by marker hash. Several v0.1.0 behaviors (line-mode splitting, stop-term filtering, 12-hex hashes, SkipNames) exist because live testing found the failure modes.

Use

go get github.com/initializ/ctxzip@v0.1.0

See the README for the full options reference and the three-seam runtime embedding guide.

Compatibility: v0.x — the API may change between minor versions while live-driven hardening continues.