Loading...
Loading...
Use when implementing agent memory, persisting state across sessions, building knowledge graphs, tracking entities, or asking about "agent memory", "knowledge graph", "entity memory", "vector stores", "temporal knowledge", "cross-session persistence"
npx skill4agent add eyadsibai/ltk memory-systems| Layer | Latency | Persistence | Use Case |
|---|---|---|---|
| Working Memory | Zero | Volatile | Context window |
| Short-Term | Low | Session | Session state |
| Long-Term | Medium | Persistent | Cross-session knowledge |
| Entity Memory | Medium | Persistent | Entity tracking |
| Temporal KG | Medium | Persistent | Time-aware queries |
| System | DMR Accuracy | Retrieval Latency |
|---|---|---|
| Zep (Temporal KG) | 94.8% | 2.58s |
| MemGPT | 93.4% | Variable |
| GraphRAG | 75-85% | Variable |
| Vector RAG | 60-70% | Fast |
| Recursive Summary | 35.3% | Low |
# Simple, no infrastructure needed
def store_fact(entity_id, fact):
path = f"memory/{entity_id}.json"
facts = load_json(path, default=[])
facts.append({"fact": fact, "timestamp": now()})
save_json(path, facts)# Embed facts with rich metadata
vector_store.add(
embedding=embed(fact),
metadata={
"entity_id": entity_id,
"valid_from": now(),
"source": "conversation",
"confidence": 0.95
}
)# Preserve relationships
graph.create_relationship(
from_entity="Customer_123",
relationship="PURCHASED",
to_entity="Product_456",
properties={"date": "2024-01-15", "quantity": 2}
)# Time-travel queries
def query_address_at_time(user_id, query_time):
return graph.query("""
MATCH (user)-[r:LIVES_AT]->(address)
WHERE user.id = $user_id
AND r.valid_from <= $query_time
AND (r.valid_until IS NULL OR r.valid_until > $query_time)
RETURN address
""", {"user_id": user_id, "query_time": query_time})def remember_entity(entity_id, properties):
memory.store({
"type": "entity",
"id": entity_id,
"properties": properties,
"last_updated": now()
})| Requirement | Architecture |
|---|---|
| Simple persistence | File-system memory |
| Semantic search | Vector RAG with metadata |
| Relationship reasoning | Knowledge graph |
| Temporal validity | Temporal knowledge graph |