/lm-resizer:lm-resizer [command to wrap]from lm-resizer
Keep noisy command output (tests, builds, package managers, diffs, logs, large JSON) out of the context window by running it through lm-resizer. Use whenever a shell command is likely to print more than a screen, when a previous command flooded the conversation, or when the user asks to save tokens. The full output always stays recoverable.
Ships in lm-resizer. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
lm-resizer sits between a command and the model. It keeps errors, file paths and summaries, drops repeated noise, and stores the raw output locally so nothing is lost. It never executes anything on its own: you wrap the command explicitly.
The CLI is lm-resizer (cargo build --release → target/release/lm-resizer, or the @phuetz/lm-resizer npm package for the WebAssembly module). Check it is reachable with lm-resizer stats before relying on it; if it is missing, say so and run the command normally.
Wrap anything that is likely to print more than a screen:
cargo test, npm test, vitest, jest, pytest, dotnet test, go test)cargo build, npm install, dotnet build, pip install, mvn, gradle)kubectl/aws listings, big JSON payloadsDo not wrap short, one-line commands (git status, ls, pwd): the wrapper would cost more than it saves.
lm-resizer exec --raw-on-failure -- <command> # summary on success, RAW output when the command fails
lm-resizer exec --raw-on-failure -q "why does test X fail" -- npm test # query-aware: keeps what answers the question
lm-resizer exec --raw-on-failure --stream -- cargo build --release # long command: live stream, then the filtered result
lm-resizer exec --json -- <command> # metadata (bytes before/after, steps, CCR key) instead of text
--raw-on-failure is the default you want: a failing command must never be summarised away. Always report the exit code of the wrapped command, not of lm-resizer.
Preview a rewrite without running it: lm-resizer rewrite <command> / lm-resizer rewrite-shell '<full shell line>'.
Filtered does not mean lost. When you need the evidence:
lm-resizer tee list # raw recovery files written by exec
lm-resizer tee read <file> # print one of them
lm-resizer retrieve <ccr-hash> # fetch an offloaded blob by its CCR key (shown in the compressed output)
Prefer retrieving a specific file over re-running the noisy command.
lm-resizer stats --markdown
When you finish a task that used lm-resizer, add one line to your report: how many commands were wrapped and how many bytes/tokens were saved (from stats). Never claim savings you did not measure.
lm_resizer_compress, lm_resizer_tool_output (post-execution reduction of output you already have; never runs commands), lm_resizer_retrieve, lm_resizer_stats. Install once per project: lm-resizer install --client claude --scope project.
lm-resizer install-hooks --client claude --project-dir . adds a marked, reversible guidance block to CLAUDE.md.lm-resizer init-native-hooks --client claude --project-dir . installs a PreToolUse hook that routes supported commands through exec automatically. Remove with uninstall-hooks.If the Code Explorer skill is available, map the repository first (code-explorer status, then context/impact/query) and wrap the commands you run afterwards with lm-resizer. Understand, compress, act.
--raw-on-failure on every wrapped command.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
2 skills in this plugin
npx claudepluginhub phuetz/lm-resizer --plugin lm-resizer