Skip to main content

AIMemoryOS

A powerful, modular, multi-store memory layer for conversational agents and LLM applications.

AIMemoryOS combines vector retrieval, graph knowledge bases, and highly-durable structured storage to give your AI agents a robust, scalable long-term memory that you can plug and play directly into your own applications.

Features

  • Multi-Store Architecture: Coordinated state across SQLite (append-only events), DuckDB (canonical relational state), FAISS (vector similarity), and KuzuDB (graph relationships).
  • Advanced Ingestion: End-to-end pipeline with preprocessing, PII stripping, SHA-256 deduplication, and semantic chunking.
  • Rich Retrieval: Context assembly from multiple sources, reranking, and trace scoring.
  • Coordinated Pruning: Safely forget() memories with guaranteed cleanup across all storage backends without violating relational integrity.
  • Snapshotting: Take portable, verified SQLite backups of your system's event history instantly.
  • Hallucination Firewall: Isolate "hypothesized" or "imagined" memories to separate tables so they don't pollute your agent's ground-truth recall.

Installation

AIMemoryOS relies on powerful machine learning models under the hood. Make sure you have at least 2GB of free disk space before installing, as it will download heavy dependencies like PyTorch, FAISS, and HuggingFace Transformers.

Step-by-step Installation

Step 1: Create a safe virtual environment
We highly recommend using a virtual environment strictly locked to a stable Python version. We suggest using uv for incredibly fast and foolproof environment isolation:

# Create a Python 3.12 virtual environment
uv venv --python 3.12

Step 2: Activate the environment

  • Windows (PowerShell): .\.venv\Scripts\activate
  • Mac/Linux: source .venv/bin/activate

Step 3: Install AIMemoryOS
Install the SDK directly from PyPI into your isolated environment:

uv pip install aimemoryos

(If you are using standard pip, simply run python -m pip install aimemoryos instead).

Step 4: Download the SpaCy language model weights
The aimemoryos package will automatically install the spacy library for you. However, you must explicitly download the actual English NLP model weights (which pip cannot bundle) used for entity extraction:

# If using uv:
uv run python -m spacy download en_core_web_sm

# If using standard python:
python -m spacy download en_core_web_sm

Quickstart (Plug & Play)

The easiest way to integrate AIMemoryOS into your codebase is by using the Memory facade. Simply import it into your application and start saving/retrieving knowledge.

import asyncio
from pathlib import Path
from aimemoryos import Memory

async def run():
    # Initialize the high-level memory facade
    memory = Memory()

    # 1. Ingest information into the memory pipeline
    print("Ingesting memory...")
    await memory.save(
        document_id="doc_001",
        content="My favorite programming language is Python and I love pizza."
    )

    # 2. Retrieve relevant context based on semantic similarity
    print("Retrieving context...")
    results = await memory.retrieve(
        query="What foods do I like?",
        top_k=5,
        score_threshold=0.2
    )
    
    # Results include the content, metadata, and relevance score
    for r in results:
        print(f"[{r['score']:.2f}] {r['metadata']['content']}")

    # 3. Forget a memory across all stores (DuckDB, FAISS, Graph, SQLite)
    if results:
        memory_id = results[0]["metadata"]["memory_id"]
        await memory.forget(memory_id=memory_id)
    
    # 4. Take a verifiable snapshot of the entire event history
    await memory.snapshot(output_path=Path("backups/memory_snapshot.sqlite"))

if __name__ == "__main__":
    asyncio.run(run())

Configuration

By default, runtime databases and indexes are stored in the .aimemoryos/ folder at the root of the installed package. You can easily override this globally if you want your data saved elsewhere:

export AIMEMORYOS_DATA_DIR="/path/to/custom/data"

Architecture / Project Layout

For those interested in extending the SDK or contributing, the folder architecture is maintained as follows:

  • agents/: SDK-facing components. Contains MemoryClient, which is the primary unified interface to the ecosystem.
  • main.py: A lightweight, backwards-compatible wrapper around MemoryClient for immediate plug-and-play.
  • core/runtime.py: The composition root. Handles dependency injection, configuration, and instantiating storage/retrieval services.
  • ingestion/: Text preprocessing, SHA deduplication, routing, and chunking boundaries.
  • retrieval/: Similarity search, vector reranking, and ContextBuilder logic.
  • storage/: Highly durable persistence backends (duckdb_store.py, faiss_store.py, sqlite_log.py) and the orchestrator.py.
  • vector/: Embedding generation (sentence-transformers) and model management.
  • graph/: KuzuDB ontology and schema definitions.

Contributing

We welcome contributions! To set up for local development:

git clone https://github.com/your-org/aimemoryos.git
cd aimemoryos
pip install -e .
pytest -q

Metadata

Release files for aimemoryos 0.1.2

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

Source distribution (sdist)

Source distribution for aimemoryos 0.1.2
File Size Uploaded Provenance
aimemoryos-0.1.2.tar.gz 76.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for aimemoryos 0.1.2
File Interpreter ABI Platform
aimemoryos-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 168.7 kB

Release files / aimemoryos-0.1.2.tar.gz

Download URL aimemoryos-0.1.2.tar.gz
Size 76.3 kB
Tags Source
SHA-256 checksum
How to use checksums
82f6e42788dc44f69c2aa7f3763a137296a87498f86d14685fc0f3b842e30875
BLAKE2b-256 checksum
How to use checksums
92a28fbc4239cb2e810ef22328e0e1b7752cdc3d60f2e7823cdbdf20ae535eb4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / aimemoryos-0.1.2-py3-none-any.whl

Download URL aimemoryos-0.1.2-py3-none-any.whl
Size 92.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a812538ec16daa64de688e04f639925f032fcd248fd238a32a8ce9c1957a6a8a
BLAKE2b-256 checksum
How to use checksums
f1cf331b9add1f1fc0ee79652845f9d76f74d76bf2c9366412cf83f7ad49d121
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Security for aimemoryos 0.1.2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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