Long-term memory library for AI assistants and agents
Project description
MemoryBrain
===========
Long-term memory library for AI assistants, chatbots, and autonomous agents.
Stores memories in a local SQLite database with intelligent ranked retrieval.
Requirements
------------
- Python 3.10 or newer
- No third-party runtime dependencies
Installation
------------
pip install memorybrain
Or install from source:
pip install .
Quick Start
-----------
from memorybrain import MemoryBrain
brain = MemoryBrain()
brain.remember(
"User likes Flutter development",
tags=["flutter", "programming"],
importance=10,
)
results = brain.recall("What framework does the user like?")
for memory in results:
print(memory.text)
matches = brain.search("Flutter")
print(matches)
print(brain.stats())
API Overview
------------
remember(text, tags=None, importance=5)
Store a new memory. Returns a Memory object.
recall(query, limit=10)
Retrieve memories ranked for a natural-language query.
search(query, limit=10)
Search memories by keyword relevance.
forget(memory_id)
Delete a memory by ID. Returns True if deleted.
export("memories.json")
Export all memories to a JSON file.
import_file("memories.json")
Import memories from JSON (upsert by ID).
stats()
Return statistics:
- total_memories
- most_common_tags (list of {tag, count})
- database_size_bytes
Custom Database Path
--------------------
brain = MemoryBrain(db_path="./data/my_memories.db")
Default location: ~/.memorybrain/memories.db
Build and Publish to PyPI
-------------------------
Install build tools:
pip install wheel twine build
Build source distribution and wheel:
python setup.py sdist bdist_wheel
Or using the modern build frontend:
python -m build
Validate packages:
twine check dist/*
Upload to PyPI (requires PyPI account and API token):
twine upload dist/*
Test upload to TestPyPI first:
twine upload --repository testpypi dist/*
License
-------
MIT License — see LICENSE.txt
MIT License
Copyright (c) 2026 MemoryBrain Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
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
memorybrain-1.0.0.tar.gz
(10.9 kB
view details)
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 memorybrain-1.0.0.tar.gz.
File metadata
- Download URL: memorybrain-1.0.0.tar.gz
- Upload date:
- Size: 10.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea827927c1a0328ee0e6ead55bc5407b09698cf6166ce95da7591cfe509edc93
|
|
| MD5 |
3b0aee3509a52043068930a76f2db132
|
|
| BLAKE2b-256 |
dba762fc3154b1fb29466425fa38369a66999dcae8aefdbc5b7a7858bea1c613
|
File details
Details for the file memorybrain-1.0.0-py3-none-any.whl.
File metadata
- Download URL: memorybrain-1.0.0-py3-none-any.whl
- Upload date:
- Size: 10.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9b80687fb02624a363a47d0e1365a5eda7e900af05ffb4c73f80057f40cedab
|
|
| MD5 |
3830605c584e32127b44f784c87ebfa3
|
|
| BLAKE2b-256 |
7b5ee98fe20876a27ccbb6120f0c1ae4ca2de598de3196609fe8af637747264c
|