Memory Model
The core RetainDB concepts for user memory, sessions, agents, tasks, and project knowledge.
RetainDB stores memory as durable, searchable records scoped to your product.
User memory
User memory captures facts, preferences, goals, instructions, and events tied to a user.
Use it for:
- personalization
- support history
- onboarding state
- long-running assistants
- app-specific preferences
Session memory
Session memory narrows recall to a conversation, workflow, or run.
Use it when:
- a conversation should have local continuity
- multiple sessions for one user should stay separate
- a workflow has a clear start and end
Agent memory
Agent memory captures work events, decisions, tool results, constraints, and handoffs.
Use it when multiple agents need shared state across a task.
Project knowledge
Project knowledge is context from sources such as docs, files, repos, and indexed content. Query it through /v1/context.
Search behavior
RetainDB combines durable storage with search so your application can retrieve only the relevant context before a model call. New writes should default to async mode, and fresh searches can use pending visibility where supported.
Next: Scopes.
Was this page useful?
Your feedback helps us make the product easier to ship with.