LLMSlim Context and Memory

Compress context to a token budget and retrieve long-term agent memory locally, with no default LLM call.

Stars
★ 21
Last updated
today
License
MIT
Primary language
Python

At a glance

How it runs
MCP serverLibrary / SDKCLI
Works with
Universal · cross-platformCodex · Claude CodeOpenAI API · Claude API (Partial support)
Cost
Free software; you pay for model usage
Setup effort
Low · running in minutes
You'll need
Python 3.10 or newer for the MCP serveruv for the documented one-click MCP setupShell / CLINetwork accessLocal filesystemMCP Server
Typical use
Developers who want Claude Code, Codex, or another MCP client to recall user facts across sessions can run the local SQLite memory server.
Not a fit if
  • Teams that need semantic retrieval but cannot install the optional reranker
  • Workflows that cannot tolerate compression dropping a needed fact
Source review
70/100 · Some gaps

What does this agent do, and when should you use it?

LLMSlim Core is an MIT-licensed Python library for context compression, planning, and long-term memory retrieval. It also runs as an MCP server through llmslim mcp or exposes an HTTP API through llmslim serve. Memory messages are stored verbatim in SQLite or Postgres, then deterministic code selects relevant messages within a budget; the default path makes no model call. The library supports Python 3.9 and newer, while the MCP server requires Python 3.10 or newer; a TypeScript client connects to the local HTTP service. Optional semantic reranking and provider integrations add dependencies, and rewrite modes use an LLM supplied by the caller.

Use Memory.add to store messages verbatim in SQLite or Postgres, then Memory.search to retrieve matching messages for a question within a token budget; the MCP server exposes remember, recall, list_memories, forget, and fit_context. compress, compress_documents, and compress_chat_messages process text, retrieved documents, and conversation messages; plan_context and ContextRuntime plan model-visible context and produce an explainable local trace. Users can also run llmslim wrap claude to compress some command output through a local proxy in front of Claude Code. Default extractive compression selects sentences from the input and can drop needed information; semantic reranking, rewriting, and provider calls need optional dependencies or explicit calls by the host application.

  1. Developers who want Claude Code, Codex, or another MCP client to recall user facts across sessions can run the local SQLite memory server.
  2. Engineers building RAG applications with a retrieval-context token budget can compress documents with compress_documents or a framework adapter.
  3. Application developers fitting long chat histories into a model context can use compress_chat_messages or an agent history adapter.
  4. Teams planning context from several sources and wanting to inspect selection reasons can use plan_context or ContextRuntime in a Python application.
  5. Claude Code users who repeatedly send long test or build logs can try the local llmslim wrap claude proxy and assess its published cost measurements.

How do you install or deploy this agent?

The MCP server can be installed and started with uvx; it requires Python 3.10 or newer. The Python library supports Python 3.9 or newer. The HTTP server and TypeScript client require their respective packages.

claude mcp add llmslim -- uvx --from "llmslim[mcp]" llmslim mcp
pip install llmslim
pip install "llmslim[server]"
npm install llmslim

How do you use this agent?

Start llmslim mcp in an MCP client to use its five memory and context tools; by default the server stores data in the local SQLite file ~/.llmslim/memory.db. Python code can add original messages and retrieve context using a query and budget. To use the Claude Code proxy, install the proxy extra and launch Claude Code through the wrapper.

from llmslim.memory import Memory

mem = Memory("memory.db")
mem.add([{"role": "user", "content": "I'm allergic to peanuts."}], user_id="asha")
context = mem.search("Am I allergic to anything?", user_id="asha", budget=1500)
print(context.text)
pip install "llmslim[proxy]"
llmslim wrap claude
llmslim proxy stats

What are this agent's strengths and limitations?

Pros
  • Default memory writes and retrieval make no LLM or embedding API calls, and the server stores data in local SQLite by default.
  • MCP memory scope is fixed at server startup; the model cannot switch to another user's scope through tool arguments.
  • The same core offers Python, HTTP, and TypeScript paths, with optional adapters for LangChain, LlamaIndex, and Haystack.
  • Default extractive compression selects sentences from the input, producing repeatable output that is easier to inspect and test.
Limitations
  • Default lexical matching can miss differently worded questions; semantic retrieval needs an optional reranker and its first model download.
  • Extractive compression can drop an important sentence, so the README advises checking results for the intended use.
  • The MCP quick setup requires uv and Python 3.10 or newer; other integrations may need additional dependencies.
  • LLMSlim does not run provider rewrites or inference by default; the application must supply the SDK and credentials and make those calls.

How does this agent compare with similar options?

The README benchmarks LLMSlim against Mem0, Zep, LongLLMLingua, LLMLingua-2, and retrieval baselines, reporting accuracy and end-to-end cost. Results vary by dataset, budget, and reranker use; the README also reports that default lexical mode trails a plain reranker on NaturalQuestions and dense retrieval leads on LongMemEval.

Key facts side by side with the most closely related agents.

Agent Source review Form / cost Stars Updated Language Full support on
LLMSlim Context and Memory This agent 70 · Some gaps MCP serverFree + model costs ★ 21 today Python Codex · Claude Code
LeanCTX Context Intelligence 75 · Good CLIFree + model costs ★ 3.9k today Rust Codex · Claude Code · OpenAI API · Claude API
Entroly 68 · Some gaps CLIFree + model costs ★ 479 6d ago Python Codex · Claude Code · OpenAI API · Claude API
Remnic Agent Memory 85 · Good CLIFree + model costs ★ 229 1d ago TypeScript ChatGPT · Codex · Claude Code · OpenAI API

How does FollowAgents rate this agent?

FollowAgents source review · FARS-2.1
Some gaps
70/ 100 5-point scale 3.5 / 5
Trust 17/29
Reliability 8/14
Adaptability 15/18
Convention 16/18
Effectiveness 9/13
Verifiability 5/8
Why each dimension lost points
Trust17 / 29 · 2.9/5

The security documents describe fixed scope, source demotion, credential redaction, bounded inputs, and non-execution of tools, while assigning authentication and authorization to the host. This supports the least-privilege and data-flow scores. The material does not establish user confirmation for deletion tools such as forget or a general recovery process; dependency declarations mostly use broad lower bounds, with no dependency-audit evidence in the supplied files. Publisher identity is unknown and does not affect the score; author details and a security reporting channel provide some attribution.

Reliability8 / 14 · 2.9/5

CI configuration covers multiple platforms and Python versions, packaging, and integration checks, while documentation describes fail-closed behavior and error handling. The README distinguishes the base Python requirement from the MCP extra, but combines several product stages and version descriptions, making the current capability set harder to identify. Optional dependencies are separated, but the files do not establish continuous availability of external services or optional packages.

Adaptability15 / 18 · 4.2/5

The material targets developers and documents MCP, Python, HTTP, TypeScript, framework integrations, and concrete scenarios. Security boundaries and some experimental features are described, though the range of products and version stages means users must assemble applicability and trigger conditions across sections. Installation covers multiple environments and states Python, Node, network-download, and optional-extra requirements.

Convention16 / 18 · 4.4/5

The README has organized sections, installation notes, runnable examples, and limitation guidance; separate files cover security policy, staged threat models, licensing, and release workflows. Versions and changes are traceable, but Core, Platform, historical phases, and multiple version descriptions add interpretation cost. Author and security contact details are present, and supported versions are stated, though publisher provenance is unverified.

Effectiveness9 / 13 · 3.5/5

Memory retrieval, context compression, and budget planning have clear input/output examples that can feed a host model or application; local processing and optional integrations offer plausible value. The files also warn that lexical retrieval can miss differently phrased facts and extractive compression can drop needed information. Since benefit claims are primarily repository claims and their applicability cannot be independently confirmed in this static review, full marks are not justified.

Verifiability5 / 8 · 3.1/5

README claims have some support across threat models, configuration, and CI files, and versions, dependencies, and test procedures are traceable. Test badges and coverage figures remain repository claims; this review did not execute or independently verify them. Product stages and version descriptions coexist, and some benefit claims rely on benchmarks or external links, so corroboration and separation of fact from inference are adequate but incomplete.

Risks and how to mitigate them
  • Confirm the target user and scope before deleting memories, and arrange database backups where recovery matters; the material does not describe a general deletion rollback mechanism.
  • Retrieval and compression can omit relevant facts. The security documents also state that provenance labels are not prompt-injection prevention or authorization; hosts must authenticate sources, constrain tool permissions, and validate outputs.
  • The README combines several product stages and version descriptions; check the selected extra, runtime requirements, and target version before deployment.
Evidence confidence: Low Reviewed Oct 24, 2026 Reviewed revision 7ff8422135da
See the full review method →

FAQ

Do I need an API key or paid model for default use?
No. Default compression, memory writes, and retrieval do not call a model. Rewrite modes or provider integrations require the application to supply the client and credentials and pay any resulting usage costs.
Does memory automatically summarize or extract facts?
No. Messages are stored verbatim, and retrieval selects messages relevant to a question. The returned text should be added to a prompt as data, not instructions.
Can default retrieval handle synonyms and paraphrases?
Default lexical mode matches words and may miss a differently phrased query. Optional relevance="semantic" adds semantic reranking, with extra dependencies and a first-use model download.
Can the MCP server access another user's memory?
The server fixes the user and agent scope at startup, so the model cannot change scopes through tool arguments. See the MCP documentation for storage and configuration options.
Does compression guarantee that every important fact survives?
No. Extractive mode selects sentences and may drop needed information, so inspect its output. Rewrite mode calls an LLM supplied by the caller and validates the result, falling back to extractive output if validation fails.
View on GitHub ↗ Install ↓

Compare agents like this one

The same FARS review applied across the shortlist this agent qualifies for.

Related agents