# Persistent AI Memory Across Sessions | DialogueDB

> Give your AI memory that persists between conversations. DialogueDB stores, isolates, and retrieves user context in the same system as your dialogues.

Canonical: https://dialoguedb.com/architecture/conversation-memory
Updated: 2026-06-24

Conversation Memory

# Give your AI memory that carries across every conversation

DialogueDB stores what your AI needs to remember, scopes it to the right user, and makes it searchable by meaning. It lives in the same system as your conversations.

[Try the Free Tier](https://app.dialoguedb.com/signup) [Read the Docs](https://docs.dialoguedb.com)

Session 1

Monday

User: I prefer dark mode and concise responses.

AI: Got it, I'll keep responses brief.

Memory stored

`"Prefers dark mode, concise"`

Session 2

Three days later

User: Help me set up my dashboard.

AI: Here's a quick setup, dark theme applied.

One system

## Memory and conversations in one database

When memory and conversations live in separate systems, they drift out of sync and your AI ends up with stale or incomplete context. DialogueDB stores both in the same database, so the context is always current.

### Separate memory service

Two APIs to integrate

Two authentication surfaces

Context split across two places

Sync logic between stores

### DialogueDB

One API for conversations and memory

One authentication surface

Context in one place

No sync step, same store

What's different

## Three differences from most memory tools

Three architectural choices that change what your memory contains and how your AI retrieves it.

### You decide what matters, not the tool

Most memory tools decide what's worth remembering by extracting facts from conversations automatically, using their own model of importance. DialogueDB stores memory directly, so the contents reflect what you intended, not what an extraction pipeline guessed.

### Search by meaning, not by key

Every memory is auto-vectorized at write time, so retrieval works by meaning instead of exact match. Your AI finds the right context for the current conversation without you tracking keys, so users don't repeat themselves and your retrieval logic stays simple as your data grows.

### Per-user isolation built into the API

A namespace parameter scopes memory to individual users at the database level, not through application-layer filters. Multi-tenant apps stay safe by default, and cross-user leaks aren't a regression you can introduce by accident.

Built-in record fields

## Tag, label, and annotate without designing a schema

Memory records include built-in fields for tags, human-readable labels, and immutable metadata. Filter by category, attach audit context, and trace a memory back to its source without adding a sidecar database or modeling a new table.

Tags are mutable for re-categorization. Metadata is immutable so it can stand in for an audit trail. Labels keep memory readable in dashboards and logs.

### A memory record

Value

"User is allergic to peanuts"

Label

"Dietary restriction"

Namespace

"user\_456"

Tags

health dietary

Metadata

`{ "source": "onboarding" }`

Auto-vectorized

Searchable by meaning at write time, no extra step

Store and retrieve

## Store in one session, retrieve in the next

The first call stores a piece of context after a conversation ends. The second call retrieves it from a different session by meaning. No indexing step in between, no key to track, no schema to set up first.

memory.ts

TypeScript cURL

```
import { DialogueDB } from "dialogue-db"

const db = new DialogueDB({
  apiKey: process.env.DIALOGUE_DB_API_KEY
})

// Session 1: store context from the conversation
await db.createMemory({
  value: "User is allergic to peanuts",
  label: "Dietary restriction",
  namespace: "user_456",
  tags: ["health", "dietary"]
})

// Session 2: retrieve by meaning
const { results } = await db.searchMemories(
  "any dietary restrictions or allergies",
  { namespace: "user_456", limit: 5 }
)
```

```
# Session 1: store context from the conversation
curl -X POST https://api.dialoguedb.com/api/v1/memory \
  -H "Authorization: Bearer $DIALOGUE_DB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "value": "User is allergic to peanuts",
    "label": "Dietary restriction",
    "namespace": "user_456",
    "tags": ["health", "dietary"]
  }'

# Session 2: retrieve by meaning
curl -X POST https://api.dialoguedb.com/api/v1/search \
  -H "Authorization: Bearer $DIALOGUE_DB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "any dietary restrictions or allergies",
    "object": "memory",
    "namespace": "user_456",
    "limit": 5
  }'
```

The memory written in the first session is searchable in the second one. There is no wiring between them and nothing to keep in sync.

### Memory is available on every plan

Memory is included on every plan starting with the free tier. Plan limits apply to total memory count and storage. [See pricing](https://dialoguedb.com/pricing) for specifics.

[Get Started Free](https://app.dialoguedb.com/signup) [Compare Plans](https://dialoguedb.com/pricing)

Any value, any type

## Store strings, numbers, objects, or arrays

One call handles every value type. Whether you're storing a fact, a structured preference, or a list of feature flags, createMemory accepts it as written.

String

"User prefers concise responses"

Number

42

Boolean

true

Object

{ theme: "dark", fontSize: 16 }

Array

\["feature\_a", "feature\_b"\]

Tags categorize memories for filtering. Custom IDs enable deterministic access. Immutable metadata captures context you want to keep but never change.

Isolation in practice

## Namespaces unlock multi-tenant patterns

The namespace parameter is more than an isolation guarantee. It's the primitive that turns one project into a multi-tenant memory system, where each user's data is scoped, queryable, and disposable on its own terms.

- Run a multi-tenant application from one project, with per-user memory automatically scoped.
- List or export every memory for a single user, useful for audits, data-portability requests, or debugging a session.
- Reset a user's AI experience by listing the memories in their namespace and deleting them, with no impact on anyone else.
- Write to a test namespace in development without polluting production memories.
- Honor data deletion requests by clearing memories in one user's namespace, without touching anyone else's history.

### One project, isolated per user

namespace: "user\_456"

"Allergic to peanuts"

"Prefers concise responses"

{ theme: "dark" }

namespace: "user\_789"

"Speaks Spanish and English"

"Works in healthcare"

Namespace isolation is enforced at the database level, not in application-layer filters.

## Frequently asked questions

Common questions about memory in DialogueDB.

How is DialogueDB memory different from most memory tools?

DialogueDB memory differs from most memory tools in two ways. First, it lives in the same database as your conversations, so there is no separate service to integrate or keep in sync. Second, memory is stored directly from what you write, not extracted from conversations automatically, so the contents of your memory are exactly what you intended.

Does DialogueDB extract memories from conversations automatically?

DialogueDB does not extract memories from conversations automatically. Memory is stored directly by calling createMemory with the value you want to persist. This avoids unpredictable extraction results and keeps your memory free of noise.

Can I update a memory after it is created?

A memory can be updated only on its tags after creation. The value, label, and metadata fields are immutable once set. To change a memory’s content, delete the original and create a new one.

How do I retrieve the right memory when a user starts a new session?

To retrieve the right memory for a returning user, call searchMemories with a natural language query scoped to that user’s namespace. Every memory is auto-vectorized at write time, so search works by meaning. For example, the query "dietary restrictions" will find a memory stored as "User is allergic to peanuts."

What happens if I store a memory without a namespace?

A memory stored without a namespace is accessible without a namespace parameter and is not isolated to any user. In a multi-tenant application, always pass a namespace (typically a user ID) so memories stay isolated per user.

Is there a limit to how many memories I can store per user?

Memory count and storage limits apply per plan. Memory is available on every plan including the free tier. See the pricing page for current limits per plan.

Can I delete all memories for a specific user?

To delete all memories for a specific user, list them with listMemories scoped to the user’s namespace and remove each one with deleteMemory. There is no single bulk-delete call for an entire namespace today.

## Memory in your conversation database

Store what matters, retrieve it by meaning, and keep every user's context scoped to them. Start on the free tier.

[Get Started Free](https://app.dialoguedb.com/signup) [Read the Docs](https://docs.dialoguedb.com)
