SuperAPIAI Directory

llmslim

github.com · Other AI tools

LLMSlim is a long-term memory and context compression tool for AI agents and coding tools that does not call an LLM. It stores user and agent conversations verbatim and returns the parts that can answer the question within a set token budget. It can run as an MCP server, a Python library, or a small HTTP server, and supports SQLite, Postgres, or MongoDB storage. It uses deterministic lexical matching by default, with optional semantic reranking. It also provides context planning and compression features that can fit prompts, conversation history, RAG documents, and tool schemas within a token budget.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)

About this tool

LLMSlim is a tool that provides long-term memory and context selection for AI agents and coding tools; its core feature is that the storage and recall processes do not call an LLM. It stores verbatim what the user and agent say, then returns the parts that can answer the question according to the token budget you set.

Key capabilities:

  • Memory: provides five MCP tools: remember, recall, list_memories, forget, and fit_context. Messages are stored verbatim in SQLite, Postgres, or MongoDB, without summarization or extraction. recall returns stored messages within the token budget, and fit_context can compress long logs or documents to within the budget.
  • Safety scoping: user and agent IDs are fixed at server startup and are not set by the model, preventing a model manipulated by injected text from reading or deleting other users' memories.
  • No LLM calls: by default, storage and recall are pure code operations, requiring no model, embedding API, or API key. Recall is deterministic ranking; the same history and question always produce the same context, making testing easy.
  • Context compression: LLMSlim Core can compress prompts, chat history, retrieved documents, and tool schemas within a token budget. The default extractive mode only selects sentences from the input; the same input always produces the same output. The base installation estimates at about 4 characters/token; after installing llmslim[fast-tokens], it uses tiktoken for counting.
  • Adaptive context planner (v0.6.0): selects a safe representation for each context item, then uses a deterministic constrained allocator to fit the highest-value context into a limited model budget. Provides explainable per-item decisions, infeasibility reports, post-plan validation, token and cost telemetry, policy presets, and optional Sarvam AI, Zoho, and MongoDB integrations.
  • Multi-document RAG compression: compress_documents accepts plain strings and returns the result for each document in order. By default, documents are treated as untrusted (ContextRole.RAG), and imperative wording in retrieved documents is not forcibly retained as protected instructions.
  • Multi-turn chat compression: compresses earlier long turns while passing system instructions and user questions through unchanged.
  • Hybrid prompt optimization: combines ultra-fast extractive pre-filtering with deep semantic rewriting using your own LLM provider. Each rewriteIt verifies structure, instruction preservation, entity preservation, and similarity; if verification fails, it returns an extractive result and reports the reason.
  • Coding agent support: llmslim wrap claude runs Claude Code through a local proxy, compressing long output the first time it is seen, and sending exactly the same bytes on subsequent requests to keep prompt cache hits. This feature is experimental.
  • Claude Code plugin: adds a memory server and two commands: /llmslim:wrap-claude guides starting Claude Code through the proxy; /llmslim:savings shows an estimate of the number of tool output tokens the proxy excluded from requests.

Usage:

  • As an MCP server: run llmslim mcp, using uv (Python 3.10+). Memory is stored in the local SQLite file ~/.llmslim/memory.db. The first startup downloads LLMSlim and its dependencies.
  • Python library: pip install llmslim (Python 3.10+).
  • TypeScript: npm install llmslim (Node 18+), targeting llmslim serve (pip install "llmslim[server]").
  • Compression prompt: after installing LLMSlim Core, run the code snippet; no API key, model, or network call is required.

Use cases:

  • Provide long-term memory for AI agents, avoiding resending large amounts of history.
  • Compress RAG-retrieved documents, chat history, and tool schemas to fit token budgets.
  • Reduce the cost of long logs, build output, and search results from coding tools such as Claude Code.
  • Require deterministic, testable context selection.

Limitations:

  • The default lexical mode matches words rather than semantics, so questions with different wording may miss stored messages. Optionally use relevance="semantic" to add a cross-encoder (llmslim[semantic], which downloads the model on first use).
  • Extractive selection preserves complete sentences, not meaning; check whether the required sentences are retained.
  • llmslim wrap and llmslim proxy are experimental and may change in minor versions.
  • Token estimates in the base installation are approximate.
  • The website Studio source code is in a private repository; Core is MIT licensed.
  • Pricing, Orbit, and Vault product information are on external websites; this material does not provide specific prices.
Up/Down to navigate · Enter to open · ESC to closeBrowse all tools