MemorySyncMemorySync
How It Works

Intelligence Pipeline

The intelligence pipeline produces aggregate insights — lifetime themes, trends, risks, skepticism points — across all of a user's or tenant's memories. It is separate from the recall engine: recall answers "what's relevant to this query"; intelligence answers "what's true across everything". This page describes how those answers are produced and kept fresh.

Two snapshot scopes

ScopeQuestion it answersRecompute frequency
User snapshotWhat does the system know about this user, lifetime?On-demand and on dirty-flag.
Tenant snapshotWhat is true across all users in this tenant?Daily, plus on-demand.

Why bounded sampling, not full scan

Snapshots cannot scan every memory at every recompute — a heavy user has hundreds of thousands of rows. The pipeline samples instead, using three bounded strategies: top-K by importance, top-3 per topic, and last-N by recency. The union covers the high-signal subset reliably and keeps recompute cost roughly constant as the memory count grows.

The content-type router

Different content types deserve different prompts. A memory drawn from a pitch deck should be analysed with built-in skepticism; a memory drawn from a quarterly report should foreground confidence levels. The router keeps a profile per content type with minimum counts of risks and skepticism points the synthesiser must surface; profiles missing the minimums are flagged as low-confidence.

What the synthesiser combines

InputWhat it contributes
MemoryRecordThe atomic facts — entities, key points, tags.
EventRecordThe lifecycle events — created, updated, deduplicated, deleted.
RecallRecordWhich memories the user actually returned to, and how often.

The synthesiser combines the three streams into a coherent insight — for example, "user has been asking about migration cutover for the last three weeks; the relevant facts say week-of-the-15th; outstanding risk is the integration sync window".

Incremental recompute, not full rebuild

  • Each snapshot stores a watermark — the highest memory.id included in the last computation.
  • On the next recompute, only memories with id > watermark are scanned.
  • If the new rows do not change the answer materially (e.g. a few low-importance writes), the snapshot is left as-is and only the watermark advances. This keeps incremental cost close to O(new rows).

Dirty-flagging and invalidation

Memory mutations fire database hooks that mark the snapshot dirty. The next read after a dirty flag triggers an incremental recompute; reads while clean serve the cached snapshot directly. Importance changes always dirty the snapshot; routine recall does not.

How the API surfaces intelligence to the caller

POST /memory/intelligence returns the snapshot — themes, trends, risks, skepticism points, the underlying memory ids that contributed, and a confidence score. The response is shaped so the caller can render an executive summary directly without a second round-trip. If the snapshot is older than the dirty flag, the call recomputes inline before returning.