github yvgude/lean-ctx v3.4.1

latest releases: v3.8.9, v3.8.8, v3.8.7...
one month ago

Performance and token optimization release. Reduces per-session overhead by up to 64%.

Added

  • LEAN_CTX_NO_CHECKPOINT env var — disable auto-checkpoint injection independently from minimal_overhead
  • PreparedSave patternSession.save() split into prepare_save() (CPU-only serialization under lock) + write_to_disk() (background I/O via tokio::task::spawn_blocking), removing disk I/O from the tool response hot path
  • md5_hex_fast — 8x faster fingerprinting for outputs >16 KB by hashing prefix + suffix + length instead of full content
  • Benchmark tests — 8 new tests covering token overhead budgets, cache effectiveness, compression density, session save latency, and MD5 performance

Changed

  • count_tokens called once per tool response (was up to 4x) — cached result reused for hints, cost attribution, and logging
  • CostStore writes deferred to background thread via spawn_blocking
  • mcp-live.json writes debounced to every 5th tool call (80% fewer disk writes)
  • compress_output skipped entirely for Normal density (no string copy)
  • Auto-checkpoint, meta-strings (savings/stale notes, shell hints, archive hints), and session blocks now all suppressed under minimal_overhead

Fixed

  • Integer overflow crash in shell_efficiency_hint when output tokens exceeded input tokens — now uses saturating_sub
  • Synchronous save() restores retry counter on disk write failure, preserving auto-save semantics

Upgrade

lean-ctx update                 # recommended (auto-downloads + refreshes shell hooks)
cargo install lean-ctx          # or
npm update -g lean-ctx-bin      # or
brew upgrade lean-ctx

Note: After upgrading via cargo/npm/brew, run lean-ctx setup to refresh shell aliases. lean-ctx update does this automatically.

Full Changelog: v3.4.1...v3.4.1

Don't miss a new lean-ctx release

NewReleases is sending notifications on new releases.