LangChain chat message history backed by SuperLocalMemory V2 — 100% local, zero cloud
Project description
langchain-superlocalmemory
LangChain chat message history backed by SuperLocalMemory V2 -- 100% local, zero cloud.
Every message stays on your machine in a SQLite database. No API keys, no subscriptions, no telemetry.
Prerequisites
- Python 3.10+
- SuperLocalMemory V2 installed (
~/.claude-memory/must exist) langchain-core >= 1.0.0
Installation
pip install langchain-superlocalmemory
Or install from source:
cd integrations/langchain
pip install -e .
Quick Start
from langchain_core.messages import AIMessage, HumanMessage
from langchain_superlocalmemory import SuperLocalMemoryChatMessageHistory
# Create a history for a conversation session
history = SuperLocalMemoryChatMessageHistory(session_id="my-chat-session")
# Add messages
history.add_messages([
HumanMessage(content="What is SuperLocalMemory?"),
AIMessage(content="It's a local-first memory system for AI assistants."),
])
# Retrieve messages (chronological order)
for msg in history.messages:
print(f"{msg.type}: {msg.content}")
# Clear the session
history.clear()
Features
- Local-first storage -- all data stays in
~/.claude-memory/memory.db - Session isolation -- each
session_idis completely independent - Full LangChain compatibility -- implements
BaseChatMessageHistory - Persistent across restarts -- SQLite-backed, survives process exit
- Works alongside SLM -- messages are queryable via CLI, MCP, Skills, and REST API
- All message types -- HumanMessage, AIMessage, SystemMessage, FunctionMessage, ToolMessage
- additional_kwargs preserved -- metadata round-trips through serialization
Multi-Session Example
from langchain_superlocalmemory import SuperLocalMemoryChatMessageHistory
# Two independent conversations
support = SuperLocalMemoryChatMessageHistory(session_id="support-ticket-42")
coding = SuperLocalMemoryChatMessageHistory(session_id="code-review-pr-99")
# Messages are isolated -- support session cannot see coding session
support.add_messages([HumanMessage(content="My app is crashing")])
coding.add_messages([HumanMessage(content="Review this PR please")])
assert len(support.messages) == 1
assert len(coding.messages) == 1
Custom Database Path
By default the package uses ~/.claude-memory/memory.db. You can point to a different database:
history = SuperLocalMemoryChatMessageHistory(
session_id="my-session",
db_path="/path/to/custom/memory.db",
)
How It Works
Each LangChain message is stored as an individual memory entry in SuperLocalMemory V2:
- Content: JSON-serialized message (type, content, additional_kwargs)
- Tags:
["langchain", "langchain:session:<session_id>"] - Importance: 3 (lower than user memories, so chat history does not crowd search results)
- Project:
"langchain"
This means your LangChain conversations are visible in the SLM dashboard, searchable via slm recall, and accessible from any SLM-integrated tool.
License
MIT -- see LICENSE for details.
Links
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file langchain_superlocalmemory-0.1.0.tar.gz.
File metadata
- Download URL: langchain_superlocalmemory-0.1.0.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f5e39a78d9f17c573403e42cb223e67b77163eb66f979acc7345a60b5e02ed0
|
|
| MD5 |
c15061e7f3813dd03fa0a9192ce74bfe
|
|
| BLAKE2b-256 |
19b3d438e63eb60b4cde761204e26c93d093e424b4bf880a6614e4bb5bfda38a
|
File details
Details for the file langchain_superlocalmemory-0.1.0-py3-none-any.whl.
File metadata
- Download URL: langchain_superlocalmemory-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c4c847b6cd0cc7f1ffe731ceeea249cb69acc33d6786504013aefff5e95e3925
|
|
| MD5 |
c46a177974ea05c0845067c6ef4d28bf
|
|
| BLAKE2b-256 |
b3ae35fa1a04e276abf496c47a04080455e2822ebbe48ebc5a7cad3adce76314
|