MemoriesDB: A Temporal-Semantic-Relational Database for Long-Term Agent Memory / Modeling Experience as a Graph of Temporal-Semantic Surfaces

AuthorsJoel Ward

2025

TL;DR

MemoriesDB fuses temporal ordering, semantic embeddings, and graph relations into a single append-only store to maintain long-term coherence for LLM agents without custom infrastructure.

SharePost on XLinkedIn

Read our summary here, or open the publisher PDF on the next tab.

THE PROBLEM

Context decoherence in long-horizon agents

MemoriesDB targets context decoherence, where long interactions cause facts and intentions to drift out of scope and reasoning fragments into disjoint episodes.

LLM-based agents relying on sliding windows or RAG lose persistent structure, so accumulated knowledge cannot be reasoned about as a coherent whole over hours, days, or weeks.

HOW IT WORKS

MemoriesDB — temporal semantic relational triality

MemoriesDB centers on The Memory Record, Edges and Relations, and the Temporal Semantic Stack to unify time, meaning, and connection in one append-only schema.

You can think of MemoriesDB like a laminated card catalog of experiences, where each card has coordinates in time, a semantic vector, and arrows to related cards.

This geometric triality lets MemoriesDB support time-bounded retrieval, hybrid semantic search, and lightweight structural reasoning that a plain context window or standalone vector database cannot provide.

DIAGRAM

Temporal semantic retrieval pipeline

This diagram shows how MemoriesDB processes a query by combining temporal filters, semantic similarity, and graph expansion into a single retrieval path.

DIAGRAM

MemoriesDB maintenance and coherence loop

This diagram shows how MemoriesDB’s background maintenance preserves coherence through embedding normalization, edge pruning, and coherence sampling.

PROCESS

How MemoriesDB Handles a Long Horizon Agent Session

  1. 01

    The Memory Record

    MemoriesDB first encodes each experience as The Memory Record tuple (ti, κi, Vi, mi), assigning microsecond timestamps and multi view embeddings for later retrieval.

  2. 02

    Edges and Relations

    MemoriesDB then creates Edges and Relations between Memory Records, labeling relations like reply or summary of and storing strengths and confidences as edge weights.

  3. 03

    The Temporal Semantic Stack

    MemoriesDB organizes Memory Records into the Temporal Semantic Stack, treating each timestamp as a local plane and stacking planes to preserve cross temporal coherence.

  4. 04

    Query Semantics

    During Query Semantics, MemoriesDB applies temporal windows, semantic similarity, and relational filters in one pipeline to return coherent context for the agent’s response.

KEY CONTRIBUTIONS

Key Contributions

  • 01

    Unified data model

    MemoriesDB introduces a unified data model where The Memory Record, Edges and Relations, and the Temporal Semantic Stack coexist in a single append only store with pgvector embeddings.

  • 02

    Geometric memory formulation

    MemoriesDB models experience as a time indexed graph of temporal semantic surfaces, using distance and coherence metrics to track semantic drift over long horizons.

  • 03

    Working implementation

    MemoriesDB ships a working PostgreSQL implementation that supports hybrid vector SQL queries, graph traversal, and coherence tracking on commodity hardware without specialized engines.

RESULTS

By the Numbers

Single insert latency

2.5 ms

context: measured at 1 M records on PostgreSQL 16

Batch insert throughput

8000 recs/s

context: batch size 100 at 1 M records

Batch insert peak

10000 recs/s

context: batch size 100 at 100 records

Memory scale

10 M records

context: interactive latency for hybrid queries on medium datasets

The prototype benchmarks on a 32 core workstation with 128 GB RAM illustrate that MemoriesDB can sustain thousands of inserts per second while keeping hybrid temporal semantic graph queries interactive. These observations support the main result that MemoriesDB’s unified architecture is practical on commodity SQL infrastructure.

BENCHMARK

By the Numbers

The prototype benchmarks on a 32 core workstation with 128 GB RAM illustrate that MemoriesDB can sustain thousands of inserts per second while keeping hybrid temporal semantic graph queries interactive. These observations support the main result that MemoriesDB’s unified architecture is practical on commodity SQL infrastructure.

BENCHMARK

Prototype insertion performance table

Insertion latency and throughput for MemoriesDB on PostgreSQL 16 with pgvector.

KEY INSIGHT

The Counterintuitive Finding

MemoriesDB shows that a unified temporal semantic relational memory can run efficiently on plain PostgreSQL 16 with pgvector, without specialized vector or graph databases.

This is surprising because many assume long term coherent memory requires custom engines, but MemoriesDB demonstrates that careful schema design and append only geometry are enough.

WHY IT MATTERS

What this unlocks for the field

MemoriesDB gives builders a concrete way to store, retrieve, and reason over long horizon agent experience as a coherent temporal semantic graph.

With MemoriesDB, developers can turn stateless LLMs into continuous learning agents that maintain identity, track semantic drift, and run auto RAG style retrieval directly on their own memory substrate.

~14 min read← Back to papers

Related papers

BenchmarkAgent Memory

Active Context Compression: Autonomous Memory Management in LLM Agents

Nikhil Verma

· 2026

Focus Agent adds start_focus, complete_focus, a persistent Knowledge block, and an optimized Persistent Bash plus String-Replace Editor scaffold to actively compress context during long software-engineering tasks. On five hard SWE-bench Lite instances against a Baseline ReAct agent, Focus Agent achieves 22.7% token reduction (14.9M → 11.5M) while matching 3/5 = 60% task success.

Questions about this paper?

Paper: MemoriesDB: A Temporal-Semantic-Relational Database for Long-Term Agent Memory / Modeling Experience as a Graph of Temporal-Semantic Surfaces

Answers use this explainer on Memory Papers.

Checking…