Skip to content

feat(pr2): compress-md, caveman persona, squeez update, track-result hook#12

Merged
claudioemmanuel merged 1 commit intodevelopfrom
feat/compress-md-persona-update
Apr 7, 2026
Merged

feat(pr2): compress-md, caveman persona, squeez update, track-result hook#12
claudioemmanuel merged 1 commit intodevelopfrom
feat/compress-md-persona-update

Conversation

@claudioemmanuel
Copy link
Copy Markdown
Owner

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.
  • Caveman persona injection — Ultra persona text injected into session banner and copilot-instructions.md. Default Ultra (most aggressive). Configurable via persona = lite|full|ultra|off.
  • auto_compress_md = truesqueez init runs compress-md --all on every session start (idempotent; backup written once, never clobbered).
  • squeez update — self-updater via curl + sha256sum/shasum shell-out. Atomic rename on Unix. --check, --insecure flags.
  • track-result hook extension — PostToolUse hook pipes stdin JSON to squeez track-result; extracts file paths + errors from Read/Grep/Glob results into SessionContext for cross-call awareness.

Test plan

  • cargo test — all 230 tests pass
  • bash bench/run.sh — 14/14 main fixtures ≥30%, ≤100ms
  • bash bench/run_context.sh — 3/3 context scenarios pass
  • squeez compress-md --dry-run README.md — outputs compressed prose, code blocks preserved
  • squeez init — banner shows Persona: ultra with full persona text
  • squeez update --check — reports current vs latest version

🤖 Generated with Claude Code

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 claudioemmanuel merged commit 0d58786 into develop Apr 7, 2026
3 checks passed
@claudioemmanuel claudioemmanuel deleted the feat/compress-md-persona-update branch April 7, 2026 03:58
claudioemmanuel added a commit that referenced this pull request Apr 7, 2026
…update

feat(pr2): compress-md, caveman persona, squeez update, track-result hook
claudioemmanuel added a commit that referenced this pull request Apr 7, 2026
…update

feat(pr2): compress-md, caveman persona, squeez update, track-result hook
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant