Memlayer
Plug-and-play persistent memory layer for LLMs that adds intelligent, context-aware recall to any AI agent in 3 lines of code.
At a Glance
Fully free and open-source under the MIT license. Install via pip and use with any supported LLM provider.
Engagement
Available On
Alternatives
Listed Sep 2026
About Memlayer
Memlayer is an open-source Python library created by Divyansh Agrawal that adds persistent, intelligent memory to any LLM with minimal setup. It is available on PyPI under the MIT license and supports OpenAI, Claude, Gemini, Ollama, and LMStudio providers through a unified API. The project reached v0.1.8 shortly after its November 2025 launch and has accumulated over 290 GitHub stars and 33 forks.
What It Is
Memlayer is a memory middleware layer that sits between your application code and any LLM provider. Rather than requiring developers to manually manage conversation history or build retrieval pipelines, Memlayer automatically filters salient information from conversations, extracts structured knowledge, stores it in a hybrid vector-plus-graph backend, and injects relevant context into subsequent LLM calls — all without manual prompting. The library is designed to be dropped into existing projects with a single pip install memlayer command.
How the Memory Pipeline Works
Every conversation passes through several automatic stages:
- Salience gate — A noise-aware filter using prototype embeddings and TF-IDF decides whether a message contains information worth storing (facts, preferences, decisions) versus filler (greetings, acknowledgments).
- Knowledge extraction — An LLM extracts structured facts, named entities, and relationships from salient content in a background thread so the user never waits.
- Hybrid storage — Facts go into ChromaDB for semantic vector search; entities and relationships go into a NetworkX knowledge graph for structured traversal.
- Multi-tier retrieval — At query time, Memlayer selects Fast (<100ms, 2 vector results), Balanced (<500ms, 5 results), or Deep (<2s, 10 results + graph traversal) based on query complexity.
Operation Modes
Three modes control both salience filtering and storage composition:
- LOCAL — Uses a local sentence-transformers model for embeddings; runs fully offline with no API cost; ~10s startup due to model loading.
- ONLINE — Uses the provider's embeddings API (e.g., OpenAI); ~2s startup with no local model loading; suited for serverless and cloud functions.
- LIGHTWEIGHT — Keyword-based filtering with NetworkX graph-only storage; instant startup; best for prototyping and low-resource environments.
Advanced Capabilities
Beyond basic recall, Memlayer exposes several additional features documented in the repository:
- Proactive task reminders — Users can schedule tasks in natural language; Memlayer automatically injects due reminders into future responses.
- Knowledge graph extraction API —
analyze_and_extract_knowledge()returns structured facts, entities, and typed relationships from any text. - Built-in observability —
client.last_traceexposes per-event timing so developers can inspect search tier selection and latency breakdowns. - Tunable salience threshold — A
salience_thresholdparameter controls how strictly the memory gate filters content. - Streaming support — Documented streaming mode for real-time response delivery.
Update: v0.1.8
The latest release, v0.1.8 ("Memlayer v0.1.8 - Plug and Play Memory for LLMs"), was published on November 22, 2025, shortly after the repository was created on November 16, 2025. The repository was last updated in early 2026, indicating active early-stage development. The project is tagged on GitHub with topics including llm-memory, knowledge-graph, rag, vector-database, and semantic-search, reflecting its hybrid retrieval architecture.
Community Discussions
Be the first to start a conversation about Memlayer
Share your experience with Memlayer, ask questions, or help others learn from your insights.
Pricing
Open Source
Fully free and open-source under the MIT license. Install via pip and use with any supported LLM provider.
- MIT license
- All operation modes (LOCAL, ONLINE, LIGHTWEIGHT)
- All LLM providers (OpenAI, Claude, Gemini, Ollama, LMStudio)
- Hybrid ChromaDB + NetworkX storage
- Multi-tier retrieval
Capabilities
Key Features
- Persistent memory across conversations
- Salience-based memory filtering (noise-aware gate)
- Hybrid storage: ChromaDB vector + NetworkX knowledge graph
- Multi-tier retrieval: Fast (<100ms), Balanced (<500ms), Deep (<2s)
- Three operation modes: LOCAL, ONLINE, LIGHTWEIGHT
- Universal LLM provider support: OpenAI, Claude, Gemini, Ollama, LMStudio
- Automatic knowledge extraction (facts, entities, relationships)
- Proactive task reminders
- Built-in observability and tracing
- Tunable salience threshold
- Streaming support
- 100% local / offline-first operation
- Zero config setup
- Background consolidation (non-blocking)
