Skip to main content

Coding agents

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

6 min readUpdated November 2026

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.

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.

terminalbash
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.

terminalbash
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.

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 senttext
[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 statstext
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.

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.

FlagDefaultMeaning
--min-tokens1500Leave output at or below this alone.
--keep-ratio0.35Fraction of a long output to keep.
--min-keep1000Never shrink output below this.
--tool, --neverAdd a tool to compress, or exempt one (repeatable).
--mcpoffAlso compress every MCP tool's output.
--jsonoffAlso compress JSON output.
--db~/.llmslim/proxy.dbWhere decisions and savings are kept (LLMSLIM_PROXY_DB).
terminalbash
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 in llmslim[langchain-agents].

Questions

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.