LM Resizer
LM Resizer is a local Rust CLI that reduces noisy command output before it enters an AI agent's context. It runs commands, builds compact views of supported output and stores the original bytes for later retrieval. It also offers MCP tools and an HTTP proxy. The CLI works without an account or a language model. On the bundled synthetic JSON demonstration, it reduced 36751 bytes to 2700 and 12735 tokens to 1340 (o200k_base, exact count), with byte-for-byte recovery. These measurements describe this fixture only; reproduce them with python3 scripts/demo.py (see below).
Release candidate 0.2.7, unpublished. The prebuilt installation below becomes usable after the maintainer configures the signing key and publishes the signed artifacts. The fresh-install target is under five minutes with a prebuilt binary; this duration has not been verified on a clean machine. Source compilation needs the prerequisites listed below and can take longer. The full Linux suite with local sockets and the Windows build, targeted tests and source installation have passed. Signed prebuilt installation and macOS validation remain pending.
Français · CLI reference · Publication gates
Install
Before the signed release is published, the versioned download URLs are unavailable. For this candidate, use the Install from source section in an existing checkout.
Prebuilt binary for Linux and macOS (after publication):
curl -fsSL https://raw.githubusercontent.com/phuetz/lm-resizer/v0.2.7/install.sh -o install.sh && sh install.sh
export PATH="$HOME/.local/bin:$PATH"
lm-resizer --version
Windows PowerShell:
irm https://raw.githubusercontent.com/phuetz/lm-resizer/v0.2.7/install.ps1 | iex
The installer verifies the archive's signature with the maintainer's key written in the installer (openssl is needed on Linux and macOS), then its SHA-256 checksum and binary version, before placing lm-resizer in ~/.local/bin by default. The checksum alone, served by the same release as the archive, would not detect a replaced archive. Prepared platforms are Linux x86_64, macOS x86_64/arm64 and Windows x86_64.
On Linux and macOS the installer prints the line to add when ~/.local/bin is not on your PATH; to make it permanent in Bash, run echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc (use ~/.zshrc for zsh) and open a new terminal. The Windows installer updates the user PATH. LM_RESIZER_INSTALL_DIR selects another destination. To uninstall a prebuilt binary, remove it from that destination. Windows: TLS fallback, PowerShell 5.1 and byte-exact recovery.
Reproduce a measured example
From this checkout, with Python available for the demonstration only:
python3 scripts/demo.py
For a locally built CLI:
cargo build --locked
python3 scripts/demo.py target/debug/lm-resizer
On Windows, use python and target/debug/lm-resizer.exe. The script uses an isolated temporary state directory and removes it afterward. It processes the synthetic fixtures/json-synthetic/json-jobs.txt, retrieves the original using tee read, compares every byte and verifies that a failing command retains its diagnostic and exit code.
Measured with the command above: 36751 → 2700 bytes, 12735 → 1340 tokens, tiktoken-rs/o200k_base, token_count_method: exact. Recovery is byte-for-byte identical; the failure returns 7. These numbers apply only to this fixture, not to arbitrary projects or API bills.
See it work
tool-output processes output that a host already captured (exec runs the command and applies the same view). A JSON array of objects becomes a table, and the exact original stays one command away. From a clone of this repository, replay this bundled capture, the last eight tags of serde-rs/json from the public GitHub API (3731 bytes):