# Coding agents

> **Upcoming in 1.0 (preview). These pages describe the main branch of LLMSlim Core, which becomes the 0.13 release candidate and then 1.0. `pip install llmslim` installs 0.12.0 today, which doesn't have everything described here.** Docs for what pip installs: https://www.llmslim.app/docs.md

> Memory across sessions for Claude Code, and leaner tool output with an experimental proxy.

Give Claude Code long-term memory over MCP, import its past sessions, and shorten long tool output with llmslim wrap claude (experimental).

Category: Guides & Strategies · Version: 1.0 · Updated: November 2026 · 6 min read

## What LLMSlim does for a coding agent

Three independent pieces; use any of them.

- **Memory across sessions.** `llmslim mcp` gives Claude Code `remember` and `recall` tools, so what you said last week is there today.
- **Leaner tool output** (experimental). `llmslim wrap claude` runs Claude Code through a local proxy that shortens long shell, search and web output once and resends the same bytes afterwards.

## Bring past sessions

`llmslim import claude-code` stores your earlier Claude Code sessions in the same memory the MCP server reads, so `recall` finds them too. See [Import your chat history](https://www.llmslim.app/docs/1.0/import-history).

## Memory over MCP

Add the server to Claude Code, or install the LLMSlim plugin, which also adds the `/llmslim:wrap-claude` and `/llmslim:savings` commands. Details, other clients and options are in the [MCP quickstart](https://www.llmslim.app/docs/1.0/quickstart-mcp).

terminal:

```bash
pip install "llmslim[mcp]"
claude mcp add llmslim -- llmslim mcp
```

## Shorten tool output: llmslim wrap claude

Coding agents resend their whole conversation on every turn, so a long test log is paid for again and again, and fills the context until the agent compacts. The proxy shortens long tool output the first time the model is about to see it.

terminal:

```bash
pip install "llmslim[proxy]"
llmslim wrap claude                 # interactive, as usual
llmslim wrap claude -- -p "Run the tests and fix what fails" --model claude-sonnet-5-5
llmslim proxy stats                 # what it has saved so far
```

Running `llmslim wrap claude` uses your own Claude Code login or API key, as Claude Code always does.

> **Experimental:** `llmslim wrap`, `llmslim proxy` and `llmslim.proxy` sit on the Anthropic Messages wire format and on Claude Code's traffic, which change without notice. A minor release may change them.

## What it changes, and what it never touches

Output from `Bash`, `PowerShell`, `Grep`, `Glob`, `WebFetch`, `WebSearch` and `Monitor` is shortened when it is longer than 1,500 tokens, to at most about 35% of its tokens (or 1,000, if that is larger):

- lines that look like errors, failures, warnings and tracebacks come first, then the lines most related to the call;
- runs of near-identical lines collapse into one line with a count, and a one-line note tells the model the output was shortened;
- output that is one whole JSON document is left alone unless you pass `--json`;
- MCP tools are opt-in (`--tool mcp__server__tool`, or `--mcp` for all), because some return live state, such as a browser snapshot.

Never touched: `Read`, `Edit` and `Write` output and any tool not listed; output seen before the proxy started; system prompts, tool definitions, assistant turns, thinking, `cache_control` and every header. Each decision is stored in `~/.llmslim/proxy.db` under the tool call id and the text, and replayed byte for byte whenever Claude Code resends that output.

## What the model receives

A 10,545-token pytest log with one failure, as it goes upstream through the proxy:

tool result, as sent:

```text
[LLMSlim shortened this tool output from 10,545 to about 117 tokens, keeping errors and the lines most related to the call. Run a narrower command to see more.]
tests/test_api.py::test_endpoint_0 PASSED [0%]
... [410 similar lines]
tests/test_api.py::test_endpoint_411 PASSED [58%]
tests/billing/test_refund.py::test_rounding_half_even FAILED - AssertionError: Decimal('10.05') != Decimal('10.04')
tests/test_api.py::test_endpoint_412 PASSED [58%]
... [286 similar lines]
tests/test_api.py::test_endpoint_699 PASSED [99%]
=== 1 failed, 700 passed in 41.27s ===
```

llmslim proxy stats:

```text
Requests changed:   1
Outputs compressed: 1 (replayed 0 times)
Input tokens:       10,545 -> 156
Tokens not sent:    10,389
```

What it saves depends on the work: it helps most on mid-sized logs whose useful line sits in the middle, and does little where agents already trim output. The measured effect on real Claude Code bills is on [the Claude Code page](https://www.llmslim.app/integrations/claude-code).

## Limits worth knowing

Before you rely on it:

- Claude Code saves shell output over about 30,000 characters to a file and shows the model a 2 KB preview; the proxy sees only that preview.
- With a custom base URL, Claude Code turns Remote Control off and tool search off. `llmslim wrap claude` sets `ENABLE_TOOL_SEARCH=true` unless you set it; set it yourself when you run `llmslim proxy` on its own.
- Print-mode runs (`-p`) start with `--permission-mode default` unless you pass a permission flag or settings of your own.
- With a custom `ANTHROPIC_BASE_URL`, Claude Code skips a Team or Enterprise organization's server-managed settings. Don't use the proxy where those must apply.
- Keep `~/.llmslim/proxy.db` for as long as a session lasts: entries are kept for 30 days after their last use.

## Security

The proxy listens on 127.0.0.1 and refuses other interfaces unless you pass `--allow-remote`. Its upstream is fixed when it starts (`--upstream`, `LLMSLIM_PROXY_UPSTREAM` or `ANTHROPIC_BASE_URL`), so it isn't an open relay. Your credentials go to that upstream unchanged and are never stored or logged. `~/.llmslim/proxy.db` holds tool output, original and shortened, so treat it like your shell history. If a request can't be rewritten, the original is forwarded.

## Run the proxy yourself

For other setups, start the proxy and point Claude Code at it.

| Flag | Default | Meaning |
|---|---|---|
| `--min-tokens` | `1500` | Leave output at or below this alone. |
| `--keep-ratio` | `0.35` | Fraction of a long output to keep. |
| `--min-keep` | `1000` | Never shrink output below this. |
| `--tool`, `--never` |  | Add a tool to compress, or exempt one (repeatable). |
| `--mcp` | off | Also compress every MCP tool's output. |
| `--json` | off | Also compress JSON output. |
| `--db` | `~/.llmslim/proxy.db` | Where decisions and savings are kept (`LLMSLIM_PROXY_DB`). |

terminal:

```bash
llmslim proxy --port 8787                       # then: ANTHROPIC_BASE_URL=http://127.0.0.1:8787 claude
llmslim proxy --upstream https://my-gateway.example.com   # in front of an existing gateway
llmslim proxy stats --days 7 --price-per-mtok 3
```

LangChain 1.x agents get the same first-sight shortening as middleware: [`LLMSlimToolOutputMiddleware`](https://github.com/Thanatos9404/llmslim/blob/main/docs/integrations/LANGCHAIN.md#agents-shorten-long-tool-output-langchain-1x) in `llmslim[langchain-agents]`.

## FAQ

### Does the proxy call a model?

No. It runs no model, and nothing leaves your machine except the requests Claude Code was already sending, shorter where tool output was long.

### Does it break prompt caching or thinking?

No. Output is shortened the first time the model is about to see it, and the same bytes go out on every later request, so the cached prefix and Claude's thinking signatures stay valid.

### Does it work with Codex or other agents?

Not yet: only the Anthropic Messages API is supported.

## Related

- [MCP quickstart](https://www.llmslim.app/docs/1.0/quickstart-mcp.md)
- [Import your chat history](https://www.llmslim.app/docs/1.0/import-history.md)

Canonical page: https://www.llmslim.app/docs/1.0/coding-agents
