Every Qor has memory. Not just a rolling context window — a typed, searchable, graph-linked, decay-exempt memory system that survives compaction, integrates with dreaming for consolidation, and scales to millions of facts on one Postgres instance.

The layers, bottom to top

Layer 1: raw message history

The simplest layer — every user + Qor message lives in sessions.messages as JSONB. This is the audit trail, not the thinking fuel. It grows unbounded.

Layer 2: typed memories

When something happens that’s worth remembering, it becomes a memory — a row in memories with:
FieldPurpose
memory_typefact, preference, decision, identity, event, observation, goal, todo
contentThe actual text of what to remember
summaryOne-line version for quick list views
sourceWhere it came from (session id, email, voice transcript)
importance0.0–1.0, drives retrieval ranking
embedding1536-dim pgvector, generated at write time
tagsString array for filtered search
scopeagent, team, task, session, prime
decay_exemptWhether the memory can be pruned
tsvGenerated tsvector for BM25 keyword search
Types matter because different memory types have different retention policies and retrieval triggers:
“Priya’s laptop is a 2024 M3 MacBook Pro.” Retrieved whenever “Priya” or “laptop” is mentioned.
“Priya prefers bullet points over paragraphs.” Injected into system context every time Priya talks.
“Decided on 2026-04-20: ship v0.4 with Telegram only, WhatsApp in v0.5.” Never decays; always retrievable.
“I’m a Researcher Qor specialised in biotech patents.” Seed memory, never decays, included in every system prompt.
“2026-04-21: user opened a PR to the docs.” Decays over time unless the Qor access-counts it back up.
“User seemed stressed in the last message.” Low-importance unless reinforced.
“Launch the marketing site by 2026-05-01.” Retrieved when planning-related messages come in.
“Ping Ramesh about the Q3 numbers.” Lives in todo until marked done.

Layer 3: knowledge graph

Memories can link to each other and to entities (people, projects, companies). Building the graph happens in two ways:
  • Explicit — the Qor calls memory.save with a links array
  • Automatic — the dreamer (layer 5 below) extracts entities from recent memories and creates edges
Graph queries answer questions like “what do we know about Project Apollo?” by walking edges from the Apollo entity out to connected memories.

Layer 4: bulletins & digests

A bulletin is a Qor-generated summary of everything it knows right now. Think of it as a cached “identity doc”:
  • “I’m Prime at Acme. Priya is the CEO. Current priorities: Q3 launch, hiring. Recent decisions: pricing model, channel selection.”
Bulletins are regenerated on a schedule (default: daily, on-demand available). They’re injected into the system prompt so the Qor doesn’t have to search memory on every turn.

Layer 5: working context

What actually goes to the LLM on each turn:
  1. System prompt (identity + instructions + latest bulletin)
  2. Recent raw messages (the rolling window, bounded by model context)
  3. Retrieved memories relevant to the current message (top-K from layer 2)
  4. Tool results from the current turn
When the rolling window fills → compaction. The oldest half of the window gets summarised, saved as a memory, then evicted. Compaction → Every memory gets an embedding at write time using the configured embedding provider (OpenAI text-embedding-3-small by default; local models via Ollama work too). Retrieval is hybrid: pgvector cosine similarity + BM25 full-text search, combined via Reciprocal Rank Fusion (RRF). In practice this beats either alone for most queries.
-- Simplified version of the retrieval query
WITH vector_hits AS (
  SELECT id, 1 - (embedding <=> $query_embedding) AS score
  FROM memories WHERE agent_id = $agent_id
  ORDER BY embedding <=> $query_embedding LIMIT 50
),
bm25_hits AS (
  SELECT id, ts_rank(tsv, plainto_tsquery($query)) AS score
  FROM memories WHERE agent_id = $agent_id AND tsv @@ plainto_tsquery($query)
  LIMIT 50
)
-- RRF merge
SELECT id, SUM(1.0 / (60 + rank)) AS rrf_score FROM (...) GROUP BY id ORDER BY rrf_score DESC;
Memory search from the UI →

Dreaming (layer 5’s maintenance job)

Every N hours (default 6), a background goroutine wakes up per Qor and:
1

Scans recent raw messages

Last 24 hours of session activity.
2

Extracts candidate facts

Uses a cheap LLM call to pull out “things worth remembering” — decisions, preferences, new entities, events.
3

Deduplicates against existing memories

Vector similarity + content hash to avoid storing the same fact twice.
4

Writes new memories + graph edges

New facts become rows in memories; mentioned entities get linked.
5

Decays old low-importance memories

Observations older than 30 days with access_count=0 get their importance halved. Eventually fall below the retrieval threshold.
6

Regenerates the bulletin

Fresh identity summary for the next turn.
Dreaming runs off-peak, is idempotent, and can be triggered manually via qorven memory dream <agent>. Dreaming deep-dive →

Scope — who can see what

Memories have a scope that controls who can retrieve them:
ScopeMeaning
agentPrivate to this Qor (default for most memories)
teamShared across a team’s Qors
taskScoped to a specific task run
sessionScoped to one session (rare)
primeVisible to Prime across all Qors you own
The prime scope is what makes your chief-of-staff Qor aware of what your other Qors are doing — without giving it read access to private notes.

Privacy

Memories can contain personal data. Qorven has three opt-in controls to manage what gets stored:
  • PII redaction — strips emails, phone numbers, credit cards, SSNs before embedding. Settings → Privacy toggles this. PII redaction →
  • Soft-deletememory.delete marks a memory deleted=true but doesn’t purge. Recoverable for 30 days then garbage-collected.
  • Right-to-forgetmemory.purge(user_id) removes every memory where source references that user. Compliance flow for data-subject requests.

Where next

Memory types

The eight memory types, when to use each, examples.

Compaction

How the rolling window stays fresh.

Memory search

The UI, the API, hybrid retrieval details.

Dreaming

Background consolidation in depth.