Skip to content

carbongotfound/remember

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Remember 🧠

"AI agents shouldn't have goldfish memory."

Production-ready local-first memory layer for AI agents.

Remember gives your agent persistent memory that survives across sessions. Hybrid search (BM25 + vector), temporal validity windows, entity graphs, and memory decay — all in a single SQLite file. No cloud. No API keys. No telemetry.

Features

  • Hybrid Search — 70% vector similarity + 30% BM25 keyword matching
  • Temporal Validity — Facts have valid_from/valid_to windows
  • Memory Decay — Exponential decay with access-boost recovery
  • Entity Graph — Track relationships between people, projects, concepts
  • GDPR Compliant — Soft delete + user purge
  • Multi-Tenant — User-scoped memories
  • Zero Dependencies — Just Python + SQLite (embeddings optional)

Quick Start

# Install
pip install -e .

# Store a memory
remember remember "I prefer dark mode and concise responses" --user carbon

# Search
remember recall "dark mode" --user carbon

# Get context for LLM prompts
remember context --query "user preferences" --user carbon

# Statistics
remember stats --user carbon

Python API

from remember import MemoryEngine

# Initialize
engine = MemoryEngine()

# Store with auto-extraction
result = engine.remember(
    "Working on Remember project with Python and SQLite",
    user_id="carbon",
    category="project",
    extract_entities=True,
    extract_facts=True,
)
# result: {"id": 1, "facts": [...], "entities": [...]}

# Hybrid search
results = engine.recall("Python project", user_id="carbon")
# {"memories": [...], "entities": [...], "total": 3}

# Get formatted context for LLM prompts
context = engine.get_context(
    query="what is the user working on",
    user_id="carbon",
    max_tokens=2000,
)

# Entity graph
engine.get_entity_context("Remember")  # All memories about Remember
engine.graph.get_related_entities("Python")  # What co-occurs with Python

# GDPR
engine.purge_user("carbon")  # Delete ALL memories for user

# Decay
engine.apply_decay(half_life_days=30)  # Apply exponential decay

Architecture

┌─────────────────────────────────────────────────────────────┐
│                      MemoryEngine                          │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────┐        │
│  │    Store    │  │   Search    │  │    Graph    │        │
│  │  (SQLite)   │  │  (Hybrid)   │  │  (Entities) │        │
│  └──────┬──────┘  └──────┬──────┘  └──────┬──────┘        │
│         │                │                │                 │
│         └────────────────┼────────────────┘                 │
│                          │                                  │
│                   ┌──────┴──────┐                           │
│                   │  Extractor  │                           │
│                   │ (Regex+LLM) │                           │
│                   └─────────────┘                           │
└─────────────────────────────────────────────────────────────┘
Component Purpose
Store SQLite with WAL mode, FTS5, temporal validity, decay scoring
Search BM25 (30%) + Vector (70%) weighted fusion with graceful fallback
Graph Entity extraction, linking, co-occurrence tracking
Extractor Regex patterns + optional LLM extraction

Integrations

Hermes Agent

Install as a Hermes plugin:

Install the remember plugin from GitHub repo carbongotfound/remember.
Run: hermes plugins install carbongotfound/remember
Then: hermes plugins enable remember
Then restart the gateway or start a new session.

Tools provided:

  • remember_add — Store a memory
  • remember_search — Search memories
  • remember_entity — Get entity context

LangChain

from remember.integrations.langchain import RememberMemory

memory = RememberMemory(user_id="my_user")

# Use with any LangChain chain
chain = SomeChain(memory=memory)

# Or use directly
memory.remember("User prefers dark mode")
context = memory.load_memory_variables({"input": "what do I like?"})

OpenClaw

Install the skill:

git clone https://github.com/carbongotfound/remember ~/.openclaw/skills/remember/

Then tell your agent:

Clone the repo carbongotfound/remember to ~/.openclaw/skills/remember/

The skill provides CLI commands your agent can use:

remember remember "User prefers dark mode" --user my_user
remember recall "dark mode" --user my_user
remember context --query "user preferences" --user my_user

CLI Commands

remember remember <content>     # Store a memory
remember recall <query>         # Search memories
remember context --query <q>    # Get context for LLM
remember list                   # List all memories
remember delete <id>            # Soft delete
remember purge <user_id>        # GDPR: delete all for user
remember entity <name>          # Get entity context
remember stats                  # Statistics
remember decay                  # Apply decay
remember init                   # Initialize database

How It Compares

Feature Remember Mem0 Zep Letta
Local-first ✅ SQLite ❌ Qdrant/Cloud ❌ Neo4j/Cloud ❌ REST API
Zero dependencies ✅ stdlib only ❌ Heavy ❌ Heavy ❌ Heavy
Temporal validity
Memory decay
Entity graph
Hybrid search ✅ 70/30
GDPR ✅ purge
Single file DB
Agent integrations ✅ Hermes/LC/OC

Configuration

Embeddings (Optional)

By default, Remember uses keyword-only search. For semantic search, install sentence-transformers:

pip install sentence-transformers

Or provide a custom embedder:

from remember import MemoryEngine

def my_embedder(text: str) -> list[float]:
    # Your embedding logic here
    return [0.1, 0.2, ...]

engine = MemoryEngine(embedder=my_embedder)

LLM Extraction (Optional)

For enhanced fact extraction, provide an LLM function:

from openai import OpenAI

client = OpenAI()

def llm_extract(text: str) -> list[dict]:
    response = client.chat.completions.create(
        model="gpt-4o-mini",
        messages=[{
            "role": "system",
            "content": "Extract facts as JSON array with 'content', 'category', 'confidence'"
        }, {
            "role": "user",
            "content": text
        }],
        response_format={"type": "json_object"},
    )
    return json.loads(response.choices[0].message.content)

engine = MemoryEngine(llm_fn=llm_extract)

Database Location

Default: ~/.remember/remember.db

Override with:

engine = MemoryEngine(db_path="/custom/path/remember.db")

Contributing

Found a bug? Have an idea? Open an issue or PR.

If Remember saved your project from the dreaded "wait, what was I working on?" — consider starring the repo. It helps others find it, and honestly it makes me feel good about the minutes I spent debugging FTS5 tokenizers.

License

MIT

About

Remembers facts, preferences, and context across sessions. Searches by meaning, not just keywords. Extracts knowledge automatically from conversations.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages