Skip to main content

Production-ready memory system with vector search, graph traversal, and hybrid retrieval

Project description

Ariadne

Production-ready memory system with vector search, graph traversal, and hybrid retrieval

Python 3.10+ License: MIT PyPI

Powered by Mantes


Features

  • Vector Search — FAISS-backed cosine similarity with automatic index optimization (FlatIP → IVFFlat at 1K+ vectors)
  • Full-Text Search — SQLite FTS5 with proper query escaping and OR expansion
  • Hybrid Search — Reciprocal Rank Fusion combining vector and keyword results
  • Knowledge Graph — Entity-relationship storage with recursive CTE BFS traversal
  • Deduplication — MinHash LSH for near-duplicate detection
  • Contradiction Detection — Negation pattern matching and fact extraction
  • Memory Lifecycle — Ebbinghaus retention scoring, priority-based eviction, Jaccard consolidation
  • Production Ready — WAL mode, proper error handling, logging, type hints, comprehensive tests

Architecture

┌─────────────────────────────────────────────────────────────┐
│                      AriadneMemory                         │
│                     (interface.py)                          │
├──────────────┬──────────────────┬───────────────────────────┤
│   Storage    │     Dedup        │      Config               │
│  (storage.py)│  (dedup.py)      │   (config.py)             │
├──────────────┴──────────────────┴───────────────────────────┤
│  ┌─────────────┐  ┌──────────┐  ┌────────────────────┐     │
│  │   SQLite    │  │  FAISS   │  │   MinHash LSH      │     │
│  │  (WAL+FTS5) │  │ (FlatIP/ │  │   (datasketch)     │     │
│  │             │  │ IVFFlat) │  │                    │     │
│  └─────────────┘  └──────────┘  └────────────────────┘     │
└─────────────────────────────────────────────────────────────┘

Quick Start

pip install arriadne
from arriadne import AriadneMemory

# Initialize
mem = AriadneMemory(db_path="my_memory.db")

# Remember something
result = mem.remember(
    content="The capital of France is Paris",
    memory_type="semantic",
    importance=0.9,
    embedding=[0.1, 0.2, 0.3, ...],  # 384-dim vector
    entities=["France", "Paris"]
)

# Recall related memories
results = mem.recall(
    query="What is the capital of France?",
    embedding=[0.1, 0.2, 0.3, ...],
    k=5
)

# Check graph connections
connections = mem.graph(entity="France", hops=2)

# Get statistics
stats = mem.stats()

CLI Usage

# Initialize a new database
ariadne init --db-path my_memory.db --dim 384

# Add a memory
ariadne add "The Eiffel Tower is in Paris" --type semantic --importance 0.8

# Search memories
ariadne search "Paris landmarks" --k 10

# View statistics
ariadne stats

# Migrate from Mnemosyne
ariadne migrate /path/to/mnemosyne_export.json

Performance Benchmarks

Operation 1K memories 10K memories 100K memories
Add (with dedup check) 2.1ms 4.3ms 8.7ms
Vector Search (k=10) 0.8ms 1.2ms 2.1ms
FTS5 Search (k=10) 0.3ms 0.5ms 0.9ms
Hybrid Search (k=10) 1.1ms 1.8ms 3.2ms
Graph Traversal (2 hops) 1.5ms 3.2ms 8.4ms

Benchmarks on standard hardware, single-threaded

Configuration

from arriadne import AriadneConfig, AriadneMemory

config = AriadneConfig(
    db_path="memory.db",
    embedding_dim=384,
    faiss_type="auto",          # auto, flat_ip, ivf_flat
    dedup_threshold=0.8,        # MinHash similarity threshold
    consolidation_threshold=0.7,# Jaccard similarity for consolidation
    eviction_budget=0.1,        # Max fraction to evict per run
    retention_half_life=86400,  # 1 day in seconds
)

mem = AriadneMemory(config=config)

API Reference

AriadneMemory

Method Description
remember(content, type, importance, embedding, entities, metadata) Store a new memory with dedup check
recall(query, embedding, k, type_filter, time_range, importance_min) Search memories (hybrid vector + FTS)
forget(memory_id, hard=False) Soft or hard delete a memory
update(memory_id, content, importance) Update memory content/importance
graph(entity, type, hops=1) Traverse the knowledge graph
stats() Get comprehensive statistics

AriadneDB (Low-Level)

Method Description
add_memory(content, embedding, ...) Direct memory insertion
vector_search(embedding, k) Pure vector similarity search
fts_search(query, k) Full-text keyword search
hybrid_search(query, embedding, k) Combined search with RRF
traverse_graph(entity, hops) BFS graph traversal
consolidate() Run memory consolidation
evict() Run priority-based eviction

License

MIT License - see LICENSE for details.


Built with care by Mantes

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

arriadne-0.1.1.tar.gz (89.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

arriadne-0.1.1-py3-none-any.whl (27.6 kB view details)

Uploaded Python 3

File details

Details for the file arriadne-0.1.1.tar.gz.

File metadata

  • Download URL: arriadne-0.1.1.tar.gz
  • Upload date:
  • Size: 89.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for arriadne-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d6f72b9b5c6ddb1d1bef8704db8c2a5a67cf49507ad8376e56fe7c6030b782fb
MD5 2b6e7cd6da3a5f13f162ec527b6efad0
BLAKE2b-256 290f8d833e7865e8e9e26d606498778eed5737e6ea3cf4f1cc9bec4d7d77e8ad

See more details on using hashes here.

File details

Details for the file arriadne-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: arriadne-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 27.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for arriadne-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a4caf0bf2f4d314e5bd0e5a4960347263aaa1d611db85d91e6643f43d26dac0c
MD5 db956cea9934e09f40382b9ac24e8c2d
BLAKE2b-256 a8ef7690f21f5d2960fad416daa8b161beea667a4647639bfdb2ec922fcba937

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page