Compact Qdrant-backed memory for host-owned LLM applications.
Project description
memory-os
Compact Qdrant-backed memory for AI applications.
MemoryOS does not generate final answers. Your application owns the chat flow and the user-facing LLM call. MemoryOS extracts multiple important memory chunks from the user's prompt, stores those chunks separately in Qdrant, applies forgetting-curve style decay to them over time, and also keeps a small rolling prompt/response history per session.
Public API
pip install pymemoryos
from memory_os import MemoryOS
memory = MemoryOS(
qdrant_url="https://your-qdrant-url",
qdrant_api_key="your-qdrant-api-key",
llm=configured_llm, # any object with .invoke()
session_id="user_123",
)
memory.store(prompt: str, response: str) -> None
memory.retrieve(prompt: str) -> dict
That is the entire intended surface.
Usage
context = memory.retrieve(user_prompt)
final_response = host_llm.invoke(
f"Relevant memory:\n{context}\n\nUser:\n{user_prompt}"
)
memory.store(user_prompt, final_response)
Behavior
store(prompt, response)callsllm.invoke(...)once to distill the completed prompt into multiple important memory chunks.store(prompt, response)embeds each extracted memory chunk with an internal SentenceTransformer model, then upserts those chunks separately to Qdrant.store(prompt, response)also stores the raw prompt/response pair in a simple rolling session history capped at 7 pairs.retrieve(prompt)embeds the current prompt with the same internal SentenceTransformer model, then queries Qdrant for relevant memories.retrieve(prompt)reranks Qdrant hits using an Ebbinghaus-style decay score:similarity * decay_score * importance * emotional_weight.retrieve(prompt)also returns the latest 4-5 stored prompt/response pairs for the same session as immediate context.- All Qdrant reads and writes are filtered by
session_id. - When an old pair is evicted from the 7-pair history, the Qdrant memory chunks created from that prompt are also removed.
- Each stored memory chunk keeps decay state in Qdrant payload, including
last_accessed,access_count,stability,importance,emotion,emotional_weight,decay_score,final_score, andlast_similarity.
Retrieve shape
{
"recent_pairs": [
{"prompt": "...", "response": "...", "created_at": 1720000000.0},
],
"memories": [
{
"text": "...",
"score": 0.92,
"created_at": 1720000000.0,
"decay_score": 0.81,
"importance": 0.9,
"emotion": "fear",
},
],
}
Boundaries
- MemoryOS never generates the final answer to a user query.
- MemoryOS uses
llm.invoke()only to break the user's prompt into storable memory chunks. - MemoryOS uses an internal SentenceTransformer embedder for vector storage and retrieval.
- Required init config is exactly
qdrant_url,qdrant_api_key,llm, andsession_id.
Project details
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 pymemoryos-0.1.1.tar.gz.
File metadata
- Download URL: pymemoryos-0.1.1.tar.gz
- Upload date:
- Size: 39.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57119aa2ff6cc30393b6300de1f0324c31c30cfd24869be0036746e867cd8f2c
|
|
| MD5 |
5b82a99fd83167fadf94c90c06ead45f
|
|
| BLAKE2b-256 |
98e6336e05c73a27bad2e45b645a8d77fb695b58e3c0d0d77c87401ee98fa62b
|
Provenance
The following attestation bundles were made for pymemoryos-0.1.1.tar.gz:
Publisher:
publish.yml on karann810/MemoryOS
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pymemoryos-0.1.1.tar.gz -
Subject digest:
57119aa2ff6cc30393b6300de1f0324c31c30cfd24869be0036746e867cd8f2c - Sigstore transparency entry: 2101124586
- Sigstore integration time:
-
Permalink:
karann810/MemoryOS@403b60cef1684b26ae2bc9179fc8b6e7e5a2ea0a -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/karann810
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@403b60cef1684b26ae2bc9179fc8b6e7e5a2ea0a -
Trigger Event:
release
-
Statement type:
File details
Details for the file pymemoryos-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pymemoryos-0.1.1-py3-none-any.whl
- Upload date:
- Size: 39.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 |
5fb036092eae015baf417c7eea1d829456bb688025ad5baa867fbd0cd066f747
|
|
| MD5 |
424a11cb2bd82c458f43a1ea524e9c7a
|
|
| BLAKE2b-256 |
24ef85ef57a9129bcdd5d44fdfbbe8a1ab102a482e1a85b2c105c81d2287ad0d
|
Provenance
The following attestation bundles were made for pymemoryos-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on karann810/MemoryOS
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pymemoryos-0.1.1-py3-none-any.whl -
Subject digest:
5fb036092eae015baf417c7eea1d829456bb688025ad5baa867fbd0cd066f747 - Sigstore transparency entry: 2101124821
- Sigstore integration time:
-
Permalink:
karann810/MemoryOS@403b60cef1684b26ae2bc9179fc8b6e7e5a2ea0a -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/karann810
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@403b60cef1684b26ae2bc9179fc8b6e7e5a2ea0a -
Trigger Event:
release
-
Statement type: