# Memori: SQL Native Memory Layer for LLMs and AI Agents

This repository profile is provided by osrepos.com, an open source repository discovery platform.

Source: osrepos.com
Repository profile: https://osrepos.com/repo/gibsonai-memori
Generated for open source discovery and AI-assisted research.

Memori is an SQL Native Memory Layer designed for LLMs, AI Agents, and Multi-Agent Systems. It provides a robust and flexible solution for managing long-short term memory, integrating seamlessly with existing software and infrastructure. This project aims to enhance AI systems with persistent, structured memory capabilities, making them more intelligent and context-aware.

GitHub: https://github.com/GibsonAI/memori
OSRepos URL: https://osrepos.com/repo/gibsonai-memori

## Summary

Memori is an SQL Native Memory Layer designed for LLMs, AI Agents, and Multi-Agent Systems. It provides a robust and flexible solution for managing long-short term memory, integrating seamlessly with existing software and infrastructure. This project aims to enhance AI systems with persistent, structured memory capabilities, making them more intelligent and context-aware.

## Topics

- AI
- LLM
- AI Agents
- Memory Management
- Python
- RAG
- Database
- State Management

## Repository Information

Last analyzed by OSRepos: Sun Dec 28 2025 00:01:00 GMT+0000 (Western European Standard Time)
Detail views: 5
GitHub clicks: 3

## Safety Notice

OSRepos shares public repositories for knowledge and discovery only. Review source code, dependencies, licenses, and security implications before running or installing anything.

## Content

## Introduction

Memori, developed by MemoriLabs, is an SQL Native Memory Layer for LLMs, AI Agents, and Multi-Agent Systems. It serves as the memory fabric for enterprise AI, designed to plug into the software and infrastructure you already use. Memori is LLM, datastore, and framework agnostic, ensuring seamless integration into your existing architecture. It enhances AI interactions by providing structured, persistent memory, including vectorized memories, in-memory semantic search, and a third normal form schema for a knowledge graph.

## Installation

Getting started with Memori is straightforward. You can install it using pip:

bash
pip install memori


For an optimized environment, it's suggested to run the setup command once:

bash
python -m memori setup


This prepares your environment for faster execution, though Memori will perform this step automatically on its first run if not done manually.

## Examples

Here's a quickstart example demonstrating how to use Memori with OpenAI to manage conversational memory:

python
import os
import sqlite3

from memori import Memori
from openai import OpenAI


def get_sqlite_connection():
    return sqlite3.connect("memori.db")


client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))

memori = Memori(conn=get_sqlite_connection).llm.register(client)
memori.attribution(entity_id="123456", process_id="test-ai-agent")
memori.config.storage.build()

response = client.chat.completions.create(
    model="gpt-4.1-mini",
    messages=[
        {"role": "user", "content": "My favorite color is blue."}
    ]
)
print(response.choices[0].message.content + "\n")

# Advanced Augmentation runs asynchronously to efficiently
# create memories. For this example, a short lived command
# line program, we need to wait for it to finish.

memori.augmentation.wait()

# Memori stored that your favorite color is blue in SQLite.
# Now reset everything so there's no prior context.

client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))

memori = Memori(conn=get_sqlite_connection).llm.register(client)
memori.attribution(entity_id="123456", process_id="test-ai-agent")

response = client.chat.completions.create(
    model="gpt-4.1-mini",
    messages=[
        {"role": "user", "content": "What's my favorite color?"}
    ]
)
print(response.choices[0].message.content + "\n")


You can also explore the stored memories directly using SQLite:

bash
/bin/echo "select * from memori_conversation_message" | /usr/bin/sqlite3 memori.db
/bin/echo "select * from memori_entity_fact" | /usr/bin/sqlite3 memori.db
/bin/echo "select * from memori_process_attribute" | /usr/bin/sqlite3 memori.db
/bin/echo "select * from memori_knowledge_graph" | /usr/bin/sqlite3 memori.db


## Why Use Memori?

Memori offers a powerful and flexible solution for integrating memory into your AI applications. Key advantages include:

*   **LLM and Datastore Agnostic**: Supports all major foundational models (Anthropic, Bedrock, Gemini, Grok, OpenAI) and a wide range of databases (DB API 2.0, Django, SQLAlchemy, CockroachDB, MariaDB, MongoDB, MySQL, Neon, Oracle, PostgreSQL, SQLite, Supabase).
*   **Advanced Augmentation**: Significant performance improvements with threaded, zero-latency memory extraction and enhancement, enriching memories with attributes, events, facts, people, preferences, relationships, rules, and skills.
*   **Structured Memory**: Utilizes vectorized memories and in-memory semantic search for more accurate context, alongside a third normal form schema for a robust knowledge graph.
*   **Reduced Development Overhead**: Simplifies integration with a single line of code for core memory functionalities.
*   **Attribution and Session Management**: Provides mechanisms to attribute LLM interactions to specific entities and processes, and manage sessions for coherent conversational flows.
*   **Developer-Friendly**: Advanced Augmentation is always free for developers, with a CLI for easy management and quota checking.

## Links

*   **GitHub Repository**: <a href="https://github.com/MemoriLabs/Memori" target="_blank">https://github.com/MemoriLabs/Memori</a>
*   **Documentation**: <a href="https://memorilabs.ai/docs" target="_blank">https://memorilabs.ai/docs</a>
*   **Discord**: <a href="https://discord.gg/abD4eGym6v" target="_blank">https://discord.gg/abD4eGym6v</a>
*   **Memori Cookbook**: <a href="https://github.com/MemoriLabs/memori-cookbook" target="_blank">https://github.com/MemoriLabs/memori-cookbook</a>
*   **Contributing Guidelines**: <a href="https://github.com/MemoriLabs/Memori/blob/main/CONTRIBUTING.md" target="_blank">https://github.com/MemoriLabs/Memori/blob/main/CONTRIBUTING.md</a>