feat(pr2): compress-md, caveman persona, squeez update, track-result hook#12
Merged
claudioemmanuel merged 1 commit intodevelopfrom Apr 7, 2026
Merged
Conversation
PR2 of two. Stacks on the context engine from PR1 and lands the user-facing features that make squeez attack input + output + memory-file tokens at maximum aggression by default. Highlights: - squeez compress-md — pure-Rust, zero-LLM caveman-style markdown compressor. Line-based state machine preserves fenced code blocks, inline code, URLs (bare + markdown link targets), headings, tables, list markers, and version strings; only natural-language prose is compressed. Drops articles + fillers + pleasantries + hedging everywhere. --ultra additionally substitutes with→w/, function→fn, configuration→config, repository→repo, etc. Damage heuristic aborts the write if any code block, URL, or heading was lost. Backups go to <stem>.original.md and are never overwritten. - Caveman persona — three intensity levels (lite/full/ultra) shipped via include_str!. Default is Ultra. Injected into the squeez init banner (Claude Code) and into the <!-- squeez:start --> block in ~/.copilot/copilot-instructions.md (Copilot CLI). - auto_compress_md=true — squeez init runs compress-md --all silently on every session start. Idempotent: backup is only written once and the integrity check guarantees safety. - squeez update — self-updater. Shells out to curl + sha256sum/shasum (both already required by install.sh) so we stay zero-dep. Atomic on Unix via .new + rename; documented .new + manual move on Windows. Override base URL via SQUEEZ_UPDATE_URL_OVERRIDE for tests. --check reports without installing; --insecure skips checksum. - squeez track-result + posttooluse hook update — PostToolUse now pipes the raw JSON for every tool call (Read, Grep, LS, Glob, ...) into squeez track-result, which extracts file paths + errors from the result content and feeds them into SessionContext. Future bash calls dedup against this state via the cross-call hint added in PR1. - Config additions: persona (default Ultra), auto_compress_md (default true). Both opt-out via config.ini. Tests: 230 passing (was 162). New integration tests for compress_md (13), persona (8), track_result (6), update (8). New mdcompress_* bench fixtures show ~22-27% reduction (caveman LLM gets ~45% with API calls; we get ~25% with zero API calls in <5ms). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
claudioemmanuel
added a commit
that referenced
this pull request
Apr 7, 2026
…update feat(pr2): compress-md, caveman persona, squeez update, track-result hook
This was referenced Apr 7, 2026
claudioemmanuel
added a commit
that referenced
this pull request
Apr 7, 2026
…update feat(pr2): compress-md, caveman persona, squeez update, track-result hook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PR2 of the squeez token-optimizer roadmap. Lands user-facing features on top of the context engine from PR1 (#10, now merged).
squeez compress-md— pure-Rust caveman markdown compressor (CLAUDE.md, copilot-instructions.md, AGENTS.md). Line-based state machine preserves code blocks, URLs, headings, tables. Ultra mode adds abbreviations (with→w/,fn, etc.). Damage heuristic aborts write if code blocks / URLs / headings change.copilot-instructions.md. Default Ultra (most aggressive). Configurable viapersona = lite|full|ultra|off.auto_compress_md = true—squeez initrunscompress-md --allon every session start (idempotent; backup written once, never clobbered).squeez update— self-updater viacurl+sha256sum/shasumshell-out. Atomic rename on Unix.--check,--insecureflags.track-resulthook extension — PostToolUse hook pipes stdin JSON tosqueez track-result; extracts file paths + errors from Read/Grep/Glob results into SessionContext for cross-call awareness.Test plan
cargo test— all 230 tests passbash bench/run.sh— 14/14 main fixtures ≥30%, ≤100msbash bench/run_context.sh— 3/3 context scenarios passsqueez compress-md --dry-run README.md— outputs compressed prose, code blocks preservedsqueez init— banner showsPersona: ultrawith full persona textsqueez update --check— reports current vs latest version🤖 Generated with Claude Code