Documentation
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
- 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
- Storage backendsChoose a memory store for llmslim.memory, llmslim serve and llmslim mcp: InMemoryStore, SQLite, Postgres (Neon included), MongoDB, or any object with the MemoryStore methods.6 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
API Reference
- 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 77 public names in llmslim, generated from the source of llmslim 0.12.0.33 min read
- API reference: llmslim.memorySignatures, type annotations and docstrings of the 9 public names in llmslim.memory, generated from the source of llmslim 0.12.0.10 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