LLMSlim Context and Memory
Compress context to a token budget and retrieve long-term agent memory locally, with no default LLM call.
- Source repo
- Thanatos9404/llmslim
- Stars
- ★ 21
- Last updated
- today
- License
- MIT
- Primary language
- Python
- FA score
- 70/100 · Some gaps
At a glance
- How it runs
- 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
- 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.
- Developers who want Claude Code, Codex, or another MCP client to recall user facts across sessions can run the local SQLite memory server.
- Engineers building RAG applications with a retrieval-context token budget can compress documents with
compress_documentsor a framework adapter. - Application developers fitting long chat histories into a model context can use
compress_chat_messagesor an agent history adapter. - Teams planning context from several sources and wanting to inspect selection reasons can use
plan_contextorContextRuntimein a Python application. - Claude Code users who repeatedly send long test or build logs can try the local
llmslim wrap claudeproxy 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 mcppip install llmslimpip install "llmslim[server]"
npm install llmslimHow 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 statsWhat are this agent's strengths and limitations?
- 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.
- 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?
Why each dimension lost points
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.
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.
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.
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.
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.
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.
- 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.
FAQ
Do I need an API key or paid model for default use?
Does memory automatically summarize or extract facts?
Can default retrieval handle synonyms and paraphrases?
relevance="semantic" adds semantic reranking, with extra dependencies and a first-use model download.