Skip to main content

langchain-superlocalmemory

LangChain integration for SuperLocalMemory V3 — local-first AI memory with mathematical foundations.

Features

  • SuperLocalMemoryChatHistory — Drop-in BaseChatMessageHistory for conversation persistence across sessions
  • SuperLocalMemoryRetriever — BaseRetriever for RAG-style memory augmentation with 4-channel retrieval
  • Direct Python API — No subprocess calls, no CLI dependency at runtime
  • Privacy-first — All data stays on your device (Mode A: zero cloud)

Installation

pip install langchain-superlocalmemory

Requires SuperLocalMemory V3 to be installed:

pip install "superlocalmemory[search]"
# or
npm install -g superlocalmemory && slm setup

Usage

Chat Message History

from langchain_superlocalmemory import SuperLocalMemoryChatHistory
from langchain_core.runnables.history import RunnableWithMessageHistory

# Create history for a session
history = SuperLocalMemoryChatHistory(session_id="my-project")

# Use with RunnableWithMessageHistory
chain_with_memory = RunnableWithMessageHistory(
    chain,
    lambda session_id: SuperLocalMemoryChatHistory(session_id=session_id),
    input_messages_key="input",
    history_messages_key="history",
)

Memory Retriever (RAG)

from langchain_superlocalmemory import SuperLocalMemoryRetriever

retriever = SuperLocalMemoryRetriever(k=5, score_threshold=0.3)
docs = retriever.invoke("authentication middleware patterns")

for doc in docs:
    print(f"{doc.page_content} (score: {doc.metadata['score']:.2f})")

Modes

Mode Privacy Performance Use Case
a Maximum (zero cloud) 74.8% LoCoMo EU AI Act compliant
b High (local Ollama) Higher Private + LLM assist
c Standard (cloud LLM) 87.7% LoCoMo Maximum accuracy
# EU AI Act compliant (default)
history = SuperLocalMemoryChatHistory(session_id="s1", mode="a")

# Full power
history = SuperLocalMemoryChatHistory(session_id="s1", mode="c")

Links

License

MIT

Part of Qualixar | Author: Varun Pratap Bhardwaj

Metadata

Release files for langchain-superlocalmemory 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langchain-superlocalmemory 0.1.1
File Size Uploaded
langchain_superlocalmemory-0.1.1.tar.gz 9.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for langchain-superlocalmemory 0.1.1
File Interpreter ABI Platform
langchain_superlocalmemory-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 17.8 kB

Release files / langchain_superlocalmemory-0.1.1.tar.gz

Download URL langchain_superlocalmemory-0.1.1.tar.gz
Size 9.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b723b8726dd178c5bf1746f336f8b98e1ddfe9274725dbd450d073ccd575baea
BLAKE2b-256 checksum
How to use checksums
f1f436fa81e68bbc434a00b9f5092022d43325dbeff5fb4f2b4380f7197f537a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 19, 2026.

Transparency log

Release files / langchain_superlocalmemory-0.1.1-py3-none-any.whl

Download URL langchain_superlocalmemory-0.1.1-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d9b7804b016d1dd6cd31b4ba28f04cec29ac6f78f3d8d8f07228d4434502450a
BLAKE2b-256 checksum
How to use checksums
87e4b524a985205af86222ecee4476be4a7c9399c5943265c138e81dd6e13990
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 19, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page