Less noise.
More useful context.
lm-resizer helps Claude Code and Codex spend fewer tokens on raw logs and more context on reasoning. It filters noisy tool output, compresses provider payloads, and keeps the raw data recoverable when the agent needs it.
INFO running cargo test
DEBUG cache miss abc123
WARN repeated stack trace
ERROR expected `}` at line 87
...
1,284 repeated lines
huge provider JSON payload
diff noise and search output
score
offload
SUMMARY
Parser failure in src/parser/mod.rs at line 87.
RELEVANT CONTEXT
85 let item = parse_item(tokens)?;
86 items.push(item);
87 // expected `}`
RECOVERY
[full output: ccr://sha256/...]
Why readers should care
AI coding agents are only as useful as the context they can still see. If the window is full of repeated logs, long diffs and raw JSON, the model has less room left for the actual reasoning. lm-resizer keeps the important signal visible while moving bulk data into recoverable local storage.
Make failures readable
Errors, warnings, file paths, failing tests and next steps stay visible instead of being buried in raw logs.
Save context without losing proof
Large or failed command output can be saved locally and referenced through CCR, so compression does not mean losing evidence.
Fit real agent workflows
Use it as a CLI wrapper, MCP server, Codex/Claude hook helper, local proxy, C ABI or WASM package.
Two complementary repositories
Code Explorer and lm-resizer are designed to work together. Code Explorer gives the agent a queryable map of the repository. lm-resizer protects the agent's working context while commands, tools and model providers produce noise. Together: know the codebase, then keep the execution loop clean.
Code Explorer
Answers structural questions: where is the logic, what calls this, what changes if this symbol moves?
lm-resizer
Filters the noisy outputs produced while the agent tests, searches, builds, reviews and calls providers.
Code Buddy toolchain
A practical direction for agentic coding: map the repo, preserve context, orchestrate the work.
Agent alone vs. agent with lm-resizer
The point is not only to compress text. The point is to make Claude Code and Codex easier to trust because the prompt contains less waste and more useful evidence.
| Workflow | Without lm-resizer | With lm-resizer |
|---|---|---|
| Shell commands | Raw output floods the prompt | Filtered output plus raw recovery hint |
| Build failures | Useful errors buried in repeated logs | Failures, files and next steps stay visible |
| Large JSON / diffs | Context gets consumed by structure noise | Minified, summarized or offloaded safely |
| Claude / Codex sessions | Every session invents its own filtering habits | Shared local compression rules and hooks |
| Provider proxying | Payloads go upstream as-is | OpenAI, Anthropic, Bedrock and Vertex shapes can be previewed or forwarded |
Connect Claude Code, Codex and MCP agents
Install project instructions or native hook configs, then route noisy tool output through a consistent local compression layer.
# Native hook configs for Claude Code and Codex lm-resizer init-native-hooks --client all --project-dir . --force # Reversible agent guidance blocks lm-resizer install-hooks --client codex --project-dir . --force lm-resizer install-hooks --client claude --project-dir . --force
# MCP stdio server lm-resizer mcp # Install MCP config where supported lm-resizer install --client claude --scope project lm-resizer install --client codex --scope global
Proxy, MCP and local APIs
Run lm-resizer beside your agent as a local service. It can compress direct HTTP requests, OpenAI-compatible routes, Anthropic messages, Bedrock and Vertex route shapes, or expose a small MCP tool surface.
HTTP compression
POST /compress, GET /retrieve/:hash and GET /stats provide a small local API for custom tools.
Provider-compatible proxy
/v1/chat/completions, /v1/responses, /v1/messages, Bedrock and Vertex shapes support preview or upstream forwarding.
Embeddable core
Use the Rust API, C ABI or WASM wrapper when you want the same compression pipeline inside another host.
Quick start
# Build the local binary git clone https://github.com/phuetz/lm-resizer cd lm-resizer cargo build --release # Compress a file or command output lm-resizer compress --input tool-output.txt --json lm-resizer exec --stream -- cargo test
# Run the local proxy lm-resizer serve --bind 127.0.0.1:8787 # Evaluate real Claude/Codex session logs lm-resizer discover-sessions --agent all --markdown lm-resizer eval fixtures/sessions --recursive --markdown
Part of a visible agent-tooling story
lm-resizer is the context-budget layer. Code Explorer maps the codebase, Code Buddy orchestrates coding work, and lm-resizer keeps command output, diffs, logs and provider payloads small enough for agents to use effectively.
Created by Patrice Huetz as part of a practical toolchain for developers who want AI agents to work on real repositories, not just demos.
Built in Rust, local-first, Apache-2.0 licensed, and designed for real Claude Code, Codex and MCP workflows.