phuetz

Lm Resizer — AI skill for Claude Code

AI community

Rust-native context compression for Claude Code, Codex & MCP agents: filters & compresses noisy tool output (tests, diffs, logs, JSON, provider traffic) before it reaches the LLM — fewer wasted tokens.

How to install Lm Resizer

This entry records only its repository, not the path inside it, so there is no exact command to give. Open phuetz/lm-resizer and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Lm Resizer does

Rust-native context compression for Claude Code, Codex & MCP agents: filters & compresses noisy tool output (tests, diffs, logs, JSON, provider traffic) before it reaches the LLM — fewer wasted tokens, full evidence recoverable. Local-first, Apache-2.0. Pairs with Code Explorer.

Alternatives in AI

  • Paritok 4b V1 — Non-destructive compression gateway for AI coding agents 1.4k ★
  • Riteway — Simple, readable, helpful unit tests 1.2k ★
  • Tokentap — Intercept LLM API traffic and visualize token usage in a real-time terminal dashboard 763 ★

README

lm-resizer

Make **Claude Code** and **Codex** work with less noise, fewer wasted tokens, and more useful context.

![lm-resizer in action](docs/lm-resizer-hero.png)

One `cargo test` run through `lm-resizer`: **398 commands, 1.23 MB → 372 KB, 222,247 tokens saved** — signal kept, noise dropped, nothing lost (full output stays recoverable).

Website:

French README: [README.fr.md](README.fr.md)

`lm-resizer` is designed for a practical agent problem: Claude Code, Codex, and MCP agents spend a surprising amount of their context window on raw tool output. Its purpose is simple: **save tokens and preserve useful context by removing, compressing, or offloading data the model does not need to reason well**.

When an agent runs commands such as `cargo test`, `npm test`, `git diff`, `rg`, linters, package managers, or provider/API calls, the raw output often contains thousands of repeated, low-value, or structurally noisy lines. Sending all of that to the LLM wastes tokens, fills the context window, and can hide the real error. `lm-resizer` filters and compresses that output before it reaches the agent, while keeping important failures, file paths, summaries, and recovery links visible.

**Why this matters even with large context windows.** Bigger windows (200K, 1M+) don't make noisy output free — they make it *expensive in three ways*: **cost** (you pay per token, every turn), **latency** (more tokens = slower responses), and **attention dilution** — models reason worse when the signal is buried in noise ("lost in the middle"). `lm-resizer` is about **signal density**, not fitting under a size limit: keep what the agent needs to reason, drop the rest, keep the full output recoverable. It can also compress **query-aware** — biasing retention toward the rows relevant to the user's current question when it must drop anything.

**Provider-agnostic, validated live.** lm-resizer sits in front of any OpenAI/Anthropic-compatible API.