First Steps

A hands-on walkthrough of Mnemosyne's core operations.

1. Initialize Memory

from mnemosyne import Mnemosyne

mem = Mnemosyne()
print(f"Initialized: {mem.db_path}")

2. Store Information

# Simple memory
mem.remember("Alice is a backend engineer who prefers Go over Python.")

# Structured memory with metadata
mem.remember(
  content="Project deadline moved to Friday.",
  metadata={"project": "alpha", "type": "deadline"},
  importance=0.8,
  source="slack",
)

3. Recall Information

# Semantic search
results = mem.recall("What programming language does Alice prefer?")

# Filtered search by topic and date
results = mem.recall(
  query="deadline",
  topic="project-alpha",
  from_date="2026-04-01",
)

# Access a specific memory from results
for r in results:
  print(f"{r['score']:.2f}: {r['content']}")

4. Update and Delete

# Update a memory
mem.update("mem_abc123", content="Deadline moved to Monday.")

# Delete a memory
mem.forget("mem_abc123")

# No bulk delete — iterate through results
results = mem.recall("temp notes", top_k=10)
for r in results:
  mem.forget(r["memory_id"])

5. Inspect Memory State

# Statistics
stats = mem.get_stats()
print(f"Total: {stats['total_memories']} memories across {stats['total_sessions']} sessions")
print(f"BEAM working: {stats['beam']['working_memory']}")
print(f"BEAM episodic: {stats['beam']['episodic_memory']}")
print(f"Triples: {stats['beam']['triples']['total']}")
print(f"Database: {stats['database']}")
You're Ready

You've learned the core CRUD operations. Next, explore the BEAM Architecture to understand how Mnemosyne organizes memory.