Documentation · 1.0 preview
Start in one line. Go as deep as you need.
Short guides for agent memory with no LLM in the loop, from Python, MCP, HTTP and TypeScript, and for fitting chat, retrieval and tool output into a real token budget.
from llmslim.memory import Memory
memory = Memory("memory.db")
memory.add("I moved to Pune last month.",
user_id="asha")
context = memory.search("Where did I move to?",
user_id="asha")
print(context.text) # what answers itGetting Started
- Python quickstartInstall llmslim, store turns word for word with Memory, and get back what answers a question within a token budget.4 min read
- MCP quickstartInstall llmslim mcp, connect Claude Code (command or plugin), Claude Desktop or Cursor, and use the remember, recall, forget and fit_context tools.4 min read
- HTTP quickstartRun llmslim serve, store and search memory with curl, add API keys, and run the server from Python.5 min read
- TypeScript quickstartInstall the llmslim npm package, store and search memory from TypeScript, and give AI SDK and Mastra agents recall_memory and remember tools.5 min read
- Compression quickstartInstall LLMSlim and compress long prompts with the Python API.5 min read
Guides & Strategies
- Import your chat historyNewllmslim import reads Claude Code transcripts, ChatGPT and Claude.ai exports, Mem0 exports and JSONL, and stores each message verbatim under its original time, with no model call.6 min read
- Explain a searchNewMemory.search(..., explain=True) says for every stored turn whether it was kept, cut or left out and why, with its tokens and share of the budget.5 min read
- Coding agentsGive Claude Code long-term memory over MCP, import its past sessions, and shorten long tool output with llmslim wrap claude (experimental).6 min read
- OpenAI-compatible endpointExperimentalStart llmslim serve with an upstream, and POST /v1/chat/completions recalls and stores memory for the OpenAI SDKs and voice platforms with a custom LLM setting.7 min read
- Storage backendsChoose a memory store for llmslim.memory, llmslim serve and llmslim mcp: InMemoryStore, SQLite, Postgres, MongoDB, or any object with the MemoryStore methods.5 min read
- Remote MCPExperimentalllmslim mcp --transport http serves remember, recall and the other tools over MCP's Streamable HTTP transport, with bearer keys, one scope per server, and TLS in front.5 min read
- MCP catalogs and agent hostsUse LLMSlim's MCP catalog sources, context plans, scoped caching, and the optional OpenAI Agents SDK bridge.4 min read
Core Concepts
Migration
- Upgrade from 0.x to 1.0NewThe breaking and default changes between LLMSlim 0.12 and 1.0: Python 3.10, date_format defaulting to None, narrower __all__ lists, planner_version, keyless servers, and what is new.7 min read
- Migrate from Mem0Move from Mem0 to LLMSlim: export memories with get_all, import them with llmslim import mem0 (or a Memory.add loop on 0.12), and keep your code with the Mem0-compatible Mem0Memory.6 min read
API Reference
- API stabilityNewLLMSlim's public API contract from 1.0: semantic versioning, the deprecation policy, experimental and internal API, and the command line, HTTP routes, MCP tools and stored memory.5 min read
- Document and chat pipelinesCompress retrieved documents and chat messages with role-aware defaults.4 min read
- Token counter telemetryRead token_counter_used and handle the heuristic fallback appropriately.2 min read
- API reference: llmslimSignatures, type annotations and docstrings of the 80 public names in llmslim, generated from the main branch (llmslim 0.12.0 and the changes since, not released yet).37 min read
- API reference: llmslim.memorySignatures, type annotations and docstrings of the 19 public names in llmslim.memory, generated from the main branch (llmslim 0.12.0 and the changes since, not released yet).22 min read
Framework integrations
- LangChainA BaseDocumentCompressor for ContextualCompressionRetriever. Use it where you would use LLMLinguaCompressor.llmslim[langchain]
- LlamaIndexA BaseNodePostprocessor for query engines. Use it where you would use LongLLMLinguaPostprocessor.llmslim[llamaindex]
- HaystackA Haystack 2.x and 3 component that compresses retrieved documents between the retriever and the prompt builder.llmslim[haystack]
- gptmeA gptme context provider for automatic compaction and /compact trim. Older tool output is compressed instead of being replaced by a stub.llmslim[gptme]
- Hermes AgentA Hermes Agent context engine that compresses older turns locally instead of asking a model for a summary, so prompt caches keep hitting.Guide
- Pydantic AIA Pydantic AI history processor that fits the message history into a token budget before every model request. Tool calls and returns stay paired.llmslim[pydantic-ai]
- Vercel AI SDKLong-term memory for AI SDK agents as tools, with no LLM writing your memory and nothing injected into the prompt.Guide
- MastraLong-term memory for Mastra agents as tools and an output processor, with no LLM writing your memory and nothing injected into the prompt.Guide
Comparisons
- LLMSlim vs Mem0LLMSlim vs Mem0: verbatim memory with no LLM calls on write, LoCoMo and LongMemEval results with cost and 95% intervals, both pricing pages, and a tested Mem0 migration.Comparison
- LLMSlim vs ZepLLMSlim vs Zep: verbatim turns with no LLM calls on write against a temporal context graph, LoCoMo and LongMemEval results with cost and 95% intervals, pricing, and a migration path.Comparison
- LLMSlim vs LLMLinguaLLMSlim vs LLMLingua-2 and LongLLMLingua: how each compresses, same-budget results on NaturalQuestions, HotpotQA and LoCoMo with cost and confidence intervals, and migration code.Comparison