Graph Memory

What turns LongMem from a vector store into a memory system: facts that evolve — updated, extended, expired — instead of piling up as contradictions.

The problem#

A plain vector store treats every sentence as independent. Tell it "Alex works at Google" today and "Alex moved to Stripe" next month, and a search for "where does Alex work?" returns both. Graph memory knows the new fact supersedes the old.

The pipeline (remember)#

1. Extraction#

An LLM turns messy input into atomic, typed facts:

POST /v1/memory/collections/people/remember
{"content": "Had a call with Alex, now a PM at Stripe; he likes mornings."}

→ "Alex works at Stripe as a PM"      (type: fact)
→ "Alex prefers morning meetings"     (type: preference)

Three types: fact (stable), preference (likes/habits), episode (one-off events). Time-bound facts get an expires_at ("meeting at 3pm today" expires tomorrow).

2. Relating#

Each new fact is compared to the most similar existing memory (cosine > 0.55) and classified:

RelationEffect
updatesnew fact contradicts/replaces the old → old is marked not-latest and drops out of search; an edge records why
extendsnew fact adds detail → both stay current, linked
noneunrelated → stored independently

Every search filters to is_latest and non-expired memories, so you get what's true now. Superseded facts aren't deleted — the edges preserve history.

Forgetting#

Profiles#

GET /v1/memory/collections/{c}/profile summarizes the collection's current facts + preferences into a short third-person profile — ready to paste into a system prompt. See User Profiles.

Async by default#

remember enqueues and returns 202 {"job_id": …} instantly; the worker extracts in the background (poll GET /v1/memory/extract/job/{id}). Pass ?sync=true to extract inline and get the facts back in the response.

When to use what#

remember costs LLM calls (one extraction + one relation check per fact — fractions of a cent on the default model). add and file drops never call an LLM: they embed and store. Use remember for evolving knowledge about users and projects; use add/drop for documents you just want searchable.