Mimir persistent, local, encrypted memory for LangChain — tools and a retriever backed by the Mimir MCP engine.
Project description
langchain-mimir
Persistent, local-first, encrypted memory for LangChain, backed by Mimir — an open-source (MIT) memory engine with FTS5 + dense hybrid search and optional AES-256-GCM encryption, exposed over the Model Context Protocol (MCP) stdio transport.
It gives a LangChain agent durable memory that survives across runs and processes, stored in a single local SQLite file you control — no external service, no cloud.
What you get
This package wraps Mimir using the modern langchain-core interfaces:
create_mimir_tools(client)— a pair ofStructuredTools (mimir_remember/mimir_recall) you give to an agent so it can manage its own long-term memory via tool calls. This is the current-recommended LangChain pattern (the legacyMemory/ConversationBufferMemoryclasses are deprecated).MimirRetriever— aBaseRetrieverreturningDocuments, for drop-in use in RAG chains and anywhere LangChain accepts a retriever (.invoke(query)).MimirClient— the low-level MCP stdio client, if you want direct access.
Prerequisite: the mimir binary
This package talks to a local mimir executable via JSON-RPC over stdio. You
must have it installed:
- Download a release from
https://github.com/Perseus-Computing-LLC/mimir/releases, or build from source
(
cargo build --release), and putmimiron your$PATH. - Or pass an absolute path:
MimirClient(mimir_binary="/path/to/mimir").
On Windows the binary may be named mimir.exe; ensure its directory is on
PATH, or pass the full path.
Install
pip install langchain-mimir
Usage
As agent tools
from langchain_mimir import MimirClient, create_mimir_tools
client = MimirClient(db_path="~/.langchain/mimir.db")
tools = create_mimir_tools(client) # [mimir_remember, mimir_recall]
# Bind to any tool-calling model / agent:
from langchain.chat_models import init_chat_model
llm = init_chat_model("anthropic:claude-sonnet-4-5")
llm_with_memory = llm.bind_tools(tools)
resp = llm_with_memory.invoke("Remember that my favorite language is Rust.")
# ... the model will call mimir_remember; execute the tool call as usual.
As a retriever
from langchain_mimir import MimirClient, MimirRetriever
client = MimirClient(db_path="~/.langchain/mimir.db")
client.remember("The capital of France is Paris.")
retriever = MimirRetriever(client=client, k=5)
docs = retriever.invoke("What is the capital of France?")
print(docs[0].page_content) # -> "The capital of France is Paris."
Direct client
from langchain_mimir import MimirClient
client = MimirClient(db_path="~/.langchain/mimir.db")
client.remember("Project deadline is July 15.", tags=["project", "deadline"])
items = client.recall("when is the deadline")
print(items[0]["text"])
How it works
MimirClient spawns mimir --db <path> as a subprocess and speaks JSON-RPC 2.0
(MCP) over its stdin/stdout. A background reader thread and a lock make calls
thread-safe and timeout-bounded. Memories are stored via mimir_remember and
retrieved via mimir_recall.
License
MIT © 2026 Perseus Computing LLC
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_mimir-0.1.0.tar.gz.
File metadata
- Download URL: langchain_mimir-0.1.0.tar.gz
- Upload date:
- Size: 12.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3fa6de9cced2ccc93fa8a42b20fa4332c831ebccdbd698cab4d2b156f8c1c575
|
|
| MD5 |
983ee01252590d5d5c8bee5ffbc2b368
|
|
| BLAKE2b-256 |
02e63d85f00b8bd8da3b72afc5cb4d2fdc3376bbb49fdbf1fa623ed4ba560049
|
Provenance
The following attestation bundles were made for langchain_mimir-0.1.0.tar.gz:
Publisher:
publish.yml on Perseus-Computing-LLC/langchain-mimir
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langchain_mimir-0.1.0.tar.gz -
Subject digest:
3fa6de9cced2ccc93fa8a42b20fa4332c831ebccdbd698cab4d2b156f8c1c575 - Sigstore transparency entry: 2012406774
- Sigstore integration time:
-
Permalink:
Perseus-Computing-LLC/langchain-mimir@1ad1f2a95cd80218e1ffc008f5e6e90d85fe230b -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Perseus-Computing-LLC
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1ad1f2a95cd80218e1ffc008f5e6e90d85fe230b -
Trigger Event:
push
-
Statement type:
File details
Details for the file langchain_mimir-0.1.0-py3-none-any.whl.
File metadata
- Download URL: langchain_mimir-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c2d92d735a389c202689b65a64d9193cf97bd1d2303a154d4c9c829db9ef4deb
|
|
| MD5 |
c206146b8cfa98ee8212bf312089ed68
|
|
| BLAKE2b-256 |
42aef72896788a888e284cc0ff3c62e4dc990c5af128ec4b6bf4c71ea31fea65
|
Provenance
The following attestation bundles were made for langchain_mimir-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on Perseus-Computing-LLC/langchain-mimir
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langchain_mimir-0.1.0-py3-none-any.whl -
Subject digest:
c2d92d735a389c202689b65a64d9193cf97bd1d2303a154d4c9c829db9ef4deb - Sigstore transparency entry: 2012406930
- Sigstore integration time:
-
Permalink:
Perseus-Computing-LLC/langchain-mimir@1ad1f2a95cd80218e1ffc008f5e6e90d85fe230b -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Perseus-Computing-LLC
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1ad1f2a95cd80218e1ffc008f5e6e90d85fe230b -
Trigger Event:
push
-
Statement type: