Knowledge Graph
Memories aren't isolated - they're connected. The Knowledge Graph reveals relationships between memories, enabling your AI to make connections and discover insights.
Watch Knowledge Graph Form in Real-Time
See how each conversation builds your knowledge network progressively
Connections are automatically discovered as memories are created
What is a Knowledge Graph?
A knowledge graph is a network of connected memories. Instead of storing memories in isolation, Memory OS automatically discovers and maintains relationships between them - just like how your brain connects related concepts.
This enables powerful features like discovering related information, finding patterns, and understanding context.
Isolated Memories
No connections - each memory stands alone.
Connected Knowledge Graph
Connected - the AI understands relationships and context.
Types of Relationships
Memory OS automatically detects and maintains different types of relationships between memories:
Semantic Similarity
Memories about similar topics are automatically connected based on meaning.
Temporal Connections
Memories created around the same time or in sequence are linked.
Causal Relationships
Cause-and-effect connections between memories and events.
Entity Relationships
Connections through shared entities (people, places, projects).
Using the Knowledge Graph
Exploring Connections
from memory_os import MemoryOSClient
memory = MemoryOSClient(
api_key="your_api_key",
user_id="user_123"
)
# Get a memory and its connections
mem = memory.get_memory(memory_id="mem_123")
# Explore related memories
related = memory.get_related_memories(
memory_id="mem_123",
relationship_types=["similar", "temporal"],
limit=10
)
# Process connections
for rel in related['relationships']:
print(f"Relationship: {rel['type']}")
print(f"Connected to: {rel['target_memory']['content']}")
print(f"Strength: {rel['strength']}")
print("---")Graph Traversal
# Find path between two memories
path = memory.find_path(
from_memory="mem_123",
to_memory="mem_456",
max_depth=3
)
# Discover clusters of related memories
clusters = memory.find_clusters(
min_cluster_size=5,
similarity_threshold=0.7
)
# Get memory neighborhood
neighborhood = memory.get_neighborhood(
memory_id="mem_123",
depth=2 # 2 hops away
)
# Visualize the graph
graph_data = memory.export_graph(
memory_ids=["mem_123", "mem_456", "mem_789"],
include_connections=True
)Pattern Discovery
# Find patterns in the graph
patterns = memory.discover_patterns(
pattern_type="frequent_connections",
min_support=3
)
# Identify central/important memories
central_memories = memory.get_central_memories(
metric="betweenness", # or "degree", "pagerank"
limit=10
)
# Find emerging topics
topics = memory.detect_topics(
time_window_days=30,
min_memories=5
)
for topic in topics:
print(f"Topic: {topic['name']}")
print(f"Memories: {topic['memory_count']}")
print(f"Keywords: {', '.join(topic['keywords'])}")Powerful Use Cases
🔍Discovery & Recommendations
"You asked about Python APIs. Based on your previous work with FastAPI and interest in authentication, you might want to explore OAuth2 implementation."
🧩Context Building
When answering a question, the AI can pull in connected memories to provide richer, more contextual responses.
📊Pattern Recognition
Identify recurring themes, common issues, or emerging trends across your memories.
🎯Smart Navigation
Navigate through your knowledge by following connections, discovering related information naturally.
Visualizing Your Knowledge
Memory OS provides interactive graph visualizations in your dashboard. See your knowledge network, explore connections, and discover insights visually.
Graph Features
Best Practices
✅ Do
- • Let the system auto-discover connections
- • Use rich, descriptive memory content
- • Explore related memories when searching
- • Leverage graph insights for recommendations
- • Visualize your knowledge periodically
❌ Don't
- • Manually create all connections
- • Ignore relationship suggestions
- • Store isolated, context-free memories
- • Overlook graph-based insights
- • Forget to explore memory neighborhoods
