# cmprss Compresses oversized Pi tool results and persists exact originals for retrieval. ## Install / load Loaded through the root `pi-ext` package. See [../../README.md](../../README.md). ## Commands / tools / settings Pi commands: - `/cmprss` — show status. - `/cmprss status` — show status. - `/cmprss stats` — show stored block count and estimated savings. - `/cmprss on` — enable compression for the current session branch. - `/cmprss off` — disable compression for the current session branch. - `/cmprss clear` — tombstone stored originals for the current session branch. Pi tools: - `cmprss_retrieve` — retrieve bounded exact UTF-8 ranges by hash, byte offset, and byte limit. Pi hooks: - `session_start` — replay persisted originals and state. - `session_shutdown` — clear process-local cache. - `tool_result` — compress eligible oversized tool output. Pi settings: ```json { "cmprss": { "enabled": true, "thresholdBytes": 20000, "maxStoredBlocks": 64, "status": true, "tools": ["bash", "grep", "find", "ls", "read"] } } ``` ## Behavior `cmprss` compresses large text tool results before the next model turn. It stores the exact original in Pi session history, so restarting Pi can still retrieve hidden ranges. Retrieval defaults to byte offset `0` and returns at most `8192` bytes per call. Continuation metadata supplies the next UTF-8 boundary, while retrieval bytes reduce reported savings. For pre-truncated Pi bash results, it persists `details.fullOutputPath` content when available. Default compressors: - JSON arrays and objects. - grep/ripgrep-style search output. - unified diffs. - stack traces. - build/test logs. - generic head/tail text. Safety rules: - Never compresses `edit` or `write` results. - Never compresses `read` output when `offset`, `limit`, or `l` is set. - Preserves existing tool result details and adds `details.cmprss`. - Retrieval misses fail loudly with `cmprss: unknown hash`. Example marker: ```text [cmprss: bash 58000B → 7000B, saved ~12000t, hash=abc123] Use cmprss_retrieve(hash="abc123") for bounded exact UTF-8 ranges. ``` ## A/B evaluation Run the isolated one-shot baseline and current extension against deterministic fixtures for all six compressors: ```text mise //extensions/cmprss:ab ``` After changing cmprss, run only the modified case and compare its persistent result with prior runs: ```text mise //extensions/cmprss:ab -- --case modified ``` The default subject and blinded judge model is `openai-codex/gpt-5.6-luna`. Use `--model`, `--judge-model`, `--thinking`, or `--repeats` to override the fixed run parameters. The runner disables discovered extensions, skills, prompts, themes, context files, sessions, and RTK. It records provider usage, compression bytes, retrieval bytes, exact-answer score, blinded judge score, fixtures, events, and the tested extension source under `$XDG_STATE_HOME/pi/cmprss-ab`. Run `--dry-run` to inspect fixture sizes, expected compressors, and the prompt without calling a model. No server. No proxy. No Python. No Rust. No ML. No MCP. No telemetry. No dashboard.