Skip to content

research(memory): temporal edge validity in graph memory (Graphiti/Zep pattern) #1693

@bug-ops

Description

@bug-ops

Source

Zep: A Temporal Knowledge Graph Architecture for Agent Memory (Jan 2025)
Graphiti: Build Real-Time Knowledge Graphs for AI Agents

Finding

The Zep/Graphiti architecture extends graph memory edges with temporal validity attributes (valid_from, valid_until). When a fact is updated (e.g. "Alice now works at Startup, not Acme"), the old edge is marked as expired rather than deleted — preserving historical context for temporal queries. This achieves 18.5% accuracy improvement on LongMemEval and 90% lower latency vs MemGPT baseline.

Applicability to Zeph

Zeph's graph memory (SQLite schema with entities/edges/communities, completed) already has an eviction policy but no temporal edge validity. The SQLite edges table can be extended with valid_from INTEGER (unix timestamp) and valid_until INTEGER (NULL = currently valid) columns. The graph_recall BFS can filter on valid_until IS NULL OR valid_until > now(), and entity extraction can detect superseding facts and expire old edges.

Implementation Sketch

  1. Schema migration: add valid_from and valid_until columns to edges table
  2. Update GraphStore::upsert_edge to set valid_from = now()
  3. Update extraction: when a new edge contradicts an existing one (same source+target+label), set valid_until = now() on the old edge
  4. Update graph_recall BFS to filter on validity window
  5. Expose temporal queries via /graph slash command (e.g. /graph history Alice)

Priority

Medium — low schema cost, significant accuracy improvement for long-running sessions where facts change over time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestmemoryzeph-memory crate (SQLite)researchResearch-driven improvement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions