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 insessions.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 inmemories with:
| Field | Purpose |
|---|---|
memory_type | fact, preference, decision, identity, event, observation, goal, todo |
content | The actual text of what to remember |
summary | One-line version for quick list views |
source | Where it came from (session id, email, voice transcript) |
importance | 0.0–1.0, drives retrieval ranking |
embedding | 1536-dim pgvector, generated at write time |
tags | String array for filtered search |
scope | agent, team, task, session, prime |
decay_exempt | Whether the memory can be pruned |
tsv | Generated tsvector for BM25 keyword search |
fact — durable, searchable, never decays
fact — durable, searchable, never decays
“Priya’s laptop is a 2024 M3 MacBook Pro.” Retrieved whenever “Priya” or “laptop” is mentioned.
preference — shapes tone + behaviour
preference — shapes tone + behaviour
“Priya prefers bullet points over paragraphs.” Injected into system context every time Priya talks.
decision — record of what was agreed
decision — record of what was agreed
“Decided on 2026-04-20: ship v0.4 with Telegram only, WhatsApp in v0.5.” Never decays; always retrievable.
identity — who the Qor is
identity — who the Qor is
“I’m a Researcher Qor specialised in biotech patents.” Seed memory, never decays, included in every system prompt.
event — something happened
event — something happened
“2026-04-21: user opened a PR to the docs.” Decays over time unless the Qor access-counts it back up.
observation — weaker than fact, unverified
observation — weaker than fact, unverified
“User seemed stressed in the last message.” Low-importance unless reinforced.
goal — ongoing objective
goal — ongoing objective
“Launch the marketing site by 2026-05-01.” Retrieved when planning-related messages come in.
todo — actionable item
todo — actionable item
“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.savewith alinksarray - Automatic — the dreamer (layer 5 below) extracts entities from recent memories and creates edges
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.”
Layer 5: working context
What actually goes to the LLM on each turn:- System prompt (identity + instructions + latest bulletin)
- Recent raw messages (the rolling window, bounded by model context)
- Retrieved memories relevant to the current message (top-K from layer 2)
- Tool results from the current turn
Embedding + search
Every memory gets an embedding at write time using the configured embedding provider (OpenAItext-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.
Dreaming (layer 5’s maintenance job)
Every N hours (default 6), a background goroutine wakes up per Qor and:Extracts candidate facts
Uses a cheap LLM call to pull out “things worth remembering” — decisions, preferences, new entities, events.
Deduplicates against existing memories
Vector similarity + content hash to avoid storing the same fact twice.
Decays old low-importance memories
Observations older than 30 days with access_count=0 get their importance halved. Eventually fall below the retrieval threshold.
qorven memory dream <agent>. Dreaming deep-dive →
Scope — who can see what
Memories have ascope that controls who can retrieve them:
| Scope | Meaning |
|---|---|
agent | Private to this Qor (default for most memories) |
team | Shared across a team’s Qors |
task | Scoped to a specific task run |
session | Scoped to one session (rare) |
prime | Visible to Prime across all Qors you own |
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
- PII redaction — strips emails, phone numbers, credit cards, SSNs before embedding. Settings → Privacy toggles this. PII redaction →
- Soft-delete —
memory.deletemarks a memorydeleted=truebut doesn’t purge. Recoverable for 30 days then garbage-collected. - Right-to-forget —
memory.purge(user_id)removes every memory wheresourcereferences 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.